@seatlayer/core 0.56.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-AQKYUJBX.js → chunk-4BVXDBFE.js} +1 -1
- package/dist/{chunk-6VTTBC5F.js → chunk-66HGMU7D.js} +1 -1
- package/dist/chunk-GHJUDU3U.js +1 -0
- package/dist/{chunk-55NOSZK5.js → chunk-IRFG5DVH.js} +1 -1
- package/dist/{chunk-PXWKSYCK.js → chunk-N4CBOQFB.js} +1 -1
- package/dist/{chunk-7PT7OQUO.js → chunk-PMU3VPNK.js} +1 -1
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.cjs +1 -1
- package/dist/core/layout/index.js +1 -1
- package/dist/core/sections/index.cjs +1 -1
- package/dist/core/sections/index.js +1 -1
- package/dist/{de-WPX4D3SY.js → de-JS2HQ675.js} +1 -1
- package/dist/{es-6KAJQVVX.js → es-XJUREIJL.js} +1 -1
- package/dist/{fr-5DTMRBN5.js → fr-CAT46QLZ.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +26 -9
- package/dist/index.d.ts +26 -9
- package/dist/index.js +1 -1
- package/dist/view3d/index.cjs +25 -20
- package/dist/view3d/index.js +18 -13
- package/package.json +1 -1
- package/dist/chunk-VDZ24QVV.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as Mi,e as ht,g as Pi,h as pe,i as J,j as xi,k as Ri,l as dt,m as Ei}from"./chunk-6VTTBC5F.js";import{a as Wn,b as Kn}from"./chunk-HHM3PB66.js";import{a as Gi,b as Hi,d as Wt,f as Ni,g as pt,i as Vi,k as zi}from"./chunk-7PT7OQUO.js";import{a as he,b as Ce,c as Ti,d as Ii,e as Me,f as de,l as fe,m as ie,p as Vt,q as lt,s as Ci,t as ct,u as Y,v as zt}from"./chunk-VI2CLV3Y.js";import{b as Pe,f as Ai,g as Fi,m as Di,x as Oi,y as _i}from"./chunk-DNGP2HDT.js";import{a as Fn,b as Dn,c as On,d as _n,e as Gn,f as _t,g as Hn,h as rt,i as Nn,j as wi,k as Gt,l as Vn,m as zn,n as ki}from"./chunk-AQKYUJBX.js";import{a as ln,b as cn,c as hn,d as dn,e as Ot,f as pn,g as un,h as fn,i as yn,j as gn,k as mn,m as Ve,p as Bi}from"./chunk-6XJN4REG.js";import{Aa as Bn,Ba as bi,Ca as Si,Da as An,Ea as He,Fa as vi,V as yi,W as Ie,X as bn,da as q,ea as gi,fa as st,ja as Sn,ka as vn,la as wn,ma as kn,na as Ln,oa as Tn,pa as In,qa as Cn,ra as Mn,s as ui,sa as Pn,ta as j,u as fi,ua as ot,va as xn,w as V,wa as Rn,xa as nt,ya as En,za as mi}from"./chunk-VDZ24QVV.js";import{B as te,h as Ht,s as Ne,t as ue,u as ce,v as at,w as Nt,y as Li}from"./chunk-CXF32VPG.js";import{Konva as Mt}from"konva/lib/Core";import{Stage as Go}from"konva/lib/Stage";import{Layer as ti}from"konva/lib/Layer";import{Group as we}from"konva/lib/Group";import{Circle as ge}from"konva/lib/shapes/Circle";import{Rect as De}from"konva/lib/shapes/Rect";import{Line as Je}from"konva/lib/shapes/Line";import{Text as ke}from"konva/lib/shapes/Text";import{Path as Ho}from"konva/lib/shapes/Path";import{Image as No}from"konva/lib/shapes/Image";import{Shape as Vo}from"konva/lib/Shape";var Ki;function $i(s){Ki=s}function so(s){return typeof s=="number"?s:s instanceof Date?s.getTime():Date.parse(s)}var Wi=new Map;function oo(s,e){let t=s??Ki,i=`${t??""}|${JSON.stringify(e)}`,o=Wi.get(i);return o||(o=new Intl.DateTimeFormat(t,e),Wi.set(i,o)),o}var no={dateStyle:"medium",timeStyle:"short"};function Xi(s,e={}){let{locale:t,...i}=e,o=so(s);if(!Number.isFinite(o))return"";let n=Object.keys(i).length?i:no;return oo(t,n).format(o)}var Xn="USD",qn=["USD","EUR","GBP","CAD","AUD","INR","AED","SGD","JPY","CHF","SEK","NZD","ZAR","MXN","BRL"],Yi;function Ui(s){Yi=s}var qi=new Map;function ut(s,e,t,i){let o=i??Yi,n=`${o??""}|${s}|${e??"auto"}|${t??"auto"}`,r=qi.get(n);return r||(r=new Intl.NumberFormat(o,{style:"currency",currency:s,minimumFractionDigits:e,maximumFractionDigits:t}),qi.set(n,r)),r}function Kt(s,e="USD",t,i){if(typeof t=="object"){let n=t;try{return ut(e,n.minimumFractionDigits,n.maximumFractionDigits,n.locale).format(s)}catch(r){if(n.fallback)return n.fallback(s,e);throw r}}let o=t??(Number.isInteger(s)?0:void 0);return ut(e,o,o,i).format(s)}function ro(s="USD"){try{return ut(s,void 0,void 0).resolvedOptions().maximumFractionDigits??2}catch{return 2}}function ao(s,e="USD"){return s/10**ro(e)}function Yn(s,e="USD",t){return Kt(ao(s,e),e,void 0,t)}function Un(s="USD"){return ut(s,0,0).formatToParts(0).find(t=>t.type==="currency")?.value??s}var ze={"common.cancel":"Cancel","common.close":"Close","common.done":"Done","common.copied":"\u2713 Copied","picker.holdExpired":"Your hold expired \u2014 the seats were released. Pick again.","picker.poweredBy":"Powered by SeatLayer","picker.testMode":"TEST MODE","picker.orphanHint":"This leaves a single seat stranded \u2014 consider shifting one seat over.","picker.companionRequiresWheelchair":"Requires the adjacent wheelchair place","picker.companionPairRequired":"Select the adjacent wheelchair place with each companion ticket.","map.aria":"Seating map. Use arrow keys to move between seats, Enter to select.","map.seatsLeft":"{count} LEFT","map.soldOut":"SOLD OUT","map.fromPrice":"FROM {price}","map.statusHeld":"On hold","map.statusTaken":"Taken","picker.floor":"Floor","picker.zoomLevel":"Zoom level","picker.rungTip.zones":"Venue overview \u2014 groups of sections such as North Stand or VIP","picker.rungTip.sections":"Section blocks \u2014 sold-out and nearly-gone sections shade to show availability at a glance","picker.rungTip.seats":"Individual seats \u2014 blocks melt into dots","picker.rungLabel.zones":"ZONES","picker.rungLabel.sections":"SECTIONS","picker.rungLabel.seats":"SEATS","picker.sectionSummaryAria":"{label} section summary","picker.closeSectionSummary":"Close section summary","picker.seatsLeftInSection.one":"{count} seat left","picker.seatsLeftInSection.other":"{count} seats left","picker.overview":"Overview","picker.entrance":"Entrance","picker.tapSeatHint":"Tap any seat to check its view","picker.ticketTierFor":"Ticket tier for {label}","picker.viewFromSeat":"View from seat {label}","picker.real360":"REAL 360\xB0","picker.preview":"PREVIEW","picker.sightline":"\u2248 {m} m to stage","picker.panorama360":"360\xB0 venue photo","picker.illustrationCaption":"illustration \xB7 \u2248 {m} m from stage","picker.restrictedView":"Restricted view","picker.obstructedView":"Obstructed view","picker.premiumSeat":"Premium seat","picker.hideLimitedView":"Hide limited-view seats","picker.bestSeatsPremium":"Best seats","picker.premiumFallbackNote":"No premium block of {count} \u2014 showing best overall","picker.loading3d":"Building the 3D venue\u2026","picker.unavailable3d":"3D could not start. The seat map is still available.","picker.jumpToSection":"Jump to section","picker.salesClosedPill":"Sales are closed","picker.salesClosedCopy":"Ticket sales for this event have ended.","picker.salesClosedCta":"Sales closed","picker.salesClosedToast":"Sales are closed for this event.","picker.holdReassurance":"Yours for {time} \u2014 you won\u2019t be charged yet.","picker.securingSeats":"Securing your seats\u2026","picker.openingCheckout":"Opening secure checkout\u2026","picker.peekSecured":"\u2713 {count} secured \xB7 {total} \u2014 you won\u2019t be charged yet","picker.priceHint":"Colours on the map are ticket types \u2014 tap one below to show just those seats.","picker.findTogetherInstead":"Find seats together instead","picker.keepMyPicks":"Keep my picks","picker.accessExpiredBody":"Sign in again, or reload the page, to keep browsing these seats. Anything you are already holding stays yours.","picker.accessExpiredTitle":"Your access session has ended","picker.accessInvalidBody":"You can still book anything shown as available. Contact whoever sent you here for access to the rest.","picker.accessInvalidTitle":"We couldn\u2019t verify your access","picker.accessPausedBody":"The organizer has paused this selection. Try again in a few minutes.","picker.accessPausedTitle":"These seats are on hold right now","picker.accessRetry":"Try again","picker.accessRevokedBody":"Ask whoever sent you here for a new link to keep booking these seats.","picker.accessRevokedTitle":"This access link is no longer active","picker.accessiblePhysicalSeat":"Accessible physical seat","picker.addTime":"Add time","picker.addingEllipsis":"Adding\u2026","picker.allLevels":"All levels","picker.allPlacesBookedTogether":"All {count} places are booked together as one exclusive table.","picker.allPrices":"All prices","picker.allSeats":"All seats","picker.allSetTitle":"You\u2019re all set","picker.anyTicketType":"Any ticket type","picker.anyVenueZone":"Any venue zone","picker.areas":"Areas","picker.available":"Available","picker.backToMap":"Back to map","picker.backToVenue":"Back to venue","picker.bestSeatsStar":"\u2726 Best seats","picker.booth":"Booth","picker.capacityGuests":"{count} guests","picker.change":"Change","picker.chartDerivedModel":"Chart-derived model","picker.chartDerivedSeatEye":"Live 3D \xB7 chart-derived seat-eye \xB7 not surveyed","picker.checkConnection":"Check your connection and try again.","picker.checkoutCouldNotBeOpened":"Checkout could not be opened. Your seats are still held \u2014 please try again.","picker.chooseAnotherToCompare":"Choose another seat to compare.","picker.chooseGuestsCopy":"Choose how many guests will sit together. This table is held exclusively for your party.","picker.chooseMinMaxGuests":"Choose {min}\u2013{max} guests","picker.clearSavedSeatComparison":"Clear saved seat comparison","picker.close":"Close","picker.closeSeatStatus":"Close seat status","picker.closestGroupChosenInstantly":"Closest available group, chosen instantly.","picker.collapseTicketPanel":"Collapse ticket panel","picker.compareCount":"Compare {count}","picker.compareWithSaved":"Compare with saved","picker.confirmOrCancelSeat":"Confirm or cancel this seat","picker.confirmSeatLabel":"Confirm seat {label}","picker.confirmYourTable":"Confirm your table","picker.confirmedAndOnWay":"confirmed. A confirmation is on its way.","picker.continue":"Continue","picker.continueToCheckout":"Continue to checkout","picker.couldNotAddMoreTime":"Couldn\u2019t add more time \u2014 please head to checkout now.","picker.couldNotFindSeatsTogether":"We couldn\u2019t find {count} seats together. Try fewer seats or another ticket type.","picker.couldNotReleaseTickets":"Couldn\u2019t release your tickets. Your hold is unchanged.","picker.couldNotRemoveLabel":"Couldn\u2019t remove {label}. Your hold is unchanged.","picker.currentOffer":"Current offer","picker.currentTicketOffer":"Current ticket offer","picker.dragToLookAround":"Drag to look around \xB7 scroll to zoom","picker.emptyWheelchairSpace":"Empty wheelchair space","picker.exitFullScreen":"Exit full screen","picker.fewer":"Fewer","picker.fewerGuests":"Fewer guests","picker.fewerSeats":"Fewer seats","picker.filterAndFocusByPrice":"Filter and focus seats by price","picker.filters":"Filters","picker.findBestSeatsCount.one":"Find {count} best seat","picker.findBestSeatsCount.other":"Find {count} best seats","picker.findBestSeatsTogether":"Find the best seats together","picker.findNewSeats":"Find new seats","picker.findingBestSeats":"Finding the best seats\u2026","picker.findingEllipsis":"Finding\u2026","picker.fitToScreen":"Fit to screen","picker.flat2dMap":"Flat 2D map","picker.flexiblePartyTypeWord":"Flexible party \xB7 {typeWord}","picker.fullScreen":"Full screen","picker.generalAdmission":"General admission","picker.guestCountCouldNotBeSecured":"That guest count could not be secured. Your current table hold is unchanged.","picker.guestCountNoLongerAvailable":"That guest count is no longer available. Your current hold is unchanged.","picker.guests":"Guests","picker.guestsCount":"{count} guests","picker.guestsCountEdit":"{count} guests \xB7 Edit","picker.held":"Held","picker.heldForYou":"Held for you","picker.heldSeatExplanation":"Another buyer is holding this seat. It may become available again.","picker.heldTicketsReleased":"Held tickets released. Choose your new seats.","picker.heldTicketsRestored":"Your held tickets have been restored.","picker.hidePanel":"Hide panel","picker.hideTicketPanel":"Hide the ticket panel","picker.holdSeatsAndCheckout":"Hold seats & checkout","picker.howOfferWorks":"How the {name} offer works","picker.interactive3dVenueView":"Interactive 3D venue view","picker.keepMine":"Keep mine","picker.labelNoLongerAvailable":"{label} is no longer available.","picker.labelRemoved":"{label} removed.","picker.labelRemovedFromHold":"{label} removed from your hold.","picker.labelRestored":"{label} restored.","picker.labelsNoLongerAvailable.one":"{labels} is no longer available. Choose another seat.","picker.labelsNoLongerAvailable.other":"{labels} are no longer available. Choose another group.","picker.leftCount.one":"{count} left","picker.leftCount.other":"{count} left","picker.levelNumber":"Level {number}","picker.levels":"Levels","picker.liveAvailability":"Live availability \u2014 seats update in real time","picker.loadingSeatMap":"Loading seat map\u2026","picker.lookAroundLive3d":"Look around in live 3D","picker.manualTicketsRemovedNote":"Your manually selected tickets will be removed only after a new group is secured.","picker.map":"Map","picker.mapDidNotLoad":"The seat map didn\u2019t load","picker.maxTicketsForOrder":"You can select up to {count} tickets for this order.","picker.selectExactMore":"Select {count} more","picker.selectExactCount":"Select exactly {count} tickets","picker.minToMaxGuests":"{min} to {max} guests","picker.more":"More","picker.moreGuests":"More guests","picker.moreSeats":"More seats","picker.moreSelectedCount":"{count} more selected","picker.moreTimeAdded":"More time added \u2014 your seats are still held.","picker.noAccessibilityMetadata":"No accessibility metadata supplied","picker.noAuthoredRestriction":"No organizer-authored restriction","picker.noSeatsSelected":"No seats selected","picker.notChargedYet":"You won\u2019t be charged yet.","picker.notForSale":"Not for sale","picker.notForSaleExplanation":"This seat is not included in the current sale.","picker.numberOfGuests":"Number of guests","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.","picker.offerDetailUpcoming":"Tickets are available at their normal price now. This scheduled offer will apply automatically to eligible seats when it starts.","picker.offerRemainingAvailable":"{count} available","picker.offerStarts":"starts {time}","picker.offerUntil":"until {time}","picker.oneSeatSaved":"1 seat saved","picker.oneSeatSavedChooseAnother":"One seat saved; choose another to compare","picker.openAuthored360":"Open venue 360\xB0","picker.openComparison":"Open comparison","picker.openComparisonOfSeats":"Open comparison of {count} seats","picker.openTicketPanel":"Open ticket panel","picker.peekFromPrice":"From {price}","picker.peekTicketsTotal.one":"{count} ticket \xB7 {total}","picker.peekTicketsTotal.other":"{count} tickets \xB7 {total}","picker.perGuestPrice":"{price} per guest","picker.pickYourSeats":"Pick your seats","picker.preferredTicketType":"Preferred ticket type","picker.preferredVenueZone":"Preferred venue zone","picker.priceNotSupplied":"Price not supplied","picker.releaseHeldTickets":"Release held tickets and choose different seats","picker.releasingEllipsis":"Releasing\u2026","picker.removeHeldTicketLabel":"Remove held ticket {label}","picker.removeSeatLabel":"Remove {label}","picker.removeTicketsUntilOrFewer":"Remove tickets until your order has {count} or fewer.","picker.replaceCurrentChoices":"Replace your current choices?","picker.review":"Review","picker.row":"Row","picker.rowLabel":"Row {label}","picker.saveToCompare":"Save to compare","picker.savedForComparison":"Saved for comparison","picker.savedSeatComparison":"Saved seat comparison","picker.scheduledOffer":"Scheduled offer","picker.seat":"Seat","picker.seatCount.one":"{count} seat","picker.seatCount.other":"{count} seats","picker.seatJustTakenByAnother":"Seat {label} was just taken by another buyer.","picker.seatLabel":"Seat {label}","picker.seatNoLongerAvailable":"That seat is no longer available.","picker.seatNoLongerYours":"Some seats are no longer available to you. They have been removed from your order.","picker.seatNumberLower":"seat {label}","picker.seatSalesClosedForEvent":"Seat sales have closed for this event.","picker.seatSelection":"Seat selection","picker.seatStatusLegend":"Seat status legend","picker.seatTaken":"Someone else took a seat you had picked. It has been removed from your order.","picker.seatsHeldForNeedMoreTime":"Your seats are held for <b>{time}</b>. Need more time?","picker.seatsJustTaken":"One or more seats were just taken. Please pick again.","picker.seatsJustTakenInCategory.one":"{count} seat just taken in {label} \xB7 {left} left","picker.seatsJustTakenInCategory.other":"{count} seats just taken in {label} \xB7 {left} left","picker.seatsNoLongerAvailableTryAnother":"Those seats are no longer available. Try another quantity or ticket type.","picker.seatsSecured":"Seats secured","picker.seatsSelectedCount.one":"{count} selected","picker.seatsSelectedCount.other":"{count} selected","picker.section":"Section","picker.secureMore":"Secure more","picker.secureMoreAndCheckout":"Secure {count} more & checkout","picker.securedCount":"{count} secured","picker.seeItIn3d":"See it in 3D","picker.select":"Select","picker.selectSeats":"Select seats","picker.selectTable":"Select table","picker.selectWholeTable":"Select whole table","picker.selected":"Selected","picker.selectingEllipsis":"Selecting\u2026","picker.showAllSeats":"Show all seats","picker.showAllTicketTypes":"Show all {count} ticket types","picker.showFewer":"Show fewer","picker.showLabelSeatsOnMap":"Show {label} seats on the map","picker.showTicketPanel":"Show the ticket panel","picker.sold":"Sold","picker.soldOutCopy":"No reserved seats are currently available for this event.","picker.soldOutEyebrow":"This event","picker.soldOutTitle":"Sold out","picker.soldSeatExplanation":"This seat has already been booked.","picker.statusAvailable":"available","picker.statusOnHold":"on hold","picker.statusTaken2":"taken","picker.table":"Table","picker.tableCapacity":"Table capacity","picker.tableUpdatedForGuests":"{label} updated for {count} guests.","picker.temporarilyHeld":"Temporarily held","picker.ticketPrices":"Ticket prices","picker.ticketTypeSoldOut":"That ticket type is sold out. Try another ticket type.","picker.tickets":"Tickets","picker.ticketsCount.one":"{count} ticket","picker.ticketsCount.other":"{count} tickets","picker.toggleColorblindColors":"Toggle colorblind-friendly colors","picker.total":"Total","picker.trayHintTapOrBest":"Tap a seat on the map, or let us pick the best available for you.","picker.trayHintTapOrStanding":"Tap a seat on the map \u2014 or grab standing tickets below.","picker.undo":"Undo","picker.upcomingTicketOffer":"Upcoming ticket offer","picker.updateTable":"Update table","picker.updatingEllipsis":"Updating\u2026","picker.venueView":"Venue view","picker.viewFromHere":"View from here","picker.viewFromThisSeat":"View from this seat","picker.wholeTypeWord":"Whole {typeWord}","picker.willChooseClosestGroup":"We\u2019ll choose the closest available group for you.","picker.willFindSeatsTogether":"We\u2019ll find {count} seats together.","picker.yourSeats":"Your seats","picker.zoomIn":"Zoom in","picker.zoomOut":"Zoom out","picker.closeVenueNav":"Close","picker.levelsAndAreas":"Levels & areas"};var lo=["en","es","de","fr"],xe={en:ze},ft={},se="en";function Zi(s,e){for(let t of[s,e,typeof navigator<"u"?navigator.language:null]){if(!t)continue;let i=t.toLowerCase().split("-")[0];if(lo.includes(i))return i}return"en"}function tr(){return se}function yt(s,e){e&&(xe[s]={...xe[s],...e}),se=xe[s]?s:"en",Ui(se),$i(se),typeof document<"u"&&(document.documentElement.lang=se)}function ir(s){ft=s}var Qi=/\{(\w+)\}/g;function oe(s,e){let t=ft[s]??xe[se]?.[s]??ze[s]??s;return e?t.replace(Qi,(i,o)=>String(e[o]??`{${o}}`)):t}function sr(s,e,t){let i=new Intl.PluralRules(se).select(e);return(ft[`${s}.${i}`]??xe[se]?.[`${s}.${i}`]??ze[`${s}.${i}`]??ft[`${s}.other`]??xe[se]?.[`${s}.other`]??ze[`${s}.other`]??s).replace(Qi,(r,a)=>String({count:e,...t}[a]??`{${a}}`))}function or(s,e){return Xi(s,{...e??{dateStyle:"medium",timeStyle:"short"},locale:se})}var We=9,Se=.9,ee=.55*Se,ne=de/he,Ke=4,gt=14,ji=10,Ji=14,ye=.45*Se,Re=.9*Se,es=Math.max(Se*1.1,Re),ve=8,ts=700,U=2,is=de,$e=64,Ee=.55*ye,$t=700,ss=2500,mt=-11.5,Xe=.58,os=320,bt=650,ns=1,St=1,rs=20,Xt=12,as=[.85,.72,.62],vt=18,ls=12,cs=.1;var co="#e5e7eb",ho="#c7cbd1",po="#595f69",uo="#d1d5db",fo="#b8bdc4",yo="#273142",go="#526078",mo="#f1f5f9",bo="#374151",So="#64748b",qt="#111827",hs="#6b7280",wt="#374151",ds="#4b5563",ps="#4b5563",us=.4,qe=.16,fs="rgba(244,246,248,0.06)",kt=["#E69F00","#56B4E9","#009E73","#F0E442","#0072B2","#D55E00","#CC79A7"];function re(s){return Ne(s)?{sectionFill:co,sectionStroke:ho,sectionInk:po,focalFill:uo,focalStroke:fo}:{sectionFill:yo,sectionStroke:go,sectionInk:mo,focalFill:bo,focalStroke:So}}function Be(s,e){let t=s.sectionFill,i=Li(ce(t,.2),.85);switch(e){case"closed":return ce(t,.12);case"sold-out":return i;case"nearly-gone":return at(t,i,.4);default:return t}}function vo(s,e){return s.x<e.x+e.width&&e.x<s.x+s.width&&s.y<e.y+e.height&&e.y<s.y+s.height}var Ae=class{constructor(){this.cells=new Map}insert(e){for(let t of this.keys(e)){let i=this.cells.get(t);i?i.push(e):this.cells.set(t,[e])}}collisionCount(e){let t=new Set,i=0;for(let o of this.keys(e))for(let n of this.cells.get(o)??[])t.has(n)||(t.add(n),vo(e,n)&&i++);return i}keys(e){let t=Math.floor(e.x/$e),i=Math.floor((e.x+Math.max(0,e.width))/$e),o=Math.floor(e.y/$e),n=Math.floor((e.y+Math.max(0,e.height))/$e),r=[];for(let a=o;a<=n;a++)for(let l=t;l<=i;l++)r.push(`${l}:${a}`);return r}};function z(s){let e=Bi(s);return e?{x:e.x,y:e.y,width:Math.max(1,e.width),height:Math.max(1,e.height)}:{x:0,y:0,width:1,height:1}}function Lt(s,e,t,i){let o=i*Math.PI/180,n=Math.cos(o),r=Math.sin(o);return[{x:-e/2,y:-t/2},{x:e/2,y:-t/2},{x:e/2,y:t/2},{x:-e/2,y:t/2}].map(a=>({x:s.x+a.x*n-a.y*r,y:s.y+a.x*r+a.y*n}))}function Tt(s,e,t,i,o,n){let r=i*Math.PI/180,a=Math.cos(r),l=Math.sin(r);for(let c=0;c<=4;c++)for(let h=0;h<=6;h++){let u=e*(h/6-.5),d=t*(c/4-.5),g={x:s.x+u*a-d*l,y:s.y+u*l+d*a};if(!j(g,o,n))return!1}return!0}function ys(s,e,t){let i=z(s),o=[t];for(let r=1;r<12;r+=1)for(let a=1;a<12;a+=1){let l={x:i.x+i.width*a/12,y:i.y+i.height*r/12};j(l,s,e)&&o.push(l)}let n=[s,...e];return o.map(r=>({point:r,room:ui(r,n)})).sort((r,a)=>a.room-r.room).map(r=>r.point).filter((r,a,l)=>a===l.findIndex(c=>Math.abs(c.x-r.x)<1e-6&&Math.abs(c.y-r.y)<1e-6))}import{Group as wo}from"konva/lib/Group";import{Shape as ko}from"konva/lib/Shape";function Lo(s,e,t){let i=e.length,o={x:(e[i-1].x+e[0].x)/2,y:(e[i-1].y+e[0].y)/2};s.moveTo(o.x,o.y);for(let n=0;n<i;n+=1){let r=e[n],a=e[(n+1)%i],l=e[(n-1+i)%i],c=Math.min(Math.hypot(r.x-l.x,r.y-l.y)/2,Math.hypot(a.x-r.x,a.y-r.y)/2);s.arcTo(r.x,r.y,a.x,a.y,Math.max(0,Math.min(t,c)))}s.closePath()}function Fe(s,e,t,i){let o=Ve(s)>0,n=t.cornerRadius&&t.cornerRadius>0?t.cornerRadius:0;return new ko({...t,sceneFunc(r,a){r.beginPath();let l=h=>{if(h.length){if(n>0&&h.length>=3)return Lo(r,h,n);r.moveTo(h[0].x,h[0].y);for(let u=1;u<h.length;u+=1)r.lineTo(h[u].x,h[u].y);r.closePath()}};i?(h=>{r.moveTo(h.start.x,h.start.y);let u=h.start;for(let d of h.segments)d.kind==="line"?r.lineTo(d.end.x,d.end.y):d.kind==="arc"?r.arc(d.center.x,d.center.y,d.radius,Math.atan2(u.y-d.center.y,u.x-d.center.x),Math.atan2(d.end.y-d.center.y,d.end.x-d.center.x),!d.clockwise):r.bezierCurveTo(d.control1.x,d.control1.y,d.control2.x,d.control2.y,d.end.x,d.end.y),u=d.end;r.closePath()})(i):l(s);for(let h of e??[]){let u=Ve(h)>0;l(u===o?[...h].reverse():h)}r.fillStrokeShape(a)},perfectDrawEnabled:!1})}var Ye=class extends wo{constructor(){super(...arguments);this.viewportCulled=!1}setViewportCulled(t){t!==this.viewportCulled&&(this.viewportCulled=t,t||super._clearSelfAndDescendantCache())}isViewportCulled(){return this.viewportCulled}drawScene(...t){return this.viewportCulled?this:super.drawScene(...t)}drawHit(...t){return this.viewportCulled?this:super.drawHit(...t)}_clearSelfAndDescendantCache(t){if(!this.viewportCulled){super._clearSelfAndDescendantCache(t);return}this._clearCache(t)}};var It=class{constructor(e){this.pointers=new Map;this.pinch=null;this.panLast=null;this.panStart=null;this.panStarted=!1;this.movedPx=0;this.lastTapAt=0;this.onPointerDown=e=>{this.host.cancelGlide();let t=this.toLocal(e);if(this.pointers.set(e.pointerId,t),this.pointers.size===1)this.movedPx=0,this.pinch=null,this.panStart=t,this.panStarted=!1,this.host.marqueeShouldStart(e)?(this.host.beginMarquee(t),this.panLast=null):this.panLast=t;else if(this.pointers.size===2){this.host.marqueeActive()&&this.host.cancelMarquee();let[i,o]=[...this.pointers.values()],n={x:(i.x+o.x)/2,y:(i.y+o.y)/2},r=this.host.stage.scaleX();this.pinch={startDist:Math.hypot(o.x-i.x,o.y-i.y),startScale:r,worldMid:{x:(n.x-this.host.stage.x())/r,y:(n.y-this.host.stage.y())/r}},this.panLast=null,this.panStart=null,this.panStarted=!0,this.movedPx=ve+1}};this.onPointerMove=e=>{if(!this.pointers.has(e.pointerId))return;e.preventDefault();let t=this.toLocal(e);if(this.pointers.set(e.pointerId,t),this.pointers.size===1&&this.panStart?this.movedPx=Math.max(this.movedPx,Math.hypot(t.x-this.panStart.x,t.y-this.panStart.y)):this.pointers.size>=2&&(this.movedPx=ve+1),this.host.marqueeActive()){this.host.updateMarquee(t);return}if(this.pinch&&this.pointers.size>=2){this.host.releaseSectionFocusDim();let[i,o]=[...this.pointers.values()],n=Math.hypot(o.x-i.x,o.y-i.y);if(this.pinch.startDist<1)return;let r={x:(i.x+o.x)/2,y:(i.y+o.y)/2},{min:a,max:l}=this.host.zoomBounds(),c=V(this.pinch.startScale*(n/this.pinch.startDist),a,l);this.host.stage.scale({x:c,y:c}),this.host.stage.position({x:r.x-this.pinch.worldMid.x*c,y:r.y-this.pinch.worldMid.y*c}),this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}else if(this.panLast&&this.pointers.size===1){if(!this.panStarted){if(this.movedPx<=ve)return;this.panStarted=!0,this.host.releaseSectionFocusDim()}this.host.stage.position({x:this.host.stage.x()+(t.x-this.panLast.x),y:this.host.stage.y()+(t.y-this.panLast.y)}),this.panLast=t,this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}};this.onPointerEnd=e=>{if(this.host.marqueeActive()){this.host.finishMarquee(),this.pointers.delete(e.pointerId),this.pointers.size===0&&(this.panLast=null);return}this.pointers.delete(e.pointerId),this.pointers.size<2&&(this.pinch=null),this.pointers.size===1&&(this.panLast=[...this.pointers.values()][0],this.panStart=this.panLast,this.panStarted=!0),this.pointers.size===0&&(this.panLast=null,this.panStart=null,this.panStarted=!1,this.host.afterViewChange())};this.host=e}get moved(){return this.movedPx}attach(){let{container:e}=this.host;e.addEventListener("pointerdown",this.onPointerDown,{passive:!1}),e.addEventListener("pointermove",this.onPointerMove,{passive:!1}),e.addEventListener("pointerup",this.onPointerEnd,{passive:!1}),e.addEventListener("pointercancel",this.onPointerEnd,{passive:!1})}detach(){let{container:e}=this.host;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerEnd),e.removeEventListener("pointercancel",this.onPointerEnd)}resetPan(){this.panLast=null,this.panStart=null,this.panStarted=!1}isGhostClick(e){return e.type==="tap"?(this.lastTapAt=performance.now(),!1):this.lastTapAt>0&&performance.now()-this.lastTapAt<ts}toLocal(e){let t=this.host.container.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}};import{Rect as gs}from"konva/lib/shapes/Rect";import{Text as To}from"konva/lib/shapes/Text";function ms(s){let e=s.effScale(),t=s.stage.scaleX(),i={width:s.stage.width(),height:s.stage.height()},o=p=>Math.round(p*100)/100,n=s.seats.map(p=>{let f=s.circleById.get(p.id),b=s.boothLabelById.get(p.id)??s.seatLabelById.get(p.id),m=s.viewMode==="perspective"?s.perspectiveSeatScale.get(p.id)??1:1,v=(s.viewMode==="perspective"?t:e)*m,k=p.kind==="booth"?Ce:he*s.seatLabelScale(p),L=s.viewMode==="perspective"&&p.kind!=="booth"?e*m:v,S=o((b?.fontSize()??k)*L),w=s.worldToScreen(p),x=w.x<0||w.x>i.width||w.y<0||w.y>i.height,I=s.focusedSeatOpacity(p.id,f?.getAbsoluteOpacity()??0),T=s.seatSection.get(p.id),P=!!b?.isVisible()&&I>=.5&&!x,C;P||(I<.5?C="dimmed-or-unavailable":S<de?C="below-minimum-size":x?C="outside-viewport":b?C="renderer-hidden":C="clutter-or-fit");let M=b?b.width()*t*m:0,R=b?b.height()*(s.viewMode==="perspective"&&p.kind==="booth"?t:e)*m:0,A=f instanceof gs?f.width()*t*m:s.seatR*2*v,B=f instanceof gs?f.height()*(s.viewMode==="perspective"?t:e)*m:s.seatR*2*v,W=2*(s.seatR*v+gt),G=f?.fill(),H=b?.fill(),X=s.accessGlyphById.get(p.id),D=X?.getAbsoluteScale();return{seatId:p.id,label:p.label,kind:p.kind==="booth"?"booth":"seat",markerShape:p.kind==="booth"?"booth":p.wheelchairSpaceType==="no-seat"?"square":"circle",...p.wheelchairSpaceType?{wheelchairSpaceType:p.wheelchairSpaceType}:{},categoryKey:p.categoryKey,...T?{sectionId:T.id}:{},...T?.zone?{zoneId:T.zone}:{},status:s.statusById.get(p.id)??"free",selected:s.selection.has(p.id),visible:P,renderedFontPx:S,fill:typeof G=="string"?G:"",ink:typeof H=="string"?H:f?s.seatLabelInk(p,f):s.seatPreferredLabelInk(p),opacity:o(I),...X?{accessibilityMarker:{glyphVisible:X.isVisible(),glyphWidthPx:o(ie*Math.abs(D?.x??0)),emphasizedByFilter:s.accessGlyphFilterEmphasized(p.id)}}:{},pointerTarget:{active:!s.cached&&!s.seatViewportCulled(p.id)&&!!f?.isVisible()&&!!f?.isListening()&&s.isSelectable(p.id),directWidthPx:o(A),directHeightPx:o(B),effectiveMinimumPx:o(Math.max(Math.min(A,B),W))},screenCenter:{x:o(w.x),y:o(w.y)},...P?{screenBox:{x:o(w.x-M/2),y:o(w.y-R/2),width:o(M),height:o(R)}}:{},...C?{hiddenReason:C}:{}}}),r=n.filter(p=>p.visible).length,a=(p,f,b,m,v,k)=>{let L=Lt({x:m.x(),y:m.y()},m.width(),m.height(),m.rotation()),S=k&&k.liftWorld>0?s.isoLiftLocal(k.liftWorld):{x:0,y:0},w=z(L.map(M=>s.worldToScreen({x:M.x+S.x,y:M.y+S.y}))),x=o(m.opacity()),I=m.fill(),T=w.x+w.width<0||w.x>i.width||w.y+w.height<0||w.y>i.height,P=m.isVisible()&&x>.05&&!T,C=k?Tt({x:m.x(),y:m.y()},m.width(),m.height(),m.rotation(),k.outline,k.holes):void 0;return{id:p,kind:f,role:b,label:m.text(),visible:P,renderedFontPx:o(m.fontSize()*t),opacity:x,fill:v,ink:typeof I=="string"?I:"",...C==null?{}:{fitsContainer:C},...P?{screenBox:{x:o(w.x),y:o(w.y),width:o(w.width),height:o(w.height)}}:{}}},l=[...s.sections.map(p=>{let f=p.blockPoly.fill();return a(p.id,"section","name",p.nameLabel,typeof f=="string"?f:p.baseFill,p)}),...s.sections.map(p=>{let f=p.blockPoly.fill();return a(`${p.id}:availability`,"section","availability",p.subLabel,typeof f=="string"?f:p.baseFill,p)}),...s.zones.flatMap(p=>[a(p.id,"zone","name",p.label,p.background),...p.sub?[a(`${p.id}:price`,"zone","price",p.sub,p.background)]:[]])],c=[...s.gaById].map(([p,f])=>{let b=f.points.map(T=>s.worldToScreen(T)),m=Math.min(...b.map(T=>T.x)),v=Math.min(...b.map(T=>T.y)),k=Math.max(...b.map(T=>T.x)),L=Math.max(...b.map(T=>T.y)),S=k<0||m>i.width||L<0||v>i.height,w=o(f.polygon.opacity()),x=w>=.1&&!S,I=f.polygon.fill();return{areaId:p,label:f.label,capacity:f.capacity,categoryKey:f.categoryKey,...f.sectionId?{sectionId:f.sectionId}:{},visible:x,interactive:f.polygon.listening(),opacity:w,fill:typeof I=="string"?I:"",effectiveBackground:f.effectiveBackground,...x?{screenBox:{x:o(m),y:o(v),width:o(k-m),height:o(L-v)}}:{}}}),h=[...s.freeTextById].map(([p,f])=>{let{node:b,background:m,kind:v}=f,k=s.worldToScreen({x:b.x(),y:b.y()}),L=b.width()*t,S=b.height()*e,w=k.x-b.offsetX()*t,x=k.y-b.offsetY()*e,I=o(b.fontSize()*e),T=w+L<0||w>i.width||x+S<0||x>i.height,P=b.isVisible()&&!T,C=b.fill(),M=o(b.getAbsoluteOpacity()),R;return P||(I<de?R="below-minimum-size":T?R="outside-viewport":R="renderer-hidden"),{objectId:f.objectId??p,kind:v,text:b.text(),visible:P,renderedFontPx:I,ink:typeof C=="string"?C:"",background:m,opacity:M,...P?{screenBox:{x:o(w),y:o(x),width:o(L),height:o(S)}}:{},...R?{hiddenReason:R}:{}}}),u=s.labelGroup.find(p=>p.getAttr("rowLabel")===!0).filter(p=>p instanceof To).map(p=>{let f=p.getClientRect({skipShadow:!0,skipStroke:!0}),b=f.x+f.width<0||f.x>i.width||f.y+f.height<0||f.y>i.height,m=p.fill();return{text:p.text(),visible:p.isVisible()&&!b,renderedFontPx:o(p.fontSize()*e),ink:typeof m=="string"?m:"",...b?{}:{screenBox:{x:o(f.x),y:o(f.y),width:o(f.width),height:o(f.height)}}}}),d=re(s.canvasBackground),g=new Set(["normal","nearly-gone","sold-out","closed"].map(p=>Be(d,p).toLowerCase())),y=s.sections.filter(p=>p.blockPoly.opacity()>.05);return{viewport:i,projection:s.viewMode,...s.viewMode==="perspective"?{perspective:{model:"pinhole-exact-seat-anchors",sectionSurfaceModel:"tangent-plane",exactSeatAnchorCount:s.perspectiveSeatProjected.size,depthSorted:!0}}:{},canvasBackground:s.canvasBackground,effectiveScale:o(e),rung:s.getRung(),minimumVisibleLabelPx:de,totalLabelledBookableUnits:n.length,visibleLabels:r,hiddenLabels:n.length-r,totalBookableUnits:n.length+c.reduce((p,f)=>p+f.capacity,0),selectionRingSeatIds:s.overlayLayer.find(".selection-ring").map(p=>String(p.getAttr("seatId")??"")).filter(Boolean),selectionRingColor:s.effSelection,focusedSectionId:s.focusedSectionId,focusBackdropVisible:!!s.focusBackdrop?.isVisible(),categoryFilterKeys:s.categoryFilter?[...s.categoryFilter].sort():null,overviewStyle:{visibleSectionShells:y.length,categoryPaintedSectionShells:y.filter(p=>{let f=p.blockPoly.fill();return typeof f!="string"||!g.has(f.toLowerCase())}).length,visibleCategoryDetailOutlines:s.sections.filter(p=>p.outlinePoly.opacity()>.05).length,visibleSectionRowHints:0,visibleSectionAvailabilityLabels:s.sections.filter(p=>p.subLabel.opacity()>.05).length,visibleSectionGADetails:[...s.gaById.values()].filter(p=>p.sectionId!=null&&p.polygon.opacity()>.05).length},labels:n,gaAreas:c,hierarchyLabels:l,freeTextLabels:h,rowLabels:u}}import{Circle as Io}from"konva/lib/shapes/Circle";import{Ellipse as Co}from"konva/lib/shapes/Ellipse";import{Line as Mo}from"konva/lib/shapes/Line";import{Arrow as Po}from"konva/lib/shapes/Arrow";import{Path as xo}from"konva/lib/shapes/Path";import{Rect as Zt}from"konva/lib/shapes/Rect";import{Text as Qt}from"konva/lib/shapes/Text";import{Image as Ro}from"konva/lib/shapes/Image";function Yt(s,e){return e.length===0?!!s.accessible:!!s.accessibility?.some(t=>e.includes(t))}var Ct="#0b1220",Ue="#ffffff",bs="#0b1220",Ss="#232c40",vs="#8b93a7";function ws(s,e,t="normal"){let i=s?"bold":t;return e?`italic ${i}`.trim():i}var Ut="#0e1117";function ks(s,e){let t=new window.Image,i=new Ro({image:t,x:e.x+e.width/2,y:e.y+e.height/2,offsetX:e.width/2,offsetY:e.height/2,width:e.width,height:e.height,rotation:e.rotation??0,opacity:V(e.opacity??1,0,1),listening:!1,perfectDrawEnabled:!1});e.layer==="foreground"?s.fgDecorGroup.add(i):s.bgLayer.add(i),s.trackAssetImage(t,e.href,`Decor image \u201C${e.label||e.id}\u201D`,()=>{let o=i.getLayer();o&&o.batchDraw()})}function Ls(s,e){if(e.shape==="round")s.bgLayer.add(new Io({x:e.center.x,y:e.center.y,radius:e.radius??40,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,listening:!1}));else{let i=e.width??80,o=e.height??50;s.bgLayer.add(new Zt({x:e.center.x,y:e.center.y,width:i,height:o,offsetX:i/2,offsetY:o/2,rotation:e.rotation,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,cornerRadius:4,listening:!1}))}let t=Ze(s,s.bgLayer,e.displayLabel??e.label,e.center.x,e.center.y,"#cbd5e1",12,!0);s.freeTextById.set(e.id,{node:t,background:"#232c40",kind:"table"})}function Ts(s,e){let t=e.background?.color??s.canvasBackground,i=e.color??s.theme.textColor??vs,o=e.semanticKind==="icon"?Di(e.iconKey):void 0;if(o){let c=e.fontSize/24,h=new xo({x:e.position.x,y:e.position.y,data:o,rotation:e.rotation,scaleX:c,scaleY:c,stroke:Y(t,i),strokeWidth:2,lineCap:"round",lineJoin:"round",fillEnabled:!1,listening:!1,perfectDrawEnabled:!1});s.iconNodeById.set(e.id,{node:h,fontSize:e.fontSize}),s.bgLayer.add(h);return}let n=e.background?.padding??0,r=e.opacity??1,a=new Qt({x:e.position.x,y:e.position.y,text:e.text,fontSize:e.fontSize,rotation:e.rotation,fontStyle:ws(e.bold,e.italic,"600"),fill:Y(t,i),fontFamily:e.fontFamily??s.labelFont(),...e.width!=null?{width:e.width}:{},align:e.align??"left",lineHeight:e.lineHeight??1.2,letterSpacing:e.letterSpacing??0,textDecoration:e.underline?"underline":"",padding:n,opacity:r,wrap:"word",listening:!1,perfectDrawEnabled:!1,name:"buyer-free-text"}),l;e.background&&(l=new Zt({x:e.position.x,y:e.position.y,width:a.width(),height:a.height(),rotation:e.rotation,fill:e.background.color,opacity:r*(e.background.opacity??.9),cornerRadius:e.background.cornerRadius??4,listening:!1,perfectDrawEnabled:!1,name:"buyer-text-background"}),s.bgLayer.add(l)),s.freeTextById.set(e.id,{node:a,backdrop:l,background:t,kind:"free-text"}),s.bgLayer.add(a)}function Is(s,e){let t=e.fill??s.theme.decorFill??Ss,i=e.role==="stage",o=e.role==="reference-focal",n=!!e.role&&!i,r=re(s.canvasBackground),a=o?r.focalFill:t,l=e.kind==="line"||e.kind==="polyline",c=e.stroke?.color??(i?ue(a,.28):o?r.focalStroke:l?"#9aa3b5":void 0),h=e.stroke?.width??(i?1:o||l?2:0),u=e.opacity!=null?V(e.opacity,.1,1):1,d=0,g=0;if(l&&e.points&&e.points.length>=2){d=e.points.reduce((b,m)=>b+m.x,0)/e.points.length,g=e.points.reduce((b,m)=>b+m.y,0)/e.points.length;let y=Oi(e),p=_i(h),f=new Po({points:e.points.flatMap(b=>[b.x,b.y]),closed:!1,x:d,y:g,offsetX:d,offsetY:g,rotation:e.rotation??0,stroke:c,fill:c,strokeWidth:h,opacity:u,lineCap:y.lineCap,lineJoin:y.lineJoin,pointerAtBeginning:y.startEnding==="arrow",pointerAtEnding:y.endEnding==="arrow",...p,listening:!1,name:"buyer-shape-open-path"});f.setAttr("shapeObjectId",e.id),s.bgLayer.add(f)}else if(e.kind==="rect"&&e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null){let y=i?{fillLinearGradientStartPoint:{x:0,y:0},fillLinearGradientEndPoint:{x:0,y:e.height},fillLinearGradientColorStops:[0,ce(a,.3),1,ue(a,.12)]}:{fill:a};d=e.x+e.width/2,g=e.y+e.height/2,s.bgLayer.add(new Zt({x:d,y:g,offsetX:e.width/2,offsetY:e.height/2,rotation:e.rotation??0,width:e.width,height:e.height,...y,stroke:c,strokeWidth:h,cornerRadius:V(e.cornerRadius??4,0,Math.min(e.width,e.height)/2),opacity:u,listening:!1}))}else if(e.kind==="ellipse"&&e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null){d=e.x+e.width/2,g=e.y+e.height/2;let y=i?{fillLinearGradientStartPoint:{x:0,y:-e.height/2},fillLinearGradientEndPoint:{x:0,y:e.height/2},fillLinearGradientColorStops:[0,ce(a,.3),1,ue(a,.12)]}:{fill:a};s.bgLayer.add(new Co({x:d,y:g,rotation:e.rotation??0,radiusX:e.width/2,radiusY:e.height/2,...y,stroke:c,strokeWidth:h,opacity:u,listening:!1}))}else if(e.kind==="polygon"&&e.points&&e.points.length){let y=e.points.flatMap(b=>[b.x,b.y]),p=z(e.points);d=e.points.reduce((b,m)=>b+m.x,0)/e.points.length,g=e.points.reduce((b,m)=>b+m.y,0)/e.points.length;let f=i?{fillLinearGradientStartPoint:{x:0,y:p.y},fillLinearGradientEndPoint:{x:0,y:p.y+p.height},fillLinearGradientColorStops:[0,ce(a,.3),1,ue(a,.12)]}:{fill:a};s.bgLayer.add(new Mo({points:y,closed:!0,x:d,y:g,offsetX:d,offsetY:g,rotation:e.rotation??0,...f,stroke:c,strokeWidth:h,opacity:u,listening:!1}))}if(e.label)if(i){let y=Eo(s,d,g,e.label,a);s.primaryFocalLabels.set(y,22),s.freeTextById.set(e.id,{node:y,background:a,kind:"stage"})}else if(n){let y=Ze(s,s.bgLayer,e.label,d,g,o?Y(a,"#e6e9f0"):"#9aa3b5",o?18:12,!1);o&&s.primaryFocalLabels.set(y,18),s.freeTextById.set(e.id,{node:y,background:a,kind:"decor"})}else{let y=Ze(s,s.bgLayer,e.label,d,g,"#cbd5e1",16,!0);s.freeTextById.set(e.id,{node:y,background:a,kind:"decor"})}}function Eo(s,e,t,i,o){let n=Y(o,"#e6e9f0"),r=new Qt({x:e,y:t,text:i.toUpperCase(),fontSize:22,fontStyle:"700",letterSpacing:4,fontFamily:s.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});return r.offsetX(r.width()/2),r.offsetY(r.height()/2),s.bgLayer.add(r),r}function Cs(s,e){let t=s.catColor.get(e.categoryKey)??"#6e7bff",i=s.canvasBackground,o=Ci(t,i,Me),n=s.theme.textColor??"#e6e9f0",r=Y(o,n),a=Fe(e.points,e.holes,{fill:t,opacity:Me,stroke:t,strokeWidth:1.5,cornerRadius:e.cornerRadius});a.setAttr("gaId",e.id),a.on("click tap",d=>{s.isGhostClick(d)||s.opts.onGAClick?.(e.id)}),a.on("mouseenter",()=>{s.container.style.cursor="pointer"}),a.on("mouseleave",()=>{s.container.style.cursor="default"}),s.bgLayer.add(a);let l=ot(e.points,e.holes),c=s.sections.find(d=>j(l,d.outline,d.holes)),h=Ze(s,s.bgLayer,e.displayLabel??e.label,l.x,l.y-8,r,Ti,!1),u=Ze(s,s.bgLayer,`cap ${e.capacity}`,l.x,l.y+10,r,Ii,!1);s.freeTextById.set(`${e.id}:label`,{objectId:e.id,node:h,background:o,kind:"ga-label",categoryKey:e.categoryKey}),s.freeTextById.set(`${e.id}:capacity`,{objectId:e.id,node:u,background:o,kind:"ga-capacity",categoryKey:e.categoryKey}),s.gaById.set(e.id,{label:e.displayLabel??e.label,capacity:e.capacity,categoryKey:e.categoryKey,points:e.points,polygon:a,effectiveBackground:o,...c?{sectionId:c.logicalId}:{}})}function Ze(s,e,t,i,o,n,r,a){let l=new Qt({x:i,y:o,text:t,fontSize:r,fontStyle:a?"700":"500",fontFamily:s.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});return l.offsetX(l.width()/2),l.offsetY(l.height()/2),e.add(l),l}function Ms(s,e){let t=[],i=e.theme.background??"#0e1117",o=new Map,n=(c,h)=>{let u=o.get(c)??[];u.push(h),o.set(c,u)};for(let c of e.seats){if(c.kind==="booth")continue;let h=c.logicalRowId??c.rowId;n(h,c),h!==c.rowId&&n(c.rowId,c)}let r=c=>c.logicalSeatIndex??Number(c.id.split(":").pop()??0);for(let c of s.objects){if(c.type!=="row")continue;let h=c.segmentedRow?.repeatLabelOnComponents===!0;if(c.segmentedRow&&!h&&c.segmentedRow.componentIndex!==0)continue;let u=h?c.labelPresentation:c.segmentedRow?.labelPresentation??c.labelPresentation;if(u?.visible===!1||u?.positionPreset==="none")continue;let d=c.segmentedRow&&!h?c.segmentedRow.groupId:c.id,g=(o.get(d)??[]).slice().sort((P,C)=>r(P)-r(C));if(!g.length)continue;let y=g[0],p=g[g.length-1],f=u?.labelStyle,b=Y(i,f?.color??e.theme.rowLabelColor??e.theme.textColor??"#e6e9f0",ct),m=f?.size??12,v=u?.rotation??0,k=c.segmentedRow?.displayLabel??c.displayLabel??c.label,L=e.objectFilteredOut(c)?.15:1,S=e.seatSection.get(y.id),w=S?[...new Set([S.id,S.logicalId,S.zone].filter(P=>!!P))]:void 0,x=(P,C,M)=>t.push({text:k,x:P,y:C,rotation:v,fontSize:m,ink:b,opacity:L,...w?.length?{focusKeys:w}:{},...M?{automaticAway:M}:{}});if(u?.position){x(u.position.x,u.position.y);continue}let I=e.seatR+12,T=u?.positionPreset??"start";if(T==="start"||T==="both"){let P=c.rotation*Math.PI/180,C={x:-Math.cos(P),y:-Math.sin(P)};x(y.x+C.x*I,y.y+C.y*I,C)}if(T==="end"||T==="both"){let P=(c.rotation+c.curve)*Math.PI/180,C={x:Math.cos(P),y:Math.sin(P)};x(p.x+C.x*I,p.y+C.y*I,C)}}let a=(e.seatR+12)*2.2,l=[];for(let c of t){let h=l.find(u=>u.text===c.text&&Math.hypot(u.x-c.x,u.y-c.y)<=a);if(h){h.x=(h.x+c.x)/2,h.y=(h.y+c.y)/2;continue}l.push(c)}return l}function jt(s,e,t=U){let i=s.rotation()*Math.PI/180,o=Math.abs(Math.cos(i)),n=Math.abs(Math.sin(i)),r=(s.width()*o+s.height()*n)/2+t,a=(s.width()*n+s.height()*o)/2+t;return{x:e.x-r,y:e.y-a,width:r*2,height:a*2}}function Ps(s,e,t,i){let o={x:e.x,y:e.y},n=e.automaticAway;if(!n)return o;let r={x:-n.y,y:n.x},a=Math.max(7,Math.min(16,e.fontSize*.75)),l=[{x:0,y:0}];for(let d=1;d<=4;d++){let g=a*d;l.push({x:r.x*g,y:r.y*g},{x:-r.x*g,y:-r.y*g},{x:n.x*g,y:n.y*g},{x:(n.x+r.x)*g,y:(n.y+r.y)*g},{x:(n.x-r.x)*g,y:(n.y-r.y)*g})}let c=o,h=1/0,u=1/0;for(let d of l){let g={x:o.x+d.x,y:o.y+d.y},y=jt(s,g),f=(i?ht(i,y,{mode:"overlap"}).length:0)+t.collisionCount(y),b=Math.hypot(d.x,d.y);if((f<h||f===h&&b<u)&&(c=g,h=f,u=b),f===0)break}return c}function xs(s,e){let t=s.sectionHeat.get(e.id)??s.sectionHeat.get(e.logicalId)??(e.zone?s.sectionHeat.get(e.zone):void 0);if(t==null||t<=0){e.outlinePoly.stroke(te(e.outlineTint,.5)),e.outlinePoly.fill(te(e.outlineTint,.08)),e.outlinePoly.strokeWidth(1.75),e.outlinePoly.shadowOpacity(0);return}let i=at("#f4b740","#ef4444",t);e.outlinePoly.stroke(te(i,.72+t*.25)),e.outlinePoly.fill(te(i,.08+t*.13)),e.outlinePoly.strokeWidth(2+t*3.5),e.outlinePoly.shadowColor(i),e.outlinePoly.shadowBlur(4+t*12),e.outlinePoly.shadowOpacity(.25+t*.45)}function Jt(s,e){return s.closedSections.has(e.id)||s.closedSections.has(e.logicalId)||e.zone!=null&&s.closedSections.has(e.zone)}function ei(s,e){return Jt(s,e)?"closed":e.total<=0?"normal":e.free<=0?"sold-out":e.free<=e.total*cs?"nearly-gone":"normal"}function Rs(s,e){let t=ei(s,e);e.blockPoly.fill(Be(re(s.canvasBackground),t)),e.subLabel.text(t==="sold-out"?oe("map.soldOut"):oe("map.seatsLeft",{count:e.free})),e.subLabel.offsetX(e.subLabel.width()/2)}function Es(s,e){let t,i;s.reducedMotion?(t=e<=ye?1:0,i=e<=Ee?1:0):(t=V((Re-e)/(Re-ye),0,1),i=V((ye-e)/(ye-Ee),0,1)),(s.floorOverview||s.focusedSectionId)&&(t=0,i=0);let o=!s.floorOverview&&!s.focusedSectionId&&e<ee;o&&(t=1),s.zones.length||(i=0);let n=s.viewMode==="perspective"&&s.glideInProgress&&s.seatCount>2500;s.seatLayer.opacity(o||n?0:1-t);let r=s.stageScaleX,a=!s.glideInProgress&&(s.lodScale===0||Math.abs(e-s.lodScale)/(s.lodScale||1)>.08);a&&s.setLodScale(e);let l=s.focusedSectionId,c=re(s.canvasBackground),h=V((t-.2)/.8,0,1);for(let d of s.sections){let g=s.hasFocusDimOverlay?1:l&&d.id!==l&&d.logicalId!==l&&d.zone!==l?qe:1;d.outlinePoly.opacity(o?0:(1-t)*g),d.blockPoly.opacity(ns*t*g),d.blockPoly.stroke(c.sectionStroke),d.blockPoly.strokeWidth(St/Math.max(r,1e-4));let y=d.blockPoly.fill(),p=Y(typeof y=="string"?y:d.baseFill,d.preferredInk);d.nameLabel.fill(p),d.subLabel.fill(p),a&&h>.01&&Fo(s,d,r),d.nameLabel.opacity(d.nameLabelFits?h*(1-i)*g:0),d.subLabel.opacity(0)}let u=i*(1-s.isoT);for(let d of s.zones)d.back.opacity(u),d.label.opacity(u),d.sub&&d.sub.opacity(u),a&&Do(s,d,r);if(!s.glideInProgress&&(h>.01||u>.01)){Ao(s,r),Bo(s.sections);for(let d of s.zones){let g=d.label.opacity();d.back.opacity(g),d.sub&&d.sub.opacity(g)}}s.bgLayer.batchDraw()}function Bo(s){let e=new Map;for(let t of s)(e.get(t.logicalId)??e.set(t.logicalId,[]).get(t.logicalId)).push(t);for(let t of e.values()){if(t.length<2)continue;let i=t.filter(o=>o.nameLabel.opacity()>.05).sort((o,n)=>{let r=z(o.outline),a=z(n.outline);return a.width*a.height-r.width*r.height});for(let o of i.slice(1))o.nameLabel.opacity(0)}}function Ao(s,e){let i=[],o=a=>{let l=s.worldToScreen({x:a.x(),y:a.y()}),c=z(Lt({x:0,y:0},a.width()*e,a.height()*e,a.rotation()));return{x:l.x-c.width/2,y:l.y-c.height/2,w:c.width,h:c.height}};for(let a of s.zones){if(a.label.opacity()<=.05)continue;let l=s.worldToScreen(a.anchor),c=a.back.width()*e,h=a.back.height()*e;i.push({node:a.label,tier:0,section:!1,box:{x:l.x-c/2,y:l.y-h/2,w:c,h}})}for(let a of s.sections)a.nameLabel.opacity()>.05&&i.push({node:a.nameLabel,tier:1,section:!0,area:a.labelArea,box:o(a.nameLabel)});if(i.length<2)return;i.sort((a,l)=>a.tier-l.tier||(l.area??0)-(a.area??0)||a.box.y-l.box.y||a.box.x-l.box.x);let n=[],r=a=>n.some(l=>a.x<l.x+l.w+4&&l.x<a.x+a.w+4&&a.y<l.y+l.h+4&&l.y<a.y+a.h+4);for(let a of i){if(!r(a.box)){n.push(a.box);continue}let l=!1;if(a.section){let c=a.node.fontSize(),h=a.node.y();for(let u of as){let d=c*u;if(d*e<Xt)break;Qe(a.node,d,h);let g=o(a.node);if(!r(g)){n.push(g),l=!0;break}}l||Qe(a.node,c,h)}l||a.node.opacity(0)}}function Qe(s,e,t){s.fontSize(Math.max(1,e)),s.offsetX(s.width()/2),s.offsetY(s.height()/2),s.y(t)}function Fo(s,e,t){e.subLabelFits=!1;let i=Math.min(1,Math.max(.66,s.stageWidth/900)),o=rs*e.labelScale*i,n=Math.min(Xt*e.labelScale,o);for(let r=o;r>=n;r-=1)for(let a of[0,-90]){e.nameLabel.rotation(a),Qe(e.nameLabel,r/t,e.nameLabel.y());for(let l of e.labelAnchors){e.nameLabel.position(l);let c=8/t;if(Tt(l,e.nameLabel.width()+c,e.nameLabel.height()+c,a,e.outline,e.holes)){e.nameLabelFits=!0;return}}}e.nameLabel.position(e.centroid),e.nameLabel.rotation(0),e.nameLabelFits=!1}function Do(s,e,t){let i=Math.min(1,Math.max(.66,s.stageWidth/900)),o=10*i/t,n=6*i/t,r=e.sub?3*i/t:0;Qe(e.label,vt*i/t,e.anchor.y),e.sub&&Qe(e.sub,ls*i/t,e.anchor.y);let a=Math.max(e.label.width(),e.sub?.width()??0)+o*2,l=e.label.height()+(e.sub?r+e.sub.height():0)+n*2;e.label.y(e.anchor.y-(e.sub?(r+e.sub.height())/2:0)),e.sub&&e.sub.y(e.anchor.y+(e.label.height()+r)/2),e.back.position(e.anchor),e.back.size({width:a,height:l}),e.back.offset({x:a/2,y:l/2}),e.back.cornerRadius(7*i/t),e.back.strokeWidth(1/t);let c=e.back.getAbsolutePosition(),h=62+l*t/2;if(c.y<h){let u=(h-c.y)/t;e.label.y(e.label.y()+u),e.sub&&e.sub.y(e.sub.y()+u),e.back.y(e.back.y()+u)}}import{Group as Oo}from"konva/lib/Group";import{Line as Bs}from"konva/lib/shapes/Line";import{Rect as _o}from"konva/lib/shapes/Rect";import{Text as As}from"konva/lib/shapes/Text";function Fs(s){let e=s.exportMode?Math.max(s.effScale(),ne):s.effScale(),t=e>=ne;for(let[n,r]of s.boothLabelById){let a=s.circleById.get(n);r.visible(fe(r.fontSize(),e)&&!!a?.isVisible()&&s.focusedSeatOpacity(n,a?.getAbsoluteOpacity()??1)>=.5)}s.labelGroup.destroyChildren(),s.labelLiftGroups.clear(),s.seatLabelById.clear();let i=0;if(t)for(let n of s.visibleSeatCandidates()){if(n.kind==="booth")continue;let r=s.worldToScreen(n);if(r.x<-20||r.x>s.stage.width()+20||r.y<-20||r.y>s.stage.height()+20||s.accessGlyphById.has(n.id)&&s.accessGlyphShouldShow(n.id))continue;let a=s.circleById.get(n.id);if(!a?.isVisible()||s.focusedSeatOpacity(n.id,a.getAbsoluteOpacity())<.5)continue;let l=s.statusById.get(n.id)??"free",c=s.renderedSeatPoint(n),h=s.viewMode==="perspective"?s.perspectiveSeatScale.get(n.id)??1:1;if(l==="booked"||l==="held"&&!s.ownedHold.has(n.id)&&!s.opts.manageMode){let p=new Oo({x:c.x,y:c.y,listening:!1});if(p.scale({x:h,y:h}),l==="held"?(p.add(new _o({x:-4.2,y:-.7,width:8.4,height:6.5,cornerRadius:1.3,stroke:"#ffffff",strokeWidth:1.25,listening:!1})),p.add(new Bs({points:[-2.4,-.8,-2.4,-2.7,-1.2,-4,0,-4.35,1.2,-4,2.4,-2.7,2.4,-.8],stroke:"#ffffff",strokeWidth:1.2,lineCap:"round",lineJoin:"round",listening:!1}))):p.add(new Bs({points:[-4.2,4.2,4.2,-4.2],stroke:"#ffffff",strokeWidth:1.8,lineCap:"round",listening:!1})),s.seatLabelContainer(n.id).add(p),++i>=$t)break;continue}let d=he*s.seatLabelScale(n),g=new As({x:c.x,y:c.y,text:lt(n.displayLabel??n.label),fontSize:d,fontStyle:"600",fontFamily:s.labelFont(),fill:a?s.seatLabelInk(n,a):s.seatPreferredLabelInk(n),listening:!1,perfectDrawEnabled:!1}),y=s.seatR*2-3;if(g.width()>y&&g.fontSize(Math.max(Ke,d*y/g.width())),g.width()>y+.01){g.destroy();continue}if(!fe(g.fontSize(),e)){g.destroy();continue}if(g.offsetX(g.width()/2),g.offsetY(g.height()/2),g.scale({x:h,y:h}),s.seatLabelContainer(n.id).add(g),s.seatLabelById.set(n.id,g),++i>=$t)break}let o=new Ae;for(let{node:n}of s.freeTextById.values()){if(!n.isVisible())continue;let r=n.getClientRect({relativeTo:s.bgLayer,skipShadow:!0,skipStroke:!0});o.insert({x:r.x-U,y:r.y-U,width:r.width+U*2,height:r.height+U*2})}for(let n of s.rowLabelPlan){let r=s.focusedSectionId!=null&&n.focusKeys?.includes(s.focusedSectionId),a=r?Math.max(n.fontSize,is/Math.max(e,1e-4)):n.fontSize;if(!r&&!fe(a,e))continue;let l=s.worldToScreen({x:n.x,y:n.y});if(l.x<-40||l.x>s.stage.width()+40||l.y<-40||l.y>s.stage.height()+40)continue;let c=new As({x:n.x,y:n.y,text:n.text,fontSize:a,fontStyle:"700",fontFamily:s.labelFont(),fill:n.ink,rotation:n.rotation,opacity:n.opacity,shadowColor:"#05070c",shadowBlur:n.ink.toLowerCase()==="#ffffff"?5:0,shadowOpacity:n.ink.toLowerCase()==="#ffffff"?.8:0,shadowForStrokeEnabled:!1,listening:!1,perfectDrawEnabled:!1});c.offsetX(c.width()/2),c.offsetY(c.height()/2);let h=s.resolveAutomaticRowLabelPosition(c,n,o);c.position(h),c.setAttr("rowLabel",!0),o.insert(s.rowLabelBox(c,h)),s.labelGroup.add(c)}s.isoT>0&&s.viewMode!=="perspective"&&s.applyUprightLabels(),s.overlayLayer.batchDraw()}function je(s){return{th:mt*Math.PI/180*s.isoT,sg:1-(1-Xe)*s.isoT}}function Ds(s,e){let{th:t,sg:i}=je(e),o=e.centre,n=s.x-o.x,r=s.y-o.y,a=n*Math.cos(t)-r*Math.sin(t),l=(n*Math.sin(t)+r*Math.cos(t))*i;return{x:o.x+a,y:o.y+l}}function Os(s,e){let{th:t,sg:i}=je(e),o=e.centre,n=s.x-o.x,a=(s.y-o.y)/i,l=n*Math.cos(t)+a*Math.sin(t),c=-n*Math.sin(t)+a*Math.cos(t);return{x:o.x+l,y:o.y+c}}function _s(s,e){let{th:t,sg:i}=je(e),o=s*e.isoT;return{x:-(o/i)*Math.sin(t),y:-(o/i)*Math.cos(t)}}function Gs(s,e,t){let i=Ei(e);s.offset(t),s.position(J(e,t)),s.rotation(i.rotationDeg),s.scale({x:i.scaleX,y:i.scaleY}),s.skewX(i.skewX),s.skewY(0)}function Hs(s){s.position({x:0,y:0}),s.offset({x:0,y:0}),s.scale({x:1,y:1}),s.rotation(0),s.skewX(0),s.skewY(0)}function Ns(s,e){let t=Math.hypot(e.x-s.surfaceFocal.x,e.y-s.surfaceFocal.y),i=Math.max(0,t-s.frontDistanceWorld);return s.liftWorld+i*Math.tan(s.rakeDeg*Math.PI/180)}function Vs(s,e,t){return s.perspectiveAffine?J(s.perspectiveAffine,e):J(t,e)}function zs(s,e){return e?J(e,s):s}function Ws(s,e){let t=0;for(let u of s.seats){let d=Math.max(0,(u.eyeHeightM??q)-q);t=Math.max(t,d*Ie)}for(let u of s.objects)u.type==="section"&&(t=Math.max(t,st(u,{floorBaseHeightM:s.floorBaseHeightMFor(u.id)}).height*Ie));let i=Pi(s.bounds,t),o=dt(i,i.target),n=xi(o);e.seatLocal.clear(),e.seatProjected.clear(),e.seatDepth.clear(),e.seatScale.clear();let r=1/0,a=1/0,l=-1/0,c=-1/0;for(let u of s.seats){let d=Math.max(0,(u.eyeHeightM??q)-q),g=pe(i,u,d*Ie),y={x:g.x,y:g.y};e.seatProjected.set(u.id,y),e.seatLocal.set(u.id,J(n,y)),e.seatDepth.set(u.id,g.depth),e.seatScale.set(u.id,g.scale),r=Math.min(r,g.x),a=Math.min(a,g.y),l=Math.max(l,g.x),c=Math.max(c,g.y)}for(let u of[{x:s.bounds.x,y:s.bounds.y},{x:s.bounds.x+s.bounds.width,y:s.bounds.y},{x:s.bounds.x+s.bounds.width,y:s.bounds.y+s.bounds.height},{x:s.bounds.x,y:s.bounds.y+s.bounds.height}]){let d=pe(i,u,0);r=Math.min(r,d.x),a=Math.min(a,d.y),l=Math.max(l,d.x),c=Math.max(c,d.y)}let h=Math.max(24,s.seatR*3);return{camera:i,baseAffine:o,baseInverse:n,bounds:Number.isFinite(r)?{x:r-h,y:a-h,width:Math.max(1,l-r+h*2),height:Math.max(1,c-a+h*2)}:null}}function Ks(s,e,t){let i=t?[...t].map(o=>s.seatById.get(o)).filter(o=>!!o):e?s.seats:[...s.perspectiveAppliedSeats].map(o=>s.seatById.get(o)).filter(o=>!!o);for(let o of i){if(e&&s.perspectiveAppliedSeats.has(o.id))continue;let n=e?s.perspectiveSeatProjected.get(o.id)??o:o,r=e?s.perspectiveSeatScale.get(o.id)??1:1,a=s.circleById.get(o.id);a?.position(n),a?.scale({x:r,y:r});let l=s.accessRingById.get(o.id);l?.position(n),l?.scale({x:r,y:r});let c=s.accessGlyphById.get(o.id);if(c){let u=s.seatR*1.5/ie;c.position(n),c.scale({x:u*r,y:u*r})}let h=s.boothLabelById.get(o.id);h?.position(n),h?.scale({x:r,y:r}),e&&s.perspectiveAppliedSeats.add(o.id)}e||s.perspectiveAppliedSeats.clear()}function ii(s){return s?.getAttr?.("seatId")??void 0}var et=class et{constructor(e,t={}){this.labelLiftGroups=new Map;this.seats=[];this.seatById=new Map;this.seatIndex=null;this.chartDoc=null;this.activeFloorId="";this.stacked=!1;this.floorOverview=!1;this.circleById=new Map;this.boothDims=new Map;this.boothLabelById=new Map;this.seatLabelById=new Map;this.accessRingById=new Map;this.accessGlyphById=new Map;this.freeTextById=new Map;this.iconNodeById=new Map;this.primaryFocalLabels=new Map;this.gaById=new Map;this.statusById=new Map;this.catColor=new Map;this.theme={};this.canvasBackground=Ut;this.effSelection=Ue;this.colorblind=!1;this.cbHueByKey=new Map;this.rowLabelPlan=[];this.catOrder=[];this.selection=new Set;this.selectionMarkers=new Map;this.ownedHold=new Set;this.selectionFocusId=null;this.hoveredId=null;this.focusedId=null;this.accessFilter=null;this.categoryHighlight=null;this.categoryFilter=null;this.commercialLimitedFilter=!1;this.sections=[];this.zones=[];this.seatSection=new Map;this.unsectionedSeatGroup=null;this.catPrice=new Map;this.dimmedSections=new Set;this.sectionHeat=new Map;this.closedSections=new Set;this.focusedSectionId=null;this.focusBackdrop=null;this.focusDimOverlay=null;this.objectFloor=new Map;this.zoneColor=new Map;this.hasSections=!1;this.hasBoothText=!1;this.isoT=0;this.isoTarget=0;this.isoRaf=0;this.viewMode="flat";this.perspectiveCamera=null;this.perspectiveBaseAffine=null;this.perspectiveBaseInverse=null;this.perspectiveSeatLocal=new Map;this.perspectiveSeatProjected=new Map;this.perspectiveSeatDepth=new Map;this.perspectiveSeatScale=new Map;this.perspectiveAppliedSeats=new Set;this.perspectiveBounds=null;this.isoCentre={x:0,y:0};this.glideRaf=0;this.glideInProgress=!1;this.destroyed=!1;this.lodScale=0;this.reducedMotion=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.fitScale=1;this.seatR=We;this.bounds={x:0,y:0,width:1,height:1};this.cached=!1;this.dpr=Math.min(typeof window<"u"&&window.devicePixelRatio||1,2);this.assetGeneration=0;this.assetPromises=[];this.assetErrors=[];this.assetCancels=new Set;this.rafId=0;this.frames=0;this.lastFpsAt=0;this.recacheTimer=null;this.resizeObs=null;this.viewChangeRaf=0;this.marquee=null;this.marqueeCur=null;this.onKeyDown=e=>{if(this.opts.manageMode){if((e.metaKey||e.ctrlKey)&&(e.key==="a"||e.key==="A")){e.preventDefault(),this.opts.onMarquee?.(this.selectAllSelectable());return}if(e.key==="Escape"&&this.selection.size){e.preventDefault(),this.clearSelection(),this.opts.onMarquee?.([]);return}}let t=e.key==="ArrowLeft"?{x:-1,y:0}:e.key==="ArrowRight"?{x:1,y:0}:e.key==="ArrowUp"?{x:0,y:-1}:e.key==="ArrowDown"?{x:0,y:1}:null;if(t){e.preventDefault();let i=this.focusedId?this.nearestSeat(this.focusedId,t):this.seats[0]?.id??null;i&&this.focusSeat(i);return}if((e.key==="Enter"||e.key===" ")&&this.focusedId){e.preventDefault(),this.toggleSeat(this.focusedId);let i=this.seatById.get(this.focusedId);i&&this.opts.onFocusSeat?.(i)}};this.container=e,this.opts={maxSelection:10,selectableStatuses:["free"],...t},this.exportMode=t.exportMode===!0,this.currency=t.currency;let i=Mt.pixelRatio;this.exportMode&&(this.dpr=1),Mt.pixelRatio=this.dpr,this.stage=new Go({container:e,width:e.clientWidth||1,height:e.clientHeight||1,draggable:!1}),this.gestures=new It(this.pointerHost),this.exportMode||(e.style.touchAction="none",this.gestures.attach(),e.tabIndex<0&&(e.tabIndex=0),e.setAttribute("role","application"),e.getAttribute("aria-label")||e.setAttribute("aria-label",oe("map.aria")),e.addEventListener("keydown",this.onKeyDown)),this.bgLayer=new ti({listening:!this.exportMode}),this.seatLayer=new ti({listening:!this.exportMode}),this.overlayLayer=new ti({listening:!1}),this.labelGroup=new we({listening:!1}),this.overlayLayer.add(this.labelGroup),this.fgDecorGroup=new we({listening:!1}),this.overlayLayer.add(this.fgDecorGroup),this.hoverRing=new ge({radius:We+2,stroke:"#ffffff",strokeWidth:2,opacity:.85,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.hoverRing),this.focusRing=new ge({radius:We+3,stroke:"#38bdf8",strokeWidth:2.5,dash:[4,3],opacity:.95,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.focusRing),this.stage.add(this.bgLayer,this.seatLayer,this.overlayLayer),this.exportMode&&(Mt.pixelRatio=i),this.exportMode||(this.wireInteraction(),this.startFpsLoop()),!this.exportMode&&typeof ResizeObserver<"u"&&(this.resizeObs=new ResizeObserver(()=>this.handleResize()),this.resizeObs.observe(e))}get moved(){return this.gestures.moved}isGhostClick(e){return this.gestures.isGhostClick(e)}get pointerHost(){return{container:this.container,stage:this.stage,cancelGlide:()=>this.cancelGlide(),releaseSectionFocusDim:()=>this.releaseSectionFocusDim(),updateSeatGroupVisibility:()=>this.updateSeatGroupVisibility(),scheduleViewChange:()=>this.scheduleViewChange(),afterViewChange:()=>this.afterViewChange(),zoomBounds:()=>this.zoomBounds(),marqueeActive:()=>!!this.marquee,marqueeShouldStart:e=>!!(this.opts.manageMode&&this.opts.marqueeSelect&&e.pointerType!=="touch"&&e.button===0&&this.getRung()==="seats"),beginMarquee:e=>this.beginMarquee(e),updateMarquee:e=>this.updateMarquee(e),finishMarquee:()=>this.finishMarquee(),cancelMarquee:()=>this.cancelMarquee()}}setChart(e,t){if(e!==this.chartDoc&&(this.stacked=!1,this.floorOverview=!1),this.cancelAssetLoads(),this.chartDoc=e,this.activeFloorId=t?.floorId??nt(e)[0].id,this.objectFloor.clear(),e.floors&&e.floors.length>1)for(let o of e.floors)for(let n of o.objects)this.objectFloor.set(n.id,o.id),n.type==="section"&&n.logicalSectionId&&this.objectFloor.set(n.logicalSectionId,o.id);let i=this.floorView(e);this.focusedId=null,this.focusRing.visible(!1),this.bgLayer.destroyChildren(),this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.seatLayer.clearCache(),this.seatLayer.listening(!this.exportMode),this.seatLayer.destroyChildren(),this.unsectionedSeatGroup=null,this.labelGroup.destroyChildren(),this.labelLiftGroups.clear(),this.fgDecorGroup.destroyChildren(),this.circleById.clear(),this.boothDims.clear(),this.boothLabelById.clear(),this.seatLabelById.clear(),this.accessRingById.clear(),this.accessGlyphById.clear(),this.freeTextById.clear(),this.iconNodeById.clear(),this.primaryFocalLabels.clear(),this.gaById.clear();for(let o of this.selectionMarkers.values())o.destroy();this.selectionMarkers.clear(),this.ownedHold.clear(),this.selectionFocusId=null,this.statusById.clear(),this.selection.clear(),this.seatById.clear(),this.seatIndex=null,this.cached=!1,this.accessFilter=null,this.sections=[],this.zones=[],this.seatSection.clear(),this.focusedSectionId=null,this.focusBackdrop=null,this.catPrice.clear(),this.zoneColor.clear(),this.lodScale=0,this.hasBoothText=!1,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),this.isoT=0,this.isoTarget=0,this.viewMode="flat",this.perspectiveCamera=null,this.perspectiveBaseAffine=null,this.perspectiveBaseInverse=null,this.perspectiveSeatLocal.clear(),this.perspectiveSeatProjected.clear(),this.perspectiveSeatDepth.clear(),this.perspectiveSeatScale.clear(),this.perspectiveAppliedSeats.clear(),this.perspectiveBounds=null,this.resetLayerTransforms(),this.hasSections=i.objects.some(o=>o.type==="section");for(let o of e.zones??[])o.color&&this.zoneColor.set(o.id,o.color);this.seatLayer.opacity(1),this.hoverRing.visible(!1),this.hoveredId=null,this.theme=e.theme??{},this.seatR=V(this.theme.seatScale??1,.7,1.6)*We,this.container.style.background="",this.canvasBackground=this.resolveCanvasBackground(),this.container.style.background=this.canvasBackground,this.effSelection=this.resolveSelectionColor(),this.hoverRing.stroke(this.effSelection),this.hoverRing.radius(this.seatR+2),this.catColor.clear(),this.catPrice.clear(),this.catOrder=e.categories.map(o=>o.key),this.cbHueByKey.clear(),[...this.catOrder].sort().forEach((o,n)=>{this.cbHueByKey.set(o,kt[n%kt.length])});for(let o of e.categories)this.catColor.set(o.key,o.color),typeof o.price=="number"&&this.catPrice.set(o.key,o.price);for(let o of i.objects)o.type==="booth"&&this.boothDims.set(o.id,{width:o.width,height:o.height,rotation:o.rotation,...o.points&&o.points.length>=3?{points:o.points.map(n=>({x:n.x,y:n.y}))}:{}});this.seats=He(i,{floorBaseHeightM:this.stacked||this.floorOverview?0:this.floorBaseHeightMFor()});for(let o of this.seats)this.seatById.set(o.id,o),this.statusById.set(o.id,"free");this.seatIndex=Mi(this.seats,{seatRadius:this.seatR}),this.bounds=vi(i),this.isoCentre={x:this.bounds.x+this.bounds.width/2,y:this.bounds.y+this.bounds.height/2},this.buildPerspectiveProjection(i),this.renderBackground(i),this.unsectionedSeatGroup=new we({listening:!this.exportMode}),this.seatLayer.add(this.unsectionedSeatGroup),this.renderSeats(),this.buildRowLabelPlan(i),this.overlayLayer.add(this.labelGroup),this.overlayLayer.add(this.fgDecorGroup),this.overlayLayer.add(this.hoverRing),this.overlayLayer.add(this.focusRing),this.zoomToFit()}floorView(e){if(!e.floors||!e.floors.length)return{...e,referenceImage:void 0,backgroundImage:Pe(e)};if(this.floorOverview&&e.floors.length>=2)return{...Si(e),referenceImage:void 0,backgroundImage:Pe(e)};if(this.stacked&&e.floors.length>=2)return{...bi(e),referenceImage:void 0,backgroundImage:Pe(e)};let t=e.floors.find(i=>i.id===this.activeFloorId)??e.floors[0];return{...e,objects:t.objects,focalPoint:t.focalPoint,referenceImage:void 0,backgroundImage:Pe(t),floors:void 0}}floorBaseHeightMFor(e){let t=this.chartDoc?.floors;if(!t?.length)return 0;let i=this.stacked&&e?this.objectFloor.get(e)??this.activeFloorId:this.activeFloorId;return t.find(o=>o.id===i)?.baseHeightM??0}setStacked(e){!this.chartDoc||e===this.stacked||!(this.chartDoc.floors&&this.chartDoc.floors.length>=2)||(this.stacked=e,e&&(this.floorOverview=!1),this.setChart(this.chartDoc,{floorId:this.activeFloorId}))}isStacked(){return this.stacked}setFloorOverview(e){!this.chartDoc||e===this.floorOverview||!(this.chartDoc.floors&&this.chartDoc.floors.length>=2)||(this.floorOverview=e,e&&(this.stacked=!1),this.setChart(this.chartDoc,{floorId:this.activeFloorId}))}isFloorOverview(){return this.floorOverview}setActiveFloor(e){!this.chartDoc||e===this.activeFloorId&&!this.floorOverview&&!this.stacked||(this.floorOverview=!1,this.stacked=!1,this.setChart(this.chartDoc,{floorId:e}))}getFloors(){return this.chartDoc?nt(this.chartDoc).map(e=>({id:e.id,name:e.name})):[]}getActiveFloorId(){return this.activeFloorId}setStatus(e,t){let i=!1,o=this.hasSections?new Set:null;for(let n of e){if(!this.statusById.has(n))continue;let r=this.statusById.get(n);this.statusById.set(n,t);let a=this.circleById.get(n);if(a&&(this.paintSeat(a,n),i=!0),o){let l=this.seatSection.get(n);l&&(r==="free"!=(t==="free")&&(l.free+=t==="free"?1:-1),o.add(l))}}if(o&&o.size){for(let n of o)this.refreshSectionFill(n);this.bgLayer.batchDraw()}i&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>ne&&this.updateLabels())}setSeatCategories(e){let t=!1,i=new Set;for(let[n,r]of Object.entries(e)){let a=this.seatById.get(n);if(!a||!this.catColor.has(r)||a.categoryKey===r)continue;a.categoryKey=r;let l=this.circleById.get(n);l&&(this.paintSeat(l,n),t=!0);let c=this.seatSection.get(n);c&&i.add(c)}if(!t)return;let o=new Map((this.chartDoc?nt(this.chartDoc):[]).flatMap(n=>n.objects).filter(n=>n.type==="section").map(n=>[n.id,n]));for(let n of i){if(!o.get(n.id)?.color){let a=new Map;for(let l of n.memberIds){let c=this.seatById.get(l)?.categoryKey;c&&a.set(c,(a.get(c)??0)+1)}n.baseFill=Nt([...a].map(([l,c])=>({hex:this.catColor.get(l)??"#6e7bff",w:c})),"#3a4358")}this.refreshSectionFill(n)}i.size&&this.bgLayer.batchDraw(),this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>ne&&this.updateLabels()}setOwnedHold(e){let t=new Set((e??[]).filter(o=>this.statusById.has(o))),i=new Set([...this.ownedHold,...t]);this.ownedHold=t;for(let o of i){let n=this.circleById.get(o);n&&this.paintSeat(n,o),this.syncSelectionMarker(o)}i.size&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>ne&&this.updateLabels(),this.overlayLayer.batchDraw())}setSelectionFocus(e){let t=e&&this.selection.has(e)?e:null;if(t===this.selectionFocusId)return;let i=this.selectionFocusId;this.selectionFocusId=t;for(let o of this.seats){let n=this.circleById.get(o.id);n&&this.paintSeat(n,o.id)}i&&this.syncSelectionMarker(i),t&&this.syncSelectionMarker(t);for(let[o,n]of this.selectionMarkers)n.opacity(!t||o===t?1:.2);this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}getStatus(e){return this.statusById.get(e)??"free"}getSelection(){let e=[];for(let t of this.selection){let i=this.seatById.get(t);i&&e.push(i)}return e}clearSelection(){let e=[...this.selection];for(let t of e)this.setSelected(t,!1,!0);this.overlayLayer.batchDraw()}setMaxSelection(e){this.opts.maxSelection=Math.max(0,Math.floor(e))}select(e){let t=[];for(let i of e){if(this.selection.has(i)||!this.isSelectable(i))continue;if(this.selection.size>=this.opts.maxSelection){this.opts.onSelectionLimit?.(this.opts.maxSelection);break}this.setSelected(i,!0,!0);let o=this.seatById.get(i);o&&t.push(o)}return t.length&&this.overlayLayer.batchDraw(),t}setManageInteraction(e){this.marquee&&this.cancelMarquee(),this.gestures.resetPan(),this.opts.manageMode=e.manageMode,this.opts.marqueeSelect=e.marqueeSelect,this.opts.selectableStatuses=[...e.selectableStatuses],e.maxSelection!=null&&(this.opts.maxSelection=e.maxSelection);let t=[...this.selection].filter(i=>!this.isSelectable(i));t.length&&this.deselect(t),!e.manageMode&&this.selection.size&&this.clearSelection(),this.container.style.cursor="default",this.overlayLayer.batchDraw()}setSectionHeat(e){this.sectionHeat.clear();for(let[t,i]of Object.entries(e??{}))Number.isFinite(i)&&this.sectionHeat.set(t,Math.max(0,Math.min(1,i)));for(let t of this.sections)this.refreshSectionHeat(t);this.bgLayer.batchDraw()}deselect(e){let t=!1;for(let i of e)this.selection.has(i)&&(this.setSelected(i,!1,!0),t=!0);t&&this.overlayLayer.batchDraw()}selectAllSelectable(){if(!this.opts.manageMode)return[];let e=[];for(let t of this.seats)this.isSelectable(t.id)&&e.push(t.id);return this.selectMany(e)}selectByLabels(e){if(!this.opts.manageMode)return[];let t=new Set(e),i=[];for(let o of this.seats)t.has(o.label)&&this.isSelectable(o.id)&&i.push(o.id);return this.selectMany(i)}setEvidenceSelection(e){return!this.seatById.has(e)||!this.isSelectable(e)?!1:(this.selection.size&&this.clearSelection(),this.setSelected(e,!0),this.overlayLayer.batchDraw(),this.selection.has(e))}getSelectableInSection(e){let t=[],i=new Set;for(let o of this.sections)if(!(o.id!==e&&o.logicalId!==e&&o.zone!==e))for(let n of o.memberIds){if(i.has(n)||(i.add(n),!this.isSelectable(n)))continue;let r=this.seatById.get(n);r&&t.push(r)}return t}selectMany(e){let t=e.filter(o=>!this.selection.has(o));if(!t.length)return this.getSelection();let i=this.selection.size+t.length<=ss;for(let o of t)if(i)this.setSelected(o,!0,!0);else{this.selection.add(o);let n=this.circleById.get(o);n&&this.paintSeat(n,o)}return this.cached||this.seatLayer.batchDraw(),this.overlayLayer.batchDraw(),this.getSelection()}beginMarquee(e){let t=this.screenToWorld(e),i=this.stage.scaleX()||1,o=new De({x:t.x,y:t.y,width:0,height:0,stroke:this.effSelection,strokeWidth:1.5/i,dash:[5/i,4/i],fill:"rgba(110,123,255,0.10)",listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.overlayLayer.add(o),this.marquee={start:t,rect:o},this.marqueeCur=t,this.overlayLayer.batchDraw()}updateMarquee(e){if(!this.marquee)return;let t=this.screenToWorld(e),{start:i,rect:o}=this.marquee;o.setAttrs({x:Math.min(i.x,t.x),y:Math.min(i.y,t.y),width:Math.abs(t.x-i.x),height:Math.abs(t.y-i.y)}),this.marqueeCur=t,this.overlayLayer.batchDraw()}cancelMarquee(){this.marquee&&(this.marquee.rect.destroy(),this.marquee=null,this.marqueeCur=null,this.overlayLayer.batchDraw())}finishMarquee(){let e=this.marquee;if(this.marquee=null,!e)return;e.rect.destroy(),this.overlayLayer.batchDraw();let t=this.marqueeCur??e.start;this.marqueeCur=null;let i=Math.min(e.start.x,t.x),o=Math.max(e.start.x,t.x),n=Math.min(e.start.y,t.y),r=Math.max(e.start.y,t.y),a=this.stage.scaleX()||1;if((o-i)*a<4&&(r-n)*a<4){this.selection.size&&(this.clearSelection(),this.opts.onMarquee?.([]));return}let l=[];for(let c of this.seats){let h=this.renderedSeatPoint(c);h.x<i||h.x>o||h.y<n||h.y>r||this.isSelectable(c.id)&&l.push(c.id)}this.selectMany(l),this.opts.onMarquee?.(this.getSelection())}flashSeat(e,t="#f43f5e"){let i=this.seatById.get(e);if(!i)return;let o=this.renderedSeatPoint(i),n=new ge({x:o.x,y:o.y,radius:this.seatR,stroke:t,strokeWidth:3,opacity:.9,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),r=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e)??1:1;n.scale({x:r,y:r}),this.overlayLayer.add(n);let a=performance.now(),l=620,c=h=>{if(!n.getLayer())return;let u=Math.min(1,(h-a)/l);n.radius(this.seatR*(1+u*1.8)),n.opacity(.9*(1-u)),this.overlayLayer.batchDraw(),u<1?requestAnimationFrame(c):(n.destroy(),this.overlayLayer.batchDraw())};requestAnimationFrame(c)}flashSection(e,t="#22a06b"){let i=this.sections.filter(o=>o.id===e||o.zone===e);if(i.length)for(let o of i){let n=this.viewMode==="perspective"&&o.perspectiveAffine?o.outline.map(d=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,d))):o.outline.map(d=>{let g=o.liftWorld>0?this.isoLiftLocal(o.liftWorld):{x:0,y:0};return{x:d.x+g.x,y:d.y+g.y}}),r=n.reduce((d,g)=>({x:d.x+g.x,y:d.y+g.y}),{x:0,y:0});r.x/=n.length,r.y/=n.length;let a=new Je({x:r.x,y:r.y,points:n.flatMap(d=>[d.x-r.x,d.y-r.y]),closed:!0,stroke:t,strokeWidth:3,strokeScaleEnabled:!1,opacity:.92,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!0,shadowColor:t,shadowBlur:14,shadowOpacity:.7});this.overlayLayer.add(a),this.overlayLayer.batchDraw();let l=()=>{a.getLayer()&&(a.destroy(),this.overlayLayer.batchDraw())};if(this.reducedMotion||typeof document<"u"&&document.hidden){setTimeout(l,520);continue}let c=performance.now(),h=820,u=d=>{if(this.destroyed||!a.getLayer())return;let g=Math.min(1,(d-c)/h),p=1+(1-Math.pow(1-g,3))*.04;a.scale({x:p,y:p}),a.opacity(.92*(1-g)),this.overlayLayer.batchDraw(),g<1?requestAnimationFrame(u):l()};requestAnimationFrame(u)}}nearestSeat(e,t){let i=this.seatById.get(e);if(!i)return null;let o=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(i.id)??i:i,n=null,r=1/0;for(let a of this.seats){if(a.id===e)continue;let l=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(a.id)??a:a,c=l.x-o.x,h=l.y-o.y,u=c*t.x+h*t.y;if(u<=.5)continue;let d=Math.abs(c*t.y-h*t.x),g=u+d*2.5;g<r&&(r=g,n=a.id)}return n}focusSeat(e){let t=this.seatById.get(e);if(!t)return;this.focusedId=e,this.focusRing.radius(this.seatR+3),this.focusRing.position(this.renderedSeatPoint(t));let i=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e)??1:1;this.focusRing.scale({x:i,y:i}),this.focusRing.visible(!0),this.ensureVisible(t),this.overlayLayer.batchDraw(),this.opts.onFocusSeat?.(t)}ensureVisible(e){let t=this.stage.width(),i=this.stage.height(),o=Math.max(this.stage.scaleX(),Se*1.2),n=this.worldToScreen(e),r=70,a=n.x<r||n.x>t-r||n.y<r||n.y>i-r;if(this.stage.scaleX()<o||a){let l=this.renderedSeatPoint(e),c=this.viewMode==="perspective"&&this.perspectiveBaseAffine?J(this.perspectiveBaseAffine,l):this.isoT===0?l:this.isoForward(l);this.stage.scale({x:o,y:o}),this.stage.position({x:t/2-c.x*o,y:i/2-c.y*o}),this.afterViewChange(),this.stage.batchDraw()}}zoomToFit(){let e=this.stage.width(),t=this.stage.height(),i=this.viewMode==="perspective"&&this.perspectiveBounds?this.perspectiveBounds:this.bounds;if(this.fitScale=Math.min(e/i.width,t/i.height)||1,this.opts.portraitFitCrop&&!this.exportMode){let n=e/i.width<=t/i.height,r=i.height*this.fitScale;n&&r<.55*t&&(this.fitScale=Math.min(this.fitScale*1.3,.62*t/i.height))}let o=this.fitScale;this.stage.scale({x:o,y:o}),this.stage.position({x:(e-i.width*o)/2-i.x*o,y:(t-i.height*o)/2-i.y*o}),this.afterViewChange(),this.stage.batchDraw()}refitCurrentView(){if(this.focusedSectionId&&this.sectionBounds(this.focusedSectionId)){this.focusRegion(this.focusedSectionId,{animate:!1});return}this.zoomToFit()}zoomIn(){let e={x:this.stage.width()/2,y:this.stage.height()/2};this.zoomAbout(this.stage.scaleX()*et.ZOOM_STEP,e)}zoomOut(){let e={x:this.stage.width()/2,y:this.stage.height()/2};this.zoomAbout(this.stage.scaleX()/et.ZOOM_STEP,e)}seatCount(){return this.seats.length}bookableCount(){let e=this.seats.length;for(let t of this.gaById.values())e+=t.capacity;return e}worldToScreen(e){let t=this.stage.scaleX(),i=e.id,o=typeof i=="string"?this.seatById.get(i):void 0;if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let a=o?this.perspectiveSeatProjected.get(o.id)??J(this.perspectiveBaseAffine,e):J(this.perspectiveBaseAffine,e);return{x:a.x*t+this.stage.x(),y:a.y*t+this.stage.y()}}let n=o?this.renderedSeatPoint(o):e,r=this.isoT===0?n:this.isoForward(n);return{x:r.x*t+this.stage.x(),y:r.y*t+this.stage.y()}}setAccessibleFilter(e){this.setAccessibilityFilter(e?[]:null)}setAccessibilityFilter(e){let t=e===null?null:[...e];if(!this.sameAccessFilter(t)){this.accessFilter=t,this.updateAccessGlyphs(this.effScale());for(let i of this.seats){let o=this.circleById.get(i.id);o&&this.paintSeat(o,i.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}sameAccessFilter(e){let t=this.accessFilter;return t===null||e===null?t===e:t.length===e.length&&t.every((i,o)=>i===e[o])}setCommercialLimitedFilter(e){if(this.commercialLimitedFilter!==e){this.commercialLimitedFilter=e;for(let t of this.seats){let i=this.circleById.get(t.id);i&&this.paintSeat(i,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setCategoryFilter(e){let t=e===null?null:new Set(e);if(!(t===null&&this.categoryFilter===null||t!==null&&this.categoryFilter!==null&&t.size===this.categoryFilter.size&&[...t].every(o=>this.categoryFilter.has(o)))){this.categoryFilter=t;for(let o of this.seats){let n=this.circleById.get(o.id);n&&this.paintSeat(n,o.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}gaCategoryDimmed(e){return!!(this.categoryHighlight&&e!==this.categoryHighlight||this.categoryFilter&&!this.categoryFilter.has(e))}applyGAFilterState(){this.paintGAStateForView(),this.updateFreeTextVisibility(),this.bgLayer.batchDraw()}paintGAStateForView(){for(let e of this.gaById.values()){let t=!!(this.categoryFilter&&!this.categoryFilter.has(e.categoryKey)),i=!this.exportMode&&e.sectionId!=null&&this.effScale()<ee;e.polygon.opacity(i?0:this.gaCategoryDimmed(e.categoryKey)?Me*.08:Me),e.polygon.listening(!this.exportMode&&!i&&!t)}}focusCategories(e){if(!e?.length){this.focusRegion(this.bounds,{durationMs:bt});return}let t=new Set(e),i=this.seats.filter(c=>!t.has(c.categoryKey)||this.seatInClosedSection(c.id)?!1:(this.statusById.get(c.id)??"free")==="free"||this.ownedHold.has(c.id));if(!i.length)return;let o=1/0,n=-1/0,r=1/0,a=-1/0;for(let c of i){let h=this.renderedSeatPoint(c);o=Math.min(o,h.x),n=Math.max(n,h.x),r=Math.min(r,h.y),a=Math.max(a,h.y)}let l=Math.max(24,this.seatR*3);o-=l,n+=l,r-=l,a+=l,this.focusRegion({x:o,y:r,width:Math.max(40,n-o),height:Math.max(40,a-r)},{durationMs:bt})}setViewMode(e){if(e==="perspective"){if(this.viewMode===e){this.afterViewChange();return}let a=this.viewMode==="isometric"&&this.isoT>0;this.viewMode=e,this.isoTarget=1,this.isoT=1,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),this.applyPerspective(a),this.zoomToFit();return}let t=e==="isometric"?1:0,i=this.viewMode==="perspective";if(this.viewMode=e,this.isoTarget=t,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),i){this.isoT=t,this.applyIso(),this.afterViewChange();return}if(this.reducedMotion){this.isoT=t,this.applyIso(),this.afterViewChange();return}let o=this.isoT;if(o===t){this.applyIso(),this.afterViewChange();return}let n=performance.now(),r=a=>{if(this.destroyed)return;let l=Math.min(1,(a-n)/os),c=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2;this.isoT=o+(this.isoTarget-o)*c,this.applyIso(),this.scheduleViewChange(),l<1?this.isoRaf=requestAnimationFrame(r):(this.isoT=this.isoTarget,this.isoRaf=0,this.applyIso(),this.afterViewChange())};this.isoRaf=requestAnimationFrame(r)}getViewMode(){return this.viewMode}get isoState(){return{isoT:this.isoT,centre:this.isoCentre}}isoParams(){return je(this.isoState)}effScale(){if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let e=Math.hypot(this.perspectiveBaseAffine.a,this.perspectiveBaseAffine.b),t=Math.hypot(this.perspectiveBaseAffine.c,this.perspectiveBaseAffine.d);return this.stage.scaleX()*Math.min(e,t)}return this.stage.scaleX()*(1-(1-Xe)*this.isoT)}isoForward(e){return Ds(e,this.isoState)}isoInverse(e){return Os(e,this.isoState)}buildPerspectiveProjection(e){let t=Ws({seats:this.seats,objects:e.objects,bounds:this.bounds,seatR:this.seatR,floorBaseHeightMFor:i=>this.floorBaseHeightMFor(i)},{seatLocal:this.perspectiveSeatLocal,seatProjected:this.perspectiveSeatProjected,seatDepth:this.perspectiveSeatDepth,seatScale:this.perspectiveSeatScale});this.perspectiveCamera=t.camera,this.perspectiveBaseAffine=t.baseAffine,this.perspectiveBaseInverse=t.baseInverse,this.perspectiveBounds=t.bounds}setContainerAffine(e,t,i){Gs(e,t,i)}resetContainerTransform(e){Hs(e)}sectionSurfaceHeight(e,t){return Ns(e,t)}projectedSectionPoint(e,t){return Vs(e,t,this.perspectiveBaseAffine)}perspectiveLocalPoint(e){return zs(e,this.perspectiveBaseInverse)}isoLiftLocal(e){return _s(e,this.isoState)}resetLayerTransforms(e=!0){let t=e?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let i of t)i.position({x:0,y:0}),i.offset({x:0,y:0}),i.scale({x:1,y:1}),i.rotation(0),i.skewX(0),i.skewY(0)}resetSectionProjection(e=!0){for(let t of this.sections){this.resetContainerTransform(t.rootGroupBg),this.resetContainerTransform(t.liftGroupBg),e&&this.resetContainerTransform(t.liftGroupSeat),t.rootGroupBg.zIndex(t.bgZIndex),e&&t.liftGroupSeat.zIndex(t.seatZIndex);let i=this.labelLiftGroups.get(t.id);i&&e&&this.resetContainerTransform(i),t.perspectiveAffine=void 0,t.perspectiveCorrection=void 0,t.perspectiveDepth=void 0}}get seatAnchorContext(){return{seats:this.seats,seatById:this.seatById,seatR:this.seatR,perspectiveSeatProjected:this.perspectiveSeatProjected,perspectiveSeatScale:this.perspectiveSeatScale,perspectiveAppliedSeats:this.perspectiveAppliedSeats,circleById:this.circleById,accessRingById:this.accessRingById,accessGlyphById:this.accessGlyphById,boothLabelById:this.boothLabelById}}applyExactSeatAnchors(e,t){Ks(this.seatAnchorContext,e,t)}applyPerspective(e=!0){let t=this.perspectiveCamera,i=this.perspectiveBaseAffine,o=this.perspectiveBaseInverse;if(!t||!i||!o)return;let n=this.seats.length>2500&&this.sections.length>0;this.cached&&!n&&(this.seatLayer.clearCache(),this.seatLayer.listening(!0),this.cached=!1),this.resetLayerTransforms(e),this.resetSectionProjection(e);for(let a of[this.bgLayer,this.overlayLayer])this.setContainerAffine(a,i,t.target);this.perspectiveAppliedSeats.clear(),n||this.applyExactSeatAnchors(!0);for(let a of this.sections){let l=u=>this.sectionSurfaceHeight(a,u),c=dt(t,a.centroid,l),h=Ri(o,c);a.perspectiveAffine=c,a.perspectiveCorrection=h,a.perspectiveDepth=pe(t,a.centroid,l(a.centroid)).depth,this.setContainerAffine(a.liftGroupBg,h,a.centroid);for(let u=0;u<a.sideFaces.length;u++){let d=a.outline[u],g=a.outline[(u+1)%a.outline.length],y=this.perspectiveLocalPoint(pe(t,d,0)),p=this.perspectiveLocalPoint(pe(t,g,0)),f=this.perspectiveLocalPoint(pe(t,g,l(g))),b=this.perspectiveLocalPoint(pe(t,d,l(d)));a.sideFaces[u].points([y.x,y.y,p.x,p.y,f.x,f.y,b.x,b.y]),a.sideFaces[u].opacity(.9)}}let r=[...this.sections].sort((a,l)=>(l.perspectiveDepth??0)-(a.perspectiveDepth??0));for(let a of r)a.rootGroupBg.moveToTop(),a.liftGroupSeat.moveToTop();this.unsectionedSeatGroup?.moveToTop(),this.syncSeatOverlayPositions(),n||this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyIso(){if(this.resetSectionProjection(),this.applyExactSeatAnchors(!1),this.isoT===0)this.resetLayerTransforms();else{let{th:t,sg:i}=this.isoParams(),o=Math.cos(t),n=i*Math.sin(t),r=-Math.sin(t),a=i*Math.cos(t),l=Math.sqrt(o*o+n*n),c=o*a-n*r,h=Math.atan2(n,o)*180/Math.PI,u=l,d=c/l,g=(o*r+n*a)/c,y=this.isoCentre;for(let p of[this.bgLayer,this.seatLayer,this.overlayLayer])p.position({x:y.x,y:y.y}),p.offset({x:y.x,y:y.y}),p.rotation(h),p.scaleX(u),p.scaleY(d),p.skewX(g),p.skewY(0)}this.applyUprightLabels(),this.applyElevation(),this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyUprightLabels(){let e=mt*this.isoT,t=1/(1-(1-Xe)*this.isoT),i=this.hasBoothText?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let o of i){let n=o.find("Text");for(let r of n){let a=r.getAttr("uprightBase");a==null&&(a=r.rotation(),r.setAttr("uprightBase",a)),r.rotation(a-e),r.scaleX(1),r.scaleY(t),r.skewX(0)}}}applyElevation(){let e=this.isoT;for(let t of this.sections){if(t.liftWorld<=0)continue;let i=this.isoLiftLocal(t.liftWorld);t.liftGroupBg?.position(i),t.liftGroupSeat.position(i),this.labelLiftGroups.get(t.id)?.position(i);let o=.9*e;for(let n=0;n<t.sideFaces.length;n++){let r=t.sideFaces[n],a=t.outline[n],l=t.outline[(n+1)%t.outline.length];r.points([a.x,a.y,l.x,l.y,l.x+i.x,l.y+i.y,a.x+i.x,a.y+i.y]),r.opacity(o)}}this.syncSeatOverlayPositions()}destroy(){this.destroyed=!0,this.cancelAssetLoads(),this.rafId&&cancelAnimationFrame(this.rafId),this.isoRaf&&cancelAnimationFrame(this.isoRaf),this.glideRaf&&cancelAnimationFrame(this.glideRaf),this.viewChangeRaf&&cancelAnimationFrame(this.viewChangeRaf),this.recacheTimer&&clearTimeout(this.recacheTimer),this.resizeObs?.disconnect(),this.gestures.detach(),this.container.removeEventListener("keydown",this.onKeyDown),this.stage.destroy()}labelFont(){return this.exportMode?this.theme.fontFamily?.toLowerCase().includes("jetbrains")?"JetBrains Mono, monospace":"Inter, sans-serif":this.theme.fontFamily||"Inter, sans-serif"}seatContainer(e){return this.seatSection.get(e)?.liftGroupSeat??this.unsectionedSeatGroup??this.seatLayer}sectionMatchesFocus(e){let t=this.focusedSectionId;return t==null||e.id===t||e.logicalId===t||e.zone===t}focusedSeatOpacity(e,t){if(!this.focusedSectionId)return t;let i=this.seatSection.get(e);return t*(i&&this.sectionMatchesFocus(i)?1:qe)}sectionScreenBounds(e){if(this.viewMode==="perspective"&&e.perspectiveAffine){let r=this.stage.scaleX(),a=this.stage.x(),l=this.stage.y();return z(e.outline.map(c=>{let h=this.projectedSectionPoint(e,c);return{x:h.x*r+a,y:h.y*r+l}}))}let t=e.liftWorld>0?this.isoLiftLocal(e.liftWorld):{x:0,y:0},i=this.stage.scaleX(),o=this.stage.x(),n=this.stage.y();return z(e.outline.map(r=>{let a={x:r.x+t.x,y:r.y+t.y},l=this.isoT===0?a:this.isoForward(a);return{x:l.x*i+o,y:l.y*i+n}}))}updateSeatGroupVisibility(){let e=this.exportMode||this.effScale()>=ee,t=this.viewMode==="perspective"&&this.glideInProgress&&this.seats.length>2500,i=96,o=this.stage.width(),n=this.stage.height();for(let r of this.sections){let a=!0;if(e){let c=this.sectionScreenBounds(r);a=c.x+c.width>=-i&&c.y+c.height>=-i&&c.x<=o+i&&c.y<=n+i,a&&this.viewMode==="perspective"&&!t&&this.applyExactSeatAnchors(!0,r.memberIds)}r.liftGroupSeat.setViewportCulled(!a),this.labelLiftGroups.get(r.id)?.setViewportCulled(!a)}this.unsectionedSeatGroup&&!this.unsectionedSeatGroup.visible()&&this.unsectionedSeatGroup.visible(!0),e&&this.viewMode==="perspective"&&!t&&this.applyExactSeatAnchors(!0,this.seats.filter(r=>!this.seatSection.has(r.id)).map(r=>r.id))}visibleSeatCandidates(){if(!this.sections.length)return this.seats;let e=[];for(let t of this.sections)if(!t.liftGroupSeat.isViewportCulled())for(let i of t.memberIds){let o=this.seatById.get(i);o&&e.push(o)}for(let t of this.seats)this.seatSection.has(t.id)||e.push(t);return e}seatViewportCulled(e){return this.seatSection.get(e)?.liftGroupSeat.isViewportCulled()??!1}renderedSeatPoint(e){if(this.viewMode==="perspective")return this.perspectiveSeatLocal.get(e.id)??e;let t=this.seatSection.get(e.id);if(!t||t.liftWorld<=0||this.isoT===0)return e;let i=this.isoLiftLocal(t.liftWorld);return{x:e.x+i.x,y:e.y+i.y}}seatLabelContainer(e){let t=this.seatSection.get(e);if(!t)return this.labelGroup;let i=this.labelLiftGroups.get(t.id);return i||(i=new Ye({listening:!1}),i.setViewportCulled(t.liftGroupSeat.isViewportCulled()),i.position(this.viewMode==="perspective"?{x:0,y:0}:this.isoLiftLocal(t.liftWorld)),this.labelGroup.add(i),this.labelLiftGroups.set(t.id,i)),i}syncSeatOverlayPositions(){if(this.hoveredId){let e=this.seatById.get(this.hoveredId);if(e){this.hoverRing.position(this.renderedSeatPoint(e));let t=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.hoverRing.scale({x:t,y:t})}}if(this.focusedId){let e=this.seatById.get(this.focusedId);if(e){this.focusRing.position(this.renderedSeatPoint(e));let t=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.focusRing.scale({x:t,y:t})}}for(let[e,t]of this.selectionMarkers){let i=this.seatById.get(e);if(i){t.position(this.renderedSeatPoint(i));let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(i.id)??1:1;t.scale({x:o,y:o})}}}renderSeats(){let e=[...this.seats].sort((t,i)=>(this.perspectiveSeatDepth.get(i.id)??0)-(this.perspectiveSeatDepth.get(t.id)??0));for(let t of e){if(t.kind==="booth"){this.renderBoothUnit(t);continue}let i=this.seatContainer(t.id),o=t.wheelchairSpaceType==="no-seat"?new De({x:t.x,y:t.y,width:this.seatR*2,height:this.seatR*2,offsetX:this.seatR,offsetY:this.seatR,cornerRadius:2,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}):new ge({x:t.x,y:t.y,radius:this.seatR,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0});if(o.setAttr("seatId",t.id),this.circleById.set(t.id,o),this.paintSeat(o,t.id),i.add(o),t.accessible){if(t.wheelchairSpaceType!=="no-seat"){let n=new ge({x:t.x,y:t.y,radius:this.seatR+1.5,stroke:Ot(t.accessibility),strokeWidth:2.5,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.accessRingById.set(t.id,n),i.add(n)}if(t.accessibility?.includes("wheelchair")&&Vt(t.accessibility)){let n=this.buildAccessGlyph(t,typeof o.fill()=="string"?o.fill():"");this.accessGlyphById.set(t.id,n),i.add(n)}}}}renderBoothUnit(e){let t=this.seatContainer(e.id),i=this.boothDims.get(e.rowId)??{width:40,height:30,rotation:0},o=e.x,n=e.y,r;i.points&&i.points.length>=3?(r=new Je({x:e.x,y:e.y,points:i.points.flatMap(l=>[l.x,l.y]),closed:!0,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),o=e.x+i.points.reduce((l,c)=>l+c.x,0)/i.points.length,n=e.y+i.points.reduce((l,c)=>l+c.y,0)/i.points.length):r=new De({x:e.x,y:e.y,width:i.width,height:i.height,offsetX:i.width/2,offsetY:i.height/2,rotation:i.rotation,cornerRadius:4,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),r.setAttr("seatId",e.id),this.circleById.set(e.id,r),t.add(r);let a=new ke({x:o,y:n,text:e.displayLabel??e.label,fontSize:Ce,fontStyle:"600",fontFamily:this.labelFont(),fill:this.theme.seatLabelColor??Ct,listening:!1,perfectDrawEnabled:!1});a.offsetX(a.width()/2),a.offsetY(a.height()/2),a.visible(!1),this.hasBoothText=!0,this.boothLabelById.set(e.id,a),t.add(a),this.paintSeat(r,e.id)}buildAccessGlyph(e,t){let i=this.seatR*1.5/ie;return new Ho({x:e.x,y:e.y,data:Vt(e.accessibility??[])??"",offsetX:ie/2,offsetY:ie/2,scaleX:i,scaleY:i,fill:zt(t),listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})}updateAccessGlyphs(e){if(this.accessGlyphById.size)for(let[t,i]of this.accessGlyphById){let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1,n=this.seatR*1.5/ie*o,a=this.accessGlyphFilterEmphasized(t)?Ji:ji,l=Math.max(n,a/(ie*Math.max(e,.001)));i.scale({x:l,y:l}),i.visible(this.accessGlyphShouldShow(t))}}accessGlyphFilterEmphasized(e){let t=this.seatById.get(e),i=this.accessFilter;return!!t&&i!==null&&!!t.accessibility?.includes("wheelchair")&&(i.length===0||i.includes("wheelchair"))&&Yt(t,i)}accessGlyphShouldShow(e){return this.accessGlyphById.has(e)&&this.accessGlyphEligible(e)}accessGlyphEligible(e){let t=this.statusById.get(e)??"free";return!(t==="booked"||t==="held"&&!this.ownedHold.has(e)&&!this.opts.manageMode)}seatBaseColor(e){return this.colorblind?this.cbHueByKey.get(e)??kt[0]:this.catColor.get(e)??"#6e7bff"}seatLabelScale(e){return(e.labelStyle?.size??18)/18}seatPreferredLabelInk(e){return e.labelStyle?.color??this.theme.seatLabelColor??Ct}seatLabelInk(e,t){let i=t.fill();return Y(typeof i=="string"?i:"",this.seatPreferredLabelInk(e),ct)}paintSeat(e,t){let i=this.seatById.get(t),o=this.statusById.get(t)??"free",n=this.selection.has(t),r=this.seatBaseColor(i.categoryKey),a=this.boothLabelById.get(t);switch(e.dash([]),e.strokeWidth(0),e.stroke(""),e.opacity(1),o){case"free":e.fill(n&&this.effSelection===Ue?ue(r,.28):r);break;case"held":this.ownedHold.has(t)?(e.fill(ue(r,this.effSelection===Ue?.24:.1)),e.stroke(this.effSelection),e.strokeWidth(3)):e.fill(hs);break;case"booked":this.colorblind?(e.fill("rgba(0,0,0,0)"),e.stroke(wt),e.strokeWidth(1.5),e.opacity(.9)):(e.fill(wt),e.opacity(.45));break;case"not_for_sale":e.fill(wt),e.stroke(ds),e.strokeWidth(1),e.dash([2,2]);break}if(i.wheelchairSpaceType==="no-seat"&&o==="free"&&(e.stroke(Ot(i.accessibility)),e.strokeWidth(n?3:2),e.dash([3,2])),a&&(a.text(o==="booked"?"SOLD":o==="held"?"HELD":i.label),a.fontSize(o==="free"?10:Math.min(10,Math.max(6,this.boothDims.get(i.rowId)?.width??40)/6)),a.fontStyle(o==="free"?"600":"800"),a.fill(o==="free"?this.theme.seatLabelColor??Ct:"#ffffff"),a.offsetX(a.width()/2),a.offsetY(a.height()/2)),this.accessFilter&&o==="free"&&!n&&!Yt(i,this.accessFilter)&&e.opacity(.25),this.categoryHighlight&&o==="free"&&!n&&i.categoryKey!==this.categoryHighlight&&e.opacity(.25),this.categoryFilter&&o==="free"&&!n&&!this.categoryFilter.has(i.categoryKey)&&e.opacity(.22),this.commercialLimitedFilter&&o==="free"&&!n&&(i.commercial?.restrictedView||i.commercial?.obstructedView)&&e.opacity(.22),this.dimmedSections.size){let h=this.seatSection.get(t);(!h&&this.dimmedSections.has(wi)||h&&(this.dimmedSections.has(h.id)||this.dimmedSections.has(h.logicalId)||h.zone!=null&&this.dimmedSections.has(h.zone)))&&e.opacity(.18)}this.closedSections.size&&this.seatInClosedSection(t)&&(e.fill(ps),e.stroke(""),e.strokeWidth(0),e.dash([]),e.opacity(us)),this.selectionFocusId&&t!==this.selectionFocusId&&e.opacity(Math.min(e.opacity(),.16));let l=this.boothLabelById.get(t)??this.seatLabelById.get(t);l&&(l.fill(this.seatLabelInk(i,e)),l.visible(fe(l.fontSize(),this.effScale())&&e.opacity()>=.5));let c=this.accessGlyphById.get(t);if(c){let h=e.fill();c.fill(zt(typeof h=="string"?h:"")),c.opacity(e.opacity()),c.visible(this.accessGlyphShouldShow(t))}this.accessRingById.get(t)?.opacity(e.opacity())}seatInClosedSection(e){if(!this.closedSections.size)return!1;let t=this.seatSection.get(e);return!!t&&(this.closedSections.has(t.id)||this.closedSections.has(t.logicalId)||t.zone!=null&&this.closedSections.has(t.zone))}setColorblindSafe(e){if(e!==this.colorblind){this.colorblind=e;for(let t of this.seats){let i=this.circleById.get(t.id);i&&this.paintSeat(i,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setDimmedSections(e){let t=new Set(e??[]);if(!(t.size===this.dimmedSections.size&&[...t].every(i=>this.dimmedSections.has(i)))){this.dimmedSections=t;for(let i of this.seats){let o=this.circleById.get(i.id);o&&this.paintSeat(o,i.id)}this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setClosedSections(e){let t=new Set(e??[]);t.size===this.closedSections.size&&[...t].every(i=>this.closedSections.has(i))||(this.closedSections=t,this.repaintSectionsAndSeats())}focusSection(e){this.sections.some(t=>t.id===e||t.logicalId===e)&&(this.focusedSectionId=e,this.drawFocusBackdrop(e),this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD(),this.focusRegion(e))}releaseSectionFocusDim(){!this.focusBackdrop&&!this.focusDimOverlay||(this.focusBackdrop?.destroy(),this.focusBackdrop=null,this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.bgLayer.batchDraw(),this.overlayLayer.batchDraw())}clearSectionFocus(){this.focusedSectionId&&(this.focusedSectionId=null,this.focusBackdrop&&(this.focusBackdrop.destroy(),this.focusBackdrop=null),this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD())}getFocusedSection(){return this.focusedSectionId}drawFocusBackdrop(e){this.focusBackdrop&&(this.focusBackdrop.destroy(),this.focusBackdrop=null);let t=this.sections.filter(o=>o.id===e||o.logicalId===e);if(!t.length)return;let i=new we({listening:!1});for(let o of t){let n=this.viewMode==="perspective"&&o.perspectiveAffine,r=n?o.outline.map(l=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,l))):o.outline,a=n?o.holes.map(l=>l.map(c=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,c)))):o.holes;i.add(Fe(r,a,{fill:fs,stroke:te("#ffffff",.1),strokeWidth:1,listening:!1},n?void 0:o.outlinePath))}this.bgLayer.add(i),i.moveToTop(),this.focusBackdrop=i,this.drawFocusDimOverlay(t)}drawFocusDimOverlay(e){this.focusDimOverlay?.destroy();let i=Math.max(this.bounds.width,this.bounds.height,1)*4+1e3,o=[{x:this.bounds.x-i,y:this.bounds.y-i},{x:this.bounds.x+this.bounds.width+i,y:this.bounds.y-i},{x:this.bounds.x+this.bounds.width+i,y:this.bounds.y+this.bounds.height+i},{x:this.bounds.x-i,y:this.bounds.y+this.bounds.height+i}],n=new Vo({fill:this.canvasBackground,opacity:1-qe,listening:!1,perfectDrawEnabled:!1,sceneFunc:(r,a)=>{let l=c=>{if(c.length){r.moveTo(c[0].x,c[0].y);for(let h=1;h<c.length;h++)r.lineTo(c[h].x,c[h].y);r.closePath()}};r.beginPath(),l(o);for(let c of e){let h=this.viewMode==="perspective"&&c.perspectiveAffine?c.outline.map(u=>this.perspectiveLocalPoint(this.projectedSectionPoint(c,u))):c.outline.map(u=>{let d=c.liftWorld>0?this.isoLiftLocal(c.liftWorld):{x:0,y:0};return{x:u.x+d.x,y:u.y+d.y}});l(Ve(h)>0?[...h].reverse():h)}r.fillStrokeShape(a)}});this.overlayLayer.add(n),n.moveToTop();for(let r of this.selectionMarkers.values())r.moveToTop();this.hoverRing.moveToTop(),this.focusRing.moveToTop(),this.focusDimOverlay=n}repaintSectionsAndSeats(){for(let e of this.seats){let t=this.circleById.get(e.id);t&&this.paintSeat(t,e.id)}for(let e of this.sections)e.blockPoly.fill(this.sectionBlockFill(e));this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.bgLayer.batchDraw()}getVisibleWorldRect(){let e=this.screenToWorld({x:0,y:0}),t=this.screenToWorld({x:this.stage.width(),y:this.stage.height()});return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}getWorldBounds(){let e=1/0,t=1/0,i=-1/0,o=-1/0,n=(r,a)=>{r<e&&(e=r),a<t&&(t=a),r>i&&(i=r),a>o&&(o=a)};for(let r of this.seats)n(r.x,r.y);for(let r of this.sections)for(let a of r.outline)n(a.x,a.y);for(let r of this.gaById.values())for(let a of r.points)n(a.x,a.y);return Number.isFinite(e)?{x:e,y:t,width:Math.max(1,i-e),height:Math.max(1,o-t)}:{x:0,y:0,width:1,height:1}}getMinimapSnapshot(){let e=this.sections.map(t=>{let i=this.isSectionClosed(t)||t.free<=0,o=t.memberIds.some(r=>this.selection.has(r)),n=this.focusedSectionId===t.id||this.focusedSectionId===t.logicalId;return{id:t.logicalId,label:t.label,outline:t.outline.map(r=>({...r})),...this.objectFloor.get(t.id)?{floorId:this.objectFloor.get(t.id)}:{},state:o?"selected":i?"inactive":"available",active:n}});return{sections:e,seats:e.length?[]:this.seats.map(t=>({x:t.x,y:t.y,categoryKey:t.categoryKey,state:this.selection.has(t.id)?"selected":this.statusById.get(t.id)==="free"?"available":"inactive"}))}}panToWorld(e){this.cancelGlide();let t=this.worldToScreen(e);this.stage.position({x:this.stage.x()+this.stage.width()/2-t.x,y:this.stage.y()+this.stage.height()/2-t.y}),this.afterViewChange(),this.stage.batchDraw()}setCategoryHighlight(e){if(this.categoryHighlight!==e){this.categoryHighlight=e;for(let t of this.seats){let i=this.circleById.get(t.id);i&&this.paintSeat(i,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}renderBackground(e){let t=Pe(e);t&&this.renderBackgroundImage(t);for(let i of e.objects)i.type==="decorImage"&&this.renderDecorImage(i);for(let i of e.objects)i.type==="section"&&this.renderSection(i);this.renderZones(e);for(let i of e.objects)i.type==="shape"?this.renderShape(i):i.type==="gaArea"?this.renderGA(i):i.type==="table"?this.renderTable(i):i.type==="text"&&this.renderText(i)}trackAssetImage(e,t,i,o){let n=this.assetGeneration;/^https?:\/\//i.test(t)&&(e.crossOrigin="anonymous");let r=new Promise(a=>{let l=!1,c=()=>{l||(l=!0,this.assetCancels.delete(h),a())},h=()=>{e.onload=null,e.onerror=null;try{e.removeAttribute("src"),e.src=""}catch{}c()};this.assetCancels.add(h),e.onload=()=>{if(!this.exportMode){n===this.assetGeneration&&o(),c();return}(typeof e.decode=="function"?e.decode():Promise.resolve()).then(()=>{n===this.assetGeneration&&o()}).catch(()=>{n===this.assetGeneration&&this.assetErrors.push(`${i} could not be decoded.`)}).finally(c)},e.onerror=()=>{n===this.assetGeneration&&this.assetErrors.push(`${i} could not be loaded.`),c()},e.src=t});this.assetPromises.push(r)}cancelAssetLoads(){this.assetGeneration++;for(let e of[...this.assetCancels])e();this.assetCancels.clear(),this.assetPromises=[],this.assetErrors=[]}renderBackgroundImage(e){if(!e.url||e.visible===!1)return;let t=new window.Image;this.trackAssetImage(t,e.url,"Buyer background image",()=>{let i=t.naturalWidth||4,o=t.naturalHeight||3,n=e.crop??{x:0,y:0,width:1,height:1},r=Math.max(0,Math.min(.99,n.x)),a=Math.max(0,Math.min(.99,n.y)),l={x:r,y:a,width:Math.max(.01,Math.min(1-r,n.width)),height:Math.max(.01,Math.min(1-a,n.height))},c=e.width,h=c*(o*l.height/(i*l.width)),u=new No({image:t,x:e.center.x,y:e.center.y,offsetX:c/2,offsetY:h/2,width:c,height:h,rotation:e.rotation??0,crop:{x:l.x*i,y:l.y*o,width:l.width*i,height:l.height*o},opacity:e.opacity,listening:!1});this.bgLayer.add(u),u.moveToBottom(),this.bgLayer.batchDraw()})}get objectDrawContext(){return{bgLayer:this.bgLayer,fgDecorGroup:this.fgDecorGroup,container:this.container,opts:this.opts,theme:this.theme,canvasBackground:this.canvasBackground,catColor:this.catColor,sections:this.sections,freeTextById:this.freeTextById,gaById:this.gaById,iconNodeById:this.iconNodeById,primaryFocalLabels:this.primaryFocalLabels,labelFont:()=>this.labelFont(),trackAssetImage:(e,t,i,o)=>this.trackAssetImage(e,t,i,o),isGhostClick:e=>this.isGhostClick(e)}}renderDecorImage(e){ks(this.objectDrawContext,e)}renderTable(e){Ls(this.objectDrawContext,e)}renderText(e){Ts(this.objectDrawContext,e)}renderShape(e){Is(this.objectDrawContext,e)}renderGA(e){Cs(this.objectDrawContext,e)}renderSection(e){let t=ot(e.outline,e.holes),i=re(this.canvasBackground),o=[],n=new Map,r=0,a=z(e.outline),l=this.seatIndex?ht(this.seatIndex,a).map(M=>this.seatById.get(M)).filter(M=>!!M):this.seats;for(let M of l)this.seatSection.has(M.id)||j(M,e.outline,e.holes)&&(o.push(M.id),n.set(M.categoryKey,(n.get(M.categoryKey)??0)+1),(this.statusById.get(M.id)??"free")==="free"&&r++);let c=e.color??Nt([...n].map(([M,R])=>({hex:this.catColor.get(M)??"#6e7bff",w:R})),"#3a4358"),h=gi(e.elevation),u=st(e,{floorBaseHeightM:this.floorBaseHeightMFor(e.id)}),d=u.height*Ie,g=new we({listening:!1});this.bgLayer.add(g);let y=new we({listening:!1});g.add(y);let p=new Ye({listening:!0});this.seatLayer.add(p);let f=[];if(d>0){let M=ce(this.zoneColor.get(e.zone??"")??c,.42);for(let R=0;R<e.outline.length;R++){let A=new Je({points:[],closed:!0,fill:M,stroke:te("#000000",.25),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});f.push(A),g.add(A)}}y.moveToTop();let b=y,m=e.color??this.zoneColor.get(e.zone??"")??"#3a4358",v=Fe(e.outline,e.holes,{stroke:te(m,.5),strokeWidth:1,fill:te(m,.08),listening:!1},e.outlinePath);b.add(v);let k=Fe(e.outline,e.holes,{fill:i.sectionFill,stroke:i.sectionStroke,strokeWidth:St,opacity:0,listening:!1},e.outlinePath);b.add(k);let L=e.labelPresentation?.labelStyle,S=L?.color??i.sectionInk,w=(L?.size??18)/18,x=new ke({x:e.labelPresentation?.position?.x??t.x,y:e.labelPresentation?.position?.y??t.y,text:e.displayLabel??e.label,rotation:e.labelPresentation?.rotation??0,visible:e.labelPresentation?.visible!==!1,fontSize:22*w,fontStyle:"700",fontFamily:this.labelFont(),fill:Y(i.sectionFill,S),listening:!1,perfectDrawEnabled:!1});x.offsetX(x.width()/2),x.offsetY(x.height()/2),b.add(x);let I=new ke({x:t.x,y:t.y,text:oe("map.seatsLeft",{count:r}),fontSize:12,fontStyle:"700",fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:i.sectionInk,opacity:0,listening:!1,perfectDrawEnabled:!1});I.offsetX(I.width()/2),b.add(I);let T={id:e.id,logicalId:e.logicalSectionId??e.id,label:e.displayLabel??e.label,outline:e.outline,...e.outlinePath?{outlinePath:e.outlinePath}:{},holes:e.holes??[],centroid:t,labelAnchors:ys(e.outline,e.holes??[],t),labelArea:fi(e.outline,e.holes),zone:e.zone,memberIds:o,total:o.length,free:r,baseFill:c,outlineTint:m,outlinePoly:v,blockPoly:k,nameLabel:x,subLabel:I,preferredInk:S,labelScale:w,nameLabelFits:!0,subLabelFits:!0,elevation:h,liftWorld:d,rakeDeg:u.rake,surfaceFocal:o.length?{...this.seatById.get(o[0])?.focalPoint??this.isoCentre}:{...this.chartDoc?.focalPoint??this.isoCentre},frontDistanceWorld:0,rootGroupBg:g,bgZIndex:g.zIndex(),seatZIndex:p.zIndex(),liftGroupBg:y,liftGroupSeat:p,sideFaces:f},P=o.map(M=>this.seatById.get(M)).filter(M=>!!M),C=P.length?P:e.outline;T.frontDistanceWorld=Math.min(...C.map(M=>Math.hypot(M.x-T.surfaceFocal.x,M.y-T.surfaceFocal.y)));for(let M of o)this.seatSection.set(M,T);this.refreshSectionFill(T),this.refreshSectionHeat(T),this.sections.push(T)}refreshSectionHeat(e){xs(this.sectionLodPaintContext,e)}refreshSectionFill(e){Rs(this.sectionLodPaintContext,e)}isSectionClosed(e){return Jt(this.sectionLodPaintContext,e)}sectionAvailabilityState(e){return ei(this.sectionLodPaintContext,e)}sectionBlockFill(e){return Be(re(this.canvasBackground),this.sectionAvailabilityState(e))}get sectionLodPaintContext(){return{sections:this.sections,zones:this.zones,sectionHeat:this.sectionHeat,closedSections:this.closedSections,canvasBackground:this.canvasBackground,bgLayer:this.bgLayer,seatLayer:this.seatLayer,stageScaleX:this.stage.scaleX(),stageWidth:this.stage.width(),floorOverview:this.floorOverview,focusedSectionId:this.focusedSectionId,hasFocusDimOverlay:!!this.focusDimOverlay,viewMode:this.viewMode,glideInProgress:this.glideInProgress,reducedMotion:this.reducedMotion,isoT:this.isoT,seatCount:this.seats.length,lodScale:this.lodScale,setLodScale:e=>{this.lodScale=e},worldToScreen:e=>this.worldToScreen(e)}}renderZones(e){if(!e.zones?.length||!this.sections.length)return;let t=new Map;for(let i of this.sections)i.zone&&(t.get(i.zone)??t.set(i.zone,[]).get(i.zone)).push(i);for(let i of e.zones){let o=t.get(i.id);if(!o||!o.length)continue;let n=o[0];for(let d of o)d.centroid.y<n.centroid.y&&(n=d);let r=n.centroid.x,a=n.centroid.y,l=1/0;for(let d of o)for(let g of d.memberIds){let y=this.seatById.get(g),p=y&&this.catPrice.get(y.categoryKey);typeof p=="number"&&p<l&&(l=p)}let c=new De({x:r,y:a,width:1,height:1,offsetX:.5,offsetY:.5,cornerRadius:1,fill:qt,stroke:i.color??n.outlineTint,strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});this.bgLayer.add(c);let h=new ke({x:r,y:a,text:i.label.toUpperCase(),fontSize:vt,fontStyle:"800",letterSpacing:.5,fontFamily:this.labelFont(),fill:"#f4f6fb",opacity:0,listening:!1,perfectDrawEnabled:!1});h.offsetX(h.width()/2),h.offsetY(h.height()/2),this.bgLayer.add(h);let u=null;isFinite(l)&&(u=new ke({x:r,y:a,text:oe("map.fromPrice",{price:Kt(l,this.currency)}),fontSize:14,fontStyle:"600",fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:"#cbd5e1",opacity:0,listening:!1,perfectDrawEnabled:!1}),u.offsetX(u.width()/2),this.bgLayer.add(u)),this.zones.push({id:i.id,anchor:{x:r,y:a},back:c,background:qt,label:h,sub:u})}}screenToWorld(e){let t=this.stage.scaleX(),i={x:(e.x-this.stage.x())/t,y:(e.y-this.stage.y())/t};return this.viewMode==="perspective"&&this.perspectiveBaseInverse?J(this.perspectiveBaseInverse,i):this.isoT===0?i:this.isoInverse(i)}sectionAt(e){if(!this.sections.length)return null;let t=this.screenToWorld(e),i=this.sections.find(o=>{if(this.viewMode==="perspective"&&o.perspectiveAffine)return j(t,o.outline.map(r=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,r))),o.holes.map(r=>r.map(a=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,a)))));let n=o.liftWorld>0?this.isoLiftLocal(o.liftWorld):{x:0,y:0};return j({x:t.x-n.x,y:t.y-n.y},o.outline,o.holes)});return i?i.logicalId:null}sectionMembers(e){return[...new Set(this.sections.filter(t=>t.id===e||t.logicalId===e||t.zone===e).flatMap(t=>t.memberIds))]}isSelectable(e){return this.seatInClosedSection(e)?!1:(this.opts.selectableStatuses??["free"]).includes(this.statusById.get(e)??"free")}toggleSeat(e){if(this.selection.has(e)){this.setSelected(e,!1);let t=this.seatById.get(e);t&&this.opts.onDeselect?.(t)}else{if(!this.isSelectable(e))return;if(this.selection.size>=this.opts.maxSelection){this.opts.onSelectionLimit?.(this.opts.maxSelection);return}this.setSelected(e,!0);let t=this.seatById.get(e);t&&this.opts.onSelect?.(t)}this.overlayLayer.batchDraw()}resolveCanvasBackground(){let e=this.theme.background?Ht(this.theme.background):null;if(e)return e;if(typeof getComputedStyle=="function"){let t=this.container;for(;t;){let i=Ht(getComputedStyle(t).backgroundColor);if(i)return i;t=t.parentElement}}return Ut}resolveSelectionColor(){return this.theme.selectionColor?this.theme.selectionColor:Ne(this.canvasBackground)?bs:Ue}setSelected(e,t,i=!1){let o=this.circleById.get(e);t?this.selection.add(e):(this.selectionFocusId===e&&this.setSelectionFocus(null),this.selection.delete(e)),this.syncSelectionMarker(e),o&&(this.paintSeat(o,e),!i&&!this.cached&&this.seatLayer.batchDraw())}syncSelectionMarker(e){if(this.selectionMarkers.get(e)?.destroy(),this.selectionMarkers.delete(e),!this.selection.has(e)&&!this.ownedHold.has(e))return;let t=this.seatById.get(e);if(!t)return;let i=this.selectionFocusId===e,o=this.boothDims.get(t.rowId),n=this.renderedSeatPoint(t),r=new we({name:"selection-ring",x:n.x,y:n.y,rotation:o?.rotation??0,listening:!1,perfectDrawEnabled:!1,opacity:this.selectionFocusId&&!i?.2:1});if(this.viewMode==="perspective"){let l=this.perspectiveSeatScale.get(e)??1;r.scale({x:l,y:l})}r.setAttr("seatId",e);let a={stroke:this.effSelection,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(o)if(r.add(new De({...a,width:o.width,height:o.height,offsetX:o.width/2,offsetY:o.height/2,cornerRadius:4,strokeWidth:i?4:3})),i)r.add(new De({...a,width:o.width+10,height:o.height+10,offsetX:(o.width+10)/2,offsetY:(o.height+10)/2,cornerRadius:7,strokeWidth:2,opacity:.55}));else{let l=Math.max(0,o.width/2-14),c=-Math.max(0,o.height/2-14);r.add(new ge({x:l,y:c,radius:10,fill:this.effSelection,listening:!1})),r.add(new Je({x:l,y:c,points:[-4.5,0,-1,3.5,5.5,-4.5],stroke:Ne(this.effSelection)?"#0b1220":"#ffffff",strokeWidth:2.4,lineCap:"round",lineJoin:"round",listening:!1}))}else r.add(new ge({...a,radius:Math.max(1,this.seatR-1.25),strokeWidth:Math.min(2.5,Math.max(1.8,this.seatR*.22))})),i?r.add(new ge({...a,radius:this.seatR+2,strokeWidth:2,opacity:.55})):r.add(new Je({points:[-this.seatR*.52,0,-this.seatR*.12,this.seatR*.4,this.seatR*.6,-this.seatR*.46],stroke:"#ffffff",strokeWidth:Math.max(2.6,this.seatR*.34),lineCap:"round",lineJoin:"round",shadowColor:"#0b1220",shadowBlur:1.5,shadowOpacity:.55,listening:!1}));this.selectionMarkers.set(e,r),this.overlayLayer.add(r)}sectionBounds(e){let t=this.sections.filter(y=>y.id===e||y.logicalId===e),i=t.map(y=>{if(this.viewMode==="perspective"&&y.perspectiveAffine)return z(y.outline.map(b=>this.projectedSectionPoint(y,b)));let p=y.liftWorld>0?this.isoLiftLocal(y.liftWorld):{x:0,y:0},f=y.outline.map(b=>{let m={x:b.x+p.x,y:b.y+p.y};return this.isoT===0?m:this.isoForward(m)});return z(f)});if(!i.length)return null;let o=Math.min(...i.map(y=>y.x)),n=Math.min(...i.map(y=>y.y)),r=Math.max(...i.map(y=>y.x+y.width)),a=Math.max(...i.map(y=>y.y+y.height)),l=new Set(t.flatMap(y=>y.memberIds));for(let y of l){let p=this.seatById.get(y);if(!p)continue;let f=this.renderedSeatPoint(p);o=Math.min(o,f.x-this.seatR),n=Math.min(n,f.y-this.seatR),r=Math.max(r,f.x+this.seatR),a=Math.max(a,f.y+this.seatR)}let c=y=>{[y.x,y.y,y.width,y.height].every(Number.isFinite)&&(o=Math.min(o,y.x),n=Math.min(n,y.y),r=Math.max(r,y.x+y.width),a=Math.max(a,y.y+y.height))},h=y=>{let p={x:y.x+y.width/2,y:y.y+y.height/2};return t.some(f=>j(p,f.outline,f.holes))};for(let{node:y,backdrop:p}of this.freeTextById.values()){let f=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0});h(f)&&(c(f),p&&c(p.getClientRect({relativeTo:this.bgLayer,skipShadow:!0})))}for(let{node:y}of this.iconNodeById.values()){let p=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0});h(p)&&c(p)}let u=new Ae;for(let{node:y}of this.freeTextById.values()){let p=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0,skipStroke:!0});u.insert({x:p.x-U,y:p.y-U,width:p.width+U*2,height:p.height+U*2})}for(let y of this.rowLabelPlan){let p=y.focusKeys?.some(v=>v===e||t.some(k=>v===k.id||v===k.logicalId||v===k.zone))??!1,f=new ke({text:y.text,fontSize:y.fontSize,fontStyle:"700",fontFamily:this.labelFont(),rotation:y.rotation,listening:!1});f.offsetX(f.width()/2),f.offsetY(f.height()/2);let b=this.resolveAutomaticRowLabelPosition(f,y,u),m=this.rowLabelBox(f,b);p&&c(m),u.insert(m),f.destroy()}let d=Math.max(r-o,a-n),g=Math.max(this.seatR*2,Math.min(24,d*.025));return{x:o-g,y:n-g,width:Math.max(1,r-o+g*2),height:Math.max(1,a-n+g*2)}}sectionFrameScale(e){let t=this.sectionBounds(e);if(!t)return this.stage.scaleX();let i=this.stage.width(),o=this.stage.height(),{min:n,max:r}=this.zoomBounds(),a=1.12;if(t.width<=0||t.height<=0)return this.stage.scaleX();let l=Math.min(i/(t.width*a),o/(t.height*a));return V(l,n,r)}handleSeatTap(e){if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let t=this.objectFloor.get(this.seatById.get(e)?.rowId??"");if(t){this.opts.onDeckTap(t);return}}if(this.effScale()<ne&&this.sections.length){let t=this.seatSection.get(e);if(t){let i=this.focusedSectionId===t.logicalId,o=this.sectionFrameScale(t.logicalId)>this.stage.scaleX()*1.02;if(!i&&o){this.opts.onSectionTap?this.opts.onSectionTap(t.logicalId):this.focusSection(t.logicalId);return}}}this.toggleSeat(e)}nearestSeatToScreen(e,t){let i=null,o=1/0,n=this.stage.scaleX()||1;for(let r of this.seats){if(!this.selection.has(r.id)&&!this.isSelectable(r.id))continue;let a=this.worldToScreen(r),l=this.viewMode==="perspective"?this.perspectiveSeatScale.get(r.id)??1:1,c=this.seatR*n*l+t,h=Math.hypot(a.x-e.x,a.y-e.y);h<=c&&h<o&&(o=h,i=r.id)}return i}wireInteraction(){this.seatLayer.on("click tap",e=>{if(this.moved>ve||this.isGhostClick(e))return;let t=ii(e.target);t&&this.handleSeatTap(t)}),this.seatLayer.on("mouseover",e=>{let t=ii(e.target);if(!t)return;let i=this.seatById.get(t);if(!i)return;this.hoveredId=t,this.hoverRing.position(this.renderedSeatPoint(i));let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1;this.hoverRing.scale({x:o,y:o}),this.hoverRing.visible(!0),this.overlayLayer.batchDraw(),this.container.style.cursor="pointer",this.opts.onHover?.(i)}),this.seatLayer.on("mouseout",()=>{this.hoveredId=null,this.hoverRing.visible(!1),this.overlayLayer.batchDraw(),this.container.style.cursor="default",this.opts.onHover?.(null)}),this.stage.on("wheel",e=>{e.evt.preventDefault(),this.releaseSectionFocusDim();let t=this.container.getBoundingClientRect(),i={x:e.evt.clientX-t.left,y:e.evt.clientY-t.top},o=Math.exp(-e.evt.deltaY*.002);this.zoomAbout(this.stage.scaleX()*V(o,.5,2),i)}),this.stage.on("click tap",e=>{if(this.moved>ve||this.isGhostClick(e))return;let t=this.stage.getPointerPosition();if(!t)return;if(!this.cached){if(ii(e.target))return;let o=this.nearestSeatToScreen(t,gt);o&&this.handleSeatTap(o);return}if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let o=this.floorOverview?this.sectionAt(t):null,n=(o?this.objectFloor.get(o):null)??this.deckFloorAt();if(n){this.opts.onDeckTap(n);return}}if(this.sections.length){let o=this.sectionAt(t);if(o){this.opts.onSectionTap?this.opts.onSectionTap(o):this.focusRegion(o);return}}let i=Math.max(Se*1.2,this.stage.scaleX()*2.5);this.zoomAbout(i,t)})}deckFloorAt(){if(!this.objectFloor.size)return null;let e=this.stage.getPointerPosition();if(!e)return null;let t=this.screenToWorld(e),i=null,o=1/0;for(let n of this.seats){let r=this.renderedSeatPoint(n),a=r.x-t.x,l=r.y-t.y,c=a*a+l*l;c<o&&(o=c,i=n.rowId)}return i?this.objectFloor.get(i)??null:null}zoomBounds(){let e=.5*this.fitScale;return this.zones.length&&(e=Math.min(e,Ee*.9)),{min:e,max:Math.max(10*this.fitScale,4)}}zoomAbout(e,t){let{min:i,max:o}=this.zoomBounds(),n=V(e,i,o),r=this.stage.scaleX();if(n===r)return;let a=(t.x-this.stage.x())/r,l=(t.y-this.stage.y())/r;this.stage.scale({x:n,y:n}),this.stage.position({x:t.x-a*n,y:t.y-l*n}),this.afterViewChange(),this.stage.batchDraw()}zoomToBounds(e,t){let i=this.stage.width(),o=this.stage.height(),{min:n,max:r}=this.zoomBounds(),a=1.12,l=Math.min(i/(e.width*a),o/(e.height*a)),c=V(Math.max(l,t??n),n,r);this.stage.scale({x:c,y:c}),this.stage.position({x:i/2-(e.x+e.width/2)*c,y:o/2-(e.y+e.height/2)*c}),this.afterViewChange(),this.stage.batchDraw()}focusRegion(e,t){let i=typeof e=="string"?this.sectionBounds(e):e;if(!i)return;if(this.cancelGlide(),t?.animate===!1||this.reducedMotion){this.zoomToBounds(i,t?.minScale);return}let o=this.stage.width(),n=this.stage.height(),{min:r,max:a}=this.zoomBounds(),l=1.12,c=Math.min(o/(i.width*l),n/(i.height*l)),h=V(Math.max(c,t?.minScale??r),r,a),u=o/2-(i.x+i.width/2)*h,d=n/2-(i.y+i.height/2)*h,g=this.stage.scaleX(),y=this.stage.x(),p=this.stage.y();if(Math.abs(h-g)<1e-4&&Math.abs(u-y)<.5&&Math.abs(d-p)<.5){this.afterViewChange();return}let f=performance.now(),b=Math.max(180,Math.min(1200,t?.durationMs??bt));this.glideInProgress=!0;let m=v=>{if(this.destroyed){this.glideRaf=0,this.glideInProgress=!1;return}let k=Math.min(1,(v-f)/b),L=k<.5?4*k*k*k:1-Math.pow(-2*k+2,3)/2,S=g+(h-g)*L;this.stage.scale({x:S,y:S}),this.stage.position({x:y+(u-y)*L,y:p+(d-p)*L}),this.updateSeatGroupVisibility(),this.updateLOD(),this.scheduleViewChange(),this.stage.batchDraw(),k<1?this.glideRaf=requestAnimationFrame(m):(this.glideRaf=0,this.glideInProgress=!1,this.afterViewChange())};this.glideRaf=requestAnimationFrame(m)}cancelGlide(){this.glideRaf&&(cancelAnimationFrame(this.glideRaf),this.glideRaf=0),this.glideInProgress=!1}getRung(){let e=this.effScale();return e>=ee?"seats":this.zones.length&&e<Ee?"zones":"sections"}get renderedQualityContext(){return{stage:this.stage,overlayLayer:this.overlayLayer,labelGroup:this.labelGroup,viewMode:this.viewMode,cached:this.cached,effScale:()=>this.effScale(),getRung:()=>this.getRung(),worldToScreen:e=>this.worldToScreen(e),isoLiftLocal:e=>this.isoLiftLocal(e),seats:this.seats,sections:this.sections,zones:this.zones,seatSection:this.seatSection,statusById:this.statusById,selection:this.selection,circleById:this.circleById,seatLabelById:this.seatLabelById,boothLabelById:this.boothLabelById,accessGlyphById:this.accessGlyphById,freeTextById:this.freeTextById,gaById:this.gaById,perspectiveSeatProjected:this.perspectiveSeatProjected,perspectiveSeatScale:this.perspectiveSeatScale,seatR:this.seatR,canvasBackground:this.canvasBackground,effSelection:this.effSelection,categoryFilter:this.categoryFilter,focusedSectionId:this.focusedSectionId,focusBackdrop:this.focusBackdrop,isSelectable:e=>this.isSelectable(e),seatViewportCulled:e=>this.seatViewportCulled(e),focusedSeatOpacity:(e,t)=>this.focusedSeatOpacity(e,t),accessGlyphFilterEmphasized:e=>this.accessGlyphFilterEmphasized(e),seatLabelScale:e=>this.seatLabelScale(e),seatLabelInk:(e,t)=>this.seatLabelInk(e,t),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e)}}getRenderedQualityEvidence(){return ms(this.renderedQualityContext)}setRung(e){if(e==="zones"){this.cancelGlide(),this.zoomToFit();return}let t=e==="sections"?(ye+ee)/2:Math.max(this.seatLabelTargetScale()*1.05,es,ee*1.3),i=this.stage.width(),o=this.stage.height(),n=this.getVisibleWorldRect(),r={x:n.x+n.width/2,y:n.y+n.height/2},a=r.x,l=r.y;if(e==="sections"&&this.sections.length>0){let d=this.sections.map(f=>{let b=z(f.outline);return{x:b.x+b.width/2,y:b.y+b.height/2}}),g=i/(t*2),y=o/(t*2);if(!d.some(f=>Math.abs(f.x-r.x)<=g&&Math.abs(f.y-r.y)<=y)){let f=d.reduce((b,m)=>{let v=(m.x-r.x)**2+(m.y-r.y)**2;return v<b.distance?{point:m,distance:v}:b},{point:d[0],distance:1/0});a=f.point.x,l=f.point.y}}let c=e==="seats"?this.seats.filter(d=>d.kind!=="booth"):[];if(c.length>0){let d=c[0],g=1/0;for(let y of c){let p=y.x-r.x,f=y.y-r.y,b=p*p+f*f;b<g&&(d=y,g=b)}a=d.x,l=d.y}let h=i/(t*1.12),u=o/(t*1.12);this.focusRegion({x:a-h/2,y:l-u/2,width:h,height:u})}seatLabelTargetScale(){let e=Ce,t=new ke({fontSize:he,fontStyle:"600",fontFamily:this.labelFont(),listening:!1}),i=this.seatR*2-3;for(let o of this.seats){if(o.kind==="booth"){e=Math.min(e,Ce);continue}let n=he*this.seatLabelScale(o);t.fontSize(n),t.text(lt(o.displayLabel??o.label));let r=t.width()>i?Math.max(Ke,n*i/t.width()):n;e=Math.min(e,r)}return t.destroy(),de/Math.max(Ke,e)}afterViewChange(){this.updateSeatGroupVisibility(),this.updateLOD(),this.updateFreeTextVisibility(),this.updateLabels(),this.scheduleViewChange()}scheduleViewChange(){this.exportMode||this.viewChangeRaf||(this.viewChangeRaf=requestAnimationFrame(()=>{this.viewChangeRaf=0,this.opts.onViewChange?.()}))}sizeLabel(e,t,i){e.fontSize(Math.max(1,t)),e.offsetX(e.width()/2),e.offsetY(e.height()/2),e.y(i)}updateLOD(){let e=this.exportMode?Math.max(this.effScale(),Re+.01,ne):this.effScale(),t=Math.max(e,1e-4);for(let[n,r]of this.primaryFocalLabels)this.sizeLabel(n,r/t,n.y());this.hasSections?Es(this.sectionLodPaintContext,e):this.primaryFocalLabels.size&&this.bgLayer.batchDraw(),this.paintGAStateForView(),this.updateAccessGlyphs(e);let i=!this.exportMode&&e<ee;if(this.viewMode==="perspective"&&this.hasSections&&this.seats.length>2500&&i){this.seatLayer.listening(!1);return}i&&!this.cached?this.cacheSeatLayer():!i&&(this.cached||!this.seatLayer.listening())&&(this.cached&&this.releaseSeatLayerBitmap(),this.seatLayer.listening(!this.exportMode),this.cached=!1,this.seatLayer.batchDraw())}rebuildSeatCache(){this.updateSeatGroupVisibility();let e=V(this.stage.scaleX()*this.dpr,.15,2);this.seatLayer.clearCache(),this.seatLayer.cache({pixelRatio:e}),this.seatLayer.listening(!1),this.cached=!0}cacheSeatLayer(){this.rebuildSeatCache(),this.seatLayer.batchDraw()}releaseSeatLayerBitmap(){let e=this.seatLayer,t=e._cache.get("canvas");t&&(Mt.Util.releaseCanvas(t.scene._canvas,t.filter._canvas,t.hit._canvas),e._cache.delete("canvas"))}forceDraw(){this.recacheTimer&&(clearTimeout(this.recacheTimer),this.recacheTimer=null,this.effScale()<ee?this.rebuildSeatCache():this.cached&&(this.releaseSeatLayerBitmap(),this.seatLayer.listening(!0),this.cached=!1)),this.bgLayer.draw(),this.seatLayer.draw(),this.overlayLayer.draw()}async ready(){let e=this.assetGeneration,t=typeof document<"u"&&"fonts"in document?document.fonts:null;if(await Promise.all([...this.assetPromises.slice(),...t?[t.ready.then(()=>{}),t.load("700 24px Inter").then(()=>{}),t.load('600 12px "JetBrains Mono"').then(()=>{})]:[]]),e!==this.assetGeneration)throw new Error("The chart changed while its export assets were loading.");if(this.assetErrors.length)throw new Error(`Export stopped because ${this.assetErrors.join(" ")}`);this.exportMode&&(this.fitExportContent(),this.forceDraw())}exportSceneBounds(){let e=[this.bgLayer,this.seatLayer,this.overlayLayer].map(r=>r.getClientRect({relativeTo:this.stage})).filter(r=>r.width>0&&r.height>0);if(!e.length)return this.bounds;let t=Math.min(...e.map(r=>r.x)),i=Math.min(...e.map(r=>r.y)),o=Math.max(...e.map(r=>r.x+r.width)),n=Math.max(...e.map(r=>r.y+r.height));return{x:t,y:i,width:Math.max(1,o-t),height:Math.max(1,n-i)}}fitExportContent(){if(!this.exportMode)return;let e=this.stage.width(),t=this.stage.height(),i=Math.max(12,Math.min(36,Math.min(e,t)*.025)),o=()=>{let n=this.exportSceneBounds(),r=Math.max(1,e-i*2),a=Math.max(1,t-i*2),l=Math.min(r/n.width,a/n.height)||1;this.fitScale=l,this.stage.scale({x:l,y:l}),this.stage.position({x:(e-n.width*l)/2-n.x*l,y:(t-n.height*l)/2-n.y*l}),this.afterViewChange()};o(),o()}captureCanvas(){if(!this.exportMode)throw new Error("captureCanvas() is available only on a renderer created with exportMode.");this.forceDraw();let e;try{e=this.stage.toCanvas({pixelRatio:1,imageSmoothingEnabled:!0})}catch(o){let n=o instanceof Error?o.message:String(o);throw new Error(`The chart canvas could not be captured. A buyer-visible image may block export. ${n}`)}let t=document.createElement("canvas");t.width=this.stage.width(),t.height=this.stage.height();let i=t.getContext("2d");if(!i)throw new Error("Canvas 2D is unavailable; this browser cannot create an export.");i.fillStyle=this.canvasBackground,i.fillRect(0,0,t.width,t.height);try{i.drawImage(e,0,0)}finally{e.width=1,e.height=1}return t}updateFreeTextVisibility(){let e=this.exportMode?Math.max(this.effScale(),ne):this.effScale();for(let{objectId:t,node:i,backdrop:o,categoryKey:n,kind:r}of this.freeTextById.values()){let a=n!=null&&(r==="ga-label"||r==="ga-capacity")&&this.gaCategoryDimmed(n),l=t!=null&&(r==="ga-label"||r==="ga-capacity")&&this.gaById.get(t)?.sectionId!=null&&e<ee,c=r==="free-text"&&this.nodeBelongsToFocusedSection(i),h=!a&&!l&&(c||fe(i.fontSize(),e));i.visible(h),o?.visible(h)}for(let{node:t,fontSize:i}of this.iconNodeById.values())t.visible(this.nodeBelongsToFocusedSection(t)||fe(i,e))}nodeBelongsToFocusedSection(e){let t=this.focusedSectionId;if(!t)return!1;let i=this.sections.filter(r=>r.id===t||r.logicalId===t||r.zone===t);if(!i.length)return!1;let o=e.getClientRect({relativeTo:this.bgLayer,skipShadow:!0}),n={x:o.x+o.width/2,y:o.y+o.height/2};return i.some(r=>j(n,r.outline,r.holes))}buildRowLabelPlan(e){this.rowLabelPlan=Ms(e,{theme:this.theme,seats:this.seats,seatSection:this.seatSection,seatR:this.seatR,objectFilteredOut:t=>this.objectFilteredOut(t)})}rowLabelBox(e,t,i=U){return jt(e,t,i)}resolveAutomaticRowLabelPosition(e,t,i){return Ps(e,t,i,this.seatIndex)}objectFilteredOut(e){let t=e.categoryKey;return t?!!(this.categoryHighlight&&t!==this.categoryHighlight||this.categoryFilter&&!this.categoryFilter.has(t)):!1}updateLabels(){Fs(this.viewportLabelContext)}get viewportLabelContext(){return{exportMode:this.exportMode,effScale:()=>this.effScale(),boothLabelById:this.boothLabelById,circleById:this.circleById,focusedSeatOpacity:(e,t)=>this.focusedSeatOpacity(e,t),labelGroup:this.labelGroup,labelLiftGroups:this.labelLiftGroups,seatLabelById:this.seatLabelById,visibleSeatCandidates:()=>this.visibleSeatCandidates(),worldToScreen:e=>this.worldToScreen(e),stage:this.stage,accessGlyphById:this.accessGlyphById,accessGlyphShouldShow:e=>this.accessGlyphShouldShow(e),statusById:this.statusById,renderedSeatPoint:e=>this.renderedSeatPoint(e),viewMode:this.viewMode,perspectiveSeatScale:this.perspectiveSeatScale,ownedHold:this.ownedHold,opts:this.opts,seatLabelContainer:e=>this.seatLabelContainer(e),seatLabelScale:e=>this.seatLabelScale(e),labelFont:()=>this.labelFont(),seatLabelInk:(e,t)=>this.seatLabelInk(e,t),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e),seatR:this.seatR,freeTextById:this.freeTextById,bgLayer:this.bgLayer,rowLabelPlan:this.rowLabelPlan,focusedSectionId:this.focusedSectionId,resolveAutomaticRowLabelPosition:(e,t,i)=>this.resolveAutomaticRowLabelPosition(e,t,i),rowLabelBox:(e,t)=>this.rowLabelBox(e,t),isoT:this.isoT,applyUprightLabels:()=>this.applyUprightLabels(),overlayLayer:this.overlayLayer}}handleResize(){let e=this.container.clientWidth||1,t=this.container.clientHeight||1;e===this.stage.width()&&t===this.stage.height()||(this.stage.size({width:e,height:t}),this.refitCurrentView())}startFpsLoop(){let e=t=>{this.lastFpsAt||(this.lastFpsAt=t),this.frames++;let i=t-this.lastFpsAt;i>=1e3&&(this.opts.onFps?.(Math.round(this.frames*1e3/i)),this.frames=0,this.lastFpsAt=t),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}};et.ZOOM_STEP=1.4;var si=et;function $s(s,e){return new si(s,e)}function Xs(s,e={}){let{baseMs:t=1e3,factor:i=2,maxMs:o=1/0,jitter:n=0,random:r=Math.random}=e,a=Math.min(t*i**Math.max(0,s),o);if(n<=0)return a;let l=Math.min(1,n);return a*(1-l+l*r())}var me=class extends Error{constructor(t){super(t.message);this.status=422;this.name="PickerSelectionError",this.reason=t.code,this.labels=t.labels}};var zo=10,Wo=15e3,Ys=["background","rowLabelColor","textColor","selectionColor"];function Ko(s,e){return!s||!e?!s&&!e:Ys.every(t=>s[t]===e[t])}function Pt(s){let e=s??{};return{status:e.status,conflicts:e.conflicts,reason:e.reason}}function oi(s){return s==="blocked"?"not_for_sale":s==="held"||s==="booked"||s==="free"||s==="not_for_sale"?s:"free"}var qs=class{constructor(e){this.selectableSeatIds=null;this.lastSelectionValidity=null;this.renderer=null;this._doc=null;this.hidden=new Set;this.mapTheme=null;this.closedSections=new Set;this.labelToId=new Map;this.labelToSeat=new Map;this.seatTiers=new Map;this.seatById=new Map;this.seatContext=new Map;this.allIds=[];this.groupedTablesByObject=new Map;this.groupedTablesByLabel=new Map;this.groupedTableBySeatId=new Map;this.tableQuantities=new Map;this.confirmedVariableTables=new Set;this.groupedSelectionOverhead=0;this.ws=null;this.realtime=null;this.reconnectTimer=null;this.attempt=0;this.closed=!1;this.onVisibilityChange=null;this.hold_=null;this.liveStatuses=new Map;this.liveDefault="free";this.currency="USD";this.expiryTimer=null;this.hintShown=!1;this.opts=e,this.api=e.transport,this.key=e.eventKey;let t=e.numberOfPlacesToSelect;if(t!=null&&(!Number.isInteger(t)||t<1))throw new Error("picker: `numberOfPlacesToSelect` must be a positive integer");this.numberOfPlacesToSelect=t??null;let i=Math.max(0,Math.floor(e.maxSelection??this.numberOfPlacesToSelect??zo));if(this.numberOfPlacesToSelect!=null&&i<this.numberOfPlacesToSelect)throw new Error("picker: `maxSelection` cannot be lower than `numberOfPlacesToSelect`");this.maxSelection=this.numberOfPlacesToSelect??i,this.selectableObjectRefs=e.selectableObjects==null?null:[...new Set(e.selectableObjects.filter(o=>typeof o=="string"&&!!o))],this.mapTheme=e.mapTheme??null}get doc(){return this._doc}visibleDoc(){if(!this._doc)return{objects:[]};let e=ki(this._doc,this.hidden);if(!this.mapTheme)return e;let t={...e.theme??{}};for(let i of Ys){let o=this.mapTheme[i];o&&(t[i]=o)}return{...e,theme:t}}setMapTheme(e){if(Ko(this.mapTheme,e??null))return!1;this.mapTheme=e??null;let t=this.renderer;if(!t)return!0;let i=t.getSelection().map(r=>r.id),o=this.getActiveFloorId(),n=t.isFloorOverview?.()??!1;return t.setChart(this.visibleDoc(),o?{floorId:o}:void 0),n&&t.setFloorOverview?.(!0),this.opts.colorblindSafe&&t.setColorblindSafe?.(!0),this.closedSections.size&&t.setClosedSections?.([...this.closedSections]),this.applySeatsMap(Object.fromEntries(this.liveStatuses),this.liveDefault),i.length&&t.select?.(i),!0}syncHidden(e){let t=e.filter(o=>typeof o=="string");if(t.length===this.hidden.size&&t.every(o=>this.hidden.has(o)))return!1;this.hidden=new Set(t);let i=this.renderer?.isFloorOverview?.()??!1;return this.renderer?.setChart(this.visibleDoc()),i&&this.renderer?.setFloorOverview?.(!0),!0}syncClosed(e){let t=(e??[]).filter(i=>typeof i=="string");return t.length===this.closedSections.size&&t.every(i=>this.closedSections.has(i))?!1:(this.closedSections=new Set(t),this.renderer?.setClosedSections?.(t),!0)}isSectionClosed(e){return this.closedSections.has(e)}currentHold(){return this.hold_}getRenderer(){return this.renderer}seatByLabel(e){return this.labelToSeat.get(e)}idForLabel(e){return this.labelToId.get(e)}idsForLabel(e){let t=this.groupedTablesByLabel.get(e);if(t)return t.chairs.map(o=>o.id);let i=this.labelToId.get(e);return i?[i]:[]}idsForLabels(e){return[...new Set([...e].flatMap(t=>this.idsForLabel(t)))]}tableSelection(e){let t=this.groupedTableBySeatId.get(e)??this.groupedTablesByLabel.get(e);return t?this.toTableSeat(t):null}lineItemDisplay(e){if(e.objectType==="ga"){let o=this.visibleDoc(),n=rt(o).find(r=>r.id===e.objectId);return{...n?.displayLabel?{displayLabel:n.displayLabel}:{},...n?.displayType?{displayType:n.displayType}:{}}}if(e.objectType==="table"){let o=this.groupedTablesByLabel.get(e.label);return{...o?.displayLabel&&o.displayLabel!==o.label?{displayLabel:o.displayLabel}:{},...o?.displayType?{displayType:o.displayType}:{}}}let t=this.labelToSeat.get(e.label),i=t?this.seatContext.get(t.id):void 0;return{...t?.displayLabel?{displayLabel:t.displayLabel}:{},...i?.displayType?{displayType:i.displayType}:{}}}async render(e){if(this.renderer)return null;let t=performance.now(),i={},o=S=>Math.round((performance.now()-S)*100)/100;this.closed=!1;let n,r=performance.now();try{n=await this.api.chart(this.key)}catch(S){return this.emitError(S),null}if(i.loadChart=o(r),this.closed)return null;this._doc=n.doc;let a=performance.now();try{let S=zi(n.doc,n.event.inventoryModelVersion===2?2:1);this.groupedTablesByObject=new Map(S.map(w=>[w.objectId,w])),this.groupedTablesByLabel=new Map(S.map(w=>[w.label,w])),this.groupedTableBySeatId=new Map(S.flatMap(w=>w.chairs.map(x=>[x.id,w]))),this.tableQuantities=new Map(S.map(w=>[w.label,w.mode==="whole"?w.capacity:w.minOccupancy])),this.confirmedVariableTables=new Set,this.groupedSelectionOverhead=S.reduce((w,x)=>w+Math.max(0,x.chairs.length-1),0)}catch(S){return this.emitError(S),null}this.labelToId=new Map,this.labelToSeat=new Map,this.seatById=new Map,this.seatContext=new Map,this.allIds=[];let l=new Map(mi(n.doc).map(S=>[S.id,S])),c=Gt(n.doc),h=new Map([...c.sections,...c.ungrouped?[c.ungrouped]:[]].map(S=>[S.id,S.label]));for(let S of He(n.doc)){this.labelToId.set(S.label,S.id),this.labelToSeat.set(S.label,S),this.seatById.set(S.id,S),this.allIds.push(S.id);let w=l.get(S.rowId),x=w&&"label"in w&&typeof w.label=="string"?w.label:void 0,I=w?.type==="row"?w.segmentedRow:void 0,T=I?.displayLabel??(w&&"displayLabel"in w&&typeof w.displayLabel=="string"&&w.displayLabel?w.displayLabel:x),P=this.groupedTablesByObject.get(S.rowId),C=w?.type==="table"?"table":w?.type==="booth"?"booth":"seat",M=T,R=I?.displayType?.trim()||(w&&"displayType"in w&&typeof w.displayType=="string"&&w.displayType.trim()?w.displayType.trim():void 0),A=S.displayLabel??S.label,B=A.split("-"),W=P||S.kind==="booth"?void 0:T&&A.startsWith(`${T}-`)?A.slice(T.length+1):B[B.length-1]??A;this.seatContext.set(S.id,{objectId:S.rowId,objectType:C,sectionLabel:h.get(c.objectToSection.get(S.rowId)??""),rowLabel:M,seatNumber:W,...R?{displayType:R,rowType:R}:{}})}for(let S of this.groupedTablesByLabel.values()){let w=S.chairs[0];w&&(this.labelToId.set(S.label,w.id),this.labelToSeat.set(S.label,w))}i.normalizeBuyerModel=o(a);let u=n.event.currency??this.opts.currency;this.currency=u??"USD";let d=performance.now(),g=$s(e,{maxSelection:this.rendererSelectionCap(),confirmSelection:this.opts.confirmSelection,portraitFitCrop:!0,currency:u,onSelect:S=>{this.handleRendererSelect(S)},onDeselect:S=>{this.handleRendererDeselect(S)},onSelectionLimit:this.opts.onSelectionLimit,onHover:S=>{this.opts.onHover?.(S),this.opts.onSeatHover&&this.opts.onSeatHover(S?this.describeSeat(S):null)},onFocusSeat:this.opts.onFocusSeat,onViewChange:this.opts.onViewChange,onGAClick:this.opts.onGAClick,onSectionTap:S=>this.handleSectionTap(S),onDeckTap:S=>this.handleDeckTap(S),onFps:this.opts.onFps});if(i.createRenderer=o(d),this.closed)return g.destroy(),null;this.renderer=g;let y=null,p="free",f=[],b=performance.now();try{let S=await this.api.objects(this.key);this.hidden=new Set(S.hidden??[]),f=(S.closed??[]).filter(w=>typeof w=="string"),y=S.seats,p=S.default??"free"}catch{}if(i.loadStatuses=o(b),this.closed)return g.destroy(),this.renderer=null,null;let m=performance.now();g.setChart(this.visibleDoc()),(n.doc.floors?.length??0)>1&&g.setFloorOverview?.(!0),this.opts.colorblindSafe&&g.setColorblindSafe?.(!0),i.buildScene=o(m),this.closedSections=new Set(f);let v=performance.now();f.length&&g.setClosedSections?.(f),y&&this.applySeatsMap(y,p),this.rebuildSelectableSeatIds(),this.opts.selectedObjects?.length?this.select(this.opts.selectedObjects):this.emitSelectionValidity(),i.applyInitialState=o(v);let k=performance.now();g.forceDraw(),i.firstPaint=o(k);let L=performance.now();return this.attachVisibilityListener(),this.connect(),i.startRealtime=o(L),i.controllerTotal=o(t),{doc:n.doc,salesClosed:!!n.event.salesClosed,eventName:n.event.name,venue:n.event.venue,startsAt:n.event.startsAt,timezone:n.event.timezone??null,currency:u,mode:n.event.mode??"live",posterUrl:n.event.posterUrl??null,performanceProfile:i}}getSelection(){if(!this.renderer)return[];let e=[],t=new Set;for(let i of this.renderer.getSelection()){let o=this.groupedTableBySeatId.get(i.id);o?t.has(o.label)||(t.add(o.label),e.push(this.toTableSeat(o))):e.push(this.toSeat(i))}return e}seatDetails(e){let t=this.seatById.get(e);return t?this.describeSeat(t):null}clearSelection(){this.renderer?.clearSelection(),this.resetUnheldTableQuantities(),this.emitSelectionChange()}deselect(e){let t=new Set;for(let i of e){let o=this.groupedTableBySeatId.get(i)??this.groupedTablesByLabel.get(i);if(o)o.chairs.forEach(n=>t.add(n.id)),this.hold_?.labels.includes(o.label)||(this.tableQuantities.set(o.label,o.mode==="whole"?o.capacity:o.minOccupancy),o.mode==="variable"&&this.confirmedVariableTables.delete(o.label));else{let n=this.seatById.has(i)?i:this.labelToId.get(i);n&&t.add(n)}}this.renderer?.deselect([...t]),this.emitSelectionChange()}setMaxSelection(e){this.maxSelection=Math.max(0,Math.floor(e)),this.renderer?.setMaxSelection?.(this.rendererSelectionCap())}select(e){let t=new Set(this.getSelection().map(r=>r.label)),i=new Set,o=[];for(let r of e){let a=this.groupedTableBySeatId.get(r)??this.groupedTablesByLabel.get(r);if(a)this.tableTierResolution(a).kind==="invalid"?o.push(a.label):a.chairs.forEach(c=>{this.isSelectableByPolicy(c.id)&&i.add(c.id)});else{let l=this.seatById.has(r)?r:this.labelToId.get(r);if(!l||!this.isSelectableByPolicy(l))continue;let c=this.seatById.get(l);c&&this.seatTierResolution(c).kind==="invalid"?o.push(c.label):i.add(l)}}if(o.length&&this.emitError(new me(Wt(o))),!i.size)return[];if(this.renderer?.select?.([...i]),this.selectionGuestCount()>this.maxSelection)return this.renderer?.deselect([...i]),this.opts.onSelectionLimit?.(this.maxSelection),[];let n=this.getSelection().filter(r=>!t.has(r.label));return n.length&&this.emitSelectionChange(),n}selectCategories(e){let t=new Set(e);return this.select([...this.seatById.values()].filter(i=>t.has(i.categoryKey)).map(i=>i.id))}deselectCategories(e){let t=new Set(e);this.deselect(this.getSelection().filter(i=>t.has(i.categoryKey)).map(i=>i.id))}setSelectableObjects(e){this.selectableObjectRefs=e==null?null:[...new Set(e.filter(i=>typeof i=="string"&&!!i))],this.rebuildSelectableSeatIds();let t=this.renderer?.getSelection().filter(i=>!this.isSelectableByPolicy(i.id)).map(i=>i.id)??[];t.length&&this.deselect(t)}getSelectionValidity(){let e=this.numberOfPlacesToSelect;if(e==null)return null;let t=this.getSelection(),i=t.reduce((o,n)=>o+(n.quantity??1),0);return{isValid:i===e,count:i,required:e,remaining:Math.max(0,e-i),seats:t}}rebuildSelectableSeatIds(){if(this.selectableObjectRefs==null){this.selectableSeatIds=null;return}let e=new Set;for(let t of this.selectableObjectRefs){let i=this.groupedTableBySeatId.get(t)??this.groupedTablesByLabel.get(t);if(i){i.chairs.forEach(n=>e.add(n.id));continue}let o=this.seatById.has(t)?t:this.labelToId.get(t);o&&e.add(o)}this.selectableSeatIds=e}isSelectableByPolicy(e){return this.selectableSeatIds==null||this.selectableSeatIds.has(e)}setTableQuantity(e,t){let i=this.groupedTablesByLabel.get(e);if(!i)return!1;let o=i.mode==="whole"?i.capacity:Math.floor(t);if(!Number.isInteger(o)||o<i.minOccupancy||o>i.maxOccupancy)return!1;let n=this.tableQuantities.get(e)??i.minOccupancy;return this.tableQuantities.set(e,o),this.selectionGuestCount()>this.maxSelection?(this.tableQuantities.set(e,n),this.opts.onSelectionLimit?.(this.maxSelection),!1):(i.mode==="variable"&&this.confirmedVariableTables.add(e),this.emitSelectionChange(),!0)}async replaceTableQuantity(e,t,i){let o=this.groupedTablesByLabel.get(e),n=this.hold_;if(!o||o.mode!=="variable"||!n?.labels.includes(e))return null;let r=Math.floor(t);if(!Number.isInteger(r)||r<o.minOccupancy||r>o.maxOccupancy)return null;if((n.items??[]).filter(h=>h.label!==e).reduce((h,u)=>h+(u.quantity??1),0)+r>this.maxSelection)return this.opts.onSelectionLimit?.(this.maxSelection),null;let l=(n.items??[]).map(h=>({label:h.label,tierId:h.tierId,quantity:h.label===e?r:h.quantity}));if(!l.some(h=>h.label===e))return null;let c=await this.api.hold(this.key,l,i,n.holdId);return this.tableQuantities.set(e,r),this.setHold({holdId:c.holdId,labels:l.map(h=>h.label),expiresAt:c.expiresAt,items:c.items}),this.hold_}rendererSelectionCap(){return this.maxSelection+this.groupedSelectionOverhead}selectionGuestCount(){return this.getSelection().reduce((e,t)=>e+(t.quantity??1),0)}handleRendererSelect(e){let t=this.groupedTableBySeatId.get(e.id);if(!this.isSelectableByPolicy(e.id)){this.renderer?.deselect(t?t.chairs.map(o=>o.id):[e.id]),this.emitSelectionChange();return}if((t?this.tableTierResolution(t):this.seatTierResolution(e)).kind==="invalid"){this.renderer?.deselect(t?t.chairs.map(o=>o.id):[e.id]),this.emitError(new me(Wt([t?.label??e.label]))),this.emitSelectionChange();return}if(t){if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect(t.chairs.map(o=>o.id)),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.renderer?.select?.(t.chairs.map(o=>o.id)),this.opts.onSelect?.(t.chairs[0]??e),this.opts.onTableSelectionRequest?.(this.toTableSeat(t)),this.emitSelectionChange();return}if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect([e.id]),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.opts.onSelect?.(e),this.emitSelectionChange()}handleRendererDeselect(e){let t=this.groupedTableBySeatId.get(e.id);t?(this.renderer?.deselect(t.chairs.map(i=>i.id)),this.hold_?.labels.includes(t.label)||(this.tableQuantities.set(t.label,t.mode==="whole"?t.capacity:t.minOccupancy),t.mode==="variable"&&this.confirmedVariableTables.delete(t.label)),this.opts.onDeselect?.(t.chairs[0]??e)):this.opts.onDeselect?.(e),this.emitSelectionChange()}resetUnheldTableQuantities(){for(let e of this.groupedTablesByLabel.values())this.hold_?.labels.includes(e.label)||(this.tableQuantities.set(e.label,e.mode==="whole"?e.capacity:e.minOccupancy),e.mode==="variable"&&this.confirmedVariableTables.delete(e.label))}resetTableQuantitiesForLabels(e){for(let t of e){let i=this.groupedTablesByLabel.get(t);i&&(this.tableQuantities.set(t,i.mode==="whole"?i.capacity:i.minOccupancy),i.mode==="variable"&&this.confirmedVariableTables.delete(t))}}tableQuantityRequest(e){if(e?.objectType!=="table")return{};if(e.bookingMode==="variable"&&!this.confirmedVariableTables.has(e.label))throw new Error("picker: confirm a variable table guest quantity before holding");return{quantity:e.quantity}}async hold(e,t){if(!this.renderer)return null;let o=e??this.getSelection().map(l=>l.label),n=(this.hold_?.items??[]).filter(l=>l.objectType==="ga"),r=[...new Set([...n.map(l=>l.label),...o])];if(!r.length)return null;let a=this.ticketIssue(r);if(a)throw new me(a);if(this.hold_&&this.holdCovers(r))return this.hold_;try{let l=r.map(h=>{let u=n.find(y=>y.label===h);if(u)return{label:h,tierId:u.tierId,quantity:u.quantity};let d=this.labelToSeat.get(h),g=d?this.toSeat(d):null;return{label:h,...g?.tierId?{tierId:g.tierId}:{},...this.tableQuantityRequest(g)}}),c=await this.api.hold(this.key,l,t,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:r,expiresAt:c.expiresAt,items:c.items}),this.hold_}catch(l){throw this.handle409Conflicts(l),l}}async resumeHold(e){if(this.closed||!e||!this.api.resume)return null;let t=await this.api.resume(this.key,e);if(this.closed)return null;let i=[...new Set(t.items.map(o=>o.label))];return i.length?(this.setHold({holdId:t.holdId,labels:i,expiresAt:t.expiresAt,items:t.items},"restored"),this.hold_):null}async extendHold(e){let t=this.hold_;if(!t||!this.api.extend)return null;try{let i=await this.api.extend(this.key,t.holdId,e);return this.hold_?.holdId!==t.holdId?this.hold_:(this.setHold({holdId:t.holdId,labels:t.labels,expiresAt:i.expiresAt,items:t.items}),this.hold_)}catch{return null}}categoryAvailability(){let e={},t=this.closedMemberIds();for(let[i,o]of this.seatById)this.groupedTableBySeatId.has(i)||t.has(i)||(this.getStatus(i)??"free")==="free"&&(e[o.categoryKey]=(e[o.categoryKey]??0)+1);for(let i of this.groupedTablesByLabel.values()){if(i.chairs.some(n=>t.has(n.id)))continue;let o=i.chairs[0];o&&(this.getStatus(o.id)??"free")==="free"&&(e[i.categoryKey]=(e[i.categoryKey]??0)+i.maxOccupancy)}return e}closedMemberIds(){let e=new Set,t=this.renderer;if(!t||!this.closedSections.size)return e;for(let i of this.closedSections)for(let o of t.sectionMembers?.(i)??[])e.add(o);return e}getGAAreas(){let e=this.visibleDoc();return e?rt(e).map(t=>{let i=e.categories.find(o=>o.key===t.categoryKey);return{id:t.id,label:t.label,...t.displayLabel?{displayLabel:t.displayLabel}:{},...t.displayType?{displayType:t.displayType}:{},capacity:Math.max(0,Math.floor(t.capacity)),available:_t(t).filter(o=>this.statusOf(o)==="free").length,categoryKey:t.categoryKey,tiers:i?.tiers,price:i?.tiers?.[0]?.price??i?.price??0,currency:this.currency}}):[]}async holdGA(e,t,i={}){let o=this.visibleDoc();if(!o||!Number.isFinite(t)||t<1)return null;let n=rt(o).find(h=>h.id===e);if(!n)return null;let r=_t(n).filter(h=>!this.hold_?.labels.includes(h)&&this.statusOf(h)==="free").slice(0,Math.floor(t));if(r.length!==Math.floor(t))return null;let a=new Map;for(let h of this.hold_?.items??[])a.set(h.label,{label:h.label,tierId:h.tierId,quantity:h.quantity});if(this.hold_&&!this.hold_?.items?.length)for(let h of this.hold_.seats)a.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{}});for(let h of this.getSelection())a.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{},...this.tableQuantityRequest(h)});for(let h of r)a.set(h,{label:h,...i.tierId?{tierId:i.tierId}:{}});let l=[...a.values()],c=await this.api.hold(this.key,l,i.ttlMs,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:l.map(h=>h.label),expiresAt:c.expiresAt,items:c.items}),this.hold_}hasPremiumSeats(){for(let e of this.labelToSeat.values())if(e.commercial?.premium)return!0;return!1}getBestAvailableZones(){let e=this.visibleDoc();if(!e?.zones?.length)return[];let t=new Set(Gt(e).sections.filter(i=>i.seatCount>0&&!!i.zone).map(i=>i.zone));return e.zones.filter(i=>t.has(i.id)).map(i=>({id:i.id,label:i.label}))}pickPremiumBlock(e,t,i){let o=this.visibleDoc();if(!o?.objects?.length)return null;let n=o.focalPoint??{x:0,y:0},r=new Set(this.groupedTablesByObject.keys()),a=He(o).filter(d=>!r.has(d.rowId)),l=new Set(this.hold_?.labels??[]),c=new Set;for(let d of a){if(l.has(d.label)||this.seatTierResolution(d).kind==="invalid")continue;let g=this.labelToId.get(d.label);((g?this.getStatus(g):void 0)??"free")==="free"&&c.add(d.label)}let h=Hi(a,c,{qty:e,categoryKey:t,zoneId:i,focal:n,preferPremium:!0});return h.labels.length!==e?null:h.labels.every(d=>this.labelToSeat.get(d)?.commercial?.premium)?[...h.labels]:null}async bestAvailable(e,t,i={}){let o=this.renderer;if(!o)return null;if(i.preferPremium){let n=this.pickPremiumBlock(e,t,i.zoneId);if(n){if(this.hold_&&!await this.release())return null;try{let r=n.map(h=>{let u=this.labelToSeat.get(h),d=u?this.toSeat(u):null;return{label:h,...d?.tierId?{tierId:d.tierId}:{}}}),a=await this.api.hold(this.key,r,i.ttlMs);o.clearSelection();let l=this.idsForLabels(n);l.length&&o.setStatus(l,"held"),this.setHold({holdId:a.holdId,labels:[...n],expiresAt:a.expiresAt,items:a.items});let c=n.map(h=>this.labelToSeat.get(h)).filter(h=>!!h).map(h=>this.toSeat(h));return this.opts.onSelectionChange?.(c),this.hold_}catch(r){let{status:a,reason:l}=Pt(r);if(a===409&&l==="event_closed")throw this.opts.onSalesClosed?.(),r}}}if(this.hold_&&!await this.release())return null;try{let n=await this.api.bestAvailable(this.key,e,t,i.zoneId,i.ttlMs);o.clearSelection();let r=this.idsForLabels(n.labels);r.length&&o.setStatus(r,"held"),this.setHold({holdId:n.holdId,labels:[...n.labels],expiresAt:n.expiresAt,items:n.items});let a=n.labels.map(l=>this.labelToSeat.get(l)).filter(l=>!!l).map(l=>this.toSeat(l));return this.opts.onSelectionChange?.(a),this.hold_}catch(n){let{status:r,reason:a}=Pt(n);throw r===409&&a==="event_closed"&&this.opts.onSalesClosed?.(),n}}async book(e,t,i){let o=this.renderer;if(!o)return null;if(!this.api.book)throw new Error("picker: transport has no book() \u2014 hold-only mode");let n=t??this.getSelection().map(c=>c.label);if(!n.length)return null;let r=this.ticketIssue(n);if(r)throw new me(r);let a;try{if(this.hold_&&this.holdCovers(n))a=this.hold_.holdId;else{let c=this.hold_?.holdId,h=await this.api.hold(this.key,n.map(u=>{let d=this.labelToSeat.get(u),g=d?this.toSeat(d):null;return{label:u,...g?.tierId?{tierId:g.tierId}:{},...this.tableQuantityRequest(g)}}),i,c);a=h.holdId,this.setHold({holdId:a,labels:[...n],expiresAt:h.expiresAt,items:h.items})}await this.api.book(this.key,n,a,e)}catch(c){let{status:h,conflicts:u,reason:d}=Pt(c);if(this.clearHold(),h===409&&d==="event_closed")this.opts.onSalesClosed?.();else if(h===409&&u?.length){let g=new Set(u.map(f=>f.label)),y=this.idsForLabels(g);y.length&&(o.setStatus(y,"booked"),o.deselect(y),this.resetTableQuantitiesForLabels(g));let p=n.filter(f=>!g.has(f));p.length&&a&&this.api.release(this.key,p,a).catch(()=>{}),this.emitSelectionChange()}else a&&this.api.release(this.key,n,a).catch(()=>{});throw c}let l=this.idsForLabels(n);return l.length&&(o.setStatus(l,"booked"),o.deselect(l)),this.clearHold(),this.resetTableQuantitiesForLabels(n),this.emitSelectionChange(),this.opts.onBook?.(e),n}async release(){let e=this.hold_;if(!e)return!0;try{let i=await this.api.release(this.key,e.labels,e.holdId);if(!this.releaseConfirmed(i,e.labels))return await this.resnapshot(),!1}catch(i){return this.emitError(i),!1}if(this.hold_?.holdId!==e.holdId)return!0;this.clearHold(),this.resetTableQuantitiesForLabels(e.labels);let t=this.idsForLabels(e.labels);return t.length&&(this.renderer?.deselect(t),this.renderer?.setStatus(t,"free")),!0}async releaseLabels(e){let t=this.hold_;if(!t)return!0;let i=e.filter(a=>t.labels.includes(a));if(!i.length)return!0;try{let a=await this.api.release(this.key,i,t.holdId);if(!this.releaseConfirmed(a,i))return await this.resnapshot(),!1}catch(a){return this.emitError(a),!1}if(this.hold_?.holdId!==t.holdId)return!0;let o=t.labels.filter(a=>!i.includes(a)),n=t.items?.filter(a=>!i.includes(a.label));o.length?this.setHold({...t,labels:o,items:n}):this.clearHold(),this.resetTableQuantitiesForLabels(i);let r=this.idsForLabels(i);return r.length&&(this.renderer?.deselect(r),this.renderer?.setStatus(r,"free")),!0}releaseConfirmed(e,t){let i=e?.released;return!Array.isArray(i)||t.every(o=>i.includes(o))}setStatus(e,t){this.renderer?.setStatus(e,t)}getStatus(e){return this.renderer?.getStatus(e)}notForSaleCategorySeatIds(){let e=this.doc;if(!e)return[];let t=new Set(e.categories.filter(o=>o.notForSale).map(o=>o.key));if(!t.size)return[];let i=[];for(let[o,n]of this.seatById)t.has(n.categoryKey)&&i.push(o);return i}flashSeat(e,t){this.renderer?.flashSeat(e,t)}zoomIn(){this.renderer?.zoomIn()}zoomOut(){this.renderer?.zoomOut()}zoomToFit(){this.renderer?.zoomToFit()}refitCurrentView(){this.renderer?.refitCurrentView?this.renderer.refitCurrentView():this.renderer?.zoomToFit()}worldToScreen(e){return this.renderer?.worldToScreen(e)??{x:0,y:0}}setSelectionFocus(e){this.renderer?.setSelectionFocus?.(e)}setAccessibilityFilter(e){this.renderer?.setAccessibilityFilter?.(e)}setCommercialLimitedFilter(e){this.renderer?.setCommercialLimitedFilter?.(e)}getFloors(){return this.renderer?.getFloors?.()??[]}getActiveFloorId(){return this.renderer?.getActiveFloorId?.()??""}setFloor(e){let t=this.renderer;!t?.setActiveFloor||e===t.getActiveFloorId?.()&&!t.isFloorOverview?.()||(t.setFloorOverview?.(!1),t.setStacked?.(!1),t.setActiveFloor(e),this.resnapshot(),this.emitSelectionChange())}setStacked(e){let t=this.renderer;!t?.setStacked||e===t.isStacked?.()||(t.setStacked(e),this.resnapshot())}isMultiFloor(){return(this._doc?.floors?.length??0)>1}setFloorOverview(e){let t=this.renderer;!t?.setFloorOverview||e===t.isFloorOverview?.()||(t.setFloorOverview(e),this.resnapshot(),this.emitSelectionChange())}isFloorOverview(){return this.renderer?.isFloorOverview?.()??!1}handleDeckTap(e){let t=this.renderer;t&&(t.setViewMode?.("flat"),t.setFloorOverview?.(!1),t.setStacked?.(!1),t.setActiveFloor?.(e),this.resnapshot(),this.emitSelectionChange(),this.opts.onDeckTap?.(e))}setViewMode(e){this.renderer?.setViewMode?.(e)}getViewMode(){return this.renderer?.getViewMode?.()??"flat"}getRung(){return this.renderer?.getRung?.()??"seats"}setRung(e){if(e==="zones"){this.overview();return}this.renderer?.setRung?.(e)}setCategoryFilter(e){this.renderer?.setCategoryFilter?.(e)}focusCategoryFilter(e){let t=this.renderer;if(t){if(t.clearSectionFocus?.(),this.opts.onSectionFocus?.(null),e?.length){let i=this.floorForCategories(e);i&&this.setFloor(i)}t.focusCategories?t.focusCategories(e):t.zoomToFit()}}floorForCategories(e){let t=this._doc;if(!t?.floors||t.floors.length<2)return null;let i=new Set(e),o=a=>a.some(l=>l.type==="row"&&(i.has(l.categoryKey)||(l.overrides??[]).some(c=>c.categoryKey!=null&&i.has(c.categoryKey)))||l.type==="gaArea"&&i.has(l.categoryKey)),n=this.getActiveFloorId(),r=t.floors.find(a=>a.id===n);return r&&o(r.objects)?null:t.floors.find(a=>o(a.objects))?.id??null}getViewport(){let e=this.renderer;return!e?.getVisibleWorldRect||!e.getWorldBounds?null:{visible:e.getVisibleWorldRect(),bounds:e.getWorldBounds()}}getMinimapSnapshot(){return this.renderer?.getMinimapSnapshot?.()??{sections:[],seats:[]}}panToWorld(e){this.renderer?.panToWorld?.(e)}clearSectionFocus(){this.renderer?.clearSectionFocus?.(),this.opts.onSectionFocus?.(null)}getRenderedQualityEvidence(){return this.renderer?.getRenderedQualityEvidence()??null}focusSection(e){this.handleSectionTap(e)}getSectionSeatCount(e){return this.renderer?.sectionMembers?.(e)?.length??0}overview(){this.renderer?.clearSectionFocus?.(),this.renderer?.zoomToFit(),this.opts.onSectionFocus?.(null)}handleSectionTap(e){let t=this.renderer;if(t){if(t.focusSection?t.focusSection(e):t.focusRegion?.(e),this.isSectionClosed(e)){this.opts.onSectionFocus?.(null);return}this.opts.onSectionFocus?.(this.sectionSummary(e))}}sectionSummary(e){let t=this.renderer,i=this._doc;if(!t||!i)return null;let o=i.objects.find(y=>y.type==="section"&&y.id===e);if(!o)return null;let n=t.sectionMembers?.(e)??[],r=new Map,a=new Set,l=0;for(let y of n){let p=this.seatById.get(y);if(!p)continue;let f=this.groupedTableBySeatId.get(y);if(f){if(a.has(f.label))continue;a.add(f.label),r.set(f.categoryKey,(r.get(f.categoryKey)??0)+f.maxOccupancy),t.getStatus(f.chairs[0]?.id??y)==="free"&&(l+=f.maxOccupancy)}else r.set(p.categoryKey,(r.get(p.categoryKey)??0)+1),t.getStatus(y)==="free"&&l++}let c=[...r.entries()].map(([y,p])=>{let f=i.categories.find(k=>k.key===y),b=f?.tiers?.length?f.tiers.map(k=>k.price):[f?.price??0],m=Math.min(...b),v=Math.max(...b);return{key:y,count:p,label:f?.label??y,color:f?.color??"#6e7bff",price:m,priceMin:m,priceMax:v}}).sort((y,p)=>y.price-p.price),h=c.map(y=>y.priceMin),u=c.map(y=>y.priceMax),d=o.zone?i.zones?.find(y=>y.id===o.zone):void 0,g=o.color??d?.color??c[0]?.color??"#6e7bff";return{id:e,label:o.displayLabel??o.label,zoneLabel:d?.label??"",...o.entrance&&o.entrance.trim()?{entrance:o.entrance.trim()}:{},color:g,seatsLeft:l,priceMin:h.length?Math.min(...h):0,priceMax:u.length?Math.max(...u):0,categories:c}}destroy(){if(this.closed=!0,this.detachVisibilityListener(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.expiryTimer&&(clearTimeout(this.expiryTimer),this.expiryTimer=null),this.realtime){try{this.realtime.stop()}catch{}this.realtime=null}if(this.ws){try{this.ws.close()}catch{}this.ws=null}this.renderer?.destroy(),this.renderer=null}toSeat(e){let t=this.groupedTableBySeatId.get(e.id);if(t)return this.toTableSeat(t);let i=e.commercial?{commercial:e.commercial}:void 0,o=e.displayLabel?{displayLabel:e.displayLabel}:void 0,n=e.accessibility?.length?{accessibility:e.accessibility}:void 0,r=e.wheelchairSpaceType?{wheelchairSpaceType:e.wheelchairSpaceType}:void 0,a=this.seatContext.get(e.id),l=this.tiersForSeat(e),c=this.seatTierResolution(e);if(c.kind!=="resolved"||!l)return{id:e.id,label:e.label,...o,...a,categoryKey:e.categoryKey,price:this.priceFor(e.categoryKey),currency:this.currency,...i,...n,...r};let h=c.tier;return{id:e.id,label:e.label,...o,...a,categoryKey:e.categoryKey,price:h.price,currency:this.currency,tiers:l,tierId:h.id,...i,...n,...r}}toTableSeat(e){let t=e.chairs[0],i=this.tiersFor(e.categoryKey)?.filter(r=>pt(this._doc,this.tableTierSeat(e),r.id).kind==="resolved"),o=this.tableTierResolution(e),n=o.kind==="resolved"?o.tier:void 0;return{id:t?.id??e.objectId,label:e.label,displayLabel:e.displayLabel??e.label,...e.displayType?{displayType:e.displayType,rowType:e.displayType}:{},objectId:e.objectId,sectionLabel:t?this.seatContext.get(t.id)?.sectionLabel:void 0,rowLabel:e.displayLabel??e.label,categoryKey:e.categoryKey,price:n?.price??this.priceFor(e.categoryKey),currency:this.currency,...i?{tiers:i,tierId:n?.id}:{},objectType:"table",bookingMode:e.mode,quantity:this.tableQuantities.get(e.label)??(e.mode==="whole"?e.capacity:e.minOccupancy),capacity:e.capacity,minOccupancy:e.minOccupancy,maxOccupancy:e.maxOccupancy,physicalSeatIds:e.chairs.map(r=>r.id)}}describeSeat(e){let t=this._doc?.categories.find(i=>i.key===e.categoryKey);return{...this.toSeat(e),categoryLabel:t?.label??e.categoryKey,categoryColor:t?.color??"#6e7bff",status:this.renderer?.getStatus(e.id)??"free",currency:this.currency,...this.seatContext.get(e.id)}}priceFor(e){return this._doc?.categories.find(t=>t.key===e)?.price??0}tiersFor(e){let t=this._doc?.categories.find(i=>i.key===e)?.tiers;return t&&t.length?t:void 0}tiersForSeat(e){if(!this._doc)return;let t=Ni(this._doc,e);return t.length?t:void 0}seatTierResolution(e){return this._doc?pt(this._doc,e,this.seatTiers.get(e.id)):{kind:"none"}}tableTierSeat(e){return{label:e.label,categoryKey:e.categoryKey,accessibility:e.chairs.flatMap(t=>t.accessibility??[])}}tableTierResolution(e){if(!this._doc)return{kind:"none"};let t=e.chairs[0]?.id??"";return pt(this._doc,this.tableTierSeat(e),this.seatTiers.get(t))}setSeatTier(e,t){let i=this.seatById.get(e);if(!i)return;let o=this.tiersForSeat(i);if(o){if(t==null)this.seatTiers.delete(e);else if(o.some(n=>n.id===t))this.seatTiers.set(e,t);else return;this.emitSelectionChange(),this.hold_&&(this.hold_={...this.hold_,seats:this.seatsForLabels(this.hold_.labels)})}}seatsForLabels(e){let t=[];for(let i of e){let o=this.labelToSeat.get(i);o&&t.push(this.toSeat(o))}return t}emitSelectionChange(){let e=this.getSelection();this.opts.onSelectionChange?.(e),this.emitSelectionValidity(),this.emitOrphanHint()}emitSelectionValidity(){let e=this.getSelectionValidity();e&&(this.opts.onSelectionValidityChange?.(e),e.isValid?this.lastSelectionValidity!==!0&&this.opts.onSelectionValid?.(e.seats):this.lastSelectionValidity!==!1&&this.opts.onSelectionInvalid?.(e),this.lastSelectionValidity=e.isValid)}ticketIssue(e){if(!this._doc)return null;let t=e?this.seatsForLabels(e):this.getSelection();return Vi(this._doc,t.map(i=>({label:i.label,...i.tierId?{tierId:i.tierId}:{}})))}emitOrphanHint(){if(!this.opts.onHint)return;let e=this.renderer;if(!e)return;let t=this.ticketIssue();if(t){this.hintShown=!0,this.opts.onHint(t.code==="companion_pair_required"?oe("picker.companionPairRequired"):"That ticket choice is not available for the selected seat.");return}let i=new Set(e.getSelection().map(n=>n.id));(i.size?Gi(this.seatById.values(),n=>e.getStatus(n),i):[]).length>0?(this.hintShown=!0,this.opts.onHint(oe("picker.orphanHint"))):this.hintShown&&(this.hintShown=!1,this.opts.onHint(null))}setColorblindSafe(e){this.renderer?.setColorblindSafe?.(e)}emitError(e){this.opts.onError?this.opts.onError(e):console.error("[picker]",e)}holdCovers(e){let t=this.hold_;if(!t||t.labels.length!==e.length||!e.every(n=>t.labels.includes(n)))return!1;let i=new Map((t.items??[]).map(n=>[n.label,n.tierId])),o=new Map((t.items??[]).map(n=>[n.label,n.quantity??1]));return e.every(n=>{let r=this.labelToSeat.get(n),a=r?this.toSeat(r):null,l=a?.tierId??null;return(a?.objectType!=="table"||(a.bookingMode!=="variable"||this.confirmedVariableTables.has(n))&&(!o.has(n)||o.get(n)===a.quantity))&&(!i.has(n)||i.get(n)===l)})}handle409Conflicts(e){let{status:t,conflicts:i}=Pt(e);if(t!==409||!i?.length)return;let o=this.renderer;if(!o)return;let n=this.idsForLabels(i.map(r=>r.label));n.length&&(o.deselect(n),o.setStatus(n,"held"),this.resetTableQuantitiesForLabels(i.map(r=>r.label))),this.emitSelectionChange()}setHold(e,t="created"){for(let n of e.items??[])this.groupedTablesByLabel.has(n.label)&&n.quantity!=null&&(this.tableQuantities.set(n.label,n.quantity),this.groupedTablesByLabel.get(n.label)?.mode==="variable"&&this.confirmedVariableTables.add(n.label));let i={...e,seats:this.seatsForLabels(e.labels)};this.hold_=i,this.renderer?.setOwnedHold?.(this.idsForLabels(i.labels)),this.expiryTimer&&clearTimeout(this.expiryTimer);let o=Math.max(0,i.expiresAt-Date.now());this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},o),t==="restored"?this.opts.onHoldRestored?.(i):this.opts.onHold?.(i)}clearHold(){this.hold_=null,this.renderer?.setOwnedHold?.(null),this.expiryTimer&&(clearTimeout(this.expiryTimer),this.expiryTimer=null)}async expireActiveHold(){let e=this.hold_;if(e){try{let t=await this.api.objects(this.key);if(this.hold_?.holdId!==e.holdId)return;this.applySeatsMap(t.seats,t.default??"free")}catch{this.hold_?.holdId===e.holdId&&(this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},2e3));return}if(this.hold_?.holdId===e.holdId){if(e.labels.some(t=>this.statusOf(t)==="held")){this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},1e3);return}this.clearHold(),this.opts.onHoldExpired?.()}}}applySeatsMap(e,t="free"){let i=this.renderer;if(!i)return;this.liveStatuses=new Map(Object.entries(e)),this.liveDefault=t;let o=oi(t);this.allIds.length&&i.setStatus(this.allIds,o),i.setOwnedHold?.(this.idsForLabels(this.hold_?.labels??[]));let n={free:[],held:[],booked:[],not_for_sale:[]};for(let[a,l]of Object.entries(e))n[oi(l)].push(...this.idsForLabel(a));["free","held","booked","not_for_sale"].forEach(a=>{a!==o&&n[a].length&&i.setStatus(n[a],a)});let r=this.notForSaleCategorySeatIds();r.length&&i.setStatus(r,"not_for_sale"),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.()}statusOf(e){return this.liveStatuses.get(e)??this.liveDefault}clearBookedHoldIfSettled(){let e=this.hold_;e?.labels.every(t=>this.statusOf(t)==="booked")&&(this.clearHold(),this.resetTableQuantitiesForLabels(e.labels))}async resnapshot(){try{let e=await this.api.objects(this.key);this.applySeatsMap(e.seats,e.default??"free")}catch{}}async refresh(){await this.resnapshot()}attachVisibilityListener(){if(this.onVisibilityChange||typeof document>"u"||typeof document.addEventListener!="function")return;let e=()=>{this.closed||document.visibilityState==="visible"&&this.resnapshot().then(()=>{this.closed||this.renderer?.forceDraw()})};this.onVisibilityChange=e,document.addEventListener("visibilitychange",e)}detachVisibilityListener(){this.onVisibilityChange&&(typeof document<"u"&&typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",this.onVisibilityChange),this.onVisibilityChange=null)}realtimeSink(){return{applyStatuses:e=>this.applyStatusChanges(e),applyProjection:e=>this.applySeatsMap(e.exceptions,e.default),resync:()=>this.resnapshot(),onSections:(e,t)=>{let i=this.syncHidden(e),o=this.syncClosed(t);i&&this.resnapshot(),(i||o)&&this.opts.onStatusChange?.()}}}applyStatusChanges(e){let t=this.renderer;if(t){for(let i of e){this.liveStatuses.set(i.label,i.status);let o=this.idsForLabel(i.label);if(!o.length)continue;let n=oi(i.status);this.opts.flashOnLiveChange&&n!=="free"&&o.some(r=>t.getStatus(r)==="free")&&!this.hold_?.labels.includes(i.label)&&o.forEach(r=>t.flashSeat(r,n==="held"?"#f4b740":"#f43f5e")),t.setStatus(o,n)}this.opts.keepLiveWhileHidden&&typeof document<"u"&&document.visibilityState==="hidden"&&t.forceDraw(),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.()}}connect(){if(this.closed)return;let e=this.api.socketUrl(this.key);if(!e)return;if(!this.realtime&&this.api.createRealtime){let i=null;try{i=this.api.createRealtime(this.key,this.realtimeSink())}catch{i=null}if(i){this.realtime=i,i.start();return}}if(this.realtime)return;let t;try{let i=this.api.socketProtocols?.(this.key);t=i&&i.length?new WebSocket(e,i):new WebSocket(e)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.attempt=0,this.resnapshot()},t.onmessage=i=>{let o;try{o=JSON.parse(typeof i.data=="string"?i.data:"")}catch{return}if(!this.renderer||!o||typeof o!="object")return;let r=o;Array.isArray(r.hidden)&&this.syncHidden(r.hidden)&&(this.resnapshot(),this.opts.onStatusChange?.()),Array.isArray(r.closed)&&this.syncClosed(r.closed)&&this.opts.onStatusChange?.(),r.type!=="hidden"&&(r.seats&&typeof r.seats=="object"?this.applySeatsMap(r.seats):Array.isArray(r.changes)&&this.applyStatusChanges(r.changes))},t.onclose=()=>{this.ws===t&&(this.ws=null),this.scheduleReconnect()},t.onerror=()=>{try{t.close()}catch{}}}scheduleReconnect(){if(this.closed||this.reconnectTimer)return;let e=Math.min(this.attempt++,5),t=Xs(e,{baseMs:1e3,maxMs:Wo,jitter:1});this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}};var $o=5,Xo=-1.1,ni=35;function ri(s,e){let t=s-q,i=Math.atan2($o-t,e)*180/Math.PI,o=Math.atan2(Xo-t,e)*180/Math.PI;return o<-ni&&(i+=-ni-o,o=-ni),{topPitch:i,basePitch:o}}var K=2048,ae=1024,it=yi,E=Math.PI*2,qo=ae/180,_e=s=>(s+180)/360*K,_=s=>(90-s)/180*ae;function Js(s){let e=2166136261;for(let t=0;t<s.length;t++)e^=s.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function eo(s){let e=s>>>0;return()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}var xt=96,ci=360/xt,Yo=.6,ai=[17,23,42];function li(s,e,t=1){let i=Math.max(0,Math.min(.58,e)),o=Math.round(s[0]+(ai[0]-s[0])*i),n=Math.round(s[1]+(ai[1]-s[1])*i),r=Math.round(s[2]+(ai[2]-s[2])*i);return`rgba(${o},${n},${r},${t})`}function Us(s,e,t){return[Math.round(s[0]+(e[0]-s[0])*t),Math.round(s[1]+(e[1]-s[1])*t),Math.round(s[2]+(e[2]-s[2])*t)]}function Z(s,e,t){let i=(1-Math.abs(2*t-1))*e,o=(s%360+360)%360/60,n=i*(1-Math.abs(o%2-1)),r=0,a=0,l=0;o<1?[r,a,l]=[i,n,0]:o<2?[r,a,l]=[n,i,0]:o<3?[r,a,l]=[0,i,n]:o<4?[r,a,l]=[0,n,i]:o<5?[r,a,l]=[n,0,i]:[r,a,l]=[i,0,n];let c=t-i/2;return[Math.round((r+c)*255),Math.round((a+c)*255),Math.round((l+c)*255)]}var Zs=new Map;function Qs(s){if(!s)return null;let e=Zs.get(s);if(e)return e;let t=2166136261;for(let n=0;n<s.length;n++)t^=s.charCodeAt(n),t=Math.imul(t,16777619);let i=(t>>>0)%360,o=Z(i,.3,.42);return Zs.set(s,o),o}function Uo(s,e,t,i){let o=new Array(xt).fill(null),n=0,r=s.sectionId;for(let a of e){if(a.id===s.id)continue;let l=a.sectionId;if(!l||r&&l===r)continue;let c=a.x-s.x,h=a.y-s.y,u=Math.hypot(c,h)*it;if(u<1.5||u>95)continue;let d=a.eyeHeightM??q,g=d-i;Math.abs(g)>n&&(n=Math.abs(g));let y=Math.atan2(g,u)*180/Math.PI,p=Math.atan2(d-q-i,u)*180/Math.PI,b=((Math.atan2(c,-h)-t)*180/Math.PI+540)%360-180,m=Math.min(xt-1,Math.max(0,Math.floor((b+180)/ci))),v=y>34&&u<16,k=o[m];k?(y>k.top&&(k.top=y),p<k.base&&(k.base=p),u<k.nearM&&(k.nearM=u,k.tint=Qs(a.categoryKey)),k.overhead=k.overhead||v):o[m]={top:y,base:p,nearM:u,overhead:v,tint:Qs(a.categoryKey)}}return{bins:o,maxDelta:n}}function Zo(s,e,t,i){for(let o=0;o<xt;o++){let n=e[o];if(!n)continue;let r=-180+o*ci,a=t(r),l=t(r+ci);if(!(l>a))continue;let c=Math.min(72,n.top),h=Math.min(n.base,-4),u=i(c),d=i(h);if(d<=u)continue;let g=n.nearM/95,y=n.tint,p=y?Us([44,54,80],y,.34):[44,54,80],f=y?Us([24,30,48],y,.28):[24,30,48],b=s.createLinearGradient(0,u,0,d);b.addColorStop(0,li(p,g)),b.addColorStop(.24,li(f,g)),b.addColorStop(1,li([10,13,22],g)),s.fillStyle=b,s.fillRect(a,u,l-a+1,d-u),s.fillStyle=`rgba(150,165,205,${.35*(1-g*.55)})`,s.fillRect(a,u,l-a+1,1.5);let v=Math.min(d,i(0))-u;if(v>8){let L=1-g*.4;for(let S=1;S<6;S++){let w=u+v*S/6;s.fillStyle=`rgba(0,0,0,${.16*L})`,s.fillRect(a,w,l-a+1,1.5),s.fillStyle=`rgba(120,134,170,${.1*L})`,s.fillRect(a,w+1.5,l-a+1,1.2)}}if(n.overhead){let k=i(Math.min(86,c+12)),L=s.createLinearGradient(0,k,0,u);L.addColorStop(0,"rgba(3,4,8,0.9)"),L.addColorStop(1,"rgba(3,4,8,0)"),s.fillStyle=L,s.fillRect(a,k,l-a+1,u-k),s.fillStyle="rgba(120,130,160,0.14)",s.fillRect(a,u-1.5,l-a+1,1.5)}}}function Qo(s,e,t){let o=new Array(72).fill(!1),n=new Array(72).fill(1/0),r=new Set,a=0;for(let b of t){a++,b.sectionId&&r.add(b.sectionId);let m=b.x-e.x,v=b.y-e.y,k=Math.hypot(m,v)*it;if(k<.5)continue;let L=Math.atan2(m,-v),S=Math.floor((L+Math.PI)/E*72);S<0?S=0:S>=72&&(S=71),o[S]=!0,k<n[S]&&(n[S]=k)}let l=0,c=[];for(let b=0;b<72;b++)o[b]&&(l++,c.push(n[b]));let h=l/72*360;c.sort((b,m)=>b-m);let u=c.length?c[c.length>>1]:0,d=c.length?c[Math.floor(c.length*.15)]??u:0,g=c.length?c[Math.floor(c.length*.85)]??u:0,y=d>.5?g/d:1,p=Js(`${a}|${[...r].sort().join(",")}|${Math.round(e.x)},${Math.round(e.y)}`),f;return h>=300&&u>11&&y>1.35?f="sport":h>=285?f="arena":f="proscenium",{mode:f,seed:p,voidRadiusM:u,aspect:y}}var jo=5;function Jo(s,e,t){switch(t){case 1:s.beginPath(),s.ellipse(0,-e*.14,e*1.16,e*1.16,0,0,E),s.fill();break;case 2:s.beginPath(),s.ellipse(0,-e*1.02,e*.42,e*.42,0,0,E),s.fill(),s.beginPath(),s.ellipse(0,-e*.2,e*.98,e*1.02,0,0,E),s.fill();break;case 3:s.beginPath(),s.ellipse(0,-e*.36,e*1.04,e*.6,0,Math.PI,E),s.fill(),s.beginPath(),s.ellipse(0,-e*.52,e*1.22,e*.24,0,0,E),s.fill();break;case 4:s.beginPath(),s.ellipse(-e*.66,e*.5,e*.5,e*1.35,0,0,E),s.fill(),s.beginPath(),s.ellipse(e*.66,e*.5,e*.5,e*1.35,0,0,E),s.fill(),s.beginPath(),s.ellipse(0,-e*.08,e*1.06,e*1.08,0,0,E),s.fill();break;default:break}}function en(s,e,t,i,o){let n=i*.44,r=i*o.shoulderK,a=i*.66,l=i*1.68,c=i*5.4,h=`rgba(${o.clothing[0]},${o.clothing[1]},${o.clothing[2]},${o.alpha})`,u=`rgba(${o.tone[0]},${o.tone[1]},${o.tone[2]},${o.alpha})`;s.save(),s.translate(e,t);let d=o.lean*i;s.fillStyle=h,s.beginPath(),s.moveTo(-n,a),s.quadraticCurveTo(-n*1.18,l-d-i*.6,-r,l-d),s.quadraticCurveTo(-r*1.05,l+i*1.2,-r*.94,c),s.lineTo(r*.94,c),s.quadraticCurveTo(r*1.05,l+i*1.2,r,l+d),s.quadraticCurveTo(n*1.18,l+d-i*.6,n,a),s.closePath(),s.fill(),s.fillStyle=u,s.fillRect(-n*.82,i*.5,n*1.64,i*.9),s.save(),s.rotate(o.tilt),s.translate(o.turn*i,0),s.fillStyle=u,i>=18?(s.beginPath(),s.moveTo(-i*.9,-i*.15),s.quadraticCurveTo(-i*.96,-i*1.12,0,-i*1.06),s.quadraticCurveTo(i*.96,-i*1.12,i*.9,-i*.15),s.quadraticCurveTo(i*.86,i*.55,i*.36,i*.98),s.quadraticCurveTo(0,i*1.14,-i*.36,i*.98),s.quadraticCurveTo(-i*.86,i*.55,-i*.9,-i*.15),s.closePath(),s.fill(),i>=22&&(s.beginPath(),s.ellipse(-i*.9,i*.18,i*.13,i*.22,0,0,E),s.ellipse(i*.9,i*.18,i*.13,i*.22,0,0,E),s.fill())):(s.beginPath(),s.ellipse(0,0,i*.9,i*1.06,0,0,E),s.fill()),Jo(s,i,o.hair),o.rim>.01&&(s.strokeStyle=`rgba(245,205,150,${(.5*o.rim).toFixed(3)})`,s.lineWidth=Math.max(1,i*.14),s.beginPath(),s.ellipse(0,-i*.06,i*.86,i*1,0,Math.PI*1.12,Math.PI*1.9),s.stroke()),s.restore(),o.rim>.01&&(s.strokeStyle=`rgba(240,200,150,${(.28*o.rim).toFixed(3)})`,s.lineWidth=Math.max(1,i*.12),s.beginPath(),s.moveTo(-r*.8,l-i*.05),s.quadraticCurveTo(-n,l-i*.75,0,l-i*.82),s.quadraticCurveTo(n,l-i*.75,r*.8,l-i*.05),s.stroke()),s.restore()}function tn(s,e,t,i,o,n,r){s.fillStyle=`rgba(${o[0]},${o[1]},${o[2]},${r})`,s.beginPath(),s.moveTo(e-i*1.72,t+i*4),s.quadraticCurveTo(e-i*1.78,t+i*1.55,e-i*.46,t+i*1.02),s.lineTo(e-i*.4,t+i*.62),s.lineTo(e+i*.4,t+i*.62),s.lineTo(e+i*.46,t+i*1.02),s.quadraticCurveTo(e+i*1.78,t+i*1.55,e+i*1.72,t+i*4),s.closePath(),s.fill(),s.fillStyle=`rgba(${n[0]},${n[1]},${n[2]},${r})`,s.beginPath(),s.ellipse(e,t,i*.9,i*1.05,0,0,E),s.fill()}function di(s,e,t,i,o){let n=i*.1,r=t-i*.9,a=t-i*.74,l=t-i*.46,c=i*.13,h=i*.09,u=`rgba(${o.tone[0]},${o.tone[1]},${o.tone[2]},${o.alpha})`,d=s.createRadialGradient(e,t,1,e,t,i*.24);d.addColorStop(0,"rgba(0,0,0,0.4)"),d.addColorStop(1,"rgba(0,0,0,0)"),s.save(),s.scale(1,.28),s.fillStyle=d,s.beginPath(),s.ellipse(e,t/.28,i*.24,i*.24,0,0,E),s.fill(),s.restore(),s.fillStyle=u,s.beginPath(),s.moveTo(e-h,l),s.lineTo(e-h*.7,t),s.lineTo(e-h*.1,t),s.lineTo(e-h*.1,l+i*.02),s.lineTo(e+h*.1,l+i*.02),s.lineTo(e+h*.1,t),s.lineTo(e+h*.7,t),s.lineTo(e+h,l),s.closePath(),s.fill(),s.beginPath(),s.moveTo(e-c,a),s.quadraticCurveTo(e-c*.9,l-i*.12,e-h,l),s.lineTo(e+h,l),s.quadraticCurveTo(e+c*.9,l-i*.12,e+c,a),s.quadraticCurveTo(e,a-i*.05,e-c,a),s.closePath(),s.fill(),s.lineCap="round",s.lineJoin="round",s.strokeStyle=u,s.lineWidth=i*.055;let g=a+i*.02;o.pose===1?(s.beginPath(),s.moveTo(e-c*.8,g),s.lineTo(e-c*1.5,t-i*1.02),s.moveTo(e+c*.8,g),s.lineTo(e+c*1.5,t-i*1.02),s.stroke()):o.pose===2?(s.beginPath(),s.moveTo(e-c*.8,g),s.lineTo(e+h*1.4,l-i*.02),s.moveTo(e+c*.8,g),s.lineTo(e-h*.4,l-i*.06),s.stroke(),s.fillStyle=u,s.beginPath(),s.ellipse(e+h*1.5,l-i*.04,i*.07,i*.09,-.5,0,E),s.fill()):o.pose===3?(s.beginPath(),s.moveTo(e-c*.8,g),s.lineTo(e-c*.2,r+n*.6),s.moveTo(e+c*.8,g),s.lineTo(e+c*1.1,l),s.stroke(),s.lineWidth=i*.02,s.beginPath(),s.moveTo(e-c*.2,r+n*.9),s.lineTo(e-c*.2,t-i*.02),s.stroke()):(s.beginPath(),s.moveTo(e-c*.85,g),s.lineTo(e-c*.95,l+i*.02),s.moveTo(e+c*.85,g),s.lineTo(e+c*.95,l+i*.02),s.stroke()),s.fillStyle=u,s.fillRect(e-n*.34,r+n*.6,n*.68,n*.9),s.beginPath(),s.ellipse(e,r,n*.86,n*1.05,0,0,E),s.fill(),o.rimStrength>.01&&(s.strokeStyle=`rgba(${o.rim[0]},${o.rim[1]},${o.rim[2]},${(.6*o.rimStrength).toFixed(3)})`,s.lineWidth=Math.max(1,i*.02),s.beginPath(),s.moveTo(e-c,a),s.lineTo(e-n*.6,r+n*.4),s.moveTo(e-n*.7,r),s.ellipse(e,r,n*.84,n*1.02,0,Math.PI*1.05,Math.PI*1.55),s.stroke())}function Rt(s,e,t,i,o,n,r,a,l){s.save(),s.globalCompositeOperation="lighter";let c=s.createLinearGradient(0,t,0,o);c.addColorStop(0,`rgba(${a},${l})`),c.addColorStop(.5,`rgba(${a},${(l*.4).toFixed(3)})`),c.addColorStop(1,`rgba(${a},0)`),s.fillStyle=c,s.beginPath(),s.moveTo(e-n,t),s.lineTo(i-r,o),s.lineTo(i+r,o),s.lineTo(e+n,t),s.closePath(),s.fill(),s.restore()}function pi(s,e,t,i,o){let n=s.createRadialGradient(e,t,0,e,t,i*3);n.addColorStop(0,`rgba(${o},0.9)`),n.addColorStop(.4,`rgba(${o},0.35)`),n.addColorStop(1,`rgba(${o},0)`),s.fillStyle=n,s.beginPath(),s.arc(e,t,i*3,0,E),s.fill(),s.fillStyle=`rgba(${o},1)`,s.beginPath(),s.arc(e,t,i,0,E),s.fill()}function Cl(s,e,t){let i=document.createElement("canvas");i.width=K,i.height=ae;let o=i.getContext("2d"),n=e.x-s.x,r=e.y-s.y,a=Math.hypot(n,r),l=Math.max(2,a*it),c=s.eyeHeightM??q,h=Qo(s,e,t),u=eo(h.seed),d=210+u()*150,g=Z(220+(u()-.5)*60,.55,.82),y=`${g[0]},${g[1]},${g[2]}`,p=o.createLinearGradient(0,0,0,ae);p.addColorStop(0,"#080b12"),p.addColorStop(.42,"#12182c"),p.addColorStop(.5,"#1c2440"),p.addColorStop(.56,"#151b2c"),p.addColorStop(.78,"#171e30"),p.addColorStop(1,"#131829"),o.fillStyle=p,o.fillRect(0,0,K,ae);let f=o.createLinearGradient(0,_(-6),0,ae);f.addColorStop(0,"rgba(30, 37, 56, 0)"),f.addColorStop(.55,"rgba(30, 37, 56, 0.22)"),f.addColorStop(1,"rgba(22, 28, 44, 0.12)"),o.fillStyle=f,o.fillRect(0,_(-6),K,ae-_(-6));let b=Math.atan2(n,-r),m=Uo(s,t,b,c),v=m.maxDelta>=Yo;v&&Zo(o,m.bins,_e,_);let k=Math.max(.3,Math.min(1,1-(l-6)/60)),L=ri(c,l),S=Math.min(80,Math.atan2(4,l)*180/Math.PI),w=Math.min(45,L.topPitch),x=L.basePitch;h.mode==="sport"?nn(o,l,c,h,k,d,y,u):h.mode==="arena"?on(o,l,c,h,k,y,u):sn(o,S,w,x,k,d,y,u);let I=h.mode==="sport"?34:24+Math.floor(u()*8);o.fillStyle=`rgba(${y},0.8)`;for(let P=0;P<I;P++){let C=(P+.5)/I*K,M=_(h.mode==="sport"?58:54+P*7%3*6);o.beginPath(),o.arc(C,M,h.mode==="sport"?2.6:3.2,0,E),o.fill()}rn(o,s,t,e,b,c,n,r,v,h);let T=o.createLinearGradient(0,0,0,ae);return T.addColorStop(0,"rgba(0,0,0,0.85)"),T.addColorStop(.12,"rgba(0,0,0,0)"),T.addColorStop(.9,"rgba(0,0,0,0)"),T.addColorStop(1,"rgba(0,0,0,0.55)"),o.fillStyle=T,o.fillRect(0,0,K,ae),{url:i.toDataURL("image/jpeg",.82),distanceM:Math.round(l)}}function sn(s,e,t,i,o,n,r,a){let l=_e(-e),c=_e(e),h=_(t),u=_(i),d=c-l,g=u-h,y=_(Math.min(50,t+10)),p=d*(1.1+(1-o)*.5),f=s.createRadialGradient(K/2,(h+u)/2,8,K/2,(h+u)/2,p);f.addColorStop(0,"rgba(255, 214, 150, 0.34)"),f.addColorStop(.28,"rgba(150, 150, 230, 0.3)"),f.addColorStop(.6,"rgba(99, 102, 241, 0.12)"),f.addColorStop(1,"rgba(99, 102, 241, 0)"),s.fillStyle=f,s.fillRect(l-d*.6,h-g*1.2,d*2.2,g*3.4);let b=Z(n,.62,.55),m=Z(n+40,.7,.5),v=Z(n+70,.78,.52);s.save(),s.beginPath(),s.rect(l,h,d,g),s.clip();let k=s.createLinearGradient(0,h,0,u);k.addColorStop(0,`rgb(${b[0]},${b[1]},${b[2]})`),k.addColorStop(.5,`rgb(${m[0]},${m[1]},${m[2]})`),k.addColorStop(1,`rgb(${v[0]},${v[1]},${v[2]})`),s.globalAlpha=.8,s.fillStyle=k,s.fillRect(l,h,d,g),s.globalAlpha=1;let L=s.createRadialGradient(K/2,(h+u)/2,d*.12,K/2,(h+u)/2,d*.62);L.addColorStop(0,"rgba(6,8,14,0)"),L.addColorStop(.7,"rgba(6,8,14,0.15)"),L.addColorStop(1,"rgba(5,6,11,0.92)"),s.fillStyle=L,s.fillRect(l,h,d,g),s.restore();let S=3+Math.floor(a()*3),w=g*.46,x=u-g*.08;for(let B=0;B<S;B++){let W=(B+1)/(S+1),G=l+d*(.22+W*.56+(a()-.5)*.06);di(s,G,x,w*(.9+a()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(a()*4),rim:Z(n+20,.5,.7),rimStrength:.7})}s.fillStyle="#05070d",s.fillRect(l-d*.5,y,d*.5,u-y),s.fillRect(c,y,d*.5,u-y);let I=d*.055+3,T=I*1.35;s.fillStyle="#03050a",s.beginPath(),s.moveTo(l,u),s.lineTo(l-I,u),s.lineTo(l-T,y),s.lineTo(l+d*.012,y),s.closePath(),s.fill(),s.beginPath(),s.moveTo(c,u),s.lineTo(c+I,u),s.lineTo(c+T,y),s.lineTo(c-d*.012,y),s.closePath(),s.fill(),s.fillRect(l-T,y,d+T*2,(u-y)*.12);let P=g*.14,C=y+(u-y)*.12;s.fillStyle="rgba(4,6,12,0.96)";let M=7;s.beginPath(),s.moveTo(l-T,C);for(let B=0;B<=M;B++){let W=l-T+(d+T*2)*B/M;s.quadraticCurveTo(W-(d+T*2)/M/2,C+P,W,C)}s.lineTo(c+T,C),s.lineTo(c+T,y),s.lineTo(l-T,y),s.closePath(),s.fill(),s.fillStyle=`rgba(${r},0.12)`,s.fillRect(l-1.5,C,1.5,u-C),s.fillRect(c,C,1.5,u-C),s.fillStyle="#0b0f18",s.fillRect(l-I,u-g*.05,d+I*2,g*.05+3);let R=s.createLinearGradient(0,u-g*.05,0,u+g*.12);R.addColorStop(0,`rgba(255,206,140,${(.5*o).toFixed(3)})`),R.addColorStop(1,"rgba(255,206,140,0)"),s.fillStyle=R,s.fillRect(l-I,u-g*.05,d+I*2,g*.2);let A=3+Math.floor(a()*2);for(let B=0;B<A;B++){let W=(B+1)/(A+1),G=l+d*(W+(a()-.5)*.08),H=_(Math.min(62,t+26)),X=(a()-.5)*d*.16;Rt(s,G,H,G+X,u,4,d*.09,r,.16*(.7+o*.5)),pi(s,G,H,2.4,r)}}function on(s,e,t,i,o,n,r){let a=Math.min(e*.6,Math.max(3,i.voidRadiusM)),l=Math.min(55,Math.atan2(a,e)*180/Math.PI),c=K/2,h=1.2,u=Math.max(e*.45,e-a),d=e+a,g=Math.atan2(h-t,u)*180/Math.PI,y=Math.atan2(h-t,d)*180/Math.PI,p=Math.atan2(-t,u)*180/Math.PI,f=_(g),b=_(y),m=_(p),v=_e(l)-c,k=Math.max(6,(f-b)/2),L=(f+b)/2,S=s.createRadialGradient(c,m,4,c,m,v*2.6);S.addColorStop(0,`rgba(255,206,150,${(.2*o).toFixed(3)})`),S.addColorStop(.5,"rgba(150,140,190,0.08)"),S.addColorStop(1,"rgba(40,44,60,0)"),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=S,s.fillRect(c-v*2.6,b-k,v*5.2,m-b+k+40),s.restore(),s.fillStyle="#0c1019",s.beginPath(),s.moveTo(c-v,L),s.ellipse(c,L,v,k,0,Math.PI,0,!1),s.lineTo(c+v,m),s.ellipse(c,m,v,k,0,0,Math.PI,!1),s.closePath(),s.fill();let w=s.createLinearGradient(0,L,0,m);w.addColorStop(0,`rgba(${n},0.14)`),w.addColorStop(1,"rgba(0,0,0,0)"),s.fillStyle=w,s.fillRect(c-v,L,v*2,m-L);let x=[[{u:-.24,v:.4,lead:!0,pose:3},{u:.34,v:-.04,pose:2},{u:-.52,v:-.38,pose:0}],[{u:.2,v:.34,lead:!0,pose:3},{u:-.3,v:-.08,pose:2}],[{u:-.1,v:.28,lead:!0,pose:1},{u:.44,v:-.2,pose:2},{u:-.46,v:-.14,pose:2},{u:.08,v:-.46,pose:0}]],I=x[Math.floor(r()*x.length)],T=r()<.5?-1:1,P=F=>c+F.u*T*v*.84,C=F=>L+F.v*k*.8,M=I.find(F=>F.lead)??I[0],R=P(M),A=s.createLinearGradient(0,L-k,0,L+k);A.addColorStop(0,"#3d4a72"),A.addColorStop(1,"#232b47"),s.fillStyle=A,s.beginPath(),s.ellipse(c,L,v,k,0,0,E),s.fill();let B=s.createRadialGradient(R,L,2,R,L,v);B.addColorStop(0,`rgba(255,214,160,${(.5*o).toFixed(3)})`),B.addColorStop(1,"rgba(255,214,160,0)"),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=B,s.beginPath(),s.ellipse(c,L,v,k,0,0,E),s.fill(),s.restore(),s.strokeStyle=`rgba(${n},0.7)`,s.lineWidth=2,s.beginPath(),s.ellipse(c,L,v,k,0,0,E),s.stroke();let W=Math.max(24,(m-b)*1.3),G=I.length>=3?3:2;for(let F=0;F<G;F++){let le=(-.62+F*.52+(r()-.5)*.12)*-T,be=c+le*v*.7,Ge=L-k*(.45+r()*.18),Te=v*(.07+r()*.04),Dt=W*(.26+r()*.12);s.fillStyle="#0a0e18",s.fillRect(be-Te/2,Ge-Dt,Te,Dt),s.fillStyle=`rgba(${n},0.3)`,s.fillRect(be-Te/2,Ge-Dt,Te,1.5)}if(I.length>=3){let F=c-M.u*T*v*.4;s.fillStyle="#0b0f1a",s.beginPath(),s.ellipse(F,L-k*.34,v*.08,k*.1,0,0,E),s.fill(),s.strokeStyle=`rgba(${n},0.35)`,s.lineWidth=1,s.stroke()}for(let F of[...I].sort((le,be)=>le.v-be.v)){let le=.82+(F.v+1)*.14;di(s,P(F),C(F),W*le*(F.lead?1.06:.92),{tone:[18,21,34],alpha:.95,pose:F.pose,rim:Z(40,.72,.8),rimStrength:F.lead?1.4:.9})}let H=_(Math.min(60,y+34)),X=k*1.1+6;s.strokeStyle="rgba(60,68,92,0.85)",s.lineWidth=3,s.beginPath(),s.ellipse(c,H,v*1.15,X,0,0,E),s.stroke();let D=4+Math.floor(r()*3);for(let F=0;F<D;F++){let le=F/D*E,be=c+Math.cos(le)*v*1.15,Ge=H+Math.sin(le)*X;if(Math.sin(le)>-.2){let Te=c+(r()-.5)*v*.8;Rt(s,be,Ge,Te,L,3,v*.32,n,.2*(.7+o*.4))}pi(s,be,Ge,3,n)}let N=_(Math.min(52,y+24)),O=Math.max(60,v*.4),$=Math.max(24,O*.34);s.strokeStyle="rgba(70,78,102,0.6)",s.lineWidth=1.5,s.beginPath(),s.moveTo(c-O*.3,N-$/2),s.lineTo(c-O*.16,N-$*2.2),s.moveTo(c+O*.3,N-$/2),s.lineTo(c+O*.16,N-$*2.2),s.stroke(),s.fillStyle="#0d1220",s.fillRect(c-O/2,N-$/2,O,$);let Et=s.createLinearGradient(0,N-$*.3,0,N+$*.42);Et.addColorStop(0,`rgba(${n},0.5)`),Et.addColorStop(1,"rgba(255,214,160,0.32)"),s.fillStyle=Et,s.fillRect(c-O*.42,N-$*.3,O*.84,$*.72),s.fillStyle="rgba(255,214,160,0.55)",s.fillRect(c-O/2,N+$/2-2,O,2);let Bt=s.createRadialGradient(c,N,4,c,N,O*1.1);Bt.addColorStop(0,`rgba(${n},0.2)`),Bt.addColorStop(1,"rgba(0,0,0,0)"),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=Bt,s.fillRect(c-O*1.1,N-O*.8,O*2.2,O*1.6);let At=s.createRadialGradient(c,(H+L)/2,6,c,(H+L)/2,v*1.5);At.addColorStop(0,`rgba(${n},${(.1*(.6+o*.5)).toFixed(3)})`),At.addColorStop(1,"rgba(0,0,0,0)"),s.fillStyle=At,s.fillRect(c-v*1.5,H-40,v*3,L-H+80),s.restore();let io=c+Math.sign(R-c||1)*v*.5;Rt(s,io,H-X*.4,R,C(M),2.5,v*.16,"255,224,178",.42*(.7+o*.4));let Ft=s.createRadialGradient(R,C(M),1,R,C(M),v*.2);Ft.addColorStop(0,`rgba(255,228,185,${(.4*o).toFixed(3)})`),Ft.addColorStop(1,"rgba(255,228,185,0)"),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=Ft,s.beginPath(),s.ellipse(R,C(M),v*.2,k*.24,0,0,E),s.fill(),s.restore()}function nn(s,e,t,i,o,n,r,a){let l=K/2,c=Math.max(10,i.voidRadiusM),h=Math.max(2,e-c),u=e+c,d=Math.min(78,Math.atan2(c*1.15,e)*180/Math.PI),g=Math.atan2(-t,h)*180/Math.PI,y=Math.atan2(-t,u)*180/Math.PI,p=_(g),f=_(y),b=_e(d)-l,m=(p+f)/2,v=Math.max(10,(p-f)/2),k=s.createRadialGradient(l,m,4,l,m,b);k.addColorStop(0,"#e8f0fb"),k.addColorStop(.7,"#b9c9e2"),k.addColorStop(1,"#8fa3c4"),s.save(),s.beginPath(),s.ellipse(l,m,b,v,0,0,E),s.clip(),s.fillStyle=k,s.fillRect(l-b,m-v,b*2,v*2),s.strokeStyle="rgba(90,120,170,0.5)",s.lineWidth=3,s.beginPath(),s.moveTo(l,m-v),s.lineTo(l,m+v),s.moveTo(l-b*.5,m-v),s.lineTo(l-b*.5,m+v),s.moveTo(l+b*.5,m-v),s.lineTo(l+b*.5,m+v),s.stroke(),s.strokeStyle="rgba(180,90,110,0.45)",s.beginPath(),s.ellipse(l,m,v*.9,v*.5,0,0,E),s.stroke(),s.restore(),s.strokeStyle="rgba(210,225,245,0.6)",s.lineWidth=2.5,s.beginPath(),s.ellipse(l,m,b,v,0,0,E),s.stroke(),s.fillStyle="rgba(20,26,40,0.8)";for(let P=0;P<5;P++){let C=l+(a()-.5)*b*1.4,M=m+(a()-.5)*v*1.1,R=Math.max(2,v*.06);s.beginPath(),s.ellipse(C,M,R*.6,R,0,0,E),s.fill()}let L=s.createRadialGradient(l,m,4,l,m,b*1.4);L.addColorStop(0,"rgba(200,220,255,0.12)"),L.addColorStop(1,"rgba(200,220,255,0)"),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=L,s.fillRect(l-b*1.4,f-v,b*2.8,p-f+v*2),s.restore();let S=_(Math.min(66,y+60)),w=Math.max(80,b*.7),x=w*.5,I=s.createRadialGradient(l,S,4,l,S,w*1.6);I.addColorStop(0,`rgba(${r},0.3)`),I.addColorStop(1,`rgba(${r},0)`),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=I,s.fillRect(l-w*1.6,S-w*1.2,w*3.2,w*2.4),s.restore(),s.fillStyle="#080b12",s.beginPath(),s.moveTo(l-w/2,S-x/2),s.lineTo(l+w/2,S-x/2),s.lineTo(l+w*.6,S),s.lineTo(l+w/2,S+x/2),s.lineTo(l-w/2,S+x/2),s.lineTo(l-w*.6,S),s.closePath(),s.fill();let T=n;for(let P=0;P<3;P++){let C=Z(T+P*30,.5,.5);s.fillStyle=`rgba(${C[0]},${C[1]},${C[2]},0.75)`;let M=w*.26;s.fillRect(l-w*.42+P*(M+w*.06),S-x*.32,M,x*.64)}s.fillStyle=`rgba(${r},0.9)`;for(let P=0;P<8;P++){let C=l-w*.6+w*1.2*P/7;s.beginPath(),s.arc(C,S+x*.62,2.4,0,E),s.fill()}}function rn(s,e,t,i,o,n,r,a,l,c){let h=e.sectionId,u=!1,d=[];for(let p of t){if(p.id===e.id)continue;let f=p.x-e.x,b=p.y-e.y,m=Math.hypot(f,b)*it;if(h&&p.sectionId===h&&m<3&&f*r+b*a>0&&(u=!0),m<.3||m>32)continue;let k=((Math.atan2(f,-b)-o)*180/Math.PI+540)%360-180,L=l?(p.eyeHeightM??q)-n:0,S=Math.atan2(L-.28,m)*180/Math.PI;if(S>10&&m>5)continue;let w=0;for(let T=0;T<p.id.length;T++)w=w*31+p.id.charCodeAt(T)&65535;let x=.9+(w&15)/40,I=Math.min(78,Math.atan2(.16,m)*180/Math.PI*qo*x);I<1.2||d.push({hx:_e(k),hy:_(S),r:I,d:m,hash:w})}d.sort((p,f)=>f.d-p.d);let g=[];{let p=[...d].sort((m,v)=>m.hy-v.hy),f=[],b=()=>{if(!f.length)return;let m=f.reduce((L,S)=>L+S.d,0)/f.length,v=f.reduce((L,S)=>L+S.hy,0)/f.length,k=f.reduce((L,S)=>L+S.r,0)/f.length;g.push({figs:f.sort((L,S)=>S.d-L.d),d:m,hy:v,r:k}),f=[]};for(let m of p){let v=f[f.length-1];v&&Math.abs(m.hy-v.hy)>Math.max(5,(v.r+m.r)/2*1.7)&&b(),f.push(m)}b()}g.sort((p,f)=>f.d-p.d);let y=[[22,26,40],[28,27,42],[24,31,46],[31,30,47],[20,24,36]];for(let p of g){if(p.figs.length>=3&&p.r>=1.6&&p.r<26){let f=[],b=[...p.figs].sort((k,L)=>k.hx-L.hx),m=[];for(let k of b){let L=m[m.length-1];L&&k.hx-L.hx>Math.max(14,k.r*7)&&(m.length>=3&&f.push(m),m=[]),m.push(k)}m.length>=3&&f.push(m);let v=Math.min(.42,.5*(1-p.d/42));if(v>.05){s.fillStyle=`rgba(15, 19, 31, ${v.toFixed(3)})`;for(let k of f){let L=k[0].hx-p.r*1.6,S=k[k.length-1].hx+p.r*1.6;s.beginPath(),s.roundRect(L,p.hy+p.r*.8,S-L,p.r*2.4,p.r*.8),s.fill()}}}for(let f of p.figs){let b=f.d<12?.95:f.d<17?Math.max(.66,.95-(f.d-12)/18):Math.max(.3,.68-(f.d-17)/34),m=Math.round((1-Math.min(1,f.d/16))*10),v=[14+(f.hash>>4&6)+m,17+(f.hash>>4&6)+m,25+(f.hash>>4&6)+m],k=y[f.hash%y.length],L=[k[0]+m,k[1]+m,k[2]+m];if(f.r>=13){let S=f.d<9?.16*(1-f.d/9)+(c.mode==="proscenium"?.06:0):0;en(s,f.hx,f.hy,f.r,{tone:v,clothing:L,alpha:b,tilt:((f.hash>>2&7)-3.5)*.018,shoulderK:1.72+(f.hash>>5&7)/22,hair:f.hash%jo,rim:S,turn:((f.hash>>8&7)-3.5)*.034,lean:((f.hash>>10&3)-1.5)*.09})}else f.r>=5.5?tn(s,f.hx,f.hy,f.r,L,v,b):(s.fillStyle=`rgba(${v[0]},${v[1]},${v[2]},${b.toFixed(3)})`,s.beginPath(),s.arc(f.hx,f.hy,f.r,0,E),s.fill(),s.beginPath(),s.ellipse(f.hx,f.hy+f.r*1.4,f.r*1.85,f.r*.95,0,Math.PI,0,!0),s.fill())}}if(u){let p=_(-34);s.fillStyle="rgba(6, 8, 14, 0.92)",s.fillRect(0,p,K,ae-p),s.fillStyle="rgba(24, 30, 46, 0.9)";let f=16;for(let b=0;b<f;b++){let m=(b+.5)/f*K;s.beginPath(),s.ellipse(m,p+6,K/f*.42,22,0,Math.PI,0,!0),s.fill()}}}var Q=480,Oe=270,hi=50,Le=30,js=s=>(s+hi)/(2*hi)*Q,tt=s=>(Le-s)/(2*Le)*Oe;function Ml(s,e,t){let i=document.createElement("canvas");i.width=Q,i.height=Oe;let o=i.getContext("2d"),n=e.x-s.x,r=e.y-s.y,a=Math.max(2,Math.hypot(n,r)*it),l=eo(Js(`${s.id}|${Math.round(e.x)},${Math.round(e.y)}`)),c=210+l()*150,h=Z(220+(l()-.5)*60,.55,.82),u=`${h[0]},${h[1]},${h[2]}`,d=o.createLinearGradient(0,0,0,Oe);d.addColorStop(0,"#080b12"),d.addColorStop(.44,"#151c32"),d.addColorStop(.5,"#1d2644"),d.addColorStop(.58,"#161c2e"),d.addColorStop(1,"#131829"),o.fillStyle=d,o.fillRect(0,0,Q,Oe);let g=s.eyeHeightM??q,y=ri(g,a),p=Math.min(hi-2,Math.atan2(4,a)*180/Math.PI),f=Math.min(Le-2,y.topPitch),b=Math.max(-Le+2,y.basePitch),m=js(-p),v=js(p),k=tt(f),L=tt(b),S=v-m,w=L-k,x=Math.max(.35,Math.min(1,1-(a-6)/60)),I=tt(Math.min(Le-1,f+8)),T=o.createRadialGradient(Q/2,(k+L)/2,4,Q/2,(k+L)/2,S*1.15);T.addColorStop(0,"rgba(255,214,150,0.34)"),T.addColorStop(.28,"rgba(150,150,230,0.3)"),T.addColorStop(.6,"rgba(99,102,241,0.12)"),T.addColorStop(1,"rgba(99,102,241,0)"),o.fillStyle=T,o.fillRect(m-S*.6,k-w*1.2,S*2.2,w*3.4);let P=Z(c,.62,.55),C=Z(c+40,.7,.5),M=Z(c+70,.78,.52);o.save(),o.beginPath(),o.rect(m,k,S,w),o.clip();let R=o.createLinearGradient(0,k,0,L);R.addColorStop(0,`rgb(${P[0]},${P[1]},${P[2]})`),R.addColorStop(.5,`rgb(${C[0]},${C[1]},${C[2]})`),R.addColorStop(1,`rgb(${M[0]},${M[1]},${M[2]})`),o.globalAlpha=.8,o.fillStyle=R,o.fillRect(m,k,S,w),o.globalAlpha=1;let A=o.createRadialGradient(Q/2,(k+L)/2,S*.12,Q/2,(k+L)/2,S*.6);A.addColorStop(0,"rgba(6,8,14,0)"),A.addColorStop(.7,"rgba(6,8,14,0.15)"),A.addColorStop(1,"rgba(5,6,11,0.9)"),o.fillStyle=A,o.fillRect(m,k,S,w),o.restore();let B=3,W=L-w*.08;for(let D=0;D<B;D++){let N=(D+1)/(B+1);di(o,m+S*(.24+N*.52),W,w*.46*(.9+l()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(l()*4),rim:Z(c+20,.5,.7),rimStrength:.7})}o.fillStyle="#05070d",o.fillRect(m-S*.5,I,S*.5,L-I),o.fillRect(v,I,S*.5,L-I);let G=S*.05+2,H=G*1.35;o.fillStyle="#03050a",o.beginPath(),o.moveTo(m,L),o.lineTo(m-G,L),o.lineTo(m-H,I),o.lineTo(m+S*.012,I),o.closePath(),o.fill(),o.beginPath(),o.moveTo(v,L),o.lineTo(v+G,L),o.lineTo(v+H,I),o.lineTo(v-S*.012,I),o.closePath(),o.fill(),o.fillRect(m-H,I,S+H*2,(L-I)*.13),o.fillStyle=`rgba(${u},0.12)`,o.fillRect(m-1.2,I,1.2,L-I),o.fillRect(v,I,1.2,L-I),o.fillStyle="#0b0f18",o.fillRect(m-G,L-w*.05,S+G*2,w*.05+2);let X=o.createLinearGradient(0,L-w*.05,0,L+w*.14);X.addColorStop(0,`rgba(255,206,140,${(.5*x).toFixed(3)})`),X.addColorStop(1,"rgba(255,206,140,0)"),o.fillStyle=X,o.fillRect(m-G,L-w*.05,S+G*2,w*.22);for(let D=0;D<3;D++){let N=(D+1)/4,O=m+S*N,$=tt(Math.min(Le-1,f+20));Rt(o,O,$,O+(l()-.5)*S*.14,L,3,S*.09,u,.17*x),pi(o,O,$,1.8,u)}o.fillStyle=`rgba(${u},0.75)`;for(let D=0;D<8;D++)o.beginPath(),o.arc((D+.5)/8*Q,tt(Le-4-D%2*3),2.2,0,E),o.fill();o.fillStyle="rgba(10,13,20,0.9)",o.fillRect(0,Oe-26,Q,26),o.fillStyle="rgba(30,37,54,0.9)";for(let D=0;D<9;D++){let N=D*(Q/9)+Q/18;o.beginPath(),o.ellipse(N,Oe-22,Q/9*.4,15,0,Math.PI,0,!0),o.fill()}return{url:i.toDataURL("image/jpeg",.8),distanceM:Math.round(a)}}var an={es:()=>import("./es-6KAJQVVX.js").then(s=>({default:s.es})),de:()=>import("./de-WPX4D3SY.js").then(s=>({default:s.de})),fr:()=>import("./fr-5DTMRBN5.js").then(s=>({default:s.fr}))},to=new Set(["en"]);async function Rl(s){let e=Zi(s);if(e==="en"||to.has(e))return yt(e),e;try{let t=await an[e]();return yt(e,t.default),to.add(e),e}catch{return yt("en"),"en"}}export{dn as ACCESSIBILITY_RING_COLOR,cn as ACCESSIBILITY_TYPES,ln as CHART_STORAGE_KEY,qn as CURRENCY_CHOICES,Xn as DEFAULT_CURRENCY,yn as LABEL_STYLE_MAX_SIZE,fn as LABEL_STYLE_MIN_SIZE,Dn as MAX_EVENT_INVENTORY,Fn as MAX_GA_CAPACITY,qs as PickerController,me as PickerSelectionError,Wn as RENDERED_QUALITY_REPORT_VERSION,pn as SEAT_COMMERCIAL_MARKS,lo as SUPPORTED_LOCALES,gn as SURROUNDINGS_SHAPE_ROLES,si as SeatmapRenderer,bn as TIER_HEIGHT_M,wi as UNGROUPED_ID,hn as accessibilityMeta,Ot as accessibilityRingColor,mi as allObjects,ki as applyHidden,vi as chartBounds,Gt as computeSections,$s as createRenderer,ro as currencyExponent,Un as currencySymbol,Mn as expandBooth,He as expandChart,kn as expandRow,wn as expandRowSlots,Cn as expandTable,Tn as expandTableSlots,En as floorObjects,An as floorOverviewTranslations,nt as floorsOf,or as formatDate,Yn as formatMinor,Kt as formatMoney,ao as fromMinorUnits,rt as gaAreasOf,Gn as gaInventorySegments,On as gaUnitLabel,_t as gaUnitLabels,Cl as generateSeatPanorama,Ml as generateSeatThumb,tr as getLocale,Hn as growJoinedGAInventory,zn as hiddenObjectIds,Kn as inspectRenderedQualityEvidence,Nn as isGaUnitLabel,Vn as isSectionHidden,mn as layerOf,Si as layoutFloorOverview,Rl as loadLocale,xn as objectCenter,Rn as owningSectionForObject,Pn as pointInPolygon,j as pointInPolygonWithHoles,ot as polygonLabelPoint,Zi as resolveLocale,vn as rowInventoryCount,Sn as rowSeatPositions,un as seatCommercialMeta,st as sectionGeometry,yt as setLocale,Ui as setMoneyLocale,ir as setStringOverrides,bi as stackFloors,oe as t,sr as tCount,In as tableInventoryCount,Ln as tableSeatCountsBySide,Bn as translateObject,_n as validGAInventorySegments};
|
|
1
|
+
import{b as Pi,e as ht,g as xi,h as pe,i as J,j as Ri,k as Ei,l as dt,m as Bi}from"./chunk-66HGMU7D.js";import{a as Yn,b as Un}from"./chunk-HHM3PB66.js";import{a as Wt,b as Hi,d as Kt,f as Vi,g as pt,i as Ni,k as zi}from"./chunk-PMU3VPNK.js";import{a as he,b as Ce,c as Ii,d as Ci,e as Me,f as de,l as fe,m as ie,p as Nt,q as lt,s as Mi,t as ct,u as Y,v as zt}from"./chunk-VI2CLV3Y.js";import{b as Pe,f as Fi,g as Di,m as Oi,x as _i,y as Gi}from"./chunk-DNGP2HDT.js";import{a as Hn,b as Vn,c as Nn,d as zn,e as Wn,f as _t,g as Kn,h as rt,i as $n,j as ki,k as Gt,l as Xn,m as qn,n as Li}from"./chunk-4BVXDBFE.js";import{a as un,b as fn,c as yn,d as mn,e as Ot,f as gn,g as bn,h as Sn,i as vn,j as wn,k as kn,m as Ne,p as Ai}from"./chunk-6XJN4REG.js";import{Aa as _n,Ba as Si,Ca as vi,Da as Gn,Ea as He,Fa as wi,V as mi,W as Ie,X as Ln,da as q,ea as gi,fa as st,ja as Tn,ka as In,la as Cn,ma as Mn,na as Pn,oa as xn,pa as Rn,qa as En,ra as Bn,s as fi,sa as An,ta as j,u as yi,ua as ot,va as Fn,w as N,wa as Dn,xa as nt,ya as On,za as bi}from"./chunk-GHJUDU3U.js";import{B as te,h as Ht,s as Ve,t as ue,u as ce,v as at,w as Vt,y as Ti}from"./chunk-CXF32VPG.js";import{Konva as Mt}from"konva/lib/Core";import{Stage as No}from"konva/lib/Stage";import{Layer as ii}from"konva/lib/Layer";import{Group as we}from"konva/lib/Group";import{Circle as me}from"konva/lib/shapes/Circle";import{Rect as De}from"konva/lib/shapes/Rect";import{Line as Je}from"konva/lib/shapes/Line";import{Text as ke}from"konva/lib/shapes/Text";import{Path as zo}from"konva/lib/shapes/Path";import{Image as Wo}from"konva/lib/shapes/Image";import{Shape as Ko}from"konva/lib/Shape";var Ki;function $i(s){Ki=s}function ro(s){return typeof s=="number"?s:s instanceof Date?s.getTime():Date.parse(s)}var Wi=new Map;function ao(s,e){let t=s??Ki,i=`${t??""}|${JSON.stringify(e)}`,o=Wi.get(i);return o||(o=new Intl.DateTimeFormat(t,e),Wi.set(i,o)),o}var lo={dateStyle:"medium",timeStyle:"short"};function Xi(s,e={}){let{locale:t,...i}=e,o=ro(s);if(!Number.isFinite(o))return"";let n=Object.keys(i).length?i:lo;return ao(t,n).format(o)}var Qn="USD",jn=["USD","EUR","GBP","CAD","AUD","INR","AED","SGD","JPY","CHF","SEK","NZD","ZAR","MXN","BRL"],Yi;function Ui(s){Yi=s}var qi=new Map;function ut(s,e,t,i){let o=i??Yi,n=`${o??""}|${s}|${e??"auto"}|${t??"auto"}`,r=qi.get(n);return r||(r=new Intl.NumberFormat(o,{style:"currency",currency:s,minimumFractionDigits:e,maximumFractionDigits:t}),qi.set(n,r)),r}function $t(s,e="USD",t,i){if(typeof t=="object"){let n=t;try{return ut(e,n.minimumFractionDigits,n.maximumFractionDigits,n.locale).format(s)}catch(r){if(n.fallback)return n.fallback(s,e);throw r}}let o=t??(Number.isInteger(s)?0:void 0);return ut(e,o,o,i).format(s)}function co(s="USD"){try{return ut(s,void 0,void 0).resolvedOptions().maximumFractionDigits??2}catch{return 2}}function ho(s,e="USD"){return s/10**co(e)}function Jn(s,e="USD",t){return $t(ho(s,e),e,void 0,t)}function er(s="USD"){return ut(s,0,0).formatToParts(0).find(t=>t.type==="currency")?.value??s}var ze={"common.cancel":"Cancel","common.close":"Close","common.done":"Done","common.copied":"\u2713 Copied","picker.holdExpired":"Your hold expired \u2014 the seats were released. Pick again.","picker.poweredBy":"Powered by SeatLayer","picker.testMode":"TEST MODE","picker.orphanHint":"This leaves a single seat stranded \u2014 consider shifting one seat over.","picker.companionRequiresWheelchair":"Requires the adjacent wheelchair place","picker.companionPairRequired":"Select the adjacent wheelchair place with each companion ticket.","map.aria":"Seating map. Use arrow keys to move between seats, Enter to select.","map.seatsLeft":"{count} LEFT","map.soldOut":"SOLD OUT","map.fromPrice":"FROM {price}","map.statusHeld":"On hold","map.statusTaken":"Taken","picker.floor":"Floor","picker.zoomLevel":"Zoom level","picker.rungTip.zones":"Venue overview \u2014 groups of sections such as North Stand or VIP","picker.rungTip.sections":"Section blocks \u2014 sold-out and nearly-gone sections shade to show availability at a glance","picker.rungTip.seats":"Individual seats \u2014 blocks melt into dots","picker.rungLabel.zones":"ZONES","picker.rungLabel.sections":"SECTIONS","picker.rungLabel.seats":"SEATS","picker.sectionSummaryAria":"{label} section summary","picker.closeSectionSummary":"Close section summary","picker.seatsLeftInSection.one":"{count} seat left","picker.seatsLeftInSection.other":"{count} seats left","picker.overview":"Overview","picker.entrance":"Entrance","picker.tapSeatHint":"Tap any seat to check its view","picker.ticketTierFor":"Ticket tier for {label}","picker.viewFromSeat":"View from seat {label}","picker.real360":"REAL 360\xB0","picker.preview":"PREVIEW","picker.sightline":"\u2248 {m} m to stage","picker.panorama360":"360\xB0 venue photo","picker.illustrationCaption":"illustration \xB7 \u2248 {m} m from stage","picker.restrictedView":"Restricted view","picker.obstructedView":"Obstructed view","picker.premiumSeat":"Premium seat","picker.hideLimitedView":"Hide limited-view seats","picker.bestSeatsPremium":"Best seats","picker.premiumFallbackNote":"No premium block of {count} \u2014 showing best overall","picker.loading3d":"Building the 3D venue\u2026","picker.unavailable3d":"3D could not start. The seat map is still available.","picker.jumpToSection":"Jump to section","picker.salesClosedPill":"Sales are closed","picker.salesClosedCopy":"Ticket sales for this event have ended.","picker.salesClosedCta":"Sales closed","picker.salesClosedToast":"Sales are closed for this event.","picker.holdReassurance":"Yours for {time} \u2014 you won\u2019t be charged yet.","picker.securingSeats":"Securing your seats\u2026","picker.openingCheckout":"Opening secure checkout\u2026","picker.peekSecured":"\u2713 {count} secured \xB7 {total} \u2014 you won\u2019t be charged yet","picker.priceHint":"Colours on the map are ticket types \u2014 tap one below to show just those seats.","picker.findTogetherInstead":"Find seats together instead","picker.keepMyPicks":"Keep my picks","picker.accessExpiredBody":"Sign in again, or reload the page, to keep browsing these seats. Anything you are already holding stays yours.","picker.accessExpiredTitle":"Your access session has ended","picker.accessInvalidBody":"You can still book anything shown as available. Contact whoever sent you here for access to the rest.","picker.accessInvalidTitle":"We couldn\u2019t verify your access","picker.accessPausedBody":"The organizer has paused this selection. Try again in a few minutes.","picker.accessPausedTitle":"These seats are on hold right now","picker.accessRetry":"Try again","picker.accessRevokedBody":"Ask whoever sent you here for a new link to keep booking these seats.","picker.accessRevokedTitle":"This access link is no longer active","picker.accessiblePhysicalSeat":"Accessible physical seat","picker.addTime":"Add time","picker.addingEllipsis":"Adding\u2026","picker.allLevels":"All levels","picker.allPlacesBookedTogether":"All {count} places are booked together as one exclusive table.","picker.allPrices":"All prices","picker.allSeats":"All seats","picker.allSetTitle":"You\u2019re all set","picker.anyTicketType":"Any ticket type","picker.anyVenueZone":"Any venue zone","picker.areas":"Areas","picker.available":"Available","picker.backToMap":"Back to map","picker.backToVenue":"Back to venue","picker.bestSeatsStar":"\u2726 Best seats","picker.booth":"Booth","picker.capacityGuests":"{count} guests","picker.change":"Change","picker.chartDerivedModel":"Chart-derived model","picker.chartDerivedSeatEye":"Live 3D \xB7 chart-derived seat-eye \xB7 not surveyed","picker.checkConnection":"Check your connection and try again.","picker.checkoutCouldNotBeOpened":"Checkout could not be opened. Your seats are still held \u2014 please try again.","picker.chooseAnotherToCompare":"Choose another seat to compare.","picker.chooseGuestsCopy":"Choose how many guests will sit together. This table is held exclusively for your party.","picker.chooseMinMaxGuests":"Choose {min}\u2013{max} guests","picker.clearSavedSeatComparison":"Clear saved seat comparison","picker.close":"Close","picker.closeSeatStatus":"Close seat status","picker.closestGroupChosenInstantly":"Closest available group, chosen instantly.","picker.collapseTicketPanel":"Collapse ticket panel","picker.compareCount":"Compare {count}","picker.compareWithSaved":"Compare with saved","picker.confirmOrCancelSeat":"Confirm or cancel this seat","picker.confirmSeatLabel":"Confirm seat {label}","picker.confirmYourTable":"Confirm your table","picker.confirmedAndOnWay":"confirmed. A confirmation is on its way.","picker.continue":"Continue","picker.continueToCheckout":"Continue to checkout","picker.couldNotAddMoreTime":"Couldn\u2019t add more time \u2014 please head to checkout now.","picker.couldNotFindSeatsTogether":"We couldn\u2019t find {count} seats together. Try fewer seats or another ticket type.","picker.couldNotReleaseTickets":"Couldn\u2019t release your tickets. Your hold is unchanged.","picker.couldNotRemoveLabel":"Couldn\u2019t remove {label}. Your hold is unchanged.","picker.currentOffer":"Current offer","picker.currentTicketOffer":"Current ticket offer","picker.dragToLookAround":"Drag to look around \xB7 scroll to zoom","picker.emptyWheelchairSpace":"Empty wheelchair space","picker.exitFullScreen":"Exit full screen","picker.fewer":"Fewer","picker.fewerGuests":"Fewer guests","picker.fewerSeats":"Fewer seats","picker.filterAndFocusByPrice":"Filter and focus seats by price","picker.filters":"Filters","picker.findBestSeatsCount.one":"Find {count} best seat","picker.findBestSeatsCount.other":"Find {count} best seats","picker.findBestSeatsTogether":"Find the best seats together","picker.findNewSeats":"Find new seats","picker.findingBestSeats":"Finding the best seats\u2026","picker.findingEllipsis":"Finding\u2026","picker.fitToScreen":"Fit to screen","picker.flat2dMap":"Flat 2D map","picker.flexiblePartyTypeWord":"Flexible party \xB7 {typeWord}","picker.fullScreen":"Full screen","picker.generalAdmission":"General admission","picker.guestCountCouldNotBeSecured":"That guest count could not be secured. Your current table hold is unchanged.","picker.guestCountNoLongerAvailable":"That guest count is no longer available. Your current hold is unchanged.","picker.guests":"Guests","picker.guestsCount":"{count} guests","picker.guestsCountEdit":"{count} guests \xB7 Edit","picker.held":"Held","picker.heldForYou":"Held for you","picker.heldSeatExplanation":"Another buyer is holding this seat. It may become available again.","picker.heldTicketsReleased":"Held tickets released. Choose your new seats.","picker.heldTicketsRestored":"Your held tickets have been restored.","picker.hidePanel":"Hide panel","picker.hideTicketPanel":"Hide the ticket panel","picker.holdSeatsAndCheckout":"Hold seats & checkout","picker.howOfferWorks":"How the {name} offer works","picker.interactive3dVenueView":"Interactive 3D venue view","picker.keepMine":"Keep mine","picker.labelNoLongerAvailable":"{label} is no longer available.","picker.labelRemoved":"{label} removed.","picker.labelRemovedFromHold":"{label} removed from your hold.","picker.labelRestored":"{label} restored.","picker.labelsNoLongerAvailable.one":"{labels} is no longer available. Choose another seat.","picker.labelsNoLongerAvailable.other":"{labels} are no longer available. Choose another group.","picker.leftCount.one":"{count} left","picker.leftCount.other":"{count} left","picker.levelNumber":"Level {number}","picker.levels":"Levels","picker.liveAvailability":"Live availability \u2014 seats update in real time","picker.loadingSeatMap":"Loading seat map\u2026","picker.lookAroundLive3d":"Look around in live 3D","picker.manualTicketsRemovedNote":"Your manually selected tickets will be removed only after a new group is secured.","picker.map":"Map","picker.mapDidNotLoad":"The seat map didn\u2019t load","picker.maxTicketsForOrder":"You can select up to {count} tickets for this order.","picker.selectExactMore":"Select {count} more","picker.selectExactCount":"Select exactly {count} tickets","picker.selectMinimumMore":"Select {count} more","picker.adjustSeatSelection":"Adjust seat selection","picker.selectSeatsTogether":"Choose seats together in the same row and ticket category.","picker.minToMaxGuests":"{min} to {max} guests","picker.more":"More","picker.moreGuests":"More guests","picker.moreSeats":"More seats","picker.moreSelectedCount":"{count} more selected","picker.moreTimeAdded":"More time added \u2014 your seats are still held.","picker.noAccessibilityMetadata":"No accessibility metadata supplied","picker.noAuthoredRestriction":"No organizer-authored restriction","picker.noSeatsSelected":"No seats selected","picker.notChargedYet":"You won\u2019t be charged yet.","picker.notForSale":"Not for sale","picker.notForSaleExplanation":"This seat is not included in the current sale.","picker.numberOfGuests":"Number of guests","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.","picker.offerDetailUpcoming":"Tickets are available at their normal price now. This scheduled offer will apply automatically to eligible seats when it starts.","picker.offerRemainingAvailable":"{count} available","picker.offerStarts":"starts {time}","picker.offerUntil":"until {time}","picker.oneSeatSaved":"1 seat saved","picker.oneSeatSavedChooseAnother":"One seat saved; choose another to compare","picker.openAuthored360":"Open venue 360\xB0","picker.openComparison":"Open comparison","picker.openComparisonOfSeats":"Open comparison of {count} seats","picker.openTicketPanel":"Open ticket panel","picker.peekFromPrice":"From {price}","picker.peekTicketsTotal.one":"{count} ticket \xB7 {total}","picker.peekTicketsTotal.other":"{count} tickets \xB7 {total}","picker.perGuestPrice":"{price} per guest","picker.pickYourSeats":"Pick your seats","picker.preferredTicketType":"Preferred ticket type","picker.preferredVenueZone":"Preferred venue zone","picker.priceNotSupplied":"Price not supplied","picker.releaseHeldTickets":"Release held tickets and choose different seats","picker.releasingEllipsis":"Releasing\u2026","picker.removeHeldTicketLabel":"Remove held ticket {label}","picker.removeSeatLabel":"Remove {label}","picker.removeTicketsUntilOrFewer":"Remove tickets until your order has {count} or fewer.","picker.replaceCurrentChoices":"Replace your current choices?","picker.review":"Review","picker.row":"Row","picker.rowLabel":"Row {label}","picker.saveToCompare":"Save to compare","picker.savedForComparison":"Saved for comparison","picker.savedSeatComparison":"Saved seat comparison","picker.scheduledOffer":"Scheduled offer","picker.seat":"Seat","picker.seatCount.one":"{count} seat","picker.seatCount.other":"{count} seats","picker.seatJustTakenByAnother":"Seat {label} was just taken by another buyer.","picker.seatLabel":"Seat {label}","picker.seatNoLongerAvailable":"That seat is no longer available.","picker.seatNoLongerYours":"Some seats are no longer available to you. They have been removed from your order.","picker.seatNumberLower":"seat {label}","picker.seatSalesClosedForEvent":"Seat sales have closed for this event.","picker.seatSelection":"Seat selection","picker.seatStatusLegend":"Seat status legend","picker.seatTaken":"Someone else took a seat you had picked. It has been removed from your order.","picker.seatsHeldForNeedMoreTime":"Your seats are held for <b>{time}</b>. Need more time?","picker.seatsJustTaken":"One or more seats were just taken. Please pick again.","picker.seatsJustTakenInCategory.one":"{count} seat just taken in {label} \xB7 {left} left","picker.seatsJustTakenInCategory.other":"{count} seats just taken in {label} \xB7 {left} left","picker.seatsNoLongerAvailableTryAnother":"Those seats are no longer available. Try another quantity or ticket type.","picker.seatsSecured":"Seats secured","picker.seatsSelectedCount.one":"{count} selected","picker.seatsSelectedCount.other":"{count} selected","picker.section":"Section","picker.secureMore":"Secure more","picker.secureMoreAndCheckout":"Secure {count} more & checkout","picker.securedCount":"{count} secured","picker.seeItIn3d":"See it in 3D","picker.select":"Select","picker.selectSeats":"Select seats","picker.selectTable":"Select table","picker.selectWholeTable":"Select whole table","picker.selected":"Selected","picker.selectingEllipsis":"Selecting\u2026","picker.showAllSeats":"Show all seats","picker.showAllTicketTypes":"Show all {count} ticket types","picker.showFewer":"Show fewer","picker.showLabelSeatsOnMap":"Show {label} seats on the map","picker.showTicketPanel":"Show the ticket panel","picker.sold":"Sold","picker.soldOutCopy":"No reserved seats are currently available for this event.","picker.soldOutEyebrow":"This event","picker.soldOutTitle":"Sold out","picker.soldSeatExplanation":"This seat has already been booked.","picker.statusAvailable":"available","picker.statusOnHold":"on hold","picker.statusTaken2":"taken","picker.table":"Table","picker.tableCapacity":"Table capacity","picker.tableUpdatedForGuests":"{label} updated for {count} guests.","picker.temporarilyHeld":"Temporarily held","picker.ticketPrices":"Ticket prices","picker.ticketTypeSoldOut":"That ticket type is sold out. Try another ticket type.","picker.tickets":"Tickets","picker.ticketsCount.one":"{count} ticket","picker.ticketsCount.other":"{count} tickets","picker.toggleColorblindColors":"Toggle colorblind-friendly colors","picker.total":"Total","picker.trayHintTapOrBest":"Tap a seat on the map, or let us pick the best available for you.","picker.trayHintTapOrStanding":"Tap a seat on the map \u2014 or grab standing tickets below.","picker.undo":"Undo","picker.upcomingTicketOffer":"Upcoming ticket offer","picker.updateTable":"Update table","picker.updatingEllipsis":"Updating\u2026","picker.venueView":"Venue view","picker.viewFromHere":"View from here","picker.viewFromThisSeat":"View from this seat","picker.wholeTypeWord":"Whole {typeWord}","picker.willChooseClosestGroup":"We\u2019ll choose the closest available group for you.","picker.willFindSeatsTogether":"We\u2019ll find {count} seats together.","picker.yourSeats":"Your seats","picker.zoomIn":"Zoom in","picker.zoomOut":"Zoom out","picker.closeVenueNav":"Close","picker.levelsAndAreas":"Levels & areas"};var po=["en","es","de","fr"],xe={en:ze},ft={},se="en";function Zi(s,e){for(let t of[s,e,typeof navigator<"u"?navigator.language:null]){if(!t)continue;let i=t.toLowerCase().split("-")[0];if(po.includes(i))return i}return"en"}function rr(){return se}function yt(s,e){e&&(xe[s]={...xe[s],...e}),se=xe[s]?s:"en",Ui(se),$i(se),typeof document<"u"&&(document.documentElement.lang=se)}function ar(s){ft=s}var Qi=/\{(\w+)\}/g;function oe(s,e){let t=ft[s]??xe[se]?.[s]??ze[s]??s;return e?t.replace(Qi,(i,o)=>String(e[o]??`{${o}}`)):t}function lr(s,e,t){let i=new Intl.PluralRules(se).select(e);return(ft[`${s}.${i}`]??xe[se]?.[`${s}.${i}`]??ze[`${s}.${i}`]??ft[`${s}.other`]??xe[se]?.[`${s}.other`]??ze[`${s}.other`]??s).replace(Qi,(r,a)=>String({count:e,...t}[a]??`{${a}}`))}function cr(s,e){return Xi(s,{...e??{dateStyle:"medium",timeStyle:"short"},locale:se})}var We=9,Se=.9,ee=.55*Se,ne=de/he,Ke=4,mt=14,ji=10,Ji=14,ye=.45*Se,Re=.9*Se,es=Math.max(Se*1.1,Re),ve=8,ts=700,U=2,is=de,$e=64,Ee=.55*ye,Xt=700,ss=2500,gt=-11.5,Xe=.58,os=320,bt=650,ns=1,St=1,rs=20,qt=12,as=[.85,.72,.62],vt=18,ls=12,cs=.1;var uo="#e5e7eb",fo="#c7cbd1",yo="#595f69",mo="#d1d5db",go="#b8bdc4",bo="#273142",So="#526078",vo="#f1f5f9",wo="#374151",ko="#64748b",Yt="#111827",hs="#6b7280",wt="#374151",ds="#4b5563",ps="#4b5563",us=.4,qe=.16,fs="rgba(244,246,248,0.06)",kt=["#E69F00","#56B4E9","#009E73","#F0E442","#0072B2","#D55E00","#CC79A7"];function re(s){return Ve(s)?{sectionFill:uo,sectionStroke:fo,sectionInk:yo,focalFill:mo,focalStroke:go}:{sectionFill:bo,sectionStroke:So,sectionInk:vo,focalFill:wo,focalStroke:ko}}function Be(s,e){let t=s.sectionFill,i=Ti(ce(t,.2),.85);switch(e){case"closed":return ce(t,.12);case"sold-out":return i;case"nearly-gone":return at(t,i,.4);default:return t}}function Lo(s,e){return s.x<e.x+e.width&&e.x<s.x+s.width&&s.y<e.y+e.height&&e.y<s.y+s.height}var Ae=class{constructor(){this.cells=new Map}insert(e){for(let t of this.keys(e)){let i=this.cells.get(t);i?i.push(e):this.cells.set(t,[e])}}collisionCount(e){let t=new Set,i=0;for(let o of this.keys(e))for(let n of this.cells.get(o)??[])t.has(n)||(t.add(n),Lo(e,n)&&i++);return i}keys(e){let t=Math.floor(e.x/$e),i=Math.floor((e.x+Math.max(0,e.width))/$e),o=Math.floor(e.y/$e),n=Math.floor((e.y+Math.max(0,e.height))/$e),r=[];for(let a=o;a<=n;a++)for(let l=t;l<=i;l++)r.push(`${l}:${a}`);return r}};function z(s){let e=Ai(s);return e?{x:e.x,y:e.y,width:Math.max(1,e.width),height:Math.max(1,e.height)}:{x:0,y:0,width:1,height:1}}function Lt(s,e,t,i){let o=i*Math.PI/180,n=Math.cos(o),r=Math.sin(o);return[{x:-e/2,y:-t/2},{x:e/2,y:-t/2},{x:e/2,y:t/2},{x:-e/2,y:t/2}].map(a=>({x:s.x+a.x*n-a.y*r,y:s.y+a.x*r+a.y*n}))}function Tt(s,e,t,i,o,n){let r=i*Math.PI/180,a=Math.cos(r),l=Math.sin(r);for(let c=0;c<=4;c++)for(let h=0;h<=6;h++){let u=e*(h/6-.5),d=t*(c/4-.5),m={x:s.x+u*a-d*l,y:s.y+u*l+d*a};if(!j(m,o,n))return!1}return!0}function ys(s,e,t){let i=z(s),o=[t];for(let r=1;r<12;r+=1)for(let a=1;a<12;a+=1){let l={x:i.x+i.width*a/12,y:i.y+i.height*r/12};j(l,s,e)&&o.push(l)}let n=[s,...e];return o.map(r=>({point:r,room:fi(r,n)})).sort((r,a)=>a.room-r.room).map(r=>r.point).filter((r,a,l)=>a===l.findIndex(c=>Math.abs(c.x-r.x)<1e-6&&Math.abs(c.y-r.y)<1e-6))}import{Group as To}from"konva/lib/Group";import{Shape as Io}from"konva/lib/Shape";function Co(s,e,t){let i=e.length,o={x:(e[i-1].x+e[0].x)/2,y:(e[i-1].y+e[0].y)/2};s.moveTo(o.x,o.y);for(let n=0;n<i;n+=1){let r=e[n],a=e[(n+1)%i],l=e[(n-1+i)%i],c=Math.min(Math.hypot(r.x-l.x,r.y-l.y)/2,Math.hypot(a.x-r.x,a.y-r.y)/2);s.arcTo(r.x,r.y,a.x,a.y,Math.max(0,Math.min(t,c)))}s.closePath()}function Fe(s,e,t,i){let o=Ne(s)>0,n=t.cornerRadius&&t.cornerRadius>0?t.cornerRadius:0;return new Io({...t,sceneFunc(r,a){r.beginPath();let l=h=>{if(h.length){if(n>0&&h.length>=3)return Co(r,h,n);r.moveTo(h[0].x,h[0].y);for(let u=1;u<h.length;u+=1)r.lineTo(h[u].x,h[u].y);r.closePath()}};i?(h=>{r.moveTo(h.start.x,h.start.y);let u=h.start;for(let d of h.segments)d.kind==="line"?r.lineTo(d.end.x,d.end.y):d.kind==="arc"?r.arc(d.center.x,d.center.y,d.radius,Math.atan2(u.y-d.center.y,u.x-d.center.x),Math.atan2(d.end.y-d.center.y,d.end.x-d.center.x),!d.clockwise):r.bezierCurveTo(d.control1.x,d.control1.y,d.control2.x,d.control2.y,d.end.x,d.end.y),u=d.end;r.closePath()})(i):l(s);for(let h of e??[]){let u=Ne(h)>0;l(u===o?[...h].reverse():h)}r.fillStrokeShape(a)},perfectDrawEnabled:!1})}var Ye=class extends To{constructor(){super(...arguments);this.viewportCulled=!1}setViewportCulled(t){t!==this.viewportCulled&&(this.viewportCulled=t,t||super._clearSelfAndDescendantCache())}isViewportCulled(){return this.viewportCulled}drawScene(...t){return this.viewportCulled?this:super.drawScene(...t)}drawHit(...t){return this.viewportCulled?this:super.drawHit(...t)}_clearSelfAndDescendantCache(t){if(!this.viewportCulled){super._clearSelfAndDescendantCache(t);return}this._clearCache(t)}};var It=class{constructor(e){this.pointers=new Map;this.pinch=null;this.panLast=null;this.panStart=null;this.panStarted=!1;this.movedPx=0;this.lastTapAt=0;this.onPointerDown=e=>{this.host.cancelGlide();let t=this.toLocal(e);if(this.pointers.set(e.pointerId,t),this.pointers.size===1)this.movedPx=0,this.pinch=null,this.panStart=t,this.panStarted=!1,this.host.marqueeShouldStart(e)?(this.host.beginMarquee(t),this.panLast=null):this.panLast=t;else if(this.pointers.size===2){this.host.marqueeActive()&&this.host.cancelMarquee();let[i,o]=[...this.pointers.values()],n={x:(i.x+o.x)/2,y:(i.y+o.y)/2},r=this.host.stage.scaleX();this.pinch={startDist:Math.hypot(o.x-i.x,o.y-i.y),startScale:r,worldMid:{x:(n.x-this.host.stage.x())/r,y:(n.y-this.host.stage.y())/r}},this.panLast=null,this.panStart=null,this.panStarted=!0,this.movedPx=ve+1}};this.onPointerMove=e=>{if(!this.pointers.has(e.pointerId))return;e.preventDefault();let t=this.toLocal(e);if(this.pointers.set(e.pointerId,t),this.pointers.size===1&&this.panStart?this.movedPx=Math.max(this.movedPx,Math.hypot(t.x-this.panStart.x,t.y-this.panStart.y)):this.pointers.size>=2&&(this.movedPx=ve+1),this.host.marqueeActive()){this.host.updateMarquee(t);return}if(this.pinch&&this.pointers.size>=2){this.host.releaseSectionFocusDim();let[i,o]=[...this.pointers.values()],n=Math.hypot(o.x-i.x,o.y-i.y);if(this.pinch.startDist<1)return;let r={x:(i.x+o.x)/2,y:(i.y+o.y)/2},{min:a,max:l}=this.host.zoomBounds(),c=N(this.pinch.startScale*(n/this.pinch.startDist),a,l);this.host.stage.scale({x:c,y:c}),this.host.stage.position({x:r.x-this.pinch.worldMid.x*c,y:r.y-this.pinch.worldMid.y*c}),this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}else if(this.panLast&&this.pointers.size===1){if(!this.panStarted){if(this.movedPx<=ve)return;this.panStarted=!0,this.host.releaseSectionFocusDim()}this.host.stage.position({x:this.host.stage.x()+(t.x-this.panLast.x),y:this.host.stage.y()+(t.y-this.panLast.y)}),this.panLast=t,this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}};this.onPointerEnd=e=>{if(this.host.marqueeActive()){this.host.finishMarquee(),this.pointers.delete(e.pointerId),this.pointers.size===0&&(this.panLast=null);return}this.pointers.delete(e.pointerId),this.pointers.size<2&&(this.pinch=null),this.pointers.size===1&&(this.panLast=[...this.pointers.values()][0],this.panStart=this.panLast,this.panStarted=!0),this.pointers.size===0&&(this.panLast=null,this.panStart=null,this.panStarted=!1,this.host.afterViewChange())};this.host=e}get moved(){return this.movedPx}attach(){let{container:e}=this.host;e.addEventListener("pointerdown",this.onPointerDown,{passive:!1}),e.addEventListener("pointermove",this.onPointerMove,{passive:!1}),e.addEventListener("pointerup",this.onPointerEnd,{passive:!1}),e.addEventListener("pointercancel",this.onPointerEnd,{passive:!1})}detach(){let{container:e}=this.host;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerEnd),e.removeEventListener("pointercancel",this.onPointerEnd)}resetPan(){this.panLast=null,this.panStart=null,this.panStarted=!1}isGhostClick(e){return e.type==="tap"?(this.lastTapAt=performance.now(),!1):this.lastTapAt>0&&performance.now()-this.lastTapAt<ts}toLocal(e){let t=this.host.container.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}};import{Rect as ms}from"konva/lib/shapes/Rect";import{Text as Mo}from"konva/lib/shapes/Text";function gs(s){let e=s.effScale(),t=s.stage.scaleX(),i={width:s.stage.width(),height:s.stage.height()},o=p=>Math.round(p*100)/100,n=s.seats.map(p=>{let f=s.circleById.get(p.id),b=s.boothLabelById.get(p.id)??s.seatLabelById.get(p.id),g=s.viewMode==="perspective"?s.perspectiveSeatScale.get(p.id)??1:1,v=(s.viewMode==="perspective"?t:e)*g,k=p.kind==="booth"?Ce:he*s.seatLabelScale(p),L=s.viewMode==="perspective"&&p.kind!=="booth"?e*g:v,S=o((b?.fontSize()??k)*L),w=s.worldToScreen(p),x=w.x<0||w.x>i.width||w.y<0||w.y>i.height,I=s.focusedSeatOpacity(p.id,f?.getAbsoluteOpacity()??0),T=s.seatSection.get(p.id),P=!!b?.isVisible()&&I>=.5&&!x,C;P||(I<.5?C="dimmed-or-unavailable":S<de?C="below-minimum-size":x?C="outside-viewport":b?C="renderer-hidden":C="clutter-or-fit");let M=b?b.width()*t*g:0,R=b?b.height()*(s.viewMode==="perspective"&&p.kind==="booth"?t:e)*g:0,A=f instanceof ms?f.width()*t*g:s.seatR*2*v,B=f instanceof ms?f.height()*(s.viewMode==="perspective"?t:e)*g:s.seatR*2*v,W=2*(s.seatR*v+mt),G=f?.fill(),H=b?.fill(),X=s.accessGlyphById.get(p.id),D=X?.getAbsoluteScale();return{seatId:p.id,label:p.label,kind:p.kind==="booth"?"booth":"seat",markerShape:p.kind==="booth"?"booth":p.wheelchairSpaceType==="no-seat"?"square":"circle",...p.wheelchairSpaceType?{wheelchairSpaceType:p.wheelchairSpaceType}:{},categoryKey:p.categoryKey,...T?{sectionId:T.id}:{},...T?.zone?{zoneId:T.zone}:{},status:s.statusById.get(p.id)??"free",selected:s.selection.has(p.id),visible:P,renderedFontPx:S,fill:typeof G=="string"?G:"",ink:typeof H=="string"?H:f?s.seatLabelInk(p,f):s.seatPreferredLabelInk(p),opacity:o(I),...X?{accessibilityMarker:{glyphVisible:X.isVisible(),glyphWidthPx:o(ie*Math.abs(D?.x??0)),emphasizedByFilter:s.accessGlyphFilterEmphasized(p.id)}}:{},pointerTarget:{active:!s.cached&&!s.seatViewportCulled(p.id)&&!!f?.isVisible()&&!!f?.isListening()&&s.isSelectable(p.id),directWidthPx:o(A),directHeightPx:o(B),effectiveMinimumPx:o(Math.max(Math.min(A,B),W))},screenCenter:{x:o(w.x),y:o(w.y)},...P?{screenBox:{x:o(w.x-M/2),y:o(w.y-R/2),width:o(M),height:o(R)}}:{},...C?{hiddenReason:C}:{}}}),r=n.filter(p=>p.visible).length,a=(p,f,b,g,v,k)=>{let L=Lt({x:g.x(),y:g.y()},g.width(),g.height(),g.rotation()),S=k&&k.liftWorld>0?s.isoLiftLocal(k.liftWorld):{x:0,y:0},w=z(L.map(M=>s.worldToScreen({x:M.x+S.x,y:M.y+S.y}))),x=o(g.opacity()),I=g.fill(),T=w.x+w.width<0||w.x>i.width||w.y+w.height<0||w.y>i.height,P=g.isVisible()&&x>.05&&!T,C=k?Tt({x:g.x(),y:g.y()},g.width(),g.height(),g.rotation(),k.outline,k.holes):void 0;return{id:p,kind:f,role:b,label:g.text(),visible:P,renderedFontPx:o(g.fontSize()*t),opacity:x,fill:v,ink:typeof I=="string"?I:"",...C==null?{}:{fitsContainer:C},...P?{screenBox:{x:o(w.x),y:o(w.y),width:o(w.width),height:o(w.height)}}:{}}},l=[...s.sections.map(p=>{let f=p.blockPoly.fill();return a(p.id,"section","name",p.nameLabel,typeof f=="string"?f:p.baseFill,p)}),...s.sections.map(p=>{let f=p.blockPoly.fill();return a(`${p.id}:availability`,"section","availability",p.subLabel,typeof f=="string"?f:p.baseFill,p)}),...s.zones.flatMap(p=>[a(p.id,"zone","name",p.label,p.background),...p.sub?[a(`${p.id}:price`,"zone","price",p.sub,p.background)]:[]])],c=[...s.gaById].map(([p,f])=>{let b=f.points.map(T=>s.worldToScreen(T)),g=Math.min(...b.map(T=>T.x)),v=Math.min(...b.map(T=>T.y)),k=Math.max(...b.map(T=>T.x)),L=Math.max(...b.map(T=>T.y)),S=k<0||g>i.width||L<0||v>i.height,w=o(f.polygon.opacity()),x=w>=.1&&!S,I=f.polygon.fill();return{areaId:p,label:f.label,capacity:f.capacity,categoryKey:f.categoryKey,...f.sectionId?{sectionId:f.sectionId}:{},visible:x,interactive:f.polygon.listening(),opacity:w,fill:typeof I=="string"?I:"",effectiveBackground:f.effectiveBackground,...x?{screenBox:{x:o(g),y:o(v),width:o(k-g),height:o(L-v)}}:{}}}),h=[...s.freeTextById].map(([p,f])=>{let{node:b,background:g,kind:v}=f,k=s.worldToScreen({x:b.x(),y:b.y()}),L=b.width()*t,S=b.height()*e,w=k.x-b.offsetX()*t,x=k.y-b.offsetY()*e,I=o(b.fontSize()*e),T=w+L<0||w>i.width||x+S<0||x>i.height,P=b.isVisible()&&!T,C=b.fill(),M=o(b.getAbsoluteOpacity()),R;return P||(I<de?R="below-minimum-size":T?R="outside-viewport":R="renderer-hidden"),{objectId:f.objectId??p,kind:v,text:b.text(),visible:P,renderedFontPx:I,ink:typeof C=="string"?C:"",background:g,opacity:M,...P?{screenBox:{x:o(w),y:o(x),width:o(L),height:o(S)}}:{},...R?{hiddenReason:R}:{}}}),u=s.labelGroup.find(p=>p.getAttr("rowLabel")===!0).filter(p=>p instanceof Mo).map(p=>{let f=p.getClientRect({skipShadow:!0,skipStroke:!0}),b=f.x+f.width<0||f.x>i.width||f.y+f.height<0||f.y>i.height,g=p.fill();return{text:p.text(),visible:p.isVisible()&&!b,renderedFontPx:o(p.fontSize()*e),ink:typeof g=="string"?g:"",...b?{}:{screenBox:{x:o(f.x),y:o(f.y),width:o(f.width),height:o(f.height)}}}}),d=re(s.canvasBackground),m=new Set(["normal","nearly-gone","sold-out","closed"].map(p=>Be(d,p).toLowerCase())),y=s.sections.filter(p=>p.blockPoly.opacity()>.05);return{viewport:i,projection:s.viewMode,...s.viewMode==="perspective"?{perspective:{model:"pinhole-exact-seat-anchors",sectionSurfaceModel:"tangent-plane",exactSeatAnchorCount:s.perspectiveSeatProjected.size,depthSorted:!0}}:{},canvasBackground:s.canvasBackground,effectiveScale:o(e),rung:s.getRung(),minimumVisibleLabelPx:de,totalLabelledBookableUnits:n.length,visibleLabels:r,hiddenLabels:n.length-r,totalBookableUnits:n.length+c.reduce((p,f)=>p+f.capacity,0),selectionRingSeatIds:s.overlayLayer.find(".selection-ring").map(p=>String(p.getAttr("seatId")??"")).filter(Boolean),selectionRingColor:s.effSelection,focusedSectionId:s.focusedSectionId,focusBackdropVisible:!!s.focusBackdrop?.isVisible(),categoryFilterKeys:s.categoryFilter?[...s.categoryFilter].sort():null,overviewStyle:{visibleSectionShells:y.length,categoryPaintedSectionShells:y.filter(p=>{let f=p.blockPoly.fill();return typeof f!="string"||!m.has(f.toLowerCase())}).length,visibleCategoryDetailOutlines:s.sections.filter(p=>p.outlinePoly.opacity()>.05).length,visibleSectionRowHints:0,visibleSectionAvailabilityLabels:s.sections.filter(p=>p.subLabel.opacity()>.05).length,visibleSectionGADetails:[...s.gaById.values()].filter(p=>p.sectionId!=null&&p.polygon.opacity()>.05).length},labels:n,gaAreas:c,hierarchyLabels:l,freeTextLabels:h,rowLabels:u}}import{Circle as Po}from"konva/lib/shapes/Circle";import{Ellipse as xo}from"konva/lib/shapes/Ellipse";import{Line as Ro}from"konva/lib/shapes/Line";import{Arrow as Eo}from"konva/lib/shapes/Arrow";import{Path as Bo}from"konva/lib/shapes/Path";import{Rect as Qt}from"konva/lib/shapes/Rect";import{Text as jt}from"konva/lib/shapes/Text";import{Image as Ao}from"konva/lib/shapes/Image";function Ut(s,e){return e.length===0?!!s.accessible:!!s.accessibility?.some(t=>e.includes(t))}var Ct="#0b1220",Ue="#ffffff",bs="#0b1220",Ss="#232c40",vs="#8b93a7";function ws(s,e,t="normal"){let i=s?"bold":t;return e?`italic ${i}`.trim():i}var Zt="#0e1117";function ks(s,e){let t=new window.Image,i=new Ao({image:t,x:e.x+e.width/2,y:e.y+e.height/2,offsetX:e.width/2,offsetY:e.height/2,width:e.width,height:e.height,rotation:e.rotation??0,opacity:N(e.opacity??1,0,1),listening:!1,perfectDrawEnabled:!1});e.layer==="foreground"?s.fgDecorGroup.add(i):s.bgLayer.add(i),s.trackAssetImage(t,e.href,`Decor image \u201C${e.label||e.id}\u201D`,()=>{let o=i.getLayer();o&&o.batchDraw()})}function Ls(s,e){if(e.shape==="round")s.bgLayer.add(new Po({x:e.center.x,y:e.center.y,radius:e.radius??40,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,listening:!1}));else{let i=e.width??80,o=e.height??50;s.bgLayer.add(new Qt({x:e.center.x,y:e.center.y,width:i,height:o,offsetX:i/2,offsetY:o/2,rotation:e.rotation,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,cornerRadius:4,listening:!1}))}let t=Ze(s,s.bgLayer,e.displayLabel??e.label,e.center.x,e.center.y,"#cbd5e1",12,!0);s.freeTextById.set(e.id,{node:t,background:"#232c40",kind:"table"})}function Ts(s,e){let t=e.background?.color??s.canvasBackground,i=e.color??s.theme.textColor??vs,o=e.semanticKind==="icon"?Oi(e.iconKey):void 0;if(o){let c=e.fontSize/24,h=new Bo({x:e.position.x,y:e.position.y,data:o,rotation:e.rotation,scaleX:c,scaleY:c,stroke:Y(t,i),strokeWidth:2,lineCap:"round",lineJoin:"round",fillEnabled:!1,listening:!1,perfectDrawEnabled:!1});s.iconNodeById.set(e.id,{node:h,fontSize:e.fontSize}),s.bgLayer.add(h);return}let n=e.background?.padding??0,r=e.opacity??1,a=new jt({x:e.position.x,y:e.position.y,text:e.text,fontSize:e.fontSize,rotation:e.rotation,fontStyle:ws(e.bold,e.italic,"600"),fill:Y(t,i),fontFamily:e.fontFamily??s.labelFont(),...e.width!=null?{width:e.width}:{},align:e.align??"left",lineHeight:e.lineHeight??1.2,letterSpacing:e.letterSpacing??0,textDecoration:e.underline?"underline":"",padding:n,opacity:r,wrap:"word",listening:!1,perfectDrawEnabled:!1,name:"buyer-free-text"}),l;e.background&&(l=new Qt({x:e.position.x,y:e.position.y,width:a.width(),height:a.height(),rotation:e.rotation,fill:e.background.color,opacity:r*(e.background.opacity??.9),cornerRadius:e.background.cornerRadius??4,listening:!1,perfectDrawEnabled:!1,name:"buyer-text-background"}),s.bgLayer.add(l)),s.freeTextById.set(e.id,{node:a,backdrop:l,background:t,kind:"free-text"}),s.bgLayer.add(a)}function Is(s,e){let t=e.fill??s.theme.decorFill??Ss,i=e.role==="stage",o=e.role==="reference-focal",n=!!e.role&&!i,r=re(s.canvasBackground),a=o?r.focalFill:t,l=e.kind==="line"||e.kind==="polyline",c=e.stroke?.color??(i?ue(a,.28):o?r.focalStroke:l?"#9aa3b5":void 0),h=e.stroke?.width??(i?1:o||l?2:0),u=e.opacity!=null?N(e.opacity,.1,1):1,d=0,m=0;if(l&&e.points&&e.points.length>=2){d=e.points.reduce((b,g)=>b+g.x,0)/e.points.length,m=e.points.reduce((b,g)=>b+g.y,0)/e.points.length;let y=_i(e),p=Gi(h),f=new Eo({points:e.points.flatMap(b=>[b.x,b.y]),closed:!1,x:d,y:m,offsetX:d,offsetY:m,rotation:e.rotation??0,stroke:c,fill:c,strokeWidth:h,opacity:u,lineCap:y.lineCap,lineJoin:y.lineJoin,pointerAtBeginning:y.startEnding==="arrow",pointerAtEnding:y.endEnding==="arrow",...p,listening:!1,name:"buyer-shape-open-path"});f.setAttr("shapeObjectId",e.id),s.bgLayer.add(f)}else if(e.kind==="rect"&&e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null){let y=i?{fillLinearGradientStartPoint:{x:0,y:0},fillLinearGradientEndPoint:{x:0,y:e.height},fillLinearGradientColorStops:[0,ce(a,.3),1,ue(a,.12)]}:{fill:a};d=e.x+e.width/2,m=e.y+e.height/2,s.bgLayer.add(new Qt({x:d,y:m,offsetX:e.width/2,offsetY:e.height/2,rotation:e.rotation??0,width:e.width,height:e.height,...y,stroke:c,strokeWidth:h,cornerRadius:N(e.cornerRadius??4,0,Math.min(e.width,e.height)/2),opacity:u,listening:!1}))}else if(e.kind==="ellipse"&&e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null){d=e.x+e.width/2,m=e.y+e.height/2;let y=i?{fillLinearGradientStartPoint:{x:0,y:-e.height/2},fillLinearGradientEndPoint:{x:0,y:e.height/2},fillLinearGradientColorStops:[0,ce(a,.3),1,ue(a,.12)]}:{fill:a};s.bgLayer.add(new xo({x:d,y:m,rotation:e.rotation??0,radiusX:e.width/2,radiusY:e.height/2,...y,stroke:c,strokeWidth:h,opacity:u,listening:!1}))}else if(e.kind==="polygon"&&e.points&&e.points.length){let y=e.points.flatMap(b=>[b.x,b.y]),p=z(e.points);d=e.points.reduce((b,g)=>b+g.x,0)/e.points.length,m=e.points.reduce((b,g)=>b+g.y,0)/e.points.length;let f=i?{fillLinearGradientStartPoint:{x:0,y:p.y},fillLinearGradientEndPoint:{x:0,y:p.y+p.height},fillLinearGradientColorStops:[0,ce(a,.3),1,ue(a,.12)]}:{fill:a};s.bgLayer.add(new Ro({points:y,closed:!0,x:d,y:m,offsetX:d,offsetY:m,rotation:e.rotation??0,...f,stroke:c,strokeWidth:h,opacity:u,listening:!1}))}if(e.label)if(i){let y=Fo(s,d,m,e.label,a);s.primaryFocalLabels.set(y,22),s.freeTextById.set(e.id,{node:y,background:a,kind:"stage"})}else if(n){let y=Ze(s,s.bgLayer,e.label,d,m,o?Y(a,"#e6e9f0"):"#9aa3b5",o?18:12,!1);o&&s.primaryFocalLabels.set(y,18),s.freeTextById.set(e.id,{node:y,background:a,kind:"decor"})}else{let y=Ze(s,s.bgLayer,e.label,d,m,"#cbd5e1",16,!0);s.freeTextById.set(e.id,{node:y,background:a,kind:"decor"})}}function Fo(s,e,t,i,o){let n=Y(o,"#e6e9f0"),r=new jt({x:e,y:t,text:i.toUpperCase(),fontSize:22,fontStyle:"700",letterSpacing:4,fontFamily:s.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});return r.offsetX(r.width()/2),r.offsetY(r.height()/2),s.bgLayer.add(r),r}function Cs(s,e){let t=s.catColor.get(e.categoryKey)??"#6e7bff",i=s.canvasBackground,o=Mi(t,i,Me),n=s.theme.textColor??"#e6e9f0",r=Y(o,n),a=Fe(e.points,e.holes,{fill:t,opacity:Me,stroke:t,strokeWidth:1.5,cornerRadius:e.cornerRadius});a.setAttr("gaId",e.id),a.on("click tap",d=>{s.isGhostClick(d)||s.opts.onGAClick?.(e.id)}),a.on("mouseenter",()=>{s.container.style.cursor="pointer"}),a.on("mouseleave",()=>{s.container.style.cursor="default"}),s.bgLayer.add(a);let l=ot(e.points,e.holes),c=s.sections.find(d=>j(l,d.outline,d.holes)),h=Ze(s,s.bgLayer,e.displayLabel??e.label,l.x,l.y-8,r,Ii,!1),u=Ze(s,s.bgLayer,`cap ${e.capacity}`,l.x,l.y+10,r,Ci,!1);s.freeTextById.set(`${e.id}:label`,{objectId:e.id,node:h,background:o,kind:"ga-label",categoryKey:e.categoryKey}),s.freeTextById.set(`${e.id}:capacity`,{objectId:e.id,node:u,background:o,kind:"ga-capacity",categoryKey:e.categoryKey}),s.gaById.set(e.id,{label:e.displayLabel??e.label,capacity:e.capacity,categoryKey:e.categoryKey,points:e.points,polygon:a,effectiveBackground:o,...c?{sectionId:c.logicalId}:{}})}function Ze(s,e,t,i,o,n,r,a){let l=new jt({x:i,y:o,text:t,fontSize:r,fontStyle:a?"700":"500",fontFamily:s.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});return l.offsetX(l.width()/2),l.offsetY(l.height()/2),e.add(l),l}function Ms(s,e){let t=[],i=e.theme.background??"#0e1117",o=new Map,n=(c,h)=>{let u=o.get(c)??[];u.push(h),o.set(c,u)};for(let c of e.seats){if(c.kind==="booth")continue;let h=c.logicalRowId??c.rowId;n(h,c),h!==c.rowId&&n(c.rowId,c)}let r=c=>c.logicalSeatIndex??Number(c.id.split(":").pop()??0);for(let c of s.objects){if(c.type!=="row")continue;let h=c.segmentedRow?.repeatLabelOnComponents===!0;if(c.segmentedRow&&!h&&c.segmentedRow.componentIndex!==0)continue;let u=h?c.labelPresentation:c.segmentedRow?.labelPresentation??c.labelPresentation;if(u?.visible===!1||u?.positionPreset==="none")continue;let d=c.segmentedRow&&!h?c.segmentedRow.groupId:c.id,m=(o.get(d)??[]).slice().sort((P,C)=>r(P)-r(C));if(!m.length)continue;let y=m[0],p=m[m.length-1],f=u?.labelStyle,b=Y(i,f?.color??e.theme.rowLabelColor??e.theme.textColor??"#e6e9f0",ct),g=f?.size??12,v=u?.rotation??0,k=c.segmentedRow?.displayLabel??c.displayLabel??c.label,L=e.objectFilteredOut(c)?.15:1,S=e.seatSection.get(y.id),w=S?[...new Set([S.id,S.logicalId,S.zone].filter(P=>!!P))]:void 0,x=(P,C,M)=>t.push({text:k,x:P,y:C,rotation:v,fontSize:g,ink:b,opacity:L,...w?.length?{focusKeys:w}:{},...M?{automaticAway:M}:{}});if(u?.position){x(u.position.x,u.position.y);continue}let I=e.seatR+12,T=u?.positionPreset??"start";if(T==="start"||T==="both"){let P=c.rotation*Math.PI/180,C={x:-Math.cos(P),y:-Math.sin(P)};x(y.x+C.x*I,y.y+C.y*I,C)}if(T==="end"||T==="both"){let P=(c.rotation+c.curve)*Math.PI/180,C={x:Math.cos(P),y:Math.sin(P)};x(p.x+C.x*I,p.y+C.y*I,C)}}let a=(e.seatR+12)*2.2,l=[];for(let c of t){let h=l.find(u=>u.text===c.text&&Math.hypot(u.x-c.x,u.y-c.y)<=a);if(h){h.x=(h.x+c.x)/2,h.y=(h.y+c.y)/2;continue}l.push(c)}return l}function Jt(s,e,t=U){let i=s.rotation()*Math.PI/180,o=Math.abs(Math.cos(i)),n=Math.abs(Math.sin(i)),r=(s.width()*o+s.height()*n)/2+t,a=(s.width()*n+s.height()*o)/2+t;return{x:e.x-r,y:e.y-a,width:r*2,height:a*2}}function Ps(s,e,t,i){let o={x:e.x,y:e.y},n=e.automaticAway;if(!n)return o;let r={x:-n.y,y:n.x},a=Math.max(7,Math.min(16,e.fontSize*.75)),l=[{x:0,y:0}];for(let d=1;d<=4;d++){let m=a*d;l.push({x:r.x*m,y:r.y*m},{x:-r.x*m,y:-r.y*m},{x:n.x*m,y:n.y*m},{x:(n.x+r.x)*m,y:(n.y+r.y)*m},{x:(n.x-r.x)*m,y:(n.y-r.y)*m})}let c=o,h=1/0,u=1/0;for(let d of l){let m={x:o.x+d.x,y:o.y+d.y},y=Jt(s,m),f=(i?ht(i,y,{mode:"overlap"}).length:0)+t.collisionCount(y),b=Math.hypot(d.x,d.y);if((f<h||f===h&&b<u)&&(c=m,h=f,u=b),f===0)break}return c}function xs(s,e){let t=s.sectionHeat.get(e.id)??s.sectionHeat.get(e.logicalId)??(e.zone?s.sectionHeat.get(e.zone):void 0);if(t==null||t<=0){e.outlinePoly.stroke(te(e.outlineTint,.5)),e.outlinePoly.fill(te(e.outlineTint,.08)),e.outlinePoly.strokeWidth(1.75),e.outlinePoly.shadowOpacity(0);return}let i=at("#f4b740","#ef4444",t);e.outlinePoly.stroke(te(i,.72+t*.25)),e.outlinePoly.fill(te(i,.08+t*.13)),e.outlinePoly.strokeWidth(2+t*3.5),e.outlinePoly.shadowColor(i),e.outlinePoly.shadowBlur(4+t*12),e.outlinePoly.shadowOpacity(.25+t*.45)}function ei(s,e){return s.closedSections.has(e.id)||s.closedSections.has(e.logicalId)||e.zone!=null&&s.closedSections.has(e.zone)}function ti(s,e){return ei(s,e)?"closed":e.total<=0?"normal":e.free<=0?"sold-out":e.free<=e.total*cs?"nearly-gone":"normal"}function Rs(s,e){let t=ti(s,e);e.blockPoly.fill(Be(re(s.canvasBackground),t)),e.subLabel.text(t==="sold-out"?oe("map.soldOut"):oe("map.seatsLeft",{count:e.free})),e.subLabel.offsetX(e.subLabel.width()/2)}function Es(s,e){let t,i;s.reducedMotion?(t=e<=ye?1:0,i=e<=Ee?1:0):(t=N((Re-e)/(Re-ye),0,1),i=N((ye-e)/(ye-Ee),0,1)),(s.floorOverview||s.focusedSectionId)&&(t=0,i=0);let o=!s.floorOverview&&!s.focusedSectionId&&e<ee;o&&(t=1),s.zones.length||(i=0);let n=s.viewMode==="perspective"&&s.glideInProgress&&s.seatCount>2500;s.seatLayer.opacity(o||n?0:1-t);let r=s.stageScaleX,a=!s.glideInProgress&&(s.lodScale===0||Math.abs(e-s.lodScale)/(s.lodScale||1)>.08);a&&s.setLodScale(e);let l=s.focusedSectionId,c=re(s.canvasBackground),h=N((t-.2)/.8,0,1);for(let d of s.sections){let m=s.hasFocusDimOverlay?1:l&&d.id!==l&&d.logicalId!==l&&d.zone!==l?qe:1;d.outlinePoly.opacity(o?0:(1-t)*m),d.blockPoly.opacity(ns*t*m),d.blockPoly.stroke(c.sectionStroke),d.blockPoly.strokeWidth(St/Math.max(r,1e-4));let y=d.blockPoly.fill(),p=Y(typeof y=="string"?y:d.baseFill,d.preferredInk);d.nameLabel.fill(p),d.subLabel.fill(p),a&&h>.01&&_o(s,d,r),d.nameLabel.opacity(d.nameLabelFits?h*(1-i)*m:0),d.subLabel.opacity(0)}let u=i*(1-s.isoT);for(let d of s.zones)d.back.opacity(u),d.label.opacity(u),d.sub&&d.sub.opacity(u),a&&Go(s,d,r);if(!s.glideInProgress&&(h>.01||u>.01)){Oo(s,r),Do(s.sections);for(let d of s.zones){let m=d.label.opacity();d.back.opacity(m),d.sub&&d.sub.opacity(m)}}s.bgLayer.batchDraw()}function Do(s){let e=new Map;for(let t of s)(e.get(t.logicalId)??e.set(t.logicalId,[]).get(t.logicalId)).push(t);for(let t of e.values()){if(t.length<2)continue;let i=t.filter(o=>o.nameLabel.opacity()>.05).sort((o,n)=>{let r=z(o.outline),a=z(n.outline);return a.width*a.height-r.width*r.height});for(let o of i.slice(1))o.nameLabel.opacity(0)}}function Oo(s,e){let i=[],o=a=>{let l=s.worldToScreen({x:a.x(),y:a.y()}),c=z(Lt({x:0,y:0},a.width()*e,a.height()*e,a.rotation()));return{x:l.x-c.width/2,y:l.y-c.height/2,w:c.width,h:c.height}};for(let a of s.zones){if(a.label.opacity()<=.05)continue;let l=s.worldToScreen(a.anchor),c=a.back.width()*e,h=a.back.height()*e;i.push({node:a.label,tier:0,section:!1,box:{x:l.x-c/2,y:l.y-h/2,w:c,h}})}for(let a of s.sections)a.nameLabel.opacity()>.05&&i.push({node:a.nameLabel,tier:1,section:!0,area:a.labelArea,box:o(a.nameLabel)});if(i.length<2)return;i.sort((a,l)=>a.tier-l.tier||(l.area??0)-(a.area??0)||a.box.y-l.box.y||a.box.x-l.box.x);let n=[],r=a=>n.some(l=>a.x<l.x+l.w+4&&l.x<a.x+a.w+4&&a.y<l.y+l.h+4&&l.y<a.y+a.h+4);for(let a of i){if(!r(a.box)){n.push(a.box);continue}let l=!1;if(a.section){let c=a.node.fontSize(),h=a.node.y();for(let u of as){let d=c*u;if(d*e<qt)break;Qe(a.node,d,h);let m=o(a.node);if(!r(m)){n.push(m),l=!0;break}}l||Qe(a.node,c,h)}l||a.node.opacity(0)}}function Qe(s,e,t){s.fontSize(Math.max(1,e)),s.offsetX(s.width()/2),s.offsetY(s.height()/2),s.y(t)}function _o(s,e,t){e.subLabelFits=!1;let i=Math.min(1,Math.max(.66,s.stageWidth/900)),o=rs*e.labelScale*i,n=Math.min(qt*e.labelScale,o);for(let r=o;r>=n;r-=1)for(let a of[0,-90]){e.nameLabel.rotation(a),Qe(e.nameLabel,r/t,e.nameLabel.y());for(let l of e.labelAnchors){e.nameLabel.position(l);let c=8/t;if(Tt(l,e.nameLabel.width()+c,e.nameLabel.height()+c,a,e.outline,e.holes)){e.nameLabelFits=!0;return}}}e.nameLabel.position(e.centroid),e.nameLabel.rotation(0),e.nameLabelFits=!1}function Go(s,e,t){let i=Math.min(1,Math.max(.66,s.stageWidth/900)),o=10*i/t,n=6*i/t,r=e.sub?3*i/t:0;Qe(e.label,vt*i/t,e.anchor.y),e.sub&&Qe(e.sub,ls*i/t,e.anchor.y);let a=Math.max(e.label.width(),e.sub?.width()??0)+o*2,l=e.label.height()+(e.sub?r+e.sub.height():0)+n*2;e.label.y(e.anchor.y-(e.sub?(r+e.sub.height())/2:0)),e.sub&&e.sub.y(e.anchor.y+(e.label.height()+r)/2),e.back.position(e.anchor),e.back.size({width:a,height:l}),e.back.offset({x:a/2,y:l/2}),e.back.cornerRadius(7*i/t),e.back.strokeWidth(1/t);let c=e.back.getAbsolutePosition(),h=62+l*t/2;if(c.y<h){let u=(h-c.y)/t;e.label.y(e.label.y()+u),e.sub&&e.sub.y(e.sub.y()+u),e.back.y(e.back.y()+u)}}import{Group as Ho}from"konva/lib/Group";import{Line as Bs}from"konva/lib/shapes/Line";import{Rect as Vo}from"konva/lib/shapes/Rect";import{Text as As}from"konva/lib/shapes/Text";function Fs(s){let e=s.exportMode?Math.max(s.effScale(),ne):s.effScale(),t=e>=ne;for(let[n,r]of s.boothLabelById){let a=s.circleById.get(n);r.visible(fe(r.fontSize(),e)&&!!a?.isVisible()&&s.focusedSeatOpacity(n,a?.getAbsoluteOpacity()??1)>=.5)}s.labelGroup.destroyChildren(),s.labelLiftGroups.clear(),s.seatLabelById.clear();let i=0;if(t)for(let n of s.visibleSeatCandidates()){if(n.kind==="booth")continue;let r=s.worldToScreen(n);if(r.x<-20||r.x>s.stage.width()+20||r.y<-20||r.y>s.stage.height()+20||s.accessGlyphById.has(n.id)&&s.accessGlyphShouldShow(n.id))continue;let a=s.circleById.get(n.id);if(!a?.isVisible()||s.focusedSeatOpacity(n.id,a.getAbsoluteOpacity())<.5)continue;let l=s.statusById.get(n.id)??"free",c=s.renderedSeatPoint(n),h=s.viewMode==="perspective"?s.perspectiveSeatScale.get(n.id)??1:1;if(l==="booked"||l==="held"&&!s.ownedHold.has(n.id)&&!s.opts.manageMode){let p=new Ho({x:c.x,y:c.y,listening:!1});if(p.scale({x:h,y:h}),l==="held"?(p.add(new Vo({x:-4.2,y:-.7,width:8.4,height:6.5,cornerRadius:1.3,stroke:"#ffffff",strokeWidth:1.25,listening:!1})),p.add(new Bs({points:[-2.4,-.8,-2.4,-2.7,-1.2,-4,0,-4.35,1.2,-4,2.4,-2.7,2.4,-.8],stroke:"#ffffff",strokeWidth:1.2,lineCap:"round",lineJoin:"round",listening:!1}))):p.add(new Bs({points:[-4.2,4.2,4.2,-4.2],stroke:"#ffffff",strokeWidth:1.8,lineCap:"round",listening:!1})),s.seatLabelContainer(n.id).add(p),++i>=Xt)break;continue}let d=he*s.seatLabelScale(n),m=new As({x:c.x,y:c.y,text:lt(n.displayLabel??n.label),fontSize:d,fontStyle:"600",fontFamily:s.labelFont(),fill:a?s.seatLabelInk(n,a):s.seatPreferredLabelInk(n),listening:!1,perfectDrawEnabled:!1}),y=s.seatR*2-3;if(m.width()>y&&m.fontSize(Math.max(Ke,d*y/m.width())),m.width()>y+.01){m.destroy();continue}if(!fe(m.fontSize(),e)){m.destroy();continue}if(m.offsetX(m.width()/2),m.offsetY(m.height()/2),m.scale({x:h,y:h}),s.seatLabelContainer(n.id).add(m),s.seatLabelById.set(n.id,m),++i>=Xt)break}let o=new Ae;for(let{node:n}of s.freeTextById.values()){if(!n.isVisible())continue;let r=n.getClientRect({relativeTo:s.bgLayer,skipShadow:!0,skipStroke:!0});o.insert({x:r.x-U,y:r.y-U,width:r.width+U*2,height:r.height+U*2})}for(let n of s.rowLabelPlan){let r=s.focusedSectionId!=null&&n.focusKeys?.includes(s.focusedSectionId),a=r?Math.max(n.fontSize,is/Math.max(e,1e-4)):n.fontSize;if(!r&&!fe(a,e))continue;let l=s.worldToScreen({x:n.x,y:n.y});if(l.x<-40||l.x>s.stage.width()+40||l.y<-40||l.y>s.stage.height()+40)continue;let c=new As({x:n.x,y:n.y,text:n.text,fontSize:a,fontStyle:"700",fontFamily:s.labelFont(),fill:n.ink,rotation:n.rotation,opacity:n.opacity,shadowColor:"#05070c",shadowBlur:n.ink.toLowerCase()==="#ffffff"?5:0,shadowOpacity:n.ink.toLowerCase()==="#ffffff"?.8:0,shadowForStrokeEnabled:!1,listening:!1,perfectDrawEnabled:!1});c.offsetX(c.width()/2),c.offsetY(c.height()/2);let h=s.resolveAutomaticRowLabelPosition(c,n,o);c.position(h),c.setAttr("rowLabel",!0),o.insert(s.rowLabelBox(c,h)),s.labelGroup.add(c)}s.isoT>0&&s.viewMode!=="perspective"&&s.applyUprightLabels(),s.overlayLayer.batchDraw()}function je(s){return{th:gt*Math.PI/180*s.isoT,sg:1-(1-Xe)*s.isoT}}function Ds(s,e){let{th:t,sg:i}=je(e),o=e.centre,n=s.x-o.x,r=s.y-o.y,a=n*Math.cos(t)-r*Math.sin(t),l=(n*Math.sin(t)+r*Math.cos(t))*i;return{x:o.x+a,y:o.y+l}}function Os(s,e){let{th:t,sg:i}=je(e),o=e.centre,n=s.x-o.x,a=(s.y-o.y)/i,l=n*Math.cos(t)+a*Math.sin(t),c=-n*Math.sin(t)+a*Math.cos(t);return{x:o.x+l,y:o.y+c}}function _s(s,e){let{th:t,sg:i}=je(e),o=s*e.isoT;return{x:-(o/i)*Math.sin(t),y:-(o/i)*Math.cos(t)}}function Gs(s,e,t){let i=Bi(e);s.offset(t),s.position(J(e,t)),s.rotation(i.rotationDeg),s.scale({x:i.scaleX,y:i.scaleY}),s.skewX(i.skewX),s.skewY(0)}function Hs(s){s.position({x:0,y:0}),s.offset({x:0,y:0}),s.scale({x:1,y:1}),s.rotation(0),s.skewX(0),s.skewY(0)}function Vs(s,e){let t=Math.hypot(e.x-s.surfaceFocal.x,e.y-s.surfaceFocal.y),i=Math.max(0,t-s.frontDistanceWorld);return s.liftWorld+i*Math.tan(s.rakeDeg*Math.PI/180)}function Ns(s,e,t){return s.perspectiveAffine?J(s.perspectiveAffine,e):J(t,e)}function zs(s,e){return e?J(e,s):s}function Ws(s,e){let t=0;for(let u of s.seats){let d=Math.max(0,(u.eyeHeightM??q)-q);t=Math.max(t,d*Ie)}for(let u of s.objects)u.type==="section"&&(t=Math.max(t,st(u,{floorBaseHeightM:s.floorBaseHeightMFor(u.id)}).height*Ie));let i=xi(s.bounds,t),o=dt(i,i.target),n=Ri(o);e.seatLocal.clear(),e.seatProjected.clear(),e.seatDepth.clear(),e.seatScale.clear();let r=1/0,a=1/0,l=-1/0,c=-1/0;for(let u of s.seats){let d=Math.max(0,(u.eyeHeightM??q)-q),m=pe(i,u,d*Ie),y={x:m.x,y:m.y};e.seatProjected.set(u.id,y),e.seatLocal.set(u.id,J(n,y)),e.seatDepth.set(u.id,m.depth),e.seatScale.set(u.id,m.scale),r=Math.min(r,m.x),a=Math.min(a,m.y),l=Math.max(l,m.x),c=Math.max(c,m.y)}for(let u of[{x:s.bounds.x,y:s.bounds.y},{x:s.bounds.x+s.bounds.width,y:s.bounds.y},{x:s.bounds.x+s.bounds.width,y:s.bounds.y+s.bounds.height},{x:s.bounds.x,y:s.bounds.y+s.bounds.height}]){let d=pe(i,u,0);r=Math.min(r,d.x),a=Math.min(a,d.y),l=Math.max(l,d.x),c=Math.max(c,d.y)}let h=Math.max(24,s.seatR*3);return{camera:i,baseAffine:o,baseInverse:n,bounds:Number.isFinite(r)?{x:r-h,y:a-h,width:Math.max(1,l-r+h*2),height:Math.max(1,c-a+h*2)}:null}}function Ks(s,e,t){let i=t?[...t].map(o=>s.seatById.get(o)).filter(o=>!!o):e?s.seats:[...s.perspectiveAppliedSeats].map(o=>s.seatById.get(o)).filter(o=>!!o);for(let o of i){if(e&&s.perspectiveAppliedSeats.has(o.id))continue;let n=e?s.perspectiveSeatProjected.get(o.id)??o:o,r=e?s.perspectiveSeatScale.get(o.id)??1:1,a=s.circleById.get(o.id);a?.position(n),a?.scale({x:r,y:r});let l=s.accessRingById.get(o.id);l?.position(n),l?.scale({x:r,y:r});let c=s.accessGlyphById.get(o.id);if(c){let u=s.seatR*1.5/ie;c.position(n),c.scale({x:u*r,y:u*r})}let h=s.boothLabelById.get(o.id);h?.position(n),h?.scale({x:r,y:r}),e&&s.perspectiveAppliedSeats.add(o.id)}e||s.perspectiveAppliedSeats.clear()}function si(s){return s?.getAttr?.("seatId")??void 0}var et=class et{constructor(e,t={}){this.labelLiftGroups=new Map;this.seats=[];this.seatById=new Map;this.seatIndex=null;this.chartDoc=null;this.activeFloorId="";this.stacked=!1;this.floorOverview=!1;this.circleById=new Map;this.boothDims=new Map;this.boothLabelById=new Map;this.seatLabelById=new Map;this.accessRingById=new Map;this.accessGlyphById=new Map;this.freeTextById=new Map;this.iconNodeById=new Map;this.primaryFocalLabels=new Map;this.gaById=new Map;this.statusById=new Map;this.catColor=new Map;this.theme={};this.canvasBackground=Zt;this.effSelection=Ue;this.colorblind=!1;this.cbHueByKey=new Map;this.rowLabelPlan=[];this.catOrder=[];this.selection=new Set;this.selectionMarkers=new Map;this.ownedHold=new Set;this.selectionFocusId=null;this.hoveredId=null;this.focusedId=null;this.accessFilter=null;this.categoryHighlight=null;this.categoryFilter=null;this.commercialLimitedFilter=!1;this.sections=[];this.zones=[];this.seatSection=new Map;this.unsectionedSeatGroup=null;this.catPrice=new Map;this.dimmedSections=new Set;this.sectionHeat=new Map;this.closedSections=new Set;this.focusedSectionId=null;this.focusBackdrop=null;this.focusDimOverlay=null;this.objectFloor=new Map;this.zoneColor=new Map;this.hasSections=!1;this.hasBoothText=!1;this.isoT=0;this.isoTarget=0;this.isoRaf=0;this.viewMode="flat";this.perspectiveCamera=null;this.perspectiveBaseAffine=null;this.perspectiveBaseInverse=null;this.perspectiveSeatLocal=new Map;this.perspectiveSeatProjected=new Map;this.perspectiveSeatDepth=new Map;this.perspectiveSeatScale=new Map;this.perspectiveAppliedSeats=new Set;this.perspectiveBounds=null;this.isoCentre={x:0,y:0};this.glideRaf=0;this.glideInProgress=!1;this.destroyed=!1;this.lodScale=0;this.reducedMotion=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.fitScale=1;this.seatR=We;this.bounds={x:0,y:0,width:1,height:1};this.cached=!1;this.dpr=Math.min(typeof window<"u"&&window.devicePixelRatio||1,2);this.assetGeneration=0;this.assetPromises=[];this.assetErrors=[];this.assetCancels=new Set;this.rafId=0;this.frames=0;this.lastFpsAt=0;this.recacheTimer=null;this.resizeObs=null;this.viewChangeRaf=0;this.marquee=null;this.marqueeCur=null;this.onKeyDown=e=>{if(this.opts.manageMode){if((e.metaKey||e.ctrlKey)&&(e.key==="a"||e.key==="A")){e.preventDefault(),this.opts.onMarquee?.(this.selectAllSelectable());return}if(e.key==="Escape"&&this.selection.size){e.preventDefault(),this.clearSelection(),this.opts.onMarquee?.([]);return}}let t=e.key==="ArrowLeft"?{x:-1,y:0}:e.key==="ArrowRight"?{x:1,y:0}:e.key==="ArrowUp"?{x:0,y:-1}:e.key==="ArrowDown"?{x:0,y:1}:null;if(t){e.preventDefault();let i=this.focusedId?this.nearestSeat(this.focusedId,t):this.seats[0]?.id??null;i&&this.focusSeat(i);return}if((e.key==="Enter"||e.key===" ")&&this.focusedId){e.preventDefault(),this.toggleSeat(this.focusedId);let i=this.seatById.get(this.focusedId);i&&this.opts.onFocusSeat?.(i)}};this.container=e,this.opts={maxSelection:10,selectableStatuses:["free"],...t},this.exportMode=t.exportMode===!0,this.currency=t.currency;let i=Mt.pixelRatio;this.exportMode&&(this.dpr=1),Mt.pixelRatio=this.dpr,this.stage=new No({container:e,width:e.clientWidth||1,height:e.clientHeight||1,draggable:!1}),this.gestures=new It(this.pointerHost),this.exportMode||(e.style.touchAction="none",this.gestures.attach(),e.tabIndex<0&&(e.tabIndex=0),e.setAttribute("role","application"),e.getAttribute("aria-label")||e.setAttribute("aria-label",oe("map.aria")),e.addEventListener("keydown",this.onKeyDown)),this.bgLayer=new ii({listening:!this.exportMode}),this.seatLayer=new ii({listening:!this.exportMode}),this.overlayLayer=new ii({listening:!1}),this.labelGroup=new we({listening:!1}),this.overlayLayer.add(this.labelGroup),this.fgDecorGroup=new we({listening:!1}),this.overlayLayer.add(this.fgDecorGroup),this.hoverRing=new me({radius:We+2,stroke:"#ffffff",strokeWidth:2,opacity:.85,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.hoverRing),this.focusRing=new me({radius:We+3,stroke:"#38bdf8",strokeWidth:2.5,dash:[4,3],opacity:.95,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.focusRing),this.stage.add(this.bgLayer,this.seatLayer,this.overlayLayer),this.exportMode&&(Mt.pixelRatio=i),this.exportMode||(this.wireInteraction(),this.startFpsLoop()),!this.exportMode&&typeof ResizeObserver<"u"&&(this.resizeObs=new ResizeObserver(()=>this.handleResize()),this.resizeObs.observe(e))}get moved(){return this.gestures.moved}isGhostClick(e){return this.gestures.isGhostClick(e)}get pointerHost(){return{container:this.container,stage:this.stage,cancelGlide:()=>this.cancelGlide(),releaseSectionFocusDim:()=>this.releaseSectionFocusDim(),updateSeatGroupVisibility:()=>this.updateSeatGroupVisibility(),scheduleViewChange:()=>this.scheduleViewChange(),afterViewChange:()=>this.afterViewChange(),zoomBounds:()=>this.zoomBounds(),marqueeActive:()=>!!this.marquee,marqueeShouldStart:e=>!!(this.opts.manageMode&&this.opts.marqueeSelect&&e.pointerType!=="touch"&&e.button===0&&this.getRung()==="seats"),beginMarquee:e=>this.beginMarquee(e),updateMarquee:e=>this.updateMarquee(e),finishMarquee:()=>this.finishMarquee(),cancelMarquee:()=>this.cancelMarquee()}}setChart(e,t){if(e!==this.chartDoc&&(this.stacked=!1,this.floorOverview=!1),this.cancelAssetLoads(),this.chartDoc=e,this.activeFloorId=t?.floorId??nt(e)[0].id,this.objectFloor.clear(),e.floors&&e.floors.length>1)for(let o of e.floors)for(let n of o.objects)this.objectFloor.set(n.id,o.id),n.type==="section"&&n.logicalSectionId&&this.objectFloor.set(n.logicalSectionId,o.id);let i=this.floorView(e);this.focusedId=null,this.focusRing.visible(!1),this.bgLayer.destroyChildren(),this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.seatLayer.clearCache(),this.seatLayer.listening(!this.exportMode),this.seatLayer.destroyChildren(),this.unsectionedSeatGroup=null,this.labelGroup.destroyChildren(),this.labelLiftGroups.clear(),this.fgDecorGroup.destroyChildren(),this.circleById.clear(),this.boothDims.clear(),this.boothLabelById.clear(),this.seatLabelById.clear(),this.accessRingById.clear(),this.accessGlyphById.clear(),this.freeTextById.clear(),this.iconNodeById.clear(),this.primaryFocalLabels.clear(),this.gaById.clear();for(let o of this.selectionMarkers.values())o.destroy();this.selectionMarkers.clear(),this.ownedHold.clear(),this.selectionFocusId=null,this.statusById.clear(),this.selection.clear(),this.seatById.clear(),this.seatIndex=null,this.cached=!1,this.accessFilter=null,this.sections=[],this.zones=[],this.seatSection.clear(),this.focusedSectionId=null,this.focusBackdrop=null,this.catPrice.clear(),this.zoneColor.clear(),this.lodScale=0,this.hasBoothText=!1,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),this.isoT=0,this.isoTarget=0,this.viewMode="flat",this.perspectiveCamera=null,this.perspectiveBaseAffine=null,this.perspectiveBaseInverse=null,this.perspectiveSeatLocal.clear(),this.perspectiveSeatProjected.clear(),this.perspectiveSeatDepth.clear(),this.perspectiveSeatScale.clear(),this.perspectiveAppliedSeats.clear(),this.perspectiveBounds=null,this.resetLayerTransforms(),this.hasSections=i.objects.some(o=>o.type==="section");for(let o of e.zones??[])o.color&&this.zoneColor.set(o.id,o.color);this.seatLayer.opacity(1),this.hoverRing.visible(!1),this.hoveredId=null,this.theme=e.theme??{},this.seatR=N(this.theme.seatScale??1,.7,1.6)*We,this.container.style.background="",this.canvasBackground=this.resolveCanvasBackground(),this.container.style.background=this.canvasBackground,this.effSelection=this.resolveSelectionColor(),this.hoverRing.stroke(this.effSelection),this.hoverRing.radius(this.seatR+2),this.catColor.clear(),this.catPrice.clear(),this.catOrder=e.categories.map(o=>o.key),this.cbHueByKey.clear(),[...this.catOrder].sort().forEach((o,n)=>{this.cbHueByKey.set(o,kt[n%kt.length])});for(let o of e.categories)this.catColor.set(o.key,o.color),typeof o.price=="number"&&this.catPrice.set(o.key,o.price);for(let o of i.objects)o.type==="booth"&&this.boothDims.set(o.id,{width:o.width,height:o.height,rotation:o.rotation,...o.points&&o.points.length>=3?{points:o.points.map(n=>({x:n.x,y:n.y}))}:{}});this.seats=He(i,{floorBaseHeightM:this.stacked||this.floorOverview?0:this.floorBaseHeightMFor()});for(let o of this.seats)this.seatById.set(o.id,o),this.statusById.set(o.id,"free");this.seatIndex=Pi(this.seats,{seatRadius:this.seatR}),this.bounds=wi(i),this.isoCentre={x:this.bounds.x+this.bounds.width/2,y:this.bounds.y+this.bounds.height/2},this.buildPerspectiveProjection(i),this.renderBackground(i),this.unsectionedSeatGroup=new we({listening:!this.exportMode}),this.seatLayer.add(this.unsectionedSeatGroup),this.renderSeats(),this.buildRowLabelPlan(i),this.overlayLayer.add(this.labelGroup),this.overlayLayer.add(this.fgDecorGroup),this.overlayLayer.add(this.hoverRing),this.overlayLayer.add(this.focusRing),this.zoomToFit()}floorView(e){if(!e.floors||!e.floors.length)return{...e,referenceImage:void 0,backgroundImage:Pe(e)};if(this.floorOverview&&e.floors.length>=2)return{...vi(e),referenceImage:void 0,backgroundImage:Pe(e)};if(this.stacked&&e.floors.length>=2)return{...Si(e),referenceImage:void 0,backgroundImage:Pe(e)};let t=e.floors.find(i=>i.id===this.activeFloorId)??e.floors[0];return{...e,objects:t.objects,focalPoint:t.focalPoint,referenceImage:void 0,backgroundImage:Pe(t),floors:void 0}}floorBaseHeightMFor(e){let t=this.chartDoc?.floors;if(!t?.length)return 0;let i=this.stacked&&e?this.objectFloor.get(e)??this.activeFloorId:this.activeFloorId;return t.find(o=>o.id===i)?.baseHeightM??0}setStacked(e){!this.chartDoc||e===this.stacked||!(this.chartDoc.floors&&this.chartDoc.floors.length>=2)||(this.stacked=e,e&&(this.floorOverview=!1),this.setChart(this.chartDoc,{floorId:this.activeFloorId}))}isStacked(){return this.stacked}setFloorOverview(e){!this.chartDoc||e===this.floorOverview||!(this.chartDoc.floors&&this.chartDoc.floors.length>=2)||(this.floorOverview=e,e&&(this.stacked=!1),this.setChart(this.chartDoc,{floorId:this.activeFloorId}))}isFloorOverview(){return this.floorOverview}setActiveFloor(e){!this.chartDoc||e===this.activeFloorId&&!this.floorOverview&&!this.stacked||(this.floorOverview=!1,this.stacked=!1,this.setChart(this.chartDoc,{floorId:e}))}getFloors(){return this.chartDoc?nt(this.chartDoc).map(e=>({id:e.id,name:e.name})):[]}getActiveFloorId(){return this.activeFloorId}setStatus(e,t){let i=!1,o=this.hasSections?new Set:null;for(let n of e){if(!this.statusById.has(n))continue;let r=this.statusById.get(n);this.statusById.set(n,t);let a=this.circleById.get(n);if(a&&(this.paintSeat(a,n),i=!0),o){let l=this.seatSection.get(n);l&&(r==="free"!=(t==="free")&&(l.free+=t==="free"?1:-1),o.add(l))}}if(o&&o.size){for(let n of o)this.refreshSectionFill(n);this.bgLayer.batchDraw()}i&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>ne&&this.updateLabels())}setSeatCategories(e){let t=!1,i=new Set;for(let[n,r]of Object.entries(e)){let a=this.seatById.get(n);if(!a||!this.catColor.has(r)||a.categoryKey===r)continue;a.categoryKey=r;let l=this.circleById.get(n);l&&(this.paintSeat(l,n),t=!0);let c=this.seatSection.get(n);c&&i.add(c)}if(!t)return;let o=new Map((this.chartDoc?nt(this.chartDoc):[]).flatMap(n=>n.objects).filter(n=>n.type==="section").map(n=>[n.id,n]));for(let n of i){if(!o.get(n.id)?.color){let a=new Map;for(let l of n.memberIds){let c=this.seatById.get(l)?.categoryKey;c&&a.set(c,(a.get(c)??0)+1)}n.baseFill=Vt([...a].map(([l,c])=>({hex:this.catColor.get(l)??"#6e7bff",w:c})),"#3a4358")}this.refreshSectionFill(n)}i.size&&this.bgLayer.batchDraw(),this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>ne&&this.updateLabels()}setOwnedHold(e){let t=new Set((e??[]).filter(o=>this.statusById.has(o))),i=new Set([...this.ownedHold,...t]);this.ownedHold=t;for(let o of i){let n=this.circleById.get(o);n&&this.paintSeat(n,o),this.syncSelectionMarker(o)}i.size&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>ne&&this.updateLabels(),this.overlayLayer.batchDraw())}setSelectionFocus(e){let t=e&&this.selection.has(e)?e:null;if(t===this.selectionFocusId)return;let i=this.selectionFocusId;this.selectionFocusId=t;for(let o of this.seats){let n=this.circleById.get(o.id);n&&this.paintSeat(n,o.id)}i&&this.syncSelectionMarker(i),t&&this.syncSelectionMarker(t);for(let[o,n]of this.selectionMarkers)n.opacity(!t||o===t?1:.2);this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}getStatus(e){return this.statusById.get(e)??"free"}getSelection(){let e=[];for(let t of this.selection){let i=this.seatById.get(t);i&&e.push(i)}return e}clearSelection(){let e=[...this.selection];for(let t of e)this.setSelected(t,!1,!0);this.overlayLayer.batchDraw()}setMaxSelection(e){this.opts.maxSelection=Math.max(0,Math.floor(e))}select(e){let t=[];for(let i of e){if(this.selection.has(i)||!this.isSelectable(i))continue;if(this.selection.size>=this.opts.maxSelection){this.opts.onSelectionLimit?.(this.opts.maxSelection);break}this.setSelected(i,!0,!0);let o=this.seatById.get(i);o&&t.push(o)}return t.length&&this.overlayLayer.batchDraw(),t}setManageInteraction(e){this.marquee&&this.cancelMarquee(),this.gestures.resetPan(),this.opts.manageMode=e.manageMode,this.opts.marqueeSelect=e.marqueeSelect,this.opts.selectableStatuses=[...e.selectableStatuses],e.maxSelection!=null&&(this.opts.maxSelection=e.maxSelection);let t=[...this.selection].filter(i=>!this.isSelectable(i));t.length&&this.deselect(t),!e.manageMode&&this.selection.size&&this.clearSelection(),this.container.style.cursor="default",this.overlayLayer.batchDraw()}setSectionHeat(e){this.sectionHeat.clear();for(let[t,i]of Object.entries(e??{}))Number.isFinite(i)&&this.sectionHeat.set(t,Math.max(0,Math.min(1,i)));for(let t of this.sections)this.refreshSectionHeat(t);this.bgLayer.batchDraw()}deselect(e){let t=!1;for(let i of e)this.selection.has(i)&&(this.setSelected(i,!1,!0),t=!0);t&&this.overlayLayer.batchDraw()}selectAllSelectable(){if(!this.opts.manageMode)return[];let e=[];for(let t of this.seats)this.isSelectable(t.id)&&e.push(t.id);return this.selectMany(e)}selectByLabels(e){if(!this.opts.manageMode)return[];let t=new Set(e),i=[];for(let o of this.seats)t.has(o.label)&&this.isSelectable(o.id)&&i.push(o.id);return this.selectMany(i)}setEvidenceSelection(e){return!this.seatById.has(e)||!this.isSelectable(e)?!1:(this.selection.size&&this.clearSelection(),this.setSelected(e,!0),this.overlayLayer.batchDraw(),this.selection.has(e))}getSelectableInSection(e){let t=[],i=new Set;for(let o of this.sections)if(!(o.id!==e&&o.logicalId!==e&&o.zone!==e))for(let n of o.memberIds){if(i.has(n)||(i.add(n),!this.isSelectable(n)))continue;let r=this.seatById.get(n);r&&t.push(r)}return t}selectMany(e){let t=e.filter(o=>!this.selection.has(o));if(!t.length)return this.getSelection();let i=this.selection.size+t.length<=ss;for(let o of t)if(i)this.setSelected(o,!0,!0);else{this.selection.add(o);let n=this.circleById.get(o);n&&this.paintSeat(n,o)}return this.cached||this.seatLayer.batchDraw(),this.overlayLayer.batchDraw(),this.getSelection()}beginMarquee(e){let t=this.screenToWorld(e),i=this.stage.scaleX()||1,o=new De({x:t.x,y:t.y,width:0,height:0,stroke:this.effSelection,strokeWidth:1.5/i,dash:[5/i,4/i],fill:"rgba(110,123,255,0.10)",listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.overlayLayer.add(o),this.marquee={start:t,rect:o},this.marqueeCur=t,this.overlayLayer.batchDraw()}updateMarquee(e){if(!this.marquee)return;let t=this.screenToWorld(e),{start:i,rect:o}=this.marquee;o.setAttrs({x:Math.min(i.x,t.x),y:Math.min(i.y,t.y),width:Math.abs(t.x-i.x),height:Math.abs(t.y-i.y)}),this.marqueeCur=t,this.overlayLayer.batchDraw()}cancelMarquee(){this.marquee&&(this.marquee.rect.destroy(),this.marquee=null,this.marqueeCur=null,this.overlayLayer.batchDraw())}finishMarquee(){let e=this.marquee;if(this.marquee=null,!e)return;e.rect.destroy(),this.overlayLayer.batchDraw();let t=this.marqueeCur??e.start;this.marqueeCur=null;let i=Math.min(e.start.x,t.x),o=Math.max(e.start.x,t.x),n=Math.min(e.start.y,t.y),r=Math.max(e.start.y,t.y),a=this.stage.scaleX()||1;if((o-i)*a<4&&(r-n)*a<4){this.selection.size&&(this.clearSelection(),this.opts.onMarquee?.([]));return}let l=[];for(let c of this.seats){let h=this.renderedSeatPoint(c);h.x<i||h.x>o||h.y<n||h.y>r||this.isSelectable(c.id)&&l.push(c.id)}this.selectMany(l),this.opts.onMarquee?.(this.getSelection())}flashSeat(e,t="#f43f5e"){let i=this.seatById.get(e);if(!i)return;let o=this.renderedSeatPoint(i),n=new me({x:o.x,y:o.y,radius:this.seatR,stroke:t,strokeWidth:3,opacity:.9,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),r=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e)??1:1;n.scale({x:r,y:r}),this.overlayLayer.add(n);let a=performance.now(),l=620,c=h=>{if(!n.getLayer())return;let u=Math.min(1,(h-a)/l);n.radius(this.seatR*(1+u*1.8)),n.opacity(.9*(1-u)),this.overlayLayer.batchDraw(),u<1?requestAnimationFrame(c):(n.destroy(),this.overlayLayer.batchDraw())};requestAnimationFrame(c)}flashSection(e,t="#22a06b"){let i=this.sections.filter(o=>o.id===e||o.zone===e);if(i.length)for(let o of i){let n=this.viewMode==="perspective"&&o.perspectiveAffine?o.outline.map(d=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,d))):o.outline.map(d=>{let m=o.liftWorld>0?this.isoLiftLocal(o.liftWorld):{x:0,y:0};return{x:d.x+m.x,y:d.y+m.y}}),r=n.reduce((d,m)=>({x:d.x+m.x,y:d.y+m.y}),{x:0,y:0});r.x/=n.length,r.y/=n.length;let a=new Je({x:r.x,y:r.y,points:n.flatMap(d=>[d.x-r.x,d.y-r.y]),closed:!0,stroke:t,strokeWidth:3,strokeScaleEnabled:!1,opacity:.92,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!0,shadowColor:t,shadowBlur:14,shadowOpacity:.7});this.overlayLayer.add(a),this.overlayLayer.batchDraw();let l=()=>{a.getLayer()&&(a.destroy(),this.overlayLayer.batchDraw())};if(this.reducedMotion||typeof document<"u"&&document.hidden){setTimeout(l,520);continue}let c=performance.now(),h=820,u=d=>{if(this.destroyed||!a.getLayer())return;let m=Math.min(1,(d-c)/h),p=1+(1-Math.pow(1-m,3))*.04;a.scale({x:p,y:p}),a.opacity(.92*(1-m)),this.overlayLayer.batchDraw(),m<1?requestAnimationFrame(u):l()};requestAnimationFrame(u)}}nearestSeat(e,t){let i=this.seatById.get(e);if(!i)return null;let o=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(i.id)??i:i,n=null,r=1/0;for(let a of this.seats){if(a.id===e)continue;let l=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(a.id)??a:a,c=l.x-o.x,h=l.y-o.y,u=c*t.x+h*t.y;if(u<=.5)continue;let d=Math.abs(c*t.y-h*t.x),m=u+d*2.5;m<r&&(r=m,n=a.id)}return n}focusSeat(e){let t=this.seatById.get(e);if(!t)return;this.focusedId=e,this.focusRing.radius(this.seatR+3),this.focusRing.position(this.renderedSeatPoint(t));let i=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e)??1:1;this.focusRing.scale({x:i,y:i}),this.focusRing.visible(!0),this.ensureVisible(t),this.overlayLayer.batchDraw(),this.opts.onFocusSeat?.(t)}ensureVisible(e){let t=this.stage.width(),i=this.stage.height(),o=Math.max(this.stage.scaleX(),Se*1.2),n=this.worldToScreen(e),r=70,a=n.x<r||n.x>t-r||n.y<r||n.y>i-r;if(this.stage.scaleX()<o||a){let l=this.renderedSeatPoint(e),c=this.viewMode==="perspective"&&this.perspectiveBaseAffine?J(this.perspectiveBaseAffine,l):this.isoT===0?l:this.isoForward(l);this.stage.scale({x:o,y:o}),this.stage.position({x:t/2-c.x*o,y:i/2-c.y*o}),this.afterViewChange(),this.stage.batchDraw()}}zoomToFit(){let e=this.stage.width(),t=this.stage.height(),i=this.viewMode==="perspective"&&this.perspectiveBounds?this.perspectiveBounds:this.bounds;if(this.fitScale=Math.min(e/i.width,t/i.height)||1,this.opts.portraitFitCrop&&!this.exportMode){let n=e/i.width<=t/i.height,r=i.height*this.fitScale;n&&r<.55*t&&(this.fitScale=Math.min(this.fitScale*1.3,.62*t/i.height))}let o=this.fitScale;this.stage.scale({x:o,y:o}),this.stage.position({x:(e-i.width*o)/2-i.x*o,y:(t-i.height*o)/2-i.y*o}),this.afterViewChange(),this.stage.batchDraw()}refitCurrentView(){if(this.focusedSectionId&&this.sectionBounds(this.focusedSectionId)){this.focusRegion(this.focusedSectionId,{animate:!1});return}this.zoomToFit()}zoomIn(){let e={x:this.stage.width()/2,y:this.stage.height()/2};this.zoomAbout(this.stage.scaleX()*et.ZOOM_STEP,e)}zoomOut(){let e={x:this.stage.width()/2,y:this.stage.height()/2};this.zoomAbout(this.stage.scaleX()/et.ZOOM_STEP,e)}seatCount(){return this.seats.length}bookableCount(){let e=this.seats.length;for(let t of this.gaById.values())e+=t.capacity;return e}worldToScreen(e){let t=this.stage.scaleX(),i=e.id,o=typeof i=="string"?this.seatById.get(i):void 0;if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let a=o?this.perspectiveSeatProjected.get(o.id)??J(this.perspectiveBaseAffine,e):J(this.perspectiveBaseAffine,e);return{x:a.x*t+this.stage.x(),y:a.y*t+this.stage.y()}}let n=o?this.renderedSeatPoint(o):e,r=this.isoT===0?n:this.isoForward(n);return{x:r.x*t+this.stage.x(),y:r.y*t+this.stage.y()}}setAccessibleFilter(e){this.setAccessibilityFilter(e?[]:null)}setAccessibilityFilter(e){let t=e===null?null:[...e];if(!this.sameAccessFilter(t)){this.accessFilter=t,this.updateAccessGlyphs(this.effScale());for(let i of this.seats){let o=this.circleById.get(i.id);o&&this.paintSeat(o,i.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}sameAccessFilter(e){let t=this.accessFilter;return t===null||e===null?t===e:t.length===e.length&&t.every((i,o)=>i===e[o])}setCommercialLimitedFilter(e){if(this.commercialLimitedFilter!==e){this.commercialLimitedFilter=e;for(let t of this.seats){let i=this.circleById.get(t.id);i&&this.paintSeat(i,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setCategoryFilter(e){let t=e===null?null:new Set(e);if(!(t===null&&this.categoryFilter===null||t!==null&&this.categoryFilter!==null&&t.size===this.categoryFilter.size&&[...t].every(o=>this.categoryFilter.has(o)))){this.categoryFilter=t;for(let o of this.seats){let n=this.circleById.get(o.id);n&&this.paintSeat(n,o.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}gaCategoryDimmed(e){return!!(this.categoryHighlight&&e!==this.categoryHighlight||this.categoryFilter&&!this.categoryFilter.has(e))}applyGAFilterState(){this.paintGAStateForView(),this.updateFreeTextVisibility(),this.bgLayer.batchDraw()}paintGAStateForView(){for(let e of this.gaById.values()){let t=!!(this.categoryFilter&&!this.categoryFilter.has(e.categoryKey)),i=!this.exportMode&&e.sectionId!=null&&this.effScale()<ee;e.polygon.opacity(i?0:this.gaCategoryDimmed(e.categoryKey)?Me*.08:Me),e.polygon.listening(!this.exportMode&&!i&&!t)}}focusCategories(e){if(!e?.length){this.focusRegion(this.bounds,{durationMs:bt});return}let t=new Set(e),i=this.seats.filter(c=>!t.has(c.categoryKey)||this.seatInClosedSection(c.id)?!1:(this.statusById.get(c.id)??"free")==="free"||this.ownedHold.has(c.id));if(!i.length)return;let o=1/0,n=-1/0,r=1/0,a=-1/0;for(let c of i){let h=this.renderedSeatPoint(c);o=Math.min(o,h.x),n=Math.max(n,h.x),r=Math.min(r,h.y),a=Math.max(a,h.y)}let l=Math.max(24,this.seatR*3);o-=l,n+=l,r-=l,a+=l,this.focusRegion({x:o,y:r,width:Math.max(40,n-o),height:Math.max(40,a-r)},{durationMs:bt})}setViewMode(e){if(e==="perspective"){if(this.viewMode===e){this.afterViewChange();return}let a=this.viewMode==="isometric"&&this.isoT>0;this.viewMode=e,this.isoTarget=1,this.isoT=1,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),this.applyPerspective(a),this.zoomToFit();return}let t=e==="isometric"?1:0,i=this.viewMode==="perspective";if(this.viewMode=e,this.isoTarget=t,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),i){this.isoT=t,this.applyIso(),this.afterViewChange();return}if(this.reducedMotion){this.isoT=t,this.applyIso(),this.afterViewChange();return}let o=this.isoT;if(o===t){this.applyIso(),this.afterViewChange();return}let n=performance.now(),r=a=>{if(this.destroyed)return;let l=Math.min(1,(a-n)/os),c=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2;this.isoT=o+(this.isoTarget-o)*c,this.applyIso(),this.scheduleViewChange(),l<1?this.isoRaf=requestAnimationFrame(r):(this.isoT=this.isoTarget,this.isoRaf=0,this.applyIso(),this.afterViewChange())};this.isoRaf=requestAnimationFrame(r)}getViewMode(){return this.viewMode}get isoState(){return{isoT:this.isoT,centre:this.isoCentre}}isoParams(){return je(this.isoState)}effScale(){if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let e=Math.hypot(this.perspectiveBaseAffine.a,this.perspectiveBaseAffine.b),t=Math.hypot(this.perspectiveBaseAffine.c,this.perspectiveBaseAffine.d);return this.stage.scaleX()*Math.min(e,t)}return this.stage.scaleX()*(1-(1-Xe)*this.isoT)}isoForward(e){return Ds(e,this.isoState)}isoInverse(e){return Os(e,this.isoState)}buildPerspectiveProjection(e){let t=Ws({seats:this.seats,objects:e.objects,bounds:this.bounds,seatR:this.seatR,floorBaseHeightMFor:i=>this.floorBaseHeightMFor(i)},{seatLocal:this.perspectiveSeatLocal,seatProjected:this.perspectiveSeatProjected,seatDepth:this.perspectiveSeatDepth,seatScale:this.perspectiveSeatScale});this.perspectiveCamera=t.camera,this.perspectiveBaseAffine=t.baseAffine,this.perspectiveBaseInverse=t.baseInverse,this.perspectiveBounds=t.bounds}setContainerAffine(e,t,i){Gs(e,t,i)}resetContainerTransform(e){Hs(e)}sectionSurfaceHeight(e,t){return Vs(e,t)}projectedSectionPoint(e,t){return Ns(e,t,this.perspectiveBaseAffine)}perspectiveLocalPoint(e){return zs(e,this.perspectiveBaseInverse)}isoLiftLocal(e){return _s(e,this.isoState)}resetLayerTransforms(e=!0){let t=e?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let i of t)i.position({x:0,y:0}),i.offset({x:0,y:0}),i.scale({x:1,y:1}),i.rotation(0),i.skewX(0),i.skewY(0)}resetSectionProjection(e=!0){for(let t of this.sections){this.resetContainerTransform(t.rootGroupBg),this.resetContainerTransform(t.liftGroupBg),e&&this.resetContainerTransform(t.liftGroupSeat),t.rootGroupBg.zIndex(t.bgZIndex),e&&t.liftGroupSeat.zIndex(t.seatZIndex);let i=this.labelLiftGroups.get(t.id);i&&e&&this.resetContainerTransform(i),t.perspectiveAffine=void 0,t.perspectiveCorrection=void 0,t.perspectiveDepth=void 0}}get seatAnchorContext(){return{seats:this.seats,seatById:this.seatById,seatR:this.seatR,perspectiveSeatProjected:this.perspectiveSeatProjected,perspectiveSeatScale:this.perspectiveSeatScale,perspectiveAppliedSeats:this.perspectiveAppliedSeats,circleById:this.circleById,accessRingById:this.accessRingById,accessGlyphById:this.accessGlyphById,boothLabelById:this.boothLabelById}}applyExactSeatAnchors(e,t){Ks(this.seatAnchorContext,e,t)}applyPerspective(e=!0){let t=this.perspectiveCamera,i=this.perspectiveBaseAffine,o=this.perspectiveBaseInverse;if(!t||!i||!o)return;let n=this.seats.length>2500&&this.sections.length>0;this.cached&&!n&&(this.seatLayer.clearCache(),this.seatLayer.listening(!0),this.cached=!1),this.resetLayerTransforms(e),this.resetSectionProjection(e);for(let a of[this.bgLayer,this.overlayLayer])this.setContainerAffine(a,i,t.target);this.perspectiveAppliedSeats.clear(),n||this.applyExactSeatAnchors(!0);for(let a of this.sections){let l=u=>this.sectionSurfaceHeight(a,u),c=dt(t,a.centroid,l),h=Ei(o,c);a.perspectiveAffine=c,a.perspectiveCorrection=h,a.perspectiveDepth=pe(t,a.centroid,l(a.centroid)).depth,this.setContainerAffine(a.liftGroupBg,h,a.centroid);for(let u=0;u<a.sideFaces.length;u++){let d=a.outline[u],m=a.outline[(u+1)%a.outline.length],y=this.perspectiveLocalPoint(pe(t,d,0)),p=this.perspectiveLocalPoint(pe(t,m,0)),f=this.perspectiveLocalPoint(pe(t,m,l(m))),b=this.perspectiveLocalPoint(pe(t,d,l(d)));a.sideFaces[u].points([y.x,y.y,p.x,p.y,f.x,f.y,b.x,b.y]),a.sideFaces[u].opacity(.9)}}let r=[...this.sections].sort((a,l)=>(l.perspectiveDepth??0)-(a.perspectiveDepth??0));for(let a of r)a.rootGroupBg.moveToTop(),a.liftGroupSeat.moveToTop();this.unsectionedSeatGroup?.moveToTop(),this.syncSeatOverlayPositions(),n||this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyIso(){if(this.resetSectionProjection(),this.applyExactSeatAnchors(!1),this.isoT===0)this.resetLayerTransforms();else{let{th:t,sg:i}=this.isoParams(),o=Math.cos(t),n=i*Math.sin(t),r=-Math.sin(t),a=i*Math.cos(t),l=Math.sqrt(o*o+n*n),c=o*a-n*r,h=Math.atan2(n,o)*180/Math.PI,u=l,d=c/l,m=(o*r+n*a)/c,y=this.isoCentre;for(let p of[this.bgLayer,this.seatLayer,this.overlayLayer])p.position({x:y.x,y:y.y}),p.offset({x:y.x,y:y.y}),p.rotation(h),p.scaleX(u),p.scaleY(d),p.skewX(m),p.skewY(0)}this.applyUprightLabels(),this.applyElevation(),this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyUprightLabels(){let e=gt*this.isoT,t=1/(1-(1-Xe)*this.isoT),i=this.hasBoothText?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let o of i){let n=o.find("Text");for(let r of n){let a=r.getAttr("uprightBase");a==null&&(a=r.rotation(),r.setAttr("uprightBase",a)),r.rotation(a-e),r.scaleX(1),r.scaleY(t),r.skewX(0)}}}applyElevation(){let e=this.isoT;for(let t of this.sections){if(t.liftWorld<=0)continue;let i=this.isoLiftLocal(t.liftWorld);t.liftGroupBg?.position(i),t.liftGroupSeat.position(i),this.labelLiftGroups.get(t.id)?.position(i);let o=.9*e;for(let n=0;n<t.sideFaces.length;n++){let r=t.sideFaces[n],a=t.outline[n],l=t.outline[(n+1)%t.outline.length];r.points([a.x,a.y,l.x,l.y,l.x+i.x,l.y+i.y,a.x+i.x,a.y+i.y]),r.opacity(o)}}this.syncSeatOverlayPositions()}destroy(){this.destroyed=!0,this.cancelAssetLoads(),this.rafId&&cancelAnimationFrame(this.rafId),this.isoRaf&&cancelAnimationFrame(this.isoRaf),this.glideRaf&&cancelAnimationFrame(this.glideRaf),this.viewChangeRaf&&cancelAnimationFrame(this.viewChangeRaf),this.recacheTimer&&clearTimeout(this.recacheTimer),this.resizeObs?.disconnect(),this.gestures.detach(),this.container.removeEventListener("keydown",this.onKeyDown),this.stage.destroy()}labelFont(){return this.exportMode?this.theme.fontFamily?.toLowerCase().includes("jetbrains")?"JetBrains Mono, monospace":"Inter, sans-serif":this.theme.fontFamily||"Inter, sans-serif"}seatContainer(e){return this.seatSection.get(e)?.liftGroupSeat??this.unsectionedSeatGroup??this.seatLayer}sectionMatchesFocus(e){let t=this.focusedSectionId;return t==null||e.id===t||e.logicalId===t||e.zone===t}focusedSeatOpacity(e,t){if(!this.focusedSectionId)return t;let i=this.seatSection.get(e);return t*(i&&this.sectionMatchesFocus(i)?1:qe)}sectionScreenBounds(e){if(this.viewMode==="perspective"&&e.perspectiveAffine){let r=this.stage.scaleX(),a=this.stage.x(),l=this.stage.y();return z(e.outline.map(c=>{let h=this.projectedSectionPoint(e,c);return{x:h.x*r+a,y:h.y*r+l}}))}let t=e.liftWorld>0?this.isoLiftLocal(e.liftWorld):{x:0,y:0},i=this.stage.scaleX(),o=this.stage.x(),n=this.stage.y();return z(e.outline.map(r=>{let a={x:r.x+t.x,y:r.y+t.y},l=this.isoT===0?a:this.isoForward(a);return{x:l.x*i+o,y:l.y*i+n}}))}updateSeatGroupVisibility(){let e=this.exportMode||this.effScale()>=ee,t=this.viewMode==="perspective"&&this.glideInProgress&&this.seats.length>2500,i=96,o=this.stage.width(),n=this.stage.height();for(let r of this.sections){let a=!0;if(e){let c=this.sectionScreenBounds(r);a=c.x+c.width>=-i&&c.y+c.height>=-i&&c.x<=o+i&&c.y<=n+i,a&&this.viewMode==="perspective"&&!t&&this.applyExactSeatAnchors(!0,r.memberIds)}r.liftGroupSeat.setViewportCulled(!a),this.labelLiftGroups.get(r.id)?.setViewportCulled(!a)}this.unsectionedSeatGroup&&!this.unsectionedSeatGroup.visible()&&this.unsectionedSeatGroup.visible(!0),e&&this.viewMode==="perspective"&&!t&&this.applyExactSeatAnchors(!0,this.seats.filter(r=>!this.seatSection.has(r.id)).map(r=>r.id))}visibleSeatCandidates(){if(!this.sections.length)return this.seats;let e=[];for(let t of this.sections)if(!t.liftGroupSeat.isViewportCulled())for(let i of t.memberIds){let o=this.seatById.get(i);o&&e.push(o)}for(let t of this.seats)this.seatSection.has(t.id)||e.push(t);return e}seatViewportCulled(e){return this.seatSection.get(e)?.liftGroupSeat.isViewportCulled()??!1}renderedSeatPoint(e){if(this.viewMode==="perspective")return this.perspectiveSeatLocal.get(e.id)??e;let t=this.seatSection.get(e.id);if(!t||t.liftWorld<=0||this.isoT===0)return e;let i=this.isoLiftLocal(t.liftWorld);return{x:e.x+i.x,y:e.y+i.y}}seatLabelContainer(e){let t=this.seatSection.get(e);if(!t)return this.labelGroup;let i=this.labelLiftGroups.get(t.id);return i||(i=new Ye({listening:!1}),i.setViewportCulled(t.liftGroupSeat.isViewportCulled()),i.position(this.viewMode==="perspective"?{x:0,y:0}:this.isoLiftLocal(t.liftWorld)),this.labelGroup.add(i),this.labelLiftGroups.set(t.id,i)),i}syncSeatOverlayPositions(){if(this.hoveredId){let e=this.seatById.get(this.hoveredId);if(e){this.hoverRing.position(this.renderedSeatPoint(e));let t=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.hoverRing.scale({x:t,y:t})}}if(this.focusedId){let e=this.seatById.get(this.focusedId);if(e){this.focusRing.position(this.renderedSeatPoint(e));let t=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.focusRing.scale({x:t,y:t})}}for(let[e,t]of this.selectionMarkers){let i=this.seatById.get(e);if(i){t.position(this.renderedSeatPoint(i));let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(i.id)??1:1;t.scale({x:o,y:o})}}}renderSeats(){let e=[...this.seats].sort((t,i)=>(this.perspectiveSeatDepth.get(i.id)??0)-(this.perspectiveSeatDepth.get(t.id)??0));for(let t of e){if(t.kind==="booth"){this.renderBoothUnit(t);continue}let i=this.seatContainer(t.id),o=t.wheelchairSpaceType==="no-seat"?new De({x:t.x,y:t.y,width:this.seatR*2,height:this.seatR*2,offsetX:this.seatR,offsetY:this.seatR,cornerRadius:2,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}):new me({x:t.x,y:t.y,radius:this.seatR,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0});if(o.setAttr("seatId",t.id),this.circleById.set(t.id,o),this.paintSeat(o,t.id),i.add(o),t.accessible){if(t.wheelchairSpaceType!=="no-seat"){let n=new me({x:t.x,y:t.y,radius:this.seatR+1.5,stroke:Ot(t.accessibility),strokeWidth:2.5,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.accessRingById.set(t.id,n),i.add(n)}if(t.accessibility?.includes("wheelchair")&&Nt(t.accessibility)){let n=this.buildAccessGlyph(t,typeof o.fill()=="string"?o.fill():"");this.accessGlyphById.set(t.id,n),i.add(n)}}}}renderBoothUnit(e){let t=this.seatContainer(e.id),i=this.boothDims.get(e.rowId)??{width:40,height:30,rotation:0},o=e.x,n=e.y,r;i.points&&i.points.length>=3?(r=new Je({x:e.x,y:e.y,points:i.points.flatMap(l=>[l.x,l.y]),closed:!0,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),o=e.x+i.points.reduce((l,c)=>l+c.x,0)/i.points.length,n=e.y+i.points.reduce((l,c)=>l+c.y,0)/i.points.length):r=new De({x:e.x,y:e.y,width:i.width,height:i.height,offsetX:i.width/2,offsetY:i.height/2,rotation:i.rotation,cornerRadius:4,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),r.setAttr("seatId",e.id),this.circleById.set(e.id,r),t.add(r);let a=new ke({x:o,y:n,text:e.displayLabel??e.label,fontSize:Ce,fontStyle:"600",fontFamily:this.labelFont(),fill:this.theme.seatLabelColor??Ct,listening:!1,perfectDrawEnabled:!1});a.offsetX(a.width()/2),a.offsetY(a.height()/2),a.visible(!1),this.hasBoothText=!0,this.boothLabelById.set(e.id,a),t.add(a),this.paintSeat(r,e.id)}buildAccessGlyph(e,t){let i=this.seatR*1.5/ie;return new zo({x:e.x,y:e.y,data:Nt(e.accessibility??[])??"",offsetX:ie/2,offsetY:ie/2,scaleX:i,scaleY:i,fill:zt(t),listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})}updateAccessGlyphs(e){if(this.accessGlyphById.size)for(let[t,i]of this.accessGlyphById){let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1,n=this.seatR*1.5/ie*o,a=this.accessGlyphFilterEmphasized(t)?Ji:ji,l=Math.max(n,a/(ie*Math.max(e,.001)));i.scale({x:l,y:l}),i.visible(this.accessGlyphShouldShow(t))}}accessGlyphFilterEmphasized(e){let t=this.seatById.get(e),i=this.accessFilter;return!!t&&i!==null&&!!t.accessibility?.includes("wheelchair")&&(i.length===0||i.includes("wheelchair"))&&Ut(t,i)}accessGlyphShouldShow(e){return this.accessGlyphById.has(e)&&this.accessGlyphEligible(e)}accessGlyphEligible(e){let t=this.statusById.get(e)??"free";return!(t==="booked"||t==="held"&&!this.ownedHold.has(e)&&!this.opts.manageMode)}seatBaseColor(e){return this.colorblind?this.cbHueByKey.get(e)??kt[0]:this.catColor.get(e)??"#6e7bff"}seatLabelScale(e){return(e.labelStyle?.size??18)/18}seatPreferredLabelInk(e){return e.labelStyle?.color??this.theme.seatLabelColor??Ct}seatLabelInk(e,t){let i=t.fill();return Y(typeof i=="string"?i:"",this.seatPreferredLabelInk(e),ct)}paintSeat(e,t){let i=this.seatById.get(t),o=this.statusById.get(t)??"free",n=this.selection.has(t),r=this.seatBaseColor(i.categoryKey),a=this.boothLabelById.get(t);switch(e.dash([]),e.strokeWidth(0),e.stroke(""),e.opacity(1),o){case"free":e.fill(n&&this.effSelection===Ue?ue(r,.28):r);break;case"held":this.ownedHold.has(t)?(e.fill(ue(r,this.effSelection===Ue?.24:.1)),e.stroke(this.effSelection),e.strokeWidth(3)):e.fill(hs);break;case"booked":this.colorblind?(e.fill("rgba(0,0,0,0)"),e.stroke(wt),e.strokeWidth(1.5),e.opacity(.9)):(e.fill(wt),e.opacity(.45));break;case"not_for_sale":e.fill(wt),e.stroke(ds),e.strokeWidth(1),e.dash([2,2]);break}if(i.wheelchairSpaceType==="no-seat"&&o==="free"&&(e.stroke(Ot(i.accessibility)),e.strokeWidth(n?3:2),e.dash([3,2])),a&&(a.text(o==="booked"?"SOLD":o==="held"?"HELD":i.label),a.fontSize(o==="free"?10:Math.min(10,Math.max(6,this.boothDims.get(i.rowId)?.width??40)/6)),a.fontStyle(o==="free"?"600":"800"),a.fill(o==="free"?this.theme.seatLabelColor??Ct:"#ffffff"),a.offsetX(a.width()/2),a.offsetY(a.height()/2)),this.accessFilter&&o==="free"&&!n&&!Ut(i,this.accessFilter)&&e.opacity(.25),this.categoryHighlight&&o==="free"&&!n&&i.categoryKey!==this.categoryHighlight&&e.opacity(.25),this.categoryFilter&&o==="free"&&!n&&!this.categoryFilter.has(i.categoryKey)&&e.opacity(.22),this.commercialLimitedFilter&&o==="free"&&!n&&(i.commercial?.restrictedView||i.commercial?.obstructedView)&&e.opacity(.22),this.dimmedSections.size){let h=this.seatSection.get(t);(!h&&this.dimmedSections.has(ki)||h&&(this.dimmedSections.has(h.id)||this.dimmedSections.has(h.logicalId)||h.zone!=null&&this.dimmedSections.has(h.zone)))&&e.opacity(.18)}this.closedSections.size&&this.seatInClosedSection(t)&&(e.fill(ps),e.stroke(""),e.strokeWidth(0),e.dash([]),e.opacity(us)),this.selectionFocusId&&t!==this.selectionFocusId&&e.opacity(Math.min(e.opacity(),.16));let l=this.boothLabelById.get(t)??this.seatLabelById.get(t);l&&(l.fill(this.seatLabelInk(i,e)),l.visible(fe(l.fontSize(),this.effScale())&&e.opacity()>=.5));let c=this.accessGlyphById.get(t);if(c){let h=e.fill();c.fill(zt(typeof h=="string"?h:"")),c.opacity(e.opacity()),c.visible(this.accessGlyphShouldShow(t))}this.accessRingById.get(t)?.opacity(e.opacity())}seatInClosedSection(e){if(!this.closedSections.size)return!1;let t=this.seatSection.get(e);return!!t&&(this.closedSections.has(t.id)||this.closedSections.has(t.logicalId)||t.zone!=null&&this.closedSections.has(t.zone))}setColorblindSafe(e){if(e!==this.colorblind){this.colorblind=e;for(let t of this.seats){let i=this.circleById.get(t.id);i&&this.paintSeat(i,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setDimmedSections(e){let t=new Set(e??[]);if(!(t.size===this.dimmedSections.size&&[...t].every(i=>this.dimmedSections.has(i)))){this.dimmedSections=t;for(let i of this.seats){let o=this.circleById.get(i.id);o&&this.paintSeat(o,i.id)}this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setClosedSections(e){let t=new Set(e??[]);t.size===this.closedSections.size&&[...t].every(i=>this.closedSections.has(i))||(this.closedSections=t,this.repaintSectionsAndSeats())}focusSection(e){this.sections.some(t=>t.id===e||t.logicalId===e)&&(this.focusedSectionId=e,this.drawFocusBackdrop(e),this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD(),this.focusRegion(e))}releaseSectionFocusDim(){!this.focusBackdrop&&!this.focusDimOverlay||(this.focusBackdrop?.destroy(),this.focusBackdrop=null,this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.bgLayer.batchDraw(),this.overlayLayer.batchDraw())}clearSectionFocus(){this.focusedSectionId&&(this.focusedSectionId=null,this.focusBackdrop&&(this.focusBackdrop.destroy(),this.focusBackdrop=null),this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD())}getFocusedSection(){return this.focusedSectionId}drawFocusBackdrop(e){this.focusBackdrop&&(this.focusBackdrop.destroy(),this.focusBackdrop=null);let t=this.sections.filter(o=>o.id===e||o.logicalId===e);if(!t.length)return;let i=new we({listening:!1});for(let o of t){let n=this.viewMode==="perspective"&&o.perspectiveAffine,r=n?o.outline.map(l=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,l))):o.outline,a=n?o.holes.map(l=>l.map(c=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,c)))):o.holes;i.add(Fe(r,a,{fill:fs,stroke:te("#ffffff",.1),strokeWidth:1,listening:!1},n?void 0:o.outlinePath))}this.bgLayer.add(i),i.moveToTop(),this.focusBackdrop=i,this.drawFocusDimOverlay(t)}drawFocusDimOverlay(e){this.focusDimOverlay?.destroy();let i=Math.max(this.bounds.width,this.bounds.height,1)*4+1e3,o=[{x:this.bounds.x-i,y:this.bounds.y-i},{x:this.bounds.x+this.bounds.width+i,y:this.bounds.y-i},{x:this.bounds.x+this.bounds.width+i,y:this.bounds.y+this.bounds.height+i},{x:this.bounds.x-i,y:this.bounds.y+this.bounds.height+i}],n=new Ko({fill:this.canvasBackground,opacity:1-qe,listening:!1,perfectDrawEnabled:!1,sceneFunc:(r,a)=>{let l=c=>{if(c.length){r.moveTo(c[0].x,c[0].y);for(let h=1;h<c.length;h++)r.lineTo(c[h].x,c[h].y);r.closePath()}};r.beginPath(),l(o);for(let c of e){let h=this.viewMode==="perspective"&&c.perspectiveAffine?c.outline.map(u=>this.perspectiveLocalPoint(this.projectedSectionPoint(c,u))):c.outline.map(u=>{let d=c.liftWorld>0?this.isoLiftLocal(c.liftWorld):{x:0,y:0};return{x:u.x+d.x,y:u.y+d.y}});l(Ne(h)>0?[...h].reverse():h)}r.fillStrokeShape(a)}});this.overlayLayer.add(n),n.moveToTop();for(let r of this.selectionMarkers.values())r.moveToTop();this.hoverRing.moveToTop(),this.focusRing.moveToTop(),this.focusDimOverlay=n}repaintSectionsAndSeats(){for(let e of this.seats){let t=this.circleById.get(e.id);t&&this.paintSeat(t,e.id)}for(let e of this.sections)e.blockPoly.fill(this.sectionBlockFill(e));this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.bgLayer.batchDraw()}getVisibleWorldRect(){let e=this.screenToWorld({x:0,y:0}),t=this.screenToWorld({x:this.stage.width(),y:this.stage.height()});return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}getWorldBounds(){let e=1/0,t=1/0,i=-1/0,o=-1/0,n=(r,a)=>{r<e&&(e=r),a<t&&(t=a),r>i&&(i=r),a>o&&(o=a)};for(let r of this.seats)n(r.x,r.y);for(let r of this.sections)for(let a of r.outline)n(a.x,a.y);for(let r of this.gaById.values())for(let a of r.points)n(a.x,a.y);return Number.isFinite(e)?{x:e,y:t,width:Math.max(1,i-e),height:Math.max(1,o-t)}:{x:0,y:0,width:1,height:1}}getMinimapSnapshot(){let e=this.sections.map(t=>{let i=this.isSectionClosed(t)||t.free<=0,o=t.memberIds.some(r=>this.selection.has(r)),n=this.focusedSectionId===t.id||this.focusedSectionId===t.logicalId;return{id:t.logicalId,label:t.label,outline:t.outline.map(r=>({...r})),...this.objectFloor.get(t.id)?{floorId:this.objectFloor.get(t.id)}:{},state:o?"selected":i?"inactive":"available",active:n}});return{sections:e,seats:e.length?[]:this.seats.map(t=>({x:t.x,y:t.y,categoryKey:t.categoryKey,state:this.selection.has(t.id)?"selected":this.statusById.get(t.id)==="free"?"available":"inactive"}))}}panToWorld(e){this.cancelGlide();let t=this.worldToScreen(e);this.stage.position({x:this.stage.x()+this.stage.width()/2-t.x,y:this.stage.y()+this.stage.height()/2-t.y}),this.afterViewChange(),this.stage.batchDraw()}setCategoryHighlight(e){if(this.categoryHighlight!==e){this.categoryHighlight=e;for(let t of this.seats){let i=this.circleById.get(t.id);i&&this.paintSeat(i,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}renderBackground(e){let t=Pe(e);t&&this.renderBackgroundImage(t);for(let i of e.objects)i.type==="decorImage"&&this.renderDecorImage(i);for(let i of e.objects)i.type==="section"&&this.renderSection(i);this.renderZones(e);for(let i of e.objects)i.type==="shape"?this.renderShape(i):i.type==="gaArea"?this.renderGA(i):i.type==="table"?this.renderTable(i):i.type==="text"&&this.renderText(i)}trackAssetImage(e,t,i,o){let n=this.assetGeneration;/^https?:\/\//i.test(t)&&(e.crossOrigin="anonymous");let r=new Promise(a=>{let l=!1,c=()=>{l||(l=!0,this.assetCancels.delete(h),a())},h=()=>{e.onload=null,e.onerror=null;try{e.removeAttribute("src"),e.src=""}catch{}c()};this.assetCancels.add(h),e.onload=()=>{if(!this.exportMode){n===this.assetGeneration&&o(),c();return}(typeof e.decode=="function"?e.decode():Promise.resolve()).then(()=>{n===this.assetGeneration&&o()}).catch(()=>{n===this.assetGeneration&&this.assetErrors.push(`${i} could not be decoded.`)}).finally(c)},e.onerror=()=>{n===this.assetGeneration&&this.assetErrors.push(`${i} could not be loaded.`),c()},e.src=t});this.assetPromises.push(r)}cancelAssetLoads(){this.assetGeneration++;for(let e of[...this.assetCancels])e();this.assetCancels.clear(),this.assetPromises=[],this.assetErrors=[]}renderBackgroundImage(e){if(!e.url||e.visible===!1)return;let t=new window.Image;this.trackAssetImage(t,e.url,"Buyer background image",()=>{let i=t.naturalWidth||4,o=t.naturalHeight||3,n=e.crop??{x:0,y:0,width:1,height:1},r=Math.max(0,Math.min(.99,n.x)),a=Math.max(0,Math.min(.99,n.y)),l={x:r,y:a,width:Math.max(.01,Math.min(1-r,n.width)),height:Math.max(.01,Math.min(1-a,n.height))},c=e.width,h=c*(o*l.height/(i*l.width)),u=new Wo({image:t,x:e.center.x,y:e.center.y,offsetX:c/2,offsetY:h/2,width:c,height:h,rotation:e.rotation??0,crop:{x:l.x*i,y:l.y*o,width:l.width*i,height:l.height*o},opacity:e.opacity,listening:!1});this.bgLayer.add(u),u.moveToBottom(),this.bgLayer.batchDraw()})}get objectDrawContext(){return{bgLayer:this.bgLayer,fgDecorGroup:this.fgDecorGroup,container:this.container,opts:this.opts,theme:this.theme,canvasBackground:this.canvasBackground,catColor:this.catColor,sections:this.sections,freeTextById:this.freeTextById,gaById:this.gaById,iconNodeById:this.iconNodeById,primaryFocalLabels:this.primaryFocalLabels,labelFont:()=>this.labelFont(),trackAssetImage:(e,t,i,o)=>this.trackAssetImage(e,t,i,o),isGhostClick:e=>this.isGhostClick(e)}}renderDecorImage(e){ks(this.objectDrawContext,e)}renderTable(e){Ls(this.objectDrawContext,e)}renderText(e){Ts(this.objectDrawContext,e)}renderShape(e){Is(this.objectDrawContext,e)}renderGA(e){Cs(this.objectDrawContext,e)}renderSection(e){let t=ot(e.outline,e.holes),i=re(this.canvasBackground),o=[],n=new Map,r=0,a=z(e.outline),l=this.seatIndex?ht(this.seatIndex,a).map(M=>this.seatById.get(M)).filter(M=>!!M):this.seats;for(let M of l)this.seatSection.has(M.id)||j(M,e.outline,e.holes)&&(o.push(M.id),n.set(M.categoryKey,(n.get(M.categoryKey)??0)+1),(this.statusById.get(M.id)??"free")==="free"&&r++);let c=e.color??Vt([...n].map(([M,R])=>({hex:this.catColor.get(M)??"#6e7bff",w:R})),"#3a4358"),h=gi(e.elevation),u=st(e,{floorBaseHeightM:this.floorBaseHeightMFor(e.id)}),d=u.height*Ie,m=new we({listening:!1});this.bgLayer.add(m);let y=new we({listening:!1});m.add(y);let p=new Ye({listening:!0});this.seatLayer.add(p);let f=[];if(d>0){let M=ce(this.zoneColor.get(e.zone??"")??c,.42);for(let R=0;R<e.outline.length;R++){let A=new Je({points:[],closed:!0,fill:M,stroke:te("#000000",.25),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});f.push(A),m.add(A)}}y.moveToTop();let b=y,g=e.color??this.zoneColor.get(e.zone??"")??"#3a4358",v=Fe(e.outline,e.holes,{stroke:te(g,.5),strokeWidth:1,fill:te(g,.08),listening:!1},e.outlinePath);b.add(v);let k=Fe(e.outline,e.holes,{fill:i.sectionFill,stroke:i.sectionStroke,strokeWidth:St,opacity:0,listening:!1},e.outlinePath);b.add(k);let L=e.labelPresentation?.labelStyle,S=L?.color??i.sectionInk,w=(L?.size??18)/18,x=new ke({x:e.labelPresentation?.position?.x??t.x,y:e.labelPresentation?.position?.y??t.y,text:e.displayLabel??e.label,rotation:e.labelPresentation?.rotation??0,visible:e.labelPresentation?.visible!==!1,fontSize:22*w,fontStyle:"700",fontFamily:this.labelFont(),fill:Y(i.sectionFill,S),listening:!1,perfectDrawEnabled:!1});x.offsetX(x.width()/2),x.offsetY(x.height()/2),b.add(x);let I=new ke({x:t.x,y:t.y,text:oe("map.seatsLeft",{count:r}),fontSize:12,fontStyle:"700",fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:i.sectionInk,opacity:0,listening:!1,perfectDrawEnabled:!1});I.offsetX(I.width()/2),b.add(I);let T={id:e.id,logicalId:e.logicalSectionId??e.id,label:e.displayLabel??e.label,outline:e.outline,...e.outlinePath?{outlinePath:e.outlinePath}:{},holes:e.holes??[],centroid:t,labelAnchors:ys(e.outline,e.holes??[],t),labelArea:yi(e.outline,e.holes),zone:e.zone,memberIds:o,total:o.length,free:r,baseFill:c,outlineTint:g,outlinePoly:v,blockPoly:k,nameLabel:x,subLabel:I,preferredInk:S,labelScale:w,nameLabelFits:!0,subLabelFits:!0,elevation:h,liftWorld:d,rakeDeg:u.rake,surfaceFocal:o.length?{...this.seatById.get(o[0])?.focalPoint??this.isoCentre}:{...this.chartDoc?.focalPoint??this.isoCentre},frontDistanceWorld:0,rootGroupBg:m,bgZIndex:m.zIndex(),seatZIndex:p.zIndex(),liftGroupBg:y,liftGroupSeat:p,sideFaces:f},P=o.map(M=>this.seatById.get(M)).filter(M=>!!M),C=P.length?P:e.outline;T.frontDistanceWorld=Math.min(...C.map(M=>Math.hypot(M.x-T.surfaceFocal.x,M.y-T.surfaceFocal.y)));for(let M of o)this.seatSection.set(M,T);this.refreshSectionFill(T),this.refreshSectionHeat(T),this.sections.push(T)}refreshSectionHeat(e){xs(this.sectionLodPaintContext,e)}refreshSectionFill(e){Rs(this.sectionLodPaintContext,e)}isSectionClosed(e){return ei(this.sectionLodPaintContext,e)}sectionAvailabilityState(e){return ti(this.sectionLodPaintContext,e)}sectionBlockFill(e){return Be(re(this.canvasBackground),this.sectionAvailabilityState(e))}get sectionLodPaintContext(){return{sections:this.sections,zones:this.zones,sectionHeat:this.sectionHeat,closedSections:this.closedSections,canvasBackground:this.canvasBackground,bgLayer:this.bgLayer,seatLayer:this.seatLayer,stageScaleX:this.stage.scaleX(),stageWidth:this.stage.width(),floorOverview:this.floorOverview,focusedSectionId:this.focusedSectionId,hasFocusDimOverlay:!!this.focusDimOverlay,viewMode:this.viewMode,glideInProgress:this.glideInProgress,reducedMotion:this.reducedMotion,isoT:this.isoT,seatCount:this.seats.length,lodScale:this.lodScale,setLodScale:e=>{this.lodScale=e},worldToScreen:e=>this.worldToScreen(e)}}renderZones(e){if(!e.zones?.length||!this.sections.length)return;let t=new Map;for(let i of this.sections)i.zone&&(t.get(i.zone)??t.set(i.zone,[]).get(i.zone)).push(i);for(let i of e.zones){let o=t.get(i.id);if(!o||!o.length)continue;let n=o[0];for(let d of o)d.centroid.y<n.centroid.y&&(n=d);let r=n.centroid.x,a=n.centroid.y,l=1/0;for(let d of o)for(let m of d.memberIds){let y=this.seatById.get(m),p=y&&this.catPrice.get(y.categoryKey);typeof p=="number"&&p<l&&(l=p)}let c=new De({x:r,y:a,width:1,height:1,offsetX:.5,offsetY:.5,cornerRadius:1,fill:Yt,stroke:i.color??n.outlineTint,strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});this.bgLayer.add(c);let h=new ke({x:r,y:a,text:i.label.toUpperCase(),fontSize:vt,fontStyle:"800",letterSpacing:.5,fontFamily:this.labelFont(),fill:"#f4f6fb",opacity:0,listening:!1,perfectDrawEnabled:!1});h.offsetX(h.width()/2),h.offsetY(h.height()/2),this.bgLayer.add(h);let u=null;isFinite(l)&&(u=new ke({x:r,y:a,text:oe("map.fromPrice",{price:$t(l,this.currency)}),fontSize:14,fontStyle:"600",fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:"#cbd5e1",opacity:0,listening:!1,perfectDrawEnabled:!1}),u.offsetX(u.width()/2),this.bgLayer.add(u)),this.zones.push({id:i.id,anchor:{x:r,y:a},back:c,background:Yt,label:h,sub:u})}}screenToWorld(e){let t=this.stage.scaleX(),i={x:(e.x-this.stage.x())/t,y:(e.y-this.stage.y())/t};return this.viewMode==="perspective"&&this.perspectiveBaseInverse?J(this.perspectiveBaseInverse,i):this.isoT===0?i:this.isoInverse(i)}sectionAt(e){if(!this.sections.length)return null;let t=this.screenToWorld(e),i=this.sections.find(o=>{if(this.viewMode==="perspective"&&o.perspectiveAffine)return j(t,o.outline.map(r=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,r))),o.holes.map(r=>r.map(a=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,a)))));let n=o.liftWorld>0?this.isoLiftLocal(o.liftWorld):{x:0,y:0};return j({x:t.x-n.x,y:t.y-n.y},o.outline,o.holes)});return i?i.logicalId:null}sectionMembers(e){return[...new Set(this.sections.filter(t=>t.id===e||t.logicalId===e||t.zone===e).flatMap(t=>t.memberIds))]}isSelectable(e){return this.seatInClosedSection(e)?!1:(this.opts.selectableStatuses??["free"]).includes(this.statusById.get(e)??"free")}toggleSeat(e){if(this.selection.has(e)){this.setSelected(e,!1);let t=this.seatById.get(e);t&&this.opts.onDeselect?.(t)}else{if(!this.isSelectable(e))return;if(this.selection.size>=this.opts.maxSelection){this.opts.onSelectionLimit?.(this.opts.maxSelection);return}this.setSelected(e,!0);let t=this.seatById.get(e);t&&this.opts.onSelect?.(t)}this.overlayLayer.batchDraw()}resolveCanvasBackground(){let e=this.theme.background?Ht(this.theme.background):null;if(e)return e;if(typeof getComputedStyle=="function"){let t=this.container;for(;t;){let i=Ht(getComputedStyle(t).backgroundColor);if(i)return i;t=t.parentElement}}return Zt}resolveSelectionColor(){return this.theme.selectionColor?this.theme.selectionColor:Ve(this.canvasBackground)?bs:Ue}setSelected(e,t,i=!1){let o=this.circleById.get(e);t?this.selection.add(e):(this.selectionFocusId===e&&this.setSelectionFocus(null),this.selection.delete(e)),this.syncSelectionMarker(e),o&&(this.paintSeat(o,e),!i&&!this.cached&&this.seatLayer.batchDraw())}syncSelectionMarker(e){if(this.selectionMarkers.get(e)?.destroy(),this.selectionMarkers.delete(e),!this.selection.has(e)&&!this.ownedHold.has(e))return;let t=this.seatById.get(e);if(!t)return;let i=this.selectionFocusId===e,o=this.boothDims.get(t.rowId),n=this.renderedSeatPoint(t),r=new we({name:"selection-ring",x:n.x,y:n.y,rotation:o?.rotation??0,listening:!1,perfectDrawEnabled:!1,opacity:this.selectionFocusId&&!i?.2:1});if(this.viewMode==="perspective"){let l=this.perspectiveSeatScale.get(e)??1;r.scale({x:l,y:l})}r.setAttr("seatId",e);let a={stroke:this.effSelection,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(o)if(r.add(new De({...a,width:o.width,height:o.height,offsetX:o.width/2,offsetY:o.height/2,cornerRadius:4,strokeWidth:i?4:3})),i)r.add(new De({...a,width:o.width+10,height:o.height+10,offsetX:(o.width+10)/2,offsetY:(o.height+10)/2,cornerRadius:7,strokeWidth:2,opacity:.55}));else{let l=Math.max(0,o.width/2-14),c=-Math.max(0,o.height/2-14);r.add(new me({x:l,y:c,radius:10,fill:this.effSelection,listening:!1})),r.add(new Je({x:l,y:c,points:[-4.5,0,-1,3.5,5.5,-4.5],stroke:Ve(this.effSelection)?"#0b1220":"#ffffff",strokeWidth:2.4,lineCap:"round",lineJoin:"round",listening:!1}))}else r.add(new me({...a,radius:Math.max(1,this.seatR-1.25),strokeWidth:Math.min(2.5,Math.max(1.8,this.seatR*.22))})),i?r.add(new me({...a,radius:this.seatR+2,strokeWidth:2,opacity:.55})):r.add(new Je({points:[-this.seatR*.52,0,-this.seatR*.12,this.seatR*.4,this.seatR*.6,-this.seatR*.46],stroke:"#ffffff",strokeWidth:Math.max(2.6,this.seatR*.34),lineCap:"round",lineJoin:"round",shadowColor:"#0b1220",shadowBlur:1.5,shadowOpacity:.55,listening:!1}));this.selectionMarkers.set(e,r),this.overlayLayer.add(r)}sectionBounds(e){let t=this.sections.filter(y=>y.id===e||y.logicalId===e),i=t.map(y=>{if(this.viewMode==="perspective"&&y.perspectiveAffine)return z(y.outline.map(b=>this.projectedSectionPoint(y,b)));let p=y.liftWorld>0?this.isoLiftLocal(y.liftWorld):{x:0,y:0},f=y.outline.map(b=>{let g={x:b.x+p.x,y:b.y+p.y};return this.isoT===0?g:this.isoForward(g)});return z(f)});if(!i.length)return null;let o=Math.min(...i.map(y=>y.x)),n=Math.min(...i.map(y=>y.y)),r=Math.max(...i.map(y=>y.x+y.width)),a=Math.max(...i.map(y=>y.y+y.height)),l=new Set(t.flatMap(y=>y.memberIds));for(let y of l){let p=this.seatById.get(y);if(!p)continue;let f=this.renderedSeatPoint(p);o=Math.min(o,f.x-this.seatR),n=Math.min(n,f.y-this.seatR),r=Math.max(r,f.x+this.seatR),a=Math.max(a,f.y+this.seatR)}let c=y=>{[y.x,y.y,y.width,y.height].every(Number.isFinite)&&(o=Math.min(o,y.x),n=Math.min(n,y.y),r=Math.max(r,y.x+y.width),a=Math.max(a,y.y+y.height))},h=y=>{let p={x:y.x+y.width/2,y:y.y+y.height/2};return t.some(f=>j(p,f.outline,f.holes))};for(let{node:y,backdrop:p}of this.freeTextById.values()){let f=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0});h(f)&&(c(f),p&&c(p.getClientRect({relativeTo:this.bgLayer,skipShadow:!0})))}for(let{node:y}of this.iconNodeById.values()){let p=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0});h(p)&&c(p)}let u=new Ae;for(let{node:y}of this.freeTextById.values()){let p=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0,skipStroke:!0});u.insert({x:p.x-U,y:p.y-U,width:p.width+U*2,height:p.height+U*2})}for(let y of this.rowLabelPlan){let p=y.focusKeys?.some(v=>v===e||t.some(k=>v===k.id||v===k.logicalId||v===k.zone))??!1,f=new ke({text:y.text,fontSize:y.fontSize,fontStyle:"700",fontFamily:this.labelFont(),rotation:y.rotation,listening:!1});f.offsetX(f.width()/2),f.offsetY(f.height()/2);let b=this.resolveAutomaticRowLabelPosition(f,y,u),g=this.rowLabelBox(f,b);p&&c(g),u.insert(g),f.destroy()}let d=Math.max(r-o,a-n),m=Math.max(this.seatR*2,Math.min(24,d*.025));return{x:o-m,y:n-m,width:Math.max(1,r-o+m*2),height:Math.max(1,a-n+m*2)}}sectionFrameScale(e){let t=this.sectionBounds(e);if(!t)return this.stage.scaleX();let i=this.stage.width(),o=this.stage.height(),{min:n,max:r}=this.zoomBounds(),a=1.12;if(t.width<=0||t.height<=0)return this.stage.scaleX();let l=Math.min(i/(t.width*a),o/(t.height*a));return N(l,n,r)}handleSeatTap(e){if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let t=this.objectFloor.get(this.seatById.get(e)?.rowId??"");if(t){this.opts.onDeckTap(t);return}}if(this.effScale()<ne&&this.sections.length){let t=this.seatSection.get(e);if(t){let i=this.focusedSectionId===t.logicalId,o=this.sectionFrameScale(t.logicalId)>this.stage.scaleX()*1.02;if(!i&&o){this.opts.onSectionTap?this.opts.onSectionTap(t.logicalId):this.focusSection(t.logicalId);return}}}this.toggleSeat(e)}nearestSeatToScreen(e,t){let i=null,o=1/0,n=this.stage.scaleX()||1;for(let r of this.seats){if(!this.selection.has(r.id)&&!this.isSelectable(r.id))continue;let a=this.worldToScreen(r),l=this.viewMode==="perspective"?this.perspectiveSeatScale.get(r.id)??1:1,c=this.seatR*n*l+t,h=Math.hypot(a.x-e.x,a.y-e.y);h<=c&&h<o&&(o=h,i=r.id)}return i}wireInteraction(){this.seatLayer.on("click tap",e=>{if(this.moved>ve||this.isGhostClick(e))return;let t=si(e.target);t&&this.handleSeatTap(t)}),this.seatLayer.on("mouseover",e=>{let t=si(e.target);if(!t)return;let i=this.seatById.get(t);if(!i)return;this.hoveredId=t,this.hoverRing.position(this.renderedSeatPoint(i));let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1;this.hoverRing.scale({x:o,y:o}),this.hoverRing.visible(!0),this.overlayLayer.batchDraw(),this.container.style.cursor="pointer",this.opts.onHover?.(i)}),this.seatLayer.on("mouseout",()=>{this.hoveredId=null,this.hoverRing.visible(!1),this.overlayLayer.batchDraw(),this.container.style.cursor="default",this.opts.onHover?.(null)}),this.stage.on("wheel",e=>{e.evt.preventDefault(),this.releaseSectionFocusDim();let t=this.container.getBoundingClientRect(),i={x:e.evt.clientX-t.left,y:e.evt.clientY-t.top},o=Math.exp(-e.evt.deltaY*.002);this.zoomAbout(this.stage.scaleX()*N(o,.5,2),i)}),this.stage.on("click tap",e=>{if(this.moved>ve||this.isGhostClick(e))return;let t=this.stage.getPointerPosition();if(!t)return;if(!this.cached){if(si(e.target))return;let o=this.nearestSeatToScreen(t,mt);o&&this.handleSeatTap(o);return}if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let o=this.floorOverview?this.sectionAt(t):null,n=(o?this.objectFloor.get(o):null)??this.deckFloorAt();if(n){this.opts.onDeckTap(n);return}}if(this.sections.length){let o=this.sectionAt(t);if(o){this.opts.onSectionTap?this.opts.onSectionTap(o):this.focusRegion(o);return}}let i=Math.max(Se*1.2,this.stage.scaleX()*2.5);this.zoomAbout(i,t)})}deckFloorAt(){if(!this.objectFloor.size)return null;let e=this.stage.getPointerPosition();if(!e)return null;let t=this.screenToWorld(e),i=null,o=1/0;for(let n of this.seats){let r=this.renderedSeatPoint(n),a=r.x-t.x,l=r.y-t.y,c=a*a+l*l;c<o&&(o=c,i=n.rowId)}return i?this.objectFloor.get(i)??null:null}zoomBounds(){let e=.5*this.fitScale;return this.zones.length&&(e=Math.min(e,Ee*.9)),{min:e,max:Math.max(10*this.fitScale,4)}}zoomAbout(e,t){let{min:i,max:o}=this.zoomBounds(),n=N(e,i,o),r=this.stage.scaleX();if(n===r)return;let a=(t.x-this.stage.x())/r,l=(t.y-this.stage.y())/r;this.stage.scale({x:n,y:n}),this.stage.position({x:t.x-a*n,y:t.y-l*n}),this.afterViewChange(),this.stage.batchDraw()}zoomToBounds(e,t){let i=this.stage.width(),o=this.stage.height(),{min:n,max:r}=this.zoomBounds(),a=1.12,l=Math.min(i/(e.width*a),o/(e.height*a)),c=N(Math.max(l,t??n),n,r);this.stage.scale({x:c,y:c}),this.stage.position({x:i/2-(e.x+e.width/2)*c,y:o/2-(e.y+e.height/2)*c}),this.afterViewChange(),this.stage.batchDraw()}focusRegion(e,t){let i=typeof e=="string"?this.sectionBounds(e):e;if(!i)return;if(this.cancelGlide(),t?.animate===!1||this.reducedMotion){this.zoomToBounds(i,t?.minScale);return}let o=this.stage.width(),n=this.stage.height(),{min:r,max:a}=this.zoomBounds(),l=1.12,c=Math.min(o/(i.width*l),n/(i.height*l)),h=N(Math.max(c,t?.minScale??r),r,a),u=o/2-(i.x+i.width/2)*h,d=n/2-(i.y+i.height/2)*h,m=this.stage.scaleX(),y=this.stage.x(),p=this.stage.y();if(Math.abs(h-m)<1e-4&&Math.abs(u-y)<.5&&Math.abs(d-p)<.5){this.afterViewChange();return}let f=performance.now(),b=Math.max(180,Math.min(1200,t?.durationMs??bt));this.glideInProgress=!0;let g=v=>{if(this.destroyed){this.glideRaf=0,this.glideInProgress=!1;return}let k=Math.min(1,(v-f)/b),L=k<.5?4*k*k*k:1-Math.pow(-2*k+2,3)/2,S=m+(h-m)*L;this.stage.scale({x:S,y:S}),this.stage.position({x:y+(u-y)*L,y:p+(d-p)*L}),this.updateSeatGroupVisibility(),this.updateLOD(),this.scheduleViewChange(),this.stage.batchDraw(),k<1?this.glideRaf=requestAnimationFrame(g):(this.glideRaf=0,this.glideInProgress=!1,this.afterViewChange())};this.glideRaf=requestAnimationFrame(g)}cancelGlide(){this.glideRaf&&(cancelAnimationFrame(this.glideRaf),this.glideRaf=0),this.glideInProgress=!1}getRung(){let e=this.effScale();return e>=ee?"seats":this.zones.length&&e<Ee?"zones":"sections"}get renderedQualityContext(){return{stage:this.stage,overlayLayer:this.overlayLayer,labelGroup:this.labelGroup,viewMode:this.viewMode,cached:this.cached,effScale:()=>this.effScale(),getRung:()=>this.getRung(),worldToScreen:e=>this.worldToScreen(e),isoLiftLocal:e=>this.isoLiftLocal(e),seats:this.seats,sections:this.sections,zones:this.zones,seatSection:this.seatSection,statusById:this.statusById,selection:this.selection,circleById:this.circleById,seatLabelById:this.seatLabelById,boothLabelById:this.boothLabelById,accessGlyphById:this.accessGlyphById,freeTextById:this.freeTextById,gaById:this.gaById,perspectiveSeatProjected:this.perspectiveSeatProjected,perspectiveSeatScale:this.perspectiveSeatScale,seatR:this.seatR,canvasBackground:this.canvasBackground,effSelection:this.effSelection,categoryFilter:this.categoryFilter,focusedSectionId:this.focusedSectionId,focusBackdrop:this.focusBackdrop,isSelectable:e=>this.isSelectable(e),seatViewportCulled:e=>this.seatViewportCulled(e),focusedSeatOpacity:(e,t)=>this.focusedSeatOpacity(e,t),accessGlyphFilterEmphasized:e=>this.accessGlyphFilterEmphasized(e),seatLabelScale:e=>this.seatLabelScale(e),seatLabelInk:(e,t)=>this.seatLabelInk(e,t),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e)}}getRenderedQualityEvidence(){return gs(this.renderedQualityContext)}setRung(e){if(e==="zones"){this.cancelGlide(),this.zoomToFit();return}let t=e==="sections"?(ye+ee)/2:Math.max(this.seatLabelTargetScale()*1.05,es,ee*1.3),i=this.stage.width(),o=this.stage.height(),n=this.getVisibleWorldRect(),r={x:n.x+n.width/2,y:n.y+n.height/2},a=r.x,l=r.y;if(e==="sections"&&this.sections.length>0){let d=this.sections.map(f=>{let b=z(f.outline);return{x:b.x+b.width/2,y:b.y+b.height/2}}),m=i/(t*2),y=o/(t*2);if(!d.some(f=>Math.abs(f.x-r.x)<=m&&Math.abs(f.y-r.y)<=y)){let f=d.reduce((b,g)=>{let v=(g.x-r.x)**2+(g.y-r.y)**2;return v<b.distance?{point:g,distance:v}:b},{point:d[0],distance:1/0});a=f.point.x,l=f.point.y}}let c=e==="seats"?this.seats.filter(d=>d.kind!=="booth"):[];if(c.length>0){let d=c[0],m=1/0;for(let y of c){let p=y.x-r.x,f=y.y-r.y,b=p*p+f*f;b<m&&(d=y,m=b)}a=d.x,l=d.y}let h=i/(t*1.12),u=o/(t*1.12);this.focusRegion({x:a-h/2,y:l-u/2,width:h,height:u})}seatLabelTargetScale(){let e=Ce,t=new ke({fontSize:he,fontStyle:"600",fontFamily:this.labelFont(),listening:!1}),i=this.seatR*2-3;for(let o of this.seats){if(o.kind==="booth"){e=Math.min(e,Ce);continue}let n=he*this.seatLabelScale(o);t.fontSize(n),t.text(lt(o.displayLabel??o.label));let r=t.width()>i?Math.max(Ke,n*i/t.width()):n;e=Math.min(e,r)}return t.destroy(),de/Math.max(Ke,e)}afterViewChange(){this.updateSeatGroupVisibility(),this.updateLOD(),this.updateFreeTextVisibility(),this.updateLabels(),this.scheduleViewChange()}scheduleViewChange(){this.exportMode||this.viewChangeRaf||(this.viewChangeRaf=requestAnimationFrame(()=>{this.viewChangeRaf=0,this.opts.onViewChange?.()}))}sizeLabel(e,t,i){e.fontSize(Math.max(1,t)),e.offsetX(e.width()/2),e.offsetY(e.height()/2),e.y(i)}updateLOD(){let e=this.exportMode?Math.max(this.effScale(),Re+.01,ne):this.effScale(),t=Math.max(e,1e-4);for(let[n,r]of this.primaryFocalLabels)this.sizeLabel(n,r/t,n.y());this.hasSections?Es(this.sectionLodPaintContext,e):this.primaryFocalLabels.size&&this.bgLayer.batchDraw(),this.paintGAStateForView(),this.updateAccessGlyphs(e);let i=!this.exportMode&&e<ee;if(this.viewMode==="perspective"&&this.hasSections&&this.seats.length>2500&&i){this.seatLayer.listening(!1);return}i&&!this.cached?this.cacheSeatLayer():!i&&(this.cached||!this.seatLayer.listening())&&(this.cached&&this.releaseSeatLayerBitmap(),this.seatLayer.listening(!this.exportMode),this.cached=!1,this.seatLayer.batchDraw())}rebuildSeatCache(){this.updateSeatGroupVisibility();let e=N(this.stage.scaleX()*this.dpr,.15,2);this.seatLayer.clearCache(),this.seatLayer.cache({pixelRatio:e}),this.seatLayer.listening(!1),this.cached=!0}cacheSeatLayer(){this.rebuildSeatCache(),this.seatLayer.batchDraw()}releaseSeatLayerBitmap(){let e=this.seatLayer,t=e._cache.get("canvas");t&&(Mt.Util.releaseCanvas(t.scene._canvas,t.filter._canvas,t.hit._canvas),e._cache.delete("canvas"))}forceDraw(){this.recacheTimer&&(clearTimeout(this.recacheTimer),this.recacheTimer=null,this.effScale()<ee?this.rebuildSeatCache():this.cached&&(this.releaseSeatLayerBitmap(),this.seatLayer.listening(!0),this.cached=!1)),this.bgLayer.draw(),this.seatLayer.draw(),this.overlayLayer.draw()}async ready(){let e=this.assetGeneration,t=typeof document<"u"&&"fonts"in document?document.fonts:null;if(await Promise.all([...this.assetPromises.slice(),...t?[t.ready.then(()=>{}),t.load("700 24px Inter").then(()=>{}),t.load('600 12px "JetBrains Mono"').then(()=>{})]:[]]),e!==this.assetGeneration)throw new Error("The chart changed while its export assets were loading.");if(this.assetErrors.length)throw new Error(`Export stopped because ${this.assetErrors.join(" ")}`);this.exportMode&&(this.fitExportContent(),this.forceDraw())}exportSceneBounds(){let e=[this.bgLayer,this.seatLayer,this.overlayLayer].map(r=>r.getClientRect({relativeTo:this.stage})).filter(r=>r.width>0&&r.height>0);if(!e.length)return this.bounds;let t=Math.min(...e.map(r=>r.x)),i=Math.min(...e.map(r=>r.y)),o=Math.max(...e.map(r=>r.x+r.width)),n=Math.max(...e.map(r=>r.y+r.height));return{x:t,y:i,width:Math.max(1,o-t),height:Math.max(1,n-i)}}fitExportContent(){if(!this.exportMode)return;let e=this.stage.width(),t=this.stage.height(),i=Math.max(12,Math.min(36,Math.min(e,t)*.025)),o=()=>{let n=this.exportSceneBounds(),r=Math.max(1,e-i*2),a=Math.max(1,t-i*2),l=Math.min(r/n.width,a/n.height)||1;this.fitScale=l,this.stage.scale({x:l,y:l}),this.stage.position({x:(e-n.width*l)/2-n.x*l,y:(t-n.height*l)/2-n.y*l}),this.afterViewChange()};o(),o()}captureCanvas(){if(!this.exportMode)throw new Error("captureCanvas() is available only on a renderer created with exportMode.");this.forceDraw();let e;try{e=this.stage.toCanvas({pixelRatio:1,imageSmoothingEnabled:!0})}catch(o){let n=o instanceof Error?o.message:String(o);throw new Error(`The chart canvas could not be captured. A buyer-visible image may block export. ${n}`)}let t=document.createElement("canvas");t.width=this.stage.width(),t.height=this.stage.height();let i=t.getContext("2d");if(!i)throw new Error("Canvas 2D is unavailable; this browser cannot create an export.");i.fillStyle=this.canvasBackground,i.fillRect(0,0,t.width,t.height);try{i.drawImage(e,0,0)}finally{e.width=1,e.height=1}return t}updateFreeTextVisibility(){let e=this.exportMode?Math.max(this.effScale(),ne):this.effScale();for(let{objectId:t,node:i,backdrop:o,categoryKey:n,kind:r}of this.freeTextById.values()){let a=n!=null&&(r==="ga-label"||r==="ga-capacity")&&this.gaCategoryDimmed(n),l=t!=null&&(r==="ga-label"||r==="ga-capacity")&&this.gaById.get(t)?.sectionId!=null&&e<ee,c=r==="free-text"&&this.nodeBelongsToFocusedSection(i),h=!a&&!l&&(c||fe(i.fontSize(),e));i.visible(h),o?.visible(h)}for(let{node:t,fontSize:i}of this.iconNodeById.values())t.visible(this.nodeBelongsToFocusedSection(t)||fe(i,e))}nodeBelongsToFocusedSection(e){let t=this.focusedSectionId;if(!t)return!1;let i=this.sections.filter(r=>r.id===t||r.logicalId===t||r.zone===t);if(!i.length)return!1;let o=e.getClientRect({relativeTo:this.bgLayer,skipShadow:!0}),n={x:o.x+o.width/2,y:o.y+o.height/2};return i.some(r=>j(n,r.outline,r.holes))}buildRowLabelPlan(e){this.rowLabelPlan=Ms(e,{theme:this.theme,seats:this.seats,seatSection:this.seatSection,seatR:this.seatR,objectFilteredOut:t=>this.objectFilteredOut(t)})}rowLabelBox(e,t,i=U){return Jt(e,t,i)}resolveAutomaticRowLabelPosition(e,t,i){return Ps(e,t,i,this.seatIndex)}objectFilteredOut(e){let t=e.categoryKey;return t?!!(this.categoryHighlight&&t!==this.categoryHighlight||this.categoryFilter&&!this.categoryFilter.has(t)):!1}updateLabels(){Fs(this.viewportLabelContext)}get viewportLabelContext(){return{exportMode:this.exportMode,effScale:()=>this.effScale(),boothLabelById:this.boothLabelById,circleById:this.circleById,focusedSeatOpacity:(e,t)=>this.focusedSeatOpacity(e,t),labelGroup:this.labelGroup,labelLiftGroups:this.labelLiftGroups,seatLabelById:this.seatLabelById,visibleSeatCandidates:()=>this.visibleSeatCandidates(),worldToScreen:e=>this.worldToScreen(e),stage:this.stage,accessGlyphById:this.accessGlyphById,accessGlyphShouldShow:e=>this.accessGlyphShouldShow(e),statusById:this.statusById,renderedSeatPoint:e=>this.renderedSeatPoint(e),viewMode:this.viewMode,perspectiveSeatScale:this.perspectiveSeatScale,ownedHold:this.ownedHold,opts:this.opts,seatLabelContainer:e=>this.seatLabelContainer(e),seatLabelScale:e=>this.seatLabelScale(e),labelFont:()=>this.labelFont(),seatLabelInk:(e,t)=>this.seatLabelInk(e,t),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e),seatR:this.seatR,freeTextById:this.freeTextById,bgLayer:this.bgLayer,rowLabelPlan:this.rowLabelPlan,focusedSectionId:this.focusedSectionId,resolveAutomaticRowLabelPosition:(e,t,i)=>this.resolveAutomaticRowLabelPosition(e,t,i),rowLabelBox:(e,t)=>this.rowLabelBox(e,t),isoT:this.isoT,applyUprightLabels:()=>this.applyUprightLabels(),overlayLayer:this.overlayLayer}}handleResize(){let e=this.container.clientWidth||1,t=this.container.clientHeight||1;e===this.stage.width()&&t===this.stage.height()||(this.stage.size({width:e,height:t}),this.refitCurrentView())}startFpsLoop(){let e=t=>{this.lastFpsAt||(this.lastFpsAt=t),this.frames++;let i=t-this.lastFpsAt;i>=1e3&&(this.opts.onFps?.(Math.round(this.frames*1e3/i)),this.frames=0,this.lastFpsAt=t),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}};et.ZOOM_STEP=1.4;var oi=et;function $s(s,e){return new oi(s,e)}function Xs(s,e={}){let{baseMs:t=1e3,factor:i=2,maxMs:o=1/0,jitter:n=0,random:r=Math.random}=e,a=Math.min(t*i**Math.max(0,s),o);if(n<=0)return a;let l=Math.min(1,n);return a*(1-l+l*r())}var ge=class extends Error{constructor(t){super(t.message);this.status=422;this.name="PickerSelectionError",this.reason=t.code,this.labels=t.labels}};function qs(s){if(s!=null&&(!Number.isInteger(s)||s<1))throw new Error("picker: `numberOfPlacesToSelect` must be a positive integer");return s??null}function Ys(s,e,t,i){if(t!=null&&!Array.isArray(t))throw new TypeError("picker: `selectionValidators` must be an array");let o=[],n=0,r=!1,a=!1;for(let c of t??[])if(c?.type==="minimumSelectedPlaces"){if(!Number.isInteger(c.minimum)||Number(c.minimum)<1)throw new TypeError("picker: `minimumSelectedPlaces.minimum` must be a positive integer");n=Math.max(n,Number(c.minimum))}else if(c?.type==="consecutiveSeats")r=!0;else if(c?.type==="noOrphanSeats")a=!0;else throw new TypeError(`picker: unsupported selection validator "${String(c?.type??"")}"`);if(n&&o.push({type:"minimumSelectedPlaces",minimum:n}),r&&o.push({type:"consecutiveSeats"}),a&&o.push({type:"noOrphanSeats"}),s!=null&&n>s)throw new Error("picker: `minimumSelectedPlaces.minimum` cannot exceed `numberOfPlacesToSelect`");let l=Math.max(0,Math.floor(e??s??Math.max(i,n)));if(s!=null&&l<s)throw new Error("picker: `maxSelection` cannot be lower than `numberOfPlacesToSelect`");if(e!=null&&l<n)throw new Error("picker: `maxSelection` cannot be lower than `minimumSelectedPlaces.minimum`");return{validators:o,maxSelection:s??l}}function $o(s){let e=Number(s.slice(s.lastIndexOf(":")+1));return Number.isInteger(e)?e:-1}function Xo(s){if(s.length<=1)return!1;let e=s[0]?.objectId,t=s[0]?.categoryKey;if(!e||s.some(o=>o.objectId!==e||o.categoryKey!==t))return!0;let i=s.map(o=>$o(o.id)).sort((o,n)=>o-n);return i.some((o,n)=>o<0||n>0&&o!==i[n-1]+1)}function Us(s,e,t,i,o){let n=i.find(l=>l.type==="minimumSelectedPlaces")?.minimum??0,r=t??n,a=[];return t!=null&&e!==t&&a.push("numberOfPlacesToSelect"),n&&e<n&&a.push("minimumSelectedPlaces"),i.some(l=>l.type==="consecutiveSeats")&&Xo(s)&&a.push("consecutiveSeats"),i.some(l=>l.type==="noOrphanSeats")&&o()&&a.push("noOrphanSeats"),{isValid:a.length===0,count:e,required:r,remaining:Math.max(0,r-e),seats:s,violations:a}}var qo=10,Yo=15e3,Qs=["background","rowLabelColor","textColor","selectionColor"];function Uo(s,e){return!s||!e?!s&&!e:Qs.every(t=>s[t]===e[t])}function Pt(s){let e=s??{};return{status:e.status,conflicts:e.conflicts,reason:e.reason}}function ni(s){return s==="blocked"?"not_for_sale":s==="held"||s==="booked"||s==="free"||s==="not_for_sale"?s:"free"}var Zs=class{constructor(e){this.selectableSeatIds=null;this.lastSelectionValidity=null;this.renderer=null;this._doc=null;this.hidden=new Set;this.mapTheme=null;this.closedSections=new Set;this.labelToId=new Map;this.labelToSeat=new Map;this.seatTiers=new Map;this.seatById=new Map;this.seatContext=new Map;this.allIds=[];this.groupedTablesByObject=new Map;this.groupedTablesByLabel=new Map;this.groupedTableBySeatId=new Map;this.tableQuantities=new Map;this.confirmedVariableTables=new Set;this.groupedSelectionOverhead=0;this.ws=null;this.realtime=null;this.reconnectTimer=null;this.attempt=0;this.closed=!1;this.onVisibilityChange=null;this.hold_=null;this.liveStatuses=new Map;this.liveDefault="free";this.currency="USD";this.expiryTimer=null;this.hintShown=!1;this.opts=e,this.api=e.transport,this.key=e.eventKey,this.numberOfPlacesToSelect=qs(e.numberOfPlacesToSelect);let t=Ys(this.numberOfPlacesToSelect,e.maxSelection,e.selectionValidators,qo);this.selectionValidators=t.validators,this.maxSelection=t.maxSelection,this.selectableObjectRefs=e.selectableObjects==null?null:[...new Set(e.selectableObjects.filter(i=>typeof i=="string"&&!!i))],this.mapTheme=e.mapTheme??null}get doc(){return this._doc}visibleDoc(){if(!this._doc)return{objects:[]};let e=Li(this._doc,this.hidden);if(!this.mapTheme)return e;let t={...e.theme??{}};for(let i of Qs){let o=this.mapTheme[i];o&&(t[i]=o)}return{...e,theme:t}}setMapTheme(e){if(Uo(this.mapTheme,e??null))return!1;this.mapTheme=e??null;let t=this.renderer;if(!t)return!0;let i=t.getSelection().map(r=>r.id),o=this.getActiveFloorId(),n=t.isFloorOverview?.()??!1;return t.setChart(this.visibleDoc(),o?{floorId:o}:void 0),n&&t.setFloorOverview?.(!0),this.opts.colorblindSafe&&t.setColorblindSafe?.(!0),this.closedSections.size&&t.setClosedSections?.([...this.closedSections]),this.applySeatsMap(Object.fromEntries(this.liveStatuses),this.liveDefault),i.length&&t.select?.(i),!0}syncHidden(e){let t=e.filter(o=>typeof o=="string");if(t.length===this.hidden.size&&t.every(o=>this.hidden.has(o)))return!1;this.hidden=new Set(t);let i=this.renderer?.isFloorOverview?.()??!1;return this.renderer?.setChart(this.visibleDoc()),i&&this.renderer?.setFloorOverview?.(!0),!0}syncClosed(e){let t=(e??[]).filter(i=>typeof i=="string");return t.length===this.closedSections.size&&t.every(i=>this.closedSections.has(i))?!1:(this.closedSections=new Set(t),this.renderer?.setClosedSections?.(t),!0)}isSectionClosed(e){return this.closedSections.has(e)}currentHold(){return this.hold_}getRenderer(){return this.renderer}seatByLabel(e){return this.labelToSeat.get(e)}idForLabel(e){return this.labelToId.get(e)}idsForLabel(e){let t=this.groupedTablesByLabel.get(e);if(t)return t.chairs.map(o=>o.id);let i=this.labelToId.get(e);return i?[i]:[]}idsForLabels(e){return[...new Set([...e].flatMap(t=>this.idsForLabel(t)))]}tableSelection(e){let t=this.groupedTableBySeatId.get(e)??this.groupedTablesByLabel.get(e);return t?this.toTableSeat(t):null}lineItemDisplay(e){if(e.objectType==="ga"){let o=this.visibleDoc(),n=rt(o).find(r=>r.id===e.objectId);return{...n?.displayLabel?{displayLabel:n.displayLabel}:{},...n?.displayType?{displayType:n.displayType}:{}}}if(e.objectType==="table"){let o=this.groupedTablesByLabel.get(e.label);return{...o?.displayLabel&&o.displayLabel!==o.label?{displayLabel:o.displayLabel}:{},...o?.displayType?{displayType:o.displayType}:{}}}let t=this.labelToSeat.get(e.label),i=t?this.seatContext.get(t.id):void 0;return{...t?.displayLabel?{displayLabel:t.displayLabel}:{},...i?.displayType?{displayType:i.displayType}:{}}}async render(e){if(this.renderer)return null;let t=performance.now(),i={},o=S=>Math.round((performance.now()-S)*100)/100;this.closed=!1;let n,r=performance.now();try{n=await this.api.chart(this.key)}catch(S){return this.emitError(S),null}if(i.loadChart=o(r),this.closed)return null;this._doc=n.doc;let a=performance.now();try{let S=zi(n.doc,n.event.inventoryModelVersion===2?2:1);this.groupedTablesByObject=new Map(S.map(w=>[w.objectId,w])),this.groupedTablesByLabel=new Map(S.map(w=>[w.label,w])),this.groupedTableBySeatId=new Map(S.flatMap(w=>w.chairs.map(x=>[x.id,w]))),this.tableQuantities=new Map(S.map(w=>[w.label,w.mode==="whole"?w.capacity:w.minOccupancy])),this.confirmedVariableTables=new Set,this.groupedSelectionOverhead=S.reduce((w,x)=>w+Math.max(0,x.chairs.length-1),0)}catch(S){return this.emitError(S),null}this.labelToId=new Map,this.labelToSeat=new Map,this.seatById=new Map,this.seatContext=new Map,this.allIds=[];let l=new Map(bi(n.doc).map(S=>[S.id,S])),c=Gt(n.doc),h=new Map([...c.sections,...c.ungrouped?[c.ungrouped]:[]].map(S=>[S.id,S.label]));for(let S of He(n.doc)){this.labelToId.set(S.label,S.id),this.labelToSeat.set(S.label,S),this.seatById.set(S.id,S),this.allIds.push(S.id);let w=l.get(S.rowId),x=w&&"label"in w&&typeof w.label=="string"?w.label:void 0,I=w?.type==="row"?w.segmentedRow:void 0,T=I?.displayLabel??(w&&"displayLabel"in w&&typeof w.displayLabel=="string"&&w.displayLabel?w.displayLabel:x),P=this.groupedTablesByObject.get(S.rowId),C=w?.type==="table"?"table":w?.type==="booth"?"booth":"seat",M=T,R=I?.displayType?.trim()||(w&&"displayType"in w&&typeof w.displayType=="string"&&w.displayType.trim()?w.displayType.trim():void 0),A=S.displayLabel??S.label,B=A.split("-"),W=P||S.kind==="booth"?void 0:T&&A.startsWith(`${T}-`)?A.slice(T.length+1):B[B.length-1]??A;this.seatContext.set(S.id,{objectId:S.rowId,objectType:C,sectionLabel:h.get(c.objectToSection.get(S.rowId)??""),rowLabel:M,seatNumber:W,...R?{displayType:R,rowType:R}:{}})}for(let S of this.groupedTablesByLabel.values()){let w=S.chairs[0];w&&(this.labelToId.set(S.label,w.id),this.labelToSeat.set(S.label,w))}i.normalizeBuyerModel=o(a);let u=n.event.currency??this.opts.currency;this.currency=u??"USD";let d=performance.now(),m=$s(e,{maxSelection:this.rendererSelectionCap(),confirmSelection:this.opts.confirmSelection,portraitFitCrop:!0,currency:u,onSelect:S=>{this.handleRendererSelect(S)},onDeselect:S=>{this.handleRendererDeselect(S)},onSelectionLimit:this.opts.onSelectionLimit,onHover:S=>{this.opts.onHover?.(S),this.opts.onSeatHover&&this.opts.onSeatHover(S?this.describeSeat(S):null)},onFocusSeat:this.opts.onFocusSeat,onViewChange:this.opts.onViewChange,onGAClick:this.opts.onGAClick,onSectionTap:S=>this.handleSectionTap(S),onDeckTap:S=>this.handleDeckTap(S),onFps:this.opts.onFps});if(i.createRenderer=o(d),this.closed)return m.destroy(),null;this.renderer=m;let y=null,p="free",f=[],b=performance.now();try{let S=await this.api.objects(this.key);this.hidden=new Set(S.hidden??[]),f=(S.closed??[]).filter(w=>typeof w=="string"),y=S.seats,p=S.default??"free"}catch{}if(i.loadStatuses=o(b),this.closed)return m.destroy(),this.renderer=null,null;let g=performance.now();m.setChart(this.visibleDoc()),(n.doc.floors?.length??0)>1&&m.setFloorOverview?.(!0),this.opts.colorblindSafe&&m.setColorblindSafe?.(!0),i.buildScene=o(g),this.closedSections=new Set(f);let v=performance.now();f.length&&m.setClosedSections?.(f),y&&this.applySeatsMap(y,p),this.rebuildSelectableSeatIds(),this.opts.selectedObjects?.length?this.select(this.opts.selectedObjects):this.emitSelectionValidity(),i.applyInitialState=o(v);let k=performance.now();m.forceDraw(),i.firstPaint=o(k);let L=performance.now();return this.attachVisibilityListener(),this.connect(),i.startRealtime=o(L),i.controllerTotal=o(t),{doc:n.doc,salesClosed:!!n.event.salesClosed,eventName:n.event.name,venue:n.event.venue,startsAt:n.event.startsAt,timezone:n.event.timezone??null,currency:u,mode:n.event.mode??"live",posterUrl:n.event.posterUrl??null,performanceProfile:i}}getSelection(){if(!this.renderer)return[];let e=[],t=new Set;for(let i of this.renderer.getSelection()){let o=this.groupedTableBySeatId.get(i.id);o?t.has(o.label)||(t.add(o.label),e.push(this.toTableSeat(o))):e.push(this.toSeat(i))}return e}seatDetails(e){let t=this.seatById.get(e);return t?this.describeSeat(t):null}clearSelection(){this.renderer?.clearSelection(),this.resetUnheldTableQuantities(),this.emitSelectionChange()}deselect(e){let t=new Set;for(let i of e){let o=this.groupedTableBySeatId.get(i)??this.groupedTablesByLabel.get(i);if(o)o.chairs.forEach(n=>t.add(n.id)),this.hold_?.labels.includes(o.label)||(this.tableQuantities.set(o.label,o.mode==="whole"?o.capacity:o.minOccupancy),o.mode==="variable"&&this.confirmedVariableTables.delete(o.label));else{let n=this.seatById.has(i)?i:this.labelToId.get(i);n&&t.add(n)}}this.renderer?.deselect([...t]),this.emitSelectionChange()}setMaxSelection(e){this.maxSelection=Math.max(0,Math.floor(e)),this.renderer?.setMaxSelection?.(this.rendererSelectionCap())}select(e){let t=new Set(this.getSelection().map(r=>r.label)),i=new Set,o=[];for(let r of e){let a=this.groupedTableBySeatId.get(r)??this.groupedTablesByLabel.get(r);if(a)this.tableTierResolution(a).kind==="invalid"?o.push(a.label):a.chairs.forEach(c=>{this.isSelectableByPolicy(c.id)&&i.add(c.id)});else{let l=this.seatById.has(r)?r:this.labelToId.get(r);if(!l||!this.isSelectableByPolicy(l))continue;let c=this.seatById.get(l);c&&this.seatTierResolution(c).kind==="invalid"?o.push(c.label):i.add(l)}}if(o.length&&this.emitError(new ge(Kt(o))),!i.size)return[];if(this.renderer?.select?.([...i]),this.selectionGuestCount()>this.maxSelection)return this.renderer?.deselect([...i]),this.opts.onSelectionLimit?.(this.maxSelection),[];let n=this.getSelection().filter(r=>!t.has(r.label));return n.length&&this.emitSelectionChange(),n}selectCategories(e){let t=new Set(e);return this.select([...this.seatById.values()].filter(i=>t.has(i.categoryKey)).map(i=>i.id))}deselectCategories(e){let t=new Set(e);this.deselect(this.getSelection().filter(i=>t.has(i.categoryKey)).map(i=>i.id))}setSelectableObjects(e){this.selectableObjectRefs=e==null?null:[...new Set(e.filter(i=>typeof i=="string"&&!!i))],this.rebuildSelectableSeatIds();let t=this.renderer?.getSelection().filter(i=>!this.isSelectableByPolicy(i.id)).map(i=>i.id)??[];t.length&&this.deselect(t)}getSelectionValidity(e){if(this.numberOfPlacesToSelect==null&&!this.selectionValidators.length)return null;let t=this.getSelection(),i=e??t.reduce((o,n)=>o+(n.quantity??1),0);return Us(t,i,this.numberOfPlacesToSelect,this.selectionValidators,()=>this.hasOrphanedSelection())}hasOrphanedSelection(){let e=this.renderer;if(!e)return!1;let t=new Set(e.getSelection().map(i=>i.id));return t.size>0&&Wt(this.seatById.values(),i=>e.getStatus(i),t).length>0}rebuildSelectableSeatIds(){if(this.selectableObjectRefs==null){this.selectableSeatIds=null;return}let e=new Set;for(let t of this.selectableObjectRefs){let i=this.groupedTableBySeatId.get(t)??this.groupedTablesByLabel.get(t);if(i){i.chairs.forEach(n=>e.add(n.id));continue}let o=this.seatById.has(t)?t:this.labelToId.get(t);o&&e.add(o)}this.selectableSeatIds=e}isSelectableByPolicy(e){return this.selectableSeatIds==null||this.selectableSeatIds.has(e)}setTableQuantity(e,t){let i=this.groupedTablesByLabel.get(e);if(!i)return!1;let o=i.mode==="whole"?i.capacity:Math.floor(t);if(!Number.isInteger(o)||o<i.minOccupancy||o>i.maxOccupancy)return!1;let n=this.tableQuantities.get(e)??i.minOccupancy;return this.tableQuantities.set(e,o),this.selectionGuestCount()>this.maxSelection?(this.tableQuantities.set(e,n),this.opts.onSelectionLimit?.(this.maxSelection),!1):(i.mode==="variable"&&this.confirmedVariableTables.add(e),this.emitSelectionChange(),!0)}async replaceTableQuantity(e,t,i){let o=this.groupedTablesByLabel.get(e),n=this.hold_;if(!o||o.mode!=="variable"||!n?.labels.includes(e))return null;let r=Math.floor(t);if(!Number.isInteger(r)||r<o.minOccupancy||r>o.maxOccupancy)return null;if((n.items??[]).filter(h=>h.label!==e).reduce((h,u)=>h+(u.quantity??1),0)+r>this.maxSelection)return this.opts.onSelectionLimit?.(this.maxSelection),null;let l=(n.items??[]).map(h=>({label:h.label,tierId:h.tierId,quantity:h.label===e?r:h.quantity}));if(!l.some(h=>h.label===e))return null;let c=await this.api.hold(this.key,l,i,n.holdId);return this.tableQuantities.set(e,r),this.setHold({holdId:c.holdId,labels:l.map(h=>h.label),expiresAt:c.expiresAt,items:c.items}),this.hold_}rendererSelectionCap(){return this.maxSelection+this.groupedSelectionOverhead}selectionGuestCount(){return this.getSelection().reduce((e,t)=>e+(t.quantity??1),0)}handleRendererSelect(e){let t=this.groupedTableBySeatId.get(e.id);if(!this.isSelectableByPolicy(e.id)){this.renderer?.deselect(t?t.chairs.map(o=>o.id):[e.id]),this.emitSelectionChange();return}if((t?this.tableTierResolution(t):this.seatTierResolution(e)).kind==="invalid"){this.renderer?.deselect(t?t.chairs.map(o=>o.id):[e.id]),this.emitError(new ge(Kt([t?.label??e.label]))),this.emitSelectionChange();return}if(t){if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect(t.chairs.map(o=>o.id)),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.renderer?.select?.(t.chairs.map(o=>o.id)),this.opts.onSelect?.(t.chairs[0]??e),this.opts.onTableSelectionRequest?.(this.toTableSeat(t)),this.emitSelectionChange();return}if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect([e.id]),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.opts.onSelect?.(e),this.emitSelectionChange()}handleRendererDeselect(e){let t=this.groupedTableBySeatId.get(e.id);t?(this.renderer?.deselect(t.chairs.map(i=>i.id)),this.hold_?.labels.includes(t.label)||(this.tableQuantities.set(t.label,t.mode==="whole"?t.capacity:t.minOccupancy),t.mode==="variable"&&this.confirmedVariableTables.delete(t.label)),this.opts.onDeselect?.(t.chairs[0]??e)):this.opts.onDeselect?.(e),this.emitSelectionChange()}resetUnheldTableQuantities(){for(let e of this.groupedTablesByLabel.values())this.hold_?.labels.includes(e.label)||(this.tableQuantities.set(e.label,e.mode==="whole"?e.capacity:e.minOccupancy),e.mode==="variable"&&this.confirmedVariableTables.delete(e.label))}resetTableQuantitiesForLabels(e){for(let t of e){let i=this.groupedTablesByLabel.get(t);i&&(this.tableQuantities.set(t,i.mode==="whole"?i.capacity:i.minOccupancy),i.mode==="variable"&&this.confirmedVariableTables.delete(t))}}tableQuantityRequest(e){if(e?.objectType!=="table")return{};if(e.bookingMode==="variable"&&!this.confirmedVariableTables.has(e.label))throw new Error("picker: confirm a variable table guest quantity before holding");return{quantity:e.quantity}}async hold(e,t){if(!this.renderer)return null;let o=e??this.getSelection().map(l=>l.label),n=(this.hold_?.items??[]).filter(l=>l.objectType==="ga"),r=[...new Set([...n.map(l=>l.label),...o])];if(!r.length)return null;let a=this.ticketIssue(r);if(a)throw new ge(a);if(this.hold_&&this.holdCovers(r))return this.hold_;try{let l=r.map(h=>{let u=n.find(y=>y.label===h);if(u)return{label:h,tierId:u.tierId,quantity:u.quantity};let d=this.labelToSeat.get(h),m=d?this.toSeat(d):null;return{label:h,...m?.tierId?{tierId:m.tierId}:{},...this.tableQuantityRequest(m)}}),c=await this.api.hold(this.key,l,t,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:r,expiresAt:c.expiresAt,items:c.items}),this.hold_}catch(l){throw this.handle409Conflicts(l),l}}async resumeHold(e){if(this.closed||!e||!this.api.resume)return null;let t=await this.api.resume(this.key,e);if(this.closed)return null;let i=[...new Set(t.items.map(o=>o.label))];return i.length?(this.setHold({holdId:t.holdId,labels:i,expiresAt:t.expiresAt,items:t.items},"restored"),this.hold_):null}async extendHold(e){let t=this.hold_;if(!t||!this.api.extend)return null;try{let i=await this.api.extend(this.key,t.holdId,e);return this.hold_?.holdId!==t.holdId?this.hold_:(this.setHold({holdId:t.holdId,labels:t.labels,expiresAt:i.expiresAt,items:t.items}),this.hold_)}catch{return null}}categoryAvailability(){let e={},t=this.closedMemberIds();for(let[i,o]of this.seatById)this.groupedTableBySeatId.has(i)||t.has(i)||(this.getStatus(i)??"free")==="free"&&(e[o.categoryKey]=(e[o.categoryKey]??0)+1);for(let i of this.groupedTablesByLabel.values()){if(i.chairs.some(n=>t.has(n.id)))continue;let o=i.chairs[0];o&&(this.getStatus(o.id)??"free")==="free"&&(e[i.categoryKey]=(e[i.categoryKey]??0)+i.maxOccupancy)}return e}closedMemberIds(){let e=new Set,t=this.renderer;if(!t||!this.closedSections.size)return e;for(let i of this.closedSections)for(let o of t.sectionMembers?.(i)??[])e.add(o);return e}getGAAreas(){let e=this.visibleDoc();return e?rt(e).map(t=>{let i=e.categories.find(o=>o.key===t.categoryKey);return{id:t.id,label:t.label,...t.displayLabel?{displayLabel:t.displayLabel}:{},...t.displayType?{displayType:t.displayType}:{},capacity:Math.max(0,Math.floor(t.capacity)),available:_t(t).filter(o=>this.statusOf(o)==="free").length,categoryKey:t.categoryKey,tiers:i?.tiers,price:i?.tiers?.[0]?.price??i?.price??0,currency:this.currency}}):[]}async holdGA(e,t,i={}){let o=this.visibleDoc();if(!o||!Number.isFinite(t)||t<1)return null;let n=rt(o).find(h=>h.id===e);if(!n)return null;let r=_t(n).filter(h=>!this.hold_?.labels.includes(h)&&this.statusOf(h)==="free").slice(0,Math.floor(t));if(r.length!==Math.floor(t))return null;let a=new Map;for(let h of this.hold_?.items??[])a.set(h.label,{label:h.label,tierId:h.tierId,quantity:h.quantity});if(this.hold_&&!this.hold_?.items?.length)for(let h of this.hold_.seats)a.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{}});for(let h of this.getSelection())a.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{},...this.tableQuantityRequest(h)});for(let h of r)a.set(h,{label:h,...i.tierId?{tierId:i.tierId}:{}});let l=[...a.values()],c=await this.api.hold(this.key,l,i.ttlMs,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:l.map(h=>h.label),expiresAt:c.expiresAt,items:c.items}),this.hold_}hasPremiumSeats(){for(let e of this.labelToSeat.values())if(e.commercial?.premium)return!0;return!1}getBestAvailableZones(){let e=this.visibleDoc();if(!e?.zones?.length)return[];let t=new Set(Gt(e).sections.filter(i=>i.seatCount>0&&!!i.zone).map(i=>i.zone));return e.zones.filter(i=>t.has(i.id)).map(i=>({id:i.id,label:i.label}))}pickPremiumBlock(e,t,i){let o=this.visibleDoc();if(!o?.objects?.length)return null;let n=o.focalPoint??{x:0,y:0},r=new Set(this.groupedTablesByObject.keys()),a=He(o).filter(d=>!r.has(d.rowId)),l=new Set(this.hold_?.labels??[]),c=new Set;for(let d of a){if(l.has(d.label)||this.seatTierResolution(d).kind==="invalid")continue;let m=this.labelToId.get(d.label);((m?this.getStatus(m):void 0)??"free")==="free"&&c.add(d.label)}let h=Hi(a,c,{qty:e,categoryKey:t,zoneId:i,focal:n,preferPremium:!0});return h.labels.length!==e?null:h.labels.every(d=>this.labelToSeat.get(d)?.commercial?.premium)?[...h.labels]:null}async bestAvailable(e,t,i={}){let o=this.renderer;if(!o)return null;if(i.preferPremium){let n=this.pickPremiumBlock(e,t,i.zoneId);if(n){if(this.hold_&&!await this.release())return null;try{let r=n.map(h=>{let u=this.labelToSeat.get(h),d=u?this.toSeat(u):null;return{label:h,...d?.tierId?{tierId:d.tierId}:{}}}),a=await this.api.hold(this.key,r,i.ttlMs);o.clearSelection();let l=this.idsForLabels(n);l.length&&o.setStatus(l,"held"),this.setHold({holdId:a.holdId,labels:[...n],expiresAt:a.expiresAt,items:a.items});let c=n.map(h=>this.labelToSeat.get(h)).filter(h=>!!h).map(h=>this.toSeat(h));return this.opts.onSelectionChange?.(c),this.hold_}catch(r){let{status:a,reason:l}=Pt(r);if(a===409&&l==="event_closed")throw this.opts.onSalesClosed?.(),r}}}if(this.hold_&&!await this.release())return null;try{let n=await this.api.bestAvailable(this.key,e,t,i.zoneId,i.ttlMs);o.clearSelection();let r=this.idsForLabels(n.labels);r.length&&o.setStatus(r,"held"),this.setHold({holdId:n.holdId,labels:[...n.labels],expiresAt:n.expiresAt,items:n.items});let a=n.labels.map(l=>this.labelToSeat.get(l)).filter(l=>!!l).map(l=>this.toSeat(l));return this.opts.onSelectionChange?.(a),this.hold_}catch(n){let{status:r,reason:a}=Pt(n);throw r===409&&a==="event_closed"&&this.opts.onSalesClosed?.(),n}}async book(e,t,i){let o=this.renderer;if(!o)return null;if(!this.api.book)throw new Error("picker: transport has no book() \u2014 hold-only mode");let n=t??this.getSelection().map(c=>c.label);if(!n.length)return null;let r=this.ticketIssue(n);if(r)throw new ge(r);let a;try{if(this.hold_&&this.holdCovers(n))a=this.hold_.holdId;else{let c=this.hold_?.holdId,h=await this.api.hold(this.key,n.map(u=>{let d=this.labelToSeat.get(u),m=d?this.toSeat(d):null;return{label:u,...m?.tierId?{tierId:m.tierId}:{},...this.tableQuantityRequest(m)}}),i,c);a=h.holdId,this.setHold({holdId:a,labels:[...n],expiresAt:h.expiresAt,items:h.items})}await this.api.book(this.key,n,a,e)}catch(c){let{status:h,conflicts:u,reason:d}=Pt(c);if(this.clearHold(),h===409&&d==="event_closed")this.opts.onSalesClosed?.();else if(h===409&&u?.length){let m=new Set(u.map(f=>f.label)),y=this.idsForLabels(m);y.length&&(o.setStatus(y,"booked"),o.deselect(y),this.resetTableQuantitiesForLabels(m));let p=n.filter(f=>!m.has(f));p.length&&a&&this.api.release(this.key,p,a).catch(()=>{}),this.emitSelectionChange()}else a&&this.api.release(this.key,n,a).catch(()=>{});throw c}let l=this.idsForLabels(n);return l.length&&(o.setStatus(l,"booked"),o.deselect(l)),this.clearHold(),this.resetTableQuantitiesForLabels(n),this.emitSelectionChange(),this.opts.onBook?.(e),n}async release(){let e=this.hold_;if(!e)return!0;try{let i=await this.api.release(this.key,e.labels,e.holdId);if(!this.releaseConfirmed(i,e.labels))return await this.resnapshot(),!1}catch(i){return this.emitError(i),!1}if(this.hold_?.holdId!==e.holdId)return!0;this.clearHold(),this.resetTableQuantitiesForLabels(e.labels);let t=this.idsForLabels(e.labels);return t.length&&(this.renderer?.deselect(t),this.renderer?.setStatus(t,"free")),!0}async releaseLabels(e){let t=this.hold_;if(!t)return!0;let i=e.filter(a=>t.labels.includes(a));if(!i.length)return!0;try{let a=await this.api.release(this.key,i,t.holdId);if(!this.releaseConfirmed(a,i))return await this.resnapshot(),!1}catch(a){return this.emitError(a),!1}if(this.hold_?.holdId!==t.holdId)return!0;let o=t.labels.filter(a=>!i.includes(a)),n=t.items?.filter(a=>!i.includes(a.label));o.length?this.setHold({...t,labels:o,items:n}):this.clearHold(),this.resetTableQuantitiesForLabels(i);let r=this.idsForLabels(i);return r.length&&(this.renderer?.deselect(r),this.renderer?.setStatus(r,"free")),!0}releaseConfirmed(e,t){let i=e?.released;return!Array.isArray(i)||t.every(o=>i.includes(o))}setStatus(e,t){this.renderer?.setStatus(e,t)}getStatus(e){return this.renderer?.getStatus(e)}notForSaleCategorySeatIds(){let e=this.doc;if(!e)return[];let t=new Set(e.categories.filter(o=>o.notForSale).map(o=>o.key));if(!t.size)return[];let i=[];for(let[o,n]of this.seatById)t.has(n.categoryKey)&&i.push(o);return i}flashSeat(e,t){this.renderer?.flashSeat(e,t)}zoomIn(){this.renderer?.zoomIn()}zoomOut(){this.renderer?.zoomOut()}zoomToFit(){this.renderer?.zoomToFit()}refitCurrentView(){this.renderer?.refitCurrentView?this.renderer.refitCurrentView():this.renderer?.zoomToFit()}worldToScreen(e){return this.renderer?.worldToScreen(e)??{x:0,y:0}}setSelectionFocus(e){this.renderer?.setSelectionFocus?.(e)}setAccessibilityFilter(e){this.renderer?.setAccessibilityFilter?.(e)}setCommercialLimitedFilter(e){this.renderer?.setCommercialLimitedFilter?.(e)}getFloors(){return this.renderer?.getFloors?.()??[]}getActiveFloorId(){return this.renderer?.getActiveFloorId?.()??""}setFloor(e){let t=this.renderer;!t?.setActiveFloor||e===t.getActiveFloorId?.()&&!t.isFloorOverview?.()||(t.setFloorOverview?.(!1),t.setStacked?.(!1),t.setActiveFloor(e),this.resnapshot(),this.emitSelectionChange())}setStacked(e){let t=this.renderer;!t?.setStacked||e===t.isStacked?.()||(t.setStacked(e),this.resnapshot())}isMultiFloor(){return(this._doc?.floors?.length??0)>1}setFloorOverview(e){let t=this.renderer;!t?.setFloorOverview||e===t.isFloorOverview?.()||(t.setFloorOverview(e),this.resnapshot(),this.emitSelectionChange())}isFloorOverview(){return this.renderer?.isFloorOverview?.()??!1}handleDeckTap(e){let t=this.renderer;t&&(t.setViewMode?.("flat"),t.setFloorOverview?.(!1),t.setStacked?.(!1),t.setActiveFloor?.(e),this.resnapshot(),this.emitSelectionChange(),this.opts.onDeckTap?.(e))}setViewMode(e){this.renderer?.setViewMode?.(e)}getViewMode(){return this.renderer?.getViewMode?.()??"flat"}getRung(){return this.renderer?.getRung?.()??"seats"}setRung(e){if(e==="zones"){this.overview();return}this.renderer?.setRung?.(e)}setCategoryFilter(e){this.renderer?.setCategoryFilter?.(e)}focusCategoryFilter(e){let t=this.renderer;if(t){if(t.clearSectionFocus?.(),this.opts.onSectionFocus?.(null),e?.length){let i=this.floorForCategories(e);i&&this.setFloor(i)}t.focusCategories?t.focusCategories(e):t.zoomToFit()}}floorForCategories(e){let t=this._doc;if(!t?.floors||t.floors.length<2)return null;let i=new Set(e),o=a=>a.some(l=>l.type==="row"&&(i.has(l.categoryKey)||(l.overrides??[]).some(c=>c.categoryKey!=null&&i.has(c.categoryKey)))||l.type==="gaArea"&&i.has(l.categoryKey)),n=this.getActiveFloorId(),r=t.floors.find(a=>a.id===n);return r&&o(r.objects)?null:t.floors.find(a=>o(a.objects))?.id??null}getViewport(){let e=this.renderer;return!e?.getVisibleWorldRect||!e.getWorldBounds?null:{visible:e.getVisibleWorldRect(),bounds:e.getWorldBounds()}}getMinimapSnapshot(){return this.renderer?.getMinimapSnapshot?.()??{sections:[],seats:[]}}panToWorld(e){this.renderer?.panToWorld?.(e)}clearSectionFocus(){this.renderer?.clearSectionFocus?.(),this.opts.onSectionFocus?.(null)}getRenderedQualityEvidence(){return this.renderer?.getRenderedQualityEvidence()??null}focusSection(e){this.handleSectionTap(e)}getSectionSeatCount(e){return this.renderer?.sectionMembers?.(e)?.length??0}overview(){this.renderer?.clearSectionFocus?.(),this.renderer?.zoomToFit(),this.opts.onSectionFocus?.(null)}handleSectionTap(e){let t=this.renderer;if(t){if(t.focusSection?t.focusSection(e):t.focusRegion?.(e),this.isSectionClosed(e)){this.opts.onSectionFocus?.(null);return}this.opts.onSectionFocus?.(this.sectionSummary(e))}}sectionSummary(e){let t=this.renderer,i=this._doc;if(!t||!i)return null;let o=i.objects.find(y=>y.type==="section"&&y.id===e);if(!o)return null;let n=t.sectionMembers?.(e)??[],r=new Map,a=new Set,l=0;for(let y of n){let p=this.seatById.get(y);if(!p)continue;let f=this.groupedTableBySeatId.get(y);if(f){if(a.has(f.label))continue;a.add(f.label),r.set(f.categoryKey,(r.get(f.categoryKey)??0)+f.maxOccupancy),t.getStatus(f.chairs[0]?.id??y)==="free"&&(l+=f.maxOccupancy)}else r.set(p.categoryKey,(r.get(p.categoryKey)??0)+1),t.getStatus(y)==="free"&&l++}let c=[...r.entries()].map(([y,p])=>{let f=i.categories.find(k=>k.key===y),b=f?.tiers?.length?f.tiers.map(k=>k.price):[f?.price??0],g=Math.min(...b),v=Math.max(...b);return{key:y,count:p,label:f?.label??y,color:f?.color??"#6e7bff",price:g,priceMin:g,priceMax:v}}).sort((y,p)=>y.price-p.price),h=c.map(y=>y.priceMin),u=c.map(y=>y.priceMax),d=o.zone?i.zones?.find(y=>y.id===o.zone):void 0,m=o.color??d?.color??c[0]?.color??"#6e7bff";return{id:e,label:o.displayLabel??o.label,zoneLabel:d?.label??"",...o.entrance&&o.entrance.trim()?{entrance:o.entrance.trim()}:{},color:m,seatsLeft:l,priceMin:h.length?Math.min(...h):0,priceMax:u.length?Math.max(...u):0,categories:c}}destroy(){if(this.closed=!0,this.detachVisibilityListener(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.expiryTimer&&(clearTimeout(this.expiryTimer),this.expiryTimer=null),this.realtime){try{this.realtime.stop()}catch{}this.realtime=null}if(this.ws){try{this.ws.close()}catch{}this.ws=null}this.renderer?.destroy(),this.renderer=null}toSeat(e){let t=this.groupedTableBySeatId.get(e.id);if(t)return this.toTableSeat(t);let i=e.commercial?{commercial:e.commercial}:void 0,o=e.displayLabel?{displayLabel:e.displayLabel}:void 0,n=e.accessibility?.length?{accessibility:e.accessibility}:void 0,r=e.wheelchairSpaceType?{wheelchairSpaceType:e.wheelchairSpaceType}:void 0,a=this.seatContext.get(e.id),l=this.tiersForSeat(e),c=this.seatTierResolution(e);if(c.kind!=="resolved"||!l)return{id:e.id,label:e.label,...o,...a,categoryKey:e.categoryKey,price:this.priceFor(e.categoryKey),currency:this.currency,...i,...n,...r};let h=c.tier;return{id:e.id,label:e.label,...o,...a,categoryKey:e.categoryKey,price:h.price,currency:this.currency,tiers:l,tierId:h.id,...i,...n,...r}}toTableSeat(e){let t=e.chairs[0],i=this.tiersFor(e.categoryKey)?.filter(r=>pt(this._doc,this.tableTierSeat(e),r.id).kind==="resolved"),o=this.tableTierResolution(e),n=o.kind==="resolved"?o.tier:void 0;return{id:t?.id??e.objectId,label:e.label,displayLabel:e.displayLabel??e.label,...e.displayType?{displayType:e.displayType,rowType:e.displayType}:{},objectId:e.objectId,sectionLabel:t?this.seatContext.get(t.id)?.sectionLabel:void 0,rowLabel:e.displayLabel??e.label,categoryKey:e.categoryKey,price:n?.price??this.priceFor(e.categoryKey),currency:this.currency,...i?{tiers:i,tierId:n?.id}:{},objectType:"table",bookingMode:e.mode,quantity:this.tableQuantities.get(e.label)??(e.mode==="whole"?e.capacity:e.minOccupancy),capacity:e.capacity,minOccupancy:e.minOccupancy,maxOccupancy:e.maxOccupancy,physicalSeatIds:e.chairs.map(r=>r.id)}}describeSeat(e){let t=this._doc?.categories.find(i=>i.key===e.categoryKey);return{...this.toSeat(e),categoryLabel:t?.label??e.categoryKey,categoryColor:t?.color??"#6e7bff",status:this.renderer?.getStatus(e.id)??"free",currency:this.currency,...this.seatContext.get(e.id)}}priceFor(e){return this._doc?.categories.find(t=>t.key===e)?.price??0}tiersFor(e){let t=this._doc?.categories.find(i=>i.key===e)?.tiers;return t&&t.length?t:void 0}tiersForSeat(e){if(!this._doc)return;let t=Vi(this._doc,e);return t.length?t:void 0}seatTierResolution(e){return this._doc?pt(this._doc,e,this.seatTiers.get(e.id)):{kind:"none"}}tableTierSeat(e){return{label:e.label,categoryKey:e.categoryKey,accessibility:e.chairs.flatMap(t=>t.accessibility??[])}}tableTierResolution(e){if(!this._doc)return{kind:"none"};let t=e.chairs[0]?.id??"";return pt(this._doc,this.tableTierSeat(e),this.seatTiers.get(t))}setSeatTier(e,t){let i=this.seatById.get(e);if(!i)return;let o=this.tiersForSeat(i);if(o){if(t==null)this.seatTiers.delete(e);else if(o.some(n=>n.id===t))this.seatTiers.set(e,t);else return;this.emitSelectionChange(),this.hold_&&(this.hold_={...this.hold_,seats:this.seatsForLabels(this.hold_.labels)})}}seatsForLabels(e){let t=[];for(let i of e){let o=this.labelToSeat.get(i);o&&t.push(this.toSeat(o))}return t}emitSelectionChange(){let e=this.getSelection();this.opts.onSelectionChange?.(e),this.emitSelectionValidity(),this.emitOrphanHint()}emitSelectionValidity(){let e=this.getSelectionValidity();e&&(this.opts.onSelectionValidityChange?.(e),e.isValid?this.lastSelectionValidity!==!0&&this.opts.onSelectionValid?.(e.seats):this.lastSelectionValidity!==!1&&this.opts.onSelectionInvalid?.(e),this.lastSelectionValidity=e.isValid)}ticketIssue(e){if(!this._doc)return null;let t=e?this.seatsForLabels(e):this.getSelection();return Ni(this._doc,t.map(i=>({label:i.label,...i.tierId?{tierId:i.tierId}:{}})))}emitOrphanHint(){if(!this.opts.onHint)return;let e=this.renderer;if(!e)return;let t=this.ticketIssue();if(t){this.hintShown=!0,this.opts.onHint(t.code==="companion_pair_required"?oe("picker.companionPairRequired"):"That ticket choice is not available for the selected seat.");return}let i=new Set(e.getSelection().map(n=>n.id));(i.size?Wt(this.seatById.values(),n=>e.getStatus(n),i):[]).length>0?(this.hintShown=!0,this.opts.onHint(oe("picker.orphanHint"))):this.hintShown&&(this.hintShown=!1,this.opts.onHint(null))}setColorblindSafe(e){this.renderer?.setColorblindSafe?.(e)}emitError(e){this.opts.onError?this.opts.onError(e):console.error("[picker]",e)}holdCovers(e){let t=this.hold_;if(!t||t.labels.length!==e.length||!e.every(n=>t.labels.includes(n)))return!1;let i=new Map((t.items??[]).map(n=>[n.label,n.tierId])),o=new Map((t.items??[]).map(n=>[n.label,n.quantity??1]));return e.every(n=>{let r=this.labelToSeat.get(n),a=r?this.toSeat(r):null,l=a?.tierId??null;return(a?.objectType!=="table"||(a.bookingMode!=="variable"||this.confirmedVariableTables.has(n))&&(!o.has(n)||o.get(n)===a.quantity))&&(!i.has(n)||i.get(n)===l)})}handle409Conflicts(e){let{status:t,conflicts:i}=Pt(e);if(t!==409||!i?.length)return;let o=this.renderer;if(!o)return;let n=this.idsForLabels(i.map(r=>r.label));n.length&&(o.deselect(n),o.setStatus(n,"held"),this.resetTableQuantitiesForLabels(i.map(r=>r.label))),this.emitSelectionChange()}setHold(e,t="created"){for(let n of e.items??[])this.groupedTablesByLabel.has(n.label)&&n.quantity!=null&&(this.tableQuantities.set(n.label,n.quantity),this.groupedTablesByLabel.get(n.label)?.mode==="variable"&&this.confirmedVariableTables.add(n.label));let i={...e,seats:this.seatsForLabels(e.labels)};this.hold_=i,this.renderer?.setOwnedHold?.(this.idsForLabels(i.labels)),this.expiryTimer&&clearTimeout(this.expiryTimer);let o=Math.max(0,i.expiresAt-Date.now());this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},o),t==="restored"?this.opts.onHoldRestored?.(i):this.opts.onHold?.(i)}clearHold(){this.hold_=null,this.renderer?.setOwnedHold?.(null),this.expiryTimer&&(clearTimeout(this.expiryTimer),this.expiryTimer=null)}async expireActiveHold(){let e=this.hold_;if(e){try{let t=await this.api.objects(this.key);if(this.hold_?.holdId!==e.holdId)return;this.applySeatsMap(t.seats,t.default??"free")}catch{this.hold_?.holdId===e.holdId&&(this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},2e3));return}if(this.hold_?.holdId===e.holdId){if(e.labels.some(t=>this.statusOf(t)==="held")){this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},1e3);return}this.clearHold(),this.opts.onHoldExpired?.()}}}applySeatsMap(e,t="free"){let i=this.renderer;if(!i)return;this.liveStatuses=new Map(Object.entries(e)),this.liveDefault=t;let o=ni(t);this.allIds.length&&i.setStatus(this.allIds,o),i.setOwnedHold?.(this.idsForLabels(this.hold_?.labels??[]));let n={free:[],held:[],booked:[],not_for_sale:[]};for(let[a,l]of Object.entries(e))n[ni(l)].push(...this.idsForLabel(a));["free","held","booked","not_for_sale"].forEach(a=>{a!==o&&n[a].length&&i.setStatus(n[a],a)});let r=this.notForSaleCategorySeatIds();r.length&&i.setStatus(r,"not_for_sale"),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.()}statusOf(e){return this.liveStatuses.get(e)??this.liveDefault}clearBookedHoldIfSettled(){let e=this.hold_;e?.labels.every(t=>this.statusOf(t)==="booked")&&(this.clearHold(),this.resetTableQuantitiesForLabels(e.labels))}async resnapshot(){try{let e=await this.api.objects(this.key);this.applySeatsMap(e.seats,e.default??"free")}catch{}}async refresh(){await this.resnapshot()}attachVisibilityListener(){if(this.onVisibilityChange||typeof document>"u"||typeof document.addEventListener!="function")return;let e=()=>{this.closed||document.visibilityState==="visible"&&this.resnapshot().then(()=>{this.closed||this.renderer?.forceDraw()})};this.onVisibilityChange=e,document.addEventListener("visibilitychange",e)}detachVisibilityListener(){this.onVisibilityChange&&(typeof document<"u"&&typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",this.onVisibilityChange),this.onVisibilityChange=null)}realtimeSink(){return{applyStatuses:e=>this.applyStatusChanges(e),applyProjection:e=>this.applySeatsMap(e.exceptions,e.default),resync:()=>this.resnapshot(),onSections:(e,t)=>{let i=this.syncHidden(e),o=this.syncClosed(t);i&&this.resnapshot(),(i||o)&&this.opts.onStatusChange?.()}}}applyStatusChanges(e){let t=this.renderer;if(t){for(let i of e){this.liveStatuses.set(i.label,i.status);let o=this.idsForLabel(i.label);if(!o.length)continue;let n=ni(i.status);this.opts.flashOnLiveChange&&n!=="free"&&o.some(r=>t.getStatus(r)==="free")&&!this.hold_?.labels.includes(i.label)&&o.forEach(r=>t.flashSeat(r,n==="held"?"#f4b740":"#f43f5e")),t.setStatus(o,n)}this.opts.keepLiveWhileHidden&&typeof document<"u"&&document.visibilityState==="hidden"&&t.forceDraw(),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.()}}connect(){if(this.closed)return;let e=this.api.socketUrl(this.key);if(!e)return;if(!this.realtime&&this.api.createRealtime){let i=null;try{i=this.api.createRealtime(this.key,this.realtimeSink())}catch{i=null}if(i){this.realtime=i,i.start();return}}if(this.realtime)return;let t;try{let i=this.api.socketProtocols?.(this.key);t=i&&i.length?new WebSocket(e,i):new WebSocket(e)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.attempt=0,this.resnapshot()},t.onmessage=i=>{let o;try{o=JSON.parse(typeof i.data=="string"?i.data:"")}catch{return}if(!this.renderer||!o||typeof o!="object")return;let r=o;Array.isArray(r.hidden)&&this.syncHidden(r.hidden)&&(this.resnapshot(),this.opts.onStatusChange?.()),Array.isArray(r.closed)&&this.syncClosed(r.closed)&&this.opts.onStatusChange?.(),r.type!=="hidden"&&(r.seats&&typeof r.seats=="object"?this.applySeatsMap(r.seats):Array.isArray(r.changes)&&this.applyStatusChanges(r.changes))},t.onclose=()=>{this.ws===t&&(this.ws=null),this.scheduleReconnect()},t.onerror=()=>{try{t.close()}catch{}}}scheduleReconnect(){if(this.closed||this.reconnectTimer)return;let e=Math.min(this.attempt++,5),t=Xs(e,{baseMs:1e3,maxMs:Yo,jitter:1});this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}};var Zo=5,Qo=-1.1,ri=35;function ai(s,e){let t=s-q,i=Math.atan2(Zo-t,e)*180/Math.PI,o=Math.atan2(Qo-t,e)*180/Math.PI;return o<-ri&&(i+=-ri-o,o=-ri),{topPitch:i,basePitch:o}}var K=2048,ae=1024,it=mi,E=Math.PI*2,jo=ae/180,_e=s=>(s+180)/360*K,_=s=>(90-s)/180*ae;function io(s){let e=2166136261;for(let t=0;t<s.length;t++)e^=s.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function so(s){let e=s>>>0;return()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}var xt=96,hi=360/xt,Jo=.6,li=[17,23,42];function ci(s,e,t=1){let i=Math.max(0,Math.min(.58,e)),o=Math.round(s[0]+(li[0]-s[0])*i),n=Math.round(s[1]+(li[1]-s[1])*i),r=Math.round(s[2]+(li[2]-s[2])*i);return`rgba(${o},${n},${r},${t})`}function js(s,e,t){return[Math.round(s[0]+(e[0]-s[0])*t),Math.round(s[1]+(e[1]-s[1])*t),Math.round(s[2]+(e[2]-s[2])*t)]}function Z(s,e,t){let i=(1-Math.abs(2*t-1))*e,o=(s%360+360)%360/60,n=i*(1-Math.abs(o%2-1)),r=0,a=0,l=0;o<1?[r,a,l]=[i,n,0]:o<2?[r,a,l]=[n,i,0]:o<3?[r,a,l]=[0,i,n]:o<4?[r,a,l]=[0,n,i]:o<5?[r,a,l]=[n,0,i]:[r,a,l]=[i,0,n];let c=t-i/2;return[Math.round((r+c)*255),Math.round((a+c)*255),Math.round((l+c)*255)]}var Js=new Map;function eo(s){if(!s)return null;let e=Js.get(s);if(e)return e;let t=2166136261;for(let n=0;n<s.length;n++)t^=s.charCodeAt(n),t=Math.imul(t,16777619);let i=(t>>>0)%360,o=Z(i,.3,.42);return Js.set(s,o),o}function en(s,e,t,i){let o=new Array(xt).fill(null),n=0,r=s.sectionId;for(let a of e){if(a.id===s.id)continue;let l=a.sectionId;if(!l||r&&l===r)continue;let c=a.x-s.x,h=a.y-s.y,u=Math.hypot(c,h)*it;if(u<1.5||u>95)continue;let d=a.eyeHeightM??q,m=d-i;Math.abs(m)>n&&(n=Math.abs(m));let y=Math.atan2(m,u)*180/Math.PI,p=Math.atan2(d-q-i,u)*180/Math.PI,b=((Math.atan2(c,-h)-t)*180/Math.PI+540)%360-180,g=Math.min(xt-1,Math.max(0,Math.floor((b+180)/hi))),v=y>34&&u<16,k=o[g];k?(y>k.top&&(k.top=y),p<k.base&&(k.base=p),u<k.nearM&&(k.nearM=u,k.tint=eo(a.categoryKey)),k.overhead=k.overhead||v):o[g]={top:y,base:p,nearM:u,overhead:v,tint:eo(a.categoryKey)}}return{bins:o,maxDelta:n}}function tn(s,e,t,i){for(let o=0;o<xt;o++){let n=e[o];if(!n)continue;let r=-180+o*hi,a=t(r),l=t(r+hi);if(!(l>a))continue;let c=Math.min(72,n.top),h=Math.min(n.base,-4),u=i(c),d=i(h);if(d<=u)continue;let m=n.nearM/95,y=n.tint,p=y?js([44,54,80],y,.34):[44,54,80],f=y?js([24,30,48],y,.28):[24,30,48],b=s.createLinearGradient(0,u,0,d);b.addColorStop(0,ci(p,m)),b.addColorStop(.24,ci(f,m)),b.addColorStop(1,ci([10,13,22],m)),s.fillStyle=b,s.fillRect(a,u,l-a+1,d-u),s.fillStyle=`rgba(150,165,205,${.35*(1-m*.55)})`,s.fillRect(a,u,l-a+1,1.5);let v=Math.min(d,i(0))-u;if(v>8){let L=1-m*.4;for(let S=1;S<6;S++){let w=u+v*S/6;s.fillStyle=`rgba(0,0,0,${.16*L})`,s.fillRect(a,w,l-a+1,1.5),s.fillStyle=`rgba(120,134,170,${.1*L})`,s.fillRect(a,w+1.5,l-a+1,1.2)}}if(n.overhead){let k=i(Math.min(86,c+12)),L=s.createLinearGradient(0,k,0,u);L.addColorStop(0,"rgba(3,4,8,0.9)"),L.addColorStop(1,"rgba(3,4,8,0)"),s.fillStyle=L,s.fillRect(a,k,l-a+1,u-k),s.fillStyle="rgba(120,130,160,0.14)",s.fillRect(a,u-1.5,l-a+1,1.5)}}}function sn(s,e,t){let o=new Array(72).fill(!1),n=new Array(72).fill(1/0),r=new Set,a=0;for(let b of t){a++,b.sectionId&&r.add(b.sectionId);let g=b.x-e.x,v=b.y-e.y,k=Math.hypot(g,v)*it;if(k<.5)continue;let L=Math.atan2(g,-v),S=Math.floor((L+Math.PI)/E*72);S<0?S=0:S>=72&&(S=71),o[S]=!0,k<n[S]&&(n[S]=k)}let l=0,c=[];for(let b=0;b<72;b++)o[b]&&(l++,c.push(n[b]));let h=l/72*360;c.sort((b,g)=>b-g);let u=c.length?c[c.length>>1]:0,d=c.length?c[Math.floor(c.length*.15)]??u:0,m=c.length?c[Math.floor(c.length*.85)]??u:0,y=d>.5?m/d:1,p=io(`${a}|${[...r].sort().join(",")}|${Math.round(e.x)},${Math.round(e.y)}`),f;return h>=300&&u>11&&y>1.35?f="sport":h>=285?f="arena":f="proscenium",{mode:f,seed:p,voidRadiusM:u,aspect:y}}var on=5;function nn(s,e,t){switch(t){case 1:s.beginPath(),s.ellipse(0,-e*.14,e*1.16,e*1.16,0,0,E),s.fill();break;case 2:s.beginPath(),s.ellipse(0,-e*1.02,e*.42,e*.42,0,0,E),s.fill(),s.beginPath(),s.ellipse(0,-e*.2,e*.98,e*1.02,0,0,E),s.fill();break;case 3:s.beginPath(),s.ellipse(0,-e*.36,e*1.04,e*.6,0,Math.PI,E),s.fill(),s.beginPath(),s.ellipse(0,-e*.52,e*1.22,e*.24,0,0,E),s.fill();break;case 4:s.beginPath(),s.ellipse(-e*.66,e*.5,e*.5,e*1.35,0,0,E),s.fill(),s.beginPath(),s.ellipse(e*.66,e*.5,e*.5,e*1.35,0,0,E),s.fill(),s.beginPath(),s.ellipse(0,-e*.08,e*1.06,e*1.08,0,0,E),s.fill();break;default:break}}function rn(s,e,t,i,o){let n=i*.44,r=i*o.shoulderK,a=i*.66,l=i*1.68,c=i*5.4,h=`rgba(${o.clothing[0]},${o.clothing[1]},${o.clothing[2]},${o.alpha})`,u=`rgba(${o.tone[0]},${o.tone[1]},${o.tone[2]},${o.alpha})`;s.save(),s.translate(e,t);let d=o.lean*i;s.fillStyle=h,s.beginPath(),s.moveTo(-n,a),s.quadraticCurveTo(-n*1.18,l-d-i*.6,-r,l-d),s.quadraticCurveTo(-r*1.05,l+i*1.2,-r*.94,c),s.lineTo(r*.94,c),s.quadraticCurveTo(r*1.05,l+i*1.2,r,l+d),s.quadraticCurveTo(n*1.18,l+d-i*.6,n,a),s.closePath(),s.fill(),s.fillStyle=u,s.fillRect(-n*.82,i*.5,n*1.64,i*.9),s.save(),s.rotate(o.tilt),s.translate(o.turn*i,0),s.fillStyle=u,i>=18?(s.beginPath(),s.moveTo(-i*.9,-i*.15),s.quadraticCurveTo(-i*.96,-i*1.12,0,-i*1.06),s.quadraticCurveTo(i*.96,-i*1.12,i*.9,-i*.15),s.quadraticCurveTo(i*.86,i*.55,i*.36,i*.98),s.quadraticCurveTo(0,i*1.14,-i*.36,i*.98),s.quadraticCurveTo(-i*.86,i*.55,-i*.9,-i*.15),s.closePath(),s.fill(),i>=22&&(s.beginPath(),s.ellipse(-i*.9,i*.18,i*.13,i*.22,0,0,E),s.ellipse(i*.9,i*.18,i*.13,i*.22,0,0,E),s.fill())):(s.beginPath(),s.ellipse(0,0,i*.9,i*1.06,0,0,E),s.fill()),nn(s,i,o.hair),o.rim>.01&&(s.strokeStyle=`rgba(245,205,150,${(.5*o.rim).toFixed(3)})`,s.lineWidth=Math.max(1,i*.14),s.beginPath(),s.ellipse(0,-i*.06,i*.86,i*1,0,Math.PI*1.12,Math.PI*1.9),s.stroke()),s.restore(),o.rim>.01&&(s.strokeStyle=`rgba(240,200,150,${(.28*o.rim).toFixed(3)})`,s.lineWidth=Math.max(1,i*.12),s.beginPath(),s.moveTo(-r*.8,l-i*.05),s.quadraticCurveTo(-n,l-i*.75,0,l-i*.82),s.quadraticCurveTo(n,l-i*.75,r*.8,l-i*.05),s.stroke()),s.restore()}function an(s,e,t,i,o,n,r){s.fillStyle=`rgba(${o[0]},${o[1]},${o[2]},${r})`,s.beginPath(),s.moveTo(e-i*1.72,t+i*4),s.quadraticCurveTo(e-i*1.78,t+i*1.55,e-i*.46,t+i*1.02),s.lineTo(e-i*.4,t+i*.62),s.lineTo(e+i*.4,t+i*.62),s.lineTo(e+i*.46,t+i*1.02),s.quadraticCurveTo(e+i*1.78,t+i*1.55,e+i*1.72,t+i*4),s.closePath(),s.fill(),s.fillStyle=`rgba(${n[0]},${n[1]},${n[2]},${r})`,s.beginPath(),s.ellipse(e,t,i*.9,i*1.05,0,0,E),s.fill()}function pi(s,e,t,i,o){let n=i*.1,r=t-i*.9,a=t-i*.74,l=t-i*.46,c=i*.13,h=i*.09,u=`rgba(${o.tone[0]},${o.tone[1]},${o.tone[2]},${o.alpha})`,d=s.createRadialGradient(e,t,1,e,t,i*.24);d.addColorStop(0,"rgba(0,0,0,0.4)"),d.addColorStop(1,"rgba(0,0,0,0)"),s.save(),s.scale(1,.28),s.fillStyle=d,s.beginPath(),s.ellipse(e,t/.28,i*.24,i*.24,0,0,E),s.fill(),s.restore(),s.fillStyle=u,s.beginPath(),s.moveTo(e-h,l),s.lineTo(e-h*.7,t),s.lineTo(e-h*.1,t),s.lineTo(e-h*.1,l+i*.02),s.lineTo(e+h*.1,l+i*.02),s.lineTo(e+h*.1,t),s.lineTo(e+h*.7,t),s.lineTo(e+h,l),s.closePath(),s.fill(),s.beginPath(),s.moveTo(e-c,a),s.quadraticCurveTo(e-c*.9,l-i*.12,e-h,l),s.lineTo(e+h,l),s.quadraticCurveTo(e+c*.9,l-i*.12,e+c,a),s.quadraticCurveTo(e,a-i*.05,e-c,a),s.closePath(),s.fill(),s.lineCap="round",s.lineJoin="round",s.strokeStyle=u,s.lineWidth=i*.055;let m=a+i*.02;o.pose===1?(s.beginPath(),s.moveTo(e-c*.8,m),s.lineTo(e-c*1.5,t-i*1.02),s.moveTo(e+c*.8,m),s.lineTo(e+c*1.5,t-i*1.02),s.stroke()):o.pose===2?(s.beginPath(),s.moveTo(e-c*.8,m),s.lineTo(e+h*1.4,l-i*.02),s.moveTo(e+c*.8,m),s.lineTo(e-h*.4,l-i*.06),s.stroke(),s.fillStyle=u,s.beginPath(),s.ellipse(e+h*1.5,l-i*.04,i*.07,i*.09,-.5,0,E),s.fill()):o.pose===3?(s.beginPath(),s.moveTo(e-c*.8,m),s.lineTo(e-c*.2,r+n*.6),s.moveTo(e+c*.8,m),s.lineTo(e+c*1.1,l),s.stroke(),s.lineWidth=i*.02,s.beginPath(),s.moveTo(e-c*.2,r+n*.9),s.lineTo(e-c*.2,t-i*.02),s.stroke()):(s.beginPath(),s.moveTo(e-c*.85,m),s.lineTo(e-c*.95,l+i*.02),s.moveTo(e+c*.85,m),s.lineTo(e+c*.95,l+i*.02),s.stroke()),s.fillStyle=u,s.fillRect(e-n*.34,r+n*.6,n*.68,n*.9),s.beginPath(),s.ellipse(e,r,n*.86,n*1.05,0,0,E),s.fill(),o.rimStrength>.01&&(s.strokeStyle=`rgba(${o.rim[0]},${o.rim[1]},${o.rim[2]},${(.6*o.rimStrength).toFixed(3)})`,s.lineWidth=Math.max(1,i*.02),s.beginPath(),s.moveTo(e-c,a),s.lineTo(e-n*.6,r+n*.4),s.moveTo(e-n*.7,r),s.ellipse(e,r,n*.84,n*1.02,0,Math.PI*1.05,Math.PI*1.55),s.stroke())}function Rt(s,e,t,i,o,n,r,a,l){s.save(),s.globalCompositeOperation="lighter";let c=s.createLinearGradient(0,t,0,o);c.addColorStop(0,`rgba(${a},${l})`),c.addColorStop(.5,`rgba(${a},${(l*.4).toFixed(3)})`),c.addColorStop(1,`rgba(${a},0)`),s.fillStyle=c,s.beginPath(),s.moveTo(e-n,t),s.lineTo(i-r,o),s.lineTo(i+r,o),s.lineTo(e+n,t),s.closePath(),s.fill(),s.restore()}function ui(s,e,t,i,o){let n=s.createRadialGradient(e,t,0,e,t,i*3);n.addColorStop(0,`rgba(${o},0.9)`),n.addColorStop(.4,`rgba(${o},0.35)`),n.addColorStop(1,`rgba(${o},0)`),s.fillStyle=n,s.beginPath(),s.arc(e,t,i*3,0,E),s.fill(),s.fillStyle=`rgba(${o},1)`,s.beginPath(),s.arc(e,t,i,0,E),s.fill()}function Al(s,e,t){let i=document.createElement("canvas");i.width=K,i.height=ae;let o=i.getContext("2d"),n=e.x-s.x,r=e.y-s.y,a=Math.hypot(n,r),l=Math.max(2,a*it),c=s.eyeHeightM??q,h=sn(s,e,t),u=so(h.seed),d=210+u()*150,m=Z(220+(u()-.5)*60,.55,.82),y=`${m[0]},${m[1]},${m[2]}`,p=o.createLinearGradient(0,0,0,ae);p.addColorStop(0,"#080b12"),p.addColorStop(.42,"#12182c"),p.addColorStop(.5,"#1c2440"),p.addColorStop(.56,"#151b2c"),p.addColorStop(.78,"#171e30"),p.addColorStop(1,"#131829"),o.fillStyle=p,o.fillRect(0,0,K,ae);let f=o.createLinearGradient(0,_(-6),0,ae);f.addColorStop(0,"rgba(30, 37, 56, 0)"),f.addColorStop(.55,"rgba(30, 37, 56, 0.22)"),f.addColorStop(1,"rgba(22, 28, 44, 0.12)"),o.fillStyle=f,o.fillRect(0,_(-6),K,ae-_(-6));let b=Math.atan2(n,-r),g=en(s,t,b,c),v=g.maxDelta>=Jo;v&&tn(o,g.bins,_e,_);let k=Math.max(.3,Math.min(1,1-(l-6)/60)),L=ai(c,l),S=Math.min(80,Math.atan2(4,l)*180/Math.PI),w=Math.min(45,L.topPitch),x=L.basePitch;h.mode==="sport"?hn(o,l,c,h,k,d,y,u):h.mode==="arena"?cn(o,l,c,h,k,y,u):ln(o,S,w,x,k,d,y,u);let I=h.mode==="sport"?34:24+Math.floor(u()*8);o.fillStyle=`rgba(${y},0.8)`;for(let P=0;P<I;P++){let C=(P+.5)/I*K,M=_(h.mode==="sport"?58:54+P*7%3*6);o.beginPath(),o.arc(C,M,h.mode==="sport"?2.6:3.2,0,E),o.fill()}dn(o,s,t,e,b,c,n,r,v,h);let T=o.createLinearGradient(0,0,0,ae);return T.addColorStop(0,"rgba(0,0,0,0.85)"),T.addColorStop(.12,"rgba(0,0,0,0)"),T.addColorStop(.9,"rgba(0,0,0,0)"),T.addColorStop(1,"rgba(0,0,0,0.55)"),o.fillStyle=T,o.fillRect(0,0,K,ae),{url:i.toDataURL("image/jpeg",.82),distanceM:Math.round(l)}}function ln(s,e,t,i,o,n,r,a){let l=_e(-e),c=_e(e),h=_(t),u=_(i),d=c-l,m=u-h,y=_(Math.min(50,t+10)),p=d*(1.1+(1-o)*.5),f=s.createRadialGradient(K/2,(h+u)/2,8,K/2,(h+u)/2,p);f.addColorStop(0,"rgba(255, 214, 150, 0.34)"),f.addColorStop(.28,"rgba(150, 150, 230, 0.3)"),f.addColorStop(.6,"rgba(99, 102, 241, 0.12)"),f.addColorStop(1,"rgba(99, 102, 241, 0)"),s.fillStyle=f,s.fillRect(l-d*.6,h-m*1.2,d*2.2,m*3.4);let b=Z(n,.62,.55),g=Z(n+40,.7,.5),v=Z(n+70,.78,.52);s.save(),s.beginPath(),s.rect(l,h,d,m),s.clip();let k=s.createLinearGradient(0,h,0,u);k.addColorStop(0,`rgb(${b[0]},${b[1]},${b[2]})`),k.addColorStop(.5,`rgb(${g[0]},${g[1]},${g[2]})`),k.addColorStop(1,`rgb(${v[0]},${v[1]},${v[2]})`),s.globalAlpha=.8,s.fillStyle=k,s.fillRect(l,h,d,m),s.globalAlpha=1;let L=s.createRadialGradient(K/2,(h+u)/2,d*.12,K/2,(h+u)/2,d*.62);L.addColorStop(0,"rgba(6,8,14,0)"),L.addColorStop(.7,"rgba(6,8,14,0.15)"),L.addColorStop(1,"rgba(5,6,11,0.92)"),s.fillStyle=L,s.fillRect(l,h,d,m),s.restore();let S=3+Math.floor(a()*3),w=m*.46,x=u-m*.08;for(let B=0;B<S;B++){let W=(B+1)/(S+1),G=l+d*(.22+W*.56+(a()-.5)*.06);pi(s,G,x,w*(.9+a()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(a()*4),rim:Z(n+20,.5,.7),rimStrength:.7})}s.fillStyle="#05070d",s.fillRect(l-d*.5,y,d*.5,u-y),s.fillRect(c,y,d*.5,u-y);let I=d*.055+3,T=I*1.35;s.fillStyle="#03050a",s.beginPath(),s.moveTo(l,u),s.lineTo(l-I,u),s.lineTo(l-T,y),s.lineTo(l+d*.012,y),s.closePath(),s.fill(),s.beginPath(),s.moveTo(c,u),s.lineTo(c+I,u),s.lineTo(c+T,y),s.lineTo(c-d*.012,y),s.closePath(),s.fill(),s.fillRect(l-T,y,d+T*2,(u-y)*.12);let P=m*.14,C=y+(u-y)*.12;s.fillStyle="rgba(4,6,12,0.96)";let M=7;s.beginPath(),s.moveTo(l-T,C);for(let B=0;B<=M;B++){let W=l-T+(d+T*2)*B/M;s.quadraticCurveTo(W-(d+T*2)/M/2,C+P,W,C)}s.lineTo(c+T,C),s.lineTo(c+T,y),s.lineTo(l-T,y),s.closePath(),s.fill(),s.fillStyle=`rgba(${r},0.12)`,s.fillRect(l-1.5,C,1.5,u-C),s.fillRect(c,C,1.5,u-C),s.fillStyle="#0b0f18",s.fillRect(l-I,u-m*.05,d+I*2,m*.05+3);let R=s.createLinearGradient(0,u-m*.05,0,u+m*.12);R.addColorStop(0,`rgba(255,206,140,${(.5*o).toFixed(3)})`),R.addColorStop(1,"rgba(255,206,140,0)"),s.fillStyle=R,s.fillRect(l-I,u-m*.05,d+I*2,m*.2);let A=3+Math.floor(a()*2);for(let B=0;B<A;B++){let W=(B+1)/(A+1),G=l+d*(W+(a()-.5)*.08),H=_(Math.min(62,t+26)),X=(a()-.5)*d*.16;Rt(s,G,H,G+X,u,4,d*.09,r,.16*(.7+o*.5)),ui(s,G,H,2.4,r)}}function cn(s,e,t,i,o,n,r){let a=Math.min(e*.6,Math.max(3,i.voidRadiusM)),l=Math.min(55,Math.atan2(a,e)*180/Math.PI),c=K/2,h=1.2,u=Math.max(e*.45,e-a),d=e+a,m=Math.atan2(h-t,u)*180/Math.PI,y=Math.atan2(h-t,d)*180/Math.PI,p=Math.atan2(-t,u)*180/Math.PI,f=_(m),b=_(y),g=_(p),v=_e(l)-c,k=Math.max(6,(f-b)/2),L=(f+b)/2,S=s.createRadialGradient(c,g,4,c,g,v*2.6);S.addColorStop(0,`rgba(255,206,150,${(.2*o).toFixed(3)})`),S.addColorStop(.5,"rgba(150,140,190,0.08)"),S.addColorStop(1,"rgba(40,44,60,0)"),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=S,s.fillRect(c-v*2.6,b-k,v*5.2,g-b+k+40),s.restore(),s.fillStyle="#0c1019",s.beginPath(),s.moveTo(c-v,L),s.ellipse(c,L,v,k,0,Math.PI,0,!1),s.lineTo(c+v,g),s.ellipse(c,g,v,k,0,0,Math.PI,!1),s.closePath(),s.fill();let w=s.createLinearGradient(0,L,0,g);w.addColorStop(0,`rgba(${n},0.14)`),w.addColorStop(1,"rgba(0,0,0,0)"),s.fillStyle=w,s.fillRect(c-v,L,v*2,g-L);let x=[[{u:-.24,v:.4,lead:!0,pose:3},{u:.34,v:-.04,pose:2},{u:-.52,v:-.38,pose:0}],[{u:.2,v:.34,lead:!0,pose:3},{u:-.3,v:-.08,pose:2}],[{u:-.1,v:.28,lead:!0,pose:1},{u:.44,v:-.2,pose:2},{u:-.46,v:-.14,pose:2},{u:.08,v:-.46,pose:0}]],I=x[Math.floor(r()*x.length)],T=r()<.5?-1:1,P=F=>c+F.u*T*v*.84,C=F=>L+F.v*k*.8,M=I.find(F=>F.lead)??I[0],R=P(M),A=s.createLinearGradient(0,L-k,0,L+k);A.addColorStop(0,"#3d4a72"),A.addColorStop(1,"#232b47"),s.fillStyle=A,s.beginPath(),s.ellipse(c,L,v,k,0,0,E),s.fill();let B=s.createRadialGradient(R,L,2,R,L,v);B.addColorStop(0,`rgba(255,214,160,${(.5*o).toFixed(3)})`),B.addColorStop(1,"rgba(255,214,160,0)"),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=B,s.beginPath(),s.ellipse(c,L,v,k,0,0,E),s.fill(),s.restore(),s.strokeStyle=`rgba(${n},0.7)`,s.lineWidth=2,s.beginPath(),s.ellipse(c,L,v,k,0,0,E),s.stroke();let W=Math.max(24,(g-b)*1.3),G=I.length>=3?3:2;for(let F=0;F<G;F++){let le=(-.62+F*.52+(r()-.5)*.12)*-T,be=c+le*v*.7,Ge=L-k*(.45+r()*.18),Te=v*(.07+r()*.04),Dt=W*(.26+r()*.12);s.fillStyle="#0a0e18",s.fillRect(be-Te/2,Ge-Dt,Te,Dt),s.fillStyle=`rgba(${n},0.3)`,s.fillRect(be-Te/2,Ge-Dt,Te,1.5)}if(I.length>=3){let F=c-M.u*T*v*.4;s.fillStyle="#0b0f1a",s.beginPath(),s.ellipse(F,L-k*.34,v*.08,k*.1,0,0,E),s.fill(),s.strokeStyle=`rgba(${n},0.35)`,s.lineWidth=1,s.stroke()}for(let F of[...I].sort((le,be)=>le.v-be.v)){let le=.82+(F.v+1)*.14;pi(s,P(F),C(F),W*le*(F.lead?1.06:.92),{tone:[18,21,34],alpha:.95,pose:F.pose,rim:Z(40,.72,.8),rimStrength:F.lead?1.4:.9})}let H=_(Math.min(60,y+34)),X=k*1.1+6;s.strokeStyle="rgba(60,68,92,0.85)",s.lineWidth=3,s.beginPath(),s.ellipse(c,H,v*1.15,X,0,0,E),s.stroke();let D=4+Math.floor(r()*3);for(let F=0;F<D;F++){let le=F/D*E,be=c+Math.cos(le)*v*1.15,Ge=H+Math.sin(le)*X;if(Math.sin(le)>-.2){let Te=c+(r()-.5)*v*.8;Rt(s,be,Ge,Te,L,3,v*.32,n,.2*(.7+o*.4))}ui(s,be,Ge,3,n)}let V=_(Math.min(52,y+24)),O=Math.max(60,v*.4),$=Math.max(24,O*.34);s.strokeStyle="rgba(70,78,102,0.6)",s.lineWidth=1.5,s.beginPath(),s.moveTo(c-O*.3,V-$/2),s.lineTo(c-O*.16,V-$*2.2),s.moveTo(c+O*.3,V-$/2),s.lineTo(c+O*.16,V-$*2.2),s.stroke(),s.fillStyle="#0d1220",s.fillRect(c-O/2,V-$/2,O,$);let Et=s.createLinearGradient(0,V-$*.3,0,V+$*.42);Et.addColorStop(0,`rgba(${n},0.5)`),Et.addColorStop(1,"rgba(255,214,160,0.32)"),s.fillStyle=Et,s.fillRect(c-O*.42,V-$*.3,O*.84,$*.72),s.fillStyle="rgba(255,214,160,0.55)",s.fillRect(c-O/2,V+$/2-2,O,2);let Bt=s.createRadialGradient(c,V,4,c,V,O*1.1);Bt.addColorStop(0,`rgba(${n},0.2)`),Bt.addColorStop(1,"rgba(0,0,0,0)"),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=Bt,s.fillRect(c-O*1.1,V-O*.8,O*2.2,O*1.6);let At=s.createRadialGradient(c,(H+L)/2,6,c,(H+L)/2,v*1.5);At.addColorStop(0,`rgba(${n},${(.1*(.6+o*.5)).toFixed(3)})`),At.addColorStop(1,"rgba(0,0,0,0)"),s.fillStyle=At,s.fillRect(c-v*1.5,H-40,v*3,L-H+80),s.restore();let no=c+Math.sign(R-c||1)*v*.5;Rt(s,no,H-X*.4,R,C(M),2.5,v*.16,"255,224,178",.42*(.7+o*.4));let Ft=s.createRadialGradient(R,C(M),1,R,C(M),v*.2);Ft.addColorStop(0,`rgba(255,228,185,${(.4*o).toFixed(3)})`),Ft.addColorStop(1,"rgba(255,228,185,0)"),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=Ft,s.beginPath(),s.ellipse(R,C(M),v*.2,k*.24,0,0,E),s.fill(),s.restore()}function hn(s,e,t,i,o,n,r,a){let l=K/2,c=Math.max(10,i.voidRadiusM),h=Math.max(2,e-c),u=e+c,d=Math.min(78,Math.atan2(c*1.15,e)*180/Math.PI),m=Math.atan2(-t,h)*180/Math.PI,y=Math.atan2(-t,u)*180/Math.PI,p=_(m),f=_(y),b=_e(d)-l,g=(p+f)/2,v=Math.max(10,(p-f)/2),k=s.createRadialGradient(l,g,4,l,g,b);k.addColorStop(0,"#e8f0fb"),k.addColorStop(.7,"#b9c9e2"),k.addColorStop(1,"#8fa3c4"),s.save(),s.beginPath(),s.ellipse(l,g,b,v,0,0,E),s.clip(),s.fillStyle=k,s.fillRect(l-b,g-v,b*2,v*2),s.strokeStyle="rgba(90,120,170,0.5)",s.lineWidth=3,s.beginPath(),s.moveTo(l,g-v),s.lineTo(l,g+v),s.moveTo(l-b*.5,g-v),s.lineTo(l-b*.5,g+v),s.moveTo(l+b*.5,g-v),s.lineTo(l+b*.5,g+v),s.stroke(),s.strokeStyle="rgba(180,90,110,0.45)",s.beginPath(),s.ellipse(l,g,v*.9,v*.5,0,0,E),s.stroke(),s.restore(),s.strokeStyle="rgba(210,225,245,0.6)",s.lineWidth=2.5,s.beginPath(),s.ellipse(l,g,b,v,0,0,E),s.stroke(),s.fillStyle="rgba(20,26,40,0.8)";for(let P=0;P<5;P++){let C=l+(a()-.5)*b*1.4,M=g+(a()-.5)*v*1.1,R=Math.max(2,v*.06);s.beginPath(),s.ellipse(C,M,R*.6,R,0,0,E),s.fill()}let L=s.createRadialGradient(l,g,4,l,g,b*1.4);L.addColorStop(0,"rgba(200,220,255,0.12)"),L.addColorStop(1,"rgba(200,220,255,0)"),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=L,s.fillRect(l-b*1.4,f-v,b*2.8,p-f+v*2),s.restore();let S=_(Math.min(66,y+60)),w=Math.max(80,b*.7),x=w*.5,I=s.createRadialGradient(l,S,4,l,S,w*1.6);I.addColorStop(0,`rgba(${r},0.3)`),I.addColorStop(1,`rgba(${r},0)`),s.save(),s.globalCompositeOperation="lighter",s.fillStyle=I,s.fillRect(l-w*1.6,S-w*1.2,w*3.2,w*2.4),s.restore(),s.fillStyle="#080b12",s.beginPath(),s.moveTo(l-w/2,S-x/2),s.lineTo(l+w/2,S-x/2),s.lineTo(l+w*.6,S),s.lineTo(l+w/2,S+x/2),s.lineTo(l-w/2,S+x/2),s.lineTo(l-w*.6,S),s.closePath(),s.fill();let T=n;for(let P=0;P<3;P++){let C=Z(T+P*30,.5,.5);s.fillStyle=`rgba(${C[0]},${C[1]},${C[2]},0.75)`;let M=w*.26;s.fillRect(l-w*.42+P*(M+w*.06),S-x*.32,M,x*.64)}s.fillStyle=`rgba(${r},0.9)`;for(let P=0;P<8;P++){let C=l-w*.6+w*1.2*P/7;s.beginPath(),s.arc(C,S+x*.62,2.4,0,E),s.fill()}}function dn(s,e,t,i,o,n,r,a,l,c){let h=e.sectionId,u=!1,d=[];for(let p of t){if(p.id===e.id)continue;let f=p.x-e.x,b=p.y-e.y,g=Math.hypot(f,b)*it;if(h&&p.sectionId===h&&g<3&&f*r+b*a>0&&(u=!0),g<.3||g>32)continue;let k=((Math.atan2(f,-b)-o)*180/Math.PI+540)%360-180,L=l?(p.eyeHeightM??q)-n:0,S=Math.atan2(L-.28,g)*180/Math.PI;if(S>10&&g>5)continue;let w=0;for(let T=0;T<p.id.length;T++)w=w*31+p.id.charCodeAt(T)&65535;let x=.9+(w&15)/40,I=Math.min(78,Math.atan2(.16,g)*180/Math.PI*jo*x);I<1.2||d.push({hx:_e(k),hy:_(S),r:I,d:g,hash:w})}d.sort((p,f)=>f.d-p.d);let m=[];{let p=[...d].sort((g,v)=>g.hy-v.hy),f=[],b=()=>{if(!f.length)return;let g=f.reduce((L,S)=>L+S.d,0)/f.length,v=f.reduce((L,S)=>L+S.hy,0)/f.length,k=f.reduce((L,S)=>L+S.r,0)/f.length;m.push({figs:f.sort((L,S)=>S.d-L.d),d:g,hy:v,r:k}),f=[]};for(let g of p){let v=f[f.length-1];v&&Math.abs(g.hy-v.hy)>Math.max(5,(v.r+g.r)/2*1.7)&&b(),f.push(g)}b()}m.sort((p,f)=>f.d-p.d);let y=[[22,26,40],[28,27,42],[24,31,46],[31,30,47],[20,24,36]];for(let p of m){if(p.figs.length>=3&&p.r>=1.6&&p.r<26){let f=[],b=[...p.figs].sort((k,L)=>k.hx-L.hx),g=[];for(let k of b){let L=g[g.length-1];L&&k.hx-L.hx>Math.max(14,k.r*7)&&(g.length>=3&&f.push(g),g=[]),g.push(k)}g.length>=3&&f.push(g);let v=Math.min(.42,.5*(1-p.d/42));if(v>.05){s.fillStyle=`rgba(15, 19, 31, ${v.toFixed(3)})`;for(let k of f){let L=k[0].hx-p.r*1.6,S=k[k.length-1].hx+p.r*1.6;s.beginPath(),s.roundRect(L,p.hy+p.r*.8,S-L,p.r*2.4,p.r*.8),s.fill()}}}for(let f of p.figs){let b=f.d<12?.95:f.d<17?Math.max(.66,.95-(f.d-12)/18):Math.max(.3,.68-(f.d-17)/34),g=Math.round((1-Math.min(1,f.d/16))*10),v=[14+(f.hash>>4&6)+g,17+(f.hash>>4&6)+g,25+(f.hash>>4&6)+g],k=y[f.hash%y.length],L=[k[0]+g,k[1]+g,k[2]+g];if(f.r>=13){let S=f.d<9?.16*(1-f.d/9)+(c.mode==="proscenium"?.06:0):0;rn(s,f.hx,f.hy,f.r,{tone:v,clothing:L,alpha:b,tilt:((f.hash>>2&7)-3.5)*.018,shoulderK:1.72+(f.hash>>5&7)/22,hair:f.hash%on,rim:S,turn:((f.hash>>8&7)-3.5)*.034,lean:((f.hash>>10&3)-1.5)*.09})}else f.r>=5.5?an(s,f.hx,f.hy,f.r,L,v,b):(s.fillStyle=`rgba(${v[0]},${v[1]},${v[2]},${b.toFixed(3)})`,s.beginPath(),s.arc(f.hx,f.hy,f.r,0,E),s.fill(),s.beginPath(),s.ellipse(f.hx,f.hy+f.r*1.4,f.r*1.85,f.r*.95,0,Math.PI,0,!0),s.fill())}}if(u){let p=_(-34);s.fillStyle="rgba(6, 8, 14, 0.92)",s.fillRect(0,p,K,ae-p),s.fillStyle="rgba(24, 30, 46, 0.9)";let f=16;for(let b=0;b<f;b++){let g=(b+.5)/f*K;s.beginPath(),s.ellipse(g,p+6,K/f*.42,22,0,Math.PI,0,!0),s.fill()}}}var Q=480,Oe=270,di=50,Le=30,to=s=>(s+di)/(2*di)*Q,tt=s=>(Le-s)/(2*Le)*Oe;function Fl(s,e,t){let i=document.createElement("canvas");i.width=Q,i.height=Oe;let o=i.getContext("2d"),n=e.x-s.x,r=e.y-s.y,a=Math.max(2,Math.hypot(n,r)*it),l=so(io(`${s.id}|${Math.round(e.x)},${Math.round(e.y)}`)),c=210+l()*150,h=Z(220+(l()-.5)*60,.55,.82),u=`${h[0]},${h[1]},${h[2]}`,d=o.createLinearGradient(0,0,0,Oe);d.addColorStop(0,"#080b12"),d.addColorStop(.44,"#151c32"),d.addColorStop(.5,"#1d2644"),d.addColorStop(.58,"#161c2e"),d.addColorStop(1,"#131829"),o.fillStyle=d,o.fillRect(0,0,Q,Oe);let m=s.eyeHeightM??q,y=ai(m,a),p=Math.min(di-2,Math.atan2(4,a)*180/Math.PI),f=Math.min(Le-2,y.topPitch),b=Math.max(-Le+2,y.basePitch),g=to(-p),v=to(p),k=tt(f),L=tt(b),S=v-g,w=L-k,x=Math.max(.35,Math.min(1,1-(a-6)/60)),I=tt(Math.min(Le-1,f+8)),T=o.createRadialGradient(Q/2,(k+L)/2,4,Q/2,(k+L)/2,S*1.15);T.addColorStop(0,"rgba(255,214,150,0.34)"),T.addColorStop(.28,"rgba(150,150,230,0.3)"),T.addColorStop(.6,"rgba(99,102,241,0.12)"),T.addColorStop(1,"rgba(99,102,241,0)"),o.fillStyle=T,o.fillRect(g-S*.6,k-w*1.2,S*2.2,w*3.4);let P=Z(c,.62,.55),C=Z(c+40,.7,.5),M=Z(c+70,.78,.52);o.save(),o.beginPath(),o.rect(g,k,S,w),o.clip();let R=o.createLinearGradient(0,k,0,L);R.addColorStop(0,`rgb(${P[0]},${P[1]},${P[2]})`),R.addColorStop(.5,`rgb(${C[0]},${C[1]},${C[2]})`),R.addColorStop(1,`rgb(${M[0]},${M[1]},${M[2]})`),o.globalAlpha=.8,o.fillStyle=R,o.fillRect(g,k,S,w),o.globalAlpha=1;let A=o.createRadialGradient(Q/2,(k+L)/2,S*.12,Q/2,(k+L)/2,S*.6);A.addColorStop(0,"rgba(6,8,14,0)"),A.addColorStop(.7,"rgba(6,8,14,0.15)"),A.addColorStop(1,"rgba(5,6,11,0.9)"),o.fillStyle=A,o.fillRect(g,k,S,w),o.restore();let B=3,W=L-w*.08;for(let D=0;D<B;D++){let V=(D+1)/(B+1);pi(o,g+S*(.24+V*.52),W,w*.46*(.9+l()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(l()*4),rim:Z(c+20,.5,.7),rimStrength:.7})}o.fillStyle="#05070d",o.fillRect(g-S*.5,I,S*.5,L-I),o.fillRect(v,I,S*.5,L-I);let G=S*.05+2,H=G*1.35;o.fillStyle="#03050a",o.beginPath(),o.moveTo(g,L),o.lineTo(g-G,L),o.lineTo(g-H,I),o.lineTo(g+S*.012,I),o.closePath(),o.fill(),o.beginPath(),o.moveTo(v,L),o.lineTo(v+G,L),o.lineTo(v+H,I),o.lineTo(v-S*.012,I),o.closePath(),o.fill(),o.fillRect(g-H,I,S+H*2,(L-I)*.13),o.fillStyle=`rgba(${u},0.12)`,o.fillRect(g-1.2,I,1.2,L-I),o.fillRect(v,I,1.2,L-I),o.fillStyle="#0b0f18",o.fillRect(g-G,L-w*.05,S+G*2,w*.05+2);let X=o.createLinearGradient(0,L-w*.05,0,L+w*.14);X.addColorStop(0,`rgba(255,206,140,${(.5*x).toFixed(3)})`),X.addColorStop(1,"rgba(255,206,140,0)"),o.fillStyle=X,o.fillRect(g-G,L-w*.05,S+G*2,w*.22);for(let D=0;D<3;D++){let V=(D+1)/4,O=g+S*V,$=tt(Math.min(Le-1,f+20));Rt(o,O,$,O+(l()-.5)*S*.14,L,3,S*.09,u,.17*x),ui(o,O,$,1.8,u)}o.fillStyle=`rgba(${u},0.75)`;for(let D=0;D<8;D++)o.beginPath(),o.arc((D+.5)/8*Q,tt(Le-4-D%2*3),2.2,0,E),o.fill();o.fillStyle="rgba(10,13,20,0.9)",o.fillRect(0,Oe-26,Q,26),o.fillStyle="rgba(30,37,54,0.9)";for(let D=0;D<9;D++){let V=D*(Q/9)+Q/18;o.beginPath(),o.ellipse(V,Oe-22,Q/9*.4,15,0,Math.PI,0,!0),o.fill()}return{url:i.toDataURL("image/jpeg",.8),distanceM:Math.round(a)}}var pn={es:()=>import("./es-XJUREIJL.js").then(s=>({default:s.es})),de:()=>import("./de-JS2HQ675.js").then(s=>({default:s.de})),fr:()=>import("./fr-CAT46QLZ.js").then(s=>({default:s.fr}))},oo=new Set(["en"]);async function _l(s){let e=Zi(s);if(e==="en"||oo.has(e))return yt(e),e;try{let t=await pn[e]();return yt(e,t.default),oo.add(e),e}catch{return yt("en"),"en"}}export{mn as ACCESSIBILITY_RING_COLOR,fn as ACCESSIBILITY_TYPES,un as CHART_STORAGE_KEY,jn as CURRENCY_CHOICES,Qn as DEFAULT_CURRENCY,vn as LABEL_STYLE_MAX_SIZE,Sn as LABEL_STYLE_MIN_SIZE,Vn as MAX_EVENT_INVENTORY,Hn as MAX_GA_CAPACITY,Zs as PickerController,ge as PickerSelectionError,Yn as RENDERED_QUALITY_REPORT_VERSION,gn as SEAT_COMMERCIAL_MARKS,po as SUPPORTED_LOCALES,wn as SURROUNDINGS_SHAPE_ROLES,oi as SeatmapRenderer,Ln as TIER_HEIGHT_M,ki as UNGROUPED_ID,yn as accessibilityMeta,Ot as accessibilityRingColor,bi as allObjects,Li as applyHidden,wi as chartBounds,Gt as computeSections,$s as createRenderer,co as currencyExponent,er as currencySymbol,Bn as expandBooth,He as expandChart,Mn as expandRow,Cn as expandRowSlots,En as expandTable,xn as expandTableSlots,On as floorObjects,Gn as floorOverviewTranslations,nt as floorsOf,cr as formatDate,Jn as formatMinor,$t as formatMoney,ho as fromMinorUnits,rt as gaAreasOf,Wn as gaInventorySegments,Nn as gaUnitLabel,_t as gaUnitLabels,Al as generateSeatPanorama,Fl as generateSeatThumb,rr as getLocale,Kn as growJoinedGAInventory,qn as hiddenObjectIds,Un as inspectRenderedQualityEvidence,$n as isGaUnitLabel,Xn as isSectionHidden,kn as layerOf,vi as layoutFloorOverview,_l as loadLocale,Fn as objectCenter,Dn as owningSectionForObject,An as pointInPolygon,j as pointInPolygonWithHoles,ot as polygonLabelPoint,Zi as resolveLocale,In as rowInventoryCount,Tn as rowSeatPositions,bn as seatCommercialMeta,st as sectionGeometry,yt as setLocale,Ui as setMoneyLocale,ar as setStringOverrides,Si as stackFloors,oe as t,lr as tCount,Rn as tableInventoryCount,Pn as tableSeatCountsBySide,_n as translateObject,zn as validGAInventorySegments};
|