@seatlayer/core 0.75.2 → 0.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as Ai,b as Ei,d as gs,e as Vt,g as bs,h as Ss,k as vs}from"./chunk-O5UH442K.js";import{a as Ud,b as $d,c as zo,d as qd,e as Zd,f as Xo,h as ns,k as Gt,m as as,n as ge,o as ae,p as ls,q as cs,r as Wt,s as hs}from"./chunk-NQZAZFAC.js";import{a as cu,b as Jo,c as hu}from"./chunk-BXU5D2Q5.js";import{b as ws}from"./chunk-FOYQOIWG.js";import{a as jd,b as Qd,c as Jd}from"./chunk-BT2KJXQC.js";import{a as me,b as jo,c as Me,d as Bt,e as Ft,f as Re,g as H,m as ye,n as Te,q as Ot,r as Dt,t as Qo,u as Ye,v as ne,w as Ae,x as Ri}from"./chunk-XD2P4ZS4.js";import{A as ms,B as ys,b as ss,c as rs,e as lt,i as us,j as ps,p as fs}from"./chunk-QLDV5ZGA.js";import{a as eu,b as tu,c as iu,d as ou,e as su,f as Et,g as ru,h as nt,i as nu,j as Yo,k as _t,l as au,m as lu,n as Uo}from"./chunk-Q3U3F4YJ.js";import{a as ud,b as pd,c as Bo,d as fd,e as md,f as Pt,g as yd,h as gd,i as bd,j as Sd,k as vd,l as wd,n as es,q as at,u as ds}from"./chunk-WXGW2SYC.js";import{b as Nt,f as ts,h as Ht,i as is,k as os}from"./chunk-UL5OIGIF.js";import{Aa as Go,Ca as Ed,Da as _d,E as Fo,Ea as Bd,Fa as Fd,G as Oo,Ga as Od,Ha as Dd,I as V,Ia as Nd,Ja as Hd,Ka as Gd,La as Wd,Ma as Vd,Na as ie,Oa as Rt,Pa as Kd,Qa as zd,Ra as At,Sa as Xd,Ta as Wo,Ua as Yd,Va as Vo,Wa as Xe,Xa as Ko,d as Ld,e as kd,f as Td,g as xd,ga as Do,h as Cd,ha as ze,i as Id,ia as Ad,j as Pd,k as Md,l as Rd,qa as J,ra as No,sa as Mt,ya as Ho}from"./chunk-24O23MNB.js";import{C as B,c as Ii,h as Pi,m as $o,o as qo,t as D,u as ke,v as fe,w as re,x as Mi,z as Zo}from"./chunk-JBOTRSMY.js";import"./chunk-CRCGO52K.js";var du=1,_i=90;function Bi(i,e){return!Number.isFinite(i)||!Number.isFinite(e)?0:Math.max(0,i*e)}function Ls(i,e,t,o=1){if(!Number.isFinite(i))return t;let s=Math.max(0,o);return t?i>=e-s:i>=e+s}function Fi(i,e,t,o=1){if(!Number.isFinite(i)||!(t>0))return i;let s=Math.max(0,o)/t;return e?i*(1+s):i*(1-s)}function uu(i){let{point:e,camera:t,scale:o,nextScale:s}=i;if(!Number.isFinite(o)||o<=0||!Number.isFinite(s))return{...t};let r=(e.x-t.x)/o,n=(e.y-t.y)/o;return{x:e.x-r*s,y:e.y-n*s}}import{Konva as mi}from"konva/lib/Core";import{Stage as Hh}from"konva/lib/Stage";import{Layer as wo}from"konva/lib/Layer";import{Group as kt}from"konva/lib/Group";import{Circle as Na}from"konva/lib/shapes/Circle";import{Group as Yi}from"konva/lib/Group";import{Circle as Ge}from"konva/lib/shapes/Circle";import{Line as Ui}from"konva/lib/shapes/Line";import{Rect as $i}from"konva/lib/shapes/Rect";import{Text as Rr}from"konva/lib/shapes/Text";var be=9,Ee=.9,le=.55*Ee,oe=H/me,ct=4,_e=14,ks=10,Ts=14,Se=.45*Ee,ve=.9*Ee,Be=(Se+ve)/2,xs=Math.max(Ee*1.1,ve),xe=8,Cs=700,j=2,Is=H,Kt=.85,Ps=H,ht=64,Ue=.55*Se,Oi=700,Ms=2500,zt=-11.5,dt=.58,Rs=320,As=420,Es=420,_s=1,Fe=1,Bs=2,$e=16,he=12,Di=[.85,.72,.62],Xt=13,Yt=12,Fs=0,Os="700",Ds="600",Ns=8,Hs=5,Gs=10,Ws=6,Vs=8,Ks=.6,zs=.6,Xs=.7,Ys=[0,18,-18,36,-36,54,-54],Oe="600",Us="500",de=640,Ut="700",De=.02,$s=14,qs=.34,$t=.92,ut=7,qt=3,Zs=6;function Ni(i){return Math.min(1,Math.max(he/$e,i/900))}function qe(i,e){return Math.max(he,i*Ni(e))}var js=.1,pt=1.02;var Qs=2;function Js(i,e){return!(i>0)||!(e>0)||i>=e?null:e}var yl="#e5e7eb",gl="#c7cbd1",bl="#595f69",Sl="#d1d5db",vl="#b8bdc4",wl="#273142",Ll="#526078",kl="#f1f5f9",Tl="#374151",xl="#64748b",Cl="#111827",Zt="#6b7280",ft="#374151";var er="#4b5563",tr=.4,Ne=.16,ir="rgba(244,246,248,0.06)",jt=["#E69F00","#56B4E9","#009E73","#F0E442","#0072B2","#D55E00","#CC79A7"];function or(i,e,t){let o=new Map;for(let n of i){let l=e(n);!l||t(l)||o.set(l,(o.get(l)??0)+1)}let s=null,r=0;for(let[n,l]of o)(l>r||l===r&&s!=null&&n<s)&&(s=n,r=l);return s}function ee(i){return D(i)?{sectionFill:yl,sectionStroke:gl,sectionInk:bl,focalFill:Sl,focalStroke:vl}:{sectionFill:wl,sectionStroke:Ll,sectionInk:kl,focalFill:Tl,focalStroke:xl}}function Hi(i,e){let t=i.sectionFill,o=Zo(fe(t,.2),.85);switch(e){case"closed":return fe(t,.12);case"sold-out":return o;case"nearly-gone":return re(t,o,.4);default:return t}}var sr=.28,rr=.32,Il=.55,Pl=.7;function nr(i,e,t){let o=ee(i),s=Hi(o,e);if(!t||e==="sold-out"||e==="closed")return{fill:s,stroke:o.sectionStroke};let r=D(i);return{fill:re(s,t,r?rr:sr),stroke:B(t,r?Pl:Il)}}var Ml=.03;function ar(i,e){let t=ee(i);return!["normal","nearly-gone","sold-out","closed"].map(s=>Hi(t,s).toLowerCase()).includes(e.trim().toLowerCase())&&Gi(i,e)}function Gi(i,e){let t=Ii(e);if(!t)return!1;let o=ee(i),s=Math.max(sr,rr)+Ml;return["normal","nearly-gone","sold-out","closed"].some(r=>{let n=Ii(Hi(o,r));return n?Math.max(Math.abs(n[0]-t[0]),Math.abs(n[1]-t[1]),Math.abs(n[2]-t[2]))/255<=s:!1})}var Rl="#f8fafc",Al="#f4f6fb",El="#111827",_l=.72;function lr(i){let e=D(i),t=e?Rl:Cl,o=e?El:Al,s=re(o,t,1-_l);return{plate:t,ink:o,subInk:$o(s,t)>=qo?s:o}}function Qt(i){return i?.35:.3}function dr(i){if(i<=0||i>=1)return 1;let e=1.25-1;if(i<.45){let o=i/.45;return 1+e*(1-(1-o)**2)}let t=(i-.45)/(1-.45);return 1+e*Math.cos(t*Math.PI*1.5)*(1-t)**2}function Wi(i){let e=i<=0?0:i>=1?1:i,t=1-(1-e)**3;return{radiusScale:1+(2.5-1)*t,opacity:.55*(1-e)}}var ur=700,Bl=2400,Vi=12,pr=30,cr=1,Fl=1.16,hr=.5,Ol=1;function Ki(i){return i*.61803398875%1}function fr(i,e){let o=((i/Bl+e)%1+1)%1,s=(1-Math.cos(o*2*Math.PI))/2;return{scale:cr+(Fl-cr)*s,opacity:hr+(Ol-hr)*s}}var yr;function gr(i){yr=i}function Dl(i){return typeof i=="number"?i:i instanceof Date?i.getTime():Date.parse(i)}var mr=new Map;function Nl(i,e){let t=i??yr,o=`${t??""}|${JSON.stringify(e)}`,s=mr.get(o);return s||(s=new Intl.DateTimeFormat(t,e),mr.set(o,s)),s}var Hl={dateStyle:"medium",timeStyle:"short"};function br(i,e={}){let{locale:t,...o}=e,s=Dl(i);if(!Number.isFinite(s))return"";let r=Object.keys(o).length?o:Hl;return Nl(t,r).format(s)}var vu="USD",wu=["USD","EUR","GBP","CAD","AUD","INR","AED","SGD","JPY","CHF","SEK","NZD","ZAR","MXN","BRL"],vr;function wr(i){vr=i}var Sr=new Map;function Jt(i,e,t,o){let s=o??vr,r=`${s??""}|${i}|${e??"auto"}|${t??"auto"}`,n=Sr.get(r);return n||(n=new Intl.NumberFormat(s,{style:"currency",currency:i,minimumFractionDigits:e,maximumFractionDigits:t}),Sr.set(r,n)),n}function mt(i,e="USD",t,o){if(typeof t=="object"){let r=t;try{return Jt(e,r.minimumFractionDigits,r.maximumFractionDigits,r.locale).format(i)}catch(n){if(r.fallback)return r.fallback(i,e);throw n}}let s=t??(Number.isInteger(i)?0:void 0);return Jt(e,s,s,o).format(i)}function Gl(i="USD"){try{return Jt(i,void 0,void 0).resolvedOptions().maximumFractionDigits??2}catch{return 2}}function Wl(i,e="USD"){return i/10**Gl(e)}function Lu(i,e="USD",t){return mt(Wl(i,e),e,void 0,t)}function ku(i="USD"){return Jt(i,0,0).formatToParts(0).find(t=>t.type==="currency")?.value??i}var yt={"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.testModeExplained":"Bookings here are not real and no card is charged","picker.seatsTogether":"Seats together","picker.findClosestSeatsTogether":"Find the closest seats together","picker.addSeat":"Add seat","picker.added":"Added","picker.findSeats":"Find seats","picker.displayOptions":"Display options","picker.closeVenueNavigation":"Close venue navigation","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.beaconAria":"Go to your {seats} in {name}","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.seatsLeftShort":"{count} left","picker.overview":"Venue","picker.entrance":"Entrance","picker.turnOffAccessibilityFilter":"Turn off the wheelchair filter to pick this seat","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":"Reload the seat map to continue. Seats already in your cart stay held until the timer ends.","picker.accessExpiredTitle":"Your seat session has expired","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":"Reload seat map","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.accessibilityOptions":"Accessibility and colour options","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.colorblindColors":"Colourblind-friendly colours","picker.companionSeatsNote":"Companion places beside them stay selectable","picker.accessFreeCount":"{count} free","picker.accessNoneLeft":"None left","picker.holdLapsedStillFree.one":"Your hold ended while you were away. That seat is still free.","picker.holdLapsedStillFree.other":"Your hold ended while you were away. Those seats are still free.","picker.holdLapsedSomeTaken.one":"Your hold ended while you were away, and {count} of those seats has been taken. The rest are still free.","picker.holdLapsedSomeTaken.other":"Your hold ended while you were away, and {count} of those seats have been taken. The rest are still free.","picker.holdLapsedAllTaken.one":"Your hold ended while you were away, and that seat has been taken.","picker.holdLapsedAllTaken.other":"Your hold ended while you were away, and those seats have been taken.","picker.holdLapsedSelectAgain.one":"Select it again","picker.holdLapsedSelectAgain.other":"Select them again","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.dragToLookTouch":"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close","picker.dragToLookMouse":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close","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.heldByOther":"Held by another buyer \u2014 may become available","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.moreCount":"+{count} more","picker.showLess":"Show less","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.recentreOnStage":"Recentre on the stage","picker.stopYourSeat":"Your seat","picker.stopYourRow":"Your row","picker.stopYourSection":"Your section","picker.stopWholeVenue":"Whole venue","picker.viewFromHere":"View from here","picker.viewFromYourSeat":"view from your seat","picker.fromYourSeat":"from your seat","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","picker.gaChooseTickets":"How many tickets?","picker.gaAdd.one":"Add {count} ticket \xB7 {price}","picker.gaAdd.other":"Add {count} tickets \xB7 {price}","picker.gaUpdate.one":"Update \xB7 {count} ticket","picker.gaUpdate.other":"Update \xB7 {count} tickets","picker.gaRemove":"Remove","picker.gaAreasHeading":"Areas","picker.gaTrayHintTapArea":"Tap an area on the map to choose tickets.","picker.gaAdded.one":"{count} {area} ticket added, {price}","picker.gaAdded.other":"{count} {area} tickets added, {price}","picker.gaRemoved":"{area} tickets removed","picker.gaChooseForArea":"Choose tickets for {area}","picker.holdSeatsForAllPerformances":"Hold seats for all {count} performances","picker.completeAllPerformances":"Complete all performances ({complete}/{total})","picker.groupTrayHint":"Choose seats once \u2014 the same seats will be held for every performance.","picker.groupPerPerformanceTrayHint":"Choose seats for this performance, then complete every date above.","picker.group.sameSeatSummary":"Choose once. The same seats will be held for all {count} performances.","picker.group.perPerformanceSummary":"Choose seats for each performance. All {count} selections are held together.","picker.group.allDates":"All {count} dates included","picker.group.flexibleDatesInView":"All {count} dates in view","picker.group.flexibleDatesSelected":"{selected} of {total} dates selected","picker.group.performances":"Performances","picker.group.heldForEveryPerformance":"Held for every performance","picker.group.notStarted":"Not started","picker.group.inProgress":"In progress","picker.group.complete":"Complete","picker.group.needsAttention":"Needs attention","picker.group.previousPerformance":"Previous performance","picker.group.nextPerformance":"Next performance","picker.group.performanceOpened":"Now choosing seats for {performance}.","picker.group.checkingAvailability":"Checking seats available for every performance\u2026","picker.group.securing":"Securing these seats for every performance. Please wait.","picker.group.commitPending":"We\u2019re still securing these seats for every performance. SeatLayer will keep working; this page is checking the result.","picker.group.outcomeUnknown":"We\u2019re checking whether your seats were secured. Don\u2019t choose other seats yet.","picker.group.longRunning":"This is taking longer than usual. We\u2019re still checking the same request. Don\u2019t submit it again. Reference: {reference}.","picker.group.abortPending":"We couldn\u2019t secure every performance. We\u2019re checking that all seats are released before you try again.","picker.group.secured":"Seats secured for every performance. Continue when you are ready.","picker.group.notSecured":"We couldn\u2019t secure these seats for every performance. Nothing is held. Try again.","picker.group.retry":"Try again","picker.group.salesClosed":"Seats for this performance set are not available now. Return to the event page for other options.","picker.group.revisionChanged":"This performance set changed. Review the included performances before choosing seats again.","picker.group.legendTitle":"Seat availability","picker.group.legendUnavailable":"Unavailable","picker.group.partlyAvailableTitle":"Free on some nights only","picker.group.notAvailableOn":"Not available on {dates}","picker.group.nightFree":"Free","picker.group.nightBlocked":"Not available","picker.group.pickSeatFreeEveryNight":"Pick a seat that is free every night.","picker.group.chooseNightByNight":"Choose seats night by night","picker.group.nightByNightStarted":"Now choosing seats for each performance separately. Your selection was cleared.","picker.group.yourSeatsByNight":"Your seats by night","picker.group.noSeatsChosenYet":"No seats yet","picker.group.chosenOfTotal":"{chosen} of {total}","picker.group.needsMoreSeats":"Needs {count} more","picker.group.closeSeatDetails":"Close seat details","picker.group.seatPartlyAvailable":"{label}: free on {free} of {total} performances. Not available on {dates}.","picker.group.selectAvailableDates":"Select for {count} available dates","picker.group.selectedAvailableDates":"Selected for {count} available dates.","picker.group.clearBeforePartial":"Clear your current seats before choosing a different date set.","picker.group.legendAvailable":"Available","picker.group.legendSelected":"Selected","picker.group.legendNotEveryDate":"Not open on every date","picker.group.progressLabel":"Booking steps","picker.group.stepPerformances":"Performances","picker.group.stepSeats":"Seats","picker.group.stepReview":"Review","picker.group.stepDone":"Done","picker.group.stepCurrent":"Current step","picker.group.includedNote":"All {count} performances are included \xB7 dates cannot be removed here","picker.group.flexibleDatesNote":"Choose a partial seat to include only the dates where it is available.","picker.group.flexibleSelectedNote":"Only these {count} dates will be held for this seat.","picker.group.yourSelection":"Your selection","picker.group.pricesPerPerformance":"Prices shown per performance","picker.group.total":"Total","picker.group.heldTogether":"All {count} performance selections are held together \xB7 {time} remaining","picker.group.completeWithSeats":"Complete \xB7 {seats}","picker.group.stillNeedsSeat":"Still needs a seat","picker.group.sameSeatMapHelp":"One chart shows only seats available for every selected performance.","picker.group.perPerformanceMapHelp":"Switch dates above; the map position and each choice stay saved.","picker.group.bookedAll":"You\u2019re all set \u2014 seats booked for all {count} performances.","picker.group.seatsEveryPerformance.one":"{count} seat \xB7 every performance","picker.group.seatsEveryPerformance.other":"{count} seats \xB7 every performance","picker.group.seatsPerPerformance.one":"{count} seat \xB7 {per} per performance","picker.group.seatsPerPerformance.other":"{count} seats \xB7 {per} per performance","picker.group.performancesChosenOf.one":"{chosen} of {total} performances chosen \xB7 {count} seat","picker.group.performancesChosenOf.other":"{chosen} of {total} performances chosen \xB7 {count} seats","picker.group.ticketsConfirmedAcross.one":"{count} ticket confirmed across {performances} performances","picker.group.ticketsConfirmedAcross.other":"{count} tickets confirmed across {performances} performances"};var Vl=["ar","be","bg","ca","cs","cy","da","de","el","en","es","et","fa","fi","fr","he","hr","hu","it","ja","ku","lt","lv","nl","no","pl","pt","ro","ru","sk","sl","sr","sv","tr","uk","zh-Hans","zh-Hant"],Mu={ar:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",be:"\u0411\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F",bg:"\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438",ca:"Catal\xE0",cs:"\u010Ce\u0161tina",cy:"Cymraeg",da:"Dansk",de:"Deutsch",el:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC",en:"English",es:"Espa\xF1ol",et:"Eesti",fa:"\u0641\u0627\u0631\u0633\u06CC",fi:"Suomi",fr:"Fran\xE7ais",he:"\u05E2\u05D1\u05E8\u05D9\u05EA",hr:"Hrvatski",hu:"Magyar",it:"Italiano",ja:"\u65E5\u672C\u8A9E",ku:"Kurd\xEE",lt:"Lietuvi\u0173",lv:"Latvie\u0161u",nl:"Nederlands",no:"Norsk",pl:"Polski",pt:"Portugu\xEAs",ro:"Rom\xE2n\u0103",ru:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",sk:"Sloven\u010Dina",sl:"Sloven\u0161\u010Dina",sr:"\u0421\u0440\u043F\u0441\u043A\u0438",sv:"Svenska",tr:"T\xFCrk\xE7e",uk:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430","zh-Hans":"\u7B80\u4F53\u4E2D\u6587","zh-Hant":"\u7E41\u9AD4\u4E2D\u6587"},Lr=["ar","be","bg","ca","cs","cy","da","de","el","en","es","et","fa","fi","fr","he","hr","hu","it","ja","ku","lt","lv","nl","no","pl","pt","ro","ru","sk","sl","sr","sv","tr","uk","zh-Hans","zh-Hant"],Kl=new Set(["ar","fa","he"]),zi={li:"lt",iw:"he",mo:"ro",sh:"sr",nb:"no",nn:"no",kmr:"ku",zh:"zh-Hans","zh-cn":"zh-Hans","zh-sg":"zh-Hans","zh-my":"zh-Hans","zh-tw":"zh-Hant","zh-hk":"zh-Hant","zh-mo":"zh-Hant"},Xi=new Map(Vl.map(i=>[i.toLowerCase(),i]));function zl(i){let e=i.trim().toLowerCase().replace(/_/g,"-");if(!e)return;let t=Xi.get(e)??zi[e];if(t)return t;let o=e.split("-");if(o.length>=2){let s=`${o[0]}-${o[1]}`,r=Xi.get(s)??zi[s];if(r)return r}return Xi.get(o[0])??zi[o[0]]}var He={en:yt},ei={},ce="en";function kr(i,e){let t=typeof navigator<"u"?navigator.languages?.length?navigator.languages:[navigator.language]:[];for(let o of[i,e,...t]){if(!o)continue;let s=zl(o);if(s)return s}return"en"}function Ru(){return ce}function Au(i=ce){return Kl.has(i)?"rtl":"ltr"}function Eu(i){return!!He[i]}function Ze(i,e){e&&(He[i]={...He[i],...e}),ce=He[i]?i:"en",wr(ce),gr(ce),typeof document<"u"&&(document.documentElement.lang=ce)}function _u(i){ei=i}var Tr=/\{(\w+)\}/g;function G(i,e){let t=ei[i]??He[ce]?.[i]??yt[i]??i;return e?t.replace(Tr,(o,s)=>String(e[s]??`{${s}}`)):t}function xr(i,e,t){let o=new Intl.PluralRules(ce).select(e);return(ei[`${i}.${o}`]??He[ce]?.[`${i}.${o}`]??yt[`${i}.${o}`]??ei[`${i}.other`]??He[ce]?.[`${i}.other`]??yt[`${i}.other`]??i).replace(Tr,(n,l)=>String({count:e,...t}[l]??`{${l}}`))}function Bu(i,e){return br(i,{...e??{dateStyle:"medium",timeStyle:"short"},locale:ce})}function Ir(i,e,t,o=!1){let s=i.displayLabel?.trim()||i.label;return o?{title:s,detail:G("map.statusTaken"),sellable:!1}:e==="booked"?{title:s,detail:G("map.statusTaken"),sellable:!1}:e==="held"?{title:s,detail:G("map.statusHeld"),sellable:!1}:{title:s,detail:t()??"",sellable:!0}}var je=32,Cr=70;function Pr(i,e){let t=je+6,o=i.y-Cr;return{x:Math.min(Math.max(i.x,t),Math.max(t,e.width-t)),y:o>=t?o:Math.min(i.y+Cr,e.height-t)}}var $l=220,ql=.08,ti=class{constructor(e){this.pulses=new Map;this.pulseGroup=null;this.loupe=null;this.echoTimers=new Map;this.host=e}syncMarker(e,t,o){let s=o.get(e);if(o.delete(e),!t){this.retire(s);return}s?.destroy();let r=this.host,n=r.seat(e);if(!n)return;let l=r.seatShape(e)?.fill(),a=ne(typeof l=="string"?l:"",r.selectionColor(),Ye),c=r.selectionFocusId()===e,h=r.boothDims(n.rowId),d=r.seatRadius(),u=r.seatPoint(n),p=new Yi({name:"selection-ring",x:u.x,y:u.y,rotation:h?.rotation??0,listening:!1,perfectDrawEnabled:!1,opacity:r.selectionFocusId()&&!c?.2:1});if(r.viewMode()==="perspective"){let f=r.perspectiveSeatScale(e);p.scale({x:f,y:f})}p.setAttrs({seatId:e,ringColor:a});let y={name:"selection-halo",stroke:B(r.categoryColor(n.categoryKey),Qt(D(r.canvasBackground()))),listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(h){let f=d*1.2;p.add(new $i({...y,width:h.width+f*2,height:h.height+f*2,offsetX:(h.width+f*2)/2,offsetY:(h.height+f*2)/2,cornerRadius:8,strokeWidth:Math.max(2,d*.5)}))}else p.add(new Ge({...y,radius:d*1.6,strokeWidth:Math.max(2,d*.55)}));let m={stroke:a,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(h)if(p.add(new $i({...m,width:h.width,height:h.height,offsetX:h.width/2,offsetY:h.height/2,cornerRadius:4,strokeWidth:c?4:3})),c)p.add(new $i({...m,width:h.width+10,height:h.height+10,offsetX:(h.width+10)/2,offsetY:(h.height+10)/2,cornerRadius:7,strokeWidth:2,opacity:.55}));else{let f=Math.max(0,h.width/2-14),g=-Math.max(0,h.height/2-14);p.add(new Ge({x:f,y:g,radius:10,fill:a,listening:!1})),p.add(new Ui({x:f,y:g,points:[-4.5,0,-1,3.5,5.5,-4.5],stroke:D(a)?"#0b1220":"#ffffff",strokeWidth:2.4,lineCap:"round",lineJoin:"round",listening:!1}))}else p.add(new Ge({...m,radius:Math.max(1,d-1.25),strokeWidth:Math.min(2.5,Math.max(1.8,d*.22))})),c?p.add(new Ge({...m,radius:d+2,strokeWidth:2,opacity:.55})):p.add(new Ui({points:[-d*.52,0,-d*.12,d*.4,d*.6,-d*.46],stroke:"#ffffff",strokeWidth:Math.max(2.6,d*.34),lineCap:"round",lineJoin:"round",shadowColor:"#0b1220",shadowBlur:1.5,shadowOpacity:.55,listening:!1}));o.set(e,p),this.host.overlayLayer.add(p)}retire(e){let t=this.host;if(!e)return;if(t.reducedMotion()||t.isDestroyed()||typeof document<"u"&&document.hidden){e.destroy();return}let o=performance.now(),s=r=>{if(t.isDestroyed()||!e.getLayer()){e.destroy();return}let n=Math.min(1,(r-o)/160);e.opacity(1-n),t.overlayLayer.batchDraw(),n<1?requestAnimationFrame(s):(e.destroy(),t.overlayLayer.batchDraw())};requestAnimationFrame(s)}play(e){let t=this.host;if(t.reducedMotion()||t.isDestroyed()||typeof document<"u"&&document.hidden||!t.seat(e))return;this.emitPulse(e,!0);let o=this.echoTimers.get(e);o&&clearTimeout(o),this.echoTimers.set(e,setTimeout(()=>{this.echoTimers.delete(e),!(t.isDestroyed()||t.reducedMotion())&&(typeof document<"u"&&document.hidden||this.emitPulse(e,!1))},ur))}emitPulse(e,t){let o=this.host,s=o.seat(e);if(!s)return;let r=o.seatRadius(),n=o.seatPoint(s);this.pulses.get(e)?.destroy();let l=new Ge({name:"selection-pulse",x:n.x,y:n.y,radius:r,stroke:o.categoryColor(s.categoryKey),strokeWidth:Math.max(1.5,r*.24),opacity:Wi(0).opacity,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.pulses.set(e,l),this.pulseHome().add(l);let a=t&&!o.isCached()?o.seatShape(e):void 0,c=performance.now(),h=()=>{a?.scale({x:1,y:1}),l.destroy(),this.pulses.get(e)===l&&this.pulses.delete(e),o.overlayLayer.batchDraw(),a&&!o.isCached()&&o.seatLayer.batchDraw()},d=u=>{if(o.isDestroyed()){h();return}l.getLayer()||this.pulseHome().add(l);let p=u-c,y=Wi(p/420);if(l.radius(r*y.radiusScale),l.opacity(y.opacity),a){let m=dr(p/320);a.scale({x:m,y:m})}o.overlayLayer.batchDraw(),a&&!o.isCached()&&o.seatLayer.batchDraw(),p<420?requestAnimationFrame(d):h()};queueMicrotask(()=>{o.isDestroyed()||requestAnimationFrame(d)})}nudge(e){let t=this.host;if(t.reducedMotion()||t.isDestroyed()||t.isCached()||typeof document<"u"&&document.hidden)return;let o=t.seatShape(e);if(!o)return;let s=performance.now(),r=()=>{o.scale({x:1,y:1}),t.seatLayer.batchDraw()},n=l=>{if(t.isDestroyed()||t.isCached()||!o.getLayer()){r();return}let a=l-s,c=Math.min(1,a/$l),h=1+ql*Math.sin(Math.PI*c);o.scale({x:h,y:h}),t.seatLayer.batchDraw(),c<1?requestAnimationFrame(n):r()};requestAnimationFrame(n)}pulseHome(){return(!this.pulseGroup||!this.pulseGroup.getLayer())&&(this.pulseGroup=new Yi({name:"seat-pulses",listening:!1})),this.pulseGroup.getLayer()||this.host.overlayLayer.add(this.pulseGroup),this.host.overlayLayer.isCached()&&this.host.overlayLayer.clearCache(),this.pulseGroup.moveToTop(),this.pulseGroup}showLoupe(e){let t=this.host;if(t.isExportMode()||t.isDestroyed())return;let o=t.nearestSeat(e,_e),s=o?t.seat(o):void 0;if(!s){this.hideLoupe();return}let r=Ir(s,t.seatStatus(s.id),()=>t.priceLabel(s),t.seatClosed(s.id)),n=Pr(e,{width:t.stage.width(),height:t.stage.height()}),l=1/(t.stage.scaleX()||1),a=this.loupe??this.buildLoupe();a.seatId=s.id,a.group.position(t.screenToWorld(n)),a.group.scale({x:l,y:l}),a.group.opacity(r.sellable?1:.75),a.group.visible(!0),a.disc.fill(t.categoryColor(s.categoryKey)),a.title.text(r.title),a.title.offsetX(a.title.width()/2),a.detail.text(r.detail),a.detail.offsetX(a.detail.width()/2),t.overlayLayer.batchDraw()}buildLoupe(){let e=this.host,t=e.canvasBackground(),o=ne(t,ee(t).sectionInk),s=new Yi({name:"touch-loupe",listening:!1,visible:!1});s.add(new Ui({points:[-7,je-4,0,je+12,7,je-4],closed:!0,fill:t,stroke:B(o,.25),strokeWidth:1,listening:!1})),s.add(new Ge({radius:je,fill:t,stroke:B(o,.28),strokeWidth:1.25,shadowColor:"#000000",shadowBlur:16,shadowOpacity:.45,listening:!1}));let r=new Ge({y:-15,radius:6,fill:"#6e7bff",listening:!1}),n=new Rr({y:-6,text:"",fontSize:15,fontStyle:"800",fontFamily:e.labelFont(),fill:o,listening:!1,perfectDrawEnabled:!1}),l=new Rr({y:12,text:"",fontSize:10.5,fontStyle:"700",fontFamily:e.labelFont(),fill:B(o,.72),listening:!1,perfectDrawEnabled:!1});return s.add(r),s.add(n),s.add(l),e.overlayLayer.add(s),s.moveToTop(),this.loupe={group:s,title:n,detail:l,disc:r,seatId:""},this.loupe}hideLoupe(){this.loupe?.group.visible()&&(this.loupe.group.visible(!1),this.host.overlayLayer.batchDraw())}destroy(){for(let e of this.echoTimers.values())clearTimeout(e);this.echoTimers.clear()}};import{Animation as Zl}from"konva/lib/Animation";var jl=1e3/pr;function Ar(i){return i.findOne(".selection-halo")??null}var ii=class{constructor(e){this.animation=null;this.targets=[];this.startedAt=0;this.lastFrameAt=0;this.visibilityBound=!1;this.onVisibilityChange=()=>{this.refresh()};this.markers=new Map;this.beaconRings=[];this.host=e}sync(e){this.markers=e,this.refresh()}syncBeacons(e){this.beaconRings=e,this.refresh()}refresh(){let e=this.host,t=this.markers.size>0||this.beaconRings.length>0;if(t&&!e.isDestroyed()&&!e.reducedMotion()&&this.bindVisibility(),e.isDestroyed()||e.reducedMotion()||!this.pageVisible()||!t){this.stop(),this.rest(),(!t||e.isDestroyed()||e.reducedMotion())&&this.unbindVisibility();return}let o=[],s=0;for(let[n,l]of this.markers){let a=Ar(l);if(a){if(this.paintHalo(n,a),s>=Vi){a.scale({x:1,y:1}),a.opacity(1);continue}o.push({node:a,phase:Ki(s)}),s+=1}}let r=0;for(let n of this.beaconRings){if(r>=Vi){n.scale({x:1,y:1}),n.opacity(1);continue}o.push({node:n,phase:Ki(r)}),r+=1}if(this.targets=o,!o.length){this.stop();return}this.animation||(this.startedAt=performance.now(),this.lastFrameAt=0,this.animation=new Zl(()=>this.frame(),e.overlayLayer),this.animation.start())}stop(){this.targets=[],this.animation&&(this.animation.stop(),this.animation=null)}destroy(){this.stop(),this.markers=new Map,this.beaconRings=[],this.unbindVisibility()}isRunning(){return!!this.animation?.isRunning()}paintHalo(e,t){let o=this.host,s=Qt(D(o.canvasBackground())),r=o.seatCategoryKey(e),n=o.isOwnedHold(e)?re(o.selectionColor(),o.canvasBackground(),.55):r?o.categoryColor(r):o.selectionColor();t.stroke(B(n,s))}rest(){let e=!1;for(let[t,o]of this.markers){let s=Ar(o);s&&(this.paintHalo(t,s),s.scale({x:1,y:1}),s.opacity(1),e=!0)}for(let t of this.beaconRings)t.scale({x:1,y:1}),t.opacity(1),e=!0;e&&!this.host.isDestroyed()&&this.host.overlayLayer.batchDraw()}frame(){if(this.host.isDestroyed()||!this.targets.length)return this.stop(),!1;let t=performance.now();if(t-this.lastFrameAt<jl)return!1;this.lastFrameAt=t;let o=t-this.startedAt;for(let s of this.targets){let{scale:r,opacity:n}=fr(o,s.phase);s.node.scale({x:r,y:r}),s.node.opacity(n)}return!0}pageVisible(){return typeof document>"u"?!0:document.visibilityState==="visible"}bindVisibility(){this.visibilityBound||typeof document>"u"||(document.addEventListener("visibilitychange",this.onVisibilityChange),this.visibilityBound=!0)}unbindVisibility(){!this.visibilityBound||typeof document>"u"||(document.removeEventListener("visibilitychange",this.onVisibilityChange),this.visibilityBound=!1)}};import{Group as Ql}from"konva/lib/Group";import{Circle as Er}from"konva/lib/shapes/Circle";import{Text as Jl}from"konva/lib/shapes/Text";var oi=28,ec=12,tc="800",ic=44;function _r(i){if(i.rung==="seats")return[];let e=new Map,t=new Map(i.zones.map(s=>[s.id,s.name])),o=new Map(i.zones.map(s=>[s.id,s.anchor]));for(let s of i.sections){let r=i.ownedSeatIds(s);if(!r.length)continue;let n=i.rung==="zones"&&s.zone!=null&&t.has(s.zone),l=n?s.zone:s.logicalId,a=e.get(l);if(a){a.count+=r.length;continue}e.set(l,{id:l,kind:n?"zone":"section",name:n?t.get(s.zone):i.sectionName(s),count:r.length,seatId:r[0],anchor:n?o.get(s.zone):i.sectionAnchor(s)})}return[...e.values()]}function oc(i,e){return G("map.beaconAria",{seats:xr("picker.seatCount",i),name:e})}var sc="selection-beacon-ring",si=class{constructor(e){this.group=null;this.buttons=[];this.centres=[];this.rings=[];this.targets=[];this.signature="";this.host=e}breathingRings(){return this.rings}current(){return this.targets}sync(e){let t=Math.max(this.host.stageScale(),1e-4),o=`${t.toFixed(4)}|${e.map(a=>`${a.id}:${a.count}:${a.seatId}`).join(",")}`;if(o===this.signature&&this.buttons.length===e.length){this.targets=e,this.repositionButtons();return}if(this.clear(),this.signature=o,this.targets=e,!e.length){this.host.overlayLayer.batchDraw();return}let s=oi/2/t,r=this.host.accent(),n=this.host.accentInk(),l=new Ql({listening:!1,name:"selection-beacons"});for(let a of e){let c={x:a.anchor.x,y:a.anchor.y-s*1.6},h=new Er({name:sc,x:c.x,y:c.y,radius:s*1.25,stroke:B(r,.55),strokeWidth:Math.max(1,s*.22),listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});l.add(h),l.add(new Er({name:"selection-beacon-disc",x:c.x,y:c.y,radius:s,fill:r,stroke:B(n,.28),strokeWidth:1/t,listening:!1,perfectDrawEnabled:!1}));let d=new Jl({x:c.x,y:c.y,text:String(a.count),fontSize:ec/t,fontStyle:tc,fontFamily:this.host.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});d.offsetX(d.width()/2),d.offsetY(d.height()/2),l.add(d),this.rings.push(h),this.centres.push(c),this.buttons.push(this.buildButton(a,c))}this.host.overlayLayer.add(l),l.moveToTop(),this.group=l,this.host.overlayLayer.batchDraw()}clear(){this.group?.destroy(),this.group=null,this.rings=[],this.targets=[],this.centres=[],this.signature="";for(let e of this.buttons)e.remove();this.buttons=[]}repositionButtons(){for(let e=0;e<this.buttons.length;e+=1){let t=this.buttons[e],o=this.host.worldToScreen(this.centres[e]),s=t.offsetWidth||parseFloat(t.style.width)||oi;t.style.left=`${o.x-s/2}px`,t.style.top=`${o.y-s/2}px`}}buildButton(e,t){let o=this.host.worldToScreen(t),s=typeof globalThis.matchMedia=="function"&&globalThis.matchMedia("(pointer: coarse)").matches,r=Math.max(oi,s?ic:oi),n=document.createElement("button");return n.type="button",n.className="sl-beacon",n.dataset.beacon=e.id,n.setAttribute("aria-label",oc(e.count,e.name)),Object.assign(n.style,{position:"absolute",left:`${o.x-r/2}px`,top:`${o.y-r/2}px`,width:`${r}px`,height:`${r}px`,padding:"0",margin:"0",border:"none",borderRadius:"50%",background:"transparent",cursor:"pointer",touchAction:"manipulation",zIndex:"3"}),n.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),this.host.activate(e)}),n.addEventListener("pointerdown",l=>l.stopPropagation()),this.host.container.appendChild(n),n}};function Br(i,e){let t=i.width(),o=i.height(),s=1/0,r=1/0,n=-1/0,l=-1/0;for(let a of e){let c=a.getClientRect();if(!(!(c.width>1)||!(c.height>1))){if(c.x<-8||c.y<-8||c.x+c.width>t+8||c.y+c.height>o+8)return null;c.x<s&&(s=c.x),c.y<r&&(r=c.y),c.x+c.width>n&&(n=c.x+c.width),c.y+c.height>l&&(l=c.y+c.height)}}return isFinite(s)?{x:s,y:r,width:n-s,height:l-r}:null}var Fr=8,rc=.5;function Dr(i,e,t){let o=t??{x:0,y:0,width:i.width(),height:i.height()},s=Br(i,e);if(!s)return 0;Or(i,s,o);let r=Math.min((o.width-2*Fr)/s.width,(o.height-2*Fr)/s.height);if(!(Math.max(s.width-o.width,s.height-o.height)>rc)||!(r>0))return 1;let l=o.x+o.width/2,a=o.y+o.height/2;i.scale({x:i.scaleX()*r,y:i.scaleY()*r}),i.position({x:l+(i.x()-l)*r,y:a+(i.y()-a)*r});let c=Br(i,e);return c&&Or(i,c,o),r}function Or(i,e,t){let o=t.x+t.width/2-(e.x+e.width/2),s=t.y+t.height/2-(e.y+e.height/2);return o===0&&s===0?!1:(i.position({x:i.x()+o,y:i.y()+s}),!0)}function qi(i){return`${i.x()},${i.y()},${i.scaleX()}`}import{Group as nc}from"konva/lib/Group";import{Circle as Nr}from"konva/lib/shapes/Circle";import{Line as ac}from"konva/lib/shapes/Line";import{Text as lc}from"konva/lib/shapes/Text";var cc=6;function Zi(i){return D(i)?"#0b1220":"#ffffff"}function Hr(i){let{points:e}=i;if(!e.length)return null;let t=i.categoryColor??"#6e7bff",o=0,s=0;for(let r of e)o+=r.x,s+=r.y;return{count:e.length,centroid:{x:o/e.length,y:s/e.length},fill:t,ink:Zi(t)}}var ri=class{constructor(e){this.group=null;this.badges=[];this.host=e}anchorFor(e){for(let t of this.host.sections()){if(t.logicalId!==e&&t.id!==e)continue;let o=Hr({points:this.host.ownedPoints(t),categoryColor:null});if(o)return o.centroid}return null}badgeAt(e){for(let t of this.badges)if(Math.hypot(e.x-t.centre.x,e.y-t.centre.y)<=t.radius)return t.id;return null}sync(e,t="seats"){if(this.group?.destroy(),this.group=null,this.badges=[],e>=ve){this.host.overlayLayer.batchDraw();return}let o=Math.max(this.host.stageScale(),1e-4),s=new nc({listening:!1,name:"owned-sections"}),r=new Set;for(let n of this.host.sections()){let l=this.host.ownedPoints(n),a=Hr({points:l,categoryColor:this.host.sectionColor(n)});if(!a)continue;let c=Math.max(cc/2/o,1);for(let m of l)s.add(new Nr({name:"owned-seat-dot",x:m.x,y:m.y,radius:c,fill:a.fill,stroke:B("#ffffff",.55),strokeWidth:Math.max(.5,c*.28),shadowColor:a.fill,shadowBlur:c*2.4,shadowOpacity:.7,listening:!1,perfectDrawEnabled:!1}));if(t!=="seats"||r.has(n.logicalId))continue;r.add(n.logicalId);let h=this.host.sections().filter(m=>m.logicalId===n.logicalId).reduce((m,f)=>m+this.host.ownedPoints(f).length,0),d=this.host.labelAnchor(n),u=11/o,p={x:d.x,y:d.y-u*2.1};s.add(new Nr({name:"owned-section-badge",x:p.x,y:p.y,radius:u,fill:a.fill,stroke:B(a.ink,.35),strokeWidth:1/o,listening:!1,perfectDrawEnabled:!1})),s.add(new ac({x:p.x-u*.62,y:p.y,points:[-u*.22,0,-u*.02,u*.2,u*.34,-u*.26],stroke:a.ink,strokeWidth:Math.max(.6,u*.16),lineCap:"round",lineJoin:"round",listening:!1}));let y=new lc({x:p.x+u*.12,y:p.y-u*.5,text:String(h),fontSize:u,fontStyle:"800",fontFamily:this.host.labelFont(),fill:a.ink,listening:!1,perfectDrawEnabled:!1});s.add(y),this.badges.push({id:n.logicalId,centre:p,radius:u*1.8})}if(!s.hasChildren()){s.destroy(),this.host.overlayLayer.batchDraw();return}this.host.overlayLayer.add(s),s.moveToTop(),this.group=s,this.host.overlayLayer.batchDraw()}};function K(i){let e=es(i);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 Qe(i,e,t,o){let s=o*Math.PI/180,r=Math.cos(s),n=Math.sin(s);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(l=>({x:i.x+l.x*r-l.y*n,y:i.y+l.x*n+l.y*r}))}function ni(i,e,t,o,s,r){let n=o*Math.PI/180,l=Math.cos(n),a=Math.sin(n);for(let c=0;c<=4;c++)for(let h=0;h<=6;h++){let d=e*(h/6-.5),u=t*(c/4-.5),p={x:i.x+d*l-u*a,y:i.y+d*a+u*l};if(!ie(p,s,r))return!1}return!0}function Gr(i,e,t){let o=K(i),s=[t];for(let n=1;n<12;n+=1)for(let l=1;l<12;l+=1){let a={x:o.x+o.width*l/12,y:o.y+o.height*n/12};ie(a,i,e)&&s.push(a)}let r=[i,...e];return s.map(n=>({point:n,room:Fo(n,r)})).sort((n,l)=>l.room-n.room).map(n=>n.point).filter((n,l,a)=>l===a.findIndex(c=>Math.abs(c.x-n.x)<1e-6&&Math.abs(c.y-n.y)<1e-6))}function Wr(i,e){let{stageScale:t,stageX:o,stageY:s}=i;if(i.viewMode==="perspective"&&e.perspectiveAffine)return K(e.outline.map(n=>{let l=i.projectedSectionPoint(e,n);return{x:l.x*t+o,y:l.y*t+s}}));let r=e.liftWorld>0?i.isoLiftLocal(e.liftWorld):{x:0,y:0};return K(e.outline.map(n=>{let l={x:n.x+r.x,y:n.y+r.y},a=i.isoT===0?l:i.isoForward(l);return{x:a.x*t+o,y:a.y*t+s}}))}function hc(i,e){let t=i.width*i.height;if(t<=0)return 0;let o=Math.max(0,Math.min(i.x+i.width,e.width)-Math.max(i.x,0)),s=Math.max(0,Math.min(i.y+i.height,e.height)-Math.max(i.y,0));return o*s/t}function Vr(i){let{current:e,viewport:t}=i,o=new Map;for(let l of i.sections){let a=hc(l.bounds,t)*l.members;a<=0||o.set(l.logicalId,(o.get(l.logicalId)??0)+a)}if(!o.size)return e;let s=null,r=0;for(let[l,a]of o)a>r&&(r=a,s=l);if(!s||s===e)return e;let n=e!=null?o.get(e)??0:0;return r>n*1.35?s:e}import{Text as uc}from"konva/lib/shapes/Text";function dc(i,e){return i.x<e.x+e.width&&e.x<i.x+i.width&&i.y<e.y+e.height&&e.y<i.y+i.height}var Je=class{constructor(){this.cells=new Map}insert(e){for(let t of this.keys(e)){let o=this.cells.get(t);o?o.push(e):this.cells.set(t,[e])}}collisionCount(e){let t=new Set,o=0;for(let s of this.keys(e))for(let r of this.cells.get(s)??[])t.has(r)||(t.add(r),dc(e,r)&&o++);return o}keys(e){let t=Math.floor(e.x/ht),o=Math.floor((e.x+Math.max(0,e.width))/ht),s=Math.floor(e.y/ht),r=Math.floor((e.y+Math.max(0,e.height))/ht),n=[];for(let l=s;l<=r;l++)for(let a=t;a<=o;a++)n.push(`${a}:${l}`);return n}};function Kr(i,e){let t=i.sections.filter(y=>y.id===e||y.logicalId===e),o=t.map(y=>{if(i.viewMode==="perspective"&&y.perspectiveAffine)return K(y.outline.map(g=>i.projectedSectionPoint(y,g)));let m=y.liftWorld>0?i.isoLiftLocal(y.liftWorld):{x:0,y:0},f=y.outline.map(g=>{let b={x:g.x+m.x,y:g.y+m.y};return i.isoT===0?b:i.isoForward(b)});return K(f)});if(!o.length)return null;let s=Math.min(...o.map(y=>y.x)),r=Math.min(...o.map(y=>y.y)),n=Math.max(...o.map(y=>y.x+y.width)),l=Math.max(...o.map(y=>y.y+y.height)),a=new Set(t.flatMap(y=>y.memberIds));for(let y of a){let m=i.seatById.get(y);if(!m)continue;let f=i.renderedSeatPoint(m);s=Math.min(s,f.x-i.seatR),r=Math.min(r,f.y-i.seatR),n=Math.max(n,f.x+i.seatR),l=Math.max(l,f.y+i.seatR)}let c=y=>{[y.x,y.y,y.width,y.height].every(Number.isFinite)&&(s=Math.min(s,y.x),r=Math.min(r,y.y),n=Math.max(n,y.x+y.width),l=Math.max(l,y.y+y.height))},h=y=>{let m={x:y.x+y.width/2,y:y.y+y.height/2};return t.some(f=>ie(m,f.outline,f.holes))};for(let{node:y,backdrop:m}of i.freeTextById.values()){let f=y.getClientRect({relativeTo:i.bgLayer,skipShadow:!0});h(f)&&(c(f),m&&c(m.getClientRect({relativeTo:i.bgLayer,skipShadow:!0})))}for(let{node:y}of i.iconNodeById.values()){let m=y.getClientRect({relativeTo:i.bgLayer,skipShadow:!0});h(m)&&c(m)}let d=new Je;for(let{node:y}of i.freeTextById.values()){let m=y.getClientRect({relativeTo:i.bgLayer,skipShadow:!0,skipStroke:!0});d.insert({x:m.x-j,y:m.y-j,width:m.width+j*2,height:m.height+j*2})}for(let y of i.rowLabelPlan){let m=(y.focusKeys??[]).some(S=>S===e||t.some(v=>S===v.id||S===v.logicalId)),f=new uc({text:y.text,fontSize:y.fontSize,fontStyle:"700",fontFamily:i.labelFont(),rotation:y.rotation,listening:!1});f.offsetX(f.width()/2),f.offsetY(f.height()/2);let g=i.resolveAutomaticRowLabelPosition(f,y,d),b=i.rowLabelBox(f,g);m&&c(b),d.insert(b),f.destroy()}let u=Math.max(n-s,l-r),p=Math.max(i.seatR*2,Math.min(24,u*.025));return{x:s-p,y:r-p,width:Math.max(1,n-s+p*2),height:Math.max(1,l-r+p*2)}}import{Rect as pc}from"konva/lib/shapes/Rect";import{Text as zr}from"konva/lib/shapes/Text";var ji="\0";function fc(i){let t=[...G("map.fromPrice",{price:ji}).toLocaleLowerCase()],o=t.findIndex(s=>s!==ji&&s.toLocaleUpperCase()!==s.toLocaleLowerCase());return o>=0&&(t[o]=t[o].toLocaleUpperCase()),t.join("").split(ji).join(i)}function Xr(i,e){if(!e.zones?.length||!i.sections.length)return;let t=lr(i.canvasBackground),o=new Map;for(let s of i.sections)s.zone&&(o.get(s.zone)??o.set(s.zone,[]).get(s.zone)).push(s);for(let s of e.zones){let r=o.get(s.id);if(!r||!r.length)continue;let n=r[0];for(let f of r)f.centroid.y<n.centroid.y&&(n=f);let l=n.centroid.x,a=n.centroid.y,c=1/0,h=-1/0;for(let f of r)for(let g of f.outline)g.x<c&&(c=g.x),g.x>h&&(h=g.x);let d=isFinite(c)&&h>c?h-c:0,u=1/0;for(let f of r)for(let g of f.memberIds){let b=i.seatById.get(g),S=b&&i.catPrice.get(b.categoryKey);typeof S=="number"&&S<u&&(u=S)}let p=new pc({x:l,y:a,width:1,height:1,offsetX:.5,offsetY:.5,cornerRadius:1,fill:t.plate,stroke:B(s.color??n.outlineTint,Ks),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});i.bgLayer.add(p);let y=new zr({x:l,y:a,text:s.label,fontSize:Xt,fontStyle:Os,letterSpacing:0,fontFamily:i.labelFont(),fill:t.ink,opacity:0,listening:!1,perfectDrawEnabled:!1});y.offsetX(y.width()/2),y.offsetY(y.height()/2),i.bgLayer.add(y);let m=null;isFinite(u)&&(m=new zr({x:l,y:a,text:fc(mt(u,i.currency)),fontSize:Yt,fontStyle:Ds,fontFamily:i.labelFont(),fill:t.subInk,opacity:0,listening:!1,perfectDrawEnabled:!1}),m.offsetX(m.width()/2),i.bgLayer.add(m)),i.zones.push({id:s.id,anchor:{x:l,y:a},back:p,background:t.plate,name:s.label,spanWorld:d,label:y,sub:m})}}import{Circle as wc}from"konva/lib/shapes/Circle";import{Line as Lc}from"konva/lib/shapes/Line";import{Rect as kc}from"konva/lib/shapes/Rect";import{Text as Tc}from"konva/lib/shapes/Text";function we(i,e){return e.length===0?!!i.accessible:!!i.accessibility?.some(t=>e.includes(t))}function et(i,e){return we(i,e)?"match":i.accessibility?.includes("companion")?"companion":"other"}var Yr=.35,Ur=.7,tt="#0b1220",gt="#ffffff",$r="#0b1220",qr="#232c40",Zr="#8b93a7";function Qi(i,e,t="normal"){let o=i?"bold":t;return e?`italic ${o}`.trim():o}var Ji="#f7f8fb";import{Shape as yc}from"konva/lib/Shape";import{Circle as gc}from"konva/lib/shapes/Circle";import{Rect as bc}from"konva/lib/shapes/Rect";var mc={M:2,L:2,Q:4,C:6,Z:0},eo=new Map;function to(i){let e=eo.get(i);if(e)return e;let t=Ht(i);if(!t)return eo.set(i,[]),[];let o=t.match(/[MLQCZ]|-?(?:\d+(?:\.\d+)?|\.\d+)/g)??[],s=[],r=0;for(;r<o.length;){let n=o[r++],l=mc[n];if(l===void 0||r+l>o.length)throw new Error(`Invalid path data for seat glyph "${i}".`);let a=o.slice(r,r+l).map(Number);if(a.some(c=>!Number.isFinite(c)))throw new Error(`Invalid coordinate in seat glyph "${i}".`);r+=l,n==="M"||n==="L"?s.push({command:n,points:a}):n==="Q"?s.push({command:n,points:a}):n==="C"?s.push({command:n,points:a}):s.push({command:"Z",points:[]})}return eo.set(i,s),s}function jr(i,e,t,o=0,s=0){let r=to(e),n=ts(e).bounds;if(!r.length||!n||!(t>0))return!1;let l=is(n,t);i.save(),i.translate(o,s),i.scale(l.scale,l.scale),i.translate(-l.centreX,-l.centreY);for(let a of r)a.command==="M"?i.moveTo(a.points[0],a.points[1]):a.command==="L"?i.lineTo(a.points[0],a.points[1]):a.command==="Q"?i.quadraticCurveTo(a.points[0],a.points[1],a.points[2],a.points[3]):a.command==="C"?i.bezierCurveTo(a.points[0],a.points[1],a.points[2],a.points[3],a.points[4],a.points[5]):i.closePath();return i.restore(),!0}function Qr(i,e){i.beginPath(),i.arc(0,0,e,0,Math.PI*2,!1),i.closePath()}var bt=class extends yc{_sceneFunc(e){let t=this.attrs.seatRadius||1,o=this.attrs.seatGlyph,s=to(o),r=this.attrs.seatGlyphDetail,n;if(r===void 0){let l=this.getAbsoluteScale(),a=Math.max(Math.abs(l.x),Math.abs(l.y)),c=Number.isFinite(a)&&a>0?a:1;n=t*2*c>=16}else n=r;if(!s.length||!n){Qr(e,t),e.fillStrokeShape(this);return}e.beginPath(),jr(e,o,t),e.fillStrokeShape(this)}_hitFunc(e){Qr(e,this.attrs.seatRadius||1),e.fillStrokeShape(this)}getSelfRect(){let e=this.attrs.seatRadius||1;return{x:-e,y:-e,width:e*2,height:e*2}}};function Sc(i,e){return i==="circle"||!Ht(i)?null:new bt({x:e.x,y:e.y,seatRadius:e.radius,seatGlyph:i,...e.detail===void 0?{}:{seatGlyphDetail:e.detail},...e.fill?{fill:e.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function Jr(i){let{x:e,y:t,radius:o}=i;return i.wheelchairBay?new bc({x:e,y:t,width:o*2,height:o*2,offsetX:o,offsetY:o,cornerRadius:2,...i.fill?{fill:i.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}):Sc(i.glyph,{x:e,y:t,radius:o,detail:i.detail,fill:i.fill})??new gc({x:e,y:t,radius:o,...i.fill?{fill:i.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function vc(i,e){return i*2*e>=16}function en(i,e,t,o){let s=vc(e,t);if(s===o||!i.length)return s;for(let r of i)r.setAttr("seatGlyphDetail",s);return s}function tn(i){let e=[...i.seats].sort((t,o)=>(i.perspectiveSeatDepth.get(o.id)??0)-(i.perspectiveSeatDepth.get(t.id)??0));for(let t of e){if(t.kind==="booth"){xc(i,t);continue}let o=i.seatContainer(t.id),s=Jr({x:t.x,y:t.y,radius:i.seatR,detail:i.seatGlyphDetail,glyph:os(t.glyph,i.catByKey.get(t.categoryKey)),wheelchairBay:t.wheelchairSpaceType==="no-seat"});if(s instanceof bt&&i.glyphMarkers.push(s),s.setAttr("seatId",t.id),i.circleById.set(t.id,s),i.paintSeat(s,t.id),o.add(s),t.accessible){if(t.wheelchairSpaceType!=="no-seat"){let r=new wc({x:t.x,y:t.y,radius:i.seatR+1.5,stroke:Pt(t.accessibility),strokeWidth:2.5,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});i.accessRingById.set(t.id,r),o.add(r)}if(t.accessibility?.includes("wheelchair")&&Ot(t.accessibility)){let r=i.buildAccessGlyph(t,typeof s.fill()=="string"?s.fill():"");i.accessGlyphById.set(t.id,r),o.add(r)}}}}function xc(i,e){let t=i.seatContainer(e.id),o=i.boothDims.get(e.rowId)??{width:40,height:30,rotation:0},s=e.x,r=e.y,n;o.points&&o.points.length>=3?(n=new Lc({x:e.x,y:e.y,points:o.points.flatMap(a=>[a.x,a.y]),closed:!0,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),s=e.x+o.points.reduce((a,c)=>a+c.x,0)/o.points.length,r=e.y+o.points.reduce((a,c)=>a+c.y,0)/o.points.length):n=new kc({x:e.x,y:e.y,width:o.width,height:o.height,offsetX:o.width/2,offsetY:o.height/2,rotation:o.rotation,cornerRadius:4,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),n.setAttr("seatId",e.id),i.circleById.set(e.id,n),t.add(n);let l=new Tc({x:s,y:r,text:e.displayLabel??e.label,fontSize:Me,fontStyle:"600",fontFamily:i.labelFont(),fill:i.theme.seatLabelColor??tt,listening:!1,perfectDrawEnabled:!1});l.offsetX(l.width()/2),l.offsetY(l.height()/2),l.visible(!1),i.setHasBoothText(),i.boothLabelById.set(e.id,l),t.add(l),i.paintSeat(n,e.id)}function on(i,e,t,o){let s=null,r=1/0,n=i.stage.scaleX()||1;for(let l of i.seats){if(!o?.includeUnavailable&&!i.selection.has(l.id)&&!i.isSelectable(l.id))continue;let a=i.worldToScreen(l),c=i.viewMode==="perspective"?i.perspectiveSeatScale.get(l.id)??1:1,h=i.seatR*n*c+t,d=Math.hypot(a.x-e.x,a.y-e.y);d<=h&&d<r&&(r=d,s=l.id)}return s}function sn(i){if(!i.objectFloor.size)return null;let e=i.stage.getPointerPosition();if(!e)return null;let t=i.screenToWorld(e),o=null,s=1/0;for(let r of i.seats){let n=i.renderedSeatPoint(r),l=n.x-t.x,a=n.y-t.y,c=l*l+a*a;c<s&&(s=c,o=r.rowId)}return o?i.objectFloor.get(o)??null:null}import{Circle as Dc}from"konva/lib/shapes/Circle";import{Group as Ln}from"konva/lib/Group";import{Rect as Nc}from"konva/lib/shapes/Rect";import{Text as Hc}from"konva/lib/shapes/Text";var Le=1.12;function it(i,e,t,o){if(e.width<=0||e.height<=0)return i.scaleX();let s=o??{x:0,y:0,width:i.width(),height:i.height()},r=Math.min(s.width/(e.width*Le),s.height/(e.height*Le));return V(r,t.min,t.max)}function rn(i){let{stage:e,box:t,bounds:o,viewport:s,centreScreen:r}=i,n=i.ratio??pt,l=e.scaleX(),a=it(e,t,o,s)/Math.max(l,1e-4);if(a>=n||a<=1/n)return!1;let c=r.x-(s.x+s.width/2),h=r.y-(s.y+s.height/2);return Math.hypot(c,h)<=Math.min(s.width,s.height)*.02}function nn(i,e,t,o){let s=V(e,o.min,o.max),r=i.scaleX();if(s===r)return!1;let n=(t.x-i.x())/r,l=(t.y-i.y())/r;return i.scale({x:s,y:s}),i.position({x:t.x-n*s,y:t.y-l*s}),!0}function an(i,e,t,o,s){let r=s??{x:0,y:0,width:i.width(),height:i.height()},n=Math.min(r.width/(e.width*Le),r.height/(e.height*Le)),l=V(Math.max(n,o??t.min),t.min,t.max);i.scale({x:l,y:l}),i.position({x:r.x+r.width/2-(e.x+e.width/2)*l,y:r.y+r.height/2-(e.y+e.height/2)*l})}function ln(i,e){return i===null||e===null?i===e:i.size===e.size&&[...i].every(t=>e.has(t))}function cn(i,e){let t=null;for(let o of i){let s=e.get(o)?.logicalId;if(!s||t!=null&&t!==s)return null;t=s}return t}function hn(i,e){if(!e?.size)return!1;for(let t of i)if(e.has(t))return!1;return!0}function fn(i,e){let t=i.sectionHeat.get(e.id)??i.sectionHeat.get(e.logicalId)??(e.zone?i.sectionHeat.get(e.zone):void 0);if(t==null||t<=0){e.outlinePoly.stroke(B(e.outlineTint,.5)),e.outlinePoly.fill(B(e.outlineTint,.08)),e.outlinePoly.strokeWidth(1.75),e.outlinePoly.shadowOpacity(0);return}let o=re("#f4b740","#ef4444",t);e.outlinePoly.stroke(B(o,.72+t*.25)),e.outlinePoly.fill(B(o,.08+t*.13)),e.outlinePoly.strokeWidth(2+t*3.5),e.outlinePoly.shadowColor(o),e.outlinePoly.shadowBlur(4+t*12),e.outlinePoly.shadowOpacity(.25+t*.45)}function oo(i,e){return i.closedSections.has(e.id)||i.closedSections.has(e.logicalId)||e.zone!=null&&i.closedSections.has(e.zone)}function mn(i,e,t,o){if(!e)return 0;let s=0;for(let r of i){if(t(r)!=="free")continue;let n=o(r);n&&we(n,e)&&(s+=1)}return s}function yn(i,e){return oo(i,e)?"closed":e.total<=0?"normal":e.free<=0?"sold-out":e.free<=e.total*js?"nearly-gone":"normal"}function gn(i,e){let t=yn(i,e),o=i.accessFilterActive&&i.sectionAccessibleFree(e)<=0,s=nr(i.canvasBackground,t,o?null:e.shellCategoryColor);e.shellFill=s.fill,e.shellStroke=s.stroke,e.blockPoly.fill(s.fill),e.blockPoly.stroke(s.stroke),e.subLabel.text(t==="sold-out"?G("map.soldOut"):G("map.seatsLeft",{count:e.free})),e.subLabel.offsetX(e.subLabel.width()/2)}function so(i,e){return re(e,D(i)?"#ffffff":"#000000",qs)}function ro(i,e,t=0){let o=$s-t;return!e||i.length<=o?i:`${i.slice(0,Math.max(1,o-1)).trimEnd()}\u2026`}function Cc(i,e){return i.accessFilterActive&&i.sectionAccessibleFree(e)>0}function Ic(i,e,t){let o=Cc(i,e),s=ro(e.label,t,o?2:0),r=o?`\u267F ${s}`:s;e.nameLabel.text()!==r&&e.nameLabel.text(r),e.nameLabel.fontStyle(t?Ut:Oe),e.nameLabel.letterSpacing(t?e.nameLabel.fontSize()*De:0)}function Pc(i,e,t){let o=i.stageWidth<de,s=e.nameLabel.opacity();if(!o||s<=.05||!e.nameLabel.visible()){e.namePlate.opacity(0),e.subLabel.opacity(0);return}let r=e.nameLabel.rotation(),n=r===0&&yn(i,e)==="sold-out",l=ut/t,a=qt/t,c=n?2/t:0,h={x:e.nameLabel.x(),y:e.nameLabel.y()},d=e.nameLabel.height(),u=0;n?(Ce(e.subLabel,he/t,h.y),u=e.subLabel.height(),e.subLabel.rotation(0),e.subLabel.x(h.x),e.subLabel.y(h.y+d/2+c+u/2),e.subLabel.opacity(s)):e.subLabel.opacity(0);let p=n?c+u:0,y=Math.max(e.nameLabel.width(),n?e.subLabel.width():0)+l*2,m=d+p+a*2;e.namePlate.position({x:h.x,y:h.y+p/2}),e.namePlate.rotation(r),e.namePlate.size({width:y,height:m}),e.namePlate.offset({x:y/2,y:m/2}),e.namePlate.cornerRadius(Zs/t),e.namePlate.opacity(s*$t)}function bn(i,e){let t,o;i.reducedMotion?(t=e<=Se?1:0,o=e<=Ue?1:0):(t=V((ve-e)/(ve-Se),0,1),o=V((Se-e)/(Se-Ue),0,1)),(i.floorOverview||i.focusedSectionId)&&(t=0,o=0);let s=!i.floorOverview&&!i.focusedSectionId&&e<le;s&&(t=1),i.zones.length||(o=0);let r=i.viewMode==="perspective"&&i.glideInProgress&&i.seatCount>2500;i.seatLayer.opacity(s||r?0:1-t);let n=i.stageScaleX,l=!i.glideInProgress&&(i.lodScale===0||Math.abs(e-i.lodScale)/(i.lodScale||1)>.08);l&&i.setLodScale(e);let a=i.focusedSectionId,c=i.stageWidth<de,h=ee(i.canvasBackground),d=V((t-.2)/.8,0,1);for(let p of i.sections){let y=i.hasFocusDimOverlay?1:a&&p.id!==a&&p.logicalId!==a&&p.zone!==a?Ne:1,m=Math.min(y,hn(p.memberCategoryKeys,i.categoryFilter)?Ne:1);p.outlinePoly.opacity(s?0:(1-t)*m),p.blockPoly.opacity(_s*t*m);let f=i.sectionIsOwned(p);p.blockPoly.stroke(f?i.selectionColor:p.shellStroke||h.sectionStroke),p.blockPoly.strokeWidth((f?Bs:Fe)/Math.max(n,1e-4));let g=p.blockPoly.fill(),b=typeof g=="string"?g:p.baseFill,S=c?so(i.canvasBackground,b):null;S&&p.namePlate.fill(S);let v=Ae(S??b,p.explicitInk,p.preferredInk);p.nameLabel.fill(v),p.subLabel.fill(v),Ic(i,p,c),l&&d>.01&&Ac(i,p,n),p.nameLabel.opacity(p.nameLabelFits?d*(1-o)*m:0),p.subLabel.opacity(0)}let u=o*(1-i.isoT);for(let p of i.zones){let y=p.label.visible()?u:0;p.back.opacity(y),p.label.opacity(y),p.sub&&p.sub.opacity(dn(i,p)?0:y),l&&Ec(i,p,n)}if(!i.glideInProgress&&(d>.01||u>.01)){Rc(i,n),Mc(i.sections);for(let p of i.zones){let y=p.label.opacity();p.back.opacity(y),p.sub&&p.sub.opacity(dn(i,p)?0:y)}}for(let p of i.sections)Pc(i,p,n);i.bgLayer.batchDraw()}function dn(i,e){return i.stageWidth<de||!e.sub||!e.sub.visible()}function Mc(i){let e=new Map;for(let t of i)(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 o=t.filter(s=>s.nameLabel.opacity()>.05).sort((s,r)=>{let n=K(s.outline),l=K(r.outline);return l.width*l.height-n.width*n.height});for(let s of o.slice(1))s.nameLabel.opacity(0)}}function Rc(i,e){let o=[],s=a=>{let c=i.worldToScreen({x:a.x(),y:a.y()}),h=K(Qe({x:0,y:0},a.width()*e,a.height()*e,a.rotation()));return{x:c.x-h.width/2,y:c.y-h.height/2,w:h.width,h:h.height}};for(let a of i.zones){if(a.label.opacity()<=.05)continue;let c=a.back.getAbsolutePosition(),h=a.back.width()*e,d=a.back.height()*e;o.push({node:a.label,tier:0,section:!1,zone:a,box:{x:c.x-h/2,y:c.y-d/2,w:h,h:d}})}for(let a of i.sections)a.nameLabel.opacity()>.05&&o.push({node:a.nameLabel,tier:1,section:!0,area:a.labelArea,box:s(a.nameLabel)});let r=i.landmarks.map(a=>{let c=i.worldToScreen({x:a.x,y:a.y}),h=i.worldToScreen({x:a.x+a.width,y:a.y+a.height});return{x:Math.min(c.x,h.x),y:Math.min(c.y,h.y),w:Math.abs(h.x-c.x),h:Math.abs(h.y-c.y)}});if(o.length<2&&!r.length)return;o.sort((a,c)=>a.tier-c.tier||(c.area??0)-(a.area??0)||a.box.y-c.box.y||a.box.x-c.box.x);let n=[...r],l=a=>n.some(c=>a.x<c.x+c.w+4&&c.x<a.x+a.w+4&&a.y<c.y+c.h+4&&c.y<a.y+a.h+4);for(let a of o){if(!l(a.box)){n.push(a.box);continue}let c=!1;if(a.zone)for(let h of Ys){if(h===0)continue;let d={...a.box,y:a.box.y+h};if(!l(d)){io(a.zone,0,h/e),n.push(d),c=!0;break}}if(a.section){let h=a.node.fontSize(),d=a.node.y(),u=a.node.letterSpacing()>0;for(let p of Di){let y=h*p;if(y*e<he)break;Ce(a.node,y,d),u&&(a.node.letterSpacing(a.node.fontSize()*De),a.node.offsetX(a.node.width()/2));let m=s(a.node);if(!l(m)){n.push(m),c=!0;break}}c||(Ce(a.node,h,d),u&&(a.node.letterSpacing(a.node.fontSize()*De),a.node.offsetX(a.node.width()/2)))}c||a.node.opacity(0)}}function Ce(i,e,t){i.fontSize(Math.max(1,e)),i.offsetX(i.width()/2),i.offsetY(i.height()/2),i.y(t)}function Ac(i,e,t){e.subLabelFits=!1;let o=i.stageWidth<de,s=o?ut*2:0,r=qe($e*e.labelScale,i.stageWidth),n=he;for(let l=r;l>=n;l-=1)for(let a of[0,-90]){e.nameLabel.rotation(a),Ce(e.nameLabel,l/t,e.nameLabel.y()),o&&(e.nameLabel.letterSpacing(e.nameLabel.fontSize()*De),e.nameLabel.offsetX(e.nameLabel.width()/2));for(let c of e.labelAnchors){e.nameLabel.position(c);let h=(8+s)/t;if(ni(c,e.nameLabel.width()+h,e.nameLabel.height()+h,a,e.outline,e.holes)){e.nameLabelFits=!0;return}}}e.nameLabel.position(e.centroid),e.nameLabel.rotation(0),e.nameLabelFits=!1}function un(i,e,t){let o=s=>(i.text(s),i.width());if(!(o(e)<=t)){for(let s=e.length-1;s>=1;s-=1)if(o(`${e.slice(0,s).trimEnd()}\u2026`)<=t)return;o("\u2026")}}function Ec(i,e,t){let o=Ni(i.stageWidth),s=i.stageWidth<de,r=e.sub!=null&&!s,n=(s?Ns:Gs)*o/t,l=(s?Hs:Ws)*o/t,a=qe(Xt,i.stageWidth);e.label.text(e.name),Ce(e.label,a/t,e.anchor.y),r&&(Ce(e.sub,qe(Yt,i.stageWidth)/t,e.anchor.y),e.sub.letterSpacing(e.sub.fontSize()*Fs),e.sub.offsetX(e.sub.width()/2));let c=s?i.stageWidth*zs/t-n*2:1/0,h=!s&&e.spanWorld>0?e.spanWorld*Xs-n*2:1/0,d=Math.min(c,h),u=()=>Math.max(e.label.width(),r?e.sub.width():0);if(r&&u()>d&&(r=!1),u()>d)for(let k of Di){let T=Math.max(he,a*k);if(T>=e.label.fontSize()*t-.001||(Ce(e.label,T/t,e.anchor.y),e.label.width()<=d))break}if(e.label.width()>d&&(un(e.label,e.name,Math.max(d,1)),_c(e.label.text())<Bc(e.name)&&un(e.label,e.name,Math.max(c,1)),Ce(e.label,e.label.fontSize(),e.anchor.y)),e.sub&&e.sub.visible(r),c<=0||e.label.width()>c+.001){pn(e);return}e.label.visible(!0),e.back.visible(!0);let p=r?3*o/t:0;e.label.x(e.anchor.x),r?e.sub.x(e.anchor.x):e.sub&&e.sub.opacity(0);let y=Math.max(e.label.width(),r?e.sub.width():0)+n*2,m=e.label.height()+(r?p+e.sub.height():0)+l*2;e.label.y(e.anchor.y-(r?(p+e.sub.height())/2:0)),r&&e.sub.y(e.anchor.y+(e.label.height()+p)/2),e.back.position(e.anchor),e.back.size({width:y,height:m}),e.back.offset({x:y/2,y:m/2}),e.back.cornerRadius(Vs*o/t),e.back.strokeWidth(1/t);let f=e.back.getAbsolutePosition(),g=6,b=y*t;if(b>i.stageWidth-g*2){pn(e);return}let S=b/2,w=(V(f.x,g+S,i.stageWidth-g-S)-f.x)/t;Math.abs(w)>.001&&io(e,w,0);let L=62+m*t/2;f.y<L&&io(e,0,(L-f.y)/t)}function _c(i){return i.endsWith("\u2026")?i.slice(0,-1).trimEnd().length:i.length}function Bc(i){return Math.min(i.length,Math.max(6,Math.ceil(i.length/2)))}function pn(i){i.label.visible(!1),i.label.opacity(0),i.back.visible(!1),i.back.opacity(0),i.sub&&(i.sub.visible(!1),i.sub.opacity(0))}function io(i,e,t){i.label.x(i.label.x()+e),i.label.y(i.label.y()+t),i.sub&&(i.sub.x(i.sub.x()+e),i.sub.y(i.sub.y()+t)),i.back.x(i.back.x()+e),i.back.y(i.back.y()+t)}function Fc(i,e){if(!i.length)return null;let t=1/0,o=1/0,s=-1/0,r=-1/0;for(let n of i)!Number.isFinite(n.x)||!Number.isFinite(n.y)||(n.x<t&&(t=n.x),n.y<o&&(o=n.y),n.x>s&&(s=n.x),n.y>r&&(r=n.y));return!Number.isFinite(t)||!Number.isFinite(o)?null:{x:t-e,y:o-e,width:s-t+e*2,height:r-o+e*2}}function lo(i,e=0){let t=new Map;for(let s of i){let r=`${s.rowId}|${s.categoryKey}`,n=t.get(r);n||(n={categoryKey:s.categoryKey,points:[]},t.set(r,n)),n.points.push({x:s.x,y:s.y})}let o=[];for(let[s,r]of t){let n=Fc(r.points,e);n&&o.push({id:s,categoryKey:r.categoryKey,seatCount:r.points.length,bounds:n})}return o}function no(i,e){let t=Math.max(0,Math.max(i.x-(e.x+e.width),e.x-(i.x+i.width))),o=Math.max(0,Math.max(i.y-(e.y+e.height),e.y-(i.y+i.height)));return Math.hypot(t,o)}function ao(i,e){let t=Math.min(i.x,e.x),o=Math.min(i.y,e.y);return{x:t,y:o,width:Math.max(i.x+i.width,e.x+e.width)-t,height:Math.max(i.y+i.height,e.y+e.height)-o}}function Sn(i){if(!i.length)return 0;let e=[...i].sort((o,s)=>o-s),t=Math.floor(e.length/2);return e.length%2?e[t]:(e[t-1]+e[t])/2}function Oc(i){if(!i.length)return 0;let e=Sn(i.map(o=>Math.min(o.bounds.width,o.bounds.height)));if(i.length<2)return e;let t=[];for(let o=0;o<i.length;o+=1){let s=1/0;for(let r=0;r<i.length;r+=1)o!==r&&(s=Math.min(s,no(i[o].bounds,i[r].bounds)));Number.isFinite(s)&&t.push(s)}return Sn(t)+e}function co(i,e){if(!i.length)return[];let t=Oc(i)*(e?.gapRows??2),o=e?.minRows??2,s=e?.minSeats??12,r=new Map;for(let l of i){let a=r.get(l.categoryKey);a?a.push(l):r.set(l.categoryKey,[l])}let n=[];for(let[l,a]of r){let c=[...a].sort((u,p)=>u.bounds.y-p.bounds.y||u.bounds.x-p.bounds.x||u.id.localeCompare(p.id)),h=[];for(let u of c){let p=h.find(y=>no(y.bounds,u.bounds)<=t);p?(p.bounds=ao(p.bounds,u.bounds),p.rowIds.push(u.id),p.seatCount+=u.seatCount):h.push({categoryKey:l,bounds:{...u.bounds},rowIds:[u.id],seatCount:u.seatCount})}let d=!0;for(;d&&h.length>1;){d=!1;e:for(let u=0;u<h.length;u+=1)for(let p=u+1;p<h.length;p+=1)if(!(no(h[u].bounds,h[p].bounds)>t)){h[u].bounds=ao(h[u].bounds,h[p].bounds),h[u].rowIds.push(...h[p].rowIds),h[u].seatCount+=h[p].seatCount,h.splice(p,1),d=!0;break e}}for(let u of h)u.rowIds.length<o&&u.seatCount<s||(u.rowIds.sort(),n.push(u))}return n.sort((l,a)=>l.bounds.y-a.bounds.y||l.bounds.x-a.bounds.x||l.categoryKey.localeCompare(a.categoryKey)),n}function vn(i){let e=null;for(let t of i)e=e?ao(e,t.bounds):{...t.bounds};return e}function wn(i,e){let t=null,o=1/0;for(let s of i){let{x:r,y:n,width:l,height:a}=s.bounds;if(e.x<r||e.x>r+l||e.y<n||e.y>n+a)continue;let c=l*a;c<o&&(t=s,o=c)}return t}function xn(i){return i*.3}function kn(i){return xn(i)*2+i*.42}var ai=class{constructor(e){this.host=e;this.group=null;this.labels=[];this.revealed=!1;this.visible=!1;this.fadeRaf=0;this.lastFontKey=""}get all(){return this.labels.map(e=>e.cluster)}clear(){this.fadeRaf&&(cancelAnimationFrame(this.fadeRaf),this.fadeRaf=0),this.group?.destroy(),this.group=null,this.labels=[],this.visible=!1,this.revealed=!1,this.lastFontKey=""}destroy(){this.clear()}rebuild(){if(this.clear(),this.syncCursor(!1),this.host.hasSections()||this.host.exportMode)return;let e=co(lo(this.host.seats(),this.host.seatR()));if(!e.length)return;let t=this.host.canvasBackground(),o=ee(t),s=so(t,t),r=ne(s,o.sectionInk),n=new Ln({listening:!1,opacity:0,visible:!1});for(let l of e){let a=this.host.categoryLabel(l.categoryKey);if(!a)continue;let c={x:l.bounds.x+l.bounds.width/2,y:l.bounds.y+l.bounds.height/2},h=new Ln({listening:!1}),d=new Nc({...c,width:0,height:0,fill:s,stroke:o.sectionStroke,strokeWidth:Fe,opacity:$t,listening:!1,perfectDrawEnabled:!1}),u=new Dc({...c,radius:0,fill:this.host.categoryColor(l.categoryKey),listening:!1,perfectDrawEnabled:!1}),p=this.host.categoryPriceLabel(l.categoryKey),y=new Hc({...c,text:a,fontSize:$e,fontStyle:Oe,fontFamily:this.host.labelFont(),fill:r,listening:!1,perfectDrawEnabled:!1});h.add(d),h.add(u),h.add(y),n.add(h),this.labels.push({cluster:l,pill:h,plate:d,swatch:u,text:y,label:a,price:p})}if(!this.labels.length){n.destroy();return}this.group=n,this.host.labelLayer.add(n)}syncForCamera(e){if(!this.group||!this.labels.length)return!1;let t=this.host.seatR()*2,o=this.host.exportMode||this.host.viewMode()!=="flat"||this.host.seatsPickable()&&e<Be;return this.revealed=o||Ls(Bi(t,e),Bi(t,Be),this.revealed),!this.revealed&&this.size(this.host.stage.scaleX(),this.host.stage.width())&&this.host.labelLayer.batchDraw(),this.applyFilterDim(),this.applyVisibility(!this.revealed),!0}focusCluster(e){if(this.host.viewMode()!=="flat"||this.host.hasSections()||this.host.seatsPickable())return!1;let t=this.clusterAt(this.host.screenToWorld(e));if(!t)return!1;let o=this.host.seatR()*2,s={x:t.bounds.x-o,y:t.bounds.y-o,width:t.bounds.width+o*2,height:t.bounds.height+o*2},r=this.host.stage;if(it(r,s,this.host.zoomBounds(),this.host.framingViewport())<=r.scaleX()*pt)return!1;let l=this.diveTarget(s);return l?(this.host.focusRegion(l,{durationMs:this.host.cameraGlideMs()}),!0):!1}diveTarget(e,t){let o=this.host.stage,s=this.host.framingViewport(),r=this.host.zoomBounds(),n=it(o,e,r,s),l=Math.min(Math.max(this.host.readableScale(),this.host.pickableScale()),r.max);if(n>=l)return e;let a=s.width/(l*Le),c=s.height/(l*Le);if(!(a>0)||!(c>0))return null;let h=t??{x:e.x+e.width/2,y:e.y+e.height/2};return{x:h.x-a/2,y:h.y-c/2,width:a,height:c}}glideTowardTap(e){if(this.host.viewMode()!=="flat")return!1;let t=this.host.stage.scaleX(),o=Js(t,this.host.pickableScale());if(o==null||o<=t*pt)return!1;let s=this.host.screenToWorld(e),r=this.host.framingViewport(),n=r.width/(o*Le),l=r.height/(o*Le);return!(n>0)||!(l>0)?!1:(this.host.focusRegion({x:s.x-n/2,y:s.y-l/2,width:n,height:l}),!0)}syncCursor(e){if(this.host.exportMode)return;let t=this.host.viewMode()==="flat"&&!this.host.seatsPickable()?"zoom-in":e?"pointer":"default";for(let o of[this.host.stage.container(),this.host.stage.content])o&&o.style.cursor!==t&&(o.style.cursor=t)}clusterAt(e){let t=wn(this.all,e);if(t)return t;if(!this.visible)return null;for(let o of this.labels){let s=o.plate.width()/2,r=o.plate.height()/2;if(Math.abs(e.x-o.text.x())<=s&&Math.abs(e.y-o.text.y())<=r)return o.cluster}return null}size(e,t){let o=Math.max(e,1e-4),s=t<de,r=`${o.toFixed(4)}|${t}`;if(r===this.lastFontKey)return!1;this.lastFontKey=r;let n=qe($e,t),l=ut/o,a=qt/o;for(let c of this.labels){let{text:h,plate:d,swatch:u,cluster:p}=c,y=ro(c.label,s);h.text(c.price?`${y} \xB7 ${c.price}`:y),h.fontStyle(s?Ut:Oe);let m=n,f=0;for(;h.fontSize(Math.max(1,m/o)),h.letterSpacing(h.fontSize()*De),f=kn(h.fontSize())+h.width()+l*2,!(f<=p.bounds.width||m<=he);)m=Math.max(he,m-1);let g={x:p.bounds.x+p.bounds.width/2,y:p.bounds.y+p.bounds.height/2},b=h.height()+a*2,S=f-l*2,v=g.x-S/2;u.radius(xn(h.fontSize())),u.position({x:v+u.radius(),y:g.y}),h.offsetX(0),h.offsetY(h.height()/2),h.position({x:v+kn(h.fontSize()),y:g.y}),d.size({width:f,height:b}),d.offset({x:f/2,y:b/2}),d.cornerRadius(b/2),d.strokeWidth(Fe/o),d.position(g)}return!0}applyFilterDim(){if(!this.labels.length)return;let e=this.host.categoryFilter(),t=!1;for(let o of this.labels){let s=e&&!e.has(o.cluster.categoryKey)?.22:1;o.pill.opacity()!==s&&(o.pill.opacity(s),t=!0)}t&&this.host.labelLayer.batchDraw()}boundsForSeats(e,t){if(!e.length)return null;let o=lo(e,this.host.seatR()),s=co(o);s.length||(s=o.map(l=>({categoryKey:l.categoryKey,bounds:l.bounds,rowIds:[l.id],seatCount:l.seatCount})));let r=vn(s);if(!r)return null;let n=s.reduce((l,a)=>a.seatCount>l.seatCount?a:l,s[0]);return{bounds:{x:r.x-t,y:r.y-t,width:r.width+t*2,height:r.height+t*2},anchor:{x:n.bounds.x+n.bounds.width/2,y:n.bounds.y+n.bounds.height/2}}}applyVisibility(e){let t=this.group;if(!t||e===this.visible)return;if(this.visible=e,this.fadeRaf&&(cancelAnimationFrame(this.fadeRaf),this.fadeRaf=0),t.visible(!0),this.host.reducedMotion()){t.opacity(e?1:0),t.visible(e),this.host.labelLayer.batchDraw();return}let o=t.opacity(),s=e?1:0,r=performance.now(),n=l=>{if(this.host.destroyed()||!this.group){this.fadeRaf=0;return}let a=Math.min(1,(l-r)/90);t.opacity(o+(s-o)*a),a>=1&&t.visible(s>0),this.host.labelLayer.batchDraw(),this.fadeRaf=a<1?requestAnimationFrame(n):0};this.fadeRaf=requestAnimationFrame(n)}};import{Circle as Gc}from"konva/lib/shapes/Circle";import{Line as Wc}from"konva/lib/shapes/Line";function Cn(i,e,t,o){let s=i.seatRadius(),r=new Gc({x:t.x,y:t.y,radius:s,stroke:o,strokeWidth:3,opacity:.9,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),n=i.viewMode()==="perspective"?i.perspectiveSeatScale(e):1;r.scale({x:n,y:n}),i.overlayLayer.add(r);let l=performance.now(),a=620,c=h=>{if(!r.getLayer())return;let d=Math.min(1,(h-l)/a);r.radius(s*(1+d*1.8)),r.opacity(.9*(1-d)),i.overlayLayer.batchDraw(),d<1?requestAnimationFrame(c):(r.destroy(),i.overlayLayer.batchDraw())};requestAnimationFrame(c)}function In(i,e,t){for(let o of e){let s=i.viewMode()==="perspective"&&o.perspectiveAffine?o.outline.map(d=>i.perspectiveLocalPoint(i.projectedSectionPoint(o,d))):o.outline.map(d=>{let u=o.liftWorld>0?i.isoLiftLocal(o.liftWorld):{x:0,y:0};return{x:d.x+u.x,y:d.y+u.y}}),r=s.reduce((d,u)=>({x:d.x+u.x,y:d.y+u.y}),{x:0,y:0});r.x/=s.length,r.y/=s.length;let n=new Wc({x:r.x,y:r.y,points:s.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});i.overlayLayer.add(n),i.overlayLayer.batchDraw();let l=()=>{n.getLayer()&&(n.destroy(),i.overlayLayer.batchDraw())};if(i.reducedMotion()||typeof document<"u"&&document.hidden){setTimeout(l,520);continue}let a=performance.now(),c=820,h=d=>{if(i.isDestroyed()||!n.getLayer())return;let u=Math.min(1,(d-a)/c),y=1+(1-Math.pow(1-u,3))*.04;n.scale({x:y,y}),n.opacity(.92*(1-u)),i.overlayLayer.batchDraw(),u<1?requestAnimationFrame(h):l()};requestAnimationFrame(h)}}import{Group as Xc}from"konva/lib/Group";import{Shape as Yc}from"konva/lib/Shape";import{Group as Vc}from"konva/lib/Group";import{Shape as Kc}from"konva/lib/Shape";function zc(i,e,t){let o=e.length,s={x:(e[o-1].x+e[0].x)/2,y:(e[o-1].y+e[0].y)/2};i.moveTo(s.x,s.y);for(let r=0;r<o;r+=1){let n=e[r],l=e[(r+1)%o],a=e[(r-1+o)%o],c=Math.min(Math.hypot(n.x-a.x,n.y-a.y)/2,Math.hypot(l.x-n.x,l.y-n.y)/2);i.arcTo(n.x,n.y,l.x,l.y,Math.max(0,Math.min(t,c)))}i.closePath()}function We(i,e,t,o){let s=at(i)>0,r=t.cornerRadius&&t.cornerRadius>0?t.cornerRadius:0;return new Kc({...t,sceneFunc(n,l){n.beginPath();let a=h=>{if(h.length){if(r>0&&h.length>=3)return zc(n,h,r);n.moveTo(h[0].x,h[0].y);for(let d=1;d<h.length;d+=1)n.lineTo(h[d].x,h[d].y);n.closePath()}};o?(h=>{n.moveTo(h.start.x,h.start.y);let d=h.start;for(let u of h.segments)u.kind==="line"?n.lineTo(u.end.x,u.end.y):u.kind==="arc"?n.arc(u.center.x,u.center.y,u.radius,Math.atan2(d.y-u.center.y,d.x-u.center.x),Math.atan2(u.end.y-u.center.y,u.end.x-u.center.x),!u.clockwise):n.bezierCurveTo(u.control1.x,u.control1.y,u.control2.x,u.control2.y,u.end.x,u.end.y),d=u.end;n.closePath()})(o):a(i);for(let h of e??[]){let d=at(h)>0;a(d===s?[...h].reverse():h)}n.fillStrokeShape(l)},perfectDrawEnabled:!1})}var St=class extends Vc{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)}};function Pn(i,e){if(!e.length)return null;let t=new Xc({listening:!1});for(let o of e){let s=i.viewMode==="perspective"&&o.perspectiveAffine,r=s?o.outline.map(l=>i.perspectiveLocalPoint(i.projectedSectionPoint(o,l))):o.outline,n=s?o.holes.map(l=>l.map(a=>i.perspectiveLocalPoint(i.projectedSectionPoint(o,a)))):o.holes;t.add(We(r,n,{fill:ir,stroke:B("#ffffff",.1),strokeWidth:1,listening:!1},s?void 0:o.outlinePath))}return i.bgLayer.add(t),t.moveToTop(),t}function Mn(i,e){let{bounds:t}=i,s=Math.max(t.width,t.height,1)*4+1e3,r=[{x:t.x-s,y:t.y-s},{x:t.x+t.width+s,y:t.y-s},{x:t.x+t.width+s,y:t.y+t.height+s},{x:t.x-s,y:t.y+t.height+s}],n=new Yc({fill:i.canvasBackground,opacity:1-Ne,listening:!1,perfectDrawEnabled:!1,sceneFunc:(l,a)=>{let c=h=>{if(h.length){l.moveTo(h[0].x,h[0].y);for(let d=1;d<h.length;d++)l.lineTo(h[d].x,h[d].y);l.closePath()}};l.beginPath(),c(r);for(let h of e){let d=i.viewMode==="perspective"&&h.perspectiveAffine?h.outline.map(u=>i.perspectiveLocalPoint(i.projectedSectionPoint(h,u))):h.outline.map(u=>{let p=h.liftWorld>0?i.isoLiftLocal(h.liftWorld):{x:0,y:0};return{x:u.x+p.x,y:u.y+p.y}});c(at(d)>0?[...d].reverse():d)}l.fillStrokeShape(a)}});return i.overlayLayer.add(n),n.moveToTop(),n}import{Rect as Ha}from"konva/lib/shapes/Rect";import{Line as Gh}from"konva/lib/shapes/Line";import{Text as Ga}from"konva/lib/shapes/Text";import{Path as Wh}from"konva/lib/shapes/Path";import{Text as Uc}from"konva/lib/shapes/Text";function Rn(i){let e=Me,t=new Uc({fontSize:me,fontStyle:"600",fontFamily:i.labelFont(),listening:!1}),o=i.seatR*2-3;for(let s of i.seats){if(s.kind==="booth"){e=Math.min(e,Me);continue}let r=me*i.seatLabelScale(s);t.fontSize(r),t.text(Dt(s.displayLabel??s.label));let n=t.width()>o?Math.max(ct,r*o/t.width()):r;e=Math.min(e,n)}return t.destroy(),H/Math.max(ct,e)}var ho={top:0,right:0,bottom:0,left:0};function An(i){let e=t=>typeof t=="number"&&Number.isFinite(t)&&t>0?t:0;return i?{top:e(i.top),right:e(i.right),bottom:e(i.bottom),left:e(i.left)}:{...ho}}var $c=.7;function En(i,e,t){let{top:o,right:s,bottom:r,left:n}=t,l=(u,p,y)=>{let m=u+p,f=y*$c;if(m<=f||m<=0)return[u,p];let g=f/m;return[u*g,p*g]},[a,c]=l(n,s,i),[h,d]=l(o,r,e);return{x:a,y:h,width:Math.max(1,i-a-c),height:Math.max(1,e-h-d)}}function _n(i){return{x:i.x(),y:i.y(),scale:i.scaleX()}}function Bn(i,e){return!Number.isFinite(e.x)||!Number.isFinite(e.y)||!(e.scale>0)?!1:(i.scale({x:e.scale,y:e.scale}),i.position({x:e.x,y:e.y}),!0)}function li(i){return{x:i.x+i.width/2,y:i.y+i.height/2}}function Fn(i,e){let t=e({x:i.x,y:i.y}),o=e({x:i.x+i.width,y:i.y+i.height});return{x:Math.min(t.x,o.x),y:Math.min(t.y,o.y),width:Math.abs(o.x-t.x),height:Math.abs(o.y-t.y)}}function Dn(){return typeof navigator<"u"&&navigator.maxTouchPoints>0?Es:As}function Nn(i){return Math.max(i*1.05,xs,le*1.3)}function ci(i,e){let t=1/0,o=-1/0,s=1/0,r=-1/0;for(let n of i)t=Math.min(t,n.x),o=Math.max(o,n.x),s=Math.min(s,n.y),r=Math.max(r,n.y);return t-=e,o+=e,s-=e,r+=e,{x:t,y:s,width:Math.max(40,o-t),height:Math.max(40,r-s)}}function Hn(i){let{stageWidth:e,stageHeight:t,fullBounds:o,visibleBounds:s,seatPoints:r,minScale:n}=i;if(!r.length)return null;let l=1.12;if(Math.min(e/(o.width*l),t/(o.height*l))>=n)return null;let c=i.tapAnchor??{x:s.x+s.width/2,y:s.y+s.height/2},h=r[0],d=1/0;for(let m of r){let f=(m.x-c.x)**2+(m.y-c.y)**2;f<d&&(h=m,d=f)}let u=e/(n*l),p=t/(n*l),y=ci(r,0);return{bounds:{x:On(h.x,u,y.x,y.width),y:On(h.y,p,y.y,y.height),width:u,height:p},minScale:n}}function On(i,e,t,o){return o<=e?t+o/2-e/2:Math.min(Math.max(i-e/2,t),t+o-e)}var zn=.5,W=Math.SQRT1_2,qc="#f3f4f6",Gn=4;function Zc(i){let e=i.fraction;return typeof e!="number"||!Number.isFinite(e)?zn:Math.min(1,Math.max(0,e))}function jc(i){return i==="booked"||i==="not_for_sale"?ft:Zt}function Wn(i,e){return Number.parseInt(i.slice(e,e+2),16)}function Vn(i){let e=i.trim();if(!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(e))return null;if(e.length===7)return e.toLowerCase();let[,t,o,s]=e.toLowerCase();return`#${t}${t}${o}${o}${s}${s}`}function Qc(i,e,t){let o=Vn(i),s=Vn(e);if(!o||!s)return i;let r=Math.min(1,Math.max(0,t)),n="#";for(let l=1;l<7;l+=2){let a=Math.round(Wn(o,l)*(1-r)+Wn(s,l)*r);n+=a.toString(16).padStart(2,"0")}return n}function Kn(i,e,t,o){let s=t*4,r=e*W,n=-e*W,l=o*W*2*s,a=o*-W*2*s,c=r+s*W,h=n+s*W,d=r-s*W,u=n-s*W;i.beginPath(),i.moveTo(c,h),i.lineTo(d,u),i.lineTo(d+l,u+a),i.lineTo(c+l,h+a),i.closePath(),i.clip()}function Jc(i,e){let t=e*4,o=Math.max(e*.45,1);i.beginPath();for(let s=-Gn;s<=Gn;s++){let r=s*o*2,n=r+o,l=r*W,a=-r*W,c=n*W,h=-n*W;i.moveTo(l+t*W,a+t*W),i.lineTo(l-t*W,a-t*W),i.lineTo(c-t*W,h-t*W),i.lineTo(c+t*W,h+t*W),i.closePath()}i.clip()}function hi(i,e){i._sceneFunc(e)}function Xn(i){let e=this,t=e.attrs,o=t.markRadius||1,s=t.fill,r=e.getStage(),n=Math.abs((r?r.scaleX():1)*(e.scaleX()||1))||1;if(o*2*n<16){t.fill=t.markMidtone??s,hi(e,i),t.fill=s;return}let a=(1-2*(t.markFraction??zn))*o;i.save(),Kn(i,a,o,1),t.fill=t.markBase??s,hi(e,i),i.restore(),i.save(),Kn(i,a,o,-1),t.fill=t.markFill??s,hi(e,i),t.markHatch&&(Jc(i,o),t.fill=qc,hi(e,i)),i.restore(),t.fill=s}function eh(i,e,t,o,s,r){let n=Zc(e),l=jc(t),a=i.attrs;a.markFraction=n,a.markBase=o,a.markFill=l,a.markMidtone=Qc(o,l,1-n),a.markHatch=r,a.markRadius=s>0?s:1,i.fill(a.markMidtone),i.stroke(""),i.strokeWidth(0),i.dash([]),i.opacity(1),i.sceneFunc(Xn)}function th(i){i.setAttr("sceneFunc",void 0)}function uo(i){return i.attrs.sceneFunc===Xn}var di=class{constructor(){this.marks=new Map}get size(){return this.marks.size}get(e){return this.marks.get(e)??null}has(e){return this.marks.has(e)}clear(){this.marks.clear()}merge(e,t){let o=new Set;for(let[s,r]of Object.entries(e))t.has(s)&&(r&&r.kind==="partial"?(this.marks.set(s,r),o.add(s)):this.marks.delete(s)&&o.add(s));return o}paint(e,t,o,s,r,n,l){let a=l?void 0:this.marks.get(t);if(!a){uo(e)&&th(e);return}eh(e,a,o,s,r,n)}};function ui(i){let e=i.getClientRect({skipTransform:!0,skipShadow:!0});!Number.isFinite(e.width)||!Number.isFinite(e.height)||(i.offsetX(e.x+e.width/2),i.offsetY(e.y+e.height/2))}var Yn=.85,ih=[2,2],oh=1,Un=.6;function sh(i){return D(i)?"#334155":"#e2e8f0"}function $n(i,e,t){return i==="held"?{fill:Zt,stroke:sh(e),strokeWidth:oh,dash:[...ih],opacity:1,scale:1}:i==="booked"||i==="not_for_sale"?t?{fill:"rgba(0,0,0,0)",stroke:ft,strokeWidth:1.5,dash:[],opacity:.9,scale:Yn}:{fill:ft,stroke:"",strokeWidth:0,dash:[],opacity:i==="booked"?.45:.6,scale:Yn}:null}var po=1e6;function rh(){return typeof navigator>"u"?!1:navigator.maxTouchPoints>0&&/AppleWebKit/i.test(navigator.userAgent)}var pi=class{constructor(e,t=rh()){this.pointers=new Map;this.pinch=null;this.panLast=null;this.panStart=null;this.panStarted=!1;this.movedPx=0;this.singleTouch=!1;this.lastTapAt=0;this.rect=null;this.onLayoutChanged=()=>{this.rect=null};this.onPointerDown=e=>{this.useWebKitTouchEvents&&e.pointerType==="touch"||(this.rect=null,this.beginPointer(e.pointerId,this.toLocal(e.clientX,e.clientY),e.pointerType,e.button))};this.onPointerMove=e=>{if(this.useWebKitTouchEvents&&e.pointerType==="touch"||!this.pointers.has(e.pointerId))return;e.preventDefault();let t=this.toLocal(e.clientX,e.clientY);this.updatePointer(e.pointerId,t)&&this.applyPointerMove(t)};this.onPointerEnd=e=>{this.useWebKitTouchEvents&&e.pointerType==="touch"||this.endPointer(e.pointerId)};this.onTouchStart=e=>{e.preventDefault(),this.rect=null;for(let t=0;t<e.changedTouches.length;t+=1){let o=e.changedTouches.item(t);o&&this.beginPointer(po+o.identifier,this.toLocal(o.clientX,o.clientY),"touch",0)}};this.onTouchMove=e=>{e.preventDefault();let t=null;for(let o=0;o<e.changedTouches.length;o+=1){let s=e.changedTouches.item(o);if(!s)continue;let r=this.toLocal(s.clientX,s.clientY);this.updatePointer(po+s.identifier,r)&&(t=r)}t&&this.applyPointerMove(t)};this.onTouchEnd=e=>{e.preventDefault();for(let t=0;t<e.changedTouches.length;t+=1){let o=e.changedTouches.item(t);o&&this.endPointer(po+o.identifier)}};this.host=e,this.useWebKitTouchEvents=t}get moved(){return this.movedPx}attach(){let{container:e}=this.host;this.rect=null,typeof window<"u"&&(window.addEventListener("scroll",this.onLayoutChanged,{capture:!0,passive:!0}),window.addEventListener("resize",this.onLayoutChanged,{passive:!0}),window.visualViewport?.addEventListener("resize",this.onLayoutChanged),window.visualViewport?.addEventListener("scroll",this.onLayoutChanged)),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}),this.useWebKitTouchEvents&&(e.addEventListener("touchstart",this.onTouchStart,{passive:!1}),e.addEventListener("touchmove",this.onTouchMove,{passive:!1}),e.addEventListener("touchend",this.onTouchEnd,{passive:!1}),e.addEventListener("touchcancel",this.onTouchEnd,{passive:!1}))}detach(){let{container:e}=this.host;typeof window<"u"&&(window.removeEventListener("scroll",this.onLayoutChanged,{capture:!0}),window.removeEventListener("resize",this.onLayoutChanged),window.visualViewport?.removeEventListener("resize",this.onLayoutChanged),window.visualViewport?.removeEventListener("scroll",this.onLayoutChanged)),e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerEnd),e.removeEventListener("pointercancel",this.onPointerEnd),this.useWebKitTouchEvents&&(e.removeEventListener("touchstart",this.onTouchStart),e.removeEventListener("touchmove",this.onTouchMove),e.removeEventListener("touchend",this.onTouchEnd),e.removeEventListener("touchcancel",this.onTouchEnd))}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<Cs}invalidateRect(){this.rect=null}toLocal(e,t){let o=this.rect;if(!o){let s=this.host.container.getBoundingClientRect();o={left:s.left,top:s.top},this.rect=o}return{x:e-o.left,y:t-o.top}}beginPointer(e,t,o,s){if(this.host.cancelGlide(),this.pointers.set(e,t),this.pointers.size===1)this.movedPx=0,this.singleTouch=o==="touch",this.singleTouch&&this.host.touchProbeStart?.(t),this.pinch=null,this.panStart=t,this.panStarted=!1,this.host.marqueeShouldStart({pointerType:o,button:s})?(this.host.beginMarquee(t),this.panLast=null):this.panLast=t;else if(this.pointers.size===2){this.host.marqueeActive()&&this.host.cancelMarquee(),this.endTouchProbe();let[r,n]=[...this.pointers.values()],l={x:(r.x+n.x)/2,y:(r.y+n.y)/2},a=this.host.stage.scaleX();this.pinch={startDist:Math.hypot(n.x-r.x,n.y-r.y),startScale:a,worldMid:{x:(l.x-this.host.stage.x())/a,y:(l.y-this.host.stage.y())/a}},this.panLast=null,this.panStart=null,this.panStarted=!0,this.movedPx=xe+1}}updatePointer(e,t){return this.pointers.has(e)?(this.pointers.set(e,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=xe+1),!0):!1}applyPointerMove(e){if(this.singleTouch&&this.pointers.size===1&&(this.panStarted||this.movedPx>xe?this.endTouchProbe():this.host.touchProbeMove?.(e)),this.host.marqueeActive()){this.host.updateMarquee(e);return}if(this.pinch&&this.pointers.size>=2){this.host.releaseSectionFocusDim();let[t,o]=[...this.pointers.values()],s=Math.hypot(o.x-t.x,o.y-t.y);if(this.pinch.startDist<1)return;let r={x:(t.x+o.x)/2,y:(t.y+o.y)/2},{min:n,max:l}=this.host.zoomBounds(),a=V(this.pinch.startScale*(s/this.pinch.startDist),n,l);this.host.stage.scale({x:a,y:a}),this.host.stage.position({x:r.x-this.pinch.worldMid.x*a,y:r.y-this.pinch.worldMid.y*a}),this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}else if(this.panLast&&this.pointers.size===1){if(!this.panStarted){if(this.movedPx<=xe)return;this.panStarted=!0,this.host.releaseSectionFocusDim()}this.host.stage.position({x:this.host.stage.x()+(e.x-this.panLast.x),y:this.host.stage.y()+(e.y-this.panLast.y)}),this.panLast=e,this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}}endPointer(e){if(this.pointers.has(e)){if(this.host.marqueeActive()){this.endTouchProbe(),this.host.finishMarquee(),this.pointers.delete(e),this.pointers.size===0&&(this.panLast=null);return}this.pointers.delete(e),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.endTouchProbe(),this.host.afterViewChange())}}endTouchProbe(){this.singleTouch&&(this.singleTouch=!1,this.host.touchProbeEnd?.())}};import{Circle as nh}from"konva/lib/shapes/Circle";import{Group as ah}from"konva/lib/Group";import{Text as lh}from"konva/lib/shapes/Text";var qn=13,ch=15,hh=.3,dh=.08;function Jn(i,e,t){return!!(i&&t!==i||e&&!e.has(t))}function uh(i,e){return!e||i.available==null?`cap ${i.capacity}`:i.available<=0?G("map.soldOut"):G("map.seatsLeft",{count:i.available})}function ph(i,e){return e&&i.available!=null&&i.available<=0}function ea(i){for(let e of i.gaById.values()){let t=i.filteredOut(e.categoryKey),o=i.overviewHidden(e),s=ph(e,i.pickerMode),r=i.pickerMode?e.selected??0:0;e.polygon.opacity(o?0:i.dimmed(e.categoryKey)?Re*dh:s?Re*hh:Re),e.polygon.listening(!i.exportMode&&!o&&!t&&!s),e.polygon.stroke(r>0?i.selectionColor:e.strokeColor),e.polygon.strokeWidth(r>0?3:1.5),fh(i,e,s,r,o,i.dimmed(e.categoryKey))}}function fh(i,e,t,o,s,r){if(e.capacityNode){let n=uh(e,i.pickerMode);e.capacityNode.text()!==n&&(e.capacityNode.text(n),e.capacityNode.offsetX(e.capacityNode.width()/2)),e.capacityNode.opacity(t?.75:1)}mh(i,e,s||r),o>0&&!s?gh(i,e,o):e.chip&&e.chip.visible(!1)}var fo=9,Zn=.86;function mh(i,e,t){let{labelNode:o,capacityNode:s}=e;if(!o&&!s)return;let r=Math.max(i.effScale(),1e-4);if(t){o?.visible(!1),s?.visible(!1);return}if(!i.pickerMode){o?.visible(i.labelLegible(o.fontSize())),s?.visible(i.labelLegible(s.fontSize()));return}let n=yh(e,r),l=jn(o,Bt,n.width*Zn,r),a=jn(s,Ft,n.width*Zn,r),c=l!=null,h=a!=null&&c&&l+a+fo<=n.height;Qn(o,c?l:null,e.labelPoint.y-fo/r,r),Qn(s,h?a:null,e.labelPoint.y+fo/r,r)}function yh(i,e){let t=1/0,o=-1/0,s=1/0,r=-1/0;for(let n of i.points)n.x<t&&(t=n.x),n.x>o&&(o=n.x),n.y<s&&(s=n.y),n.y>r&&(r=n.y);return Number.isFinite(t)?{width:(o-t)*e,height:(r-s)*e}:{width:0,height:0}}function jn(i,e,t,o){if(!i||!i.text())return null;i.fontSize(e/o);let s=i.width()*o;if(s<=t||s<=0)return e;let r=e*(t/s);return r>=H?r:null}function Qn(i,e,t,o){if(i){if(e==null){i.visible(!1);return}i.fontSize(e/o),i.offsetX(i.width()/2),i.offsetY(i.height()/2),i.y(t),i.visible(!0)}}function gh(i,e,t){if(!e.chip){let o=new ah({x:e.labelPoint.x,y:e.labelPoint.y-qn-16,listening:!1}),s=new nh({radius:qn,fill:i.selectionColor,listening:!1,perfectDrawEnabled:!1}),r=new lh({text:String(t),fontSize:ch,fontStyle:"800",fontFamily:i.labelFont(),fill:"#0b0d12",listening:!1,perfectDrawEnabled:!1});o.add(s),o.add(r),i.bgLayer.add(o),e.chip=o,e.chipText=r}e.chipText&&e.chipText.text()!==String(t)&&e.chipText.text(String(t)),e.chipText&&(e.chipText.offsetX(e.chipText.width()/2),e.chipText.offsetY(e.chipText.height()/2)),e.chip.visible(!0),e.chip.moveToTop()}function ta(i,e){let t=!1;for(let[o,s]of Object.entries(e)){let r=i.get(o);r&&(s.available!==void 0&&r.available!==s.available&&(r.available=s.available,t=!0),s.selected!==void 0&&r.selected!==s.selected&&(r.selected=s.selected,t=!0))}return t}import{Rect as ia}from"konva/lib/shapes/Rect";import{Text as bh}from"konva/lib/shapes/Text";function oa(i){let e=i.effScale(),t=i.stage.scaleX(),o={width:i.stage.width(),height:i.stage.height()},s=m=>Math.round(m*100)/100,r=new Map(i.overlayLayer.find(".selection-ring").map(m=>[String(m.getAttr("seatId")??""),String(m.getAttr("ringColor")??i.effSelection)])),n=i.seats.map(m=>{let f=i.circleById.get(m.id),g=i.boothLabelById.get(m.id)??i.seatLabelById.get(m.id),b=i.viewMode==="perspective"?i.perspectiveSeatScale.get(m.id)??1:1,S=(i.viewMode==="perspective"?t:e)*b,v=m.kind==="booth"?Me:me*i.seatLabelScale(m),w=i.viewMode==="perspective"&&m.kind!=="booth"?e*b:S,L=s((g?.fontSize()??v)*w),k=i.worldToScreen(m),T=g?g.width()*t*b:0,x=g?g.height()*(i.viewMode==="perspective"&&m.kind==="booth"?t:e)*b:0,C=k.x-T/2<0||k.x+T/2>o.width||k.y-x/2<0||k.y+x/2>o.height,R=i.focusedSeatOpacity(m.id,f?.getAbsoluteOpacity()??0),P=i.seatSection.get(m.id),A=!!g?.isVisible()&&R>=.5&&!C,M;A||(R<.5?M="dimmed-or-unavailable":L<H?M="below-minimum-size":C?M="outside-viewport":g?M="renderer-hidden":M=i.seatLabelDrops.get(m.id)??(i.seatLabelRungOpen()?"clutter-or-fit":"below-label-rung"));let I=f instanceof ia?f.width()*t*b:i.seatR*2*S,_=f instanceof ia?f.height()*(i.viewMode==="perspective"?t:e)*b:i.seatR*2*S,$=2*(i.seatR*S+_e),X=f?.fill(),Y=g?.fill(),Q=i.accessGlyphById.get(m.id),O=Q?.getAbsoluteScale();return{seatId:m.id,label:m.label,kind:m.kind==="booth"?"booth":"seat",markerShape:m.kind==="booth"?"booth":m.wheelchairSpaceType==="no-seat"?"square":"circle",...m.wheelchairSpaceType?{wheelchairSpaceType:m.wheelchairSpaceType}:{},categoryKey:m.categoryKey,...P?{sectionId:P.id}:{},...P?.zone?{zoneId:P.zone}:{},status:i.statusById.get(m.id)??"free",selected:i.selection.has(m.id),visible:A,renderedFontPx:L,fill:typeof X=="string"?X:"",ink:typeof Y=="string"?Y:f?i.seatLabelInk(m,f):i.seatPreferredLabelInk(m),...r.has(m.id)?{selectionRingColor:r.get(m.id)}:{},opacity:s(R),...Q?{accessibilityMarker:{glyphVisible:Q.isVisible(),glyphWidthPx:s(Te*Math.abs(O?.x??0)),emphasizedByFilter:i.accessGlyphFilterEmphasized(m.id)}}:{},pointerTarget:{active:!i.cached&&!i.seatViewportCulled(m.id)&&!!f?.isVisible()&&!!f?.isListening()&&i.isSelectable(m.id),directWidthPx:s(I),directHeightPx:s(_),effectiveMinimumPx:s(Math.max(Math.min(I,_),$))},screenCenter:{x:s(k.x),y:s(k.y)},...A?{screenBox:{x:s(k.x-T/2),y:s(k.y-x/2),width:s(T),height:s(x)}}:{},...M?{hiddenReason:M}:{}}}),l=n.filter(m=>m.visible).length,a=(m,f,g,b,S,v)=>{let w=Qe({x:b.x(),y:b.y()},b.width(),b.height(),b.rotation()),L=v&&v.liftWorld>0?i.isoLiftLocal(v.liftWorld):{x:0,y:0},k=K(w.map(A=>i.worldToScreen({x:A.x+L.x,y:A.y+L.y}))),T=s(b.opacity()),x=b.fill(),C=k.x+k.width<0||k.x>o.width||k.y+k.height<0||k.y>o.height,R=b.isVisible()&&T>.05&&!C,P=v?ni({x:b.x(),y:b.y()},b.width(),b.height(),b.rotation(),v.outline,v.holes):void 0;return{id:m,kind:f,role:g,label:b.text(),visible:R,renderedFontPx:s(b.fontSize()*t),opacity:T,fill:S,ink:typeof x=="string"?x:"",...P==null?{}:{fitsContainer:P},...R?{screenBox:{x:s(k.x),y:s(k.y),width:s(k.width),height:s(k.height)}}:{}}},c=m=>{let f=m.namePlate.fill();if(m.namePlate.opacity()>.05&&typeof f=="string"&&f)return f;let g=m.blockPoly.fill();return typeof g=="string"?g:m.baseFill},h=[...i.sections.map(m=>a(m.id,"section","name",m.nameLabel,c(m),m)),...i.sections.map(m=>a(`${m.id}:availability`,"section","availability",m.subLabel,c(m),m)),...i.zones.flatMap(m=>[a(m.id,"zone","name",m.label,m.background),...m.sub?[a(`${m.id}:price`,"zone","price",m.sub,m.background)]:[]])],d=[...i.gaById].map(([m,f])=>{let g=f.points.map(C=>i.worldToScreen(C)),b=Math.min(...g.map(C=>C.x)),S=Math.min(...g.map(C=>C.y)),v=Math.max(...g.map(C=>C.x)),w=Math.max(...g.map(C=>C.y)),L=v<0||b>o.width||w<0||S>o.height,k=s(f.polygon.opacity()),T=k>=.1&&!L,x=f.polygon.fill();return{areaId:m,label:f.label,capacity:f.capacity,categoryKey:f.categoryKey,...f.sectionId?{sectionId:f.sectionId}:{},visible:T,interactive:f.polygon.listening(),opacity:k,fill:typeof x=="string"?x:"",effectiveBackground:f.effectiveBackground,...T?{screenBox:{x:s(b),y:s(S),width:s(v-b),height:s(w-S)}}:{}}}),u=[...i.freeTextById].map(([m,f])=>{let{node:g,background:b,kind:S}=f,v=i.worldToScreen({x:g.x(),y:g.y()}),w=g.width()*t,L=g.height()*e,k=v.x-g.offsetX()*t,T=v.y-g.offsetY()*e,x=s(g.fontSize()*e),C=k+w<0||k>o.width||T+L<0||T>o.height,R=g.isVisible()&&!C,P=g.fill(),A=s(g.getAbsoluteOpacity()),M;return R||(x<H?M="below-minimum-size":C?M="outside-viewport":M="renderer-hidden"),{objectId:f.objectId??m,kind:S,text:g.text(),visible:R,renderedFontPx:x,ink:typeof P=="string"?P:"",background:b,opacity:A,...R?{screenBox:{x:s(k),y:s(T),width:s(w),height:s(L)}}:{},...M?{hiddenReason:M}:{}}}),p=i.labelGroup.find(m=>m.getAttr("rowLabel")===!0).filter(m=>m instanceof bh).map(m=>{let f=m.getClientRect({skipShadow:!0,skipStroke:!0}),g=f.x+f.width<0||f.x>o.width||f.y+f.height<0||f.y>o.height,b=m.fill();return{text:m.text(),visible:m.isVisible()&&!g,renderedFontPx:s(m.fontSize()*e),ink:typeof b=="string"?b:"",...g?{}:{screenBox:{x:s(f.x),y:s(f.y),width:s(f.width),height:s(f.height)}}}}),y=i.sections.filter(m=>m.blockPoly.opacity()>.05);return{viewport:o,projection:i.viewMode,...i.viewMode==="perspective"?{perspective:{model:"pinhole-exact-seat-anchors",sectionSurfaceModel:"tangent-plane",exactSeatAnchorCount:i.perspectiveSeatProjected.size,depthSorted:!0}}:{},canvasBackground:i.canvasBackground,effectiveScale:s(e),rung:i.getRung(),minimumVisibleLabelPx:H,totalLabelledBookableUnits:n.length,visibleLabels:l,hiddenLabels:n.length-l,totalBookableUnits:n.length+d.reduce((m,f)=>m+f.capacity,0),selectionRingSeatIds:i.overlayLayer.find(".selection-ring").map(m=>String(m.getAttr("seatId")??"")).filter(Boolean),selectionRingColor:i.effSelection,focusedSectionId:i.focusedSectionId,focusBackdropVisible:!!i.focusBackdrop?.isVisible(),categoryFilterKeys:i.categoryFilter?[...i.categoryFilter].sort():null,overviewStyle:{visibleSectionShells:y.length,categoryPaintedSectionShells:y.filter(m=>{let f=m.blockPoly.fill();return typeof f!="string"||!Gi(i.canvasBackground,f)}).length,tintedSectionShells:y.filter(m=>{let f=m.blockPoly.fill();return typeof f=="string"&&ar(i.canvasBackground,f)}).length,visibleCategoryDetailOutlines:i.sections.filter(m=>m.outlinePoly.opacity()>.05).length,visibleSectionRowHints:0,visibleSectionAvailabilityLabels:i.sections.filter(m=>m.subLabel.opacity()>.05).length,visibleSectionGADetails:[...i.gaById.values()].filter(m=>m.sectionId!=null&&m.polygon.opacity()>.05).length},labels:n,gaAreas:d,hierarchyLabels:h,freeTextLabels:u,rowLabels:p}}import{Circle as Sh}from"konva/lib/shapes/Circle";import{Ellipse as vh}from"konva/lib/shapes/Ellipse";import{Line as sa}from"konva/lib/shapes/Line";import{Arrow as wh}from"konva/lib/shapes/Arrow";import{Path as Lh}from"konva/lib/shapes/Path";import{Rect as vt}from"konva/lib/shapes/Rect";import{Text as yo}from"konva/lib/shapes/Text";import{Image as ra}from"konva/lib/shapes/Image";function na(i,e){if(!e.url||e.visible===!1)return;let t=new window.Image;i.trackAssetImage(t,e.url,"Buyer background image",()=>{let o=t.naturalWidth||4,s=t.naturalHeight||3,r=e.crop??{x:0,y:0,width:1,height:1},n=Math.max(0,Math.min(.99,r.x)),l=Math.max(0,Math.min(.99,r.y)),a={x:n,y:l,width:Math.max(.01,Math.min(1-n,r.width)),height:Math.max(.01,Math.min(1-l,r.height))},c=e.width,h=c*(s*a.height/(o*a.width)),d=new ra({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:a.x*o,y:a.y*s,width:a.width*o,height:a.height*s},opacity:e.opacity,listening:!1});i.bgLayer.add(d),d.moveToBottom(),i.bgLayer.batchDraw()})}function aa(i,e){let t=new window.Image,o=new ra({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"?i.fgDecorGroup.add(o):i.bgLayer.add(o),e.role&&i.landmarkBoxes.push(K(Qe({x:e.x+e.width/2,y:e.y+e.height/2},e.width,e.height,e.rotation??0))),i.trackAssetImage(t,e.href,`Decor image \u201C${e.label||e.id}\u201D`,()=>{let s=o.getLayer();s&&s.batchDraw()})}function la(i,e){if(e.shape==="round")i.bgLayer.add(new Sh({x:e.center.x,y:e.center.y,radius:e.radius??40,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,listening:!1}));else{let o=e.width??80,s=e.height??50;i.bgLayer.add(new vt({x:e.center.x,y:e.center.y,width:o,height:s,offsetX:o/2,offsetY:s/2,rotation:e.rotation,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,cornerRadius:4,listening:!1}))}let t=wt(i,i.bgLayer,e.displayLabel??e.label,e.center.x,e.center.y,"#cbd5e1",12,!0);i.freeTextById.set(e.id,{node:t,background:"#232c40",kind:"table"})}var kh=8,Th=6;function ca(i,e){let t=e.background?.color??i.canvasBackground,o=e.color??ne(t,i.theme.textColor??Zr),s=e.semanticKind==="icon"?fs(e.iconKey):void 0;if(s){let h=e.fontSize/24,d=new Lh({x:e.position.x,y:e.position.y,data:s,rotation:e.rotation,scaleX:h,scaleY:h,stroke:o,strokeWidth:2,lineCap:"round",lineJoin:"round",fillEnabled:!1,listening:!1,perfectDrawEnabled:!1});i.iconNodeById.set(e.id,{node:d,fontSize:e.fontSize}),i.bgLayer.add(d);return}let r=e.background?.padding??0,n=e.opacity??1,l=rs(e),a=new yo({x:e.position.x,y:e.position.y,text:e.text,fontSize:e.fontSize,rotation:e.rotation,fontStyle:Qi(e.bold,e.italic,"600"),fill:o,fontFamily:e.fontFamily??i.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:r,opacity:n,wrap:"word",listening:!1,perfectDrawEnabled:!1,name:"buyer-free-text"}),c;if(e.background){let h=a.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:!0}),d=Math.max(kh,e.fontSize*.35),u=Math.max(Th,e.fontSize*.28);c=new vt({x:e.position.x,y:e.position.y,offsetX:-(h.x-d),offsetY:-(h.y-u),width:h.width+d*2,height:h.height+u*2,rotation:e.rotation,fill:e.background.color,opacity:n*(e.background.opacity??.9),cornerRadius:e.background.cornerRadius??4,listening:!1,perfectDrawEnabled:!1,name:"buyer-text-background"}),i.bgLayer.add(c)}i.freeTextById.set(e.id,{node:a,backdrop:c,background:t,kind:l?"direct-landmark":"free-text"}),i.bgLayer.add(a)}function ha(i,e){let t=e.fill??i.theme.decorFill??qr,o=e.role==="stage",s=e.role==="reference-focal",r=!!e.role&&!o,n=ss(e),l=ee(i.canvasBackground),a=s?l.focalFill:t,c=e.kind==="line"||e.kind==="polyline",h=e.stroke?.color??(o?ke(a,.28):s?l.focalStroke:c?"#9aa3b5":void 0),d=e.stroke?.width??(o?1:s||c?2:0),u=e.opacity!=null?V(e.opacity,.1,1):1,p=0,y=0,m=null;if(c&&e.points&&e.points.length>=2){p=e.points.reduce((S,v)=>S+v.x,0)/e.points.length,y=e.points.reduce((S,v)=>S+v.y,0)/e.points.length;let f=ms(e),g=ys(d),b=new wh({points:e.points.flatMap(S=>[S.x,S.y]),closed:!1,x:p,y,offsetX:p,offsetY:y,rotation:e.rotation??0,stroke:h,fill:h,strokeWidth:d,opacity:u,lineCap:f.lineCap,lineJoin:f.lineJoin,pointerAtBeginning:f.startEnding==="arrow",pointerAtEnding:f.endEnding==="arrow",...g,listening:!1,name:"buyer-shape-open-path"});b.setAttr("shapeObjectId",e.id),i.bgLayer.add(b)}else if(e.kind==="rect"&&e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null){let f=o?{fillLinearGradientStartPoint:{x:0,y:0},fillLinearGradientEndPoint:{x:0,y:e.height},fillLinearGradientColorStops:[0,fe(a,.3),1,ke(a,.12)]}:{fill:a};p=e.x+e.width/2,y=e.y+e.height/2,m={x:e.x,y:e.y,width:e.width,height:e.height},i.bgLayer.add(new vt({x:p,y,offsetX:e.width/2,offsetY:e.height/2,rotation:e.rotation??0,width:e.width,height:e.height,...f,stroke:h,strokeWidth:d,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){p=e.x+e.width/2,y=e.y+e.height/2,m={x:e.x,y:e.y,width:e.width,height:e.height};let f=o?{fillLinearGradientStartPoint:{x:0,y:-e.height/2},fillLinearGradientEndPoint:{x:0,y:e.height/2},fillLinearGradientColorStops:[0,fe(a,.3),1,ke(a,.12)]}:{fill:a};i.bgLayer.add(new vh({x:p,y,rotation:e.rotation??0,radiusX:e.width/2,radiusY:e.height/2,...f,stroke:h,strokeWidth:d,opacity:u,listening:!1}))}else if(e.kind==="polygon"&&e.points&&e.points.length){let f=e.points.flatMap(S=>[S.x,S.y]),g=K(e.points);p=e.points.reduce((S,v)=>S+v.x,0)/e.points.length,y=e.points.reduce((S,v)=>S+v.y,0)/e.points.length,m=g;let b=o?{fillLinearGradientStartPoint:{x:0,y:g.y},fillLinearGradientEndPoint:{x:0,y:g.y+g.height},fillLinearGradientColorStops:[0,fe(a,.3),1,ke(a,.12)]}:{fill:a};i.bgLayer.add(new sa({points:f,closed:!0,x:p,y,offsetX:p,offsetY:y,rotation:e.rotation??0,...b,stroke:h,strokeWidth:d,opacity:u,listening:!1}))}m&&e.role&&i.landmarkBoxes.push(m);for(let f of Go(e))i.bgLayer.add(new sa({points:f.points.flatMap(g=>[g.x,g.y]),closed:f.closed,x:p,y,offsetX:p,offsetY:y,rotation:e.rotation??0,stroke:f.ink??Ho,fill:f.fill,strokeWidth:2,opacity:u*.85,listening:!1,perfectDrawEnabled:!1,name:"buyer-stage-marking"}));if(e.label)if(o){let{node:f,spec:g}=Ch(i,p,y,e.label,a,m,e.labelStyle);i.primaryFocalLabels.set(f,g),i.freeTextById.set(e.id,{node:f,background:a,kind:"stage"})}else if(r){let f=s||n,g=wt(i,i.bgLayer,e.label,p,y,f?ne(a,"#e6e9f0"):"#9aa3b5",f?18:12,!1);f&&i.primaryFocalLabels.set(g,{targetPx:18,trackingRatio:0,ink:String(g.fill()??""),plateInk:String(g.fill()??""),plate:new vt({width:0,height:0,opacity:0,listening:!1})}),i.freeTextById.set(e.id,{node:g,background:a,kind:"decor"})}else{let f=wt(i,i.bgLayer,e.label,p,y,"#cbd5e1",16,!0);i.freeTextById.set(e.id,{node:f,background:a,kind:"decor"})}}var mo=22,xh=H,fi=6;function Ch(i,e,t,o,s,r,n){let l=n?.size??mo,a=n?.color??i.theme.textColor??"#e6e9f0",c=n?.color??ne(s,a),h=r?r.x+r.width/2:e,d=r?r.y+r.height/2:t,u=Ih(i.canvasBackground,s),p=new vt({x:h,y:d,width:0,height:0,cornerRadius:4,fill:u,opacity:0,listening:!1,perfectDrawEnabled:!1});i.bgLayer.add(p);let y=new yo({x:h,y:d,text:o,fontSize:l,fontStyle:Qi(n?.bold??!0,n?.italic,"normal"),letterSpacing:l*(4/mo),fontFamily:n?.fontFamily??i.labelFont(),fill:c,textDecoration:n?.underline?"underline":"",listening:!1,perfectDrawEnabled:!1});return y.offsetX(y.width()/2),y.offsetY(y.height()/2),i.bgLayer.add(y),{node:y,spec:{targetPx:l,...r?{bounds:r}:{},trackingRatio:4/mo,ink:c,plateInk:n?.color??ne(u,a),plate:p}}}function Ih(i,e){return re(e,D(i)?"#ffffff":"#000000",.34)}function da(i,e,t,o){let s=Math.max(t,1e-4),r=e.targetPx/s,n=p=>{i.letterSpacing(p*e.trackingRatio),o(i,p)};n(r);let l=e.bounds;if(!l){e.plate.opacity(0),i.fill(e.ink);return}let a={width:l.width-fi*2,height:l.height-fi*2},c=Math.min(1,a.width/Math.max(i.width(),1e-6),a.height/Math.max(i.height(),1e-6));if(c<1&&(r=Math.max(xh/s,r*c),n(r)),i.width()<=a.width&&i.height()<=a.height){e.plate.opacity(0),i.fill(e.ink);return}let d=i.width()+fi*2,u=i.height()+fi;e.plate.size({width:d,height:u}),e.plate.offset({x:d/2,y:u/2}),e.plate.opacity(1),i.fill(e.plateInk)}function ua(i,e){let t=i.catColor.get(e.categoryKey)??"#6e7bff",o=i.canvasBackground,s=Qo(t,o,Re),r=i.theme.textColor??"#e6e9f0",n=ne(s,r),l=We(e.points,e.holes,{fill:t,opacity:Re,stroke:t,strokeWidth:1.5,cornerRadius:e.cornerRadius});l.setAttr("gaId",e.id),l.on("click tap",u=>{i.isGhostClick(u)||i.opts.onGAClick?.(e.id)}),l.on("mouseenter",()=>{i.container.style.cursor="pointer"}),l.on("mouseleave",()=>{i.container.style.cursor="default"}),i.bgLayer.add(l);let a=Rt(e.points,e.holes),c=i.sections.find(u=>ie(a,u.outline,u.holes)),h=wt(i,i.bgLayer,e.displayLabel??e.label,a.x,a.y-8,n,Bt,!1),d=wt(i,i.bgLayer,`cap ${e.capacity}`,a.x,a.y+10,n,Ft,!1);i.freeTextById.set(`${e.id}:label`,{objectId:e.id,node:h,background:s,kind:"ga-label",categoryKey:e.categoryKey}),i.freeTextById.set(`${e.id}:capacity`,{objectId:e.id,node:d,background:s,kind:"ga-capacity",categoryKey:e.categoryKey}),i.gaById.set(e.id,{label:e.displayLabel??e.label,capacity:e.capacity,categoryKey:e.categoryKey,points:e.points,polygon:l,effectiveBackground:s,strokeColor:t,labelPoint:a,labelNode:h,capacityNode:d,...c?{sectionId:c.logicalId}:{}})}function wt(i,e,t,o,s,r,n,l){let a=new yo({x:o,y:s,text:t,fontSize:n,fontStyle:l?"700":"500",fontFamily:i.labelFont(),fill:r,listening:!1,perfectDrawEnabled:!1});return a.offsetX(a.width()/2),a.offsetY(a.height()/2),e.add(a),a}import{Text as Ph}from"konva/lib/shapes/Text";var Mh=4;function pa(i){return D(i)?{plate:"#ffffff",stroke:"rgba(15,23,42,0.18)"}:{plate:"#0f1622",stroke:"rgba(226,232,240,0.22)"}}function Rh(i,e,t,o){let s=Math.max(0,Math.min(o,e/2,t/2));i.beginPath(),i.moveTo(s,0),i.arcTo(e,0,e,t,s),i.arcTo(e,t,0,t,s),i.arcTo(0,t,0,0,s),i.arcTo(0,0,e,0,s),i.closePath()}function fa(i,e){i.padding(Mh),i.shadowBlur(0),i.shadowOpacity(0),i.sceneFunc(function(o){let s=this.width(),r=this.height();o.save(),Rh(o,s,r,Math.min(r/2,8)),o.setAttr("fillStyle",e.plate),o.fill(),o.setAttr("strokeStyle",e.stroke),o.setAttr("lineWidth",1),o.stroke(),o.restore(),Ph.prototype._sceneFunc.call(this,o)})}var ma=/^[\p{L}\p{N}]{1,4}$/u,Ah=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function ya(i,e){let t=e?.trim();if(!t)return i;let o=i.toLocaleLowerCase("en-US"),s=t.toLocaleLowerCase("en-US");if(o.startsWith(`${s} `)){let n=i.slice(t.length).trim();if(ma.test(n))return n}let r=Ah.exec(i);if(r){let n=r[1].toLocaleLowerCase("en-US"),l=r[2].trim();if((s.startsWith(n)||n.startsWith(s))&&ma.test(l))return l}return i}function ga(i,e){let t=[],o=e.canvasBackground,s=new Map,r=(c,h)=>{let d=s.get(c)??[];d.push(h),s.set(c,d)};for(let c of e.seats){if(c.kind==="booth")continue;let h=c.logicalRowId??c.rowId;r(h,c),h!==c.rowId&&r(c.rowId,c)}let n=c=>c.logicalSeatIndex??Number(c.id.split(":").pop()??0);for(let c of i.objects){if(c.type!=="row")continue;let h=c.segmentedRow?.repeatLabelOnComponents===!0;if(c.segmentedRow&&!h&&c.segmentedRow.componentIndex!==0)continue;let d=h?c.labelPresentation:c.segmentedRow?.labelPresentation??c.labelPresentation;if(d?.visible===!1||d?.positionPreset==="none")continue;let u=c.segmentedRow&&!h?c.segmentedRow.groupId:c.id,p=(s.get(u)??[]).slice().sort((M,I)=>n(M)-n(I));if(!p.length)continue;let y=p[0],m=p[p.length-1],f=d?.labelStyle,g=d?.style==="pill"?pa(o):null,b=g?g.plate:o,S=Ae(b,f?.color,e.theme.rowLabelColor??e.theme.textColor??"#e6e9f0",Ye),v=f?.size??jo,w=d?.rotation??0,L=e.objectFilteredOut(c)?.15:1,k=p.reduce((M,I)=>M??e.seatSection.get(I.id),void 0),x=c.segmentedRow?.displayLabel??c.displayLabel??ya(c.label,k?.label);if(!x)continue;let C=k?[...new Set([k.id,k.logicalId,k.zone].filter(M=>!!M))]:void 0,R=(M,I,_)=>t.push({text:x,x:M,y:I,rotation:w,fontSize:v,ink:S,opacity:L,...g?{pill:g}:{},...C?.length?{focusKeys:C}:{},..._?{automaticAway:_}:{}});if(d?.position){R(d.position.x,d.position.y);continue}let P=e.seatR+12,A=d?.positionPreset??"start";if(A==="start"||A==="both"){let M=c.rotation*Math.PI/180,I={x:-Math.cos(M),y:-Math.sin(M)};R(y.x+I.x*P,y.y+I.y*P,I)}if(A==="end"||A==="both"){let M=(c.rotation+c.curve)*Math.PI/180,I={x:Math.cos(M),y:Math.sin(M)};R(m.x+I.x*P,m.y+I.y*P,I)}}let l=(e.seatR+12)*2.2,a=[];for(let c of t){let h=a.find(d=>d.text===c.text&&Math.hypot(d.x-c.x,d.y-c.y)<=l);if(h){h.x=(h.x+c.x)/2,h.y=(h.y+c.y)/2;continue}a.push(c)}return a}function go(i,e,t=j){let o=i.rotation()*Math.PI/180,s=Math.abs(Math.cos(o)),r=Math.abs(Math.sin(o)),n=(i.width()*s+i.height()*r)/2+t,l=(i.width()*r+i.height()*s)/2+t;return{x:e.x-n,y:e.y-l,width:n*2,height:l*2}}function ba(i,e,t,o){let s={x:e.x,y:e.y},r=e.automaticAway;if(!r)return s;let n={x:-r.y,y:r.x},l=Math.max(7,Math.min(16,e.fontSize*.75)),a=[{x:0,y:0}];for(let u=1;u<=4;u++){let p=l*u;a.push({x:n.x*p,y:n.y*p},{x:-n.x*p,y:-n.y*p},{x:r.x*p,y:r.y*p},{x:(r.x+n.x)*p,y:(r.y+n.y)*p},{x:(r.x-n.x)*p,y:(r.y-n.y)*p})}let c=s,h=1/0,d=1/0;for(let u of a){let p={x:s.x+u.x,y:s.y+u.y},y=go(i,p),f=(o?Gt(o,y,{mode:"overlap"}).length:0)+t.collisionCount(y),g=Math.hypot(u.x,u.y);if((f<h||f===h&&g<d)&&(c=p,h=f,d=g),f===0)break}return c}function Sa(i,e){let t=e,o=t._cache.get("canvas");if(!o)return;let s=[o.scene,o.filter,o.hit].map(r=>r?._canvas).filter(r=>!!r);s.length&&i.Util.releaseCanvas(...s),t._cache.delete("canvas")}function va(i,e){let t=0,o=0,s=r=>{t||(t=r),o+=1;let n=r-t;n>=1e3&&(i(Math.round(o*1e3/n)),o=0,t=r),e(requestAnimationFrame(s))};e(requestAnimationFrame(s))}import{Group as Eh}from"konva/lib/Group";import{Line as wa}from"konva/lib/shapes/Line";import{Rect as _h}from"konva/lib/shapes/Rect";import{Text as La}from"konva/lib/shapes/Text";var Bh=.6;function Fh(i,e){return i>=oe||e&&i>=Kt}function Oh(i){return i.effectiveScale<Kt?!1:i.focusActive||i.stageWidth<de}function Dh(i,e,t){return t&&e>=Kt?Math.max(i,Ps/Math.max(e,1e-4)):i}function Nh(i){let{authoredFontSize:e,measuredWidth:t,maxWidth:o,effectiveScale:s}=i;if(!(t>o)||!(t>0))return e;let r=H/Math.max(s,1e-4),n=e*o/t;return Math.max(Math.min(ct,r),n)}function bo(i,e){let t=(e?1:3)*Math.min(1,i/be);return Math.max(1,i*2-t)}function ka(i){let e=new Map;for(let s of i){let r=e.get(s.rowId);r?r.push(s):e.set(s.rowId,[s])}let t=[];for(let s of e.values())if(!(s.length<2))for(let r=1;r<s.length;r+=1){let n=Math.hypot(s[r].x-s[r-1].x,s[r].y-s[r-1].y);n>0&&Number.isFinite(n)&&t.push(n)}if(!t.length)return 0;t.sort((s,r)=>s-r);let o=Math.floor(t.length/2);return t.length%2?t[o]:(t[o-1]+t[o])/2}function Ta(i,e){return e>0?Math.min(i,e/2):i}function So(i){let e=Math.max(i*2,1e-4);return Math.max(Be,Jo/e)}function vo(i){let e=bo(i,!1),t=bo(be,!1),o=e>0?t/e:1;return oe*Math.max(1,o)/Fi(1,!1,H)}function xa(i){return vo(i)*Qs}function Ca(i){let e=i.exportMode?Math.max(i.effScale(),oe):i.effScale(),t=Oh({effectiveScale:e,focusActive:i.focusedSectionId!=null,stageWidth:i.stage.width()}),o=i.exportMode?e:Fi(e,i.labelsWereVisible(),H),s=Fh(o,t);i.onLabelVisibilityChange(s),i.setSeatLabelRungOpen(s);let r=a=>{let c=a.getClientRect({skipShadow:!0,skipStroke:!0});return c.x>=0&&c.y>=0&&c.x+c.width<=i.stage.width()&&c.y+c.height<=i.stage.height()};for(let[a,c]of i.boothLabelById){let h=i.circleById.get(a);c.visible(ye(c.fontSize(),o)&&!!h?.isVisible()&&i.focusedSeatOpacity(a,h?.getAbsoluteOpacity()??1)>=.5&&r(c))}i.labelGroup.destroyChildren(),i.labelLiftGroups.clear(),i.seatLabelById.clear(),i.seatLabelDrops.clear();let n=0;if(s)for(let a of i.visibleSeatCandidates()){if(a.kind==="booth")continue;let c=i.worldToScreen(a);if(c.x<-20||c.x>i.stage.width()+20||c.y<-20||c.y>i.stage.height()+20||i.accessGlyphById.has(a.id)&&i.accessGlyphShouldShow(a.id))continue;let h=i.circleById.get(a.id);if(!h?.isVisible()){i.seatLabelDrops.set(a.id,"dimmed-or-unavailable");continue}let d=i.statusById.get(a.id)??"free",u=d==="held"&&!i.ownedHold.has(a.id)&&!i.opts.manageMode&&!i.hasSeatMark(a.id)&&i.accessFilterDimmed(a.id);if(i.focusedSeatOpacity(a.id,h.getAbsoluteOpacity())<.5&&!u){i.seatLabelDrops.set(a.id,"dimmed-or-unavailable");continue}let p=i.renderedSeatPoint(a),y=i.viewMode==="perspective"?i.perspectiveSeatScale.get(a.id)??1:1;if(!i.hasSeatMark(a.id)&&(d==="booked"||d==="held"&&!i.ownedHold.has(a.id)&&!i.opts.manageMode)){let S=new Eh({x:p.x,y:p.y,listening:!1});if(S.scale({x:y,y}),u&&S.opacity(Bh),d==="held"?(S.add(new _h({x:-4.2,y:-.7,width:8.4,height:6.5,cornerRadius:1.3,stroke:"#ffffff",strokeWidth:1.25,listening:!1})),S.add(new wa({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}))):(S.opacity(Un),S.add(new wa({points:[-4.2,4.2,4.2,-4.2],stroke:"#ffffff",strokeWidth:1.8,lineCap:"round",listening:!1}))),ui(S),i.seatLabelContainer(a.id).add(S),++n>=Oi)break;continue}let f=Dh(me*i.seatLabelScale(a),e,t),g=new La({x:p.x,y:p.y,text:Dt(a.displayLabel??a.label),fontSize:f,fontStyle:"600",fontFamily:i.labelFont(),fill:h?i.seatLabelInk(a,h):i.seatPreferredLabelInk(a),listening:!1,perfectDrawEnabled:!1}),b=bo(i.seatR,t);if(g.fontSize(Nh({authoredFontSize:f,measuredWidth:g.width(),maxWidth:b,effectiveScale:e})),g.width()>b+.01){i.seatLabelDrops.set(a.id,"label-overflows-marker"),g.destroy();continue}if(!ye(g.fontSize(),e)){i.seatLabelDrops.set(a.id,"below-minimum-size"),g.destroy();continue}if(g.offsetX(g.width()/2),g.offsetY(g.height()/2),g.scale({x:y,y}),i.seatLabelContainer(a.id).add(g),!r(g)){i.seatLabelDrops.set(a.id,"outside-viewport"),g.destroy();continue}if(i.seatLabelById.set(a.id,g),++n>=Oi)break}let l=new Je;for(let{node:a}of i.freeTextById.values()){if(!a.isVisible())continue;let c=a.getClientRect({relativeTo:i.bgLayer,skipShadow:!0,skipStroke:!0});l.insert({x:c.x-j,y:c.y-j,width:c.width+j*2,height:c.height+j*2})}for(let a of i.rowLabelPlan){let c=i.focusedSectionId!=null&&a.focusKeys?.includes(i.focusedSectionId),h=c?Math.max(a.fontSize,Is/Math.max(e,1e-4)):a.fontSize;if(!c&&!ye(h,o))continue;let d=i.worldToScreen({x:a.x,y:a.y});if(d.x<-40||d.x>i.stage.width()+40||d.y<-40||d.y>i.stage.height()+40)continue;let u=new La({x:a.x,y:a.y,text:a.text,fontSize:h,fontStyle:"700",fontFamily:i.labelFont(),fill:a.ink,rotation:a.rotation,opacity:a.opacity,shadowColor:"#05070c",shadowBlur:a.ink.toLowerCase()==="#ffffff"?5:0,shadowOpacity:a.ink.toLowerCase()==="#ffffff"?.8:0,shadowForStrokeEnabled:!1,listening:!1,perfectDrawEnabled:!1});a.pill&&fa(u,a.pill),u.offsetX(u.width()/2),u.offsetY(u.height()/2);let p=i.resolveAutomaticRowLabelPosition(u,a,l);u.position(p),u.setAttr("rowLabel",!0),i.labelGroup.add(u);let y=u.getClientRect({skipShadow:!0,skipStroke:!0}),m=6,f=y.x<m?m-y.x:y.x+y.width>i.stage.width()-m?i.stage.width()-m-y.x-y.width:0,g=y.y<m?m-y.y:y.y+y.height>i.stage.height()-m?i.stage.height()-m-y.y-y.height:0,b=p;if(f||g){let v=i.labelGroup.getAbsoluteTransform(),w=v.point(p);b=v.copy().invert().point({x:w.x+f,y:w.y+g}),u.position(b)}let S=i.rowLabelBox(u,b);if(a.automaticAway&&l.collisionCount(S)>0){u.destroy();continue}l.insert(S)}i.isoT>0&&i.viewMode!=="perspective"&&i.applyUprightLabels(),i.overlayLayer.batchDraw()}function Ia(i){let e=i.now??(()=>typeof performance<"u"?performance.now():Date.now()),t=i.budgetMs??8,o=i.reducedMotion===!0,s=i.chunks.length>1?Math.min(30,Math.max(0,840/(i.chunks.length-1))):0,r=0,n=!1,l=!1,a=null,c=[],h=typeof globalThis<"u"?globalThis:{},d=()=>{a&&(a.kind==="idle"?h.cancelIdleCallback?.(a.id):a.kind==="frame"?h.cancelAnimationFrame?.(a.id):clearTimeout(a.id),a=null)},u=f=>{if(!c.length&&typeof h.requestIdleCallback=="function"){a={kind:"idle",id:h.requestIdleCallback(()=>{a=null,f()},{timeout:120})};return}if(typeof h.requestAnimationFrame=="function"){a={kind:"frame",id:h.requestAnimationFrame(()=>{a=null,f()})};return}a={kind:"timer",id:setTimeout(()=>{a=null,f()},16)}},p=()=>{l||n||(l=!0,d(),i.done())},y=f=>{for(let g=c.length-1;g>=0;g--){let b=c[g],S=o?1:Math.min(1,(f-b.startedAt)/160);i.fade(b.work,S),S>=1&&c.splice(g,1)}return c.length>0},m=()=>{if(n)return;let f=e(),g=f;for(;r<i.chunks.length&&(r===0||e()-g<t);){let S=i.chunks[r++];if(i.build(S.work),i.fade(S.work,o?1:0),o||c.push({work:S.work,startedAt:f+(r-1)*s}),e()-g>=t)break}let b=y(f);i.draw(),r<i.chunks.length||b?u(m):p()};return u(m),{cancel(){if(!l){n=!0,d();for(let f of c)i.fade(f.work,1);c.length=0}},finishNow(){if(!(n||l)){for(;r<i.chunks.length;){let f=i.chunks[r++];i.build(f.work)}for(let f of i.chunks)i.fade(f.work,1);c.length=0,i.draw(),p()}},get done(){return l}}}function Lt(i){return{th:zt*Math.PI/180*i.isoT,sg:1-(1-dt)*i.isoT}}function Pa(i,e){let{th:t,sg:o}=Lt(e),s=e.centre,r=i.x-s.x,n=i.y-s.y,l=r*Math.cos(t)-n*Math.sin(t),a=(r*Math.sin(t)+n*Math.cos(t))*o;return{x:s.x+l,y:s.y+a}}function Ma(i,e){let{th:t,sg:o}=Lt(e),s=e.centre,r=i.x-s.x,l=(i.y-s.y)/o,a=r*Math.cos(t)+l*Math.sin(t),c=-r*Math.sin(t)+l*Math.cos(t);return{x:s.x+a,y:s.y+c}}function Ra(i,e){let{th:t,sg:o}=Lt(e),s=i*e.isoT;return{x:-(s/o)*Math.sin(t),y:-(s/o)*Math.cos(t)}}function Aa(i,e,t){let o=hs(e);i.offset(t),i.position(ae(e,t)),i.rotation(o.rotationDeg),i.scale({x:o.scaleX,y:o.scaleY}),i.skewX(o.skewX),i.skewY(0)}function Ea(i){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)}function _a(i,e){let t=Math.hypot(e.x-i.surfaceFocal.x,e.y-i.surfaceFocal.y),o=Math.max(0,t-i.frontDistanceWorld);return i.liftWorld+o*Math.tan(i.rakeDeg*Math.PI/180)}function Ba(i,e,t){return i.perspectiveAffine?ae(i.perspectiveAffine,e):ae(t,e)}function Fa(i,e){return e?ae(e,i):i}function Oa(i,e){let t=0;for(let d of i.seats){let u=Math.max(0,(d.eyeHeightM??J)-J);t=Math.max(t,u*ze)}for(let d of i.objects)d.type==="section"&&(t=Math.max(t,Mt(d,{floorBaseHeightM:i.floorBaseHeightMFor(d.id)}).height*ze));let o=as(i.bounds,t),s=Wt(o,o.target),r=ls(s);e.seatLocal.clear(),e.seatProjected.clear(),e.seatDepth.clear(),e.seatScale.clear();let n=1/0,l=1/0,a=-1/0,c=-1/0;for(let d of i.seats){let u=Math.max(0,(d.eyeHeightM??J)-J),p=ge(o,d,u*ze),y={x:p.x,y:p.y};e.seatProjected.set(d.id,y),e.seatLocal.set(d.id,ae(r,y)),e.seatDepth.set(d.id,p.depth),e.seatScale.set(d.id,p.scale),n=Math.min(n,p.x),l=Math.min(l,p.y),a=Math.max(a,p.x),c=Math.max(c,p.y)}for(let d of[{x:i.bounds.x,y:i.bounds.y},{x:i.bounds.x+i.bounds.width,y:i.bounds.y},{x:i.bounds.x+i.bounds.width,y:i.bounds.y+i.bounds.height},{x:i.bounds.x,y:i.bounds.y+i.bounds.height}]){let u=ge(o,d,0);n=Math.min(n,u.x),l=Math.min(l,u.y),a=Math.max(a,u.x),c=Math.max(c,u.y)}let h=Math.max(24,i.seatR*3);return{camera:o,baseAffine:s,baseInverse:r,bounds:Number.isFinite(n)?{x:n-h,y:l-h,width:Math.max(1,a-n+h*2),height:Math.max(1,c-l+h*2)}:null}}function Da(i,e,t){let o=t?[...t].map(s=>i.seatById.get(s)).filter(s=>!!s):e?i.seats:[...i.perspectiveAppliedSeats].map(s=>i.seatById.get(s)).filter(s=>!!s);for(let s of o){if(e&&i.perspectiveAppliedSeats.has(s.id))continue;let r=e?i.perspectiveSeatProjected.get(s.id)??s:s,n=e?i.perspectiveSeatScale.get(s.id)??1:1,l=i.circleById.get(s.id);l?.position(r),l?.scale({x:n,y:n});let a=i.accessRingById.get(s.id);a?.position(r),a?.scale({x:n,y:n});let c=i.accessGlyphById.get(s.id);if(c){let d=i.seatR*1.5/Te;c.position(r),c.scale({x:d*n,y:d*n})}let h=i.boothLabelById.get(s.id);h?.position(r),h?.scale({x:n,y:n}),e&&i.perspectiveAppliedSeats.add(s.id)}e||i.perspectiveAppliedSeats.clear()}function Lo(i){return i?.getAttr?.("seatId")??void 0}var ko=Object.freeze([]),Wa=.85,Vh=.38,Kh=Object.freeze([3,3]),Tt=class Tt{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.floorLabelStyle="number";this.circleById=new Map;this.glyphMarkers=[];this.seatGlyphDetail=!0;this.boothDims=new Map;this.boothLabelById=new Map;this.seatLabelById=new Map;this.seatLabelDrops=new Map;this.seatLabelRungOpen=!1;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.catByKey=new Map;this.theme={};this.canvasBackground=Ji;this.effSelection=gt;this.colorblind=!1;this.cbHueByKey=new Map;this.rowLabelPlan=[];this.catOrder=[];this.selection=new Set;this.selectionMarkers=new Map;this.momentsCache=null;this.breathCache=null;this.ownedCache=null;this.beaconsCache=null;this.ownedHold=new Set;this.seatMarks=new di;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.landmarkBoxes=[];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.focusMembership=new Map;this.focusMembershipKey=null;this.focusAnchor=null;this.focusRoams=!1;this.focusBackdrop=null;this.focusDimOverlay=null;this.objectFloor=new Map;this.unsectionedSeatIds=null;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.labelsVisible=!1;this.labelFadeRaf=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.cameraGlideMs=Dn();this.fitScale=1;this.fitPose="";this.viewportInsets={...ho};this.seatR=be;this.markerR=be;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.seatReveal=null;this.seatRevealPending=!1;this.progressiveSeatFloor=800;this.rafId=0;this.recacheTimer=null;this.mountCachePending=!1;this.resizeObs=null;this.viewChangeRaf=0;this.zoomSettleRaf=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 o=this.focusedId?this.nearestSeat(this.focusedId,t):this.seats[0]?.id??null;o&&this.focusSeat(o);return}if((e.key==="Enter"||e.key===" ")&&this.focusedId){e.preventDefault(),this.toggleSeat(this.focusedId);let o=this.seatById.get(this.focusedId);o&&this.opts.onFocusSeat?.(o)}};this.seatAnchorContextCache=null;this.container=e,this.opts={maxSelection:10,selectableStatuses:["free"],...t},this.exportMode=t.exportMode===!0,this.loadingReveal=t.loadingReveal??"progressive",this.onSeatsRevealed=t.onSeatsRevealed,this.currency=t.currency;let o=mi.pixelRatio;if(this.exportMode&&(this.dpr=1),mi.pixelRatio=this.dpr,this.stage=new Hh({container:e,width:e.clientWidth||1,height:e.clientHeight||1,draggable:!1}),this.gestures=new pi(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",G("map.aria")),e.addEventListener("keydown",this.onKeyDown)),this.bgLayer=new wo({listening:!this.exportMode}),this.seatLayer=new wo({listening:!this.exportMode}),this.overlayLayer=new wo({listening:!1}),this.labelGroup=new kt({listening:!1}),this.overlayLayer.add(this.labelGroup),this.fgDecorGroup=new kt({listening:!1}),this.overlayLayer.add(this.fgDecorGroup),this.clusterLabels=new ai({labelLayer:this.overlayLayer,stage:this.stage,exportMode:this.exportMode,canvasBackground:()=>this.canvasBackground,labelFont:()=>this.labelFont(),reducedMotion:()=>this.reducedMotion,destroyed:()=>this.destroyed,hasSections:()=>this.hasSections,seats:()=>this.seats,seatR:()=>this.seatR,readableScale:()=>vo(this.markerR),pickableScale:()=>So(this.markerR),categoryLabel:s=>this.catByKey.get(s)?.label??"",categoryColor:s=>this.categoryDisplayColor(s),categoryPriceLabel:s=>this.categoryPriceLabel(s),categoryFilter:()=>this.categoryFilter,viewMode:()=>this.viewMode,seatsPickable:()=>this.seatsPickable(),screenToWorld:s=>this.screenToWorld(s),zoomBounds:()=>this.zoomBounds(),framingViewport:()=>this.framingViewport(),focusRegion:(s,r)=>this.focusRegion(s,r),cameraGlideMs:()=>this.cameraGlideMs}),this.hoverRing=new Na({radius:be+2,stroke:"#ffffff",strokeWidth:2,opacity:Wa,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.hoverRing),this.focusRing=new Na({radius:be+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&&(mi.pixelRatio=o),!this.exportMode){this.wireInteraction();let s=this.opts.onFps;s&&va(s,r=>{this.rafId=r})}!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 moments(){return this.momentsCache||(this.momentsCache=new ti({overlayLayer:this.overlayLayer,seatLayer:this.seatLayer,stage:this.stage,seatRadius:()=>this.seatR,canvasBackground:()=>this.canvasBackground,selectionColor:()=>this.effSelection,reducedMotion:()=>this.reducedMotion,isDestroyed:()=>this.destroyed,isCached:()=>this.cached,isExportMode:()=>this.exportMode,labelFont:()=>this.labelFont(),viewMode:()=>this.viewMode,perspectiveSeatScale:e=>this.perspectiveSeatScale.get(e)??1,seat:e=>this.seatById.get(e),seatStatus:e=>this.statusById.get(e)??"free",seatShape:e=>this.circleById.get(e),seatPoint:e=>this.renderedSeatPoint(e),boothDims:e=>this.boothDims.get(e),selectionFocusId:()=>this.selectionFocusId,categoryColor:e=>this.categoryDisplayColor(e),priceLabel:e=>this.categoryPriceLabel(e.categoryKey),seatClosed:e=>this.seatInClosedSection(e),screenToWorld:e=>this.screenToWorld(e),nearestSeat:(e,t)=>this.nearestSeatToScreen(e,t)})),this.momentsCache}get breath(){return this.breathCache||(this.breathCache=new ii({overlayLayer:this.overlayLayer,canvasBackground:()=>this.canvasBackground,selectionColor:()=>this.effSelection,categoryColor:e=>this.categoryDisplayColor(e),seatCategoryKey:e=>this.seatById.get(e)?.categoryKey??null,isOwnedHold:e=>this.ownedHold.has(e),reducedMotion:()=>this.reducedMotion,isDestroyed:()=>this.destroyed})),this.breathCache}get beacons(){return this.beaconsCache||(this.beaconsCache=new si({overlayLayer:this.overlayLayer,container:this.container,accent:()=>this.effSelection,accentInk:()=>Zi(this.effSelection),labelFont:()=>this.labelFont(),stageScale:()=>this.stage.scaleX(),worldToScreen:e=>this.worldToScreen(e),activate:e=>this.activateBeacon(e)})),this.beaconsCache}activateBeacon(e){let t=e.kind==="section"?e.id:this.seatSection.get(e.seatId)?.logicalId??null;if(t){let o=this.sectionTapAnchor(t,this.renderedSeatPoint(this.seatById.get(e.seatId)??{x:0,y:0}));this.opts.onSectionTap?this.opts.onSectionTap(t,o):this.focusSection(t,{anchor:o})}this.focusSeat(e.seatId,{move:!t})}syncBeacons(){if(!this.beaconsCache&&!this.selectionMarkers.size)return;let e=this.beacons;e.sync(_r({rung:this.getRung(),sections:this.sections,zones:this.zones,ownedSeatIds:t=>this.ownedSeatIds(t),sectionName:t=>t.nameLabel.text()||t.logicalId,sectionAnchor:t=>({x:t.nameLabel.x(),y:t.nameLabel.y()})})),this.breath.syncBeacons(e.breathingRings())}ownedSeatIds(e){return e.memberIds.filter(t=>this.selection.has(t)||this.ownedHold.has(t))}get owned(){return this.ownedCache||(this.ownedCache=new ri({overlayLayer:this.overlayLayer,sections:()=>this.sections,ownedPoints:e=>this.ownedSeatPoints(e),sectionColor:e=>e.shellCategoryColor,labelAnchor:e=>({x:e.nameLabel.x(),y:e.nameLabel.y()}),stageScale:()=>this.stage.scaleX(),labelFont:()=>this.labelFont()})),this.ownedCache}sectionTapAnchor(e,t){return this.owned.anchorFor(e)??t}ownedSeatPoints(e){let t=[];for(let o of e.memberIds){if(!this.selection.has(o)&&!this.ownedHold.has(o))continue;let s=this.seatById.get(o);s&&t.push(this.renderedSeatPoint(s))}return t}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(),touchProbeStart:e=>this.showTouchLoupe(e),touchProbeMove:e=>this.showTouchLoupe(e),touchProbeEnd:()=>this.hideTouchLoupe()}}setChart(e,t){if(e!==this.chartDoc&&(this.stacked=!1,this.floorOverview=!1),this.cancelAssetLoads(),this.cancelSeatReveal(),this.chartDoc=e,this.activeFloorId=t?.floorId??At(e)[0].id,this.objectFloor.clear(),e.floors&&e.floors.length>1)for(let r of e.floors)for(let n of r.objects)this.objectFloor.set(n.id,r.id),n.type==="section"&&n.logicalSectionId&&this.objectFloor.set(n.logicalSectionId,r.id);let o=this.floorView(e);this.focusedId=null,this.focusRing.visible(!1),this.bgLayer.destroyChildren(),this.clusterLabels.clear(),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.glyphMarkers=[],this.boothDims.clear(),this.boothLabelById.clear(),this.seatLabelById.clear(),this.accessRingById.clear(),this.accessGlyphById.clear(),this.freeTextById.clear(),this.iconNodeById.clear(),this.focusMembership.clear(),this.focusMembershipKey=null,this.unsectionedSeatIds=null,this.primaryFocalLabels.clear(),this.gaById.clear();for(let r of this.selectionMarkers.values())r.destroy();this.selectionMarkers.clear(),this.beaconsCache?.clear(),this.breathCache?.syncBeacons([]),this.breathCache?.sync(this.selectionMarkers),this.ownedHold.clear(),this.seatMarks.clear(),this.selectionFocusId=null,this.statusById.clear(),this.seatAnchorContextCache=null,this.selection.clear(),this.seatById.clear(),this.seatIndex=null,this.cached=!1,this.accessFilter=null,this.sections=[],this.zones=[],this.landmarkBoxes=[],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=o.objects.some(r=>r.type==="section");for(let r of e.zones??[])r.color&&this.zoneColor.set(r.id,r.color);this.seatLayer.opacity(1),this.hoverRing.visible(!1),this.hoveredId=null,this.theme=e.theme??{},this.seatR=ds(this.theme.seatScale)*be,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.catByKey.clear(),this.catPrice.clear(),this.catOrder=e.categories.map(r=>r.key),this.cbHueByKey.clear(),[...this.catOrder].sort().forEach((r,n)=>{this.cbHueByKey.set(r,jt[n%jt.length])});for(let r of e.categories)this.catColor.set(r.key,r.color),this.catByKey.set(r.key,r),typeof r.price=="number"&&this.catPrice.set(r.key,r.price);for(let r of o.objects)r.type==="booth"&&this.boothDims.set(r.id,{width:r.width,height:r.height,rotation:r.rotation,...r.points&&r.points.length>=3?{points:r.points.map(n=>({x:n.x,y:n.y}))}:{}});this.seats=Xe(o,{floorBaseHeightM:this.stacked||this.floorOverview?0:this.floorBaseHeightMFor()});for(let r of this.seats)this.seatById.set(r.id,r),this.statusById.set(r.id,"free");this.seatIndex=ns(this.seats,{seatRadius:this.seatR}),this.markerR=Ta(this.seatR,ka(this.seats)),this.clusterLabels.rebuild(),this.bounds=Ko(o,{freeText:"exclude"}),this.isoCentre={x:this.bounds.x+this.bounds.width/2,y:this.bounds.y+this.bounds.height/2},this.buildPerspectiveProjection(o),this.renderBackground(o),this.unsectionedSeatGroup=new kt({listening:!this.exportMode}),this.seatLayer.add(this.unsectionedSeatGroup);let s=this.seatRevealWanted();this.seatRevealPending=s,s||this.renderSeats(),this.buildRowLabelPlan(o),this.overlayLayer.add(this.labelGroup),this.overlayLayer.add(this.fgDecorGroup),this.overlayLayer.add(this.hoverRing),this.overlayLayer.add(this.focusRing),this.mountCachePending=!s,this.zoomToFit(),s&&this.startSeatReveal()}seatRevealWanted(){return this.loadingReveal==="progressive"&&!this.exportMode&&this.sections.length>1&&this.seats.length>=this.progressiveSeatFloor}startSeatReveal(){this.cancelSeatReveal();let e=this.viewportCentreInChartSpace(),t=new Map,o=[];for(let r of this.seats){let n=this.seatSection.get(r.id);if(!n){o.push(r);continue}let l=t.get(n.id);l?l.push(r):t.set(n.id,[r])}let s=[...t.entries()].map(([r,n])=>{let l=this.sections.find(a=>a.id===r);return{id:r,work:{seats:n,group:l.liftGroupSeat},distance:Math.hypot(l.centroid.x-e.x,l.centroid.y-e.y)}}).sort((r,n)=>r.distance-n.distance);o.length&&this.unsectionedSeatGroup&&s.push({id:"",work:{seats:o,group:this.unsectionedSeatGroup},distance:1/0}),this.seatReveal=Ia({chunks:s.map(r=>({id:r.id,work:r.work})),build:r=>this.renderSeats(r.seats),fade:(r,n)=>r.group.opacity(n),draw:()=>{this.seatLayer.batchDraw()},reducedMotion:this.reducedMotion,done:()=>{this.seatReveal=null,this.seatRevealPending=!1,this.updateLOD(),this.fitPose&&qi(this.stage)===this.fitPose&&this.zoomToFit(),this.seatLayer.batchDraw(),this.onSeatsRevealed?.()}})}viewportCentreInChartSpace(){let e=this.stage.scaleX()||1;return{x:(this.stage.width()/2-this.stage.x())/e,y:(this.stage.height()/2-this.stage.y())/e}}cancelSeatReveal(e=!1){let t=this.seatReveal;this.seatRevealPending=!1,t&&(this.seatReveal=null,e?t.finishNow():t.cancel())}floorView(e){if(!e.floors?.length)return{...e,referenceImage:void 0,backgroundImage:lt(e)};if(this.floorOverview&&e.floors.length>=2)return zo(e,{labelStyle:this.floorLabelStyle});if(this.stacked&&e.floors.length>=2)return{...Vo(e),referenceImage:void 0,backgroundImage:lt(e)};let t=e.floors.find(o=>o.id===this.activeFloorId)??e.floors[0];return{...e,objects:t.objects,focalPoint:t.focalPoint,referenceImage:void 0,backgroundImage:lt(t),floors:void 0}}floorBaseHeightMFor(e){let t=this.chartDoc?.floors;if(!t?.length)return 0;let o=this.stacked&&e?this.objectFloor.get(e)??this.activeFloorId:this.activeFloorId;return t.find(s=>s.id===o)?.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}setFloorLabelStyle(e){e===this.floorLabelStyle||!this.chartDoc||(this.floorLabelStyle=e,this.floorOverview&&this.setChart(this.chartDoc,{floorId:this.activeFloorId}))}getFloorLabelStyle(){return this.floorLabelStyle}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?At(this.chartDoc).map(e=>({id:e.id,name:e.name})):[]}getActiveFloorId(){return this.activeFloorId}setStatus(e,t){let o=!1,s=this.hasSections?new Set:null;for(let r of e){if(!this.statusById.has(r))continue;let n=this.statusById.get(r);if(n===t)continue;this.statusById.set(r,t);let l=this.circleById.get(r);if(l&&(this.paintSeat(l,r),o=!0),s){let a=this.seatSection.get(r);a&&(n==="free"!=(t==="free")&&(a.free+=t==="free"?1:-1),s.add(a))}}if(s&&s.size){for(let r of s)this.refreshSectionFill(r);this.bgLayer.batchDraw()}o&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>oe&&this.updateLabels())}setSeatCategories(e){let t=!1,o=new Set;for(let[r,n]of Object.entries(e)){let l=this.seatById.get(r);if(!l||!this.catColor.has(n)||l.categoryKey===n)continue;l.categoryKey=n;let a=this.circleById.get(r);a&&(this.paintSeat(a,r),t=!0);let c=this.seatSection.get(r);c&&o.add(c)}if(!t)return;let s=new Map((this.chartDoc?At(this.chartDoc):[]).flatMap(r=>r.objects).filter(r=>r.type==="section").map(r=>[r.id,r]));for(let r of o){if(!s.get(r.id)?.color){let l=new Map;for(let a of r.memberIds){let c=this.seatById.get(a)?.categoryKey;c&&l.set(c,(l.get(c)??0)+1)}r.baseFill=Mi([...l].map(([a,c])=>({hex:this.catColor.get(a)??"#6e7bff",w:c})),"#3a4358")}r.shellCategoryColor=this.dominantSellableColor(r.memberIds),this.refreshSectionFill(r)}o.size&&this.bgLayer.batchDraw(),this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>oe&&this.updateLabels()}setOwnedHold(e){let t=new Set((e??[]).filter(s=>this.statusById.has(s))),o=new Set([...this.ownedHold,...t]);this.ownedHold=t;for(let s of o){let r=this.circleById.get(s);r&&this.paintSeat(r,s),this.syncSelectionMarker(s)}o.size&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>oe&&this.updateLabels(),this.overlayLayer.batchDraw())}setSelectionFocus(e){let t=e&&this.selection.has(e)?e:null;if(t===this.selectionFocusId)return;let o=this.selectionFocusId;this.selectionFocusId=t;let s=o&&t?[o,t]:this.seats.map(r=>r.id);for(let r of s){let n=this.circleById.get(r);n&&this.paintSeat(n,r)}o&&this.syncSelectionMarker(o),t&&this.syncSelectionMarker(t);for(let[r,n]of this.selectionMarkers)n.opacity(!t||r===t?1:.2);this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.updateLabels(),this.overlayLayer.batchDraw()}setSeatMarks(e){let t=this.seatMarks.merge(e,this.statusById);for(let o of t){let s=this.circleById.get(o);s&&this.paintSeat(s,o)}t.size&&(this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw())}getSeatMark(e){return this.seatMarks.get(e)}getStatus(e){return this.statusById.get(e)??"free"}getSelection(){let e=[];for(let t of this.selection){let o=this.seatById.get(t);o&&e.push(o)}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 o of e){if(this.selection.has(o)||!this.isSelectable(o))continue;if(this.selection.size>=this.opts.maxSelection){this.opts.onSelectionLimit?.(this.opts.maxSelection);break}this.setSelected(o,!0,!0);let s=this.seatById.get(o);s&&t.push(s)}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(o=>!this.isSelectable(o));t.length&&this.deselect(t),!e.manageMode&&this.selection.size&&this.clearSelection(),this.clusterLabels.syncCursor(!1),this.overlayLayer.batchDraw()}setSectionHeat(e){this.sectionHeat.clear();for(let[t,o]of Object.entries(e??{}))Number.isFinite(o)&&this.sectionHeat.set(t,Math.max(0,Math.min(1,o)));for(let t of this.sections)this.refreshSectionHeat(t);this.bgLayer.batchDraw()}deselect(e){let t=!1;for(let o of e)this.selection.has(o)&&(this.setSelected(o,!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),o=[];for(let s of this.seats)t.has(s.label)&&this.isSelectable(s.id)&&o.push(s.id);return this.selectMany(o)}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=[],o=new Set;for(let s of this.sections)if(!(s.id!==e&&s.logicalId!==e&&s.zone!==e))for(let r of s.memberIds){if(o.has(r)||(o.add(r),!this.isSelectable(r)))continue;let n=this.seatById.get(r);n&&t.push(n)}return t}selectMany(e){let t=e.filter(s=>!this.selection.has(s));if(!t.length)return this.getSelection();let o=this.selection.size+t.length<=Ms;for(let s of t)if(o)this.setSelected(s,!0,!0);else{this.selection.add(s);let r=this.circleById.get(s);r&&this.paintSeat(r,s)}return this.cached||this.seatLayer.batchDraw(),this.overlayLayer.batchDraw(),this.getSelection()}beginMarquee(e){let t=this.screenToWorld(e),o=this.stage.scaleX()||1,s=new Ha({x:t.x,y:t.y,width:0,height:0,stroke:this.effSelection,strokeWidth:1.5/o,dash:[5/o,4/o],fill:"rgba(110,123,255,0.10)",listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.overlayLayer.add(s),this.marquee={start:t,rect:s},this.marqueeCur=t,this.overlayLayer.batchDraw()}updateMarquee(e){if(!this.marquee)return;let t=this.screenToWorld(e),{start:o,rect:s}=this.marquee;s.setAttrs({x:Math.min(o.x,t.x),y:Math.min(o.y,t.y),width:Math.abs(t.x-o.x),height:Math.abs(t.y-o.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 o=Math.min(e.start.x,t.x),s=Math.max(e.start.x,t.x),r=Math.min(e.start.y,t.y),n=Math.max(e.start.y,t.y),l=this.stage.scaleX()||1;if((s-o)*l<4&&(n-r)*l<4){this.selection.size&&(this.clearSelection(),this.opts.onMarquee?.([]));return}let a=[];for(let c of this.seats){let h=this.renderedSeatPoint(c);h.x<o||h.x>s||h.y<r||h.y>n||this.isSelectable(c.id)&&a.push(c.id)}this.selectMany(a),this.opts.onMarquee?.(this.getSelection())}flashSeat(e,t="#f43f5e"){let o=this.seatById.get(e);o&&Cn(this.flashHost,e,this.renderedSeatPoint(o),t)}flashSection(e,t="#22a06b"){In(this.flashHost,this.sections.filter(o=>o.id===e||o.zone===e),t)}get flashHost(){return{overlayLayer:this.overlayLayer,seatRadius:()=>this.seatR,reducedMotion:()=>this.reducedMotion,isDestroyed:()=>this.destroyed,viewMode:()=>this.viewMode,perspectiveSeatScale:e=>this.perspectiveSeatScale.get(e)??1,perspectiveLocalPoint:e=>this.perspectiveLocalPoint(e),projectedSectionPoint:(e,t)=>this.projectedSectionPoint(e,t),isoLiftLocal:e=>this.isoLiftLocal(e)}}nearestSeat(e,t){let o=this.seatById.get(e);if(!o)return null;let s=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(o.id)??o:o,r=null,n=1/0;for(let l of this.seats){if(l.id===e)continue;let a=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(l.id)??l:l,c=a.x-s.x,h=a.y-s.y,d=c*t.x+h*t.y;if(d<=.5)continue;let u=Math.abs(c*t.y-h*t.x),p=d+u*2.5;p<n&&(n=p,r=l.id)}return r}focusSeat(e,t){let o=this.seatById.get(e);if(!o)return;this.focusedId=e,this.focusRing.radius(this.seatR+3),this.focusRing.position(this.renderedSeatPoint(o));let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e)??1:1;this.focusRing.scale({x:s,y:s}),this.focusRing.visible(!0),t?.move!==!1&&this.ensureVisible(o),this.overlayLayer.batchDraw(),this.opts.onFocusSeat?.(o)}ensureVisible(e){let t=this.stage.width(),o=this.stage.height(),s=Math.max(this.stage.scaleX(),Ee*1.2),r=this.worldToScreen(e),n=70,l=r.x<n||r.x>t-n||r.y<n||r.y>o-n;if(this.stage.scaleX()<s||l){let a=this.renderedSeatPoint(e),c=this.viewMode==="perspective"&&this.perspectiveBaseAffine?ae(this.perspectiveBaseAffine,a):this.isoT===0?a:this.isoForward(a);this.stage.scale({x:s,y:s}),this.stage.position({x:t/2-c.x*s,y:o/2-c.y*s}),this.afterViewChange(),this.stage.batchDraw()}}setViewportInsets(e){this.viewportInsets=An(e),this.refitCurrentView()}getViewportInsets(){return{...this.viewportInsets}}framingViewport(){return En(this.stage.width(),this.stage.height(),this.viewportInsets)}framingWorldRect(){return Fn(this.framingViewport(),e=>this.screenToWorld(e))}zoomToFit(){let e=this.framingViewport(),t=e.width,o=e.height,s=this.viewMode==="perspective"&&this.perspectiveBounds?this.perspectiveBounds:this.bounds;if(this.fitScale=Math.min(t/s.width,o/s.height)||1,this.opts.portraitFitCrop&&!this.exportMode){let n=t/s.width<=o/s.height,l=s.height*this.fitScale;n&&l<.55*o&&(this.fitScale=Math.min(this.fitScale*1.3,.62*o/s.height))}let r=this.fitScale;if(this.stage.scale({x:r,y:r}),this.stage.position({x:e.x+(t-s.width*r)/2-s.x*r,y:e.y+(o-s.height*r)/2-s.y*r}),this.settleView(),!this.exportMode){let n=Dr(this.stage,[this.bgLayer,this.seatLayer],e);n>0&&n!==1&&(this.fitScale*=n),n>0&&this.afterViewChange(),this.fitPose=qi(this.stage)}this.stage.batchDraw()}refitCurrentView(){if(this.focusedSectionId&&this.sectionBounds(this.focusedSectionId)){this.focusSectionCamera(this.focusedSectionId,!1,this.focusAnchor);return}if(this.categoryFilter?.size){this.focusCategories([...this.categoryFilter],{animate:!1});return}this.zoomToFit()}getCameraPose(){return _n(this.stage)}setCameraPose(e){this.cancelGlide(),Bn(this.stage,e)&&(this.settleView(),this.stage.batchDraw())}zoomIn(){this.zoomAbout(this.stage.scaleX()*Tt.ZOOM_STEP,li(this.framingViewport()))}zoomOut(){this.zoomAbout(this.stage.scaleX()/Tt.ZOOM_STEP,li(this.framingViewport()))}zoomOutLevel(){let e=this.focusedSectionId;return e?this.sectionBounds(e)&&this.stage.scaleX()>this.sectionFrameScale(e)*1.05?(this.focusRegion(e),"section"):"venue":this.getRung()==="seats"?(this.setRung("sections"),"sections"):(this.cancelGlide(),this.zoomToFit(),"venue")}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(),o=e.id,s=typeof o=="string"?this.seatById.get(o):void 0;if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let l=s?this.perspectiveSeatProjected.get(s.id)??ae(this.perspectiveBaseAffine,e):ae(this.perspectiveBaseAffine,e);return{x:l.x*t+this.stage.x(),y:l.y*t+this.stage.y()}}let r=s?this.renderedSeatPoint(s):e,n=this.isoT===0?r:this.isoForward(r);return{x:n.x*t+this.stage.x(),y:n.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;for(let o of this.sections)this.refreshSectionFill(o);this.lodScale=0,this.updateLOD(),this.updateAccessGlyphs(this.effScale());for(let o of this.seats){let s=this.circleById.get(o.id);s&&this.paintSeat(s,o.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((o,s)=>o===e[s])}setCommercialLimitedFilter(e){if(this.commercialLimitedFilter!==e){this.commercialLimitedFilter=e;for(let t of this.seats){let o=this.circleById.get(t.id);o&&this.paintSeat(o,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(!ln(t,this.categoryFilter)){this.categoryFilter=t;for(let o of this.seats){let s=this.circleById.get(o.id);s&&this.paintSeat(s,o.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}applyGAFilterState(){this.clusterLabels.applyFilterDim(),this.paintGAStateForView(),this.updateFreeTextVisibility(),this.bgLayer.batchDraw()}paintGAStateForView(){ea({gaById:this.gaById,bgLayer:this.bgLayer,exportMode:this.exportMode,pickerMode:!!this.opts.gaPickerMode,selectionColor:this.effSelection,labelFont:()=>this.labelFont(),filteredOut:e=>!!(this.categoryFilter&&!this.categoryFilter.has(e)),dimmed:e=>Jn(this.categoryHighlight,this.categoryFilter,e),overviewHidden:e=>!this.exportMode&&e.sectionId!=null&&this.effScale()<le,effScale:()=>this.effScale(),labelLegible:e=>ye(e,this.effScale())})}setGAStates(e){ta(this.gaById,e)&&this.applyGAFilterState()}setGAState(e,t){this.setGAStates({[e]:t})}focusCategories(e,t){if(!e?.length){this.focusRegion(this.bounds,{animate:t?.animate,durationMs:this.cameraGlideMs});return}let o=new Set(e),s=this.seats.filter(p=>!o.has(p.categoryKey)||this.seatInClosedSection(p.id)?!1:(this.statusById.get(p.id)??"free")==="free"||this.ownedHold.has(p.id));if(!s.length)return;let r=cn(s.map(p=>p.id),this.seatSection);r&&this.focusSection(r);let n=Math.max(24,this.seatR*3),l=s.map(p=>this.renderedSeatPoint(p)),a=this.clusterLabels.boundsForSeats(s.map((p,y)=>({...p,...l[y]})),n),c=a?.bounds??ci(l,n);if(!this.hasSections&&a){let p=this.clusterLabels.diveTarget(c,a.anchor);p&&this.focusRegion(p,{animate:t?.animate,durationMs:this.cameraGlideMs});return}let h=this.narrowSeatDetailFocus(l,c,a?.anchor??null),d=h?.bounds??c,u={x:d.x+d.width/2,y:d.y+d.height/2};!h&&rn({stage:this.stage,box:d,bounds:this.zoomBounds(),viewport:this.framingViewport(),centreScreen:this.worldToScreen(u)})||this.focusRegion(d,{animate:t?.animate,durationMs:this.cameraGlideMs,minScale:h?.minScale})}focusAccessibleSeats(e){let t=e===void 0?this.accessFilter:e;if(!t)return!1;let o=this.seats.filter(n=>this.seatInClosedSection(n.id)||et(n,t)!=="match"?!1:(this.statusById.get(n.id)??"free")==="free"||this.ownedHold.has(n.id));if(!o.length)return!1;this.clearSectionFocus();let s=Math.max(24,this.seatR*3),r=ci(o.map(n=>this.renderedSeatPoint(n)),s);return this.focusRegion(r,{durationMs:this.cameraGlideMs}),!0}setViewMode(e){if(e==="perspective"){if(this.viewMode===e){this.afterViewChange();return}let l=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(l),this.zoomToFit();return}let t=e==="isometric"?1:0,o=this.viewMode==="perspective";if(this.viewMode=e,this.isoTarget=t,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),o){this.isoT=t,this.applyIso(),this.afterViewChange();return}if(this.reducedMotion){this.isoT=t,this.applyIso(),this.afterViewChange();return}let s=this.isoT;if(s===t){this.applyIso(),this.afterViewChange();return}let r=performance.now(),n=l=>{if(this.destroyed)return;let a=Math.min(1,(l-r)/Rs),c=a<.5?4*a*a*a:1-Math.pow(-2*a+2,3)/2;this.isoT=s+(this.isoTarget-s)*c,this.applyIso(),this.scheduleViewChange(),a<1?this.isoRaf=requestAnimationFrame(n):(this.isoT=this.isoTarget,this.isoRaf=0,this.applyIso(),this.afterViewChange())};this.isoRaf=requestAnimationFrame(n)}getViewMode(){return this.viewMode}get isoState(){return{isoT:this.isoT,centre:this.isoCentre}}isoParams(){return Lt(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-dt)*this.isoT)}isoForward(e){return Pa(e,this.isoState)}isoInverse(e){return Ma(e,this.isoState)}buildPerspectiveProjection(e){let t=Oa({seats:this.seats,objects:e.objects,bounds:this.bounds,seatR:this.seatR,floorBaseHeightMFor:o=>this.floorBaseHeightMFor(o)},{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,o){Aa(e,t,o)}resetContainerTransform(e){Ea(e)}sectionSurfaceHeight(e,t){return _a(e,t)}projectedSectionPoint(e,t){return Ba(e,t,this.perspectiveBaseAffine)}perspectiveLocalPoint(e){return Fa(e,this.perspectiveBaseInverse)}isoLiftLocal(e){return Ra(e,this.isoState)}resetLayerTransforms(e=!0){let t=e?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let o of t)o.position({x:0,y:0}),o.offset({x:0,y:0}),o.scale({x:1,y:1}),o.rotation(0),o.skewX(0),o.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 o=this.labelLiftGroups.get(t.id);o&&e&&this.resetContainerTransform(o),t.perspectiveAffine=void 0,t.perspectiveCorrection=void 0,t.perspectiveDepth=void 0}}get seatAnchorContext(){return this.seatAnchorContextCache??={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){Da(this.seatAnchorContext,e,t)}applyPerspective(e=!0){let t=this.perspectiveCamera,o=this.perspectiveBaseAffine,s=this.perspectiveBaseInverse;if(!t||!o||!s)return;let r=this.seats.length>2500&&this.sections.length>0;this.cached&&!r&&(this.seatLayer.clearCache(),this.seatLayer.listening(!0),this.cached=!1),this.resetLayerTransforms(e),this.resetSectionProjection(e);for(let l of[this.bgLayer,this.overlayLayer])this.setContainerAffine(l,o,t.target);this.perspectiveAppliedSeats.clear(),r||this.applyExactSeatAnchors(!0);for(let l of this.sections){let a=d=>this.sectionSurfaceHeight(l,d),c=Wt(t,l.centroid,a),h=cs(s,c);l.perspectiveAffine=c,l.perspectiveCorrection=h,l.perspectiveDepth=ge(t,l.centroid,a(l.centroid)).depth,this.setContainerAffine(l.liftGroupBg,h,l.centroid);for(let d=0;d<l.sideFaces.length;d++){let u=l.outline[d],p=l.outline[(d+1)%l.outline.length],y=this.perspectiveLocalPoint(ge(t,u,0)),m=this.perspectiveLocalPoint(ge(t,p,0)),f=this.perspectiveLocalPoint(ge(t,p,a(p))),g=this.perspectiveLocalPoint(ge(t,u,a(u)));l.sideFaces[d].points([y.x,y.y,m.x,m.y,f.x,f.y,g.x,g.y]),l.sideFaces[d].opacity(.9)}}let n=[...this.sections].sort((l,a)=>(a.perspectiveDepth??0)-(l.perspectiveDepth??0));for(let l of n)l.rootGroupBg.moveToTop(),l.liftGroupSeat.moveToTop();this.unsectionedSeatGroup?.moveToTop(),this.syncSeatOverlayPositions(),r||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:o}=this.isoParams(),s=Math.cos(t),r=o*Math.sin(t),n=-Math.sin(t),l=o*Math.cos(t),a=Math.sqrt(s*s+r*r),c=s*l-r*n,h=Math.atan2(r,s)*180/Math.PI,d=a,u=c/a,p=(s*n+r*l)/c,y=this.isoCentre;for(let m of[this.bgLayer,this.seatLayer,this.overlayLayer])m.position({x:y.x,y:y.y}),m.offset({x:y.x,y:y.y}),m.rotation(h),m.scaleX(d),m.scaleY(u),m.skewX(p),m.skewY(0)}this.applyUprightLabels(),this.applyElevation(),this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyUprightLabels(){let e=zt*this.isoT,t=1/(1-(1-dt)*this.isoT),o=this.hasBoothText?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let s of o){let r=s.find("Text");for(let n of r){let l=n.getAttr("uprightBase");l==null&&(l=n.rotation(),n.setAttr("uprightBase",l)),n.rotation(l-e),n.scaleX(1),n.scaleY(t),n.skewX(0)}}}applyElevation(){let e=this.isoT;for(let t of this.sections){if(t.liftWorld<=0)continue;let o=this.isoLiftLocal(t.liftWorld);t.liftGroupBg?.position(o),t.liftGroupSeat.position(o),this.labelLiftGroups.get(t.id)?.position(o);let s=.9*e;for(let r=0;r<t.sideFaces.length;r++){let n=t.sideFaces[r],l=t.outline[r],a=t.outline[(r+1)%t.outline.length];n.points([l.x,l.y,a.x,a.y,a.x+o.x,a.y+o.y,l.x+o.x,l.y+o.y]),n.opacity(s)}}this.syncSeatOverlayPositions()}destroy(){this.destroyed=!0,this.cancelAssetLoads(),this.cancelSeatReveal(),this.rafId&&cancelAnimationFrame(this.rafId),this.isoRaf&&cancelAnimationFrame(this.isoRaf),this.glideRaf&&cancelAnimationFrame(this.glideRaf),this.viewChangeRaf&&cancelAnimationFrame(this.viewChangeRaf),this.zoomSettleRaf&&cancelAnimationFrame(this.zoomSettleRaf),this.breathCache?.destroy(),this.momentsCache?.destroy(),this.beaconsCache?.clear(),this.recacheTimer&&clearTimeout(this.recacheTimer),this.resizeObs?.disconnect(),this.gestures.detach(),this.clusterLabels.destroy(),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||!this.focusDimOverlay)return t;let o=this.seatSection.get(e);return t*(o&&this.sectionMatchesFocus(o)?1:Ne)}sectionScreenBounds(e){return Wr({viewMode:this.viewMode,isoT:this.isoT,stageScale:this.stage.scaleX(),stageX:this.stage.x(),stageY:this.stage.y(),projectedSectionPoint:(t,o)=>this.projectedSectionPoint(t,o),isoLiftLocal:t=>this.isoLiftLocal(t),isoForward:t=>this.isoForward(t)},e)}updateSeatGroupVisibility(){let e=this.exportMode||this.effScale()>=le,t=this.viewMode==="perspective"&&this.glideInProgress&&this.seats.length>2500,o=96,s=this.stage.width(),r=this.stage.height();for(let n of this.sections){let l=!0;if(e){let c=this.sectionScreenBounds(n);l=c.x+c.width>=-o&&c.y+c.height>=-o&&c.x<=s+o&&c.y<=r+o,l&&this.viewMode==="perspective"&&!t&&this.applyExactSeatAnchors(!0,n.memberIds)}n.liftGroupSeat.setViewportCulled(!l),this.labelLiftGroups.get(n.id)?.setViewportCulled(!l)}this.unsectionedSeatGroup&&!this.unsectionedSeatGroup.visible()&&this.unsectionedSeatGroup.visible(!0),e&&this.viewMode==="perspective"&&!t&&(this.unsectionedSeatIds||(this.unsectionedSeatIds=this.seats.filter(n=>!this.seatSection.has(n.id)).map(n=>n.id)),this.applyExactSeatAnchors(!0,this.unsectionedSeatIds))}visibleSeatCandidates(){if(!this.sections.length)return this.seats;let e=[];for(let t of this.sections)if(!t.liftGroupSeat.isViewportCulled())for(let o of t.memberIds){let s=this.seatById.get(o);s&&e.push(s)}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 o=this.isoLiftLocal(t.liftWorld);return{x:e.x+o.x,y:e.y+o.y}}seatLabelContainer(e){let t=this.seatSection.get(e);if(!t)return this.labelGroup;let o=this.labelLiftGroups.get(t.id);return o||(o=new St({listening:!1}),o.setViewportCulled(t.liftGroupSeat.isViewportCulled()),o.position(this.viewMode==="perspective"?{x:0,y:0}:this.isoLiftLocal(t.liftWorld)),this.labelGroup.add(o),this.labelLiftGroups.set(t.id,o)),o}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 o=this.seatById.get(e);if(o){t.position(this.renderedSeatPoint(o));let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(o.id)??1:1;t.scale({x:s,y:s})}}}renderSeats(e=this.seats){tn({seats:e,seatR:this.seatR,theme:this.theme,seatGlyphDetail:this.seatGlyphDetail,setHasBoothText:()=>{this.hasBoothText=!0},circleById:this.circleById,glyphMarkers:this.glyphMarkers,boothDims:this.boothDims,boothLabelById:this.boothLabelById,accessGlyphById:this.accessGlyphById,accessRingById:this.accessRingById,catByKey:this.catByKey,perspectiveSeatDepth:this.perspectiveSeatDepth,seatContainer:t=>this.seatContainer(t),buildAccessGlyph:(t,o)=>this.buildAccessGlyph(t,o),paintSeat:(t,o)=>this.paintSeat(t,o),labelFont:()=>this.labelFont()})}buildAccessGlyph(e,t){let o=this.seatR*1.5/Te,s=new Wh({x:e.x,y:e.y,data:Ot(e.accessibility??[])??"",scaleX:o,scaleY:o,fill:Ri(t),listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});return ui(s),s}updateAccessGlyphs(e){if(this.accessGlyphById.size)for(let[t,o]of this.accessGlyphById){let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1,r=this.seatR*1.5/Te*s,l=this.accessGlyphFilterEmphasized(t)?Ts:ks,a=Math.max(r,l/(Te*Math.max(e,.001)));o.scale({x:a,y:a}),o.visible(this.accessGlyphShouldShow(t))}}accessGlyphFilterEmphasized(e){let t=this.seatById.get(e),o=this.accessFilter;return!!t&&o!==null&&!!t.accessibility?.includes("wheelchair")&&(o.length===0||o.includes("wheelchair"))&&we(t,o)}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)}categoryPriceLabel(e){let t=this.catPrice.get(e);return typeof t=="number"?mt(t,this.currency):null}categoryDisplayColor(e){return this.colorblind?this.cbHueByKey.get(e)??jt[0]:this.catColor.get(e)??"#6e7bff"}seatLabelScale(e){return(e.labelStyle?.size??18)/18}seatPreferredLabelInk(e){return e.labelStyle?.color??this.theme.seatLabelColor??tt}seatLabelInk(e,t){let o=t.fill();return Ae(typeof o=="string"?o:"",e.labelStyle?.color,this.theme.seatLabelColor??tt,Ye)}paintSeat(e,t){let o=this.seatById.get(t),s=this.statusById.get(t)??"free",r=this.selection.has(t),n=this.categoryDisplayColor(o.categoryKey),l=this.boothLabelById.get(t);e.dash(ko),e.strokeWidth(0),e.stroke(""),e.opacity(1),e.scale({x:1,y:1});let a=s==="held"&&this.ownedHold.has(t),c=a?null:$n(s,this.canvasBackground,this.colorblind);c?(e.fill(c.fill),e.stroke(c.stroke),e.strokeWidth(c.strokeWidth),e.dash(c.dash),e.opacity(c.opacity),c.scale!==1&&e.scale({x:c.scale,y:c.scale})):a?(e.fill(ke(n,this.effSelection===gt?.24:.1)),e.stroke(this.effSelection),e.strokeWidth(3)):e.fill(r&&this.effSelection===gt?ke(n,.28):n),this.seatMarks.paint(e,t,s,n,this.seatR,this.colorblind,this.seatInClosedSection(t)),uo(e)&&e.scale({x:1,y:1}),o.wheelchairSpaceType==="no-seat"&&s==="free"&&(e.stroke(Pt(o.accessibility)),e.strokeWidth(r?3:2),e.dash([3,2])),l&&(l.text(s==="booked"?"SOLD":s==="held"?"HELD":o.label),l.fontSize(s==="free"?10:Math.min(10,Math.max(6,this.boothDims.get(o.rowId)?.width??40)/6)),l.fontStyle(s==="free"?"600":"800"),l.fill(s==="free"?this.theme.seatLabelColor??tt:"#ffffff"),l.offsetX(l.width()/2),l.offsetY(l.height()/2));let h=s==="free"||s==="held"&&!this.ownedHold.has(t);if(this.accessFilter&&h&&!r){let p=et(o,this.accessFilter);p==="other"?e.opacity(Math.min(e.opacity(),Yr)):p==="companion"&&e.opacity(Math.min(e.opacity(),Ur))}if(this.categoryHighlight&&s==="free"&&!r&&o.categoryKey!==this.categoryHighlight&&e.opacity(.25),this.categoryFilter&&s==="free"&&!r&&!this.categoryFilter.has(o.categoryKey)&&e.opacity(.22),this.commercialLimitedFilter&&s==="free"&&!r&&(o.commercial?.restrictedView||o.commercial?.obstructedView)&&e.opacity(.22),this.dimmedSections.size){let p=this.seatSection.get(t);(p?this.dimmedSections.has(p.id)||this.dimmedSections.has(p.logicalId)||p.zone!=null&&this.dimmedSections.has(p.zone):this.dimmedSections.has(Yo))&&e.opacity(.18)}this.closedSections.size&&this.seatInClosedSection(t)&&(e.fill(er),e.stroke(""),e.strokeWidth(0),e.dash(ko),e.opacity(tr),e.scale({x:1,y:1})),this.selectionFocusId&&t!==this.selectionFocusId&&e.opacity(Math.min(e.opacity(),.16));let d=this.boothLabelById.get(t)??this.seatLabelById.get(t);d&&(d.fill(this.seatLabelInk(o,e)),d.visible(ye(d.fontSize(),this.effScale())&&e.opacity()>=.5));let u=this.accessGlyphById.get(t);if(u){let p=e.fill();u.fill(Ri(typeof p=="string"?p:"")),u.opacity(e.opacity()),u.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 o=this.circleById.get(t.id);o&&this.paintSeat(o,t.id)}for(let t of this.sections)t.shellCategoryColor=this.dominantSellableColor(t.memberIds),this.refreshSectionFill(t);this.bgLayer.batchDraw(),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(o=>this.dimmedSections.has(o)))){this.dimmedSections=t;for(let o of this.seats){let s=this.circleById.get(o.id);s&&this.paintSeat(s,o.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(o=>this.closedSections.has(o))||(this.closedSections=t,this.repaintSectionsAndSeats())}focusSection(e,t){this.sections.some(o=>o.id===e||o.logicalId===e)&&(this.focusedSectionId=e,this.focusAnchor=t?.anchor??null,this.focusRoams=!1,this.drawFocusBackdrop(e),this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD(),this.focusSectionCamera(e,!0,t?.anchor))}focusSectionCamera(e,t=!0,o){let s=this.sectionBounds(e);if(!s)return;let r=this.sectionMembers(e).map(c=>this.seatById.get(c)).filter(c=>c!=null),n=r.filter(c=>(this.statusById.get(c.id)??"free")==="free"||this.ownedHold.has(c.id)),l=(n.length?n:r).map(c=>this.renderedSeatPoint(c)),a=this.narrowSeatDetailFocus(l,s,o);this.focusRegion(a?.bounds??s,{animate:t,minScale:a?.minScale})}releaseSectionFocusDim(){!this.focusBackdrop&&!this.focusDimOverlay||(this.focusRoams=!0,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.focusAnchor=null,this.focusRoams=!1,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}seatsRevealed(){return this.focusedSectionId||this.floorOverview?!0:this.effScale()>=Be}seatsPickable(){return this.focusedSectionId||this.floorOverview?!0:this.effScale()>=So(this.markerR)}drawFocusBackdrop(e){this.focusBackdrop?.destroy(),this.focusBackdrop=null;let t=this.sections.filter(o=>o.id===e||o.logicalId===e);if(this.focusBackdrop=Pn(this.focusBackdropHost,t),!!this.focusBackdrop){this.focusDimOverlay?.destroy(),this.focusDimOverlay=Mn(this.focusBackdropHost,t);for(let o of this.selectionMarkers.values())o.moveToTop();this.hoverRing.moveToTop(),this.focusRing.moveToTop()}}get focusBackdropHost(){return{bgLayer:this.bgLayer,overlayLayer:this.overlayLayer,bounds:this.bounds,canvasBackground:this.canvasBackground,viewMode:this.viewMode,perspectiveLocalPoint:e=>this.perspectiveLocalPoint(e),projectedSectionPoint:(e,t)=>this.projectedSectionPoint(e,t),isoLiftLocal:e=>this.isoLiftLocal(e)}}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)this.refreshSectionFill(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,o=-1/0,s=-1/0,r=(n,l)=>{n<e&&(e=n),l<t&&(t=l),n>o&&(o=n),l>s&&(s=l)};for(let n of this.seats)r(n.x,n.y);for(let n of this.sections)for(let l of n.outline)r(l.x,l.y);for(let n of this.gaById.values())for(let l of n.points)r(l.x,l.y);return Number.isFinite(e)?{x:e,y:t,width:Math.max(1,o-e),height:Math.max(1,s-t)}:{x:0,y:0,width:1,height:1}}getMinimapSnapshot(){let e=this.sections.map(t=>{let o=this.isSectionClosed(t)||t.free<=0,s=t.memberIds.some(l=>this.selection.has(l)),r=s||t.memberIds.some(l=>this.ownedHold.has(l)),n=this.focusedSectionId===t.id||this.focusedSectionId===t.logicalId;return{id:t.logicalId,label:t.label,outline:t.outline.map(l=>({...l})),...this.objectFloor.get(t.id)?{floorId:this.objectFloor.get(t.id)}:{},state:s?"selected":o?"inactive":"available",active:n,paint:{fill:t.shellFill,stroke:t.shellStroke},owned:r}});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 o=this.circleById.get(t.id);o&&this.paintSeat(o,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}renderBackground(e){let t=lt(e);t&&this.renderBackgroundImage(t);for(let o of e.objects)o.type==="decorImage"&&this.renderDecorImage(o);for(let o of e.objects)o.type==="section"&&this.renderSection(o);for(let o of e.objects)o.type==="shape"?this.renderShape(o):o.type==="gaArea"?this.renderGA(o):o.type==="table"?this.renderTable(o):o.type==="text"&&this.renderText(o);this.renderZones(e)}trackAssetImage(e,t,o,s){let r=this.assetGeneration;/^https?:\/\//i.test(t)&&(e.crossOrigin="anonymous");let n=new Promise(l=>{let a=!1,c=()=>{a||(a=!0,this.assetCancels.delete(h),l())},h=()=>{e.onload=null,e.onerror=null;try{e.removeAttribute("src"),e.src=""}catch{}c()};this.assetCancels.add(h),e.onload=()=>{if(!this.exportMode){r===this.assetGeneration&&s(),c();return}(typeof e.decode=="function"?e.decode():Promise.resolve()).then(()=>{r===this.assetGeneration&&s()}).catch(()=>{r===this.assetGeneration&&this.assetErrors.push(`${o} could not be decoded.`)}).finally(c)},e.onerror=()=>{r===this.assetGeneration&&this.assetErrors.push(`${o} could not be loaded.`),c()},e.src=t});this.assetPromises.push(n)}cancelAssetLoads(){this.assetGeneration++;for(let e of[...this.assetCancels])e();this.assetCancels.clear(),this.assetPromises=[],this.assetErrors=[]}renderBackgroundImage(e){na(this.objectDrawContext,e)}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,landmarkBoxes:this.landmarkBoxes,labelFont:()=>this.labelFont(),trackAssetImage:(e,t,o,s)=>this.trackAssetImage(e,t,o,s),isGhostClick:e=>this.isGhostClick(e)}}renderDecorImage(e){aa(this.objectDrawContext,e)}renderTable(e){la(this.objectDrawContext,e)}renderText(e){ca(this.objectDrawContext,e)}renderShape(e){ha(this.objectDrawContext,e)}renderGA(e){ua(this.objectDrawContext,e)}renderSection(e){let t=Rt(e.outline,e.holes),o=ee(this.canvasBackground),s=[],r=new Map,n=0,l=K(e.outline),a=this.seatIndex?Gt(this.seatIndex,l).map(I=>this.seatById.get(I)).filter(I=>!!I):this.seats;for(let I of a)this.seatSection.has(I.id)||ie(I,e.outline,e.holes)&&(s.push(I.id),r.set(I.categoryKey,(r.get(I.categoryKey)??0)+1),(this.statusById.get(I.id)??"free")==="free"&&n++);let c=e.color??Mi([...r].map(([I,_])=>({hex:this.catColor.get(I)??"#6e7bff",w:_})),"#3a4358"),h=No(e.elevation),d=Mt(e,{floorBaseHeightM:this.floorBaseHeightMFor(e.id)}),u=d.height*ze,p=new kt({listening:!1});this.bgLayer.add(p);let y=new kt({listening:!1});p.add(y);let m=new St({listening:!0});this.seatLayer.add(m);let f=[];if(u>0){let I=fe(this.zoneColor.get(e.zone??"")??c,.42);for(let _=0;_<e.outline.length;_++){let $=new Gh({points:[],closed:!0,fill:I,stroke:B("#000000",.25),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});f.push($),p.add($)}}y.moveToTop();let g=y,b=e.color??this.zoneColor.get(e.zone??"")??"#3a4358",S=We(e.outline,e.holes,{stroke:B(b,.5),strokeWidth:1,fill:B(b,.08),listening:!1},e.outlinePath);g.add(S);let v=We(e.outline,e.holes,{fill:o.sectionFill,stroke:o.sectionStroke,strokeWidth:Fe,opacity:0,listening:!1},e.outlinePath);g.add(v);let w=e.labelPresentation?.labelStyle,L=w?.color,k=o.sectionInk,T=(w?.size??18)/18,x=new Ha({x:e.labelPresentation?.position?.x??t.x,y:e.labelPresentation?.position?.y??t.y,width:0,height:0,opacity:0,listening:!1,perfectDrawEnabled:!1});g.add(x);let C=new Ga({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:18*T,fontStyle:Oe,fontFamily:this.labelFont(),fill:Ae(o.sectionFill,L,k),listening:!1,perfectDrawEnabled:!1});C.offsetX(C.width()/2),C.offsetY(C.height()/2),g.add(C);let R=new Ga({x:t.x,y:t.y,text:G("map.seatsLeft",{count:n}),fontSize:12,fontStyle:Us,fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:o.sectionInk,opacity:0,listening:!1,perfectDrawEnabled:!1});R.offsetX(R.width()/2),g.add(R);let P={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:Gr(e.outline,e.holes??[],t),memberCategoryKeys:new Set(s.map(I=>this.seatById.get(I)?.categoryKey).filter(Boolean)),shellCategoryColor:this.dominantSellableColor(s),shellFill:o.sectionFill,shellStroke:o.sectionStroke,labelArea:Oo(e.outline,e.holes),zone:e.zone,memberIds:s,total:s.length,free:n,baseFill:c,outlineTint:b,outlinePoly:S,blockPoly:v,namePlate:x,nameLabel:C,subLabel:R,preferredInk:k,...L?{explicitInk:L}:{},labelScale:T,nameLabelFits:!1,subLabelFits:!0,elevation:h,liftWorld:u,rakeDeg:d.rake,surfaceFocal:s.length?{...this.seatById.get(s[0])?.focalPoint??this.isoCentre}:{...this.chartDoc?.focalPoint??this.isoCentre},frontDistanceWorld:0,rootGroupBg:p,bgZIndex:p.zIndex(),seatZIndex:m.zIndex(),liftGroupBg:y,liftGroupSeat:m,sideFaces:f},A=s.map(I=>this.seatById.get(I)).filter(I=>!!I),M=A.length?A:e.outline;P.frontDistanceWorld=Math.min(...M.map(I=>Math.hypot(I.x-P.surfaceFocal.x,I.y-P.surfaceFocal.y)));for(let I of s)this.seatSection.set(I,P);this.unsectionedSeatIds=null,this.refreshSectionFill(P),this.refreshSectionHeat(P),this.sections.push(P)}refreshSectionHeat(e){fn(this.sectionLodPaintContext,e)}refreshSectionFill(e){gn(this.sectionLodPaintContext,e)}isSectionClosed(e){return oo(this.sectionLodPaintContext,e)}dominantSellableColor(e){let t=or(e,o=>this.seatById.get(o)?.categoryKey,o=>this.catByKey.get(o)?.notForSale===!0);return t?this.categoryDisplayColor(t):null}sectionAccessibleFree(e){return mn(e.memberIds,this.accessFilter,t=>this.statusById.get(t)??"free",t=>this.seatById.get(t))}get sectionLodPaintContext(){return{sections:this.sections,zones:this.zones,sectionHeat:this.sectionHeat,closedSections:this.closedSections,canvasBackground:this.canvasBackground,sectionIsOwned:e=>e.memberIds.some(t=>this.selection.has(t)||this.ownedHold.has(t)),accessFilterActive:this.accessFilter!=null,sectionAccessibleFree:e=>this.sectionAccessibleFree(e),selectionColor:this.effSelection,bgLayer:this.bgLayer,seatLayer:this.seatLayer,stageScaleX:this.stage.scaleX(),stageWidth:this.stage.width(),floorOverview:this.floorOverview,focusedSectionId:this.focusedSectionId,categoryFilter:this.categoryFilter,landmarks:this.landmarkBoxes,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){Xr({bgLayer:this.bgLayer,canvasBackground:this.canvasBackground,catPrice:this.catPrice,currency:this.currency,seatById:this.seatById,sections:this.sections,zones:this.zones,labelFont:()=>this.labelFont()},e)}screenToWorld(e){let t=this.stage.scaleX(),o={x:(e.x-this.stage.x())/t,y:(e.y-this.stage.y())/t};return this.viewMode==="perspective"&&this.perspectiveBaseInverse?ae(this.perspectiveBaseInverse,o):this.isoT===0?o:this.isoInverse(o)}sectionAt(e){if(!this.sections.length)return null;let t=this.screenToWorld(e),o=this.sections.find(s=>{if(this.viewMode==="perspective"&&s.perspectiveAffine)return ie(t,s.outline.map(n=>this.perspectiveLocalPoint(this.projectedSectionPoint(s,n))),s.holes.map(n=>n.map(l=>this.perspectiveLocalPoint(this.projectedSectionPoint(s,l)))));let r=s.liftWorld>0?this.isoLiftLocal(s.liftWorld):{x:0,y:0};return ie({x:t.x-r.x,y:t.y-r.y},s.outline,s.holes)});return o?o.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)||!(this.opts.selectableStatuses??["free"]).includes(this.statusById.get(e)??"free")?!1:!this.hiddenByAccessFilter(e)}hiddenByAccessFilter(e){if(!this.accessFilter||this.selection.has(e))return!1;let t=this.seatById.get(e);return t?et(t,this.accessFilter)==="other":!1}toggleSeat(e){if(this.ownedHold.has(e)){let t=this.seatById.get(e);t&&this.opts.onDeselect?.(t);return}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),this.playSeatPickMoment(e);let t=this.seatById.get(e);t&&this.opts.onSelect?.(t)}this.overlayLayer.batchDraw()}resolveCanvasBackground(){let e=this.theme.background?Pi(this.theme.background):null;if(e)return e;if(typeof getComputedStyle=="function"){let t=this.container;for(;t;){let o=Pi(getComputedStyle(t).backgroundColor);if(o)return o;t=t.parentElement}}return Ji}resolveSelectionColor(){return this.theme.selectionColor?this.theme.selectionColor:D(this.canvasBackground)?$r:gt}setSelected(e,t,o=!1){let s=this.circleById.get(e);t?this.selection.add(e):(this.selectionFocusId===e&&this.setSelectionFocus(null),this.selection.delete(e)),s&&(this.paintSeat(s,e),!o&&!this.cached&&this.seatLayer.batchDraw()),this.syncSelectionMarker(e)}syncSelectionMarker(e){this.moments.syncMarker(e,this.selection.has(e)||this.ownedHold.has(e),this.selectionMarkers),this.hasSections&&(this.owned.sync(this.effScale(),this.getRung()),this.syncBeacons()),(this.breathCache||this.selectionMarkers.size)&&this.breath.sync(this.selectionMarkers)}playSeatPickMoment(e){this.moments.play(e)}showTouchLoupe(e){this.moments.showLoupe(e)}hideTouchLoupe(){this.moments.hideLoupe()}sectionBounds(e){return Kr({sections:this.sections,viewMode:this.viewMode,isoT:this.isoT,seatR:this.seatR,bgLayer:this.bgLayer,seatById:this.seatById,freeTextById:this.freeTextById,iconNodeById:this.iconNodeById,rowLabelPlan:this.rowLabelPlan,projectedSectionPoint:(t,o)=>this.projectedSectionPoint(t,o),isoLiftLocal:t=>this.isoLiftLocal(t),isoForward:t=>this.isoForward(t),renderedSeatPoint:t=>this.renderedSeatPoint(t),labelFont:()=>this.labelFont(),resolveAutomaticRowLabelPosition:(t,o,s)=>this.resolveAutomaticRowLabelPosition(t,o,s),rowLabelBox:(t,o)=>this.rowLabelBox(t,o)},e)}sectionFrameScale(e){let t=this.sectionBounds(e);return t?it(this.stage,t,this.zoomBounds(),this.framingViewport()):this.stage.scaleX()}handleSeatTap(e){if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let o=this.objectFloor.get(this.seatById.get(e)?.rowId??"");if(o){this.opts.onDeckTap(o);return}}if(this.effScale()<oe&&this.sections.length){let o=this.seatSection.get(e);if(o){let s=this.focusedSectionId===o.logicalId,r=this.sectionFrameScale(o.logicalId)>this.stage.scaleX()*1.02;if(!s&&r){let n=this.seatById.get(e),l=n?this.renderedSeatPoint(n):void 0;this.opts.onSectionTap?this.opts.onSectionTap(o.logicalId,l):this.focusSection(o.logicalId,{anchor:l});return}}}if(!(this.ownedHold.has(e)||this.selection.has(e)||this.isSelectable(e))){let o=this.seatById.get(e)??null;o&&(this.opts.onHover?.(o,{mark:this.seatMarks.get(e)??null,interaction:"press",unavailable:!0,...this.hiddenByAccessFilter(e)?{filteredOut:!0}:{}}),this.moments.nudge(e));return}this.seatMarks.has(e)&&this.opts.onHover?.(this.seatById.get(e)??null,{mark:this.seatMarks.get(e),interaction:"press"}),this.toggleSeat(e)}deckFloorAt(){return sn(this.screenPickingHost)}nearestSeatToScreen(e,t,o=!1){return on(this.screenPickingHost,e,t,{includeUnavailable:o})}get screenPickingHost(){return{seats:this.seats,stage:this.stage,seatR:this.seatR,viewMode:this.viewMode,selection:this.selection,objectFloor:this.objectFloor,perspectiveSeatScale:this.perspectiveSeatScale,renderedSeatPoint:e=>this.renderedSeatPoint(e),screenToWorld:e=>this.screenToWorld(e),worldToScreen:e=>this.worldToScreen(e),isSelectable:e=>this.isSelectable(e)}}hoverAffordance(e){return this.ownedHold.has(e)||this.selection.has(e)||this.isSelectable(e)?"full":this.seatInClosedSection(e)?"none":(this.statusById.get(e)??"free")==="held"?"muted":"none"}wireInteraction(){this.seatLayer.on("click tap",e=>{if(this.moved>xe||this.isGhostClick(e))return;let t=Lo(e.target);t&&this.seatsPickable()&&this.handleSeatTap(t)}),this.seatLayer.on("mouseover",e=>{let t=Lo(e.target);if(!t)return;let o=this.seatById.get(t);if(!o)return;this.hoveredId=t;let s=this.hoverAffordance(t);this.hoverRing.position(this.renderedSeatPoint(o));let r=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1;this.hoverRing.scale({x:r,y:r}),this.hoverRing.opacity(s==="muted"?Vh:Wa),this.hoverRing.dash(s==="muted"?Kh:ko),this.hoverRing.visible(s!=="none"),this.overlayLayer.batchDraw(),this.clusterLabels.syncCursor(s==="full"),this.opts.onHover?.(o,{mark:this.seatMarks.get(t),interaction:"hover"})}),this.seatLayer.on("mouseout",()=>{this.hoveredId=null,this.hoverRing.visible(!1),this.overlayLayer.batchDraw(),this.clusterLabels.syncCursor(!1),this.opts.onHover?.(null,{mark:null})}),this.stage.on("wheel",e=>{e.evt.preventDefault(),this.releaseSectionFocusDim();let t=this.container.getBoundingClientRect(),o={x:e.evt.clientX-t.left,y:e.evt.clientY-t.top},s=Math.exp(-e.evt.deltaY*.002);this.zoomAbout(this.stage.scaleX()*V(s,.5,2),o,"frame")}),this.stage.on("click tap",e=>{if(this.moved>xe||this.isGhostClick(e))return;let t=this.stage.getPointerPosition();if(!t)return;if(!this.cached){if(Lo(e.target)&&this.seatsPickable())return;if(this.seatsPickable()){let s=this.focusedSectionId,r=this.nearestSeatToScreen(t,_e),n=r?this.seatSection.get(r):null;if(r&&(!s||n&&this.sectionMatchesFocus(n))){this.handleSeatTap(r);return}let l=r?null:this.nearestSeatToScreen(t,_e,!0),a=l?this.seatSection.get(l):null;if(l&&(!s||a&&this.sectionMatchesFocus(a))){this.handleSeatTap(l);return}if(s&&this.opts.onBackdropTap&&!this.floorOverview){let h=this.sectionAt(t);if(h&&h!==s){let d=this.sectionTapAnchor(h,this.screenToWorld(t));this.opts.onSectionTap?this.opts.onSectionTap(h,d):this.focusSection(h,{anchor:d})}else h||this.opts.onBackdropTap();return}if(s)return;let c=this.sections.length?this.sectionAt(t):null;if(!c||this.effScale()>=oe||this.sectionFrameScale(c)<=this.stage.scaleX()*1.02)return}}if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let s=this.floorOverview?this.sectionAt(t):null,r=(s?this.objectFloor.get(s):null)??this.deckFloorAt();if(r){this.opts.onDeckTap(r);return}}if(this.sections.length){let s=this.screenToWorld(t),r=this.owned.badgeAt(s)??this.sectionAt(t);if(r){let n=this.sectionTapAnchor(r,s);this.opts.onSectionTap?this.opts.onSectionTap(r,n):this.focusSection(r,{anchor:n});return}}if(this.clusterLabels.focusCluster(t)||this.clusterLabels.glideTowardTap(t))return;let o=Math.max(Ee*1.2,this.stage.scaleX()*2.5);this.zoomAbout(o,t)})}zoomBounds(){let e=.5*this.fitScale;return this.zones.length&&(e=Math.min(e,Ue*.9)),{min:e,max:Math.max(10*this.fitScale,4,xa(this.markerR))}}zoomAbout(e,t,o="now"){nn(this.stage,e,t,this.zoomBounds())&&(o==="frame"?(this.updateSeatGroupVisibility(),this.scheduleZoomSettle()):this.afterViewChange(),this.stage.batchDraw())}scheduleZoomSettle(){if(this.exportMode||typeof requestAnimationFrame!="function"){this.afterViewChange();return}this.zoomSettleRaf||(this.zoomSettleRaf=requestAnimationFrame(()=>{this.zoomSettleRaf=0,!this.destroyed&&this.afterViewChange()}))}cancelZoomSettle(){this.zoomSettleRaf&&(cancelAnimationFrame(this.zoomSettleRaf),this.zoomSettleRaf=0)}zoomToBounds(e,t){an(this.stage,e,this.zoomBounds(),t,this.framingViewport()),this.settleView(),this.stage.batchDraw()}focusRegion(e,t){let o=typeof e=="string"?this.sectionBounds(e):e;if(!o)return;if(this.cancelGlide(),t?.animate===!1||this.reducedMotion){this.zoomToBounds(o,t?.minScale);return}let s=this.framingViewport(),r=s.width,n=s.height,{min:l,max:a}=this.zoomBounds(),c=1.12,h=Math.min(r/(o.width*c),n/(o.height*c)),d=V(Math.max(h,t?.minScale??l),l,a),u=s.x+r/2-(o.x+o.width/2)*d,p=s.y+n/2-(o.y+o.height/2)*d,y=this.stage.scaleX(),m=this.stage.x(),f=this.stage.y();if(Math.abs(d-y)<1e-4&&Math.abs(u-m)<.5&&Math.abs(p-f)<.5){this.settleView();return}let g=performance.now(),b=Math.max(180,Math.min(1200,t?.durationMs??this.cameraGlideMs));this.glideInProgress=!0;let S=v=>{if(this.destroyed){this.glideRaf=0,this.glideInProgress=!1;return}let w=Math.min(1,(v-g)/b),L=w<.5?4*w*w*w:1-Math.pow(-2*w+2,3)/2,k=y+(d-y)*L;this.stage.scale({x:k,y:k}),this.stage.position({x:m+(u-m)*L,y:f+(p-f)*L}),this.updateSeatGroupVisibility(),this.updateLOD(),this.scheduleViewChange(),this.stage.batchDraw(),w<1?this.glideRaf=requestAnimationFrame(S):(this.glideRaf=0,this.glideInProgress=!1,this.settleView())};this.glideRaf=requestAnimationFrame(S)}applyLabelVisibility(e){let t=e!==this.labelsVisible;if(this.labelsVisible=e,!t||!e)return;if(this.labelFadeRaf&&(cancelAnimationFrame(this.labelFadeRaf),this.labelFadeRaf=0),this.reducedMotion){this.labelGroup.opacity(1);return}let o=performance.now();this.labelGroup.opacity(0);let s=r=>{if(this.destroyed){this.labelFadeRaf=0;return}let n=Math.min(1,(r-o)/90);this.labelGroup.opacity(n),this.stage.batchDraw(),this.labelFadeRaf=n<1?requestAnimationFrame(s):0};this.labelFadeRaf=requestAnimationFrame(s)}cancelGlide(){this.glideRaf&&(cancelAnimationFrame(this.glideRaf),this.glideRaf=0),this.glideInProgress=!1}getRung(){let e=this.effScale();return e>=le?"seats":this.zones.length&&e<Ue?"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,seatLabelDrops:this.seatLabelDrops,seatLabelRungOpen:()=>this.seatLabelRungOpen,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 this.cancelSeatReveal(!0),oa(this.renderedQualityContext)}setRung(e){if(e==="zones"){this.cancelGlide(),this.zoomToFit();return}let t=e==="sections"?(Se+le)/2:this.seatRungScale(),o=this.framingViewport(),s=o.width,r=o.height,n=li(this.framingWorldRect()),l=n.x,a=n.y;if(e==="sections"&&this.sections.length>0){let u=this.sections.map(f=>{let g=K(f.outline);return{x:g.x+g.width/2,y:g.y+g.height/2}}),p=s/(t*2),y=r/(t*2);if(!u.some(f=>Math.abs(f.x-n.x)<=p&&Math.abs(f.y-n.y)<=y)){let f=u.reduce((g,b)=>{let S=(b.x-n.x)**2+(b.y-n.y)**2;return S<g.distance?{point:b,distance:S}:g},{point:u[0],distance:1/0});l=f.point.x,a=f.point.y}}let c=e==="seats"?this.seats.filter(u=>u.kind!=="booth"):[];if(c.length>0){let u=c[0],p=1/0;for(let y of c){let m=y.x-n.x,f=y.y-n.y,g=m*m+f*f;g<p&&(u=y,p=g)}l=u.x,a=u.y}let h=s/(t*1.12),d=r/(t*1.12);this.focusRegion({x:l-h/2,y:a-d/2,width:h,height:d})}seatRungScale(){return Nn(this.seatLabelTargetScale())}narrowSeatDetailFocus(e,t,o){let s=this.framingViewport();return Hn({stageWidth:s.width,stageHeight:s.height,fullBounds:t,seatPoints:e,visibleBounds:this.framingWorldRect(),minScale:this.seatRungScale(),tapAnchor:o})}seatLabelTargetScale(){return Rn({seats:this.seats,seatR:this.seatR,labelFont:()=>this.labelFont(),seatLabelScale:e=>this.seatLabelScale(e)})}afterViewChange(){this.retargetRoamingFocus(),this.updateSeatGroupVisibility(),this.updateLOD(),this.updateFreeTextVisibility(),this.updateLabels(),this.scheduleViewChange()}settleView(){this.cancelZoomSettle(),this.viewChangeRaf&&(cancelAnimationFrame(this.viewChangeRaf),this.viewChangeRaf=0),this.afterViewChange()}retargetRoamingFocus(){if(!this.focusRoams||!this.focusedSectionId||this.floorOverview)return;let e=Vr({sections:this.sections.map(t=>({logicalId:t.logicalId,members:t.memberIds.length,bounds:this.sectionScreenBounds(t)})),viewport:{width:this.stage.width(),height:this.stage.height()},current:this.focusedSectionId});!e||e===this.focusedSectionId||(this.focusedSectionId=e,this.focusAnchor=null,this.opts.onFocusedSectionChange?.(e))}scheduleViewChange(){this.exportMode||this.viewChangeRaf||(this.viewChangeRaf=requestAnimationFrame(()=>{this.viewChangeRaf=0,this.opts.onViewChange?.()}))}sizeLabel(e,t,o){e.fontSize(Math.max(1,t)),e.offsetX(e.width()/2),e.offsetY(e.height()/2),e.y(o)}updateLOD(){let e=this.exportMode?Math.max(this.effScale(),ve+.01,oe):this.effScale(),t=Math.max(e,1e-4);for(let[r,n]of this.primaryFocalLabels)da(r,n,t,(l,a)=>{this.sizeLabel(l,a,l.y())});this.hasSections?(bn(this.sectionLodPaintContext,e),this.owned.sync(e,this.getRung()),this.syncBeacons()):(this.clusterLabels.syncForCamera(e)||this.primaryFocalLabels.size)&&this.bgLayer.batchDraw(),this.clusterLabels.syncCursor(this.hoveredId!=null),this.paintGAStateForView(),this.updateAccessGlyphs(e),this.seatGlyphDetail=en(this.glyphMarkers,this.seatR,e,this.seatGlyphDetail);let o=!this.exportMode&&e<le;if(this.viewMode==="perspective"&&this.hasSections&&this.seats.length>2500&&o){this.seatLayer.listening(!1);return}if(o&&!this.cached){if(this.mountCachePending){this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>{this.recacheTimer=null,this.cacheSeatLayer()},0);return}this.cacheSeatLayer()}else!o&&(this.cached||!this.seatLayer.listening())&&(this.cached&&this.releaseSeatLayerBitmap(),this.seatLayer.listening(!this.exportMode),this.cached=!1,this.seatLayer.batchDraw())}rebuildSeatCache(){if(this.seatReveal||this.seatRevealPending)return;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,this.mountCachePending=!1}cacheSeatLayer(){this.rebuildSeatCache(),this.seatLayer.batchDraw()}releaseSeatLayerBitmap(){Sa(mi,this.seatLayer)}forceDraw(){this.loadingReveal==="plain"&&this.cancelSeatReveal(!0),this.zoomSettleRaf&&(this.cancelZoomSettle(),this.afterViewChange()),this.recacheTimer&&(clearTimeout(this.recacheTimer),this.recacheTimer=null,this.effScale()<le?this.rebuildSeatCache():this.cached&&(this.releaseSeatLayerBitmap(),this.seatLayer.listening(!0),this.cached=!1)),this.bgLayer.draw(),this.seatLayer.draw(),this.overlayLayer.draw()}async ready(){this.cancelSeatReveal(!0);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(n=>n.getClientRect({relativeTo:this.stage})).filter(n=>n.width>0&&n.height>0);if(!e.length)return this.bounds;let t=Math.min(...e.map(n=>n.x)),o=Math.min(...e.map(n=>n.y)),s=Math.max(...e.map(n=>n.x+n.width)),r=Math.max(...e.map(n=>n.y+n.height));return{x:t,y:o,width:Math.max(1,s-t),height:Math.max(1,r-o)}}fitExportContent(){if(!this.exportMode)return;let e=this.stage.width(),t=this.stage.height(),o=Math.max(12,Math.min(36,Math.min(e,t)*.025)),s=()=>{let r=this.exportSceneBounds(),n=Math.max(1,e-o*2),l=Math.max(1,t-o*2),a=Math.min(n/r.width,l/r.height)||1;this.fitScale=a,this.stage.scale({x:a,y:a}),this.stage.position({x:(e-r.width*a)/2-r.x*a,y:(t-r.height*a)/2-r.y*a}),this.afterViewChange()};s(),s()}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(s){let r=s instanceof Error?s.message:String(s);throw new Error(`The chart canvas could not be captured. A buyer-visible image may block export. ${r}`)}let t=document.createElement("canvas");t.width=this.stage.width(),t.height=this.stage.height();let o=t.getContext("2d");if(!o)throw new Error("Canvas 2D is unavailable; this browser cannot create an export.");o.fillStyle=this.canvasBackground,o.fillRect(0,0,t.width,t.height);try{o.drawImage(e,0,0)}finally{e.width=1,e.height=1}return t}updateFreeTextVisibility(){let e=this.exportMode?Math.max(this.effScale(),oe):this.effScale();for(let{node:t,backdrop:o,kind:s}of this.freeTextById.values()){if(s==="ga-label"||s==="ga-capacity")continue;let r=s==="free-text"&&this.nodeBelongsToFocusedSection(t),n=s==="direct-landmark";if(n){let a=Number(t.getAttr("directLandmarkBaseFontSize"))||t.fontSize();t.setAttr("directLandmarkBaseFontSize",a),t.fontSize(Math.max(a,H/e))}let l=n||r||ye(t.fontSize(),e);t.visible(l),o?.visible(l)}for(let{node:t,fontSize:o}of this.iconNodeById.values())t.visible(this.nodeBelongsToFocusedSection(t)||ye(o,e))}nodeBelongsToFocusedSection(e){let t=this.focusedSectionId;if(!t)return!1;this.focusMembershipKey!==t&&(this.focusMembership.clear(),this.focusMembershipKey=t);let o=this.focusMembership.get(e);if(o!==void 0)return o;let s=this.sections.filter(n=>n.id===t||n.logicalId===t||n.zone===t),r=!1;if(s.length){let n=e.getClientRect({relativeTo:this.bgLayer,skipShadow:!0}),l={x:n.x+n.width/2,y:n.y+n.height/2};r=s.some(a=>ie(l,a.outline,a.holes))}return this.focusMembership.set(e,r),r}buildRowLabelPlan(e){this.rowLabelPlan=ga(e,{theme:this.theme,canvasBackground:this.canvasBackground,seats:this.seats,seatSection:this.seatSection,seatR:this.seatR,objectFilteredOut:t=>this.objectFilteredOut(t)})}rowLabelBox(e,t,o=j){return go(e,t,o)}resolveAutomaticRowLabelPosition(e,t,o){return ba(e,t,o,this.seatIndex)}objectFilteredOut(e){let t=e.categoryKey;return t?!!(this.categoryHighlight&&t!==this.categoryHighlight||this.categoryFilter&&!this.categoryFilter.has(t)):!1}updateLabels(){Ca(this.viewportLabelContext)}get viewportLabelContext(){return{exportMode:this.exportMode,effScale:()=>this.effScale(),labelsWereVisible:()=>this.labelsVisible,onLabelVisibilityChange:e=>this.applyLabelVisibility(e),boothLabelById:this.boothLabelById,circleById:this.circleById,focusedSeatOpacity:(e,t)=>this.focusedSeatOpacity(e,t),labelGroup:this.labelGroup,labelLiftGroups:this.labelLiftGroups,seatLabelById:this.seatLabelById,seatLabelDrops:this.seatLabelDrops,setSeatLabelRungOpen:e=>{this.seatLabelRungOpen=e},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,hasSeatMark:e=>this.seatMarks.has(e),accessFilterDimmed:e=>this.hiddenByAccessFilter(e),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,o)=>this.resolveAutomaticRowLabelPosition(e,t,o),rowLabelBox:(e,t)=>this.rowLabelBox(e,t),isoT:this.isoT,applyUprightLabels:()=>this.applyUprightLabels(),overlayLayer:this.overlayLayer}}handleResize(){this.gestures.invalidateRect();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())}};Tt.ZOOM_STEP=1.4;var To=Tt;function Va(i,e){return new To(i,e)}function Ka(i,e,t){let o=new Map,s=new Map,r=new Map,n=new Map,l=[],a=new Map(Wo(i).map(d=>[d.id,d])),c=_t(i),h=new Map(c.sections.map(d=>[d.id,d.label]));for(let d of e){o.set(d.label,d.id),s.set(d.label,d),r.set(d.id,d),l.push(d.id);let u=a.get(d.rowId),p=u&&"label"in u&&typeof u.label=="string"?u.label:void 0,y=u?.type==="row"?u.segmentedRow:void 0,m=y?.displayLabel??(u&&"displayLabel"in u&&typeof u.displayLabel=="string"&&u.displayLabel?u.displayLabel:p),f=t.get(d.rowId),g=u?.type==="table"?"table":u?.type==="booth"?"booth":"seat",b=m,S=y?.displayType?.trim()||(u&&"displayType"in u&&typeof u.displayType=="string"&&u.displayType.trim()?u.displayType.trim():void 0),v=d.displayLabel??d.label,w=v.split("-"),L=f||d.kind==="booth"?void 0:m&&v.startsWith(`${m}-`)?v.slice(m.length+1):w[w.length-1]??v;n.set(d.id,{objectId:d.rowId,objectType:g,sectionLabel:h.get(c.objectToSection.get(d.rowId)??""),rowLabel:b,seatNumber:L,...S?{displayType:S,rowType:S}:{}})}return{labelToId:o,labelToSeat:s,seatById:r,seatContext:n,allIds:l}}function za(i,e={}){let{baseMs:t=1e3,factor:o=2,maxMs:s=1/0,jitter:r=0,random:n=Math.random}=e,l=Math.min(t*o**Math.max(0,i),s);if(r<=0)return l;let a=Math.min(1,r);return l*(1-a+a*n())}function Xa(i,e,t){return nt(i).map(o=>{let s=i.categories.find(r=>r.key===o.categoryKey);return{id:o.id,label:o.label,...o.displayLabel?{displayLabel:o.displayLabel}:{},...o.displayType?{displayType:o.displayType}:{},capacity:Math.max(0,Math.floor(o.capacity)),available:Et(o).filter(r=>t(r)==="free").length,categoryKey:o.categoryKey,tiers:s?.tiers,price:s?.tiers?.[0]?.price??s?.price??0,currency:e}})}function Ya(i,e){let t={};for(let o of i)t[o.id]=e?{available:o.available,selected:e.get(o.id)??0}:{available:o.available};return t}function Ua(i){let e={};for(let[t,o]of i.seatById)i.groupedTableBySeatId.has(t)||i.closedMembers.has(t)||(i.statusOf(t)??"free")==="free"&&(e[o.categoryKey]=(e[o.categoryKey]??0)+1);for(let t of i.groupedTablesByLabel.values()){if(t.chairs.some(s=>i.closedMembers.has(s.id)))continue;let o=t.chairs[0];o&&(i.statusOf(o.id)??"free")==="free"&&(e[t.categoryKey]=(e[t.categoryKey]??0)+t.maxOccupancy)}for(let t of i.gaAreas??[])e[t.categoryKey]=(e[t.categoryKey]??0)+t.available;return e}function zh(i){return i.accessibility?.length?i.accessibility:i.accessible?["wheelchair"]:[]}function $a(i,e){let t=new Set,o=new Map;for(let s of i){let r=zh(s);if(!r.length)continue;let n=e(s.id)==="free";for(let l of r)t.add(l),n&&o.set(l,(o.get(l)??0)+1)}return t.size?Bo.filter(s=>t.has(s.key)).map(s=>({key:s.key,count:o.get(s.key)??0})):[]}var _g=5e3,Bg={lost:[],holdLapsed:!1,lapsedLabels:[],recoverable:[]};function Xh(i){if(!i.holdActive||i.holdLabels.length===0)return!1;let e=i.now??Date.now();return i.holdExpiresAt!=null&&e>=i.holdExpiresAt+5e3||i.serverHoldActive===!1?!0:!i.holdLabels.some(t=>i.statusOf(t)==="held")}function qa(i){let e=new Set(i.holdLabels),t=i.selection.filter(s=>!e.has(s)&&i.statusOf(s)!=="free");if(!Xh(i))return{lost:t,holdLapsed:!1,lapsedLabels:[],recoverable:[]};let o=[...i.holdLabels];return{lost:t,holdLapsed:!0,lapsedLabels:o,recoverable:o.filter(s=>i.statusOf(s)==="free")}}function Fg(i){return i.lost.length>0||i.holdLapsed}function Og(i){return!i.lapsedLabels.length||!i.recoverable.length?"none":i.recoverable.length===i.lapsedLabels.length?"all":"partial"}function Za(i,e,t=Date.now()){return e&&t<i+5e3}function ja(i){if(typeof document>"u"||typeof document.addEventListener!="function")return()=>{};let e=()=>{document.visibilityState==="visible"&&i()};return document.addEventListener("visibilitychange",e),()=>{typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",e)}}function Qa(i){if(!i?.zones?.length)return[];let e=new Set(_t(i).sections.filter(t=>t.seatCount>0&&!!t.zone).map(t=>t.zone));return i.zones.filter(t=>e.has(t.id)).map(t=>({id:t.id,label:t.label}))}function Ja(i){let e=i.doc;if(!e?.objects?.length)return null;let t=e.focalPoint??{x:0,y:0},o=Xe(e).filter(n=>!i.groupedObjectIds.has(n.rowId)),s=new Set;for(let n of o)i.heldLabels.has(n.label)||i.tierApplies(n)&&(i.accessFilter&&!we(n,i.accessFilter)||i.statusOfLabel(n.label)==="free"&&s.add(n.label));let r=Ss(o,s,{qty:i.qty,categoryKey:i.categoryKey,zoneId:i.zoneId,focal:t,preferPremium:!0});return r.labels.length!==i.qty?null:r.labels.every(n=>i.isPremium(n))?[...r.labels]:null}var xo=["background","rowLabelColor","textColor","selectionColor"];function el(i,e){return!i||!e?!i&&!e:xo.every(t=>i[t]===e[t])}function xt(i){let e=i??{};return{status:e.status,conflicts:e.conflicts,reason:e.reason}}function yi(i){return i==="blocked"?"not_for_sale":i==="held"||i==="booked"||i==="free"||i==="not_for_sale"?i:"free"}function tl(i,e,t){let o=Xo(e,t);o==="all"?i.setFloorOverview?.(!0):o&&i.setActiveFloor?.(o)}var Ie=class extends Error{constructor(t){super(t.message);this.status=422;this.name="PickerSelectionError",this.reason=t.code,this.labels=t.labels}};function il(i,e){return!e||i.eventConfigurationId===e.id&&i.eventConfigurationVersion===e.version?i:{...i,eventConfigurationId:e.id,eventConfigurationVersion:e.version}}var gi=class{constructor(){this.ref=null;this.pending=null}reset(e){this.ref=e??null,this.pending=null}load(e,t){if(!this.ref||!e.eventConfiguration)return Promise.resolve(null);if(!this.pending){let o=this.ref;this.pending=e.eventConfiguration(t).then(s=>{if(s.reference.id!==o.id||s.reference.version!==o.version||s.configuration.id!==o.id||s.configuration.version!==o.version)throw new Error("seatlayer: Event configuration response did not match the chart reference");return s.configuration})}return this.pending}};function ol(i){if(i!=null&&(!Number.isInteger(i)||i<1))throw new Error("picker: `numberOfPlacesToSelect` must be a positive integer");return i??null}function sl(i,e,t,o){if(t!=null&&!Array.isArray(t))throw new TypeError("picker: `selectionValidators` must be an array");let s=[],r=0,n=!1,l=!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");r=Math.max(r,Number(c.minimum))}else if(c?.type==="consecutiveSeats")n=!0;else if(c?.type==="noOrphanSeats")l=!0;else throw new TypeError(`picker: unsupported selection validator "${String(c?.type??"")}"`);if(r&&s.push({type:"minimumSelectedPlaces",minimum:r}),n&&s.push({type:"consecutiveSeats"}),l&&s.push({type:"noOrphanSeats"}),i!=null&&r>i)throw new Error("picker: `minimumSelectedPlaces.minimum` cannot exceed `numberOfPlacesToSelect`");let a=Math.max(0,Math.floor(e??i??Math.max(o,r)));if(i!=null&&a<i)throw new Error("picker: `maxSelection` cannot be lower than `numberOfPlacesToSelect`");if(e!=null&&a<r)throw new Error("picker: `maxSelection` cannot be lower than `minimumSelectedPlaces.minimum`");return{validators:s,maxSelection:i??a}}function Yh(i){let e=Number(i.slice(i.lastIndexOf(":")+1));return Number.isInteger(e)?e:-1}function Uh(i){if(i.length<=1)return!1;let e=i[0]?.objectId,t=i[0]?.categoryKey;if(!e||i.some(s=>s.objectId!==e||s.categoryKey!==t))return!0;let o=i.map(s=>Yh(s.id)).sort((s,r)=>s-r);return o.some((s,r)=>s<0||r>0&&s!==o[r-1]+1)}function rl(i,e,t,o,s){let r=o.find(a=>a.type==="minimumSelectedPlaces")?.minimum??0,n=t??r,l=[];return t!=null&&e!==t&&l.push("numberOfPlacesToSelect"),r&&e<r&&l.push("minimumSelectedPlaces"),o.some(a=>a.type==="consecutiveSeats")&&Uh(i)&&l.push("consecutiveSeats"),o.some(a=>a.type==="noOrphanSeats")&&s()&&l.push("noOrphanSeats"),{isValid:l.length===0,count:e,required:n,remaining:Math.max(0,n-e),seats:i,violations:l}}function nl(i){let{id:e,doc:t,seatById:o,groupedTableBySeatId:s}=i,r=t.objects.find(v=>v.type==="section"&&v.id===e);if(!r)return null;let n=i.sectionMembers(e),l=new Map,a=new Map,c=new Set,h=0,d=0;for(let v of n){let w=o.get(v);if(!w)continue;i.matchesAccessFilter&&i.statusOf(v)==="free"&&i.matchesAccessFilter(w)&&(d+=1);let L=s.get(v);if(L){if(c.has(L.label))continue;c.add(L.label),l.set(L.categoryKey,(l.get(L.categoryKey)??0)+L.maxOccupancy),i.statusOf(L.chairs[0]?.id??v)==="free"&&(h+=L.maxOccupancy,a.set(L.categoryKey,(a.get(L.categoryKey)??0)+L.maxOccupancy))}else l.set(w.categoryKey,(l.get(w.categoryKey)??0)+1),i.statusOf(v)==="free"&&(h++,a.set(w.categoryKey,(a.get(w.categoryKey)??0)+1))}let u=[...l.entries()].map(([v,w])=>{let L=t.categories.find(C=>C.key===v),k=L?.tiers?.length?L.tiers.map(C=>C.price):[L?.price??0],T=Math.min(...k),x=Math.max(...k);return{key:v,count:w,label:L?.label??v,color:L?.color??"#6e7bff",price:T,priceMin:T,priceMax:x}}).sort((v,w)=>v.price-w.price),p=u.map(v=>v.priceMin),y=u.map(v=>v.priceMax),m=r.zone?t.zones?.find(v=>v.id===r.zone):void 0,f=v=>{let w=null,L=0;for(let[k,T]of v)(T>L||T===L&&w!=null&&k<w)&&(w=k,L=T);return w},g=f(a)??f(l),S=(g?u.find(v=>v.key===g)?.color:void 0)??m?.color??r.color??"#6e7bff";return{id:e,...g?{dominantCategoryKey:g}:{},...i.matchesAccessFilter?{accessibleLeft:d}:{},label:r.displayLabel??r.label,zoneLabel:m?.label??"",...r.entrance&&r.entrance.trim()?{entrance:r.entrance.trim()}:{},color:S,seatsLeft:h,priceMin:p.length?Math.min(...p):0,priceMax:y.length?Math.max(...y):0,categories:u}}var bi=class{constructor(e={}){this.inFlight=null;this.lastSettledAt=Number.NEGATIVE_INFINITY;this.windowMs=e.windowMs??250,this.now=e.now??(()=>Date.now())}run(e,t=!1){if(!t){if(this.inFlight)return this.inFlight;if(this.now()-this.lastSettledAt<this.windowMs)return Promise.resolve()}let o=e().then(()=>{this.lastSettledAt=this.now()},()=>{}).finally(()=>{this.inFlight===o&&(this.inFlight=null)});return this.inFlight=o,o}markSettled(){this.lastSettledAt=this.now()}reset(){this.inFlight=null,this.lastSettledAt=Number.NEGATIVE_INFINITY}};var $h=10,qh=15e3,al=class{constructor(e){this.selectableSeatIds=null;this.lastSelectionValidity=null;this.renderer=null;this.gaSelected=null;this._doc=null;this.eventConfiguration=new gi;this.hidden=new Set;this.mapTheme=null;this.closedSections=new Set;this.labelToId=new Map;this.labelToSeat=new Map;this.expandedSeats=[];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.detachVisibility=null;this.hold_=null;this.liveStatuses=new Map;this.liveDefault="free";this.currency="USD";this.expiryTimer=null;this.snapshots=new bi;this.accessFilter=null;this.viewportInsets=null;this.hintShown=!1;this.opts=e,this.api=e.transport,this.key=e.eventKey,this.numberOfPlacesToSelect=ol(e.numberOfPlacesToSelect);let t=sl(this.numberOfPlacesToSelect,e.maxSelection,e.selectionValidators,$h);this.selectionValidators=t.validators,this.maxSelection=t.maxSelection,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=Uo(this._doc,this.hidden);if(!this.mapTheme)return e;let t={...e.theme??{}};for(let o of xo){let s=this.mapTheme[o];s&&(t[o]=s)}return{...e,theme:t}}setMapTheme(e){return el(this.mapTheme,e??null)?!1:(this.mapTheme=e??null,this.rebuildPreservingState(),!0)}rebuildPreservingState(){let e=this.renderer;if(!e)return!1;let t=e.getSelection().map(l=>l.id),o=this.getActiveFloorId(),s=e.isFloorOverview?.()??!1,r=e.getFocusedSection?.()??null,n=e.getCameraPose?.();return e.setChart(this.visibleDoc(),o?{floorId:o}:void 0),s&&e.setFloorOverview?.(!0),this.opts.colorblindSafe&&e.setColorblindSafe?.(!0),this.closedSections.size&&e.setClosedSections?.([...this.closedSections]),this.applySeatsMap(Object.fromEntries(this.liveStatuses),this.liveDefault),t.length&&e.select?.(t),r&&e.focusSection?.(r),n&&e.setCameraPose&&e.setCameraPose(n),!0}refreshMapCopy(){this.rebuildPreservingState()&&this.renderer?.forceDraw()}syncHidden(e){let t=e.filter(s=>typeof s=="string");if(t.length===this.hidden.size&&t.every(s=>this.hidden.has(s)))return!1;this.hidden=new Set(t);let o=this.renderer?.isFloorOverview?.()??!1;return this.renderer?.setChart(this.visibleDoc()),o&&this.renderer?.setFloorOverview?.(!0),!0}syncClosed(e){let t=(e??[]).filter(o=>typeof o=="string");return t.length===this.closedSections.size&&t.every(o=>this.closedSections.has(o))?!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)}getExpandedSeats(){return this.expandedSeats}loadEventConfiguration(){return this.eventConfiguration.load(this.api,this.key)}idForLabel(e){return this.labelToId.get(e)}idsForLabel(e){let t=this.groupedTablesByLabel.get(e);if(t)return t.chairs.map(s=>s.id);let o=this.labelToId.get(e);return o?[o]:[]}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 s=this.visibleDoc(),r=nt(s).find(n=>n.id===e.objectId);return{...r?.displayLabel?{displayLabel:r.displayLabel}:{},...r?.displayType?{displayType:r.displayType}:{}}}if(e.objectType==="table"){let s=this.groupedTablesByLabel.get(e.label);return{...s?.displayLabel&&s.displayLabel!==s.label?{displayLabel:s.displayLabel}:{},...s?.displayType?{displayType:s.displayType}:{}}}let t=this.labelToSeat.get(e.label),o=t?this.seatContext.get(t.id):void 0;return{...t?.displayLabel?{displayLabel:t.displayLabel}:{},...o?.displayType?{displayType:o.displayType}:{}}}async render(e){if(this.renderer)return null;let t=performance.now(),o={},s=T=>Math.round((performance.now()-T)*100)/100;this.closed=!1;let r=performance.now(),n=(async()=>this.api.chart(this.key))().then(T=>({ok:!0,res:T,elapsed:s(r)}),T=>({ok:!1,error:T,elapsed:s(r)})),l=performance.now(),a=(async()=>this.api.objects(this.key))().then(T=>({ok:!0,objects:T,elapsed:s(l)}),()=>({ok:!1,elapsed:s(l)})),c=await n;if(o.loadChart=c.elapsed,!c.ok)return this.emitError(c.error),null;let h=c.res;if(this.closed)return null;this._doc=il(h.doc,h.event.eventConfiguration),this.eventConfiguration.reset(h.event.eventConfiguration);let d=performance.now();try{let T=vs(h.doc,h.event.inventoryModelVersion===2?2:1);this.groupedTablesByObject=new Map(T.map(x=>[x.objectId,x])),this.groupedTablesByLabel=new Map(T.map(x=>[x.label,x])),this.groupedTableBySeatId=new Map(T.flatMap(x=>x.chairs.map(C=>[C.id,x]))),this.tableQuantities=new Map(T.map(x=>[x.label,x.mode==="whole"?x.capacity:x.minOccupancy])),this.confirmedVariableTables=new Set,this.groupedSelectionOverhead=T.reduce((x,C)=>x+Math.max(0,C.chairs.length-1),0)}catch(T){return this.emitError(T),null}this.expandedSeats=Xe(h.doc,{deriveRestrictedView:h.doc.derivedRestrictedView===!0});let u=Ka(h.doc,this.expandedSeats,this.groupedTablesByObject);this.labelToId=u.labelToId,this.labelToSeat=u.labelToSeat,this.seatById=u.seatById,this.seatContext=u.seatContext,this.allIds=u.allIds;for(let T of this.groupedTablesByLabel.values()){let x=T.chairs[0];x&&(this.labelToId.set(T.label,x.id),this.labelToSeat.set(T.label,x))}o.normalizeBuyerModel=s(d);let p=h.event.currency??this.opts.currency;this.currency=p??"USD";let y=performance.now(),m=Va(e,{maxSelection:this.rendererSelectionCap(),confirmSelection:this.opts.confirmSelection,portraitFitCrop:!1,gaPickerMode:!0,currency:p,...this.opts.loadingReveal?{loadingReveal:this.opts.loadingReveal}:{},onSeatsRevealed:()=>{o.seatsComplete=s(t),this.opts.onSeatsRevealed?.()},onSelect:T=>{this.handleRendererSelect(T)},onDeselect:T=>{this.handleRendererDeselect(T)},onSelectionLimit:this.opts.onSelectionLimit,onHover:(T,x)=>{this.opts.onHover?.(T),this.opts.onSeatHover&&this.opts.onSeatHover(T?this.describeSeat(T,x):null)},onFocusSeat:this.opts.onFocusSeat,onViewChange:this.opts.onViewChange,onGAClick:this.opts.onGAClick,onSectionTap:(T,x)=>this.handleSectionTap(T,x),onBackdropTap:()=>this.overview(),onFocusedSectionChange:T=>this.opts.onSectionFocus?.(this.isSectionClosed(T)?null:this.sectionSummary(T)),onDeckTap:T=>this.handleDeckTap(T),onFps:this.opts.onFps});if(o.createRenderer=s(y),this.closed)return m.destroy(),null;this.renderer=m,this.viewportInsets&&m.setViewportInsets?.(this.viewportInsets);let f=null,g="free",b=[],S=await a;if(S.ok){let T=S.objects;this.hidden=new Set(T.hidden??[]),b=(T.closed??[]).filter(x=>typeof x=="string"),f=T.seats,g=T.default??"free"}if(o.loadStatuses=S.elapsed,this.closed)return m.destroy(),this.renderer=null,null;let v=performance.now();m.setChart(this.visibleDoc()),tl(m,h.doc,e.clientWidth),this.opts.colorblindSafe&&m.setColorblindSafe?.(!0),o.buildScene=s(v),this.closedSections=new Set(b);let w=performance.now();b.length&&m.setClosedSections?.(b),f&&this.applySeatsMap(f,g),this.rebuildSelectableSeatIds(),this.opts.selectedObjects?.length?this.select(this.opts.selectedObjects):this.emitSelectionValidity(),this.pushGAState(),o.applyInitialState=s(w);let L=performance.now();m.forceDraw(),o.firstPaint=s(L);let k=performance.now();return S.ok&&this.snapshots.markSettled(),this.attachVisibility(),this.connect(),o.startRealtime=s(k),o.controllerTotal=s(t),{doc:h.doc,salesClosed:!!h.event.salesClosed,eventName:h.event.name,venue:h.event.venue,startsAt:h.event.startsAt,timezone:h.event.timezone??null,currency:p,mode:h.event.mode??"live",locale:h.event.locale??null,posterUrl:h.event.posterUrl??null,chartDelivery:h.chartDelivery,performanceProfile:o}}getSelection(){if(!this.renderer)return[];let e=[],t=new Set;for(let o of this.renderer.getSelection()){let s=this.groupedTableBySeatId.get(o.id);s?t.has(s.label)||(t.add(s.label),e.push(this.toTableSeat(s))):e.push(this.toSeat(o))}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 o of e){let s=this.groupedTableBySeatId.get(o)??this.groupedTablesByLabel.get(o);if(s)s.chairs.forEach(r=>t.add(r.id)),this.hold_?.labels.includes(s.label)||(this.tableQuantities.set(s.label,s.mode==="whole"?s.capacity:s.minOccupancy),s.mode==="variable"&&this.confirmedVariableTables.delete(s.label));else{let r=this.seatById.has(o)?o:this.labelToId.get(o);r&&t.add(r)}}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(n=>n.label)),o=new Set,s=[];for(let n of e){let l=this.groupedTableBySeatId.get(n)??this.groupedTablesByLabel.get(n);if(l)this.tableTierResolution(l).kind==="invalid"?s.push(l.label):l.chairs.forEach(c=>{this.isSelectableByPolicy(c.id)&&o.add(c.id)});else{let a=this.seatById.has(n)?n:this.labelToId.get(n);if(!a||!this.isSelectableByPolicy(a))continue;let c=this.seatById.get(a);c&&this.seatTierResolution(c).kind==="invalid"?s.push(c.label):o.add(a)}}if(s.length&&this.emitError(new Ie(Ei(s))),!o.size)return[];if(this.renderer?.select?.([...o]),this.selectionGuestCount()>this.maxSelection)return this.renderer?.deselect([...o]),this.opts.onSelectionLimit?.(this.maxSelection),[];let r=this.getSelection().filter(n=>!t.has(n.label));return r.length&&this.emitSelectionChange(),r}selectCategories(e){let t=new Set(e);return this.select([...this.seatById.values()].filter(o=>t.has(o.categoryKey)).map(o=>o.id))}deselectCategories(e){let t=new Set(e);this.deselect(this.getSelection().filter(o=>t.has(o.categoryKey)).map(o=>o.id))}setSelectableObjects(e){this.selectableObjectRefs=e==null?null:[...new Set(e.filter(o=>typeof o=="string"&&!!o))],this.rebuildSelectableSeatIds();let t=this.renderer?.getSelection().filter(o=>!this.isSelectableByPolicy(o.id)).map(o=>o.id)??[];t.length&&this.deselect(t)}getSelectionValidity(e){if(this.numberOfPlacesToSelect==null&&!this.selectionValidators.length)return null;let t=this.getSelection(),o=e??t.reduce((s,r)=>s+(r.quantity??1),0);return rl(t,o,this.numberOfPlacesToSelect,this.selectionValidators,()=>this.hasOrphanedSelection())}hasOrphanedSelection(){let e=this.renderer;if(!e)return!1;let t=new Set(e.getSelection().map(o=>o.id));return t.size>0&&Ai(this.seatById.values(),o=>e.getStatus(o),t).length>0}rebuildSelectableSeatIds(){if(this.selectableObjectRefs==null){this.selectableSeatIds=null;return}let e=new Set;for(let t of this.selectableObjectRefs){let o=this.groupedTableBySeatId.get(t)??this.groupedTablesByLabel.get(t);if(o){o.chairs.forEach(r=>e.add(r.id));continue}let s=this.seatById.has(t)?t:this.labelToId.get(t);s&&e.add(s)}this.selectableSeatIds=e}isSelectableByPolicy(e){return this.selectableSeatIds==null||this.selectableSeatIds.has(e)}setTableQuantity(e,t){let o=this.groupedTablesByLabel.get(e);if(!o)return!1;let s=o.mode==="whole"?o.capacity:Math.floor(t);if(!Number.isInteger(s)||s<o.minOccupancy||s>o.maxOccupancy)return!1;let r=this.tableQuantities.get(e)??o.minOccupancy;return this.tableQuantities.set(e,s),this.selectionGuestCount()>this.maxSelection?(this.tableQuantities.set(e,r),this.opts.onSelectionLimit?.(this.maxSelection),!1):(o.mode==="variable"&&this.confirmedVariableTables.add(e),this.emitSelectionChange(),!0)}async replaceTableQuantity(e,t,o){let s=this.groupedTablesByLabel.get(e),r=this.hold_;if(!s||s.mode!=="variable"||!r?.labels.includes(e))return null;let n=Math.floor(t);if(!Number.isInteger(n)||n<s.minOccupancy||n>s.maxOccupancy)return null;if((r.items??[]).filter(h=>h.label!==e).reduce((h,d)=>h+(d.quantity??1),0)+n>this.maxSelection)return this.opts.onSelectionLimit?.(this.maxSelection),null;let a=(r.items??[]).map(h=>({label:h.label,tierId:h.tierId,quantity:h.label===e?n:h.quantity}));if(!a.some(h=>h.label===e))return null;let c=await this.api.hold(this.key,a,o,r.holdId);return this.tableQuantities.set(e,n),this.setHold({holdId:c.holdId,labels:a.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(s=>s.id):[e.id]),this.emitSelectionChange();return}if((t?this.tableTierResolution(t):this.seatTierResolution(e)).kind==="invalid"){this.renderer?.deselect(t?t.chairs.map(s=>s.id):[e.id]),this.emitError(new Ie(Ei([t?.label??e.label]))),this.emitSelectionChange();return}if(t){if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect(t.chairs.map(s=>s.id)),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.renderer?.select?.(t.chairs.map(s=>s.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),o=t?.label??e.label;if(this.hold_?.labels.includes(o)){this.opts.onDeselect?.(t?{...e,label:o}:e);return}t?(this.renderer?.deselect(t.chairs.map(s=>s.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 o=this.groupedTablesByLabel.get(t);o&&(this.tableQuantities.set(t,o.mode==="whole"?o.capacity:o.minOccupancy),o.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 s=e??this.getSelection().map(a=>a.label),r=(this.hold_?.items??[]).filter(a=>a.objectType==="ga"),n=[...new Set([...r.map(a=>a.label),...s])];if(!n.length)return null;let l=this.ticketIssue(n);if(l)throw new Ie(l);if(this.hold_&&this.holdCovers(n))return this.hold_;try{let a=n.map(h=>{let d=r.find(y=>y.label===h);if(d)return{label:h,tierId:d.tierId,quantity:d.quantity};let u=this.labelToSeat.get(h),p=u?this.toSeat(u):null;return{label:h,...p?.tierId?{tierId:p.tierId}:{},...this.tableQuantityRequest(p)}}),c=await this.api.hold(this.key,a,t,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:n,expiresAt:c.expiresAt,items:c.items}),this.hold_}catch(a){throw this.handle409Conflicts(a),a}}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 o=[...new Set(t.items.map(s=>s.label))];return o.length?(this.setHold({holdId:t.holdId,labels:o,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 o=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:o.expiresAt,items:t.items}),this.hold_)}catch{return null}}categoryAvailability(){return Ua({seatById:this.seatById,groupedTableBySeatId:this.groupedTableBySeatId,groupedTablesByLabel:this.groupedTablesByLabel,closedMembers:this.closedMemberIds(),statusOf:e=>this.getStatus(e),gaAreas:this.getGAAreas()})}closedMemberIds(){let e=new Set,t=this.renderer;if(!t||!this.closedSections.size)return e;for(let o of this.closedSections)for(let s of t.sectionMembers?.(o)??[])e.add(s);return e}getGAAreas(){let e=this.visibleDoc();return e?Xa(e,this.currency,t=>this.statusOf(t)):[]}setGASelection(e){this.gaSelected=e?new Map(e):null,this.pushGAState()}pushGAState(){this.renderer?.setGAStates?.(Ya(this.getGAAreas(),this.gaSelected))}async holdGA(e,t,o={}){let s=this.visibleDoc();if(!s||!Number.isFinite(t)||t<1)return null;let r=nt(s).find(h=>h.id===e);if(!r)return null;let n=Et(r).filter(h=>!this.hold_?.labels.includes(h)&&this.statusOf(h)==="free").slice(0,Math.floor(t));if(n.length!==Math.floor(t))return null;let l=new Map;for(let h of this.hold_?.items??[])l.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)l.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{}});for(let h of this.getSelection())l.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{},...this.tableQuantityRequest(h)});for(let h of n)l.set(h,{label:h,...o.tierId?{tierId:o.tierId}:{}});let a=[...l.values()],c=await this.api.hold(this.key,a,o.ttlMs,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:a.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(){return Qa(this.visibleDoc())}pickPremiumBlock(e,t,o){return Ja({doc:this.visibleDoc(),qty:e,categoryKey:t,zoneId:o,groupedObjectIds:new Set(this.groupedTablesByObject.keys()),heldLabels:new Set(this.hold_?.labels??[]),accessFilter:this.accessFilter,tierApplies:s=>this.seatTierResolution(s).kind!=="invalid",statusOfLabel:s=>this.getStatus(this.labelToId.get(s)??"")??"free",isPremium:s=>!!this.labelToSeat.get(s)?.commercial?.premium})}async bestAvailable(e,t,o={}){let s=this.renderer;if(!s)return null;if(o.preferPremium){let r=this.pickPremiumBlock(e,t,o.zoneId);if(r){if(this.hold_&&!await this.release())return null;try{let n=r.map(h=>{let d=this.labelToSeat.get(h),u=d?this.toSeat(d):null;return{label:h,...u?.tierId?{tierId:u.tierId}:{}}}),l=await this.api.hold(this.key,n,o.ttlMs);s.clearSelection();let a=this.idsForLabels(r);a.length&&s.setStatus(a,"held"),this.setHold({holdId:l.holdId,labels:[...r],expiresAt:l.expiresAt,items:l.items});let c=r.map(h=>this.labelToSeat.get(h)).filter(h=>!!h).map(h=>this.toSeat(h));return this.opts.onSelectionChange?.(c),this.hold_}catch(n){let{status:l,reason:a}=xt(n);if(l===409&&a==="event_closed")throw this.opts.onSalesClosed?.(),n}}}if(this.hold_&&!await this.release())return null;try{let r=await this.api.bestAvailable(this.key,e,t,o.zoneId,o.ttlMs);s.clearSelection();let n=this.idsForLabels(r.labels);n.length&&s.setStatus(n,"held"),this.setHold({holdId:r.holdId,labels:[...r.labels],expiresAt:r.expiresAt,items:r.items});let l=r.labels.map(a=>this.labelToSeat.get(a)).filter(a=>!!a).map(a=>this.toSeat(a));return this.opts.onSelectionChange?.(l),this.hold_}catch(r){let{status:n,reason:l}=xt(r);throw n===409&&l==="event_closed"&&this.opts.onSalesClosed?.(),r}}async book(e,t,o){let s=this.renderer;if(!s)return null;if(!this.api.book)throw new Error("picker: transport has no book() \u2014 hold-only mode");let r=t??this.getSelection().map(c=>c.label);if(!r.length)return null;let n=this.ticketIssue(r);if(n)throw new Ie(n);let l;try{if(this.hold_&&this.holdCovers(r))l=this.hold_.holdId;else{let c=this.hold_?.holdId,h=await this.api.hold(this.key,r.map(d=>{let u=this.labelToSeat.get(d),p=u?this.toSeat(u):null;return{label:d,...p?.tierId?{tierId:p.tierId}:{},...this.tableQuantityRequest(p)}}),o,c);l=h.holdId,this.setHold({holdId:l,labels:[...r],expiresAt:h.expiresAt,items:h.items})}await this.api.book(this.key,r,l,e)}catch(c){let{status:h,conflicts:d,reason:u}=xt(c);if(this.clearHold(),h===409&&u==="event_closed")this.opts.onSalesClosed?.();else if(h===409&&d?.length){let p=new Set(d.map(f=>f.label)),y=this.idsForLabels(p);y.length&&(s.setStatus(y,"booked"),s.deselect(y),this.resetTableQuantitiesForLabels(p));let m=r.filter(f=>!p.has(f));m.length&&l&&this.api.release(this.key,m,l).catch(()=>{}),this.emitSelectionChange()}else l&&this.api.release(this.key,r,l).catch(()=>{});throw c}let a=this.idsForLabels(r);return a.length&&(s.setStatus(a,"booked"),s.deselect(a)),this.clearHold(),this.resetTableQuantitiesForLabels(r),this.emitSelectionChange(),this.opts.onBook?.(e),r}async release(){let e=this.hold_;if(!e)return!0;try{let o=await this.api.release(this.key,e.labels,e.holdId);if(!this.releaseConfirmed(o,e.labels))return await this.resnapshot(),!1}catch(o){return this.emitError(o),!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 o=e.filter(l=>t.labels.includes(l));if(!o.length)return!0;try{let l=await this.api.release(this.key,o,t.holdId);if(!this.releaseConfirmed(l,o))return await this.resnapshot(),!1}catch(l){return this.emitError(l),!1}if(this.hold_?.holdId!==t.holdId)return!0;let s=t.labels.filter(l=>!o.includes(l)),r=t.items?.filter(l=>!o.includes(l.label));s.length?this.setHold({...t,labels:s,items:r}):this.clearHold(),this.resetTableQuantitiesForLabels(o);let n=this.idsForLabels(o);return n.length&&(this.renderer?.deselect(n),this.renderer?.setStatus(n,"free")),!0}releaseConfirmed(e,t){let o=e?.released;return!Array.isArray(o)||t.every(s=>o.includes(s))}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(s=>s.notForSale).map(s=>s.key));if(!t.size)return[];let o=[];for(let[s,r]of this.seatById)t.has(r.categoryKey)&&o.push(s);return o}flashSeat(e,t){this.renderer?.flashSeat(e,t)}zoomIn(){this.renderer?.zoomIn()}zoomOut(){let e=this.renderer;if(!e?.zoomOutLevel)return void e?.zoomOut();let t=!!e.getFocusedSection?.();e.zoomOutLevel()==="venue"&&t&&this.overview()}zoomToFit(){this.renderer?.zoomToFit()}refitCurrentView(){this.renderer?.refitCurrentView?this.renderer.refitCurrentView():this.renderer?.zoomToFit()}setViewportInsets(e){this.viewportInsets=e?{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}:null,this.renderer?.setViewportInsets?.(this.viewportInsets)}getViewportInsets(){return this.renderer?.getViewportInsets?.()??this.viewportInsets??{top:0,right:0,bottom:0,left:0}}worldToScreen(e){return this.renderer?.worldToScreen(e)??{x:0,y:0}}setSelectionFocus(e){this.renderer?.setSelectionFocus?.(e)}setAccessibilityFilter(e){this.accessFilter=e===null?null:[...e],this.renderer?.setAccessibilityFilter?.(e);let t=this.renderer?.getFocusedSection?.()??null;t&&this.opts.onSectionFocus?.(this.sectionSummary(t))}getAccessibilityFilter(){return this.accessFilter?[...this.accessFilter]:null}focusAccessibilityFilter(e){let t=this.renderer;if(!t?.focusAccessibleSeats)return!1;let o=e===void 0?this.accessFilter:e;if(!o)return!1;let s=this.floorForAccessibility(o);s&&this.setFloor(s);let r=t.focusAccessibleSeats(o);return r&&this.opts.onSectionFocus?.(null),r}floorForAccessibility(e){let t=this._doc;if(!t?.floors||t.floors.length<2)return null;let o=new Set(e),s=a=>o.size===0?!!a.accessible:!!a.accessibility?.some(c=>o.has(c)),r=a=>a.some(c=>c.type==="row"&&(c.overrides??[]).some(s)),n=this.getActiveFloorId(),l=t.floors.find(a=>a.id===n);return l&&r(l.objects)?null:t.floors.find(a=>r(a.objects))?.id??null}accessibilityFilterDims(e){return this.accessFilter?et(e,this.accessFilter)==="other":!1}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"}getFocusedSection(){return this.renderer?.getFocusedSection?.()??null}seatsRevealed(){let e=this.renderer;return e?.seatsRevealed?e.seatsRevealed():this.getRung()==="seats"||!!this.getFocusedSection()}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 o=this.floorForCategories(e);o&&this.setFloor(o)}!e?.length&&this.accessFilter&&this.focusAccessibilityFilter()||(t.focusCategories?t.focusCategories(e):t.zoomToFit())}}floorForCategories(e){let t=this._doc;if(!t?.floors||t.floors.length<2)return null;let o=new Set(e),s=l=>l.some(a=>a.type==="row"&&(o.has(a.categoryKey)||(a.overrides??[]).some(c=>c.categoryKey!=null&&o.has(c.categoryKey)))||a.type==="gaArea"&&o.has(a.categoryKey)),r=this.getActiveFloorId(),n=t.floors.find(l=>l.id===r);return n&&s(n.objects)?null:t.floors.find(l=>s(l.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,t){this.handleSectionTap(e,t)}getSectionSeatCount(e){return this.renderer?.sectionMembers?.(e)?.length??0}overview(){this.renderer?.clearSectionFocus?.(),this.renderer?.zoomToFit(),this.opts.onSectionFocus?.(null)}handleSectionTap(e,t){let o=this.renderer;if(o){if(o.focusSection?o.focusSection(e,t?{anchor:t}:void 0):o.focusRegion?.(e),this.isSectionClosed(e)){this.opts.onSectionFocus?.(null);return}this.opts.onSectionFocus?.(this.sectionSummary(e))}}sectionSummary(e){return!this.renderer||!this._doc?null:nl({id:e,doc:this._doc,sectionMembers:t=>this.renderer?.sectionMembers?.(t)??[],statusOf:t=>this.renderer?.getStatus(t)??"free",seatById:this.seatById,groupedTableBySeatId:this.groupedTableBySeatId,...this.accessFilter?{matchesAccessFilter:t=>we(t,this.accessFilter)}:{}})}destroy(){if(this.closed=!0,this.detachVisibility?.(),this.detachVisibility=null,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 o=e.commercial?{commercial:e.commercial}:void 0,s=e.displayLabel?{displayLabel:e.displayLabel}:void 0,r=e.accessibility?.length?{accessibility:e.accessibility}:void 0,n=e.wheelchairSpaceType?{wheelchairSpaceType:e.wheelchairSpaceType}:void 0,l=this.seatContext.get(e.id),a=this.tiersForSeat(e),c=this.seatTierResolution(e);if(c.kind!=="resolved"||!a)return{id:e.id,label:e.label,...s,...l,categoryKey:e.categoryKey,price:this.priceFor(e.categoryKey),currency:this.currency,...o,...r,...n};let h=c.tier;return{id:e.id,label:e.label,...s,...l,categoryKey:e.categoryKey,price:h.price,currency:this.currency,tiers:a,tierId:h.id,...o,...r,...n}}toTableSeat(e){let t=e.chairs[0],o=this.tiersFor(e.categoryKey)?.filter(n=>Vt(this._doc,this.tableTierSeat(e),n.id).kind==="resolved"),s=this.tableTierResolution(e),r=s.kind==="resolved"?s.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:r?.price??this.priceFor(e.categoryKey),currency:this.currency,...o?{tiers:o,tierId:r?.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(n=>n.id)}}describeSeat(e,t){let o=this._doc?.categories.find(s=>s.key===e.categoryKey);return{...this.toSeat(e),categoryLabel:o?.label??e.categoryKey,categoryColor:o?.color??"#6e7bff",status:this.renderer?.getStatus(e.id)??"free",mark:this.renderer?.getSeatMark?.(e.id)??null,...t?.interaction?{interaction:t.interaction}:{},...t?.unavailable?{unavailable:!0}:{},...t?.filteredOut?{filteredOut:!0}:{},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(o=>o.key===e)?.tiers;return t&&t.length?t:void 0}tiersForSeat(e){if(!this._doc)return;let t=gs(this._doc,e);return t.length?t:void 0}seatTierResolution(e){return this._doc?Vt(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 Vt(this._doc,this.tableTierSeat(e),this.seatTiers.get(t))}setSeatTier(e,t){let o=this.seatById.get(e);if(!o)return;let s=this.tiersForSeat(o);if(s){if(t==null)this.seatTiers.delete(e);else if(s.some(r=>r.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 o of e){let s=this.labelToSeat.get(o);s&&t.push(this.toSeat(s))}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 bs(this._doc,t.map(o=>({label:o.label,...o.tierId?{tierId:o.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"?G("picker.companionPairRequired"):"That ticket choice is not available for the selected seat.");return}let o=new Set(e.getSelection().map(r=>r.id));(o.size?Ai(this.seatById.values(),r=>e.getStatus(r),o):[]).length>0?(this.hintShown=!0,this.opts.onHint(G("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(r=>t.labels.includes(r)))return!1;let o=new Map((t.items??[]).map(r=>[r.label,r.tierId])),s=new Map((t.items??[]).map(r=>[r.label,r.quantity??1]));return e.every(r=>{let n=this.labelToSeat.get(r),l=n?this.toSeat(n):null,a=l?.tierId??null;return(l?.objectType!=="table"||(l.bookingMode!=="variable"||this.confirmedVariableTables.has(r))&&(!s.has(r)||s.get(r)===l.quantity))&&(!o.has(r)||o.get(r)===a)})}handle409Conflicts(e){let{status:t,conflicts:o}=xt(e);if(t!==409||!o?.length)return;let s=this.renderer;if(!s)return;let r=this.idsForLabels(o.map(n=>n.label));r.length&&(s.deselect(r),s.setStatus(r,"held"),this.resetTableQuantitiesForLabels(o.map(n=>n.label))),this.emitSelectionChange()}setHold(e,t="created"){for(let r of e.items??[])this.groupedTablesByLabel.has(r.label)&&r.quantity!=null&&(this.tableQuantities.set(r.label,r.quantity),this.groupedTablesByLabel.get(r.label)?.mode==="variable"&&this.confirmedVariableTables.add(r.label));let o={...e,seats:this.seatsForLabels(e.labels)};this.hold_=o,this.renderer?.setOwnedHold?.(this.idsForLabels(o.labels)),this.expiryTimer&&clearTimeout(this.expiryTimer);let s=Math.max(0,o.expiresAt-Date.now());this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},s),t==="restored"?this.opts.onHoldRestored?.(o):this.opts.onHold?.(o)}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(Za(e.expiresAt,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 o=this.renderer;if(!o)return;this.liveStatuses=new Map(Object.entries(e)),this.liveDefault=t;let s=yi(t);this.allIds.length&&o.setStatus(this.allIds,s),o.setOwnedHold?.(this.idsForLabels(this.hold_?.labels??[]));let r={free:[],held:[],booked:[],not_for_sale:[]};for(let[l,a]of Object.entries(e))r[yi(a)].push(...this.idsForLabel(l));["free","held","booked","not_for_sale"].forEach(l=>{l!==s&&r[l].length&&o.setStatus(r[l],l)});let n=this.notForSaleCategorySeatIds();n.length&&o.setStatus(n,"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))}resnapshot(e=!1){return this.snapshots.run(async()=>{let t=await this.api.objects(this.key);this.applySeatsMap(t.seats,t.default??"free")},e)}refresh(){return this.resnapshot(!0)}async refreshAvailability(){await this.resnapshot();let e=this.hold_,t=qa({selection:this.getSelection().map(o=>o.label),holdLabels:e?.labels??[],holdActive:!!e,holdExpiresAt:e?.expiresAt??null,statusOf:o=>this.statusOf(o)});if(t.lost.length&&this.deselect(t.lost),t.holdLapsed){this.clearHold(),this.resetTableQuantitiesForLabels(t.lapsedLabels);let o=this.idsForLabels(t.lapsedLabels);o.length&&this.renderer?.deselect(o),this.opts.onHoldExpired?.()}return this.opts.onAvailabilityRefresh?.(t),t}getAccessNeeds(){return $a(this.seatById.values(),e=>this.getStatus(e)??"free")}attachVisibility(){this.detachVisibility||(this.detachVisibility=ja(()=>{this.closed||this.refreshAvailability().then(()=>{this.closed||this.renderer?.forceDraw()})}))}realtimeSink(){return{applyStatuses:e=>this.applyStatusChanges(e),applyProjection:e=>this.applySeatsMap(e.exceptions,e.default),resync:()=>this.resnapshot(),onSections:(e,t)=>{let o=this.syncHidden(e),s=this.syncClosed(t);o&&this.resnapshot(),(o||s)&&this.opts.onStatusChange?.()}}}applyStatusChanges(e){let t=this.renderer;if(t){for(let o of e){this.liveStatuses.set(o.label,o.status);let s=this.idsForLabel(o.label);if(!s.length)continue;let r=yi(o.status);this.opts.flashOnLiveChange&&r!=="free"&&s.some(n=>t.getStatus(n)==="free")&&!this.hold_?.labels.includes(o.label)&&s.forEach(n=>t.flashSeat(n,r==="held"?"#f4b740":"#f43f5e")),t.setStatus(s,r)}this.opts.keepLiveWhileHidden&&typeof document<"u"&&document.visibilityState==="hidden"&&t.forceDraw(),this.pushGAState(),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 o=null;try{o=this.api.createRealtime(this.key,this.realtimeSink())}catch{o=null}if(o){this.realtime=o,o.start();return}}if(this.realtime)return;let t;try{let o=this.api.socketProtocols?.(this.key);t=o&&o.length?new WebSocket(e,o):new WebSocket(e)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.attempt=0,this.resnapshot()},t.onmessage=o=>{let s;try{s=JSON.parse(typeof o.data=="string"?o.data:"")}catch{return}if(!this.renderer||!s||typeof s!="object")return;let n=s;Array.isArray(n.hidden)&&this.syncHidden(n.hidden)&&(this.resnapshot(),this.opts.onStatusChange?.()),Array.isArray(n.closed)&&this.syncClosed(n.closed)&&this.opts.onStatusChange?.(),n.type!=="hidden"&&(n.seats&&typeof n.seats=="object"?this.applySeatsMap(n.seats):Array.isArray(n.changes)&&this.applyStatusChanges(n.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=za(e,{baseMs:1e3,maxMs:qh,jitter:1});this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}};var Zh=5,jh=-1.1,Co=35;function Io(i,e){let t=i-J,o=Math.atan2(Zh-t,e)*180/Math.PI,s=Math.atan2(jh-t,e)*180/Math.PI;return s<-Co&&(o+=-Co-s,s=-Co),{topPitch:o,basePitch:s}}var q=2048,ue=1024,It=Do,E=Math.PI*2,Qh=ue/180,st=i=>(i+180)/360*q,z=i=>(90-i)/180*ue;function ul(i){let e=2166136261;for(let t=0;t<i.length;t++)e^=i.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function pl(i){let e=i>>>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 Si=96,Ro=360/Si,Jh=.6,Po=[17,23,42];function Mo(i,e,t=1){let o=Math.max(0,Math.min(.58,e)),s=Math.round(i[0]+(Po[0]-i[0])*o),r=Math.round(i[1]+(Po[1]-i[1])*o),n=Math.round(i[2]+(Po[2]-i[2])*o);return`rgba(${s},${r},${n},${t})`}function ll(i,e,t){return[Math.round(i[0]+(e[0]-i[0])*t),Math.round(i[1]+(e[1]-i[1])*t),Math.round(i[2]+(e[2]-i[2])*t)]}function te(i,e,t){let o=(1-Math.abs(2*t-1))*e,s=(i%360+360)%360/60,r=o*(1-Math.abs(s%2-1)),n=0,l=0,a=0;s<1?[n,l,a]=[o,r,0]:s<2?[n,l,a]=[r,o,0]:s<3?[n,l,a]=[0,o,r]:s<4?[n,l,a]=[0,r,o]:s<5?[n,l,a]=[r,0,o]:[n,l,a]=[o,0,r];let c=t-o/2;return[Math.round((n+c)*255),Math.round((l+c)*255),Math.round((a+c)*255)]}var cl=new Map;function hl(i){if(!i)return null;let e=cl.get(i);if(e)return e;let t=2166136261;for(let r=0;r<i.length;r++)t^=i.charCodeAt(r),t=Math.imul(t,16777619);let o=(t>>>0)%360,s=te(o,.3,.42);return cl.set(i,s),s}function ed(i,e,t,o){let s=new Array(Si).fill(null),r=0,n=i.sectionId;for(let l of e){if(l.id===i.id)continue;let a=l.sectionId;if(!a||n&&a===n)continue;let c=l.x-i.x,h=l.y-i.y,d=Math.hypot(c,h)*It;if(d<1.5||d>95)continue;let u=l.eyeHeightM??J,p=u-o;Math.abs(p)>r&&(r=Math.abs(p));let y=Math.atan2(p,d)*180/Math.PI,m=Math.atan2(u-J-o,d)*180/Math.PI,g=((Math.atan2(c,-h)-t)*180/Math.PI+540)%360-180,b=Math.min(Si-1,Math.max(0,Math.floor((g+180)/Ro))),S=y>34&&d<16,v=s[b];v?(y>v.top&&(v.top=y),m<v.base&&(v.base=m),d<v.nearM&&(v.nearM=d,v.tint=hl(l.categoryKey)),v.overhead=v.overhead||S):s[b]={top:y,base:m,nearM:d,overhead:S,tint:hl(l.categoryKey)}}return{bins:s,maxDelta:r}}function td(i,e,t,o){for(let s=0;s<Si;s++){let r=e[s];if(!r)continue;let n=-180+s*Ro,l=t(n),a=t(n+Ro);if(!(a>l))continue;let c=Math.min(72,r.top),h=Math.min(r.base,-4),d=o(c),u=o(h);if(u<=d)continue;let p=r.nearM/95,y=r.tint,m=y?ll([44,54,80],y,.34):[44,54,80],f=y?ll([24,30,48],y,.28):[24,30,48],g=i.createLinearGradient(0,d,0,u);g.addColorStop(0,Mo(m,p)),g.addColorStop(.24,Mo(f,p)),g.addColorStop(1,Mo([10,13,22],p)),i.fillStyle=g,i.fillRect(l,d,a-l+1,u-d),i.fillStyle=`rgba(150,165,205,${.35*(1-p*.55)})`,i.fillRect(l,d,a-l+1,1.5);let S=Math.min(u,o(0))-d;if(S>8){let w=1-p*.4;for(let L=1;L<6;L++){let k=d+S*L/6;i.fillStyle=`rgba(0,0,0,${.16*w})`,i.fillRect(l,k,a-l+1,1.5),i.fillStyle=`rgba(120,134,170,${.1*w})`,i.fillRect(l,k+1.5,a-l+1,1.2)}}if(r.overhead){let v=o(Math.min(86,c+12)),w=i.createLinearGradient(0,v,0,d);w.addColorStop(0,"rgba(3,4,8,0.9)"),w.addColorStop(1,"rgba(3,4,8,0)"),i.fillStyle=w,i.fillRect(l,v,a-l+1,d-v),i.fillStyle="rgba(120,130,160,0.14)",i.fillRect(l,d-1.5,a-l+1,1.5)}}}function id(i,e,t){let s=new Array(72).fill(!1),r=new Array(72).fill(1/0),n=new Set,l=0;for(let g of t){l++,g.sectionId&&n.add(g.sectionId);let b=g.x-e.x,S=g.y-e.y,v=Math.hypot(b,S)*It;if(v<.5)continue;let w=Math.atan2(b,-S),L=Math.floor((w+Math.PI)/E*72);L<0?L=0:L>=72&&(L=71),s[L]=!0,v<r[L]&&(r[L]=v)}let a=0,c=[];for(let g=0;g<72;g++)s[g]&&(a++,c.push(r[g]));let h=a/72*360;c.sort((g,b)=>g-b);let d=c.length?c[c.length>>1]:0,u=c.length?c[Math.floor(c.length*.15)]??d:0,p=c.length?c[Math.floor(c.length*.85)]??d:0,y=u>.5?p/u:1,m=ul(`${l}|${[...n].sort().join(",")}|${Math.round(e.x)},${Math.round(e.y)}`),f;return h>=300&&d>11&&y>1.35?f="sport":h>=285?f="arena":f="proscenium",{mode:f,seed:m,voidRadiusM:d,aspect:y}}var od=5;function sd(i,e,t){switch(t){case 1:i.beginPath(),i.ellipse(0,-e*.14,e*1.16,e*1.16,0,0,E),i.fill();break;case 2:i.beginPath(),i.ellipse(0,-e*1.02,e*.42,e*.42,0,0,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.2,e*.98,e*1.02,0,0,E),i.fill();break;case 3:i.beginPath(),i.ellipse(0,-e*.36,e*1.04,e*.6,0,Math.PI,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.52,e*1.22,e*.24,0,0,E),i.fill();break;case 4:i.beginPath(),i.ellipse(-e*.66,e*.5,e*.5,e*1.35,0,0,E),i.fill(),i.beginPath(),i.ellipse(e*.66,e*.5,e*.5,e*1.35,0,0,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.08,e*1.06,e*1.08,0,0,E),i.fill();break;default:break}}function rd(i,e,t,o,s){let r=o*.44,n=o*s.shoulderK,l=o*.66,a=o*1.68,c=o*5.4,h=`rgba(${s.clothing[0]},${s.clothing[1]},${s.clothing[2]},${s.alpha})`,d=`rgba(${s.tone[0]},${s.tone[1]},${s.tone[2]},${s.alpha})`;i.save(),i.translate(e,t);let u=s.lean*o;i.fillStyle=h,i.beginPath(),i.moveTo(-r,l),i.quadraticCurveTo(-r*1.18,a-u-o*.6,-n,a-u),i.quadraticCurveTo(-n*1.05,a+o*1.2,-n*.94,c),i.lineTo(n*.94,c),i.quadraticCurveTo(n*1.05,a+o*1.2,n,a+u),i.quadraticCurveTo(r*1.18,a+u-o*.6,r,l),i.closePath(),i.fill(),i.fillStyle=d,i.fillRect(-r*.82,o*.5,r*1.64,o*.9),i.save(),i.rotate(s.tilt),i.translate(s.turn*o,0),i.fillStyle=d,o>=18?(i.beginPath(),i.moveTo(-o*.9,-o*.15),i.quadraticCurveTo(-o*.96,-o*1.12,0,-o*1.06),i.quadraticCurveTo(o*.96,-o*1.12,o*.9,-o*.15),i.quadraticCurveTo(o*.86,o*.55,o*.36,o*.98),i.quadraticCurveTo(0,o*1.14,-o*.36,o*.98),i.quadraticCurveTo(-o*.86,o*.55,-o*.9,-o*.15),i.closePath(),i.fill(),o>=22&&(i.beginPath(),i.ellipse(-o*.9,o*.18,o*.13,o*.22,0,0,E),i.ellipse(o*.9,o*.18,o*.13,o*.22,0,0,E),i.fill())):(i.beginPath(),i.ellipse(0,0,o*.9,o*1.06,0,0,E),i.fill()),sd(i,o,s.hair),s.rim>.01&&(i.strokeStyle=`rgba(245,205,150,${(.5*s.rim).toFixed(3)})`,i.lineWidth=Math.max(1,o*.14),i.beginPath(),i.ellipse(0,-o*.06,o*.86,o*1,0,Math.PI*1.12,Math.PI*1.9),i.stroke()),i.restore(),s.rim>.01&&(i.strokeStyle=`rgba(240,200,150,${(.28*s.rim).toFixed(3)})`,i.lineWidth=Math.max(1,o*.12),i.beginPath(),i.moveTo(-n*.8,a-o*.05),i.quadraticCurveTo(-r,a-o*.75,0,a-o*.82),i.quadraticCurveTo(r,a-o*.75,n*.8,a-o*.05),i.stroke()),i.restore()}function nd(i,e,t,o,s,r,n){i.fillStyle=`rgba(${s[0]},${s[1]},${s[2]},${n})`,i.beginPath(),i.moveTo(e-o*1.72,t+o*4),i.quadraticCurveTo(e-o*1.78,t+o*1.55,e-o*.46,t+o*1.02),i.lineTo(e-o*.4,t+o*.62),i.lineTo(e+o*.4,t+o*.62),i.lineTo(e+o*.46,t+o*1.02),i.quadraticCurveTo(e+o*1.78,t+o*1.55,e+o*1.72,t+o*4),i.closePath(),i.fill(),i.fillStyle=`rgba(${r[0]},${r[1]},${r[2]},${n})`,i.beginPath(),i.ellipse(e,t,o*.9,o*1.05,0,0,E),i.fill()}function Eo(i,e,t,o,s){let r=o*.1,n=t-o*.9,l=t-o*.74,a=t-o*.46,c=o*.13,h=o*.09,d=`rgba(${s.tone[0]},${s.tone[1]},${s.tone[2]},${s.alpha})`,u=i.createRadialGradient(e,t,1,e,t,o*.24);u.addColorStop(0,"rgba(0,0,0,0.4)"),u.addColorStop(1,"rgba(0,0,0,0)"),i.save(),i.scale(1,.28),i.fillStyle=u,i.beginPath(),i.ellipse(e,t/.28,o*.24,o*.24,0,0,E),i.fill(),i.restore(),i.fillStyle=d,i.beginPath(),i.moveTo(e-h,a),i.lineTo(e-h*.7,t),i.lineTo(e-h*.1,t),i.lineTo(e-h*.1,a+o*.02),i.lineTo(e+h*.1,a+o*.02),i.lineTo(e+h*.1,t),i.lineTo(e+h*.7,t),i.lineTo(e+h,a),i.closePath(),i.fill(),i.beginPath(),i.moveTo(e-c,l),i.quadraticCurveTo(e-c*.9,a-o*.12,e-h,a),i.lineTo(e+h,a),i.quadraticCurveTo(e+c*.9,a-o*.12,e+c,l),i.quadraticCurveTo(e,l-o*.05,e-c,l),i.closePath(),i.fill(),i.lineCap="round",i.lineJoin="round",i.strokeStyle=d,i.lineWidth=o*.055;let p=l+o*.02;s.pose===1?(i.beginPath(),i.moveTo(e-c*.8,p),i.lineTo(e-c*1.5,t-o*1.02),i.moveTo(e+c*.8,p),i.lineTo(e+c*1.5,t-o*1.02),i.stroke()):s.pose===2?(i.beginPath(),i.moveTo(e-c*.8,p),i.lineTo(e+h*1.4,a-o*.02),i.moveTo(e+c*.8,p),i.lineTo(e-h*.4,a-o*.06),i.stroke(),i.fillStyle=d,i.beginPath(),i.ellipse(e+h*1.5,a-o*.04,o*.07,o*.09,-.5,0,E),i.fill()):s.pose===3?(i.beginPath(),i.moveTo(e-c*.8,p),i.lineTo(e-c*.2,n+r*.6),i.moveTo(e+c*.8,p),i.lineTo(e+c*1.1,a),i.stroke(),i.lineWidth=o*.02,i.beginPath(),i.moveTo(e-c*.2,n+r*.9),i.lineTo(e-c*.2,t-o*.02),i.stroke()):(i.beginPath(),i.moveTo(e-c*.85,p),i.lineTo(e-c*.95,a+o*.02),i.moveTo(e+c*.85,p),i.lineTo(e+c*.95,a+o*.02),i.stroke()),i.fillStyle=d,i.fillRect(e-r*.34,n+r*.6,r*.68,r*.9),i.beginPath(),i.ellipse(e,n,r*.86,r*1.05,0,0,E),i.fill(),s.rimStrength>.01&&(i.strokeStyle=`rgba(${s.rim[0]},${s.rim[1]},${s.rim[2]},${(.6*s.rimStrength).toFixed(3)})`,i.lineWidth=Math.max(1,o*.02),i.beginPath(),i.moveTo(e-c,l),i.lineTo(e-r*.6,n+r*.4),i.moveTo(e-r*.7,n),i.ellipse(e,n,r*.84,r*1.02,0,Math.PI*1.05,Math.PI*1.55),i.stroke())}function vi(i,e,t,o,s,r,n,l,a){i.save(),i.globalCompositeOperation="lighter";let c=i.createLinearGradient(0,t,0,s);c.addColorStop(0,`rgba(${l},${a})`),c.addColorStop(.5,`rgba(${l},${(a*.4).toFixed(3)})`),c.addColorStop(1,`rgba(${l},0)`),i.fillStyle=c,i.beginPath(),i.moveTo(e-r,t),i.lineTo(o-n,s),i.lineTo(o+n,s),i.lineTo(e+r,t),i.closePath(),i.fill(),i.restore()}function _o(i,e,t,o,s){let r=i.createRadialGradient(e,t,0,e,t,o*3);r.addColorStop(0,`rgba(${s},0.9)`),r.addColorStop(.4,`rgba(${s},0.35)`),r.addColorStop(1,`rgba(${s},0)`),i.fillStyle=r,i.beginPath(),i.arc(e,t,o*3,0,E),i.fill(),i.fillStyle=`rgba(${s},1)`,i.beginPath(),i.arc(e,t,o,0,E),i.fill()}function xb(i,e,t){let o=document.createElement("canvas");o.width=q,o.height=ue;let s=o.getContext("2d"),r=e.x-i.x,n=e.y-i.y,l=Math.hypot(r,n),a=Math.max(2,l*It),c=i.eyeHeightM??J,h=id(i,e,t),d=pl(h.seed),u=210+d()*150,p=te(220+(d()-.5)*60,.55,.82),y=`${p[0]},${p[1]},${p[2]}`,m=s.createLinearGradient(0,0,0,ue);m.addColorStop(0,"#080b12"),m.addColorStop(.42,"#12182c"),m.addColorStop(.5,"#1c2440"),m.addColorStop(.56,"#151b2c"),m.addColorStop(.78,"#171e30"),m.addColorStop(1,"#131829"),s.fillStyle=m,s.fillRect(0,0,q,ue);let f=s.createLinearGradient(0,z(-6),0,ue);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)"),s.fillStyle=f,s.fillRect(0,z(-6),q,ue-z(-6));let g=Math.atan2(r,-n),b=ed(i,t,g,c),S=b.maxDelta>=Jh;S&&td(s,b.bins,st,z);let v=Math.max(.3,Math.min(1,1-(a-6)/60)),w=Io(c,a),L=Math.min(80,Math.atan2(4,a)*180/Math.PI),k=Math.min(45,w.topPitch),T=w.basePitch;h.mode==="sport"?cd(s,a,c,h,v,u,y,d):h.mode==="arena"?ld(s,a,c,h,v,y,d):ad(s,L,k,T,v,u,y,d);let x=h.mode==="sport"?34:24+Math.floor(d()*8);s.fillStyle=`rgba(${y},0.8)`;for(let R=0;R<x;R++){let P=(R+.5)/x*q,A=z(h.mode==="sport"?58:54+R*7%3*6);s.beginPath(),s.arc(P,A,h.mode==="sport"?2.6:3.2,0,E),s.fill()}hd(s,i,t,e,g,c,r,n,S,h);let C=s.createLinearGradient(0,0,0,ue);return C.addColorStop(0,"rgba(0,0,0,0.85)"),C.addColorStop(.12,"rgba(0,0,0,0)"),C.addColorStop(.9,"rgba(0,0,0,0)"),C.addColorStop(1,"rgba(0,0,0,0.55)"),s.fillStyle=C,s.fillRect(0,0,q,ue),{url:o.toDataURL("image/jpeg",.82),distanceM:Math.round(a)}}function ad(i,e,t,o,s,r,n,l){let a=st(-e),c=st(e),h=z(t),d=z(o),u=c-a,p=d-h,y=z(Math.min(50,t+10)),m=u*(1.1+(1-s)*.5),f=i.createRadialGradient(q/2,(h+d)/2,8,q/2,(h+d)/2,m);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)"),i.fillStyle=f,i.fillRect(a-u*.6,h-p*1.2,u*2.2,p*3.4);let g=te(r,.62,.55),b=te(r+40,.7,.5),S=te(r+70,.78,.52);i.save(),i.beginPath(),i.rect(a,h,u,p),i.clip();let v=i.createLinearGradient(0,h,0,d);v.addColorStop(0,`rgb(${g[0]},${g[1]},${g[2]})`),v.addColorStop(.5,`rgb(${b[0]},${b[1]},${b[2]})`),v.addColorStop(1,`rgb(${S[0]},${S[1]},${S[2]})`),i.globalAlpha=.8,i.fillStyle=v,i.fillRect(a,h,u,p),i.globalAlpha=1;let w=i.createRadialGradient(q/2,(h+d)/2,u*.12,q/2,(h+d)/2,u*.62);w.addColorStop(0,"rgba(6,8,14,0)"),w.addColorStop(.7,"rgba(6,8,14,0.15)"),w.addColorStop(1,"rgba(5,6,11,0.92)"),i.fillStyle=w,i.fillRect(a,h,u,p),i.restore();let L=3+Math.floor(l()*3),k=p*.46,T=d-p*.08;for(let _=0;_<L;_++){let $=(_+1)/(L+1),X=a+u*(.22+$*.56+(l()-.5)*.06);Eo(i,X,T,k*(.9+l()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(l()*4),rim:te(r+20,.5,.7),rimStrength:.7})}i.fillStyle="#05070d",i.fillRect(a-u*.5,y,u*.5,d-y),i.fillRect(c,y,u*.5,d-y);let x=u*.055+3,C=x*1.35;i.fillStyle="#03050a",i.beginPath(),i.moveTo(a,d),i.lineTo(a-x,d),i.lineTo(a-C,y),i.lineTo(a+u*.012,y),i.closePath(),i.fill(),i.beginPath(),i.moveTo(c,d),i.lineTo(c+x,d),i.lineTo(c+C,y),i.lineTo(c-u*.012,y),i.closePath(),i.fill(),i.fillRect(a-C,y,u+C*2,(d-y)*.12);let R=p*.14,P=y+(d-y)*.12;i.fillStyle="rgba(4,6,12,0.96)";let A=7;i.beginPath(),i.moveTo(a-C,P);for(let _=0;_<=A;_++){let $=a-C+(u+C*2)*_/A;i.quadraticCurveTo($-(u+C*2)/A/2,P+R,$,P)}i.lineTo(c+C,P),i.lineTo(c+C,y),i.lineTo(a-C,y),i.closePath(),i.fill(),i.fillStyle=`rgba(${n},0.12)`,i.fillRect(a-1.5,P,1.5,d-P),i.fillRect(c,P,1.5,d-P),i.fillStyle="#0b0f18",i.fillRect(a-x,d-p*.05,u+x*2,p*.05+3);let M=i.createLinearGradient(0,d-p*.05,0,d+p*.12);M.addColorStop(0,`rgba(255,206,140,${(.5*s).toFixed(3)})`),M.addColorStop(1,"rgba(255,206,140,0)"),i.fillStyle=M,i.fillRect(a-x,d-p*.05,u+x*2,p*.2);let I=3+Math.floor(l()*2);for(let _=0;_<I;_++){let $=(_+1)/(I+1),X=a+u*($+(l()-.5)*.08),Y=z(Math.min(62,t+26)),Q=(l()-.5)*u*.16;vi(i,X,Y,X+Q,d,4,u*.09,n,.16*(.7+s*.5)),_o(i,X,Y,2.4,n)}}function ld(i,e,t,o,s,r,n){let l=Math.min(e*.6,Math.max(3,o.voidRadiusM)),a=Math.min(55,Math.atan2(l,e)*180/Math.PI),c=q/2,h=1.2,d=Math.max(e*.45,e-l),u=e+l,p=Math.atan2(h-t,d)*180/Math.PI,y=Math.atan2(h-t,u)*180/Math.PI,m=Math.atan2(-t,d)*180/Math.PI,f=z(p),g=z(y),b=z(m),S=st(a)-c,v=Math.max(6,(f-g)/2),w=(f+g)/2,L=i.createRadialGradient(c,b,4,c,b,S*2.6);L.addColorStop(0,`rgba(255,206,150,${(.2*s).toFixed(3)})`),L.addColorStop(.5,"rgba(150,140,190,0.08)"),L.addColorStop(1,"rgba(40,44,60,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=L,i.fillRect(c-S*2.6,g-v,S*5.2,b-g+v+40),i.restore(),i.fillStyle="#0c1019",i.beginPath(),i.moveTo(c-S,w),i.ellipse(c,w,S,v,0,Math.PI,0,!1),i.lineTo(c+S,b),i.ellipse(c,b,S,v,0,0,Math.PI,!1),i.closePath(),i.fill();let k=i.createLinearGradient(0,w,0,b);k.addColorStop(0,`rgba(${r},0.14)`),k.addColorStop(1,"rgba(0,0,0,0)"),i.fillStyle=k,i.fillRect(c-S,w,S*2,b-w);let T=[[{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}]],x=T[Math.floor(n()*T.length)],C=n()<.5?-1:1,R=F=>c+F.u*C*S*.84,P=F=>w+F.v*v*.8,A=x.find(F=>F.lead)??x[0],M=R(A),I=i.createLinearGradient(0,w-v,0,w+v);I.addColorStop(0,"#3d4a72"),I.addColorStop(1,"#232b47"),i.fillStyle=I,i.beginPath(),i.ellipse(c,w,S,v,0,0,E),i.fill();let _=i.createRadialGradient(M,w,2,M,w,S);_.addColorStop(0,`rgba(255,214,160,${(.5*s).toFixed(3)})`),_.addColorStop(1,"rgba(255,214,160,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=_,i.beginPath(),i.ellipse(c,w,S,v,0,0,E),i.fill(),i.restore(),i.strokeStyle=`rgba(${r},0.7)`,i.lineWidth=2,i.beginPath(),i.ellipse(c,w,S,v,0,0,E),i.stroke();let $=Math.max(24,(b-g)*1.3),X=x.length>=3?3:2;for(let F=0;F<X;F++){let pe=(-.62+F*.52+(n()-.5)*.12)*-C,Pe=c+pe*S*.7,rt=w-v*(.45+n()*.18),Ke=S*(.07+n()*.04),Ci=$*(.26+n()*.12);i.fillStyle="#0a0e18",i.fillRect(Pe-Ke/2,rt-Ci,Ke,Ci),i.fillStyle=`rgba(${r},0.3)`,i.fillRect(Pe-Ke/2,rt-Ci,Ke,1.5)}if(x.length>=3){let F=c-A.u*C*S*.4;i.fillStyle="#0b0f1a",i.beginPath(),i.ellipse(F,w-v*.34,S*.08,v*.1,0,0,E),i.fill(),i.strokeStyle=`rgba(${r},0.35)`,i.lineWidth=1,i.stroke()}for(let F of[...x].sort((pe,Pe)=>pe.v-Pe.v)){let pe=.82+(F.v+1)*.14;Eo(i,R(F),P(F),$*pe*(F.lead?1.06:.92),{tone:[18,21,34],alpha:.95,pose:F.pose,rim:te(40,.72,.8),rimStrength:F.lead?1.4:.9})}let Y=z(Math.min(60,y+34)),Q=v*1.1+6;i.strokeStyle="rgba(60,68,92,0.85)",i.lineWidth=3,i.beginPath(),i.ellipse(c,Y,S*1.15,Q,0,0,E),i.stroke();let O=4+Math.floor(n()*3);for(let F=0;F<O;F++){let pe=F/O*E,Pe=c+Math.cos(pe)*S*1.15,rt=Y+Math.sin(pe)*Q;if(Math.sin(pe)>-.2){let Ke=c+(n()-.5)*S*.8;vi(i,Pe,rt,Ke,w,3,S*.32,r,.2*(.7+s*.4))}_o(i,Pe,rt,3,r)}let U=z(Math.min(52,y+24)),N=Math.max(60,S*.4),Z=Math.max(24,N*.34);i.strokeStyle="rgba(70,78,102,0.6)",i.lineWidth=1.5,i.beginPath(),i.moveTo(c-N*.3,U-Z/2),i.lineTo(c-N*.16,U-Z*2.2),i.moveTo(c+N*.3,U-Z/2),i.lineTo(c+N*.16,U-Z*2.2),i.stroke(),i.fillStyle="#0d1220",i.fillRect(c-N/2,U-Z/2,N,Z);let Li=i.createLinearGradient(0,U-Z*.3,0,U+Z*.42);Li.addColorStop(0,`rgba(${r},0.5)`),Li.addColorStop(1,"rgba(255,214,160,0.32)"),i.fillStyle=Li,i.fillRect(c-N*.42,U-Z*.3,N*.84,Z*.72),i.fillStyle="rgba(255,214,160,0.55)",i.fillRect(c-N/2,U+Z/2-2,N,2);let ki=i.createRadialGradient(c,U,4,c,U,N*1.1);ki.addColorStop(0,`rgba(${r},0.2)`),ki.addColorStop(1,"rgba(0,0,0,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=ki,i.fillRect(c-N*1.1,U-N*.8,N*2.2,N*1.6);let Ti=i.createRadialGradient(c,(Y+w)/2,6,c,(Y+w)/2,S*1.5);Ti.addColorStop(0,`rgba(${r},${(.1*(.6+s*.5)).toFixed(3)})`),Ti.addColorStop(1,"rgba(0,0,0,0)"),i.fillStyle=Ti,i.fillRect(c-S*1.5,Y-40,S*3,w-Y+80),i.restore();let ml=c+Math.sign(M-c||1)*S*.5;vi(i,ml,Y-Q*.4,M,P(A),2.5,S*.16,"255,224,178",.42*(.7+s*.4));let xi=i.createRadialGradient(M,P(A),1,M,P(A),S*.2);xi.addColorStop(0,`rgba(255,228,185,${(.4*s).toFixed(3)})`),xi.addColorStop(1,"rgba(255,228,185,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=xi,i.beginPath(),i.ellipse(M,P(A),S*.2,v*.24,0,0,E),i.fill(),i.restore()}function cd(i,e,t,o,s,r,n,l){let a=q/2,c=Math.max(10,o.voidRadiusM),h=Math.max(2,e-c),d=e+c,u=Math.min(78,Math.atan2(c*1.15,e)*180/Math.PI),p=Math.atan2(-t,h)*180/Math.PI,y=Math.atan2(-t,d)*180/Math.PI,m=z(p),f=z(y),g=st(u)-a,b=(m+f)/2,S=Math.max(10,(m-f)/2),v=i.createRadialGradient(a,b,4,a,b,g);v.addColorStop(0,"#e8f0fb"),v.addColorStop(.7,"#b9c9e2"),v.addColorStop(1,"#8fa3c4"),i.save(),i.beginPath(),i.ellipse(a,b,g,S,0,0,E),i.clip(),i.fillStyle=v,i.fillRect(a-g,b-S,g*2,S*2),i.strokeStyle="rgba(90,120,170,0.5)",i.lineWidth=3,i.beginPath(),i.moveTo(a,b-S),i.lineTo(a,b+S),i.moveTo(a-g*.5,b-S),i.lineTo(a-g*.5,b+S),i.moveTo(a+g*.5,b-S),i.lineTo(a+g*.5,b+S),i.stroke(),i.strokeStyle="rgba(180,90,110,0.45)",i.beginPath(),i.ellipse(a,b,S*.9,S*.5,0,0,E),i.stroke(),i.restore(),i.strokeStyle="rgba(210,225,245,0.6)",i.lineWidth=2.5,i.beginPath(),i.ellipse(a,b,g,S,0,0,E),i.stroke(),i.fillStyle="rgba(20,26,40,0.8)";for(let R=0;R<5;R++){let P=a+(l()-.5)*g*1.4,A=b+(l()-.5)*S*1.1,M=Math.max(2,S*.06);i.beginPath(),i.ellipse(P,A,M*.6,M,0,0,E),i.fill()}let w=i.createRadialGradient(a,b,4,a,b,g*1.4);w.addColorStop(0,"rgba(200,220,255,0.12)"),w.addColorStop(1,"rgba(200,220,255,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=w,i.fillRect(a-g*1.4,f-S,g*2.8,m-f+S*2),i.restore();let L=z(Math.min(66,y+60)),k=Math.max(80,g*.7),T=k*.5,x=i.createRadialGradient(a,L,4,a,L,k*1.6);x.addColorStop(0,`rgba(${n},0.3)`),x.addColorStop(1,`rgba(${n},0)`),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=x,i.fillRect(a-k*1.6,L-k*1.2,k*3.2,k*2.4),i.restore(),i.fillStyle="#080b12",i.beginPath(),i.moveTo(a-k/2,L-T/2),i.lineTo(a+k/2,L-T/2),i.lineTo(a+k*.6,L),i.lineTo(a+k/2,L+T/2),i.lineTo(a-k/2,L+T/2),i.lineTo(a-k*.6,L),i.closePath(),i.fill();let C=r;for(let R=0;R<3;R++){let P=te(C+R*30,.5,.5);i.fillStyle=`rgba(${P[0]},${P[1]},${P[2]},0.75)`;let A=k*.26;i.fillRect(a-k*.42+R*(A+k*.06),L-T*.32,A,T*.64)}i.fillStyle=`rgba(${n},0.9)`;for(let R=0;R<8;R++){let P=a-k*.6+k*1.2*R/7;i.beginPath(),i.arc(P,L+T*.62,2.4,0,E),i.fill()}}function hd(i,e,t,o,s,r,n,l,a,c){let h=e.sectionId,d=!1,u=[];for(let m of t){if(m.id===e.id)continue;let f=m.x-e.x,g=m.y-e.y,b=Math.hypot(f,g)*It;if(h&&m.sectionId===h&&b<3&&f*n+g*l>0&&(d=!0),b<.3||b>32)continue;let v=((Math.atan2(f,-g)-s)*180/Math.PI+540)%360-180,w=a?(m.eyeHeightM??J)-r:0,L=Math.atan2(w-.28,b)*180/Math.PI;if(L>10&&b>5)continue;let k=0;for(let C=0;C<m.id.length;C++)k=k*31+m.id.charCodeAt(C)&65535;let T=.9+(k&15)/40,x=Math.min(78,Math.atan2(.16,b)*180/Math.PI*Qh*T);x<1.2||u.push({hx:st(v),hy:z(L),r:x,d:b,hash:k})}u.sort((m,f)=>f.d-m.d);let p=[];{let m=[...u].sort((b,S)=>b.hy-S.hy),f=[],g=()=>{if(!f.length)return;let b=f.reduce((w,L)=>w+L.d,0)/f.length,S=f.reduce((w,L)=>w+L.hy,0)/f.length,v=f.reduce((w,L)=>w+L.r,0)/f.length;p.push({figs:f.sort((w,L)=>L.d-w.d),d:b,hy:S,r:v}),f=[]};for(let b of m){let S=f[f.length-1];S&&Math.abs(b.hy-S.hy)>Math.max(5,(S.r+b.r)/2*1.7)&&g(),f.push(b)}g()}p.sort((m,f)=>f.d-m.d);let y=[[22,26,40],[28,27,42],[24,31,46],[31,30,47],[20,24,36]];for(let m of p){if(m.figs.length>=3&&m.r>=1.6&&m.r<26){let f=[],g=[...m.figs].sort((v,w)=>v.hx-w.hx),b=[];for(let v of g){let w=b[b.length-1];w&&v.hx-w.hx>Math.max(14,v.r*7)&&(b.length>=3&&f.push(b),b=[]),b.push(v)}b.length>=3&&f.push(b);let S=Math.min(.42,.5*(1-m.d/42));if(S>.05){i.fillStyle=`rgba(15, 19, 31, ${S.toFixed(3)})`;for(let v of f){let w=v[0].hx-m.r*1.6,L=v[v.length-1].hx+m.r*1.6;i.beginPath(),i.roundRect(w,m.hy+m.r*.8,L-w,m.r*2.4,m.r*.8),i.fill()}}}for(let f of m.figs){let g=f.d<12?.95:f.d<17?Math.max(.66,.95-(f.d-12)/18):Math.max(.3,.68-(f.d-17)/34),b=Math.round((1-Math.min(1,f.d/16))*10),S=[14+(f.hash>>4&6)+b,17+(f.hash>>4&6)+b,25+(f.hash>>4&6)+b],v=y[f.hash%y.length],w=[v[0]+b,v[1]+b,v[2]+b];if(f.r>=13){let L=f.d<9?.16*(1-f.d/9)+(c.mode==="proscenium"?.06:0):0;rd(i,f.hx,f.hy,f.r,{tone:S,clothing:w,alpha:g,tilt:((f.hash>>2&7)-3.5)*.018,shoulderK:1.72+(f.hash>>5&7)/22,hair:f.hash%od,rim:L,turn:((f.hash>>8&7)-3.5)*.034,lean:((f.hash>>10&3)-1.5)*.09})}else f.r>=5.5?nd(i,f.hx,f.hy,f.r,w,S,g):(i.fillStyle=`rgba(${S[0]},${S[1]},${S[2]},${g.toFixed(3)})`,i.beginPath(),i.arc(f.hx,f.hy,f.r,0,E),i.fill(),i.beginPath(),i.ellipse(f.hx,f.hy+f.r*1.4,f.r*1.85,f.r*.95,0,Math.PI,0,!0),i.fill())}}if(d){let m=z(-34);i.fillStyle="rgba(6, 8, 14, 0.92)",i.fillRect(0,m,q,ue-m),i.fillStyle="rgba(24, 30, 46, 0.9)";let f=16;for(let g=0;g<f;g++){let b=(g+.5)/f*q;i.beginPath(),i.ellipse(b,m+6,q/f*.42,22,0,Math.PI,0,!0),i.fill()}}}var se=480,ot=270,Ao=50,Ve=30,dl=i=>(i+Ao)/(2*Ao)*se,Ct=i=>(Ve-i)/(2*Ve)*ot;function Cb(i,e,t){let o=document.createElement("canvas");o.width=se,o.height=ot;let s=o.getContext("2d"),r=e.x-i.x,n=e.y-i.y,l=Math.max(2,Math.hypot(r,n)*It),a=pl(ul(`${i.id}|${Math.round(e.x)},${Math.round(e.y)}`)),c=210+a()*150,h=te(220+(a()-.5)*60,.55,.82),d=`${h[0]},${h[1]},${h[2]}`,u=s.createLinearGradient(0,0,0,ot);u.addColorStop(0,"#080b12"),u.addColorStop(.44,"#151c32"),u.addColorStop(.5,"#1d2644"),u.addColorStop(.58,"#161c2e"),u.addColorStop(1,"#131829"),s.fillStyle=u,s.fillRect(0,0,se,ot);let p=i.eyeHeightM??J,y=Io(p,l),m=Math.min(Ao-2,Math.atan2(4,l)*180/Math.PI),f=Math.min(Ve-2,y.topPitch),g=Math.max(-Ve+2,y.basePitch),b=dl(-m),S=dl(m),v=Ct(f),w=Ct(g),L=S-b,k=w-v,T=Math.max(.35,Math.min(1,1-(l-6)/60)),x=Ct(Math.min(Ve-1,f+8)),C=s.createRadialGradient(se/2,(v+w)/2,4,se/2,(v+w)/2,L*1.15);C.addColorStop(0,"rgba(255,214,150,0.34)"),C.addColorStop(.28,"rgba(150,150,230,0.3)"),C.addColorStop(.6,"rgba(99,102,241,0.12)"),C.addColorStop(1,"rgba(99,102,241,0)"),s.fillStyle=C,s.fillRect(b-L*.6,v-k*1.2,L*2.2,k*3.4);let R=te(c,.62,.55),P=te(c+40,.7,.5),A=te(c+70,.78,.52);s.save(),s.beginPath(),s.rect(b,v,L,k),s.clip();let M=s.createLinearGradient(0,v,0,w);M.addColorStop(0,`rgb(${R[0]},${R[1]},${R[2]})`),M.addColorStop(.5,`rgb(${P[0]},${P[1]},${P[2]})`),M.addColorStop(1,`rgb(${A[0]},${A[1]},${A[2]})`),s.globalAlpha=.8,s.fillStyle=M,s.fillRect(b,v,L,k),s.globalAlpha=1;let I=s.createRadialGradient(se/2,(v+w)/2,L*.12,se/2,(v+w)/2,L*.6);I.addColorStop(0,"rgba(6,8,14,0)"),I.addColorStop(.7,"rgba(6,8,14,0.15)"),I.addColorStop(1,"rgba(5,6,11,0.9)"),s.fillStyle=I,s.fillRect(b,v,L,k),s.restore();let _=3,$=w-k*.08;for(let O=0;O<_;O++){let U=(O+1)/(_+1);Eo(s,b+L*(.24+U*.52),$,k*.46*(.9+a()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(a()*4),rim:te(c+20,.5,.7),rimStrength:.7})}s.fillStyle="#05070d",s.fillRect(b-L*.5,x,L*.5,w-x),s.fillRect(S,x,L*.5,w-x);let X=L*.05+2,Y=X*1.35;s.fillStyle="#03050a",s.beginPath(),s.moveTo(b,w),s.lineTo(b-X,w),s.lineTo(b-Y,x),s.lineTo(b+L*.012,x),s.closePath(),s.fill(),s.beginPath(),s.moveTo(S,w),s.lineTo(S+X,w),s.lineTo(S+Y,x),s.lineTo(S-L*.012,x),s.closePath(),s.fill(),s.fillRect(b-Y,x,L+Y*2,(w-x)*.13),s.fillStyle=`rgba(${d},0.12)`,s.fillRect(b-1.2,x,1.2,w-x),s.fillRect(S,x,1.2,w-x),s.fillStyle="#0b0f18",s.fillRect(b-X,w-k*.05,L+X*2,k*.05+2);let Q=s.createLinearGradient(0,w-k*.05,0,w+k*.14);Q.addColorStop(0,`rgba(255,206,140,${(.5*T).toFixed(3)})`),Q.addColorStop(1,"rgba(255,206,140,0)"),s.fillStyle=Q,s.fillRect(b-X,w-k*.05,L+X*2,k*.22);for(let O=0;O<3;O++){let U=(O+1)/4,N=b+L*U,Z=Ct(Math.min(Ve-1,f+20));vi(s,N,Z,N+(a()-.5)*L*.14,w,3,L*.09,d,.17*T),_o(s,N,Z,1.8,d)}s.fillStyle=`rgba(${d},0.75)`;for(let O=0;O<8;O++)s.beginPath(),s.arc((O+.5)/8*se,Ct(Ve-4-O%2*3),2.2,0,E),s.fill();s.fillStyle="rgba(10,13,20,0.9)",s.fillRect(0,ot-26,se,26),s.fillStyle="rgba(30,37,54,0.9)";for(let O=0;O<9;O++){let U=O*(se/9)+se/18;s.beginPath(),s.ellipse(U,ot-22,se/9*.4,15,0,Math.PI,0,!0),s.fill()}return{url:o.toDataURL("image/jpeg",.8),distanceM:Math.round(l)}}var fl=new Set(["en"]),wi=new Map;async function dd(i){if(typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__)return(await import(ws(`i18n/${i}.mjs`))).default??null;let{LOADERS:e}=await import("./localeLoaders-ETY2H7H3.js"),t=e[i];return t?await t():null}async function Rb(i,e){let t=kr(i,e);if(t==="en"||fl.has(t))return Ze(t),t;if(!Lr.includes(t))return Ze("en"),"en";try{let o=wi.get(t);o||(o=dd(t),wi.set(t,o));let s=await o;return wi.delete(t),s?(Ze(t,s),fl.add(t),t):(Ze("en"),"en")}catch{return wi.delete(t),Ze("en"),"en"}}export{md as ACCESSIBILITY_RING_COLOR,Bo as ACCESSIBILITY_TYPES,Qd as AUTOMATIC_ROUND_TABLE_RADIUS_MAX,jd as AUTOMATIC_ROUND_TABLE_RADIUS_MIN,pd as CHART_STORAGE_KEY,wu as CURRENCY_CHOICES,vu as DEFAULT_CURRENCY,Bg as EMPTY_AVAILABILITY_REFRESH,kd as EVENT_CONFIGURATION_EXPORT_SCHEMA,Ld as EVENT_CONFIGURATION_SCHEMA,Ud as FLOOR_STACK_GAP_RATIO,Zd as FLOOR_STACK_MIN_SURFACE_PX,_g as HOLD_CLOCK_SKEW_MS,_i as LABEL_FADE_MS,Sd as LABEL_STYLE_MAX_SIZE,bd as LABEL_STYLE_MIN_SIZE,du as LEGIBILITY_HYSTERESIS_PX,Mu as LOCALE_NAMES,tu as MAX_EVENT_INVENTORY,eu as MAX_GA_CAPACITY,Jo as MIN_POINTER_TARGET_PX,al as PickerController,Ie as PickerSelectionError,cu as RENDERED_QUALITY_REPORT_VERSION,yd as SEAT_COMMERCIAL_MARKS,ud as STAGE_LABEL_STYLE_MAX_SIZE,Vl as SUPPORTED_LOCALES,vd as SURROUNDINGS_SHAPE_ROLES,To as SeatmapRenderer,Ed as TABLE_SEAT_OFFSET,Ad as TIER_HEIGHT_M,Lr as TRANSLATED_LOCALES,Yo as UNGROUPED_ID,$a as accessNeedsFor,fd as accessibilityMeta,Pt as accessibilityRingColor,Wo as allObjects,Uo as applyHidden,ja as attachVisibilityCatchUp,Jd as automaticRoundTableRadius,Pd as canTransitionEventConfiguration,Cd as canonicalEventConfigurationJson,Ko as chartBounds,ya as compactRowLabel,_t as computeSections,Va as createRenderer,Ls as crossesThreshold,Gl as currencyExponent,ku as currencySymbol,Wd as expandBooth,Xe as expandChart,Od as expandRow,Fd as expandRowSlots,Gd as expandTable,Nd as expandTableSlots,Xd as floorObjects,$d as floorStackPlacements,At as floorsOf,Bu as formatDate,Lu as formatMinor,mt as formatMoney,Wl as fromMinorUnits,nt as gaAreasOf,su as gaInventorySegments,iu as gaUnitLabel,Et as gaUnitLabels,xb as generateSeatPanorama,Cb as generateSeatThumb,Ru as getLocale,ru as growJoinedGAInventory,lu as hiddenObjectIds,Xh as holdHasLapsed,Og as holdRecoveryShape,Fi as hysteresisScale,Xo as initialFloorMode,Id as inspectEventConfigurationCompatibility,hu as inspectRenderedQualityEvidence,nu as isGaUnitLabel,Eu as isLocaleLoaded,au as isSectionHidden,wd as layerOf,zo as layoutFloorStack,Rb as loadLocale,Au as localeDirection,qd as mainFloorId,Rd as migrateLegacyEventConfigurations,Kd as objectCenter,zd as owningSectionForObject,xd as parseEventConfigurationExport,Td as parseEventConfigurationVersion,Vd as pointInPolygon,ie as pointInPolygonWithHoles,Rt as polygonLabelPoint,qa as reconcileAvailability,Fg as refreshChangedSomething,Bi as renderedPx,Md as resolveEventConfigurationRollback,kr as resolveLocale,Bd as rowInventoryCount,_d as rowSeatPositions,gd as seatCommercialMeta,Mt as sectionGeometry,Ze as setLocale,wr as setMoneyLocale,_u as setStringOverrides,Za as shouldWaitForHoldExpiry,Vo as stackFloors,G as t,xr as tCount,Hd as tableInventoryCount,Dd as tableSeatCountsBySide,Yd as translateObject,ou as validGAInventorySegments,uu as zoomTowardPoint};
1
+ import{a as Ei,b as _i,d as ws,e as Wt,g as Ls,h as ks,k as Cs}from"./chunk-O5UH442K.js";import{a as yu,b as gu,c as $o,d as bu,e as Su,f as qo,h as hs,k as Nt,m as ds,n as be,o as ae,p as us,q as ps,r as Ht,s as fs}from"./chunk-NQZAZFAC.js";import{a as Eu,b as os,c as _u}from"./chunk-BXU5D2Q5.js";import{b as xs}from"./chunk-FOYQOIWG.js";import{a as vu,b as wu,c as Lu}from"./chunk-BT2KJXQC.js";import{a as ye,b as ts,c as Re,d as _t,e as Bt,f as Ae,g as N,m as ge,n as xe,q as Ft,r as Ot,t as is,u as Ue,v as re,w as Ee,x as Ai}from"./chunk-XD2P4ZS4.js";import{A as Ss,B as vs,b as ls,c as cs,e as ct,i as ys,j as gs,p as bs}from"./chunk-QLDV5ZGA.js";import{a as ku,b as Cu,c as xu,d as Tu,e as Iu,f as At,g as Pu,h as at,i as Mu,j as Zo,k as Et,l as Ru,m as Au,n as jo}from"./chunk-Q3U3F4YJ.js";import{a as Fd,b as Od,c as Go,d as Dd,e as Gd,f as It,g as Nd,h as Hd,i as Wd,j as Vd,k as Kd,l as zd,n as ss,q as lt,u as ms}from"./chunk-WXGW2SYC.js";import{b as Dt,f as ns,h as Gt,i as rs,k as as}from"./chunk-UL5OIGIF.js";import{Aa as zo,Ca as tu,Da as iu,E as No,Ea as ou,Fa as su,G as Ho,Ga as nu,Ha as ru,I as V,Ia as au,Ja as lu,Ka as cu,La as hu,Ma as du,Na as oe,Oa as Mt,Pa as uu,Qa as pu,Ra as Rt,Sa as fu,Ta as Xo,Ua as mu,Va as Yo,Wa as Ye,Xa as Uo,d as Xd,e as Yd,f as Ud,g as $d,ga as Wo,h as qd,ha as Xe,i as Zd,ia as eu,j as jd,k as Qd,l as Jd,qa as ee,ra as Vo,sa as Pt,ya as Ko}from"./chunk-24O23MNB.js";import{C as B,c as Pi,h as Mi,m as Qo,o as Jo,t as F,u as Ce,v as me,w as j,x as Ri,z as es}from"./chunk-JBOTRSMY.js";import"./chunk-CRCGO52K.js";var Bu=1,Bi=90;function Fi(i,e){return!Number.isFinite(i)||!Number.isFinite(e)?0:Math.max(0,i*e)}function Ts(i,e,t,o=1){if(!Number.isFinite(i))return t;let s=Math.max(0,o);return t?i>=e-s:i>=e+s}function Oi(i,e,t,o=1){if(!Number.isFinite(i)||!(t>0))return i;let s=Math.max(0,o)/t;return e?i*(1+s):i*(1-s)}function Fu(i){let{point:e,camera:t,scale:o,nextScale:s}=i;if(!Number.isFinite(o)||o<=0||!Number.isFinite(s))return{...t};let n=(e.x-t.x)/o,r=(e.y-t.y)/o;return{x:e.x-n*s,y:e.y-r*s}}import{Konva as yi}from"konva/lib/Core";import{Stage as ld}from"konva/lib/Stage";import{Layer as xo}from"konva/lib/Layer";import{Group as Ve}from"konva/lib/Group";import{Circle as el}from"konva/lib/shapes/Circle";import{Group as Yi}from"konva/lib/Group";import{Circle as He}from"konva/lib/shapes/Circle";import{Line as Ui}from"konva/lib/shapes/Line";import{Rect as $i}from"konva/lib/shapes/Rect";import{Text as Fn}from"konva/lib/shapes/Text";var le=9,_e=.9,ce=.55*_e,se=N/ye,ht=4,Be=14,Is=10,Ps=14,Se=.45*_e,ve=.9*_e,we=(Se+ve)/2,Ms=Math.max(_e*1.1,ve),Te=8,Rs=700,Q=2,As=N,Vt=.85,Es=N,dt=64,$e=.55*Se,Kt=700,_s=2500,zt=-11.5,ut=.58,Bs=320,Fs=420,Os=420,Ds=1,Fe=1,Gs=2,qe=16,de=12,Di=[.85,.72,.62],Xt=13,Yt=12,Ns=0,Hs="700",Ws="600",Vs=8,Ks=5,zs=10,Xs=6,Ys=8,Us=.6,$s=.6,qs=.7,Zs=[0,18,-18,36,-36,54,-54],Oe="600",js="500",ue=640,Ut="700",De=.02,Qs=14,Js=.34,$t=.92,pt=7,qt=3,en=6;function Gi(i){return Math.min(1,Math.max(de/qe,i/900))}function Ze(i,e){return Math.max(de,i*Gi(e))}var tn=.1,ft=1.02;var on=2;function sn(i,e){return!(i>0)||!(e>0)||i>=e?null:e}var El="#e5e7eb",_l="#c7cbd1",Bl="#595f69",Fl="#d1d5db",Ol="#b8bdc4",Dl="#273142",Gl="#526078",Nl="#f1f5f9",Hl="#374151",Wl="#64748b",Vl="#111827",Zt="#6b7280",jt="#374151";var nn="#4b5563",rn=.4,Ge=.16,an="rgba(244,246,248,0.06)",Qt=["#E69F00","#56B4E9","#009E73","#F0E442","#0072B2","#D55E00","#CC79A7"];function ln(i,e,t){let o=new Map;for(let r of i){let l=e(r);!l||t(l)||o.set(l,(o.get(l)??0)+1)}let s=null,n=0;for(let[r,l]of o)(l>n||l===n&&s!=null&&r<s)&&(s=r,n=l);return s}function te(i){return F(i)?{sectionFill:El,sectionStroke:_l,sectionInk:Bl,focalFill:Fl,focalStroke:Ol}:{sectionFill:Dl,sectionStroke:Gl,sectionInk:Nl,focalFill:Hl,focalStroke:Wl}}function Ni(i,e){let t=i.sectionFill,o=es(me(t,.2),.85);switch(e){case"closed":return me(t,.12);case"sold-out":return o;case"nearly-gone":return j(t,o,.4);default:return t}}var cn=.28,hn=.32,Kl=.55,zl=.7;function dn(i,e,t){let o=te(i),s=Ni(o,e);if(!t||e==="sold-out"||e==="closed")return{fill:s,stroke:o.sectionStroke};let n=F(i);return{fill:j(s,t,n?hn:cn),stroke:B(t,n?zl:Kl)}}var Xl=.03;function un(i,e){let t=te(i);return!["normal","nearly-gone","sold-out","closed"].map(s=>Ni(t,s).toLowerCase()).includes(e.trim().toLowerCase())&&Hi(i,e)}function Hi(i,e){let t=Pi(e);if(!t)return!1;let o=te(i),s=Math.max(cn,hn)+Xl;return["normal","nearly-gone","sold-out","closed"].some(n=>{let r=Pi(Ni(o,n));return r?Math.max(Math.abs(r[0]-t[0]),Math.abs(r[1]-t[1]),Math.abs(r[2]-t[2]))/255<=s:!1})}var Yl="#f8fafc",Ul="#f4f6fb",$l="#111827",ql=.72;function pn(i){let e=F(i),t=e?Yl:Vl,o=e?$l:Ul,s=j(o,t,1-ql);return{plate:t,ink:o,subInk:Qo(s,t)>=Jo?s:o}}function Jt(i){return i?.35:.3}function yn(i){if(i<=0||i>=1)return 1;let e=1.25-1;if(i<.45){let o=i/.45;return 1+e*(1-(1-o)**2)}let t=(i-.45)/(1-.45);return 1+e*Math.cos(t*Math.PI*1.5)*(1-t)**2}function Wi(i){let e=i<=0?0:i>=1?1:i,t=1-(1-e)**3;return{radiusScale:1+(2.5-1)*t,opacity:.55*(1-e)}}var gn=700,Zl=2400,Vi=12,bn=30,fn=1,jl=1.16,mn=.5,Ql=1;function Ki(i){return i*.61803398875%1}function Sn(i,e){let o=((i/Zl+e)%1+1)%1,s=(1-Math.cos(o*2*Math.PI))/2;return{scale:fn+(jl-fn)*s,opacity:mn+(Ql-mn)*s}}var wn;function Ln(i){wn=i}function Jl(i){return typeof i=="number"?i:i instanceof Date?i.getTime():Date.parse(i)}var vn=new Map;function ec(i,e){let t=i??wn,o=`${t??""}|${JSON.stringify(e)}`,s=vn.get(o);return s||(s=new Intl.DateTimeFormat(t,e),vn.set(o,s)),s}var tc={dateStyle:"medium",timeStyle:"short"};function kn(i,e={}){let{locale:t,...o}=e,s=Jl(i);if(!Number.isFinite(s))return"";let n=Object.keys(o).length?o:tc;return ec(t,n).format(s)}var Ku="USD",zu=["USD","EUR","GBP","CAD","AUD","INR","AED","SGD","JPY","CHF","SEK","NZD","ZAR","MXN","BRL"],xn;function Tn(i){xn=i}var Cn=new Map;function ei(i,e,t,o){let s=o??xn,n=`${s??""}|${i}|${e??"auto"}|${t??"auto"}`,r=Cn.get(n);return r||(r=new Intl.NumberFormat(s,{style:"currency",currency:i,minimumFractionDigits:e,maximumFractionDigits:t}),Cn.set(n,r)),r}function mt(i,e="USD",t,o){if(typeof t=="object"){let n=t;try{return ei(e,n.minimumFractionDigits,n.maximumFractionDigits,n.locale).format(i)}catch(r){if(n.fallback)return n.fallback(i,e);throw r}}let s=t??(Number.isInteger(i)?0:void 0);return ei(e,s,s,o).format(i)}function ic(i="USD"){try{return ei(i,void 0,void 0).resolvedOptions().maximumFractionDigits??2}catch{return 2}}function oc(i,e="USD"){return i/10**ic(e)}function Xu(i,e="USD",t){return mt(oc(i,e),e,void 0,t)}function Yu(i="USD"){return ei(i,0,0).formatToParts(0).find(t=>t.type==="currency")?.value??i}var yt={"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.testModeExplained":"Bookings here are not real and no card is charged","picker.seatsTogether":"Seats together","picker.findClosestSeatsTogether":"Find the closest seats together","picker.addSeat":"Add seat","picker.added":"Added","picker.findSeats":"Find seats","picker.displayOptions":"Display options","picker.closeVenueNavigation":"Close venue navigation","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.beaconAria":"Go to your {seats} in {name}","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.seatsLeftShort":"{count} left","picker.overview":"Venue","picker.entrance":"Entrance","picker.turnOffAccessibilityFilter":"Turn off the wheelchair filter to pick this seat","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":"Reload the seat map to continue. Seats already in your cart stay held until the timer ends.","picker.accessExpiredTitle":"Your seat session has expired","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":"Reload seat map","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.accessibilityOptions":"Accessibility and colour options","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.colorblindColors":"Colourblind-friendly colours","picker.companionSeatsNote":"Companion places beside them stay selectable","picker.accessFreeCount":"{count} free","picker.accessNoneLeft":"None left","picker.holdLapsedStillFree.one":"Your hold ended while you were away. That seat is still free.","picker.holdLapsedStillFree.other":"Your hold ended while you were away. Those seats are still free.","picker.holdLapsedSomeTaken.one":"Your hold ended while you were away, and {count} of those seats has been taken. The rest are still free.","picker.holdLapsedSomeTaken.other":"Your hold ended while you were away, and {count} of those seats have been taken. The rest are still free.","picker.holdLapsedAllTaken.one":"Your hold ended while you were away, and that seat has been taken.","picker.holdLapsedAllTaken.other":"Your hold ended while you were away, and those seats have been taken.","picker.holdLapsedSelectAgain.one":"Select it again","picker.holdLapsedSelectAgain.other":"Select them again","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.dragToLookTouch":"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close","picker.dragToLookMouse":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close","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.heldByOther":"Held by another buyer \u2014 may become available","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.moreCount":"+{count} more","picker.showLess":"Show less","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.recentreOnStage":"Recentre on the stage","picker.stopYourSeat":"Your seat","picker.stopYourRow":"Your row","picker.stopYourSection":"Your section","picker.stopWholeVenue":"Whole venue","picker.viewFromHere":"View from here","picker.viewFromYourSeat":"view from your seat","picker.fromYourSeat":"from your seat","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","picker.gaChooseTickets":"How many tickets?","picker.gaAdd.one":"Add {count} ticket \xB7 {price}","picker.gaAdd.other":"Add {count} tickets \xB7 {price}","picker.gaUpdate.one":"Update \xB7 {count} ticket","picker.gaUpdate.other":"Update \xB7 {count} tickets","picker.gaRemove":"Remove","picker.gaAreasHeading":"Areas","picker.gaTrayHintTapArea":"Tap an area on the map to choose tickets.","picker.gaAdded.one":"{count} {area} ticket added, {price}","picker.gaAdded.other":"{count} {area} tickets added, {price}","picker.gaRemoved":"{area} tickets removed","picker.gaChooseForArea":"Choose tickets for {area}","picker.holdSeatsForAllPerformances":"Hold seats for all {count} performances","picker.completeAllPerformances":"Complete all performances ({complete}/{total})","picker.groupTrayHint":"Choose seats once \u2014 the same seats will be held for every performance.","picker.groupPerPerformanceTrayHint":"Choose seats for this performance, then complete every date above.","picker.group.sameSeatSummary":"Choose once. The same seats will be held for all {count} performances.","picker.group.perPerformanceSummary":"Choose seats for each performance. All {count} selections are held together.","picker.group.allDates":"All {count} dates included","picker.group.flexibleDatesInView":"All {count} dates in view","picker.group.flexibleDatesSelected":"{selected} of {total} dates selected","picker.group.performances":"Performances","picker.group.heldForEveryPerformance":"Held for every performance","picker.group.notStarted":"Not started","picker.group.inProgress":"In progress","picker.group.complete":"Complete","picker.group.needsAttention":"Needs attention","picker.group.previousPerformance":"Previous performance","picker.group.nextPerformance":"Next performance","picker.group.performanceOpened":"Now choosing seats for {performance}.","picker.group.checkingAvailability":"Checking seats available for every performance\u2026","picker.group.securing":"Securing these seats for every performance. Please wait.","picker.group.commitPending":"We\u2019re still securing these seats for every performance. SeatLayer will keep working; this page is checking the result.","picker.group.outcomeUnknown":"We\u2019re checking whether your seats were secured. Don\u2019t choose other seats yet.","picker.group.longRunning":"This is taking longer than usual. We\u2019re still checking the same request. Don\u2019t submit it again. Reference: {reference}.","picker.group.abortPending":"We couldn\u2019t secure every performance. We\u2019re checking that all seats are released before you try again.","picker.group.secured":"Seats secured for every performance. Continue when you are ready.","picker.group.notSecured":"We couldn\u2019t secure these seats for every performance. Nothing is held. Try again.","picker.group.retry":"Try again","picker.group.salesClosed":"Seats for this performance set are not available now. Return to the event page for other options.","picker.group.revisionChanged":"This performance set changed. Review the included performances before choosing seats again.","picker.group.legendTitle":"Seat availability","picker.group.legendUnavailable":"Unavailable","picker.group.partlyAvailableTitle":"Free on some nights only","picker.group.notAvailableOn":"Not available on {dates}","picker.group.nightFree":"Free","picker.group.nightBlocked":"Not available","picker.group.pickSeatFreeEveryNight":"Pick a seat that is free every night.","picker.group.chooseNightByNight":"Choose seats night by night","picker.group.nightByNightStarted":"Now choosing seats for each performance separately. Your selection was cleared.","picker.group.yourSeatsByNight":"Your seats by night","picker.group.noSeatsChosenYet":"No seats yet","picker.group.chosenOfTotal":"{chosen} of {total}","picker.group.needsMoreSeats":"Needs {count} more","picker.group.closeSeatDetails":"Close seat details","picker.group.seatPartlyAvailable":"{label}: free on {free} of {total} performances. Not available on {dates}.","picker.group.selectAvailableDates":"Select for {count} available dates","picker.group.selectedAvailableDates":"Selected for {count} available dates.","picker.group.clearBeforePartial":"Clear your current seats before choosing a different date set.","picker.group.legendAvailable":"Available","picker.group.legendSelected":"Selected","picker.group.legendNotEveryDate":"Not open on every date","picker.group.progressLabel":"Booking steps","picker.group.stepPerformances":"Performances","picker.group.stepSeats":"Seats","picker.group.stepReview":"Review","picker.group.stepDone":"Done","picker.group.stepCurrent":"Current step","picker.group.includedNote":"All {count} performances are included \xB7 dates cannot be removed here","picker.group.flexibleDatesNote":"Choose a partial seat to include only the dates where it is available.","picker.group.flexibleSelectedNote":"Only these {count} dates will be held for this seat.","picker.group.yourSelection":"Your selection","picker.group.pricesPerPerformance":"Prices shown per performance","picker.group.total":"Total","picker.group.heldTogether":"All {count} performance selections are held together \xB7 {time} remaining","picker.group.completeWithSeats":"Complete \xB7 {seats}","picker.group.stillNeedsSeat":"Still needs a seat","picker.group.sameSeatMapHelp":"One chart shows only seats available for every selected performance.","picker.group.perPerformanceMapHelp":"Switch dates above; the map position and each choice stay saved.","picker.group.bookedAll":"You\u2019re all set \u2014 seats booked for all {count} performances.","picker.group.seatsEveryPerformance.one":"{count} seat \xB7 every performance","picker.group.seatsEveryPerformance.other":"{count} seats \xB7 every performance","picker.group.seatsPerPerformance.one":"{count} seat \xB7 {per} per performance","picker.group.seatsPerPerformance.other":"{count} seats \xB7 {per} per performance","picker.group.performancesChosenOf.one":"{chosen} of {total} performances chosen \xB7 {count} seat","picker.group.performancesChosenOf.other":"{chosen} of {total} performances chosen \xB7 {count} seats","picker.group.ticketsConfirmedAcross.one":"{count} ticket confirmed across {performances} performances","picker.group.ticketsConfirmedAcross.other":"{count} tickets confirmed across {performances} performances"};var sc=["ar","be","bg","ca","cs","cy","da","de","el","en","es","et","fa","fi","fr","he","hr","hu","it","ja","ku","lt","lv","nl","no","pl","pt","ro","ru","sk","sl","sr","sv","tr","uk","zh-Hans","zh-Hant"],Qu={ar:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",be:"\u0411\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F",bg:"\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438",ca:"Catal\xE0",cs:"\u010Ce\u0161tina",cy:"Cymraeg",da:"Dansk",de:"Deutsch",el:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC",en:"English",es:"Espa\xF1ol",et:"Eesti",fa:"\u0641\u0627\u0631\u0633\u06CC",fi:"Suomi",fr:"Fran\xE7ais",he:"\u05E2\u05D1\u05E8\u05D9\u05EA",hr:"Hrvatski",hu:"Magyar",it:"Italiano",ja:"\u65E5\u672C\u8A9E",ku:"Kurd\xEE",lt:"Lietuvi\u0173",lv:"Latvie\u0161u",nl:"Nederlands",no:"Norsk",pl:"Polski",pt:"Portugu\xEAs",ro:"Rom\xE2n\u0103",ru:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",sk:"Sloven\u010Dina",sl:"Sloven\u0161\u010Dina",sr:"\u0421\u0440\u043F\u0441\u043A\u0438",sv:"Svenska",tr:"T\xFCrk\xE7e",uk:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430","zh-Hans":"\u7B80\u4F53\u4E2D\u6587","zh-Hant":"\u7E41\u9AD4\u4E2D\u6587"},In=["ar","be","bg","ca","cs","cy","da","de","el","en","es","et","fa","fi","fr","he","hr","hu","it","ja","ku","lt","lv","nl","no","pl","pt","ro","ru","sk","sl","sr","sv","tr","uk","zh-Hans","zh-Hant"],nc=new Set(["ar","fa","he"]),zi={li:"lt",iw:"he",mo:"ro",sh:"sr",nb:"no",nn:"no",kmr:"ku",zh:"zh-Hans","zh-cn":"zh-Hans","zh-sg":"zh-Hans","zh-my":"zh-Hans","zh-tw":"zh-Hant","zh-hk":"zh-Hant","zh-mo":"zh-Hant"},Xi=new Map(sc.map(i=>[i.toLowerCase(),i]));function rc(i){let e=i.trim().toLowerCase().replace(/_/g,"-");if(!e)return;let t=Xi.get(e)??zi[e];if(t)return t;let o=e.split("-");if(o.length>=2){let s=`${o[0]}-${o[1]}`,n=Xi.get(s)??zi[s];if(n)return n}return Xi.get(o[0])??zi[o[0]]}var Ne={en:yt},ti={},he="en";function Pn(i,e){let t=typeof navigator<"u"?navigator.languages?.length?navigator.languages:[navigator.language]:[];for(let o of[i,e,...t]){if(!o)continue;let s=rc(o);if(s)return s}return"en"}function Ju(){return he}function ep(i=he){return nc.has(i)?"rtl":"ltr"}function tp(i){return!!Ne[i]}function je(i,e){e&&(Ne[i]={...Ne[i],...e}),he=Ne[i]?i:"en",Tn(he),Ln(he),typeof document<"u"&&(document.documentElement.lang=he)}function ip(i){ti=i}var Mn=/\{(\w+)\}/g;function H(i,e){let t=ti[i]??Ne[he]?.[i]??yt[i]??i;return e?t.replace(Mn,(o,s)=>String(e[s]??`{${s}}`)):t}function Rn(i,e,t){let o=new Intl.PluralRules(he).select(e);return(ti[`${i}.${o}`]??Ne[he]?.[`${i}.${o}`]??yt[`${i}.${o}`]??ti[`${i}.other`]??Ne[he]?.[`${i}.other`]??yt[`${i}.other`]??i).replace(Mn,(r,l)=>String({count:e,...t}[l]??`{${l}}`))}function op(i,e){return kn(i,{...e??{dateStyle:"medium",timeStyle:"short"},locale:he})}function En(i,e,t,o=!1){let s=i.displayLabel?.trim()||i.label;return o?{title:s,detail:H("map.statusTaken"),sellable:!1}:e==="booked"?{title:s,detail:H("map.statusTaken"),sellable:!1}:e==="held"?{title:s,detail:H("map.statusHeld"),sellable:!1}:{title:s,detail:t()??"",sellable:!0}}var Qe=32,An=70;function _n(i,e){let t=Qe+6,o=i.y-An;return{x:Math.min(Math.max(i.x,t),Math.max(t,e.width-t)),y:o>=t?o:Math.min(i.y+An,e.height-t)}}var hc=220,dc=.08,ii=class{constructor(e){this.pulses=new Map;this.pulseGroup=null;this.loupe=null;this.echoTimers=new Map;this.host=e}syncMarker(e,t,o){let s=o.get(e);if(o.delete(e),!t){this.retire(s);return}s?.destroy();let n=this.host,r=n.seat(e);if(!r)return;let l=n.seatShape(e)?.fill(),a=re(typeof l=="string"?l:"",n.selectionColor(),Ue),c=n.selectionFocusId()===e,h=n.boothDims(r.rowId),d=n.seatRadius(),u=n.seatPoint(r),f=new Yi({name:"selection-ring",x:u.x,y:u.y,rotation:h?.rotation??0,listening:!1,perfectDrawEnabled:!1,opacity:n.selectionFocusDims(e)?.2:1});if(n.viewMode()==="perspective"){let p=n.perspectiveSeatScale(e);f.scale({x:p,y:p})}f.setAttrs({seatId:e,ringColor:a});let y={name:"selection-halo",stroke:B(n.categoryColor(r.categoryKey),Jt(F(n.canvasBackground()))),listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(h){let p=d*1.2;f.add(new $i({...y,width:h.width+p*2,height:h.height+p*2,offsetX:(h.width+p*2)/2,offsetY:(h.height+p*2)/2,cornerRadius:8,strokeWidth:Math.max(2,d*.5)}))}else f.add(new He({...y,radius:d*1.6,strokeWidth:Math.max(2,d*.55)}));let m={stroke:a,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(h)if(f.add(new $i({...m,width:h.width,height:h.height,offsetX:h.width/2,offsetY:h.height/2,cornerRadius:4,strokeWidth:c?4:3})),c)f.add(new $i({...m,width:h.width+10,height:h.height+10,offsetX:(h.width+10)/2,offsetY:(h.height+10)/2,cornerRadius:7,strokeWidth:2,opacity:.55}));else{let p=Math.max(0,h.width/2-14),g=-Math.max(0,h.height/2-14);f.add(new He({x:p,y:g,radius:10,fill:a,listening:!1})),f.add(new Ui({x:p,y:g,points:[-4.5,0,-1,3.5,5.5,-4.5],stroke:F(a)?"#0b1220":"#ffffff",strokeWidth:2.4,lineCap:"round",lineJoin:"round",listening:!1}))}else f.add(new He({...m,radius:Math.max(1,d-1.25),strokeWidth:Math.min(2.5,Math.max(1.8,d*.22))})),c?f.add(new He({...m,radius:d+2,strokeWidth:2,opacity:.55})):f.add(new Ui({points:[-d*.52,0,-d*.12,d*.4,d*.6,-d*.46],stroke:"#ffffff",strokeWidth:Math.max(2.6,d*.34),lineCap:"round",lineJoin:"round",shadowColor:"#0b1220",shadowBlur:1.5,shadowOpacity:.55,listening:!1}));o.set(e,f),this.host.overlayLayer.add(f)}retire(e){let t=this.host;if(!e)return;if(t.reducedMotion()||t.isDestroyed()||typeof document<"u"&&document.hidden){e.destroy();return}let o=performance.now(),s=n=>{if(t.isDestroyed()||!e.getLayer()){e.destroy();return}let r=Math.min(1,(n-o)/160);e.opacity(1-r),t.overlayLayer.batchDraw(),r<1?requestAnimationFrame(s):(e.destroy(),t.overlayLayer.batchDraw())};requestAnimationFrame(s)}play(e){let t=this.host;if(t.reducedMotion()||t.isDestroyed()||typeof document<"u"&&document.hidden||!t.seat(e))return;this.emitPulse(e,!0);let o=this.echoTimers.get(e);o&&clearTimeout(o),this.echoTimers.set(e,setTimeout(()=>{this.echoTimers.delete(e),!(t.isDestroyed()||t.reducedMotion())&&(typeof document<"u"&&document.hidden||this.emitPulse(e,!1))},gn))}emitPulse(e,t){let o=this.host,s=o.seat(e);if(!s)return;let n=o.seatRadius(),r=o.seatPoint(s);this.pulses.get(e)?.destroy();let l=new He({name:"selection-pulse",x:r.x,y:r.y,radius:n,stroke:o.categoryColor(s.categoryKey),strokeWidth:Math.max(1.5,n*.24),opacity:Wi(0).opacity,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.pulses.set(e,l),this.pulseHome().add(l);let a=t&&!o.isCached()?o.seatShape(e):void 0,c=performance.now(),h=()=>{a?.scale({x:1,y:1}),l.destroy(),this.pulses.get(e)===l&&this.pulses.delete(e),o.overlayLayer.batchDraw(),a&&!o.isCached()&&o.seatLayer.batchDraw()},d=u=>{if(o.isDestroyed()){h();return}l.getLayer()||this.pulseHome().add(l);let f=u-c,y=Wi(f/420);if(l.radius(n*y.radiusScale),l.opacity(y.opacity),a){let m=yn(f/320);a.scale({x:m,y:m})}o.overlayLayer.batchDraw(),a&&!o.isCached()&&o.seatLayer.batchDraw(),f<420?requestAnimationFrame(d):h()};queueMicrotask(()=>{o.isDestroyed()||requestAnimationFrame(d)})}nudge(e){let t=this.host;if(t.reducedMotion()||t.isDestroyed()||t.isCached()||typeof document<"u"&&document.hidden)return;let o=t.seatShape(e);if(!o)return;let s=performance.now(),n=()=>{o.scale({x:1,y:1}),t.seatLayer.batchDraw()},r=l=>{if(t.isDestroyed()||t.isCached()||!o.getLayer()){n();return}let a=l-s,c=Math.min(1,a/hc),h=1+dc*Math.sin(Math.PI*c);o.scale({x:h,y:h}),t.seatLayer.batchDraw(),c<1?requestAnimationFrame(r):n()};requestAnimationFrame(r)}pulseHome(){return(!this.pulseGroup||!this.pulseGroup.getLayer())&&(this.pulseGroup=new Yi({name:"seat-pulses",listening:!1})),this.pulseGroup.getLayer()||this.host.overlayLayer.add(this.pulseGroup),this.host.overlayLayer.isCached()&&this.host.overlayLayer.clearCache(),this.pulseGroup.moveToTop(),this.pulseGroup}showLoupe(e){let t=this.host;if(t.isExportMode()||t.isDestroyed())return;let o=t.nearestSeat(e,Be),s=o?t.seat(o):void 0;if(!s){this.hideLoupe();return}let n=En(s,t.seatStatus(s.id),()=>t.priceLabel(s),t.seatClosed(s.id)),r=_n(e,{width:t.stage.width(),height:t.stage.height()}),l=1/(t.stage.scaleX()||1),a=this.loupe??this.buildLoupe();a.seatId=s.id,a.group.position(t.screenToWorld(r)),a.group.scale({x:l,y:l}),a.group.opacity(n.sellable?1:.75),a.group.visible(!0),a.disc.fill(t.categoryColor(s.categoryKey)),a.title.text(n.title),a.title.offsetX(a.title.width()/2),a.detail.text(n.detail),a.detail.offsetX(a.detail.width()/2),t.overlayLayer.batchDraw()}buildLoupe(){let e=this.host,t=e.canvasBackground(),o=re(t,te(t).sectionInk),s=new Yi({name:"touch-loupe",listening:!1,visible:!1});s.add(new Ui({points:[-7,Qe-4,0,Qe+12,7,Qe-4],closed:!0,fill:t,stroke:B(o,.25),strokeWidth:1,listening:!1})),s.add(new He({radius:Qe,fill:t,stroke:B(o,.28),strokeWidth:1.25,shadowColor:"#000000",shadowBlur:16,shadowOpacity:.45,listening:!1}));let n=new He({y:-15,radius:6,fill:"#6e7bff",listening:!1}),r=new Fn({y:-6,text:"",fontSize:15,fontStyle:"800",fontFamily:e.labelFont(),fill:o,listening:!1,perfectDrawEnabled:!1}),l=new Fn({y:12,text:"",fontSize:10.5,fontStyle:"700",fontFamily:e.labelFont(),fill:B(o,.72),listening:!1,perfectDrawEnabled:!1});return s.add(n),s.add(r),s.add(l),e.overlayLayer.add(s),s.moveToTop(),this.loupe={group:s,title:r,detail:l,disc:n,seatId:""},this.loupe}hideLoupe(){this.loupe?.group.visible()&&(this.loupe.group.visible(!1),this.host.overlayLayer.batchDraw())}destroy(){for(let e of this.echoTimers.values())clearTimeout(e);this.echoTimers.clear()}};import{Animation as uc}from"konva/lib/Animation";var pc=1e3/bn;function On(i){return i.findOne(".selection-halo")??null}var oi=class{constructor(e){this.animation=null;this.targets=[];this.startedAt=0;this.lastFrameAt=0;this.visibilityBound=!1;this.onVisibilityChange=()=>{this.refresh()};this.markers=new Map;this.beaconRings=[];this.host=e}sync(e){this.markers=e,this.refresh()}syncBeacons(e){this.beaconRings=e,this.refresh()}refresh(){let e=this.host,t=this.markers.size>0||this.beaconRings.length>0;if(t&&!e.isDestroyed()&&!e.reducedMotion()&&this.bindVisibility(),e.isDestroyed()||e.reducedMotion()||!this.pageVisible()||!t){this.stop(),this.rest(),(!t||e.isDestroyed()||e.reducedMotion())&&this.unbindVisibility();return}let o=[],s=0;for(let[r,l]of this.markers){let a=On(l);if(a){if(this.paintHalo(r,a),s>=Vi){a.scale({x:1,y:1}),a.opacity(1);continue}o.push({node:a,phase:Ki(s)}),s+=1}}let n=0;for(let r of this.beaconRings){if(n>=Vi){r.scale({x:1,y:1}),r.opacity(1);continue}o.push({node:r,phase:Ki(n)}),n+=1}if(this.targets=o,!o.length){this.stop();return}this.animation||(this.startedAt=performance.now(),this.lastFrameAt=0,this.animation=new uc(()=>this.frame(),e.overlayLayer),this.animation.start())}stop(){this.targets=[],this.animation&&(this.animation.stop(),this.animation=null)}destroy(){this.stop(),this.markers=new Map,this.beaconRings=[],this.unbindVisibility()}isRunning(){return!!this.animation?.isRunning()}paintHalo(e,t){let o=this.host,s=Jt(F(o.canvasBackground())),n=o.seatCategoryKey(e),r=o.isOwnedHold(e)?j(o.selectionColor(),o.canvasBackground(),.55):n?o.categoryColor(n):o.selectionColor();t.stroke(B(r,s))}rest(){let e=!1;for(let[t,o]of this.markers){let s=On(o);s&&(this.paintHalo(t,s),s.scale({x:1,y:1}),s.opacity(1),e=!0)}for(let t of this.beaconRings)t.scale({x:1,y:1}),t.opacity(1),e=!0;e&&!this.host.isDestroyed()&&this.host.overlayLayer.batchDraw()}frame(){if(this.host.isDestroyed()||!this.targets.length)return this.stop(),!1;let t=performance.now();if(t-this.lastFrameAt<pc)return!1;this.lastFrameAt=t;let o=t-this.startedAt;for(let s of this.targets){let{scale:n,opacity:r}=Sn(o,s.phase);s.node.scale({x:n,y:n}),s.node.opacity(r)}return!0}pageVisible(){return typeof document>"u"?!0:document.visibilityState==="visible"}bindVisibility(){this.visibilityBound||typeof document>"u"||(document.addEventListener("visibilitychange",this.onVisibilityChange),this.visibilityBound=!0)}unbindVisibility(){!this.visibilityBound||typeof document>"u"||(document.removeEventListener("visibilitychange",this.onVisibilityChange),this.visibilityBound=!1)}};import{Group as fc}from"konva/lib/Group";import{Circle as Dn}from"konva/lib/shapes/Circle";import{Text as mc}from"konva/lib/shapes/Text";var si=28,yc=12,gc="800",bc=44;function Gn(i){if(i.rung==="seats")return[];let e=new Map,t=new Map(i.zones.map(s=>[s.id,s.name])),o=new Map(i.zones.map(s=>[s.id,s.anchor]));for(let s of i.sections){let n=i.ownedSeatIds(s);if(!n.length)continue;let r=i.rung==="zones"&&s.zone!=null&&t.has(s.zone),l=r?s.zone:s.logicalId,a=e.get(l);if(a){a.count+=n.length;continue}e.set(l,{id:l,kind:r?"zone":"section",name:r?t.get(s.zone):i.sectionName(s),count:n.length,seatId:n[0],anchor:r?o.get(s.zone):i.sectionAnchor(s)})}return[...e.values()]}function Sc(i,e){return H("map.beaconAria",{seats:Rn("picker.seatCount",i),name:e})}var vc="selection-beacon-ring",ni=class{constructor(e){this.group=null;this.buttons=[];this.centres=[];this.rings=[];this.targets=[];this.signature="";this.host=e}breathingRings(){return this.rings}current(){return this.targets}sync(e){let t=Math.max(this.host.stageScale(),1e-4),o=`${t.toFixed(4)}|${e.map(a=>`${a.id}:${a.count}:${a.seatId}`).join(",")}`;if(o===this.signature&&this.buttons.length===e.length){this.targets=e,this.repositionButtons();return}if(this.clear(),this.signature=o,this.targets=e,!e.length){this.host.overlayLayer.batchDraw();return}let s=si/2/t,n=this.host.accent(),r=this.host.accentInk(),l=new fc({listening:!1,name:"selection-beacons"});for(let a of e){let c={x:a.anchor.x,y:a.anchor.y-s*1.6},h=new Dn({name:vc,x:c.x,y:c.y,radius:s*1.25,stroke:B(n,.55),strokeWidth:Math.max(1,s*.22),listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});l.add(h),l.add(new Dn({name:"selection-beacon-disc",x:c.x,y:c.y,radius:s,fill:n,stroke:B(r,.28),strokeWidth:1/t,listening:!1,perfectDrawEnabled:!1}));let d=new mc({x:c.x,y:c.y,text:String(a.count),fontSize:yc/t,fontStyle:gc,fontFamily:this.host.labelFont(),fill:r,listening:!1,perfectDrawEnabled:!1});d.offsetX(d.width()/2),d.offsetY(d.height()/2),l.add(d),this.rings.push(h),this.centres.push(c),this.buttons.push(this.buildButton(a,c))}this.host.overlayLayer.add(l),l.moveToTop(),this.group=l,this.host.overlayLayer.batchDraw()}clear(){this.group?.destroy(),this.group=null,this.rings=[],this.targets=[],this.centres=[],this.signature="";for(let e of this.buttons)e.remove();this.buttons=[]}repositionButtons(){for(let e=0;e<this.buttons.length;e+=1){let t=this.buttons[e],o=this.host.worldToScreen(this.centres[e]),s=t.offsetWidth||parseFloat(t.style.width)||si;t.style.left=`${o.x-s/2}px`,t.style.top=`${o.y-s/2}px`}}buildButton(e,t){let o=this.host.worldToScreen(t),s=typeof globalThis.matchMedia=="function"&&globalThis.matchMedia("(pointer: coarse)").matches,n=Math.max(si,s?bc:si),r=document.createElement("button");return r.type="button",r.className="sl-beacon",r.dataset.beacon=e.id,r.setAttribute("aria-label",Sc(e.count,e.name)),Object.assign(r.style,{position:"absolute",left:`${o.x-n/2}px`,top:`${o.y-n/2}px`,width:`${n}px`,height:`${n}px`,padding:"0",margin:"0",border:"none",borderRadius:"50%",background:"transparent",cursor:"pointer",touchAction:"manipulation",zIndex:"3"}),r.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),this.host.activate(e)}),r.addEventListener("pointerdown",l=>l.stopPropagation()),this.host.container.appendChild(r),r}};function qi(i,e){let t=i.width(),o=i.height(),s=1/0,n=1/0,r=-1/0,l=-1/0,a=t*2,c=o*2;for(let h of e){let d=h.getClientRect();if(!(!(d.width>1)||!(d.height>1))){if(d.x<-a||d.y<-c||d.x+d.width>t+a||d.y+d.height>o+c)return null;d.x<s&&(s=d.x),d.y<n&&(n=d.y),d.x+d.width>r&&(r=d.x+d.width),d.y+d.height>l&&(l=d.y+d.height)}}return isFinite(s)?{x:s,y:n,width:r-s,height:l-n}:null}var Nn=8,wc=.02,Hn=1,Wn=.5;function Vn(i,e,t,o){let s=t??{x:0,y:0,width:i.width(),height:i.height()},n=qi(i,e);if(!n)return 0;Zi(i,n,s);let r=Math.min((s.width-2*Nn)/n.width,(s.height-2*Nn)/n.height);if(!(r>0))return 1;let l=Math.max(n.width-s.width,n.height-s.height),a=l>Wn?r:Math.min(r,Lc(i.scaleX(),o));if(!(a>1+wc)&&!(l>Wn)||!(a>0)||a===1)return 1;let c=s.x+s.width/2,h=s.y+s.height/2;i.scale({x:i.scaleX()*a,y:i.scaleY()*a}),i.position({x:c+(i.x()-c)*a,y:h+(i.y()-h)*a});let d=qi(i,e);return d&&Zi(i,d,s),a}function Kn(i,e,t){let o=t??{x:0,y:0,width:i.width(),height:i.height()},s=qi(i,e);return s?Zi(i,s,o):!1}function Lc(i,e){let t=Math.max(i,1e-9);return(e!=null&&e>t?Math.min(Hn,e):Hn)/t}function Zi(i,e,t){let o=t.x+t.width/2-(e.x+e.width/2),s=t.y+t.height/2-(e.y+e.height/2);return o===0&&s===0?!1:(i.position({x:i.x()+o,y:i.y()+s}),!0)}function ji(i){return`${i.x()},${i.y()},${i.scaleX()}`}import{Group as kc}from"konva/lib/Group";import{Circle as zn}from"konva/lib/shapes/Circle";import{Line as Cc}from"konva/lib/shapes/Line";import{Text as xc}from"konva/lib/shapes/Text";var Tc=6;function Qi(i){return F(i)?"#0b1220":"#ffffff"}function Xn(i){let{points:e}=i;if(!e.length)return null;let t=i.categoryColor??"#6e7bff",o=0,s=0;for(let n of e)o+=n.x,s+=n.y;return{count:e.length,centroid:{x:o/e.length,y:s/e.length},fill:t,ink:Qi(t)}}var ri=class{constructor(e){this.group=null;this.badges=[];this.host=e}anchorFor(e){for(let t of this.host.sections()){if(t.logicalId!==e&&t.id!==e)continue;let o=Xn({points:this.host.ownedPoints(t),categoryColor:null});if(o)return o.centroid}return null}badgeAt(e){for(let t of this.badges)if(Math.hypot(e.x-t.centre.x,e.y-t.centre.y)<=t.radius)return t.id;return null}sync(e,t="seats"){if(this.group?.destroy(),this.group=null,this.badges=[],e>=ve){this.host.overlayLayer.batchDraw();return}let o=Math.max(this.host.stageScale(),1e-4),s=new kc({listening:!1,name:"owned-sections"}),n=new Set;for(let r of this.host.sections()){let l=this.host.ownedPoints(r),a=Xn({points:l,categoryColor:this.host.sectionColor(r)});if(!a)continue;let c=Math.max(Tc/2/o,1);for(let m of l)s.add(new zn({name:"owned-seat-dot",x:m.x,y:m.y,radius:c,fill:a.fill,stroke:B("#ffffff",.55),strokeWidth:Math.max(.5,c*.28),shadowColor:a.fill,shadowBlur:c*2.4,shadowOpacity:.7,listening:!1,perfectDrawEnabled:!1}));if(t!=="seats"||n.has(r.logicalId))continue;n.add(r.logicalId);let h=this.host.sections().filter(m=>m.logicalId===r.logicalId).reduce((m,p)=>m+this.host.ownedPoints(p).length,0),d=this.host.labelAnchor(r),u=11/o,f={x:d.x,y:d.y-u*2.1};s.add(new zn({name:"owned-section-badge",x:f.x,y:f.y,radius:u,fill:a.fill,stroke:B(a.ink,.35),strokeWidth:1/o,listening:!1,perfectDrawEnabled:!1})),s.add(new Cc({x:f.x-u*.62,y:f.y,points:[-u*.22,0,-u*.02,u*.2,u*.34,-u*.26],stroke:a.ink,strokeWidth:Math.max(.6,u*.16),lineCap:"round",lineJoin:"round",listening:!1}));let y=new xc({x:f.x+u*.12,y:f.y-u*.5,text:String(h),fontSize:u,fontStyle:"800",fontFamily:this.host.labelFont(),fill:a.ink,listening:!1,perfectDrawEnabled:!1});s.add(y),this.badges.push({id:r.logicalId,centre:f,radius:u*1.8})}if(!s.hasChildren()){s.destroy(),this.host.overlayLayer.batchDraw();return}this.host.overlayLayer.add(s),s.moveToTop(),this.group=s,this.host.overlayLayer.batchDraw()}};function K(i){let e=ss(i);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 Je(i,e,t,o){let s=o*Math.PI/180,n=Math.cos(s),r=Math.sin(s);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(l=>({x:i.x+l.x*n-l.y*r,y:i.y+l.x*r+l.y*n}))}function ai(i,e,t,o,s,n){let r=o*Math.PI/180,l=Math.cos(r),a=Math.sin(r);for(let c=0;c<=4;c++)for(let h=0;h<=6;h++){let d=e*(h/6-.5),u=t*(c/4-.5),f={x:i.x+d*l-u*a,y:i.y+d*a+u*l};if(!oe(f,s,n))return!1}return!0}function Yn(i,e,t){let o=K(i),s=[t];for(let r=1;r<12;r+=1)for(let l=1;l<12;l+=1){let a={x:o.x+o.width*l/12,y:o.y+o.height*r/12};oe(a,i,e)&&s.push(a)}let n=[i,...e];return s.map(r=>({point:r,room:No(r,n)})).sort((r,l)=>l.room-r.room).map(r=>r.point).filter((r,l,a)=>l===a.findIndex(c=>Math.abs(c.x-r.x)<1e-6&&Math.abs(c.y-r.y)<1e-6))}function Un(i,e){let{stageScale:t,stageX:o,stageY:s}=i;if(i.viewMode==="perspective"&&e.perspectiveAffine)return K(e.outline.map(r=>{let l=i.projectedSectionPoint(e,r);return{x:l.x*t+o,y:l.y*t+s}}));let n=e.liftWorld>0?i.isoLiftLocal(e.liftWorld):{x:0,y:0};return K(e.outline.map(r=>{let l={x:r.x+n.x,y:r.y+n.y},a=i.isoT===0?l:i.isoForward(l);return{x:a.x*t+o,y:a.y*t+s}}))}function Ic(i,e){let t=i.width*i.height;if(t<=0)return 0;let o=Math.max(0,Math.min(i.x+i.width,e.width)-Math.max(i.x,0)),s=Math.max(0,Math.min(i.y+i.height,e.height)-Math.max(i.y,0));return o*s/t}function $n(i){let{current:e,viewport:t}=i,o=new Map;for(let l of i.sections){let a=Ic(l.bounds,t)*l.members;a<=0||o.set(l.logicalId,(o.get(l.logicalId)??0)+a)}if(!o.size)return e;let s=null,n=0;for(let[l,a]of o)a>n&&(n=a,s=l);if(!s||s===e)return e;let r=e!=null?o.get(e)??0:0;return n>r*1.35?s:e}import{Text as Mc}from"konva/lib/shapes/Text";function Pc(i,e){return i.x<e.x+e.width&&e.x<i.x+i.width&&i.y<e.y+e.height&&e.y<i.y+i.height}var et=class{constructor(){this.cells=new Map}insert(e){for(let t of this.keys(e)){let o=this.cells.get(t);o?o.push(e):this.cells.set(t,[e])}}collisionCount(e){let t=new Set,o=0;for(let s of this.keys(e))for(let n of this.cells.get(s)??[])t.has(n)||(t.add(n),Pc(e,n)&&o++);return o}keys(e){let t=Math.floor(e.x/dt),o=Math.floor((e.x+Math.max(0,e.width))/dt),s=Math.floor(e.y/dt),n=Math.floor((e.y+Math.max(0,e.height))/dt),r=[];for(let l=s;l<=n;l++)for(let a=t;a<=o;a++)r.push(`${a}:${l}`);return r}};function qn(i,e){let t=i.sections.filter(y=>y.id===e||y.logicalId===e),o=t.map(y=>{if(i.viewMode==="perspective"&&y.perspectiveAffine)return K(y.outline.map(g=>i.projectedSectionPoint(y,g)));let m=y.liftWorld>0?i.isoLiftLocal(y.liftWorld):{x:0,y:0},p=y.outline.map(g=>{let b={x:g.x+m.x,y:g.y+m.y};return i.isoT===0?b:i.isoForward(b)});return K(p)});if(!o.length)return null;let s=Math.min(...o.map(y=>y.x)),n=Math.min(...o.map(y=>y.y)),r=Math.max(...o.map(y=>y.x+y.width)),l=Math.max(...o.map(y=>y.y+y.height)),a=new Set(t.flatMap(y=>y.memberIds));for(let y of a){let m=i.seatById.get(y);if(!m)continue;let p=i.renderedSeatPoint(m);s=Math.min(s,p.x-i.seatR),n=Math.min(n,p.y-i.seatR),r=Math.max(r,p.x+i.seatR),l=Math.max(l,p.y+i.seatR)}let c=y=>{[y.x,y.y,y.width,y.height].every(Number.isFinite)&&(s=Math.min(s,y.x),n=Math.min(n,y.y),r=Math.max(r,y.x+y.width),l=Math.max(l,y.y+y.height))},h=y=>{let m={x:y.x+y.width/2,y:y.y+y.height/2};return t.some(p=>oe(m,p.outline,p.holes))};for(let{node:y,backdrop:m}of i.freeTextById.values()){let p=y.getClientRect({relativeTo:i.bgLayer,skipShadow:!0});h(p)&&(c(p),m&&c(m.getClientRect({relativeTo:i.bgLayer,skipShadow:!0})))}for(let{node:y}of i.iconNodeById.values()){let m=y.getClientRect({relativeTo:i.bgLayer,skipShadow:!0});h(m)&&c(m)}let d=new et;for(let{node:y}of i.freeTextById.values()){let m=y.getClientRect({relativeTo:i.bgLayer,skipShadow:!0,skipStroke:!0});d.insert({x:m.x-Q,y:m.y-Q,width:m.width+Q*2,height:m.height+Q*2})}for(let y of i.rowLabelPlan){let m=(y.focusKeys??[]).some(S=>S===e||t.some(v=>S===v.id||S===v.logicalId)),p=new Mc({text:y.text,fontSize:y.fontSize,fontStyle:"700",fontFamily:i.labelFont(),rotation:y.rotation,listening:!1});p.offsetX(p.width()/2),p.offsetY(p.height()/2);let g=i.resolveAutomaticRowLabelPosition(p,y,d),b=i.rowLabelBox(p,g);m&&c(b),d.insert(b),p.destroy()}let u=Math.max(r-s,l-n),f=Math.max(i.seatR*2,Math.min(24,u*.025));return{x:s-f,y:n-f,width:Math.max(1,r-s+f*2),height:Math.max(1,l-n+f*2)}}import{Rect as Rc}from"konva/lib/shapes/Rect";import{Text as Zn}from"konva/lib/shapes/Text";var Ji="\0";function Ac(i){let t=[...H("map.fromPrice",{price:Ji}).toLocaleLowerCase()],o=t.findIndex(s=>s!==Ji&&s.toLocaleUpperCase()!==s.toLocaleLowerCase());return o>=0&&(t[o]=t[o].toLocaleUpperCase()),t.join("").split(Ji).join(i)}function jn(i,e){if(!e.zones?.length||!i.sections.length)return;let t=pn(i.canvasBackground),o=new Map;for(let s of i.sections)s.zone&&(o.get(s.zone)??o.set(s.zone,[]).get(s.zone)).push(s);for(let s of e.zones){let n=o.get(s.id);if(!n||!n.length)continue;let r=n[0];for(let p of n)p.centroid.y<r.centroid.y&&(r=p);let l=r.centroid.x,a=r.centroid.y,c=1/0,h=-1/0;for(let p of n)for(let g of p.outline)g.x<c&&(c=g.x),g.x>h&&(h=g.x);let d=isFinite(c)&&h>c?h-c:0,u=1/0;for(let p of n)for(let g of p.memberIds){let b=i.seatById.get(g),S=b&&i.catPrice.get(b.categoryKey);typeof S=="number"&&S<u&&(u=S)}let f=new Rc({x:l,y:a,width:1,height:1,offsetX:.5,offsetY:.5,cornerRadius:1,fill:t.plate,stroke:B(s.color??r.outlineTint,Us),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});i.bgLayer.add(f);let y=new Zn({x:l,y:a,text:s.label,fontSize:Xt,fontStyle:Hs,letterSpacing:0,fontFamily:i.labelFont(),fill:t.ink,opacity:0,listening:!1,perfectDrawEnabled:!1});y.offsetX(y.width()/2),y.offsetY(y.height()/2),i.bgLayer.add(y);let m=null;isFinite(u)&&(m=new Zn({x:l,y:a,text:Ac(mt(u,i.currency)),fontSize:Yt,fontStyle:Ws,fontFamily:i.labelFont(),fill:t.subInk,opacity:0,listening:!1,perfectDrawEnabled:!1}),m.offsetX(m.width()/2),i.bgLayer.add(m)),i.zones.push({id:s.id,anchor:{x:l,y:a},back:f,background:t.plate,name:s.label,spanWorld:d,label:y,sub:m})}}import{Circle as Gc}from"konva/lib/shapes/Circle";import{Line as Nc}from"konva/lib/shapes/Line";import{Rect as Hc}from"konva/lib/shapes/Rect";import{Text as Wc}from"konva/lib/shapes/Text";function Le(i,e){return e.length===0?!!i.accessible:!!i.accessibility?.some(t=>e.includes(t))}function tt(i,e){return Le(i,e)?"match":i.accessibility?.includes("companion")?"companion":"other"}var Qn=.35,Jn=.7,it="#0b1220",gt="#ffffff",er="#0b1220",tr="#232c40",ir="#8b93a7";function eo(i,e,t="normal"){let o=i?"bold":t;return e?`italic ${o}`.trim():o}var to="#f7f8fb";import{Shape as _c}from"konva/lib/Shape";import{Circle as Bc}from"konva/lib/shapes/Circle";import{Rect as Fc}from"konva/lib/shapes/Rect";var Ec={M:2,L:2,Q:4,C:6,Z:0},io=new Map;function oo(i){let e=io.get(i);if(e)return e;let t=Gt(i);if(!t)return io.set(i,[]),[];let o=t.match(/[MLQCZ]|-?(?:\d+(?:\.\d+)?|\.\d+)/g)??[],s=[],n=0;for(;n<o.length;){let r=o[n++],l=Ec[r];if(l===void 0||n+l>o.length)throw new Error(`Invalid path data for seat glyph "${i}".`);let a=o.slice(n,n+l).map(Number);if(a.some(c=>!Number.isFinite(c)))throw new Error(`Invalid coordinate in seat glyph "${i}".`);n+=l,r==="M"||r==="L"?s.push({command:r,points:a}):r==="Q"?s.push({command:r,points:a}):r==="C"?s.push({command:r,points:a}):s.push({command:"Z",points:[]})}return io.set(i,s),s}function or(i,e,t,o=0,s=0){let n=oo(e),r=ns(e).bounds;if(!n.length||!r||!(t>0))return!1;let l=rs(r,t);i.save(),i.translate(o,s),i.scale(l.scale,l.scale),i.translate(-l.centreX,-l.centreY);for(let a of n)a.command==="M"?i.moveTo(a.points[0],a.points[1]):a.command==="L"?i.lineTo(a.points[0],a.points[1]):a.command==="Q"?i.quadraticCurveTo(a.points[0],a.points[1],a.points[2],a.points[3]):a.command==="C"?i.bezierCurveTo(a.points[0],a.points[1],a.points[2],a.points[3],a.points[4],a.points[5]):i.closePath();return i.restore(),!0}function sr(i,e){i.beginPath(),i.arc(0,0,e,0,Math.PI*2,!1),i.closePath()}var bt=class extends _c{_sceneFunc(e){let t=this.attrs.seatRadius||1,o=this.attrs.seatGlyph,s=oo(o),n=this.attrs.seatGlyphDetail,r;if(n===void 0){let l=this.getAbsoluteScale(),a=Math.max(Math.abs(l.x),Math.abs(l.y)),c=Number.isFinite(a)&&a>0?a:1;r=t*2*c>=16}else r=n;if(!s.length||!r){sr(e,t),e.fillStrokeShape(this);return}e.beginPath(),or(e,o,t),e.fillStrokeShape(this)}_hitFunc(e){sr(e,this.attrs.seatRadius||1),e.fillStrokeShape(this)}getSelfRect(){let e=this.attrs.seatRadius||1;return{x:-e,y:-e,width:e*2,height:e*2}}};function Oc(i,e){return i==="circle"||!Gt(i)?null:new bt({x:e.x,y:e.y,seatRadius:e.radius,seatGlyph:i,...e.detail===void 0?{}:{seatGlyphDetail:e.detail},...e.fill?{fill:e.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function nr(i){let{x:e,y:t,radius:o}=i;return i.wheelchairBay?new Fc({x:e,y:t,width:o*2,height:o*2,offsetX:o,offsetY:o,cornerRadius:2,...i.fill?{fill:i.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}):Oc(i.glyph,{x:e,y:t,radius:o,detail:i.detail,fill:i.fill})??new Bc({x:e,y:t,radius:o,...i.fill?{fill:i.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function Dc(i,e){return i*2*e>=16}function rr(i,e,t,o){let s=Dc(e,t);if(s===o||!i.length)return s;for(let n of i)n.setAttr("seatGlyphDetail",s);return s}function ar(i){let e=[...i.seats].sort((t,o)=>(i.perspectiveSeatDepth.get(o.id)??0)-(i.perspectiveSeatDepth.get(t.id)??0));for(let t of e){if(t.kind==="booth"){Vc(i,t);continue}let o=i.seatContainer(t.id),s=nr({x:t.x,y:t.y,radius:i.seatR,detail:i.seatGlyphDetail,glyph:as(t.glyph,i.catByKey.get(t.categoryKey)),wheelchairBay:t.wheelchairSpaceType==="no-seat"});if(s instanceof bt&&i.glyphMarkers.push(s),s.setAttr("seatId",t.id),i.circleById.set(t.id,s),i.paintSeat(s,t.id),o.add(s),t.accessible){if(t.wheelchairSpaceType!=="no-seat"){let n=new Gc({x:t.x,y:t.y,radius:i.seatR+1.5,stroke:It(t.accessibility),strokeWidth:2.5,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});i.accessRingById.set(t.id,n),o.add(n)}if(t.accessibility?.includes("wheelchair")&&Ft(t.accessibility)){let n=i.buildAccessGlyph(t,typeof s.fill()=="string"?s.fill():"");i.accessGlyphById.set(t.id,n),o.add(n)}}}}function Vc(i,e){let t=i.seatContainer(e.id),o=i.boothDims.get(e.rowId)??{width:40,height:30,rotation:0},s=e.x,n=e.y,r;o.points&&o.points.length>=3?(r=new Nc({x:e.x,y:e.y,points:o.points.flatMap(a=>[a.x,a.y]),closed:!0,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),s=e.x+o.points.reduce((a,c)=>a+c.x,0)/o.points.length,n=e.y+o.points.reduce((a,c)=>a+c.y,0)/o.points.length):r=new Hc({x:e.x,y:e.y,width:o.width,height:o.height,offsetX:o.width/2,offsetY:o.height/2,rotation:o.rotation,cornerRadius:4,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),r.setAttr("seatId",e.id),i.circleById.set(e.id,r),t.add(r);let l=new Wc({x:s,y:n,text:e.displayLabel??e.label,fontSize:Re,fontStyle:"600",fontFamily:i.labelFont(),fill:i.theme.seatLabelColor??it,listening:!1,perfectDrawEnabled:!1});l.offsetX(l.width()/2),l.offsetY(l.height()/2),l.visible(!1),i.setHasBoothText(),i.boothLabelById.set(e.id,l),t.add(l),i.paintSeat(r,e.id)}function lr(i,e,t,o){let s=null,n=1/0,r=i.stage.scaleX()||1;for(let l of i.seats){if(!o?.includeUnavailable&&!i.selection.has(l.id)&&!i.isSelectable(l.id))continue;let a=i.worldToScreen(l),c=i.viewMode==="perspective"?i.perspectiveSeatScale.get(l.id)??1:1,h=i.seatR*r*c+t,d=Math.hypot(a.x-e.x,a.y-e.y);d<=h&&d<n&&(n=d,s=l.id)}return s}function cr(i){if(!i.objectFloor.size)return null;let e=i.stage.getPointerPosition();if(!e)return null;let t=i.screenToWorld(e),o=null,s=1/0;for(let n of i.seats){let r=i.renderedSeatPoint(n),l=r.x-t.x,a=r.y-t.y,c=l*l+a*a;c<s&&(s=c,o=n.rowId)}return o?i.objectFloor.get(o)??null:null}import{Circle as eh}from"konva/lib/shapes/Circle";import{Group as Ir}from"konva/lib/Group";import{Rect as th}from"konva/lib/shapes/Rect";import{Text as ih}from"konva/lib/shapes/Text";var ke=1.12;function ot(i,e,t,o){if(e.width<=0||e.height<=0)return i.scaleX();let s=o??{x:0,y:0,width:i.width(),height:i.height()},n=Math.min(s.width/(e.width*ke),s.height/(e.height*ke));return V(n,t.min,t.max)}function hr(i){let{stage:e,box:t,bounds:o,viewport:s,centreScreen:n}=i,r=i.ratio??ft,l=e.scaleX(),a=ot(e,t,o,s)/Math.max(l,1e-4);if(a>=r||a<=1/r)return!1;let c=n.x-(s.x+s.width/2),h=n.y-(s.y+s.height/2);return Math.hypot(c,h)<=Math.min(s.width,s.height)*.02}function dr(i,e,t,o){let s=V(e,o.min,o.max),n=i.scaleX();if(s===n)return!1;let r=(t.x-i.x())/n,l=(t.y-i.y())/n;return i.scale({x:s,y:s}),i.position({x:t.x-r*s,y:t.y-l*s}),!0}function ur(i,e,t,o,s){let n=s??{x:0,y:0,width:i.width(),height:i.height()},r=Math.min(n.width/(e.width*ke),n.height/(e.height*ke)),l=V(Math.max(r,o??t.min),t.min,t.max);i.scale({x:l,y:l}),i.position({x:n.x+n.width/2-(e.x+e.width/2)*l,y:n.y+n.height/2-(e.y+e.height/2)*l})}function pr(i,e){return i===null||e===null?i===e:i.size===e.size&&[...i].every(t=>e.has(t))}function fr(i,e){let t=null;for(let o of i){let s=e.get(o)?.logicalId;if(!s||t!=null&&t!==s)return null;t=s}return t}function mr(i,e){if(!e?.size)return!1;for(let t of i)if(e.has(t))return!1;return!0}function Sr(i,e){let t=i.sectionHeat.get(e.id)??i.sectionHeat.get(e.logicalId)??(e.zone?i.sectionHeat.get(e.zone):void 0);if(t==null||t<=0){e.outlinePoly.stroke(B(e.outlineTint,.5)),e.outlinePoly.fill(B(e.outlineTint,.08)),e.outlinePoly.strokeWidth(1.75),e.outlinePoly.shadowOpacity(0);return}let o=j("#f4b740","#ef4444",t);e.outlinePoly.stroke(B(o,.72+t*.25)),e.outlinePoly.fill(B(o,.08+t*.13)),e.outlinePoly.strokeWidth(2+t*3.5),e.outlinePoly.shadowColor(o),e.outlinePoly.shadowBlur(4+t*12),e.outlinePoly.shadowOpacity(.25+t*.45)}function no(i,e){return i.closedSections.has(e.id)||i.closedSections.has(e.logicalId)||e.zone!=null&&i.closedSections.has(e.zone)}function vr(i,e,t,o){if(!e)return 0;let s=0;for(let n of i){if(t(n)!=="free")continue;let r=o(n);r&&Le(r,e)&&(s+=1)}return s}function wr(i,e){return no(i,e)?"closed":e.total<=0?"normal":e.free<=0?"sold-out":e.free<=e.total*tn?"nearly-gone":"normal"}function Lr(i,e){let t=wr(i,e),o=i.accessFilterActive&&i.sectionAccessibleFree(e)<=0,s=dn(i.canvasBackground,t,o?null:e.shellCategoryColor);e.shellFill=s.fill,e.shellStroke=s.stroke,e.blockPoly.fill(s.fill),e.blockPoly.stroke(s.stroke),e.subLabel.text(t==="sold-out"?H("map.soldOut"):H("map.seatsLeft",{count:e.free})),e.subLabel.offsetX(e.subLabel.width()/2)}function ro(i,e){return j(e,F(i)?"#ffffff":"#000000",Js)}function ao(i,e,t=0){let o=Qs-t;return!e||i.length<=o?i:`${i.slice(0,Math.max(1,o-1)).trimEnd()}\u2026`}function Kc(i,e){return i.accessFilterActive&&i.sectionAccessibleFree(e)>0}function zc(i,e,t){let o=Kc(i,e),s=ao(e.label,t,o?2:0),n=o?`\u267F ${s}`:s;e.nameLabel.text()!==n&&e.nameLabel.text(n),e.nameLabel.fontStyle(t?Ut:Oe),e.nameLabel.letterSpacing(t?e.nameLabel.fontSize()*De:0)}function Xc(i,e,t){let o=i.stageWidth<ue,s=e.nameLabel.opacity();if(!o||s<=.05||!e.nameLabel.visible()){e.namePlate.opacity(0),e.subLabel.opacity(0);return}let n=e.nameLabel.rotation(),r=n===0&&wr(i,e)==="sold-out",l=pt/t,a=qt/t,c=r?2/t:0,h={x:e.nameLabel.x(),y:e.nameLabel.y()},d=e.nameLabel.height(),u=0;r?(Ie(e.subLabel,de/t,h.y),u=e.subLabel.height(),e.subLabel.rotation(0),e.subLabel.x(h.x),e.subLabel.y(h.y+d/2+c+u/2),e.subLabel.opacity(s)):e.subLabel.opacity(0);let f=r?c+u:0,y=Math.max(e.nameLabel.width(),r?e.subLabel.width():0)+l*2,m=d+f+a*2;e.namePlate.position({x:h.x,y:h.y+f/2}),e.namePlate.rotation(n),e.namePlate.size({width:y,height:m}),e.namePlate.offset({x:y/2,y:m/2}),e.namePlate.cornerRadius(en/t),e.namePlate.opacity(s*$t)}function kr(i,e){let t,o;i.reducedMotion?(t=e<=Se?1:0,o=e<=$e?1:0):(t=V((ve-e)/(ve-Se),0,1),o=V((Se-e)/(Se-$e),0,1)),(i.floorOverview||i.focusedSectionId)&&(t=0,o=0);let s=!i.floorOverview&&!i.focusedSectionId&&e<ce;s&&(t=1),i.zones.length||(o=0);let n=i.viewMode==="perspective"&&i.glideInProgress&&i.seatCount>2500;i.seatLayer.opacity(s||n?0:1-t);let r=i.stageScaleX,l=!i.glideInProgress&&(i.lodScale===0||Math.abs(e-i.lodScale)/(i.lodScale||1)>.08);l&&i.setLodScale(e);let a=i.focusedSectionId,c=i.stageWidth<ue,h=te(i.canvasBackground),d=V((t-.2)/.8,0,1);for(let f of i.sections){let y=i.hasFocusDimOverlay?1:a&&f.id!==a&&f.logicalId!==a&&f.zone!==a?Ge:1,m=Math.min(y,mr(f.memberCategoryKeys,i.categoryFilter)?Ge:1);f.outlinePoly.opacity(s?0:(1-t)*m),f.blockPoly.opacity(Ds*t*m);let p=i.sectionIsOwned(f);f.blockPoly.stroke(p?i.selectionColor:f.shellStroke||h.sectionStroke),f.blockPoly.strokeWidth((p?Gs:Fe)/Math.max(r,1e-4));let g=f.blockPoly.fill(),b=typeof g=="string"?g:f.baseFill,S=c?ro(i.canvasBackground,b):null;S&&f.namePlate.fill(S);let v=Ee(S??b,f.explicitInk,f.preferredInk);f.nameLabel.fill(v),f.subLabel.fill(v),zc(i,f,c),l&&d>.01&&$c(i,f,r),f.nameLabel.opacity(f.nameLabelFits?d*(1-o)*m:0),f.subLabel.opacity(0)}let u=o*(1-i.isoT);for(let f of i.zones){let y=f.label.visible()?u:0;f.back.opacity(y),f.label.opacity(y),f.sub&&f.sub.opacity(yr(i,f)?0:y),l&&qc(i,f,r)}if(!i.glideInProgress&&(d>.01||u>.01)){Uc(i,r),Yc(i.sections);for(let f of i.zones){let y=f.label.opacity();f.back.opacity(y),f.sub&&f.sub.opacity(yr(i,f)?0:y)}}for(let f of i.sections)Xc(i,f,r);i.bgLayer.batchDraw()}function yr(i,e){return i.stageWidth<ue||!e.sub||!e.sub.visible()}function Yc(i){let e=new Map;for(let t of i)(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 o=t.filter(s=>s.nameLabel.opacity()>.05).sort((s,n)=>{let r=K(s.outline),l=K(n.outline);return l.width*l.height-r.width*r.height});for(let s of o.slice(1))s.nameLabel.opacity(0)}}function Uc(i,e){let o=[],s=a=>{let c=i.worldToScreen({x:a.x(),y:a.y()}),h=K(Je({x:0,y:0},a.width()*e,a.height()*e,a.rotation()));return{x:c.x-h.width/2,y:c.y-h.height/2,w:h.width,h:h.height}};for(let a of i.zones){if(a.label.opacity()<=.05)continue;let c=a.back.getAbsolutePosition(),h=a.back.width()*e,d=a.back.height()*e;o.push({node:a.label,tier:0,section:!1,zone:a,box:{x:c.x-h/2,y:c.y-d/2,w:h,h:d}})}for(let a of i.sections)a.nameLabel.opacity()>.05&&o.push({node:a.nameLabel,tier:1,section:!0,area:a.labelArea,box:s(a.nameLabel)});let n=i.landmarks.map(a=>{let c=i.worldToScreen({x:a.x,y:a.y}),h=i.worldToScreen({x:a.x+a.width,y:a.y+a.height});return{x:Math.min(c.x,h.x),y:Math.min(c.y,h.y),w:Math.abs(h.x-c.x),h:Math.abs(h.y-c.y)}});if(o.length<2&&!n.length)return;o.sort((a,c)=>a.tier-c.tier||(c.area??0)-(a.area??0)||a.box.y-c.box.y||a.box.x-c.box.x);let r=[...n],l=a=>r.some(c=>a.x<c.x+c.w+4&&c.x<a.x+a.w+4&&a.y<c.y+c.h+4&&c.y<a.y+a.h+4);for(let a of o){if(!l(a.box)){r.push(a.box);continue}let c=!1;if(a.zone)for(let h of Zs){if(h===0)continue;let d={...a.box,y:a.box.y+h};if(!l(d)){so(a.zone,0,h/e),r.push(d),c=!0;break}}if(a.section){let h=a.node.fontSize(),d=a.node.y(),u=a.node.letterSpacing()>0;for(let f of Di){let y=h*f;if(y*e<de)break;Ie(a.node,y,d),u&&(a.node.letterSpacing(a.node.fontSize()*De),a.node.offsetX(a.node.width()/2));let m=s(a.node);if(!l(m)){r.push(m),c=!0;break}}c||(Ie(a.node,h,d),u&&(a.node.letterSpacing(a.node.fontSize()*De),a.node.offsetX(a.node.width()/2)))}c||a.node.opacity(0)}}function Ie(i,e,t){i.fontSize(Math.max(1,e)),i.offsetX(i.width()/2),i.offsetY(i.height()/2),i.y(t)}function $c(i,e,t){e.subLabelFits=!1;let o=i.stageWidth<ue,s=o?pt*2:0,n=Ze(qe*e.labelScale,i.stageWidth),r=de;for(let l=n;l>=r;l-=1)for(let a of[0,-90]){e.nameLabel.rotation(a),Ie(e.nameLabel,l/t,e.nameLabel.y()),o&&(e.nameLabel.letterSpacing(e.nameLabel.fontSize()*De),e.nameLabel.offsetX(e.nameLabel.width()/2));for(let c of e.labelAnchors){e.nameLabel.position(c);let h=(8+s)/t;if(ai(c,e.nameLabel.width()+h,e.nameLabel.height()+h,a,e.outline,e.holes)){e.nameLabelFits=!0;return}}}e.nameLabel.position(e.centroid),e.nameLabel.rotation(0),e.nameLabelFits=!1}function gr(i,e,t){let o=s=>(i.text(s),i.width());if(!(o(e)<=t)){for(let s=e.length-1;s>=1;s-=1)if(o(`${e.slice(0,s).trimEnd()}\u2026`)<=t)return;o("\u2026")}}function qc(i,e,t){let o=Gi(i.stageWidth),s=i.stageWidth<ue,n=e.sub!=null&&!s,r=(s?Vs:zs)*o/t,l=(s?Ks:Xs)*o/t,a=Ze(Xt,i.stageWidth);e.label.text(e.name),Ie(e.label,a/t,e.anchor.y),n&&(Ie(e.sub,Ze(Yt,i.stageWidth)/t,e.anchor.y),e.sub.letterSpacing(e.sub.fontSize()*Ns),e.sub.offsetX(e.sub.width()/2));let c=s?i.stageWidth*$s/t-r*2:1/0,h=!s&&e.spanWorld>0?e.spanWorld*qs-r*2:1/0,d=Math.min(c,h),u=()=>Math.max(e.label.width(),n?e.sub.width():0);if(n&&u()>d&&(n=!1),u()>d)for(let k of Di){let C=Math.max(de,a*k);if(C>=e.label.fontSize()*t-.001||(Ie(e.label,C/t,e.anchor.y),e.label.width()<=d))break}if(e.label.width()>d&&(gr(e.label,e.name,Math.max(d,1)),Zc(e.label.text())<jc(e.name)&&gr(e.label,e.name,Math.max(c,1)),Ie(e.label,e.label.fontSize(),e.anchor.y)),e.sub&&e.sub.visible(n),c<=0||e.label.width()>c+.001){br(e);return}e.label.visible(!0),e.back.visible(!0);let f=n?3*o/t:0;e.label.x(e.anchor.x),n?e.sub.x(e.anchor.x):e.sub&&e.sub.opacity(0);let y=Math.max(e.label.width(),n?e.sub.width():0)+r*2,m=e.label.height()+(n?f+e.sub.height():0)+l*2;e.label.y(e.anchor.y-(n?(f+e.sub.height())/2:0)),n&&e.sub.y(e.anchor.y+(e.label.height()+f)/2),e.back.position(e.anchor),e.back.size({width:y,height:m}),e.back.offset({x:y/2,y:m/2}),e.back.cornerRadius(Ys*o/t),e.back.strokeWidth(1/t);let p=e.back.getAbsolutePosition(),g=6,b=y*t;if(b>i.stageWidth-g*2){br(e);return}let S=b/2,L=(V(p.x,g+S,i.stageWidth-g-S)-p.x)/t;Math.abs(L)>.001&&so(e,L,0);let w=62+m*t/2;p.y<w&&so(e,0,(w-p.y)/t)}function Zc(i){return i.endsWith("\u2026")?i.slice(0,-1).trimEnd().length:i.length}function jc(i){return Math.min(i.length,Math.max(6,Math.ceil(i.length/2)))}function br(i){i.label.visible(!1),i.label.opacity(0),i.back.visible(!1),i.back.opacity(0),i.sub&&(i.sub.visible(!1),i.sub.opacity(0))}function so(i,e,t){i.label.x(i.label.x()+e),i.label.y(i.label.y()+t),i.sub&&(i.sub.x(i.sub.x()+e),i.sub.y(i.sub.y()+t)),i.back.x(i.back.x()+e),i.back.y(i.back.y()+t)}function Qc(i,e){if(!i.length)return null;let t=1/0,o=1/0,s=-1/0,n=-1/0;for(let r of i)!Number.isFinite(r.x)||!Number.isFinite(r.y)||(r.x<t&&(t=r.x),r.y<o&&(o=r.y),r.x>s&&(s=r.x),r.y>n&&(n=r.y));return!Number.isFinite(t)||!Number.isFinite(o)?null:{x:t-e,y:o-e,width:s-t+e*2,height:n-o+e*2}}function ho(i,e=0){let t=new Map;for(let s of i){let n=`${s.rowId}|${s.categoryKey}`,r=t.get(n);r||(r={categoryKey:s.categoryKey,points:[]},t.set(n,r)),r.points.push({x:s.x,y:s.y})}let o=[];for(let[s,n]of t){let r=Qc(n.points,e);r&&o.push({id:s,categoryKey:n.categoryKey,seatCount:n.points.length,bounds:r})}return o}function lo(i,e){let t=Math.max(0,Math.max(i.x-(e.x+e.width),e.x-(i.x+i.width))),o=Math.max(0,Math.max(i.y-(e.y+e.height),e.y-(i.y+i.height)));return Math.hypot(t,o)}function co(i,e){let t=Math.min(i.x,e.x),o=Math.min(i.y,e.y);return{x:t,y:o,width:Math.max(i.x+i.width,e.x+e.width)-t,height:Math.max(i.y+i.height,e.y+e.height)-o}}function Cr(i){if(!i.length)return 0;let e=[...i].sort((o,s)=>o-s),t=Math.floor(e.length/2);return e.length%2?e[t]:(e[t-1]+e[t])/2}function Jc(i){if(!i.length)return 0;let e=Cr(i.map(o=>Math.min(o.bounds.width,o.bounds.height)));if(i.length<2)return e;let t=[];for(let o=0;o<i.length;o+=1){let s=1/0;for(let n=0;n<i.length;n+=1)o!==n&&(s=Math.min(s,lo(i[o].bounds,i[n].bounds)));Number.isFinite(s)&&t.push(s)}return Cr(t)+e}function uo(i,e){if(!i.length)return[];let t=Jc(i)*(e?.gapRows??2),o=e?.minRows??2,s=e?.minSeats??12,n=new Map;for(let l of i){let a=n.get(l.categoryKey);a?a.push(l):n.set(l.categoryKey,[l])}let r=[];for(let[l,a]of n){let c=[...a].sort((u,f)=>u.bounds.y-f.bounds.y||u.bounds.x-f.bounds.x||u.id.localeCompare(f.id)),h=[];for(let u of c){let f=h.find(y=>lo(y.bounds,u.bounds)<=t);f?(f.bounds=co(f.bounds,u.bounds),f.rowIds.push(u.id),f.seatCount+=u.seatCount):h.push({categoryKey:l,bounds:{...u.bounds},rowIds:[u.id],seatCount:u.seatCount})}let d=!0;for(;d&&h.length>1;){d=!1;e:for(let u=0;u<h.length;u+=1)for(let f=u+1;f<h.length;f+=1)if(!(lo(h[u].bounds,h[f].bounds)>t)){h[u].bounds=co(h[u].bounds,h[f].bounds),h[u].rowIds.push(...h[f].rowIds),h[u].seatCount+=h[f].seatCount,h.splice(f,1),d=!0;break e}}for(let u of h)u.rowIds.length<o&&u.seatCount<s||(u.rowIds.sort(),r.push(u))}return r.sort((l,a)=>l.bounds.y-a.bounds.y||l.bounds.x-a.bounds.x||l.categoryKey.localeCompare(a.categoryKey)),r}function xr(i){let e=null;for(let t of i)e=e?co(e,t.bounds):{...t.bounds};return e}function Tr(i,e){let t=null,o=1/0;for(let s of i){let{x:n,y:r,width:l,height:a}=s.bounds;if(e.x<n||e.x>n+l||e.y<r||e.y>r+a)continue;let c=l*a;c<o&&(t=s,o=c)}return t}function Rr(i){return i*.3}function Pr(i){return Rr(i)*2+i*.42}var li=class{constructor(e){this.host=e;this.group=null;this.labels=[];this.revealed=!1;this.visible=!1;this.fadeRaf=0;this.lastFontKey=""}get all(){return this.labels.map(e=>e.cluster)}clear(){this.fadeRaf&&(cancelAnimationFrame(this.fadeRaf),this.fadeRaf=0),this.group?.destroy(),this.group=null,this.labels=[],this.visible=!1,this.revealed=!1,this.lastFontKey=""}destroy(){this.clear()}rebuild(){if(this.clear(),this.syncCursor(!1),this.host.hasSections()||this.host.exportMode)return;let e=uo(ho(this.host.seats(),this.host.seatR()));if(!e.length)return;let t=this.host.canvasBackground(),o=te(t),s=ro(t,t),n=re(s,o.sectionInk),r=new Ir({listening:!1,opacity:0,visible:!1});for(let l of e){let a=this.host.categoryLabel(l.categoryKey);if(!a)continue;let c={x:l.bounds.x+l.bounds.width/2,y:l.bounds.y+l.bounds.height/2},h=new Ir({listening:!1}),d=new th({...c,width:0,height:0,fill:s,stroke:o.sectionStroke,strokeWidth:Fe,opacity:$t,listening:!1,perfectDrawEnabled:!1}),u=new eh({...c,radius:0,fill:this.host.categoryColor(l.categoryKey),listening:!1,perfectDrawEnabled:!1}),f=this.host.categoryPriceLabel(l.categoryKey),y=new ih({...c,text:a,fontSize:qe,fontStyle:Oe,fontFamily:this.host.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});h.add(d),h.add(u),h.add(y),r.add(h),this.labels.push({cluster:l,pill:h,plate:d,swatch:u,text:y,label:a,price:f})}if(!this.labels.length){r.destroy();return}this.group=r,this.host.labelLayer.add(r)}syncForCamera(e){if(!this.group||!this.labels.length)return!1;let t=this.host.seatR()*2,o=this.host.exportMode||this.host.viewMode()!=="flat"||this.host.seatsPickable()&&e<we;return this.revealed=o||Ts(Fi(t,e),Fi(t,we),this.revealed),!this.revealed&&this.size(this.host.stage.scaleX(),this.host.stage.width())&&this.host.labelLayer.batchDraw(),this.applyFilterDim(),this.applyVisibility(!this.revealed),!0}focusCluster(e){if(this.host.viewMode()!=="flat"||this.host.hasSections()||this.host.seatsPickable())return!1;let t=this.clusterAt(this.host.screenToWorld(e));if(!t)return!1;let o=this.host.seatR()*2,s={x:t.bounds.x-o,y:t.bounds.y-o,width:t.bounds.width+o*2,height:t.bounds.height+o*2},n=this.host.stage;if(ot(n,s,this.host.zoomBounds(),this.host.framingViewport())<=n.scaleX()*ft)return!1;let l=this.diveTarget(s);return l?(this.host.focusRegion(l,{durationMs:this.host.cameraGlideMs()}),!0):!1}diveTarget(e,t){let o=this.host.stage,s=this.host.framingViewport(),n=this.host.zoomBounds(),r=ot(o,e,n,s),l=Math.min(Math.max(this.host.readableScale(),this.host.pickableScale()),n.max);if(r>=l)return e;let a=s.width/(l*ke),c=s.height/(l*ke);if(!(a>0)||!(c>0))return null;let h=t??{x:e.x+e.width/2,y:e.y+e.height/2};return{x:h.x-a/2,y:h.y-c/2,width:a,height:c}}glideTowardTap(e){if(this.host.viewMode()!=="flat")return!1;let t=this.host.stage.scaleX(),o=sn(t,this.host.pickableScale());if(o==null||o<=t*ft)return!1;let s=this.host.screenToWorld(e),n=this.host.framingViewport(),r=n.width/(o*ke),l=n.height/(o*ke);return!(r>0)||!(l>0)?!1:(this.host.focusRegion({x:s.x-r/2,y:s.y-l/2,width:r,height:l}),!0)}syncCursor(e){if(this.host.exportMode)return;let t=this.host.viewMode()==="flat"&&!this.host.seatsPickable()?"zoom-in":e?"pointer":"default";for(let o of[this.host.stage.container(),this.host.stage.content])o&&o.style.cursor!==t&&(o.style.cursor=t)}clusterAt(e){let t=Tr(this.all,e);if(t)return t;if(!this.visible)return null;for(let o of this.labels){let s=o.plate.width()/2,n=o.plate.height()/2;if(Math.abs(e.x-o.text.x())<=s&&Math.abs(e.y-o.text.y())<=n)return o.cluster}return null}size(e,t){let o=Math.max(e,1e-4),s=t<ue,n=`${o.toFixed(4)}|${t}`;if(n===this.lastFontKey)return!1;this.lastFontKey=n;let r=Ze(qe,t),l=pt/o,a=qt/o;for(let c of this.labels){let{text:h,plate:d,swatch:u,cluster:f}=c,y=ao(c.label,s);h.text(c.price?`${y} \xB7 ${c.price}`:y),h.fontStyle(s?Ut:Oe);let m=r,p=0;for(;h.fontSize(Math.max(1,m/o)),h.letterSpacing(h.fontSize()*De),p=Pr(h.fontSize())+h.width()+l*2,!(p<=f.bounds.width||m<=de);)m=Math.max(de,m-1);let g={x:f.bounds.x+f.bounds.width/2,y:f.bounds.y+f.bounds.height/2},b=h.height()+a*2,S=p-l*2,v=g.x-S/2;u.radius(Rr(h.fontSize())),u.position({x:v+u.radius(),y:g.y}),h.offsetX(0),h.offsetY(h.height()/2),h.position({x:v+Pr(h.fontSize()),y:g.y}),d.size({width:p,height:b}),d.offset({x:p/2,y:b/2}),d.cornerRadius(b/2),d.strokeWidth(Fe/o),d.position(g)}return!0}applyFilterDim(){if(!this.labels.length)return;let e=this.host.categoryFilter(),t=!1;for(let o of this.labels){let s=e&&!e.has(o.cluster.categoryKey)?.22:1;o.pill.opacity()!==s&&(o.pill.opacity(s),t=!0)}t&&this.host.labelLayer.batchDraw()}boundsForSeats(e,t){if(!e.length)return null;let o=ho(e,this.host.seatR()),s=uo(o);s.length||(s=o.map(l=>({categoryKey:l.categoryKey,bounds:l.bounds,rowIds:[l.id],seatCount:l.seatCount})));let n=xr(s);if(!n)return null;let r=s.reduce((l,a)=>a.seatCount>l.seatCount?a:l,s[0]);return{bounds:{x:n.x-t,y:n.y-t,width:n.width+t*2,height:n.height+t*2},anchor:{x:r.bounds.x+r.bounds.width/2,y:r.bounds.y+r.bounds.height/2},singleBlock:s.length===1&&e.every(l=>l.x>=n.x&&l.x<=n.x+n.width&&l.y>=n.y&&l.y<=n.y+n.height)}}applyVisibility(e){let t=this.group;if(!t||e===this.visible)return;if(this.visible=e,this.fadeRaf&&(cancelAnimationFrame(this.fadeRaf),this.fadeRaf=0),t.visible(!0),this.host.reducedMotion()){t.opacity(e?1:0),t.visible(e),this.host.labelLayer.batchDraw();return}let o=t.opacity(),s=e?1:0,n=performance.now(),r=l=>{if(this.host.destroyed()||!this.group){this.fadeRaf=0;return}let a=Math.min(1,(l-n)/90);t.opacity(o+(s-o)*a),a>=1&&t.visible(s>0),this.host.labelLayer.batchDraw(),this.fadeRaf=a<1?requestAnimationFrame(r):0};this.fadeRaf=requestAnimationFrame(r)}};import{Circle as oh}from"konva/lib/shapes/Circle";import{Line as sh}from"konva/lib/shapes/Line";function Ar(i,e,t,o){let s=i.seatRadius(),n=new oh({x:t.x,y:t.y,radius:s,stroke:o,strokeWidth:3,opacity:.9,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),r=i.viewMode()==="perspective"?i.perspectiveSeatScale(e):1;n.scale({x:r,y:r}),i.overlayLayer.add(n);let l=performance.now(),a=620,c=h=>{if(!n.getLayer())return;let d=Math.min(1,(h-l)/a);n.radius(s*(1+d*1.8)),n.opacity(.9*(1-d)),i.overlayLayer.batchDraw(),d<1?requestAnimationFrame(c):(n.destroy(),i.overlayLayer.batchDraw())};requestAnimationFrame(c)}function Er(i,e,t){for(let o of e){let s=i.viewMode()==="perspective"&&o.perspectiveAffine?o.outline.map(d=>i.perspectiveLocalPoint(i.projectedSectionPoint(o,d))):o.outline.map(d=>{let u=o.liftWorld>0?i.isoLiftLocal(o.liftWorld):{x:0,y:0};return{x:d.x+u.x,y:d.y+u.y}}),n=s.reduce((d,u)=>({x:d.x+u.x,y:d.y+u.y}),{x:0,y:0});n.x/=s.length,n.y/=s.length;let r=new sh({x:n.x,y:n.y,points:s.flatMap(d=>[d.x-n.x,d.y-n.y]),closed:!0,stroke:t,strokeWidth:3,strokeScaleEnabled:!1,opacity:.92,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!0,shadowColor:t,shadowBlur:14,shadowOpacity:.7});i.overlayLayer.add(r),i.overlayLayer.batchDraw();let l=()=>{r.getLayer()&&(r.destroy(),i.overlayLayer.batchDraw())};if(i.reducedMotion()||typeof document<"u"&&document.hidden){setTimeout(l,520);continue}let a=performance.now(),c=820,h=d=>{if(i.isDestroyed()||!r.getLayer())return;let u=Math.min(1,(d-a)/c),y=1+(1-Math.pow(1-u,3))*.04;r.scale({x:y,y}),r.opacity(.92*(1-u)),i.overlayLayer.batchDraw(),u<1?requestAnimationFrame(h):l()};requestAnimationFrame(h)}}import{Group as lh}from"konva/lib/Group";import{Shape as ch}from"konva/lib/Shape";import{Group as nh}from"konva/lib/Group";import{Shape as rh}from"konva/lib/Shape";function ah(i,e,t){let o=e.length,s={x:(e[o-1].x+e[0].x)/2,y:(e[o-1].y+e[0].y)/2};i.moveTo(s.x,s.y);for(let n=0;n<o;n+=1){let r=e[n],l=e[(n+1)%o],a=e[(n-1+o)%o],c=Math.min(Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(l.x-r.x,l.y-r.y)/2);i.arcTo(r.x,r.y,l.x,l.y,Math.max(0,Math.min(t,c)))}i.closePath()}function We(i,e,t,o){let s=lt(i)>0,n=t.cornerRadius&&t.cornerRadius>0?t.cornerRadius:0;return new rh({...t,sceneFunc(r,l){r.beginPath();let a=h=>{if(h.length){if(n>0&&h.length>=3)return ah(r,h,n);r.moveTo(h[0].x,h[0].y);for(let d=1;d<h.length;d+=1)r.lineTo(h[d].x,h[d].y);r.closePath()}};o?(h=>{r.moveTo(h.start.x,h.start.y);let d=h.start;for(let u of h.segments)u.kind==="line"?r.lineTo(u.end.x,u.end.y):u.kind==="arc"?r.arc(u.center.x,u.center.y,u.radius,Math.atan2(d.y-u.center.y,d.x-u.center.x),Math.atan2(u.end.y-u.center.y,u.end.x-u.center.x),!u.clockwise):r.bezierCurveTo(u.control1.x,u.control1.y,u.control2.x,u.control2.y,u.end.x,u.end.y),d=u.end;r.closePath()})(o):a(i);for(let h of e??[]){let d=lt(h)>0;a(d===s?[...h].reverse():h)}r.fillStrokeShape(l)},perfectDrawEnabled:!1})}var St=class extends nh{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)}};function _r(i,e){if(!e.length)return null;let t=new lh({listening:!1});for(let o of e){let s=i.viewMode==="perspective"&&o.perspectiveAffine,n=s?o.outline.map(l=>i.perspectiveLocalPoint(i.projectedSectionPoint(o,l))):o.outline,r=s?o.holes.map(l=>l.map(a=>i.perspectiveLocalPoint(i.projectedSectionPoint(o,a)))):o.holes;t.add(We(n,r,{fill:an,stroke:B("#ffffff",.1),strokeWidth:1,listening:!1},s?void 0:o.outlinePath))}return i.bgLayer.add(t),t.moveToTop(),t}function Br(i,e){let{bounds:t}=i,s=Math.max(t.width,t.height,1)*4+1e3,n=[{x:t.x-s,y:t.y-s},{x:t.x+t.width+s,y:t.y-s},{x:t.x+t.width+s,y:t.y+t.height+s},{x:t.x-s,y:t.y+t.height+s}],r=new ch({fill:i.canvasBackground,opacity:1-Ge,listening:!1,perfectDrawEnabled:!1,sceneFunc:(l,a)=>{let c=h=>{if(h.length){l.moveTo(h[0].x,h[0].y);for(let d=1;d<h.length;d++)l.lineTo(h[d].x,h[d].y);l.closePath()}};l.beginPath(),c(n);for(let h of e){let d=i.viewMode==="perspective"&&h.perspectiveAffine?h.outline.map(u=>i.perspectiveLocalPoint(i.projectedSectionPoint(h,u))):h.outline.map(u=>{let f=h.liftWorld>0?i.isoLiftLocal(h.liftWorld):{x:0,y:0};return{x:u.x+f.x,y:u.y+f.y}});c(lt(d)>0?[...d].reverse():d)}l.fillStrokeShape(a)}});return i.overlayLayer.add(r),r.moveToTop(),r}import{Rect as tl}from"konva/lib/shapes/Rect";import{Line as cd}from"konva/lib/shapes/Line";import{Text as il}from"konva/lib/shapes/Text";import{Path as hd}from"konva/lib/shapes/Path";import{Text as hh}from"konva/lib/shapes/Text";function Fr(i){let e=Re,t=new hh({fontSize:ye,fontStyle:"600",fontFamily:i.labelFont(),listening:!1}),o=i.seatR*2-3;for(let s of i.seats){if(s.kind==="booth"){e=Math.min(e,Re);continue}let n=ye*i.seatLabelScale(s);t.fontSize(n),t.text(Ot(s.displayLabel??s.label));let r=t.width()>o?Math.max(ht,n*o/t.width()):n;e=Math.min(e,r)}return t.destroy(),N/Math.max(ht,e)}var po={top:0,right:0,bottom:0,left:0};function Or(i){let e=t=>typeof t=="number"&&Number.isFinite(t)&&t>0?t:0;return i?{top:e(i.top),right:e(i.right),bottom:e(i.bottom),left:e(i.left)}:{...po}}var dh=.7;function Dr(i,e,t){let{top:o,right:s,bottom:n,left:r}=t,l=(u,f,y)=>{let m=u+f,p=y*dh;if(m<=p||m<=0)return[u,f];let g=p/m;return[u*g,f*g]},[a,c]=l(r,s,i),[h,d]=l(o,n,e);return{x:a,y:h,width:Math.max(1,i-a-c),height:Math.max(1,e-h-d)}}function Gr(i){return{x:i.x(),y:i.y(),scale:i.scaleX()}}function Nr(i,e){return!Number.isFinite(e.x)||!Number.isFinite(e.y)||!(e.scale>0)?!1:(i.scale({x:e.scale,y:e.scale}),i.position({x:e.x,y:e.y}),!0)}function ci(i){return{x:i.x+i.width/2,y:i.y+i.height/2}}function Hr(i,e){let t=e({x:i.x,y:i.y}),o=e({x:i.x+i.width,y:i.y+i.height});return{x:Math.min(t.x,o.x),y:Math.min(t.y,o.y),width:Math.abs(o.x-t.x),height:Math.abs(o.y-t.y)}}function Vr(){return typeof navigator<"u"&&navigator.maxTouchPoints>0?Os:Fs}function Kr(i){return Math.max(i*1.05,Ms,ce*1.3)}function hi(i,e){let t=1/0,o=-1/0,s=1/0,n=-1/0;for(let r of i)t=Math.min(t,r.x),o=Math.max(o,r.x),s=Math.min(s,r.y),n=Math.max(n,r.y);return t-=e,o+=e,s-=e,n+=e,{x:t,y:s,width:Math.max(40,o-t),height:Math.max(40,n-s)}}function zr(i){let{stageWidth:e,stageHeight:t,fullBounds:o,visibleBounds:s,seatPoints:n,minScale:r}=i;if(!n.length)return null;let l=1.12;if(Math.min(e/(o.width*l),t/(o.height*l))>=r)return null;let c=i.tapAnchor??{x:s.x+s.width/2,y:s.y+s.height/2},h=n[0],d=1/0;for(let m of n){let p=(m.x-c.x)**2+(m.y-c.y)**2;p<d&&(h=m,d=p)}let u=e/(r*l),f=t/(r*l),y=hi(n,0);return{bounds:{x:Wr(h.x,u,y.x,y.width),y:Wr(h.y,f,y.y,y.height),width:u,height:f},minScale:r}}function Wr(i,e,t,o){return o<=e?t+o/2-e/2:Math.min(Math.max(i-e/2,t),t+o-e)}var qr=.5,W=Math.SQRT1_2,uh="#f3f4f6",Xr=4;function ph(i){let e=i.fraction;return typeof e!="number"||!Number.isFinite(e)?qr:Math.min(1,Math.max(0,e))}function fh(i){return i==="booked"||i==="not_for_sale"?jt:Zt}function Yr(i,e){return Number.parseInt(i.slice(e,e+2),16)}function Ur(i){let e=i.trim();if(!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(e))return null;if(e.length===7)return e.toLowerCase();let[,t,o,s]=e.toLowerCase();return`#${t}${t}${o}${o}${s}${s}`}function mh(i,e,t){let o=Ur(i),s=Ur(e);if(!o||!s)return i;let n=Math.min(1,Math.max(0,t)),r="#";for(let l=1;l<7;l+=2){let a=Math.round(Yr(o,l)*(1-n)+Yr(s,l)*n);r+=a.toString(16).padStart(2,"0")}return r}function $r(i,e,t,o){let s=t*4,n=e*W,r=-e*W,l=o*W*2*s,a=o*-W*2*s,c=n+s*W,h=r+s*W,d=n-s*W,u=r-s*W;i.beginPath(),i.moveTo(c,h),i.lineTo(d,u),i.lineTo(d+l,u+a),i.lineTo(c+l,h+a),i.closePath(),i.clip()}function yh(i,e){let t=e*4,o=Math.max(e*.45,1);i.beginPath();for(let s=-Xr;s<=Xr;s++){let n=s*o*2,r=n+o,l=n*W,a=-n*W,c=r*W,h=-r*W;i.moveTo(l+t*W,a+t*W),i.lineTo(l-t*W,a-t*W),i.lineTo(c-t*W,h-t*W),i.lineTo(c+t*W,h+t*W),i.closePath()}i.clip()}function di(i,e){i._sceneFunc(e)}function Zr(i){let e=this,t=e.attrs,o=t.markRadius||1,s=t.fill,n=e.getStage(),r=Math.abs((n?n.scaleX():1)*(e.scaleX()||1))||1;if(o*2*r<16){t.fill=t.markMidtone??s,di(e,i),t.fill=s;return}let a=(1-2*(t.markFraction??qr))*o;i.save(),$r(i,a,o,1),t.fill=t.markBase??s,di(e,i),i.restore(),i.save(),$r(i,a,o,-1),t.fill=t.markFill??s,di(e,i),t.markHatch&&(yh(i,o),t.fill=uh,di(e,i)),i.restore(),t.fill=s}function gh(i,e,t,o,s,n){let r=ph(e),l=fh(t),a=i.attrs;a.markFraction=r,a.markBase=o,a.markFill=l,a.markMidtone=mh(o,l,1-r),a.markHatch=n,a.markRadius=s>0?s:1,i.fill(a.markMidtone),i.stroke(""),i.strokeWidth(0),i.dash([]),i.opacity(1),i.sceneFunc(Zr)}function bh(i){i.setAttr("sceneFunc",void 0)}function fo(i){return i.attrs.sceneFunc===Zr}var ui=class{constructor(){this.marks=new Map}get size(){return this.marks.size}get(e){return this.marks.get(e)??null}has(e){return this.marks.has(e)}clear(){this.marks.clear()}merge(e,t){let o=new Set;for(let[s,n]of Object.entries(e))t.has(s)&&(n&&n.kind==="partial"?(this.marks.set(s,n),o.add(s)):this.marks.delete(s)&&o.add(s));return o}paint(e,t,o,s,n,r,l){let a=l?void 0:this.marks.get(t);if(!a){fo(e)&&bh(e);return}gh(e,a,o,s,n,r)}};function pi(i){let e=i.getClientRect({skipTransform:!0,skipShadow:!0});!Number.isFinite(e.width)||!Number.isFinite(e.height)||(i.offsetX(e.x+e.width/2),i.offsetY(e.y+e.height/2))}var jr=.85,Sh=1,vh=.7,wh=.8,Qr="rgba(0,0,0,0)",Lh=[2,2],kh=1,mo=.6;function Jr(i){return F(i)?"#334155":"#e2e8f0"}function ea(i,e,t){return i==="held"?{fill:Zt,stroke:Jr(e),strokeWidth:kh,dash:[...Lh],opacity:1,scale:1}:i==="booked"||i==="not_for_sale"?t?{fill:Qr,stroke:jt,strokeWidth:1.5,dash:[],opacity:.9,scale:jr}:{fill:Qr,stroke:Jr(e),strokeWidth:Sh,dash:[],opacity:i==="booked"?vh:wh,scale:jr}:null}var yo=1e6;function Ch(){return typeof navigator>"u"?!1:navigator.maxTouchPoints>0&&/AppleWebKit/i.test(navigator.userAgent)}var fi=class{constructor(e,t=Ch()){this.pointers=new Map;this.pinch=null;this.panLast=null;this.panStart=null;this.panStarted=!1;this.movedPx=0;this.singleTouch=!1;this.lastTapAt=0;this.rect=null;this.onLayoutChanged=()=>{this.rect=null};this.onPointerDown=e=>{this.useWebKitTouchEvents&&e.pointerType==="touch"||(this.rect=null,this.beginPointer(e.pointerId,this.toLocal(e.clientX,e.clientY),e.pointerType,e.button))};this.onPointerMove=e=>{if(this.useWebKitTouchEvents&&e.pointerType==="touch"||!this.pointers.has(e.pointerId))return;e.preventDefault();let t=this.toLocal(e.clientX,e.clientY);this.updatePointer(e.pointerId,t)&&this.applyPointerMove(t)};this.onPointerEnd=e=>{this.useWebKitTouchEvents&&e.pointerType==="touch"||this.endPointer(e.pointerId)};this.onTouchStart=e=>{e.preventDefault(),this.rect=null;for(let t=0;t<e.changedTouches.length;t+=1){let o=e.changedTouches.item(t);o&&this.beginPointer(yo+o.identifier,this.toLocal(o.clientX,o.clientY),"touch",0)}};this.onTouchMove=e=>{e.preventDefault();let t=null;for(let o=0;o<e.changedTouches.length;o+=1){let s=e.changedTouches.item(o);if(!s)continue;let n=this.toLocal(s.clientX,s.clientY);this.updatePointer(yo+s.identifier,n)&&(t=n)}t&&this.applyPointerMove(t)};this.onTouchEnd=e=>{e.preventDefault();for(let t=0;t<e.changedTouches.length;t+=1){let o=e.changedTouches.item(t);o&&this.endPointer(yo+o.identifier)}};this.host=e,this.useWebKitTouchEvents=t}get moved(){return this.movedPx}attach(){let{container:e}=this.host;this.rect=null,typeof window<"u"&&(window.addEventListener("scroll",this.onLayoutChanged,{capture:!0,passive:!0}),window.addEventListener("resize",this.onLayoutChanged,{passive:!0}),window.visualViewport?.addEventListener("resize",this.onLayoutChanged),window.visualViewport?.addEventListener("scroll",this.onLayoutChanged)),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}),this.useWebKitTouchEvents&&(e.addEventListener("touchstart",this.onTouchStart,{passive:!1}),e.addEventListener("touchmove",this.onTouchMove,{passive:!1}),e.addEventListener("touchend",this.onTouchEnd,{passive:!1}),e.addEventListener("touchcancel",this.onTouchEnd,{passive:!1}))}detach(){let{container:e}=this.host;typeof window<"u"&&(window.removeEventListener("scroll",this.onLayoutChanged,{capture:!0}),window.removeEventListener("resize",this.onLayoutChanged),window.visualViewport?.removeEventListener("resize",this.onLayoutChanged),window.visualViewport?.removeEventListener("scroll",this.onLayoutChanged)),e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerEnd),e.removeEventListener("pointercancel",this.onPointerEnd),this.useWebKitTouchEvents&&(e.removeEventListener("touchstart",this.onTouchStart),e.removeEventListener("touchmove",this.onTouchMove),e.removeEventListener("touchend",this.onTouchEnd),e.removeEventListener("touchcancel",this.onTouchEnd))}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<Rs}invalidateRect(){this.rect=null}toLocal(e,t){let o=this.rect;if(!o){let s=this.host.container.getBoundingClientRect();o={left:s.left,top:s.top},this.rect=o}return{x:e-o.left,y:t-o.top}}beginPointer(e,t,o,s){if(this.host.cancelGlide(),this.pointers.set(e,t),this.pointers.size===1)this.movedPx=0,this.singleTouch=o==="touch",this.singleTouch&&this.host.touchProbeStart?.(t),this.pinch=null,this.panStart=t,this.panStarted=!1,this.host.marqueeShouldStart({pointerType:o,button:s})?(this.host.beginMarquee(t),this.panLast=null):this.panLast=t;else if(this.pointers.size===2){this.host.marqueeActive()&&this.host.cancelMarquee(),this.endTouchProbe();let[n,r]=[...this.pointers.values()],l={x:(n.x+r.x)/2,y:(n.y+r.y)/2},a=this.host.stage.scaleX();this.pinch={startDist:Math.hypot(r.x-n.x,r.y-n.y),startScale:a,worldMid:{x:(l.x-this.host.stage.x())/a,y:(l.y-this.host.stage.y())/a}},this.panLast=null,this.panStart=null,this.panStarted=!0,this.movedPx=Te+1}}updatePointer(e,t){return this.pointers.has(e)?(this.pointers.set(e,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=Te+1),!0):!1}applyPointerMove(e){if(this.singleTouch&&this.pointers.size===1&&(this.panStarted||this.movedPx>Te?this.endTouchProbe():this.host.touchProbeMove?.(e)),this.host.marqueeActive()){this.host.updateMarquee(e);return}if(this.pinch&&this.pointers.size>=2){this.host.releaseSectionFocusDim();let[t,o]=[...this.pointers.values()],s=Math.hypot(o.x-t.x,o.y-t.y);if(this.pinch.startDist<1)return;let n={x:(t.x+o.x)/2,y:(t.y+o.y)/2},{min:r,max:l}=this.host.zoomBounds(),a=V(this.pinch.startScale*(s/this.pinch.startDist),r,l);this.host.stage.scale({x:a,y:a}),this.host.stage.position({x:n.x-this.pinch.worldMid.x*a,y:n.y-this.pinch.worldMid.y*a}),this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}else if(this.panLast&&this.pointers.size===1){if(!this.panStarted){if(this.movedPx<=Te)return;this.panStarted=!0,this.host.releaseSectionFocusDim()}this.host.stage.position({x:this.host.stage.x()+(e.x-this.panLast.x),y:this.host.stage.y()+(e.y-this.panLast.y)}),this.panLast=e,this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}}endPointer(e){if(this.pointers.has(e)){if(this.host.marqueeActive()){this.endTouchProbe(),this.host.finishMarquee(),this.pointers.delete(e),this.pointers.size===0&&(this.panLast=null);return}this.pointers.delete(e),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.endTouchProbe(),this.host.afterViewChange())}}endTouchProbe(){this.singleTouch&&(this.singleTouch=!1,this.host.touchProbeEnd?.())}};import{Circle as xh}from"konva/lib/shapes/Circle";import{Group as Th}from"konva/lib/Group";import{Text as Ih}from"konva/lib/shapes/Text";var ta=13,Ph=15,Mh=.3,Rh=.08;function na(i,e,t){return!!(i&&t!==i||e&&!e.has(t))}function Ah(i,e){return!e||i.available==null?`cap ${i.capacity}`:i.available<=0?H("map.soldOut"):H("map.seatsLeft",{count:i.available})}function Eh(i,e){return e&&i.available!=null&&i.available<=0}function ra(i){for(let e of i.gaById.values()){let t=i.filteredOut(e.categoryKey),o=i.overviewHidden(e),s=Eh(e,i.pickerMode),n=i.pickerMode?e.selected??0:0;e.polygon.opacity(o?0:i.dimmed(e.categoryKey)?Ae*Rh:s?Ae*Mh:Ae),e.polygon.listening(!i.exportMode&&!o&&!t&&!s),e.polygon.stroke(n>0?i.selectionColor:e.strokeColor),e.polygon.strokeWidth(n>0?3:1.5),_h(i,e,s,n,o,i.dimmed(e.categoryKey))}}function _h(i,e,t,o,s,n){if(e.capacityNode){let r=Ah(e,i.pickerMode);e.capacityNode.text()!==r&&(e.capacityNode.text(r),e.capacityNode.offsetX(e.capacityNode.width()/2)),e.capacityNode.opacity(t?.75:1)}Bh(i,e,s||n),o>0&&!s?Oh(i,e,o):e.chip&&e.chip.visible(!1)}var go=9,ia=.86;function Bh(i,e,t){let{labelNode:o,capacityNode:s}=e;if(!o&&!s)return;let n=Math.max(i.effScale(),1e-4);if(t){o?.visible(!1),s?.visible(!1);return}if(!i.pickerMode){o?.visible(i.labelLegible(o.fontSize())),s?.visible(i.labelLegible(s.fontSize()));return}let r=Fh(e,n),l=oa(o,_t,r.width*ia,n),a=oa(s,Bt,r.width*ia,n),c=l!=null,h=a!=null&&c&&l+a+go<=r.height;sa(o,c?l:null,e.labelPoint.y-go/n,n),sa(s,h?a:null,e.labelPoint.y+go/n,n)}function Fh(i,e){let t=1/0,o=-1/0,s=1/0,n=-1/0;for(let r of i.points)r.x<t&&(t=r.x),r.x>o&&(o=r.x),r.y<s&&(s=r.y),r.y>n&&(n=r.y);return Number.isFinite(t)?{width:(o-t)*e,height:(n-s)*e}:{width:0,height:0}}function oa(i,e,t,o){if(!i||!i.text())return null;i.fontSize(e/o);let s=i.width()*o;if(s<=t||s<=0)return e;let n=e*(t/s);return n>=N?n:null}function sa(i,e,t,o){if(i){if(e==null){i.visible(!1);return}i.fontSize(e/o),i.offsetX(i.width()/2),i.offsetY(i.height()/2),i.y(t),i.visible(!0)}}function Oh(i,e,t){if(!e.chip){let o=new Th({x:e.labelPoint.x,y:e.labelPoint.y-ta-16,listening:!1}),s=new xh({radius:ta,fill:i.selectionColor,listening:!1,perfectDrawEnabled:!1}),n=new Ih({text:String(t),fontSize:Ph,fontStyle:"800",fontFamily:i.labelFont(),fill:"#0b0d12",listening:!1,perfectDrawEnabled:!1});o.add(s),o.add(n),i.bgLayer.add(o),e.chip=o,e.chipText=n}e.chipText&&e.chipText.text()!==String(t)&&e.chipText.text(String(t)),e.chipText&&(e.chipText.offsetX(e.chipText.width()/2),e.chipText.offsetY(e.chipText.height()/2)),e.chip.visible(!0),e.chip.moveToTop()}function aa(i,e){let t=!1;for(let[o,s]of Object.entries(e)){let n=i.get(o);n&&(s.available!==void 0&&n.available!==s.available&&(n.available=s.available,t=!0),s.selected!==void 0&&n.selected!==s.selected&&(n.selected=s.selected,t=!0))}return t}function la(i){let{focusedId:e}=i;if(!e)return null;let t=new Set([e]),o=i.sectionOf(e);if(o!=null){for(let c of i.seats){let h=i.seatId(c);i.sectionOf(h)===o&&t.add(h)}return t}let s=i.seats.find(c=>i.seatId(c)===e);if(!s)return t;let n=i.seatPoint(s),r=i.seatPitch>0?i.seatPitch:i.seatRadius*2,l=6*(r>0?r:1),a=l*l;for(let c of i.seats){let h=i.seatPoint(c),d=h.x-n.x,u=h.y-n.y;d*d+u*u<=a&&t.add(i.seatId(c))}return t}function ca(i,e,t){let o=t(i);return o!=null&&o===t(e)}var Dh=.2,Gh=.55;function ha(i,e){return i.startsWith("#")?j(e,i,Dh):i}function da(i){return F(i)?"#0b1220":"#ffffff"}function Nh(i){return j(i,da(i),Gh)}function ua(i){return i>0?Math.min(1,i/le):1}function pa(i){let{categoryFilter:e,status:t}=i;return!e||i.selected||t!=="free"&&!(t==="held"&&!i.ownHold)?!1:!e.has(i.categoryKey)}function fa(i,e,t){let o=typeof i=="string"&&i.startsWith("#")?i:e;return t?Nh(o):da(o)}function ma(i){let{width:e,height:t}=i;return!(e>0)||!(t>0)?"hidden":e===i.stageWidth&&t===i.stageHeight?"unchanged":{width:e,height:t}}import{Rect as ya}from"konva/lib/shapes/Rect";import{Text as Hh}from"konva/lib/shapes/Text";function ga(i){let e=i.effScale(),t=i.stage.scaleX(),o={width:i.stage.width(),height:i.stage.height()},s=m=>Math.round(m*100)/100,n=new Map(i.overlayLayer.find(".selection-ring").map(m=>[String(m.getAttr("seatId")??""),String(m.getAttr("ringColor")??i.effSelection)])),r=i.seats.map(m=>{let p=i.circleById.get(m.id),g=i.boothLabelById.get(m.id)??i.seatLabelById.get(m.id),b=i.viewMode==="perspective"?i.perspectiveSeatScale.get(m.id)??1:1,S=(i.viewMode==="perspective"?t:e)*b,v=m.kind==="booth"?Re:ye*i.seatLabelScale(m),L=i.viewMode==="perspective"&&m.kind!=="booth"?e*b:S,w=s((g?.fontSize()??v)*L),k=i.worldToScreen(m),C=g?g.width()*t*b:0,x=g?g.height()*(i.viewMode==="perspective"&&m.kind==="booth"?t:e)*b:0,T=k.x-C/2<0||k.x+C/2>o.width||k.y-x/2<0||k.y+x/2>o.height,P=i.focusedSeatOpacity(m.id,p?.getAbsoluteOpacity()??0),I=i.seatSection.get(m.id),A=!!g?.isVisible()&&P>=.5&&!T,R;A||(P<.5?R="dimmed-or-unavailable":w<N?R="below-minimum-size":T?R="outside-viewport":g?R="renderer-hidden":R=i.seatLabelDrops.get(m.id)??(i.seatLabelRungOpen()?"clutter-or-fit":"below-label-rung"));let M=p instanceof ya?p.width()*t*b:i.seatR*2*S,_=p instanceof ya?p.height()*(i.viewMode==="perspective"?t:e)*b:i.seatR*2*S,$=2*(i.seatR*S+Be),X=p?.fill(),Y=g?.fill(),J=i.accessGlyphById.get(m.id),D=J?.getAbsoluteScale();return{seatId:m.id,label:m.label,kind:m.kind==="booth"?"booth":"seat",markerShape:m.kind==="booth"?"booth":m.wheelchairSpaceType==="no-seat"?"square":"circle",...m.wheelchairSpaceType?{wheelchairSpaceType:m.wheelchairSpaceType}:{},categoryKey:m.categoryKey,...I?{sectionId:I.id}:{},...I?.zone?{zoneId:I.zone}:{},status:i.statusById.get(m.id)??"free",selected:i.selection.has(m.id),visible:A,renderedFontPx:w,fill:typeof X=="string"?X:"",ink:typeof Y=="string"?Y:p?i.seatLabelInk(m,p):i.seatPreferredLabelInk(m),...n.has(m.id)?{selectionRingColor:n.get(m.id)}:{},opacity:s(P),...J?{accessibilityMarker:{glyphVisible:J.isVisible(),glyphWidthPx:s(xe*Math.abs(D?.x??0)),emphasizedByFilter:i.accessGlyphFilterEmphasized(m.id)}}:{},pointerTarget:{active:!i.cached&&!i.seatViewportCulled(m.id)&&!!p?.isVisible()&&!!p?.isListening()&&i.isSelectable(m.id),directWidthPx:s(M),directHeightPx:s(_),effectiveMinimumPx:s(Math.max(Math.min(M,_),$))},screenCenter:{x:s(k.x),y:s(k.y)},...A?{screenBox:{x:s(k.x-C/2),y:s(k.y-x/2),width:s(C),height:s(x)}}:{},...R?{hiddenReason:R}:{}}}),l=r.filter(m=>m.visible).length,a=(m,p,g,b,S,v)=>{let L=Je({x:b.x(),y:b.y()},b.width(),b.height(),b.rotation()),w=v&&v.liftWorld>0?i.isoLiftLocal(v.liftWorld):{x:0,y:0},k=K(L.map(A=>i.worldToScreen({x:A.x+w.x,y:A.y+w.y}))),C=s(b.opacity()),x=b.fill(),T=k.x+k.width<0||k.x>o.width||k.y+k.height<0||k.y>o.height,P=b.isVisible()&&C>.05&&!T,I=v?ai({x:b.x(),y:b.y()},b.width(),b.height(),b.rotation(),v.outline,v.holes):void 0;return{id:m,kind:p,role:g,label:b.text(),visible:P,renderedFontPx:s(b.fontSize()*t),opacity:C,fill:S,ink:typeof x=="string"?x:"",...I==null?{}:{fitsContainer:I},...P?{screenBox:{x:s(k.x),y:s(k.y),width:s(k.width),height:s(k.height)}}:{}}},c=m=>{let p=m.namePlate.fill();if(m.namePlate.opacity()>.05&&typeof p=="string"&&p)return p;let g=m.blockPoly.fill();return typeof g=="string"?g:m.baseFill},h=[...i.sections.map(m=>a(m.id,"section","name",m.nameLabel,c(m),m)),...i.sections.map(m=>a(`${m.id}:availability`,"section","availability",m.subLabel,c(m),m)),...i.zones.flatMap(m=>[a(m.id,"zone","name",m.label,m.background),...m.sub?[a(`${m.id}:price`,"zone","price",m.sub,m.background)]:[]])],d=[...i.gaById].map(([m,p])=>{let g=p.points.map(T=>i.worldToScreen(T)),b=Math.min(...g.map(T=>T.x)),S=Math.min(...g.map(T=>T.y)),v=Math.max(...g.map(T=>T.x)),L=Math.max(...g.map(T=>T.y)),w=v<0||b>o.width||L<0||S>o.height,k=s(p.polygon.opacity()),C=k>=.1&&!w,x=p.polygon.fill();return{areaId:m,label:p.label,capacity:p.capacity,categoryKey:p.categoryKey,...p.sectionId?{sectionId:p.sectionId}:{},visible:C,interactive:p.polygon.listening(),opacity:k,fill:typeof x=="string"?x:"",effectiveBackground:p.effectiveBackground,...C?{screenBox:{x:s(b),y:s(S),width:s(v-b),height:s(L-S)}}:{}}}),u=[...i.freeTextById].map(([m,p])=>{let{node:g,background:b,kind:S}=p,v=i.worldToScreen({x:g.x(),y:g.y()}),L=g.width()*t,w=g.height()*e,k=v.x-g.offsetX()*t,C=v.y-g.offsetY()*e,x=s(g.fontSize()*e),T=k+L<0||k>o.width||C+w<0||C>o.height,P=g.isVisible()&&!T,I=g.fill(),A=s(g.getAbsoluteOpacity()),R;return P||(x<N?R="below-minimum-size":T?R="outside-viewport":R="renderer-hidden"),{objectId:p.objectId??m,kind:S,text:g.text(),visible:P,renderedFontPx:x,ink:typeof I=="string"?I:"",background:b,opacity:A,...P?{screenBox:{x:s(k),y:s(C),width:s(L),height:s(w)}}:{},...R?{hiddenReason:R}:{}}}),f=i.labelGroup.find(m=>m.getAttr("rowLabel")===!0).filter(m=>m instanceof Hh).map(m=>{let p=m.getClientRect({skipShadow:!0,skipStroke:!0}),g=p.x+p.width<0||p.x>o.width||p.y+p.height<0||p.y>o.height,b=m.fill();return{text:m.text(),visible:m.isVisible()&&!g,renderedFontPx:s(m.fontSize()*e),ink:typeof b=="string"?b:"",...g?{}:{screenBox:{x:s(p.x),y:s(p.y),width:s(p.width),height:s(p.height)}}}}),y=i.sections.filter(m=>m.blockPoly.opacity()>.05);return{viewport:o,projection:i.viewMode,...i.viewMode==="perspective"?{perspective:{model:"pinhole-exact-seat-anchors",sectionSurfaceModel:"tangent-plane",exactSeatAnchorCount:i.perspectiveSeatProjected.size,depthSorted:!0}}:{},canvasBackground:i.canvasBackground,effectiveScale:s(e),rung:i.getRung(),minimumVisibleLabelPx:N,totalLabelledBookableUnits:r.length,visibleLabels:l,hiddenLabels:r.length-l,totalBookableUnits:r.length+d.reduce((m,p)=>m+p.capacity,0),selectionRingSeatIds:i.overlayLayer.find(".selection-ring").map(m=>String(m.getAttr("seatId")??"")).filter(Boolean),selectionRingColor:i.effSelection,focusedSectionId:i.focusedSectionId,focusBackdropVisible:!!i.focusBackdrop?.isVisible(),categoryFilterKeys:i.categoryFilter?[...i.categoryFilter].sort():null,overviewStyle:{visibleSectionShells:y.length,categoryPaintedSectionShells:y.filter(m=>{let p=m.blockPoly.fill();return typeof p!="string"||!Hi(i.canvasBackground,p)}).length,tintedSectionShells:y.filter(m=>{let p=m.blockPoly.fill();return typeof p=="string"&&un(i.canvasBackground,p)}).length,visibleCategoryDetailOutlines:i.sections.filter(m=>m.outlinePoly.opacity()>.05).length,visibleSectionRowHints:0,visibleSectionAvailabilityLabels:i.sections.filter(m=>m.subLabel.opacity()>.05).length,visibleSectionGADetails:[...i.gaById.values()].filter(m=>m.sectionId!=null&&m.polygon.opacity()>.05).length},labels:r,gaAreas:d,hierarchyLabels:h,freeTextLabels:u,rowLabels:f}}import{Circle as Wh}from"konva/lib/shapes/Circle";import{Ellipse as Vh}from"konva/lib/shapes/Ellipse";import{Line as ba}from"konva/lib/shapes/Line";import{Arrow as Kh}from"konva/lib/shapes/Arrow";import{Path as zh}from"konva/lib/shapes/Path";import{Rect as vt}from"konva/lib/shapes/Rect";import{Text as So}from"konva/lib/shapes/Text";import{Image as Sa}from"konva/lib/shapes/Image";function va(i,e){if(!e.url||e.visible===!1)return;let t=new window.Image;i.trackAssetImage(t,e.url,"Buyer background image",()=>{let o=t.naturalWidth||4,s=t.naturalHeight||3,n=e.crop??{x:0,y:0,width:1,height:1},r=Math.max(0,Math.min(.99,n.x)),l=Math.max(0,Math.min(.99,n.y)),a={x:r,y:l,width:Math.max(.01,Math.min(1-r,n.width)),height:Math.max(.01,Math.min(1-l,n.height))},c=e.width,h=c*(s*a.height/(o*a.width)),d=new Sa({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:a.x*o,y:a.y*s,width:a.width*o,height:a.height*s},opacity:e.opacity,listening:!1});i.bgLayer.add(d),d.moveToBottom(),i.bgLayer.batchDraw()})}function wa(i,e){let t=new window.Image,o=new Sa({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"?i.fgDecorGroup.add(o):i.bgLayer.add(o),e.role&&i.landmarkBoxes.push(K(Je({x:e.x+e.width/2,y:e.y+e.height/2},e.width,e.height,e.rotation??0))),i.trackAssetImage(t,e.href,`Decor image \u201C${e.label||e.id}\u201D`,()=>{let s=o.getLayer();s&&s.batchDraw()})}function La(i,e){if(e.shape==="round")i.bgLayer.add(new Wh({x:e.center.x,y:e.center.y,radius:e.radius??40,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,listening:!1}));else{let o=e.width??80,s=e.height??50;i.bgLayer.add(new vt({x:e.center.x,y:e.center.y,width:o,height:s,offsetX:o/2,offsetY:s/2,rotation:e.rotation,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,cornerRadius:4,listening:!1}))}let t=wt(i,i.bgLayer,e.displayLabel??e.label,e.center.x,e.center.y,"#cbd5e1",12,!0);i.freeTextById.set(e.id,{node:t,background:"#232c40",kind:"table"})}var Xh=8,Yh=6;function ka(i,e){let t=e.background?.color??i.canvasBackground,o=e.color??re(t,i.theme.textColor??ir),s=e.semanticKind==="icon"?bs(e.iconKey):void 0;if(s){let h=e.fontSize/24,d=new zh({x:e.position.x,y:e.position.y,data:s,rotation:e.rotation,scaleX:h,scaleY:h,stroke:o,strokeWidth:2,lineCap:"round",lineJoin:"round",fillEnabled:!1,listening:!1,perfectDrawEnabled:!1});i.iconNodeById.set(e.id,{node:d,fontSize:e.fontSize}),i.bgLayer.add(d);return}let n=e.background?.padding??0,r=e.opacity??1,l=cs(e),a=new So({x:e.position.x,y:e.position.y,text:e.text,fontSize:e.fontSize,rotation:e.rotation,fontStyle:eo(e.bold,e.italic,"600"),fill:o,fontFamily:e.fontFamily??i.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"}),c;if(e.background){let h=a.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:!0}),d=Math.max(Xh,e.fontSize*.35),u=Math.max(Yh,e.fontSize*.28);c=new vt({x:e.position.x,y:e.position.y,offsetX:-(h.x-d),offsetY:-(h.y-u),width:h.width+d*2,height:h.height+u*2,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"}),i.bgLayer.add(c)}i.freeTextById.set(e.id,{node:a,backdrop:c,background:t,kind:l?"direct-landmark":"free-text"}),i.bgLayer.add(a)}function Ca(i,e){let t=e.fill??i.theme.decorFill??tr,o=e.role==="stage",s=e.role==="reference-focal",n=!!e.role&&!o,r=ls(e),l=te(i.canvasBackground),a=s?l.focalFill:t,c=e.kind==="line"||e.kind==="polyline",h=e.stroke?.color??(o?Ce(a,.28):s?l.focalStroke:c?"#9aa3b5":void 0),d=e.stroke?.width??(o?1:s||c?2:0),u=e.opacity!=null?V(e.opacity,.1,1):1,f=0,y=0,m=null;if(c&&e.points&&e.points.length>=2){f=e.points.reduce((S,v)=>S+v.x,0)/e.points.length,y=e.points.reduce((S,v)=>S+v.y,0)/e.points.length;let p=Ss(e),g=vs(d),b=new Kh({points:e.points.flatMap(S=>[S.x,S.y]),closed:!1,x:f,y,offsetX:f,offsetY:y,rotation:e.rotation??0,stroke:h,fill:h,strokeWidth:d,opacity:u,lineCap:p.lineCap,lineJoin:p.lineJoin,pointerAtBeginning:p.startEnding==="arrow",pointerAtEnding:p.endEnding==="arrow",...g,listening:!1,name:"buyer-shape-open-path"});b.setAttr("shapeObjectId",e.id),i.bgLayer.add(b)}else if(e.kind==="rect"&&e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null){let p=o?{fillLinearGradientStartPoint:{x:0,y:0},fillLinearGradientEndPoint:{x:0,y:e.height},fillLinearGradientColorStops:[0,me(a,.3),1,Ce(a,.12)]}:{fill:a};f=e.x+e.width/2,y=e.y+e.height/2,m={x:e.x,y:e.y,width:e.width,height:e.height},i.bgLayer.add(new vt({x:f,y,offsetX:e.width/2,offsetY:e.height/2,rotation:e.rotation??0,width:e.width,height:e.height,...p,stroke:h,strokeWidth:d,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){f=e.x+e.width/2,y=e.y+e.height/2,m={x:e.x,y:e.y,width:e.width,height:e.height};let p=o?{fillLinearGradientStartPoint:{x:0,y:-e.height/2},fillLinearGradientEndPoint:{x:0,y:e.height/2},fillLinearGradientColorStops:[0,me(a,.3),1,Ce(a,.12)]}:{fill:a};i.bgLayer.add(new Vh({x:f,y,rotation:e.rotation??0,radiusX:e.width/2,radiusY:e.height/2,...p,stroke:h,strokeWidth:d,opacity:u,listening:!1}))}else if(e.kind==="polygon"&&e.points&&e.points.length){let p=e.points.flatMap(S=>[S.x,S.y]),g=K(e.points);f=e.points.reduce((S,v)=>S+v.x,0)/e.points.length,y=e.points.reduce((S,v)=>S+v.y,0)/e.points.length,m=g;let b=o?{fillLinearGradientStartPoint:{x:0,y:g.y},fillLinearGradientEndPoint:{x:0,y:g.y+g.height},fillLinearGradientColorStops:[0,me(a,.3),1,Ce(a,.12)]}:{fill:a};i.bgLayer.add(new ba({points:p,closed:!0,x:f,y,offsetX:f,offsetY:y,rotation:e.rotation??0,...b,stroke:h,strokeWidth:d,opacity:u,listening:!1}))}m&&e.role&&i.landmarkBoxes.push(m);for(let p of zo(e))i.bgLayer.add(new ba({points:p.points.flatMap(g=>[g.x,g.y]),closed:p.closed,x:f,y,offsetX:f,offsetY:y,rotation:e.rotation??0,stroke:p.ink??Ko,fill:p.fill,strokeWidth:2,opacity:u*.85,listening:!1,perfectDrawEnabled:!1,name:"buyer-stage-marking"}));if(e.label)if(o){let{node:p,spec:g}=$h(i,f,y,e.label,a,m,e.labelStyle);i.primaryFocalLabels.set(p,g),i.freeTextById.set(e.id,{node:p,background:a,kind:"stage"})}else if(n){let p=s||r,g=wt(i,i.bgLayer,e.label,f,y,p?re(a,"#e6e9f0"):"#9aa3b5",p?18:12,!1);p&&i.primaryFocalLabels.set(g,{targetPx:18,trackingRatio:0,ink:String(g.fill()??""),plateInk:String(g.fill()??""),plate:new vt({width:0,height:0,opacity:0,listening:!1})}),i.freeTextById.set(e.id,{node:g,background:a,kind:"decor"})}else{let p=wt(i,i.bgLayer,e.label,f,y,"#cbd5e1",16,!0);i.freeTextById.set(e.id,{node:p,background:a,kind:"decor"})}}var bo=22,Uh=N,mi=6;function $h(i,e,t,o,s,n,r){let l=r?.size??bo,a=r?.color??i.theme.textColor??"#e6e9f0",c=r?.color??re(s,a),h=n?n.x+n.width/2:e,d=n?n.y+n.height/2:t,u=qh(i.canvasBackground,s),f=new vt({x:h,y:d,width:0,height:0,cornerRadius:4,fill:u,opacity:0,listening:!1,perfectDrawEnabled:!1});i.bgLayer.add(f);let y=new So({x:h,y:d,text:o,fontSize:l,fontStyle:eo(r?.bold??!0,r?.italic,"normal"),letterSpacing:l*(4/bo),fontFamily:r?.fontFamily??i.labelFont(),fill:c,textDecoration:r?.underline?"underline":"",listening:!1,perfectDrawEnabled:!1});return y.offsetX(y.width()/2),y.offsetY(y.height()/2),i.bgLayer.add(y),{node:y,spec:{targetPx:l,...n?{bounds:n}:{},trackingRatio:4/bo,ink:c,plateInk:r?.color??re(u,a),plate:f}}}function qh(i,e){return j(e,F(i)?"#ffffff":"#000000",.34)}function xa(i,e,t,o){let s=Math.max(t,1e-4),n=e.targetPx/s,r=f=>{i.letterSpacing(f*e.trackingRatio),o(i,f)};r(n);let l=e.bounds;if(!l){e.plate.opacity(0),i.fill(e.ink);return}let a={width:l.width-mi*2,height:l.height-mi*2},c=Math.min(1,a.width/Math.max(i.width(),1e-6),a.height/Math.max(i.height(),1e-6));if(c<1&&(n=Math.max(Uh/s,n*c),r(n)),i.width()<=a.width&&i.height()<=a.height){e.plate.opacity(0),i.fill(e.ink);return}let d=i.width()+mi*2,u=i.height()+mi;e.plate.size({width:d,height:u}),e.plate.offset({x:d/2,y:u/2}),e.plate.opacity(1),i.fill(e.plateInk)}function Ta(i,e){let t=i.catColor.get(e.categoryKey)??"#6e7bff",o=i.canvasBackground,s=is(t,o,Ae),n=i.theme.textColor??"#e6e9f0",r=re(s,n),l=We(e.points,e.holes,{fill:t,opacity:Ae,stroke:t,strokeWidth:1.5,cornerRadius:e.cornerRadius});l.setAttr("gaId",e.id),l.on("click tap",u=>{i.isGhostClick(u)||i.opts.onGAClick?.(e.id)}),l.on("mouseenter",()=>{i.container.style.cursor="pointer"}),l.on("mouseleave",()=>{i.container.style.cursor="default"}),i.bgLayer.add(l);let a=Mt(e.points,e.holes),c=i.sections.find(u=>oe(a,u.outline,u.holes)),h=wt(i,i.bgLayer,e.displayLabel??e.label,a.x,a.y-8,r,_t,!1),d=wt(i,i.bgLayer,`cap ${e.capacity}`,a.x,a.y+10,r,Bt,!1);i.freeTextById.set(`${e.id}:label`,{objectId:e.id,node:h,background:s,kind:"ga-label",categoryKey:e.categoryKey}),i.freeTextById.set(`${e.id}:capacity`,{objectId:e.id,node:d,background:s,kind:"ga-capacity",categoryKey:e.categoryKey}),i.gaById.set(e.id,{label:e.displayLabel??e.label,capacity:e.capacity,categoryKey:e.categoryKey,points:e.points,polygon:l,effectiveBackground:s,strokeColor:t,labelPoint:a,labelNode:h,capacityNode:d,...c?{sectionId:c.logicalId}:{}})}function wt(i,e,t,o,s,n,r,l){let a=new So({x:o,y:s,text:t,fontSize:r,fontStyle:l?"700":"500",fontFamily:i.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});return a.offsetX(a.width()/2),a.offsetY(a.height()/2),e.add(a),a}import{Text as Zh}from"konva/lib/shapes/Text";var jh=4;function Ia(i){return F(i)?{plate:"#ffffff",stroke:"rgba(15,23,42,0.18)"}:{plate:"#0f1622",stroke:"rgba(226,232,240,0.22)"}}function Qh(i,e,t,o){let s=Math.max(0,Math.min(o,e/2,t/2));i.beginPath(),i.moveTo(s,0),i.arcTo(e,0,e,t,s),i.arcTo(e,t,0,t,s),i.arcTo(0,t,0,0,s),i.arcTo(0,0,e,0,s),i.closePath()}function Pa(i,e){i.padding(jh),i.shadowBlur(0),i.shadowOpacity(0),i.sceneFunc(function(o){let s=this.width(),n=this.height();o.save(),Qh(o,s,n,Math.min(n/2,8)),o.setAttr("fillStyle",e.plate),o.fill(),o.setAttr("strokeStyle",e.stroke),o.setAttr("lineWidth",1),o.stroke(),o.restore(),Zh.prototype._sceneFunc.call(this,o)})}var Ma=/^[\p{L}\p{N}]{1,4}$/u,Jh=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function Ra(i,e){let t=e?.trim();if(!t)return i;let o=i.toLocaleLowerCase("en-US"),s=t.toLocaleLowerCase("en-US");if(o.startsWith(`${s} `)){let r=i.slice(t.length).trim();if(Ma.test(r))return r}let n=Jh.exec(i);if(n){let r=n[1].toLocaleLowerCase("en-US"),l=n[2].trim();if((s.startsWith(r)||r.startsWith(s))&&Ma.test(l))return l}return i}function Aa(i,e){let t=[],o=e.canvasBackground,s=new Map,n=(c,h)=>{let d=s.get(c)??[];d.push(h),s.set(c,d)};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 i.objects){if(c.type!=="row")continue;let h=c.segmentedRow?.repeatLabelOnComponents===!0;if(c.segmentedRow&&!h&&c.segmentedRow.componentIndex!==0)continue;let d=h?c.labelPresentation:c.segmentedRow?.labelPresentation??c.labelPresentation;if(d?.visible===!1||d?.positionPreset==="none")continue;let u=c.segmentedRow&&!h?c.segmentedRow.groupId:c.id,f=(s.get(u)??[]).slice().sort((R,M)=>r(R)-r(M));if(!f.length)continue;let y=f[0],m=f[f.length-1],p=d?.labelStyle,g=d?.style==="pill"?Ia(o):null,b=g?g.plate:o,S=Ee(b,p?.color,e.theme.rowLabelColor??e.theme.textColor??"#e6e9f0",Ue),v=p?.size??ts,L=d?.rotation??0,w=e.objectFilteredOut(c)?.15:1,k=f.reduce((R,M)=>R??e.seatSection.get(M.id),void 0),x=c.segmentedRow?.displayLabel??c.displayLabel??Ra(c.label,k?.label);if(!x)continue;let T=k?[...new Set([k.id,k.logicalId,k.zone].filter(R=>!!R))]:void 0,P=(R,M,_)=>t.push({text:x,x:R,y:M,rotation:L,fontSize:v,ink:S,opacity:w,...g?{pill:g}:{},...T?.length?{focusKeys:T}:{},..._?{automaticAway:_}:{}});if(d?.position){P(d.position.x,d.position.y);continue}let I=e.seatR+12,A=d?.positionPreset??"start";if(A==="start"||A==="both"){let R=c.rotation*Math.PI/180,M={x:-Math.cos(R),y:-Math.sin(R)};P(y.x+M.x*I,y.y+M.y*I,M)}if(A==="end"||A==="both"){let R=(c.rotation+c.curve)*Math.PI/180,M={x:Math.cos(R),y:Math.sin(R)};P(m.x+M.x*I,m.y+M.y*I,M)}}let l=(e.seatR+12)*2.2,a=[];for(let c of t){let h=a.find(d=>d.text===c.text&&Math.hypot(d.x-c.x,d.y-c.y)<=l);if(h){h.x=(h.x+c.x)/2,h.y=(h.y+c.y)/2;continue}a.push(c)}return a}function vo(i,e,t=Q){let o=i.rotation()*Math.PI/180,s=Math.abs(Math.cos(o)),n=Math.abs(Math.sin(o)),r=(i.width()*s+i.height()*n)/2+t,l=(i.width()*n+i.height()*s)/2+t;return{x:e.x-r,y:e.y-l,width:r*2,height:l*2}}function Ea(i,e,t,o){let s={x:e.x,y:e.y},n=e.automaticAway;if(!n)return s;let r={x:-n.y,y:n.x},l=Math.max(7,Math.min(16,e.fontSize*.75)),a=[{x:0,y:0}];for(let u=1;u<=4;u++){let f=l*u;a.push({x:r.x*f,y:r.y*f},{x:-r.x*f,y:-r.y*f},{x:n.x*f,y:n.y*f},{x:(n.x+r.x)*f,y:(n.y+r.y)*f},{x:(n.x-r.x)*f,y:(n.y-r.y)*f})}let c=s,h=1/0,d=1/0;for(let u of a){let f={x:s.x+u.x,y:s.y+u.y},y=vo(i,f),p=(o?Nt(o,y,{mode:"overlap"}).length:0)+t.collisionCount(y),g=Math.hypot(u.x,u.y);if((p<h||p===h&&g<d)&&(c=f,h=p,d=g),p===0)break}return c}function _a(i,e){let t=e,o=t._cache.get("canvas");if(!o)return;let s=[o.scene,o.filter,o.hit].map(n=>n?._canvas).filter(n=>!!n);s.length&&i.Util.releaseCanvas(...s),t._cache.delete("canvas")}function Ba(i,e){let t=0,o=0,s=n=>{t||(t=n),o+=1;let r=n-t;r>=1e3&&(i(Math.round(o*1e3/r)),o=0,t=n),e(requestAnimationFrame(s))};e(requestAnimationFrame(s))}import{Group as ed}from"konva/lib/Group";import{Line as Fa}from"konva/lib/shapes/Line";import{Rect as td}from"konva/lib/shapes/Rect";import{Text as Oa}from"konva/lib/shapes/Text";var Da=.6;function id(i,e){return i>=se||e&&i>=Vt}function od(i){return i.effectiveScale<Vt?!1:i.focusActive||i.stageWidth<ue}function sd(i,e,t){return t&&e>=Vt?Math.max(i,Es/Math.max(e,1e-4)):i}function nd(i){let{authoredFontSize:e,measuredWidth:t,maxWidth:o,effectiveScale:s}=i;if(!(t>o)||!(t>0))return e;let n=N/Math.max(s,1e-4),r=e*o/t;return Math.max(Math.min(ht,n),r)}function Lo(i,e){let t=(e?1:3)*Math.min(1,i/le);return Math.max(1,i*2-t)}function Ga(i){let e=new Map;for(let s of i){let n=e.get(s.rowId);n?n.push(s):e.set(s.rowId,[s])}let t=[];for(let s of e.values())if(!(s.length<2))for(let n=1;n<s.length;n+=1){let r=Math.hypot(s[n].x-s[n-1].x,s[n].y-s[n-1].y);r>0&&Number.isFinite(r)&&t.push(r)}if(!t.length)return 0;t.sort((s,n)=>s-n);let o=Math.floor(t.length/2);return t.length%2?t[o]:(t[o-1]+t[o])/2}function Na(i,e){return e>0?Math.min(i,e/2):i}function ko(i){let e=Math.max(i*2,1e-4);return Math.max(we,os/e)}function Co(i){let e=Lo(i,!1),t=Lo(le,!1),o=e>0?t/e:1;return se*Math.max(1,o)/Oi(1,!1,N)}function Ha(i){return Co(i)*on}function wo(i,e,t){let o=i.seatLabelContainer(e);t.getParent()!==o&&o.add(t)}function Wa(i){let e=i.exportMode?Math.max(i.effScale(),se):i.effScale(),t=od({effectiveScale:e,focusActive:i.focusedSectionId!=null,stageWidth:i.stage.width()}),o=i.exportMode?e:Oi(e,i.labelsWereVisible(),N),s=id(o,t);i.onLabelVisibilityChange(s),i.setSeatLabelRungOpen(s);let n=h=>{let d=h.getClientRect({skipShadow:!0,skipStroke:!0});return d.x>=0&&d.y>=0&&d.x+d.width<=i.stage.width()&&d.y+d.height<=i.stage.height()};for(let[h,d]of i.boothLabelById){let u=i.circleById.get(h);d.visible(ge(d.fontSize(),o)&&!!u?.isVisible()&&i.focusedSeatOpacity(h,u?.getAbsoluteOpacity()??1)>=.5&&n(d))}i.rowLabelGroup.destroyChildren(),i.seatLabelById.clear(),i.seatLabelDrops.clear();let r=new Set,l=new Set,a=0;if(s)for(let h of i.visibleSeatCandidates()){if(h.kind==="booth")continue;let d=i.worldToScreen(h);if(d.x<-20||d.x>i.stage.width()+20||d.y<-20||d.y>i.stage.height()+20||i.accessGlyphById.has(h.id)&&i.accessGlyphShouldShow(h.id))continue;let u=i.circleById.get(h.id);if(!u?.isVisible()){i.seatLabelDrops.set(h.id,"dimmed-or-unavailable");continue}let f=i.statusById.get(h.id)??"free",y=!i.hasSeatMark(h.id)&&(f==="booked"||f==="not_for_sale"||f==="held"&&!i.ownedHold.has(h.id)&&!i.opts.manageMode),m=i.focusedSeatOpacity(h.id,u.getAbsoluteOpacity()),p=y&&!i.focusDims(h.id);if(m<.5&&!p){i.seatLabelDrops.set(h.id,"dimmed-or-unavailable");continue}let g=i.renderedSeatPoint(h),b=i.viewMode==="perspective"?i.perspectiveSeatScale.get(h.id)??1:1;if(y){let C=b*i.statusCueScale(),x=i.statusCueInk(h.id),T=i.statusCuePool.get(h.id);if(T&&T.status===f){let I=T.node;I.position(g),I.scale({x:C,y:C}),I.opacity(m<1?Da:f==="held"?1:mo);for(let A of I.getChildren())A.stroke(x);if(wo(i,h.id,I),l.add(h.id),++a>=Kt)break;continue}T?.node.destroy();let P=new ed({x:g.x,y:g.y,listening:!1});if(P.scale({x:C,y:C}),m<1&&P.opacity(Da),f==="held"?(P.add(new td({x:-4.2,y:-.7,width:8.4,height:6.5,cornerRadius:1.3,stroke:x,strokeWidth:1.25,listening:!1})),P.add(new Fa({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:x,strokeWidth:1.2,lineCap:"round",lineJoin:"round",listening:!1}))):(P.opacity(mo),P.add(new Fa({points:[-4.2,4.2,4.2,-4.2],stroke:x,strokeWidth:1.8,lineCap:"round",listening:!1}))),pi(P),i.statusCuePool.set(h.id,{node:P,status:f}),wo(i,h.id,P),l.add(h.id),++a>=Kt)break;continue}let S=sd(ye*i.seatLabelScale(h),e,t),v=Ot(h.displayLabel??h.label),L=u?i.seatLabelInk(h,u):i.seatPreferredLabelInk(h),w=i.seatLabelPool.get(h.id);w?(w.position(g),w.text(v),w.fontSize(S),w.fontFamily(i.labelFont()),w.fill(L),w.offset({x:0,y:0}),w.scale({x:1,y:1})):(w=new Oa({x:g.x,y:g.y,text:v,fontSize:S,fontStyle:"600",fontFamily:i.labelFont(),fill:L,listening:!1,perfectDrawEnabled:!1}),i.seatLabelPool.set(h.id,w));let k=Lo(i.seatR,t);if(w.fontSize(nd({authoredFontSize:S,measuredWidth:w.width(),maxWidth:k,effectiveScale:e})),w.width()>k+.01){i.seatLabelDrops.set(h.id,"label-overflows-marker");continue}if(!ge(w.fontSize(),e)){i.seatLabelDrops.set(h.id,"below-minimum-size");continue}if(w.offsetX(w.width()/2),w.offsetY(w.height()/2),w.scale({x:b,y:b}),wo(i,h.id,w),!n(w)){i.seatLabelDrops.set(h.id,"outside-viewport");continue}if(r.add(h.id),i.seatLabelById.set(h.id,w),++a>=Kt)break}for(let[h,d]of i.seatLabelPool)r.has(h)||(d.destroy(),i.seatLabelPool.delete(h));for(let[h,d]of i.statusCuePool)l.has(h)||(d.node.destroy(),i.statusCuePool.delete(h));let c=new et;for(let{node:h}of i.freeTextById.values()){if(!h.isVisible())continue;let d=h.getClientRect({relativeTo:i.bgLayer,skipShadow:!0,skipStroke:!0});c.insert({x:d.x-Q,y:d.y-Q,width:d.width+Q*2,height:d.height+Q*2})}for(let h of i.rowLabelPlan){let d=i.focusedSectionId!=null&&h.focusKeys?.includes(i.focusedSectionId),u=d?Math.max(h.fontSize,As/Math.max(e,1e-4)):h.fontSize;if(!d&&!ge(u,o))continue;let f=i.worldToScreen({x:h.x,y:h.y});if(f.x<-40||f.x>i.stage.width()+40||f.y<-40||f.y>i.stage.height()+40)continue;let y=new Oa({x:h.x,y:h.y,text:h.text,fontSize:u,fontStyle:"700",fontFamily:i.labelFont(),fill:h.ink,rotation:h.rotation,opacity:h.opacity,shadowColor:"#05070c",shadowBlur:h.ink.toLowerCase()==="#ffffff"?5:0,shadowOpacity:h.ink.toLowerCase()==="#ffffff"?.8:0,shadowForStrokeEnabled:!1,listening:!1,perfectDrawEnabled:!1});h.pill&&Pa(y,h.pill),y.offsetX(y.width()/2),y.offsetY(y.height()/2);let m=i.resolveAutomaticRowLabelPosition(y,h,c);y.position(m),y.setAttr("rowLabel",!0),i.rowLabelGroup.add(y);let p=y.getClientRect({skipShadow:!0,skipStroke:!0}),g=6,b=p.x<g?g-p.x:p.x+p.width>i.stage.width()-g?i.stage.width()-g-p.x-p.width:0,S=p.y<g?g-p.y:p.y+p.height>i.stage.height()-g?i.stage.height()-g-p.y-p.height:0,v=m;if(b||S){let w=i.labelGroup.getAbsoluteTransform(),k=w.point(m);v=w.copy().invert().point({x:k.x+b,y:k.y+S}),y.position(v)}let L=i.rowLabelBox(y,v);if(h.automaticAway&&c.collisionCount(L)>0){y.destroy();continue}c.insert(L)}i.isoT>0&&i.viewMode!=="perspective"&&i.applyUprightLabels(),i.overlayLayer.batchDraw()}function rd(i){return i<0?0:i>1?1:i}function Va(i){let e=i.now??(()=>typeof performance<"u"?performance.now():Date.now()),t=i.budgetMs??8,o=i.reducedMotion===!0,s=i.chunks.length>1?Math.min(30,Math.max(0,840/(i.chunks.length-1))):0,n=0,r=!1,l=!1,a=null,c=[],h=typeof globalThis<"u"?globalThis:{},d=()=>{a&&(a.kind==="idle"?h.cancelIdleCallback?.(a.id):a.kind==="frame"?h.cancelAnimationFrame?.(a.id):clearTimeout(a.id),a=null)},u=p=>{if(!c.length&&typeof h.requestIdleCallback=="function"){a={kind:"idle",id:h.requestIdleCallback(()=>{a=null,p()},{timeout:120})};return}if(typeof h.requestAnimationFrame=="function"){a={kind:"frame",id:h.requestAnimationFrame(()=>{a=null,p()})};return}a={kind:"timer",id:setTimeout(()=>{a=null,p()},16)}},f=()=>{l||r||(l=!0,d(),i.done())},y=p=>{for(let g=c.length-1;g>=0;g--){let b=c[g],S=o?1:rd((p-b.startedAt)/160);i.fade(b.work,S),S>=1&&c.splice(g,1)}return c.length>0},m=()=>{if(r)return;let p=e(),g=p;for(;n<i.chunks.length&&(n===0||e()-g<t);){let S=i.chunks[n++];if(i.build(S.work),i.fade(S.work,o?1:0),o||c.push({work:S.work,startedAt:p+(n-1)*s}),e()-g>=t)break}let b=y(p);i.draw(),n<i.chunks.length||b?u(m):f()};return u(m),{cancel(){if(!l){r=!0,d();for(let p of c)i.fade(p.work,1);c.length=0}},finishNow(){if(!(r||l)){for(;n<i.chunks.length;){let p=i.chunks[n++];i.build(p.work)}for(let p of i.chunks)i.fade(p.work,1);c.length=0,i.draw(),f()}},get done(){return l}}}function Ka(i){let e=new Map,t=[];for(let s of i.seats){let n=i.sectionIdOf(s.id);if(n==null){t.push(s);continue}let r=e.get(n);r?r.push(s):e.set(n,[s])}let o=[...e.entries()].flatMap(([s,n])=>{let r=i.sections.find(l=>l.id===s);return r?[{chunk:{id:s,work:{seats:n,group:r.liftGroupSeat}},distance:Math.hypot(r.centroid.x-i.viewportCentre.x,r.centroid.y-i.viewportCentre.y)}]:[]}).sort((s,n)=>s.distance-n.distance).map(s=>s.chunk);return t.length&&i.looseGroup&&o.push({id:"",work:{seats:t,group:i.looseGroup}}),o}function Lt(i){return{th:zt*Math.PI/180*i.isoT,sg:1-(1-ut)*i.isoT}}function za(i,e){let{th:t,sg:o}=Lt(e),s=e.centre,n=i.x-s.x,r=i.y-s.y,l=n*Math.cos(t)-r*Math.sin(t),a=(n*Math.sin(t)+r*Math.cos(t))*o;return{x:s.x+l,y:s.y+a}}function Xa(i,e){let{th:t,sg:o}=Lt(e),s=e.centre,n=i.x-s.x,l=(i.y-s.y)/o,a=n*Math.cos(t)+l*Math.sin(t),c=-n*Math.sin(t)+l*Math.cos(t);return{x:s.x+a,y:s.y+c}}function Ya(i,e){let{th:t,sg:o}=Lt(e),s=i*e.isoT;return{x:-(s/o)*Math.sin(t),y:-(s/o)*Math.cos(t)}}function Ua(i,e,t){let o=fs(e);i.offset(t),i.position(ae(e,t)),i.rotation(o.rotationDeg),i.scale({x:o.scaleX,y:o.scaleY}),i.skewX(o.skewX),i.skewY(0)}function $a(i){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)}function qa(i,e){let t=Math.hypot(e.x-i.surfaceFocal.x,e.y-i.surfaceFocal.y),o=Math.max(0,t-i.frontDistanceWorld);return i.liftWorld+o*Math.tan(i.rakeDeg*Math.PI/180)}function Za(i,e,t){return i.perspectiveAffine?ae(i.perspectiveAffine,e):ae(t,e)}function ja(i,e){return e?ae(e,i):i}function Qa(i,e){let t=0;for(let d of i.seats){let u=Math.max(0,(d.eyeHeightM??ee)-ee);t=Math.max(t,u*Xe)}for(let d of i.objects)d.type==="section"&&(t=Math.max(t,Pt(d,{floorBaseHeightM:i.floorBaseHeightMFor(d.id)}).height*Xe));let o=ds(i.bounds,t),s=Ht(o,o.target),n=us(s);e.seatLocal.clear(),e.seatProjected.clear(),e.seatDepth.clear(),e.seatScale.clear();let r=1/0,l=1/0,a=-1/0,c=-1/0;for(let d of i.seats){let u=Math.max(0,(d.eyeHeightM??ee)-ee),f=be(o,d,u*Xe),y={x:f.x,y:f.y};e.seatProjected.set(d.id,y),e.seatLocal.set(d.id,ae(n,y)),e.seatDepth.set(d.id,f.depth),e.seatScale.set(d.id,f.scale),r=Math.min(r,f.x),l=Math.min(l,f.y),a=Math.max(a,f.x),c=Math.max(c,f.y)}for(let d of[{x:i.bounds.x,y:i.bounds.y},{x:i.bounds.x+i.bounds.width,y:i.bounds.y},{x:i.bounds.x+i.bounds.width,y:i.bounds.y+i.bounds.height},{x:i.bounds.x,y:i.bounds.y+i.bounds.height}]){let u=be(o,d,0);r=Math.min(r,u.x),l=Math.min(l,u.y),a=Math.max(a,u.x),c=Math.max(c,u.y)}let h=Math.max(24,i.seatR*3);return{camera:o,baseAffine:s,baseInverse:n,bounds:Number.isFinite(r)?{x:r-h,y:l-h,width:Math.max(1,a-r+h*2),height:Math.max(1,c-l+h*2)}:null}}function Ja(i,e,t){let o=t?[...t].map(s=>i.seatById.get(s)).filter(s=>!!s):e?i.seats:[...i.perspectiveAppliedSeats].map(s=>i.seatById.get(s)).filter(s=>!!s);for(let s of o){if(e&&i.perspectiveAppliedSeats.has(s.id))continue;let n=e?i.perspectiveSeatProjected.get(s.id)??s:s,r=e?i.perspectiveSeatScale.get(s.id)??1:1,l=i.circleById.get(s.id);l?.position(n),l?.scale({x:r,y:r});let a=i.accessRingById.get(s.id);a?.position(n),a?.scale({x:r,y:r});let c=i.accessGlyphById.get(s.id);if(c){let d=i.seatR*1.5/xe;c.position(n),c.scale({x:d*r,y:d*r})}let h=i.boothLabelById.get(s.id);h?.position(n),h?.scale({x:r,y:r}),e&&i.perspectiveAppliedSeats.add(s.id)}e||i.perspectiveAppliedSeats.clear()}function To(i){return i?.getAttr?.("seatId")??void 0}var Io=Object.freeze([]),ol=.85,dd=.38,ud=Object.freeze([3,3]),kt=class kt{constructor(e,t={}){this.seatLabelPool=new Map;this.statusCuePool=new Map;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.floorLabelStyle="number";this.circleById=new Map;this.glyphMarkers=[];this.seatGlyphDetail=!0;this.boothDims=new Map;this.boothLabelById=new Map;this.seatLabelById=new Map;this.seatLabelDrops=new Map;this.seatLabelRungOpen=!1;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.catByKey=new Map;this.theme={};this.canvasBackground=to;this.effSelection=gt;this.colorblind=!1;this.cbHueByKey=new Map;this.rowLabelPlan=[];this.catOrder=[];this.selection=new Set;this.selectionMarkers=new Map;this.momentsCache=null;this.breathCache=null;this.ownedCache=null;this.beaconsCache=null;this.ownedHold=new Set;this.seatMarks=new ui;this.selectionFocusId=null;this.selectionFocusKeep=null;this.hiddenPose=null;this.hoveredId=null;this.focusedId=null;this.accessFilter=null;this.categoryHighlight=null;this.categoryFilter=null;this.commercialLimitedFilter=!1;this.sections=[];this.zones=[];this.landmarkBoxes=[];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.focusMembership=new Map;this.focusMembershipKey=null;this.focusAnchor=null;this.focusRoams=!1;this.focusBackdrop=null;this.focusDimOverlay=null;this.objectFloor=new Map;this.unsectionedSeatIds=null;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.labelsVisible=!1;this.labelFadeRaf=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.cameraGlideMs=Vr();this.fitScale=1;this.fitPose="";this.viewportInsets={...po};this.seatR=le;this.markerR=le;this.seatPitch=0;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.seatReveal=null;this.seatRevealPending=!1;this.progressiveSeatFloor=800;this.rafId=0;this.recacheTimer=null;this.mountCachePending=!1;this.resizeObs=null;this.viewChangeRaf=0;this.zoomSettleRaf=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 o=this.focusedId?this.nearestSeat(this.focusedId,t):this.seats[0]?.id??null;o&&this.focusSeat(o);return}if((e.key==="Enter"||e.key===" ")&&this.focusedId){e.preventDefault(),this.toggleSeat(this.focusedId);let o=this.seatById.get(this.focusedId);o&&this.opts.onFocusSeat?.(o)}};this.seatAnchorContextCache=null;this.container=e,this.opts={maxSelection:10,selectableStatuses:["free"],...t},this.exportMode=t.exportMode===!0,this.loadingReveal=t.loadingReveal??"progressive",this.onSeatsRevealed=t.onSeatsRevealed,this.currency=t.currency;let o=yi.pixelRatio;if(this.exportMode&&(this.dpr=1),yi.pixelRatio=this.dpr,this.stage=new ld({container:e,width:e.clientWidth||1,height:e.clientHeight||1,draggable:!1}),this.gestures=new fi(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",H("map.aria")),e.addEventListener("keydown",this.onKeyDown)),this.bgLayer=new xo({listening:!this.exportMode}),this.seatLayer=new xo({listening:!this.exportMode}),this.overlayLayer=new xo({listening:!1}),this.labelGroup=new Ve({listening:!1}),this.overlayLayer.add(this.labelGroup),this.rowLabelGroup=new Ve({listening:!1}),this.labelGroup.add(this.rowLabelGroup),this.fgDecorGroup=new Ve({listening:!1}),this.overlayLayer.add(this.fgDecorGroup),this.clusterLabels=new li({labelLayer:this.overlayLayer,stage:this.stage,exportMode:this.exportMode,canvasBackground:()=>this.canvasBackground,labelFont:()=>this.labelFont(),reducedMotion:()=>this.reducedMotion,destroyed:()=>this.destroyed,hasSections:()=>this.hasSections,seats:()=>this.seats,seatR:()=>this.seatR,readableScale:()=>Co(this.markerR),pickableScale:()=>ko(this.markerR),categoryLabel:s=>this.catByKey.get(s)?.label??"",categoryColor:s=>this.categoryDisplayColor(s),categoryPriceLabel:s=>this.categoryPriceLabel(s),categoryFilter:()=>this.categoryFilter,viewMode:()=>this.viewMode,seatsPickable:()=>this.seatsPickable(),screenToWorld:s=>this.screenToWorld(s),zoomBounds:()=>this.zoomBounds(),framingViewport:()=>this.framingViewport(),focusRegion:(s,n)=>this.focusRegion(s,n),cameraGlideMs:()=>this.cameraGlideMs}),this.hoverRing=new el({radius:le+2,stroke:"#ffffff",strokeWidth:2,opacity:ol,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.hoverRing),this.focusRing=new el({radius:le+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&&(yi.pixelRatio=o),!this.exportMode){this.wireInteraction();let s=this.opts.onFps;s&&Ba(s,n=>{this.rafId=n})}!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 moments(){return this.momentsCache||(this.momentsCache=new ii({overlayLayer:this.overlayLayer,seatLayer:this.seatLayer,stage:this.stage,seatRadius:()=>this.seatR,canvasBackground:()=>this.canvasBackground,selectionColor:()=>this.effSelection,reducedMotion:()=>this.reducedMotion,isDestroyed:()=>this.destroyed,isCached:()=>this.cached,isExportMode:()=>this.exportMode,labelFont:()=>this.labelFont(),viewMode:()=>this.viewMode,perspectiveSeatScale:e=>this.perspectiveSeatScale.get(e)??1,seat:e=>this.seatById.get(e),seatStatus:e=>this.statusById.get(e)??"free",seatShape:e=>this.circleById.get(e),seatPoint:e=>this.renderedSeatPoint(e),boothDims:e=>this.boothDims.get(e),selectionFocusId:()=>this.selectionFocusId,selectionFocusDims:e=>this.selectionFocusDims(e),categoryColor:e=>this.categoryDisplayColor(e),priceLabel:e=>this.categoryPriceLabel(e.categoryKey),seatClosed:e=>this.seatInClosedSection(e),screenToWorld:e=>this.screenToWorld(e),nearestSeat:(e,t)=>this.nearestSeatToScreen(e,t)})),this.momentsCache}get breath(){return this.breathCache||(this.breathCache=new oi({overlayLayer:this.overlayLayer,canvasBackground:()=>this.canvasBackground,selectionColor:()=>this.effSelection,categoryColor:e=>this.categoryDisplayColor(e),seatCategoryKey:e=>this.seatById.get(e)?.categoryKey??null,isOwnedHold:e=>this.ownedHold.has(e),reducedMotion:()=>this.reducedMotion,isDestroyed:()=>this.destroyed})),this.breathCache}get beacons(){return this.beaconsCache||(this.beaconsCache=new ni({overlayLayer:this.overlayLayer,container:this.container,accent:()=>this.effSelection,accentInk:()=>Qi(this.effSelection),labelFont:()=>this.labelFont(),stageScale:()=>this.stage.scaleX(),worldToScreen:e=>this.worldToScreen(e),activate:e=>this.activateBeacon(e)})),this.beaconsCache}activateBeacon(e){let t=e.kind==="section"?e.id:this.seatSection.get(e.seatId)?.logicalId??null;if(t){let o=this.sectionTapAnchor(t,this.renderedSeatPoint(this.seatById.get(e.seatId)??{x:0,y:0}));this.opts.onSectionTap?this.opts.onSectionTap(t,o):this.focusSection(t,{anchor:o})}this.focusSeat(e.seatId,{move:!t})}syncBeacons(){if(!this.beaconsCache&&!this.selectionMarkers.size)return;let e=this.beacons;e.sync(Gn({rung:this.getRung(),sections:this.sections,zones:this.zones,ownedSeatIds:t=>this.ownedSeatIds(t),sectionName:t=>t.nameLabel.text()||t.logicalId,sectionAnchor:t=>({x:t.nameLabel.x(),y:t.nameLabel.y()})})),this.breath.syncBeacons(e.breathingRings())}ownedSeatIds(e){return e.memberIds.filter(t=>this.selection.has(t)||this.ownedHold.has(t))}get owned(){return this.ownedCache||(this.ownedCache=new ri({overlayLayer:this.overlayLayer,sections:()=>this.sections,ownedPoints:e=>this.ownedSeatPoints(e),sectionColor:e=>e.shellCategoryColor,labelAnchor:e=>({x:e.nameLabel.x(),y:e.nameLabel.y()}),stageScale:()=>this.stage.scaleX(),labelFont:()=>this.labelFont()})),this.ownedCache}sectionTapAnchor(e,t){return this.owned.anchorFor(e)??t}ownedSeatPoints(e){let t=[];for(let o of e.memberIds){if(!this.selection.has(o)&&!this.ownedHold.has(o))continue;let s=this.seatById.get(o);s&&t.push(this.renderedSeatPoint(s))}return t}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(),touchProbeStart:e=>this.showTouchLoupe(e),touchProbeMove:e=>this.showTouchLoupe(e),touchProbeEnd:()=>this.hideTouchLoupe()}}setChart(e,t){if(e!==this.chartDoc&&(this.stacked=!1,this.floorOverview=!1),this.cancelAssetLoads(),this.cancelSeatReveal(),this.chartDoc=e,this.activeFloorId=t?.floorId??Rt(e)[0].id,this.objectFloor.clear(),e.floors&&e.floors.length>1)for(let n of e.floors)for(let r of n.objects)this.objectFloor.set(r.id,n.id),r.type==="section"&&r.logicalSectionId&&this.objectFloor.set(r.logicalSectionId,n.id);let o=this.floorView(e);this.focusedId=null,this.focusRing.visible(!1),this.bgLayer.destroyChildren(),this.clusterLabels.clear(),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.seatLabelPool.clear(),this.statusCuePool.clear(),this.rowLabelGroup=new Ve({listening:!1}),this.labelGroup.add(this.rowLabelGroup),this.fgDecorGroup.destroyChildren(),this.circleById.clear(),this.glyphMarkers=[],this.boothDims.clear(),this.boothLabelById.clear(),this.seatLabelById.clear(),this.accessRingById.clear(),this.accessGlyphById.clear(),this.freeTextById.clear(),this.iconNodeById.clear(),this.focusMembership.clear(),this.focusMembershipKey=null,this.unsectionedSeatIds=null,this.primaryFocalLabels.clear(),this.gaById.clear();for(let n of this.selectionMarkers.values())n.destroy();this.selectionMarkers.clear(),this.beaconsCache?.clear(),this.breathCache?.syncBeacons([]),this.breathCache?.sync(this.selectionMarkers),this.ownedHold.clear(),this.seatMarks.clear(),this.selectionFocusId=null,this.selectionFocusKeep=null,this.statusById.clear(),this.seatAnchorContextCache=null,this.selection.clear(),this.seatById.clear(),this.seatIndex=null,this.cached=!1,this.accessFilter=null,this.sections=[],this.zones=[],this.landmarkBoxes=[],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=o.objects.some(n=>n.type==="section");for(let n of e.zones??[])n.color&&this.zoneColor.set(n.id,n.color);this.seatLayer.opacity(1),this.hoverRing.visible(!1),this.hoveredId=null,this.theme=e.theme??{},this.seatR=ms(this.theme.seatScale)*le,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.catByKey.clear(),this.catPrice.clear(),this.catOrder=e.categories.map(n=>n.key),this.cbHueByKey.clear(),[...this.catOrder].sort().forEach((n,r)=>{this.cbHueByKey.set(n,Qt[r%Qt.length])});for(let n of e.categories)this.catColor.set(n.key,n.color),this.catByKey.set(n.key,n),typeof n.price=="number"&&this.catPrice.set(n.key,n.price);for(let n of o.objects)n.type==="booth"&&this.boothDims.set(n.id,{width:n.width,height:n.height,rotation:n.rotation,...n.points&&n.points.length>=3?{points:n.points.map(r=>({x:r.x,y:r.y}))}:{}});this.seats=Ye(o,{floorBaseHeightM:this.stacked||this.floorOverview?0:this.floorBaseHeightMFor()});for(let n of this.seats)this.seatById.set(n.id,n),this.statusById.set(n.id,"free");this.seatIndex=hs(this.seats,{seatRadius:this.seatR}),this.seatPitch=Ga(this.seats),this.markerR=Na(this.seatR,this.seatPitch),this.clusterLabels.rebuild(),this.bounds=Uo(o,{freeText:"exclude"}),this.isoCentre={x:this.bounds.x+this.bounds.width/2,y:this.bounds.y+this.bounds.height/2},this.buildPerspectiveProjection(o),this.renderBackground(o),this.unsectionedSeatGroup=new Ve({listening:!this.exportMode}),this.seatLayer.add(this.unsectionedSeatGroup);let s=this.seatRevealWanted();this.seatRevealPending=s,s||this.renderSeats(),this.buildRowLabelPlan(o),this.overlayLayer.add(this.labelGroup),this.overlayLayer.add(this.fgDecorGroup),this.overlayLayer.add(this.hoverRing),this.overlayLayer.add(this.focusRing),this.mountCachePending=!s,this.zoomToFit(),s&&this.startSeatReveal()}seatRevealWanted(){return this.loadingReveal==="progressive"&&!this.exportMode&&this.sections.length>1&&this.seats.length>=this.progressiveSeatFloor}startSeatReveal(){this.cancelSeatReveal();let e=Ka({seats:this.seats,sections:this.sections,sectionIdOf:t=>this.seatSection.get(t)?.id??null,looseGroup:this.unsectionedSeatGroup,viewportCentre:this.viewportCentreInChartSpace()});this.seatReveal=Va({chunks:e,build:t=>this.renderSeats(t.seats),fade:(t,o)=>t.group.opacity(o),draw:()=>{this.seatLayer.batchDraw()},reducedMotion:this.reducedMotion,done:()=>{this.seatReveal=null,this.seatRevealPending=!1,this.afterViewChange(),this.fitPose&&ji(this.stage)===this.fitPose&&this.zoomToFit(),this.seatLayer.batchDraw(),this.onSeatsRevealed?.()}})}viewportCentreInChartSpace(){let e=this.stage.scaleX()||1;return{x:(this.stage.width()/2-this.stage.x())/e,y:(this.stage.height()/2-this.stage.y())/e}}cancelSeatReveal(e=!1){let t=this.seatReveal;this.seatRevealPending=!1,t&&(this.seatReveal=null,e?t.finishNow():t.cancel(),this.seats.length&&!this.destroyed&&this.updateLabels())}floorView(e){if(!e.floors?.length)return{...e,referenceImage:void 0,backgroundImage:ct(e)};if(this.floorOverview&&e.floors.length>=2)return $o(e,{labelStyle:this.floorLabelStyle});if(this.stacked&&e.floors.length>=2)return{...Yo(e),referenceImage:void 0,backgroundImage:ct(e)};let t=e.floors.find(o=>o.id===this.activeFloorId)??e.floors[0];return{...e,objects:t.objects,focalPoint:t.focalPoint,referenceImage:void 0,backgroundImage:ct(t),floors:void 0}}floorBaseHeightMFor(e){let t=this.chartDoc?.floors;if(!t?.length)return 0;let o=this.stacked&&e?this.objectFloor.get(e)??this.activeFloorId:this.activeFloorId;return t.find(s=>s.id===o)?.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}setFloorLabelStyle(e){e===this.floorLabelStyle||!this.chartDoc||(this.floorLabelStyle=e,this.floorOverview&&this.setChart(this.chartDoc,{floorId:this.activeFloorId}))}getFloorLabelStyle(){return this.floorLabelStyle}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?Rt(this.chartDoc).map(e=>({id:e.id,name:e.name})):[]}getActiveFloorId(){return this.activeFloorId}setStatus(e,t){let o=!1,s=this.hasSections?new Set:null;for(let n of e){if(!this.statusById.has(n))continue;let r=this.statusById.get(n);if(r===t)continue;this.statusById.set(n,t);let l=this.circleById.get(n);if(l&&(this.paintSeat(l,n),o=!0),s){let a=this.seatSection.get(n);a&&(r==="free"!=(t==="free")&&(a.free+=t==="free"?1:-1),s.add(a))}}if(s&&s.size){for(let n of s)this.refreshSectionFill(n);this.bgLayer.batchDraw()}o&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>se&&this.updateLabels())}setSeatCategories(e){let t=!1,o=new Set;for(let[n,r]of Object.entries(e)){let l=this.seatById.get(n);if(!l||!this.catColor.has(r)||l.categoryKey===r)continue;l.categoryKey=r;let a=this.circleById.get(n);a&&(this.paintSeat(a,n),t=!0);let c=this.seatSection.get(n);c&&o.add(c)}if(!t)return;let s=new Map((this.chartDoc?Rt(this.chartDoc):[]).flatMap(n=>n.objects).filter(n=>n.type==="section").map(n=>[n.id,n]));for(let n of o){if(!s.get(n.id)?.color){let l=new Map;for(let a of n.memberIds){let c=this.seatById.get(a)?.categoryKey;c&&l.set(c,(l.get(c)??0)+1)}n.baseFill=Ri([...l].map(([a,c])=>({hex:this.catColor.get(a)??"#6e7bff",w:c})),"#3a4358")}n.shellCategoryColor=this.dominantSellableColor(n.memberIds),this.refreshSectionFill(n)}o.size&&this.bgLayer.batchDraw(),this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>se&&this.updateLabels()}setOwnedHold(e){let t=new Set((e??[]).filter(s=>this.statusById.has(s))),o=new Set([...this.ownedHold,...t]);this.ownedHold=t;for(let s of o){let n=this.circleById.get(s);n&&this.paintSeat(n,s),this.syncSelectionMarker(s)}o.size&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>se&&this.updateLabels(),this.overlayLayer.batchDraw())}setSelectionFocus(e){let t=e&&this.selection.has(e)?e:null;if(t===this.selectionFocusId)return;let o=this.selectionFocusId;this.selectionFocusId=t,this.selectionFocusKeep=la({focusedId:t,seats:this.seats,seatId:r=>r.id,seatPoint:r=>this.renderedSeatPoint(r),sectionOf:r=>this.seatSection.get(r)?.logicalId??null,seatPitch:this.seatPitch,seatRadius:this.seatR});let n=o!=null&&t!=null&&ca(o,t,r=>this.seatSection.get(r)?.logicalId??null)?[o,t]:this.seats.map(r=>r.id);for(let r of n){let l=this.circleById.get(r);l&&this.paintSeat(l,r)}o&&this.syncSelectionMarker(o),t&&this.syncSelectionMarker(t);for(let[r,l]of this.selectionMarkers)l.opacity(this.selectionFocusDims(r)?.2:1);this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.updateLabels(),this.overlayLayer.batchDraw()}setSeatMarks(e){let t=this.seatMarks.merge(e,this.statusById);for(let o of t){let s=this.circleById.get(o);s&&this.paintSeat(s,o)}t.size&&(this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw())}getSeatMark(e){return this.seatMarks.get(e)}getStatus(e){return this.statusById.get(e)??"free"}getSelection(){let e=[];for(let t of this.selection){let o=this.seatById.get(t);o&&e.push(o)}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 o of e){if(this.selection.has(o)||!this.isSelectable(o))continue;if(this.selection.size>=this.opts.maxSelection){this.opts.onSelectionLimit?.(this.opts.maxSelection);break}this.setSelected(o,!0,!0);let s=this.seatById.get(o);s&&t.push(s)}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(o=>!this.isSelectable(o));t.length&&this.deselect(t),!e.manageMode&&this.selection.size&&this.clearSelection(),this.clusterLabels.syncCursor(!1),this.overlayLayer.batchDraw()}setSectionHeat(e){this.sectionHeat.clear();for(let[t,o]of Object.entries(e??{}))Number.isFinite(o)&&this.sectionHeat.set(t,Math.max(0,Math.min(1,o)));for(let t of this.sections)this.refreshSectionHeat(t);this.bgLayer.batchDraw()}deselect(e){let t=!1;for(let o of e)this.selection.has(o)&&(this.setSelected(o,!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),o=[];for(let s of this.seats)t.has(s.label)&&this.isSelectable(s.id)&&o.push(s.id);return this.selectMany(o)}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=[],o=new Set;for(let s of this.sections)if(!(s.id!==e&&s.logicalId!==e&&s.zone!==e))for(let n of s.memberIds){if(o.has(n)||(o.add(n),!this.isSelectable(n)))continue;let r=this.seatById.get(n);r&&t.push(r)}return t}selectMany(e){let t=e.filter(s=>!this.selection.has(s));if(!t.length)return this.getSelection();let o=this.selection.size+t.length<=_s;for(let s of t)if(o)this.setSelected(s,!0,!0);else{this.selection.add(s);let n=this.circleById.get(s);n&&this.paintSeat(n,s)}return this.cached||this.seatLayer.batchDraw(),this.overlayLayer.batchDraw(),this.getSelection()}beginMarquee(e){let t=this.screenToWorld(e),o=this.stage.scaleX()||1,s=new tl({x:t.x,y:t.y,width:0,height:0,stroke:this.effSelection,strokeWidth:1.5/o,dash:[5/o,4/o],fill:"rgba(110,123,255,0.10)",listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.overlayLayer.add(s),this.marquee={start:t,rect:s},this.marqueeCur=t,this.overlayLayer.batchDraw()}updateMarquee(e){if(!this.marquee)return;let t=this.screenToWorld(e),{start:o,rect:s}=this.marquee;s.setAttrs({x:Math.min(o.x,t.x),y:Math.min(o.y,t.y),width:Math.abs(t.x-o.x),height:Math.abs(t.y-o.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 o=Math.min(e.start.x,t.x),s=Math.max(e.start.x,t.x),n=Math.min(e.start.y,t.y),r=Math.max(e.start.y,t.y),l=this.stage.scaleX()||1;if((s-o)*l<4&&(r-n)*l<4){this.selection.size&&(this.clearSelection(),this.opts.onMarquee?.([]));return}let a=[];for(let c of this.seats){let h=this.renderedSeatPoint(c);h.x<o||h.x>s||h.y<n||h.y>r||this.isSelectable(c.id)&&a.push(c.id)}this.selectMany(a),this.opts.onMarquee?.(this.getSelection())}flashSeat(e,t="#f43f5e"){let o=this.seatById.get(e);o&&Ar(this.flashHost,e,this.renderedSeatPoint(o),t)}flashSection(e,t="#22a06b"){Er(this.flashHost,this.sections.filter(o=>o.id===e||o.zone===e),t)}get flashHost(){return{overlayLayer:this.overlayLayer,seatRadius:()=>this.seatR,reducedMotion:()=>this.reducedMotion,isDestroyed:()=>this.destroyed,viewMode:()=>this.viewMode,perspectiveSeatScale:e=>this.perspectiveSeatScale.get(e)??1,perspectiveLocalPoint:e=>this.perspectiveLocalPoint(e),projectedSectionPoint:(e,t)=>this.projectedSectionPoint(e,t),isoLiftLocal:e=>this.isoLiftLocal(e)}}nearestSeat(e,t){let o=this.seatById.get(e);if(!o)return null;let s=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(o.id)??o:o,n=null,r=1/0;for(let l of this.seats){if(l.id===e)continue;let a=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(l.id)??l:l,c=a.x-s.x,h=a.y-s.y,d=c*t.x+h*t.y;if(d<=.5)continue;let u=Math.abs(c*t.y-h*t.x),f=d+u*2.5;f<r&&(r=f,n=l.id)}return n}focusSeat(e,t){let o=this.seatById.get(e);if(!o)return;this.focusedId=e,this.focusRing.radius(this.seatR+3),this.focusRing.position(this.renderedSeatPoint(o));let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e)??1:1;this.focusRing.scale({x:s,y:s}),this.focusRing.visible(!0),t?.move!==!1&&this.ensureVisible(o),this.overlayLayer.batchDraw(),this.opts.onFocusSeat?.(o)}ensureVisible(e){let t=this.stage.width(),o=this.stage.height(),s=Math.max(this.stage.scaleX(),_e*1.2),n=this.worldToScreen(e),r=70,l=n.x<r||n.x>t-r||n.y<r||n.y>o-r;if(this.stage.scaleX()<s||l){let a=this.renderedSeatPoint(e),c=this.viewMode==="perspective"&&this.perspectiveBaseAffine?ae(this.perspectiveBaseAffine,a):this.isoT===0?a:this.isoForward(a);this.stage.scale({x:s,y:s}),this.stage.position({x:t/2-c.x*s,y:o/2-c.y*s}),this.afterViewChange(),this.stage.batchDraw()}}setViewportInsets(e){this.viewportInsets=Or(e),this.refitCurrentView()}getViewportInsets(){return{...this.viewportInsets}}framingViewport(){return Dr(this.stage.width(),this.stage.height(),this.viewportInsets)}framingWorldRect(){return Hr(this.framingViewport(),e=>this.screenToWorld(e))}zoomToFit(){let e=this.framingViewport(),t=e.width,o=e.height,s=this.viewMode==="perspective"&&this.perspectiveBounds?this.perspectiveBounds:this.bounds;if(this.fitScale=Math.min(t/s.width,o/s.height)||1,this.opts.portraitFitCrop&&!this.exportMode){let r=t/s.width<=o/s.height,l=s.height*this.fitScale;r&&l<.55*o&&(this.fitScale=Math.min(this.fitScale*1.3,.62*o/s.height))}let n=this.fitScale;if(this.stage.scale({x:n,y:n}),this.stage.position({x:e.x+(t-s.width*n)/2-s.x*n,y:e.y+(o-s.height*n)/2-s.y*n}),this.settleView(),!this.exportMode){let r=Vn(this.stage,[this.bgLayer,this.seatLayer],e,this.effScale()<we?we*.999999*(this.stage.scaleX()/Math.max(this.effScale(),1e-9)):void 0);r>0&&r!==1&&(this.fitScale*=r),r>0&&(this.afterViewChange(),Kn(this.stage,[this.bgLayer,this.seatLayer],e)),this.fitPose=ji(this.stage)}this.stage.batchDraw()}refitCurrentView(){if(this.focusedSectionId&&this.sectionBounds(this.focusedSectionId)){this.focusSectionCamera(this.focusedSectionId,!1,this.focusAnchor);return}if(this.categoryFilter?.size){this.focusCategories([...this.categoryFilter],{animate:!1});return}this.zoomToFit()}getCameraPose(){return Gr(this.stage)}setCameraPose(e){this.cancelGlide(),Nr(this.stage,e)&&(this.settleView(),this.stage.batchDraw())}zoomIn(){this.zoomAbout(this.stage.scaleX()*kt.ZOOM_STEP,ci(this.framingViewport()))}zoomOut(){this.zoomAbout(this.stage.scaleX()/kt.ZOOM_STEP,ci(this.framingViewport()))}zoomOutLevel(){let e=this.focusedSectionId;return e?this.sectionBounds(e)&&this.stage.scaleX()>this.sectionFrameScale(e)*1.05?(this.focusRegion(e),"section"):"venue":this.getRung()==="seats"?(this.setRung("sections"),"sections"):(this.cancelGlide(),this.zoomToFit(),"venue")}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(),o=e.id,s=typeof o=="string"?this.seatById.get(o):void 0;if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let l=s?this.perspectiveSeatProjected.get(s.id)??ae(this.perspectiveBaseAffine,e):ae(this.perspectiveBaseAffine,e);return{x:l.x*t+this.stage.x(),y:l.y*t+this.stage.y()}}let n=s?this.renderedSeatPoint(s):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;for(let o of this.sections)this.refreshSectionFill(o);this.lodScale=0,this.updateLOD(),this.updateAccessGlyphs(this.effScale());for(let o of this.seats){let s=this.circleById.get(o.id);s&&this.paintSeat(s,o.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((o,s)=>o===e[s])}setCommercialLimitedFilter(e){if(this.commercialLimitedFilter!==e){this.commercialLimitedFilter=e;for(let t of this.seats){let o=this.circleById.get(t.id);o&&this.paintSeat(o,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(!pr(t,this.categoryFilter)){this.categoryFilter=t;for(let o of this.seats){let s=this.circleById.get(o.id);s&&this.paintSeat(s,o.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}applyGAFilterState(){this.clusterLabels.applyFilterDim(),this.paintGAStateForView(),this.updateFreeTextVisibility(),this.bgLayer.batchDraw()}paintGAStateForView(){ra({gaById:this.gaById,bgLayer:this.bgLayer,exportMode:this.exportMode,pickerMode:!!this.opts.gaPickerMode,selectionColor:this.effSelection,labelFont:()=>this.labelFont(),filteredOut:e=>!!(this.categoryFilter&&!this.categoryFilter.has(e)),dimmed:e=>na(this.categoryHighlight,this.categoryFilter,e),overviewHidden:e=>!this.exportMode&&e.sectionId!=null&&this.effScale()<ce,effScale:()=>this.effScale(),labelLegible:e=>ge(e,this.effScale())})}setGAStates(e){aa(this.gaById,e)&&this.applyGAFilterState()}setGAState(e,t){this.setGAStates({[e]:t})}focusCategories(e,t){if(!e?.length)return;let o=new Set(e),s=this.seats.filter(d=>!o.has(d.categoryKey)||this.seatInClosedSection(d.id)?!1:(this.statusById.get(d.id)??"free")==="free"||this.ownedHold.has(d.id));if(!s.length)return;let n=fr(s.map(d=>d.id),this.seatSection);n&&this.focusSection(n);let r=Math.max(24,this.seatR*3),l=s.map(d=>this.renderedSeatPoint(d)),a=this.clusterLabels.boundsForSeats(s.map((d,u)=>({...d,...l[u]})),r),c=hi(l,r);if(a?.singleBlock&&(!this.hasSections||n!=null)){let d=this.clusterLabels.diveTarget(a.bounds,a.anchor);if(d){this.focusRegion(d,{animate:t?.animate,durationMs:this.cameraGlideMs,minScale:Math.min(this.seatLabelTargetScale(),this.zoomBounds().max)});return}}let h={x:c.x+c.width/2,y:c.y+c.height/2};hr({stage:this.stage,box:c,bounds:this.zoomBounds(),viewport:this.framingViewport(),centreScreen:this.worldToScreen(h)})||this.focusRegion(c,{animate:t?.animate,durationMs:this.cameraGlideMs})}focusAccessibleSeats(e){let t=e===void 0?this.accessFilter:e;if(!t)return!1;let o=this.seats.filter(r=>this.seatInClosedSection(r.id)||tt(r,t)!=="match"?!1:(this.statusById.get(r.id)??"free")==="free"||this.ownedHold.has(r.id));if(!o.length)return!1;this.clearSectionFocus();let s=Math.max(24,this.seatR*3),n=hi(o.map(r=>this.renderedSeatPoint(r)),s);return this.focusRegion(n,{durationMs:this.cameraGlideMs}),!0}setViewMode(e){if(e==="perspective"){if(this.viewMode===e){this.afterViewChange();return}let l=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(l),this.zoomToFit();return}let t=e==="isometric"?1:0,o=this.viewMode==="perspective";if(this.viewMode=e,this.isoTarget=t,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),o){this.isoT=t,this.applyIso(),this.afterViewChange();return}if(this.reducedMotion){this.isoT=t,this.applyIso(),this.afterViewChange();return}let s=this.isoT;if(s===t){this.applyIso(),this.afterViewChange();return}let n=performance.now(),r=l=>{if(this.destroyed)return;let a=Math.min(1,(l-n)/Bs),c=a<.5?4*a*a*a:1-Math.pow(-2*a+2,3)/2;this.isoT=s+(this.isoTarget-s)*c,this.applyIso(),this.scheduleViewChange(),a<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 Lt(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-ut)*this.isoT)}isoForward(e){return za(e,this.isoState)}isoInverse(e){return Xa(e,this.isoState)}buildPerspectiveProjection(e){let t=Qa({seats:this.seats,objects:e.objects,bounds:this.bounds,seatR:this.seatR,floorBaseHeightMFor:o=>this.floorBaseHeightMFor(o)},{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,o){Ua(e,t,o)}resetContainerTransform(e){$a(e)}sectionSurfaceHeight(e,t){return qa(e,t)}projectedSectionPoint(e,t){return Za(e,t,this.perspectiveBaseAffine)}perspectiveLocalPoint(e){return ja(e,this.perspectiveBaseInverse)}isoLiftLocal(e){return Ya(e,this.isoState)}resetLayerTransforms(e=!0){let t=e?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let o of t)o.position({x:0,y:0}),o.offset({x:0,y:0}),o.scale({x:1,y:1}),o.rotation(0),o.skewX(0),o.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 o=this.labelLiftGroups.get(t.id);o&&e&&this.resetContainerTransform(o),t.perspectiveAffine=void 0,t.perspectiveCorrection=void 0,t.perspectiveDepth=void 0}}get seatAnchorContext(){return this.seatAnchorContextCache??={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){Ja(this.seatAnchorContext,e,t)}applyPerspective(e=!0){let t=this.perspectiveCamera,o=this.perspectiveBaseAffine,s=this.perspectiveBaseInverse;if(!t||!o||!s)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 l of[this.bgLayer,this.overlayLayer])this.setContainerAffine(l,o,t.target);this.perspectiveAppliedSeats.clear(),n||this.applyExactSeatAnchors(!0);for(let l of this.sections){let a=d=>this.sectionSurfaceHeight(l,d),c=Ht(t,l.centroid,a),h=ps(s,c);l.perspectiveAffine=c,l.perspectiveCorrection=h,l.perspectiveDepth=be(t,l.centroid,a(l.centroid)).depth,this.setContainerAffine(l.liftGroupBg,h,l.centroid);for(let d=0;d<l.sideFaces.length;d++){let u=l.outline[d],f=l.outline[(d+1)%l.outline.length],y=this.perspectiveLocalPoint(be(t,u,0)),m=this.perspectiveLocalPoint(be(t,f,0)),p=this.perspectiveLocalPoint(be(t,f,a(f))),g=this.perspectiveLocalPoint(be(t,u,a(u)));l.sideFaces[d].points([y.x,y.y,m.x,m.y,p.x,p.y,g.x,g.y]),l.sideFaces[d].opacity(.9)}}let r=[...this.sections].sort((l,a)=>(a.perspectiveDepth??0)-(l.perspectiveDepth??0));for(let l of r)l.rootGroupBg.moveToTop(),l.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:o}=this.isoParams(),s=Math.cos(t),n=o*Math.sin(t),r=-Math.sin(t),l=o*Math.cos(t),a=Math.sqrt(s*s+n*n),c=s*l-n*r,h=Math.atan2(n,s)*180/Math.PI,d=a,u=c/a,f=(s*r+n*l)/c,y=this.isoCentre;for(let m of[this.bgLayer,this.seatLayer,this.overlayLayer])m.position({x:y.x,y:y.y}),m.offset({x:y.x,y:y.y}),m.rotation(h),m.scaleX(d),m.scaleY(u),m.skewX(f),m.skewY(0)}this.applyUprightLabels(),this.applyElevation(),this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyUprightLabels(){let e=zt*this.isoT,t=1/(1-(1-ut)*this.isoT),o=this.hasBoothText?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let s of o){let n=s.find("Text");for(let r of n){let l=r.getAttr("uprightBase");l==null&&(l=r.rotation(),r.setAttr("uprightBase",l)),r.rotation(l-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 o=this.isoLiftLocal(t.liftWorld);t.liftGroupBg?.position(o),t.liftGroupSeat.position(o),this.labelLiftGroups.get(t.id)?.position(o);let s=.9*e;for(let n=0;n<t.sideFaces.length;n++){let r=t.sideFaces[n],l=t.outline[n],a=t.outline[(n+1)%t.outline.length];r.points([l.x,l.y,a.x,a.y,a.x+o.x,a.y+o.y,l.x+o.x,l.y+o.y]),r.opacity(s)}}this.syncSeatOverlayPositions()}destroy(){this.destroyed=!0,this.cancelAssetLoads(),this.cancelSeatReveal(),this.rafId&&cancelAnimationFrame(this.rafId),this.isoRaf&&cancelAnimationFrame(this.isoRaf),this.glideRaf&&cancelAnimationFrame(this.glideRaf),this.viewChangeRaf&&cancelAnimationFrame(this.viewChangeRaf),this.zoomSettleRaf&&cancelAnimationFrame(this.zoomSettleRaf),this.breathCache?.destroy(),this.momentsCache?.destroy(),this.beaconsCache?.clear(),this.recacheTimer&&clearTimeout(this.recacheTimer),this.resizeObs?.disconnect(),this.gestures.detach(),this.clusterLabels.destroy(),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}selectionFocusDims(e){return this.selectionFocusId?!(this.selectionFocusKeep?.has(e)??e===this.selectionFocusId):!1}focusedSeatOpacity(e,t){if(!this.focusedSectionId||!this.focusDimOverlay)return t;let o=this.seatSection.get(e);return t*(o&&this.sectionMatchesFocus(o)?1:Ge)}sectionScreenBounds(e){return Un({viewMode:this.viewMode,isoT:this.isoT,stageScale:this.stage.scaleX(),stageX:this.stage.x(),stageY:this.stage.y(),projectedSectionPoint:(t,o)=>this.projectedSectionPoint(t,o),isoLiftLocal:t=>this.isoLiftLocal(t),isoForward:t=>this.isoForward(t)},e)}updateSeatGroupVisibility(){let e=this.exportMode||this.effScale()>=ce,t=this.viewMode==="perspective"&&this.glideInProgress&&this.seats.length>2500,o=96,s=this.stage.width(),n=this.stage.height();for(let r of this.sections){let l=!0;if(e){let c=this.sectionScreenBounds(r);l=c.x+c.width>=-o&&c.y+c.height>=-o&&c.x<=s+o&&c.y<=n+o,l&&this.viewMode==="perspective"&&!t&&this.applyExactSeatAnchors(!0,r.memberIds)}r.liftGroupSeat.setViewportCulled(!l),this.labelLiftGroups.get(r.id)?.setViewportCulled(!l)}this.unsectionedSeatGroup&&!this.unsectionedSeatGroup.visible()&&this.unsectionedSeatGroup.visible(!0),e&&this.viewMode==="perspective"&&!t&&(this.unsectionedSeatIds||(this.unsectionedSeatIds=this.seats.filter(r=>!this.seatSection.has(r.id)).map(r=>r.id)),this.applyExactSeatAnchors(!0,this.unsectionedSeatIds))}visibleSeatCandidates(){if(!this.sections.length)return this.seats;let e=[];for(let t of this.sections)if(!t.liftGroupSeat.isViewportCulled())for(let o of t.memberIds){let s=this.seatById.get(o);s&&e.push(s)}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 o=this.isoLiftLocal(t.liftWorld);return{x:e.x+o.x,y:e.y+o.y}}seatLabelContainer(e){let t=this.seatSection.get(e);if(!t)return this.labelGroup;let o=this.labelLiftGroups.get(t.id);return o||(o=new St({listening:!1}),o.setViewportCulled(t.liftGroupSeat.isViewportCulled()),o.position(this.viewMode==="perspective"?{x:0,y:0}:this.isoLiftLocal(t.liftWorld)),this.labelGroup.add(o),this.labelLiftGroups.set(t.id,o)),o}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 o=this.seatById.get(e);if(o){t.position(this.renderedSeatPoint(o));let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(o.id)??1:1;t.scale({x:s,y:s})}}}renderSeats(e=this.seats){ar({seats:e,seatR:this.seatR,theme:this.theme,seatGlyphDetail:this.seatGlyphDetail,setHasBoothText:()=>{this.hasBoothText=!0},circleById:this.circleById,glyphMarkers:this.glyphMarkers,boothDims:this.boothDims,boothLabelById:this.boothLabelById,accessGlyphById:this.accessGlyphById,accessRingById:this.accessRingById,catByKey:this.catByKey,perspectiveSeatDepth:this.perspectiveSeatDepth,seatContainer:t=>this.seatContainer(t),buildAccessGlyph:(t,o)=>this.buildAccessGlyph(t,o),paintSeat:(t,o)=>this.paintSeat(t,o),labelFont:()=>this.labelFont()})}buildAccessGlyph(e,t){let o=this.seatR*1.5/xe,s=new hd({x:e.x,y:e.y,data:Ft(e.accessibility??[])??"",scaleX:o,scaleY:o,fill:Ai(t),listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});return pi(s),s}updateAccessGlyphs(e){if(this.accessGlyphById.size)for(let[t,o]of this.accessGlyphById){let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1,n=this.seatR*1.5/xe*s,l=this.accessGlyphFilterEmphasized(t)?Ps:Is,a=Math.max(n,l/(xe*Math.max(e,.001)));o.scale({x:a,y:a}),o.visible(this.accessGlyphShouldShow(t))}}accessGlyphFilterEmphasized(e){let t=this.seatById.get(e),o=this.accessFilter;return!!t&&o!==null&&!!t.accessibility?.includes("wheelchair")&&(o.length===0||o.includes("wheelchair"))&&Le(t,o)}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)}categoryPriceLabel(e){let t=this.catPrice.get(e);return typeof t=="number"?mt(t,this.currency):null}categoryDisplayColor(e){return this.colorblind?this.cbHueByKey.get(e)??Qt[0]:this.catColor.get(e)??"#6e7bff"}seatLabelScale(e){return(e.labelStyle?.size??18)/18}seatPreferredLabelInk(e){return e.labelStyle?.color??this.theme.seatLabelColor??it}seatLabelInk(e,t){let o=t.fill();return Ee(typeof o=="string"?o:"",e.labelStyle?.color,this.theme.seatLabelColor??it,Ue)}paintSeat(e,t){let o=this.seatById.get(t),s=this.statusById.get(t)??"free",n=this.selection.has(t),r=this.categoryDisplayColor(o.categoryKey),l=this.boothLabelById.get(t);e.dash(Io),e.strokeWidth(0),e.stroke(""),e.opacity(1),e.scale({x:1,y:1});let a=s==="held"&&this.ownedHold.has(t),c=a?null:ea(s,this.canvasBackground,this.colorblind);c?(e.fill(c.fill),e.stroke(c.stroke),e.strokeWidth(c.strokeWidth),e.dash(c.dash),e.opacity(c.opacity),c.scale!==1&&e.scale({x:c.scale,y:c.scale})):a?(e.fill(Ce(r,this.effSelection===gt?.24:.1)),e.stroke(this.effSelection),e.strokeWidth(3)):e.fill(n&&this.effSelection===gt?Ce(r,.28):r),this.seatMarks.paint(e,t,s,r,this.seatR,this.colorblind,this.seatInClosedSection(t)),fo(e)&&e.scale({x:1,y:1}),o.wheelchairSpaceType==="no-seat"&&s==="free"&&(e.stroke(It(o.accessibility)),e.strokeWidth(n?3:2),e.dash([3,2])),l&&(l.text(s==="booked"?"SOLD":s==="held"?"HELD":o.label),l.fontSize(s==="free"?10:Math.min(10,Math.max(6,this.boothDims.get(o.rowId)?.width??40)/6)),l.fontStyle(s==="free"?"600":"800"),l.fill(s==="free"?this.theme.seatLabelColor??it:"#ffffff"),l.offsetX(l.width()/2),l.offsetY(l.height()/2));let h=s==="free"||s==="held"&&!this.ownedHold.has(t),d=()=>{let y=e.fill();typeof y=="string"&&e.fill(ha(y,this.canvasBackground))};if(this.accessFilter&&h&&!n){let y=tt(o,this.accessFilter);y==="other"?(d(),e.opacity(Math.min(e.opacity(),Qn))):y==="companion"&&e.opacity(Math.min(e.opacity(),Jn))}if(this.categoryHighlight&&s==="free"&&!n&&o.categoryKey!==this.categoryHighlight&&e.opacity(.25),this.categoryFilter&&h&&!n&&!this.categoryFilter.has(o.categoryKey)&&(d(),e.opacity(.22)),this.commercialLimitedFilter&&s==="free"&&!n&&(o.commercial?.restrictedView||o.commercial?.obstructedView)&&e.opacity(.22),this.dimmedSections.size){let y=this.seatSection.get(t);(y?this.dimmedSections.has(y.id)||this.dimmedSections.has(y.logicalId)||y.zone!=null&&this.dimmedSections.has(y.zone):this.dimmedSections.has(Zo))&&e.opacity(.18)}this.closedSections.size&&this.seatInClosedSection(t)&&(e.fill(nn),e.stroke(""),e.strokeWidth(0),e.dash(Io),e.opacity(rn),e.scale({x:1,y:1})),this.selectionFocusDims(t)&&e.opacity(Math.min(e.opacity(),.16));let u=this.boothLabelById.get(t)??this.seatLabelById.get(t);u&&(u.fill(this.seatLabelInk(o,e)),u.visible(ge(u.fontSize(),this.effScale())&&e.opacity()>=.5));let f=this.accessGlyphById.get(t);if(f){let y=e.fill();f.fill(Ai(typeof y=="string"?y:"")),f.opacity(e.opacity()),f.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 o=this.circleById.get(t.id);o&&this.paintSeat(o,t.id)}for(let t of this.sections)t.shellCategoryColor=this.dominantSellableColor(t.memberIds),this.refreshSectionFill(t);this.bgLayer.batchDraw(),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(o=>this.dimmedSections.has(o)))){this.dimmedSections=t;for(let o of this.seats){let s=this.circleById.get(o.id);s&&this.paintSeat(s,o.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(o=>this.closedSections.has(o))||(this.closedSections=t,this.repaintSectionsAndSeats())}focusSection(e,t){this.sections.some(o=>o.id===e||o.logicalId===e)&&(this.focusedSectionId=e,this.focusAnchor=t?.anchor??null,this.focusRoams=!1,this.drawFocusBackdrop(e),this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD(),this.focusSectionCamera(e,!0,t?.anchor))}focusSectionCamera(e,t=!0,o){let s=this.sectionBounds(e);if(!s)return;let n=this.sectionMembers(e).map(c=>this.seatById.get(c)).filter(c=>c!=null),r=n.filter(c=>(this.statusById.get(c.id)??"free")==="free"||this.ownedHold.has(c.id)),l=(r.length?r:n).map(c=>this.renderedSeatPoint(c)),a=this.narrowSeatDetailFocus(l,s,o);this.focusRegion(a?.bounds??s,{animate:t,minScale:a?.minScale})}releaseSectionFocusDim(){!this.focusBackdrop&&!this.focusDimOverlay||(this.focusRoams=!0,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.focusAnchor=null,this.focusRoams=!1,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}seatsRevealed(){return this.focusedSectionId||this.floorOverview?!0:this.effScale()>=we}seatsPickable(){return this.focusedSectionId||this.floorOverview?!0:this.effScale()>=ko(this.markerR)}drawFocusBackdrop(e){this.focusBackdrop?.destroy(),this.focusBackdrop=null;let t=this.sections.filter(o=>o.id===e||o.logicalId===e);if(this.focusBackdrop=_r(this.focusBackdropHost,t),!!this.focusBackdrop){this.focusDimOverlay?.destroy(),this.focusDimOverlay=Br(this.focusBackdropHost,t);for(let o of this.selectionMarkers.values())o.moveToTop();this.hoverRing.moveToTop(),this.focusRing.moveToTop()}}get focusBackdropHost(){return{bgLayer:this.bgLayer,overlayLayer:this.overlayLayer,bounds:this.bounds,canvasBackground:this.canvasBackground,viewMode:this.viewMode,perspectiveLocalPoint:e=>this.perspectiveLocalPoint(e),projectedSectionPoint:(e,t)=>this.projectedSectionPoint(e,t),isoLiftLocal:e=>this.isoLiftLocal(e)}}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)this.refreshSectionFill(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,o=-1/0,s=-1/0,n=(r,l)=>{r<e&&(e=r),l<t&&(t=l),r>o&&(o=r),l>s&&(s=l)};for(let r of this.seats)n(r.x,r.y);for(let r of this.sections)for(let l of r.outline)n(l.x,l.y);for(let r of this.gaById.values())for(let l of r.points)n(l.x,l.y);return Number.isFinite(e)?{x:e,y:t,width:Math.max(1,o-e),height:Math.max(1,s-t)}:{x:0,y:0,width:1,height:1}}getMinimapSnapshot(){let e=this.sections.map(t=>{let o=this.isSectionClosed(t)||t.free<=0,s=t.memberIds.some(l=>this.selection.has(l)),n=s||t.memberIds.some(l=>this.ownedHold.has(l)),r=this.focusedSectionId===t.id||this.focusedSectionId===t.logicalId;return{id:t.logicalId,label:t.label,outline:t.outline.map(l=>({...l})),...this.objectFloor.get(t.id)?{floorId:this.objectFloor.get(t.id)}:{},state:s?"selected":o?"inactive":"available",active:r,paint:{fill:t.shellFill,stroke:t.shellStroke},owned: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 o=this.circleById.get(t.id);o&&this.paintSeat(o,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}renderBackground(e){let t=ct(e);t&&this.renderBackgroundImage(t);for(let o of e.objects)o.type==="decorImage"&&this.renderDecorImage(o);for(let o of e.objects)o.type==="section"&&this.renderSection(o);for(let o of e.objects)o.type==="shape"?this.renderShape(o):o.type==="gaArea"?this.renderGA(o):o.type==="table"?this.renderTable(o):o.type==="text"&&this.renderText(o);this.renderZones(e)}trackAssetImage(e,t,o,s){let n=this.assetGeneration;/^https?:\/\//i.test(t)&&(e.crossOrigin="anonymous");let r=new Promise(l=>{let a=!1,c=()=>{a||(a=!0,this.assetCancels.delete(h),l())},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&&s(),c();return}(typeof e.decode=="function"?e.decode():Promise.resolve()).then(()=>{n===this.assetGeneration&&s()}).catch(()=>{n===this.assetGeneration&&this.assetErrors.push(`${o} could not be decoded.`)}).finally(c)},e.onerror=()=>{n===this.assetGeneration&&this.assetErrors.push(`${o} 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){va(this.objectDrawContext,e)}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,landmarkBoxes:this.landmarkBoxes,labelFont:()=>this.labelFont(),trackAssetImage:(e,t,o,s)=>this.trackAssetImage(e,t,o,s),isGhostClick:e=>this.isGhostClick(e)}}renderDecorImage(e){wa(this.objectDrawContext,e)}renderTable(e){La(this.objectDrawContext,e)}renderText(e){ka(this.objectDrawContext,e)}renderShape(e){Ca(this.objectDrawContext,e)}renderGA(e){Ta(this.objectDrawContext,e)}renderSection(e){let t=Mt(e.outline,e.holes),o=te(this.canvasBackground),s=[],n=new Map,r=0,l=K(e.outline),a=this.seatIndex?Nt(this.seatIndex,l).map(M=>this.seatById.get(M)).filter(M=>!!M):this.seats;for(let M of a)this.seatSection.has(M.id)||oe(M,e.outline,e.holes)&&(s.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??Ri([...n].map(([M,_])=>({hex:this.catColor.get(M)??"#6e7bff",w:_})),"#3a4358"),h=Vo(e.elevation),d=Pt(e,{floorBaseHeightM:this.floorBaseHeightMFor(e.id)}),u=d.height*Xe,f=new Ve({listening:!1});this.bgLayer.add(f);let y=new Ve({listening:!1});f.add(y);let m=new St({listening:!0});this.seatLayer.add(m);let p=[];if(u>0){let M=me(this.zoneColor.get(e.zone??"")??c,.42);for(let _=0;_<e.outline.length;_++){let $=new cd({points:[],closed:!0,fill:M,stroke:B("#000000",.25),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});p.push($),f.add($)}}y.moveToTop();let g=y,b=e.color??this.zoneColor.get(e.zone??"")??"#3a4358",S=We(e.outline,e.holes,{stroke:B(b,.5),strokeWidth:1,fill:B(b,.08),listening:!1},e.outlinePath);g.add(S);let v=We(e.outline,e.holes,{fill:o.sectionFill,stroke:o.sectionStroke,strokeWidth:Fe,opacity:0,listening:!1},e.outlinePath);g.add(v);let L=e.labelPresentation?.labelStyle,w=L?.color,k=o.sectionInk,C=(L?.size??18)/18,x=new tl({x:e.labelPresentation?.position?.x??t.x,y:e.labelPresentation?.position?.y??t.y,width:0,height:0,opacity:0,listening:!1,perfectDrawEnabled:!1});g.add(x);let T=new il({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:18*C,fontStyle:Oe,fontFamily:this.labelFont(),fill:Ee(o.sectionFill,w,k),listening:!1,perfectDrawEnabled:!1});T.offsetX(T.width()/2),T.offsetY(T.height()/2),g.add(T);let P=new il({x:t.x,y:t.y,text:H("map.seatsLeft",{count:r}),fontSize:12,fontStyle:js,fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:o.sectionInk,opacity:0,listening:!1,perfectDrawEnabled:!1});P.offsetX(P.width()/2),g.add(P);let I={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:Yn(e.outline,e.holes??[],t),memberCategoryKeys:new Set(s.map(M=>this.seatById.get(M)?.categoryKey).filter(Boolean)),shellCategoryColor:this.dominantSellableColor(s),shellFill:o.sectionFill,shellStroke:o.sectionStroke,labelArea:Ho(e.outline,e.holes),zone:e.zone,memberIds:s,total:s.length,free:r,baseFill:c,outlineTint:b,outlinePoly:S,blockPoly:v,namePlate:x,nameLabel:T,subLabel:P,preferredInk:k,...w?{explicitInk:w}:{},labelScale:C,nameLabelFits:!1,subLabelFits:!0,elevation:h,liftWorld:u,rakeDeg:d.rake,surfaceFocal:s.length?{...this.seatById.get(s[0])?.focalPoint??this.isoCentre}:{...this.chartDoc?.focalPoint??this.isoCentre},frontDistanceWorld:0,rootGroupBg:f,bgZIndex:f.zIndex(),seatZIndex:m.zIndex(),liftGroupBg:y,liftGroupSeat:m,sideFaces:p},A=s.map(M=>this.seatById.get(M)).filter(M=>!!M),R=A.length?A:e.outline;I.frontDistanceWorld=Math.min(...R.map(M=>Math.hypot(M.x-I.surfaceFocal.x,M.y-I.surfaceFocal.y)));for(let M of s)this.seatSection.set(M,I);this.unsectionedSeatIds=null,this.refreshSectionFill(I),this.refreshSectionHeat(I),this.sections.push(I)}refreshSectionHeat(e){Sr(this.sectionLodPaintContext,e)}refreshSectionFill(e){Lr(this.sectionLodPaintContext,e)}isSectionClosed(e){return no(this.sectionLodPaintContext,e)}dominantSellableColor(e){let t=ln(e,o=>this.seatById.get(o)?.categoryKey,o=>this.catByKey.get(o)?.notForSale===!0);return t?this.categoryDisplayColor(t):null}sectionAccessibleFree(e){return vr(e.memberIds,this.accessFilter,t=>this.statusById.get(t)??"free",t=>this.seatById.get(t))}get sectionLodPaintContext(){return{sections:this.sections,zones:this.zones,sectionHeat:this.sectionHeat,closedSections:this.closedSections,canvasBackground:this.canvasBackground,sectionIsOwned:e=>e.memberIds.some(t=>this.selection.has(t)||this.ownedHold.has(t)),accessFilterActive:this.accessFilter!=null,sectionAccessibleFree:e=>this.sectionAccessibleFree(e),selectionColor:this.effSelection,bgLayer:this.bgLayer,seatLayer:this.seatLayer,stageScaleX:this.stage.scaleX(),stageWidth:this.stage.width(),floorOverview:this.floorOverview,focusedSectionId:this.focusedSectionId,categoryFilter:this.categoryFilter,landmarks:this.landmarkBoxes,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){jn({bgLayer:this.bgLayer,canvasBackground:this.canvasBackground,catPrice:this.catPrice,currency:this.currency,seatById:this.seatById,sections:this.sections,zones:this.zones,labelFont:()=>this.labelFont()},e)}screenToWorld(e){let t=this.stage.scaleX(),o={x:(e.x-this.stage.x())/t,y:(e.y-this.stage.y())/t};return this.viewMode==="perspective"&&this.perspectiveBaseInverse?ae(this.perspectiveBaseInverse,o):this.isoT===0?o:this.isoInverse(o)}sectionAt(e){if(!this.sections.length)return null;let t=this.screenToWorld(e),o=this.sections.find(s=>{if(this.viewMode==="perspective"&&s.perspectiveAffine)return oe(t,s.outline.map(r=>this.perspectiveLocalPoint(this.projectedSectionPoint(s,r))),s.holes.map(r=>r.map(l=>this.perspectiveLocalPoint(this.projectedSectionPoint(s,l)))));let n=s.liftWorld>0?this.isoLiftLocal(s.liftWorld):{x:0,y:0};return oe({x:t.x-n.x,y:t.y-n.y},s.outline,s.holes)});return o?o.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)||!(this.opts.selectableStatuses??["free"]).includes(this.statusById.get(e)??"free")?!1:!this.hiddenByAccessFilter(e)}filterExcludesSeat(e){let t=this.seatById.get(e);return this.hiddenByAccessFilter(e)||t!=null&&pa({categoryFilter:this.categoryFilter,categoryKey:t.categoryKey,status:this.statusById.get(e)??"free",selected:this.selection.has(e),ownHold:this.ownedHold.has(e)})}hiddenByAccessFilter(e){if(!this.accessFilter||this.selection.has(e))return!1;let t=this.seatById.get(e);return t?tt(t,this.accessFilter)==="other":!1}toggleSeat(e){if(this.ownedHold.has(e)){let t=this.seatById.get(e);t&&this.opts.onDeselect?.(t);return}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),this.playSeatPickMoment(e);let t=this.seatById.get(e);t&&this.opts.onSelect?.(t)}this.overlayLayer.batchDraw()}resolveCanvasBackground(){let e=this.theme.background?Mi(this.theme.background):null;if(e)return e;if(typeof getComputedStyle=="function"){let t=this.container;for(;t;){let o=Mi(getComputedStyle(t).backgroundColor);if(o)return o;t=t.parentElement}}return to}resolveSelectionColor(){return this.theme.selectionColor?this.theme.selectionColor:F(this.canvasBackground)?er:gt}setSelected(e,t,o=!1){let s=this.circleById.get(e);t?this.selection.add(e):(this.selectionFocusId===e&&this.setSelectionFocus(null),this.selection.delete(e)),s&&(this.paintSeat(s,e),!o&&!this.cached&&this.seatLayer.batchDraw()),this.syncSelectionMarker(e)}syncSelectionMarker(e){this.moments.syncMarker(e,this.selection.has(e)||this.ownedHold.has(e),this.selectionMarkers),this.hasSections&&(this.owned.sync(this.effScale(),this.getRung()),this.syncBeacons()),(this.breathCache||this.selectionMarkers.size)&&this.breath.sync(this.selectionMarkers)}playSeatPickMoment(e){this.moments.play(e)}showTouchLoupe(e){this.moments.showLoupe(e)}hideTouchLoupe(){this.moments.hideLoupe()}sectionBounds(e){return qn({sections:this.sections,viewMode:this.viewMode,isoT:this.isoT,seatR:this.seatR,bgLayer:this.bgLayer,seatById:this.seatById,freeTextById:this.freeTextById,iconNodeById:this.iconNodeById,rowLabelPlan:this.rowLabelPlan,projectedSectionPoint:(t,o)=>this.projectedSectionPoint(t,o),isoLiftLocal:t=>this.isoLiftLocal(t),isoForward:t=>this.isoForward(t),renderedSeatPoint:t=>this.renderedSeatPoint(t),labelFont:()=>this.labelFont(),resolveAutomaticRowLabelPosition:(t,o,s)=>this.resolveAutomaticRowLabelPosition(t,o,s),rowLabelBox:(t,o)=>this.rowLabelBox(t,o)},e)}sectionFrameScale(e){let t=this.sectionBounds(e);return t?ot(this.stage,t,this.zoomBounds(),this.framingViewport()):this.stage.scaleX()}handleSeatTap(e){if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let o=this.objectFloor.get(this.seatById.get(e)?.rowId??"");if(o){this.opts.onDeckTap(o);return}}if(this.effScale()<se&&this.sections.length){let o=this.seatSection.get(e);if(o){let s=this.focusedSectionId===o.logicalId,n=this.sectionFrameScale(o.logicalId)>this.stage.scaleX()*1.02;if(!s&&n){let r=this.seatById.get(e),l=r?this.renderedSeatPoint(r):void 0;this.opts.onSectionTap?this.opts.onSectionTap(o.logicalId,l):this.focusSection(o.logicalId,{anchor:l});return}}}if(!(this.ownedHold.has(e)||this.selection.has(e)||this.isSelectable(e))){let o=this.seatById.get(e)??null;o&&(this.opts.onHover?.(o,{mark:this.seatMarks.get(e)??null,interaction:"press",unavailable:!0,...this.hiddenByAccessFilter(e)?{filteredOut:!0}:{}}),this.moments.nudge(e));return}this.seatMarks.has(e)&&this.opts.onHover?.(this.seatById.get(e)??null,{mark:this.seatMarks.get(e),interaction:"press"}),this.toggleSeat(e)}deckFloorAt(){return cr(this.screenPickingHost)}nearestSeatToScreen(e,t,o=!1){return lr(this.screenPickingHost,e,t,{includeUnavailable:o})}get screenPickingHost(){return{seats:this.seats,stage:this.stage,seatR:this.seatR,viewMode:this.viewMode,selection:this.selection,objectFloor:this.objectFloor,perspectiveSeatScale:this.perspectiveSeatScale,renderedSeatPoint:e=>this.renderedSeatPoint(e),screenToWorld:e=>this.screenToWorld(e),worldToScreen:e=>this.worldToScreen(e),isSelectable:e=>this.isSelectable(e)}}hoverAffordance(e){return this.ownedHold.has(e)||this.selection.has(e)||this.isSelectable(e)?"full":this.seatInClosedSection(e)?"none":(this.statusById.get(e)??"free")==="held"?"muted":"none"}wireInteraction(){this.seatLayer.on("click tap",e=>{if(this.moved>Te||this.isGhostClick(e))return;let t=To(e.target);t&&this.seatsPickable()&&this.handleSeatTap(t)}),this.seatLayer.on("mouseover",e=>{let t=To(e.target);if(!t)return;let o=this.seatById.get(t);if(!o)return;this.hoveredId=t;let s=this.hoverAffordance(t);this.hoverRing.position(this.renderedSeatPoint(o));let n=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1;this.hoverRing.scale({x:n,y:n}),this.hoverRing.opacity(s==="muted"?dd:ol),this.hoverRing.dash(s==="muted"?ud:Io),this.hoverRing.visible(s!=="none"),this.overlayLayer.batchDraw(),this.clusterLabels.syncCursor(s==="full"),this.opts.onHover?.(o,{mark:this.seatMarks.get(t),interaction:"hover"})}),this.seatLayer.on("mouseout",()=>{this.hoveredId=null,this.hoverRing.visible(!1),this.overlayLayer.batchDraw(),this.clusterLabels.syncCursor(!1),this.opts.onHover?.(null,{mark:null})}),this.stage.on("wheel",e=>{e.evt.preventDefault(),this.releaseSectionFocusDim();let t=this.container.getBoundingClientRect(),o={x:e.evt.clientX-t.left,y:e.evt.clientY-t.top},s=Math.exp(-e.evt.deltaY*.002);this.zoomAbout(this.stage.scaleX()*V(s,.5,2),o,"frame")}),this.stage.on("click tap",e=>{if(this.moved>Te||this.isGhostClick(e))return;let t=this.stage.getPointerPosition();if(!t)return;if(!this.cached){if(To(e.target)&&this.seatsPickable())return;if(this.seatsPickable()){let s=this.focusedSectionId,n=this.nearestSeatToScreen(t,Be),r=n?this.seatSection.get(n):null;if(n&&(!s||r&&this.sectionMatchesFocus(r))){this.handleSeatTap(n);return}let l=n?null:this.nearestSeatToScreen(t,Be,!0),a=l?this.seatSection.get(l):null;if(l&&(!s||a&&this.sectionMatchesFocus(a))){this.handleSeatTap(l);return}if(s&&this.opts.onBackdropTap&&!this.floorOverview){let h=this.sectionAt(t);if(h&&h!==s){let d=this.sectionTapAnchor(h,this.screenToWorld(t));this.opts.onSectionTap?this.opts.onSectionTap(h,d):this.focusSection(h,{anchor:d})}else h||this.opts.onBackdropTap();return}if(s)return;let c=this.sections.length?this.sectionAt(t):null;if(!c||this.effScale()>=se||this.sectionFrameScale(c)<=this.stage.scaleX()*1.02)return}}if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let s=this.floorOverview?this.sectionAt(t):null,n=(s?this.objectFloor.get(s):null)??this.deckFloorAt();if(n){this.opts.onDeckTap(n);return}}if(this.sections.length){let s=this.screenToWorld(t),n=this.owned.badgeAt(s)??this.sectionAt(t);if(n){let r=this.sectionTapAnchor(n,s);this.opts.onSectionTap?this.opts.onSectionTap(n,r):this.focusSection(n,{anchor:r});return}}if(this.clusterLabels.focusCluster(t)||this.clusterLabels.glideTowardTap(t))return;let o=Math.max(_e*1.2,this.stage.scaleX()*2.5);this.zoomAbout(o,t)})}zoomBounds(){let e=.5*this.fitScale;return this.zones.length&&(e=Math.min(e,$e*.9)),{min:e,max:Math.max(10*this.fitScale,4,Ha(this.markerR))}}zoomAbout(e,t,o="now"){dr(this.stage,e,t,this.zoomBounds())&&(o==="frame"?(this.updateSeatGroupVisibility(),this.scheduleZoomSettle()):this.afterViewChange(),this.stage.batchDraw())}scheduleZoomSettle(){if(this.exportMode||typeof requestAnimationFrame!="function"){this.afterViewChange();return}this.zoomSettleRaf||(this.zoomSettleRaf=requestAnimationFrame(()=>{this.zoomSettleRaf=0,!this.destroyed&&this.afterViewChange()}))}cancelZoomSettle(){this.zoomSettleRaf&&(cancelAnimationFrame(this.zoomSettleRaf),this.zoomSettleRaf=0)}zoomToBounds(e,t){ur(this.stage,e,this.zoomBounds(),t,this.framingViewport()),this.settleView(),this.stage.batchDraw()}focusRegion(e,t){let o=typeof e=="string"?this.sectionBounds(e):e;if(!o)return;if(this.cancelGlide(),t?.animate===!1||this.reducedMotion){this.zoomToBounds(o,t?.minScale);return}let s=this.framingViewport(),n=s.width,r=s.height,{min:l,max:a}=this.zoomBounds(),c=1.12,h=Math.min(n/(o.width*c),r/(o.height*c)),d=V(Math.max(h,t?.minScale??l),l,a),u=s.x+n/2-(o.x+o.width/2)*d,f=s.y+r/2-(o.y+o.height/2)*d,y=this.stage.scaleX(),m=this.stage.x(),p=this.stage.y();if(Math.abs(d-y)<1e-4&&Math.abs(u-m)<.5&&Math.abs(f-p)<.5){this.settleView();return}let g=performance.now(),b=Math.max(180,Math.min(1200,t?.durationMs??this.cameraGlideMs));this.glideInProgress=!0;let S=v=>{if(this.destroyed){this.glideRaf=0,this.glideInProgress=!1;return}let L=Math.min(1,(v-g)/b),w=L<.5?4*L*L*L:1-Math.pow(-2*L+2,3)/2,k=y+(d-y)*w;this.stage.scale({x:k,y:k}),this.stage.position({x:m+(u-m)*w,y:p+(f-p)*w}),this.updateSeatGroupVisibility(),this.updateLOD(),this.scheduleViewChange(),this.stage.batchDraw(),L<1?this.glideRaf=requestAnimationFrame(S):(this.glideRaf=0,this.glideInProgress=!1,this.settleView())};this.glideRaf=requestAnimationFrame(S)}applyLabelVisibility(e){let t=e!==this.labelsVisible;if(this.labelsVisible=e,!t||!e)return;if(this.labelFadeRaf&&(cancelAnimationFrame(this.labelFadeRaf),this.labelFadeRaf=0),this.reducedMotion){this.labelGroup.opacity(1);return}let o=performance.now();this.labelGroup.opacity(0);let s=n=>{if(this.destroyed){this.labelFadeRaf=0;return}let r=Math.min(1,(n-o)/90);this.labelGroup.opacity(r),this.stage.batchDraw(),this.labelFadeRaf=r<1?requestAnimationFrame(s):0};this.labelFadeRaf=requestAnimationFrame(s)}cancelGlide(){this.glideRaf&&(cancelAnimationFrame(this.glideRaf),this.glideRaf=0),this.glideInProgress=!1}getRung(){let e=this.effScale();return e>=ce?"seats":this.zones.length&&e<$e?"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,seatLabelDrops:this.seatLabelDrops,seatLabelRungOpen:()=>this.seatLabelRungOpen,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 this.cancelSeatReveal(!0),ga(this.renderedQualityContext)}setRung(e){if(e==="zones"){this.cancelGlide(),this.zoomToFit();return}let t=e==="sections"?(Se+ce)/2:this.seatRungScale(),o=this.framingViewport(),s=o.width,n=o.height,r=ci(this.framingWorldRect()),l=r.x,a=r.y;if(e==="sections"&&this.sections.length>0){let u=this.sections.map(p=>{let g=K(p.outline);return{x:g.x+g.width/2,y:g.y+g.height/2}}),f=s/(t*2),y=n/(t*2);if(!u.some(p=>Math.abs(p.x-r.x)<=f&&Math.abs(p.y-r.y)<=y)){let p=u.reduce((g,b)=>{let S=(b.x-r.x)**2+(b.y-r.y)**2;return S<g.distance?{point:b,distance:S}:g},{point:u[0],distance:1/0});l=p.point.x,a=p.point.y}}let c=e==="seats"?this.seats.filter(u=>u.kind!=="booth"):[];if(c.length>0){let u=c[0],f=1/0;for(let y of c){let m=y.x-r.x,p=y.y-r.y,g=m*m+p*p;g<f&&(u=y,f=g)}l=u.x,a=u.y}let h=s/(t*1.12),d=n/(t*1.12);this.focusRegion({x:l-h/2,y:a-d/2,width:h,height:d})}seatRungScale(){return Kr(this.seatLabelTargetScale())}narrowSeatDetailFocus(e,t,o){let s=this.framingViewport();return zr({stageWidth:s.width,stageHeight:s.height,fullBounds:t,seatPoints:e,visibleBounds:this.framingWorldRect(),minScale:this.seatRungScale(),tapAnchor:o})}seatLabelTargetScale(){return Fr({seats:this.seats,seatR:this.seatR,labelFont:()=>this.labelFont(),seatLabelScale:e=>this.seatLabelScale(e)})}afterViewChange(){this.retargetRoamingFocus(),this.updateSeatGroupVisibility(),this.updateLOD(),this.updateFreeTextVisibility(),this.updateLabels(),this.scheduleViewChange()}settleView(){this.cancelZoomSettle(),this.viewChangeRaf&&(cancelAnimationFrame(this.viewChangeRaf),this.viewChangeRaf=0),this.afterViewChange()}retargetRoamingFocus(){if(!this.focusRoams||!this.focusedSectionId||this.floorOverview)return;let e=$n({sections:this.sections.map(t=>({logicalId:t.logicalId,members:t.memberIds.length,bounds:this.sectionScreenBounds(t)})),viewport:{width:this.stage.width(),height:this.stage.height()},current:this.focusedSectionId});!e||e===this.focusedSectionId||(this.focusedSectionId=e,this.focusAnchor=null,this.opts.onFocusedSectionChange?.(e))}scheduleViewChange(){this.exportMode||this.viewChangeRaf||(this.viewChangeRaf=requestAnimationFrame(()=>{this.viewChangeRaf=0,this.opts.onViewChange?.()}))}sizeLabel(e,t,o){e.fontSize(Math.max(1,t)),e.offsetX(e.width()/2),e.offsetY(e.height()/2),e.y(o)}updateLOD(){let e=this.exportMode?Math.max(this.effScale(),ve+.01,se):this.effScale(),t=Math.max(e,1e-4);for(let[n,r]of this.primaryFocalLabels)xa(n,r,t,(l,a)=>{this.sizeLabel(l,a,l.y())});this.hasSections?(kr(this.sectionLodPaintContext,e),this.owned.sync(e,this.getRung()),this.syncBeacons()):(this.clusterLabels.syncForCamera(e)||this.primaryFocalLabels.size)&&this.bgLayer.batchDraw(),this.clusterLabels.syncCursor(this.hoveredId!=null),this.paintGAStateForView(),this.updateAccessGlyphs(e),this.seatGlyphDetail=rr(this.glyphMarkers,this.seatR,e,this.seatGlyphDetail);let o=!this.exportMode&&e<ce;if(this.viewMode==="perspective"&&this.hasSections&&this.seats.length>2500&&o){this.seatLayer.listening(!1);return}if(o&&!this.cached){if(this.mountCachePending){this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>{this.recacheTimer=null,this.cacheSeatLayer()},0);return}this.cacheSeatLayer()}else!o&&(this.cached||!this.seatLayer.listening())&&(this.cached&&this.releaseSeatLayerBitmap(),this.seatLayer.listening(!this.exportMode),this.cached=!1,this.seatLayer.batchDraw())}rebuildSeatCache(){if(this.seatReveal||this.seatRevealPending)return;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,this.mountCachePending=!1}cacheSeatLayer(){this.rebuildSeatCache(),this.seatLayer.batchDraw()}releaseSeatLayerBitmap(){_a(yi,this.seatLayer)}forceDraw(){this.loadingReveal==="plain"&&this.cancelSeatReveal(!0),this.zoomSettleRaf&&(this.cancelZoomSettle(),this.afterViewChange()),this.recacheTimer&&(clearTimeout(this.recacheTimer),this.recacheTimer=null,this.effScale()<ce?this.rebuildSeatCache():this.cached&&(this.releaseSeatLayerBitmap(),this.seatLayer.listening(!0),this.cached=!1)),this.bgLayer.draw(),this.seatLayer.draw(),this.overlayLayer.draw()}async ready(){this.cancelSeatReveal(!0);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)),o=Math.min(...e.map(r=>r.y)),s=Math.max(...e.map(r=>r.x+r.width)),n=Math.max(...e.map(r=>r.y+r.height));return{x:t,y:o,width:Math.max(1,s-t),height:Math.max(1,n-o)}}fitExportContent(){if(!this.exportMode)return;let e=this.stage.width(),t=this.stage.height(),o=Math.max(12,Math.min(36,Math.min(e,t)*.025)),s=()=>{let n=this.exportSceneBounds(),r=Math.max(1,e-o*2),l=Math.max(1,t-o*2),a=Math.min(r/n.width,l/n.height)||1;this.fitScale=a,this.stage.scale({x:a,y:a}),this.stage.position({x:(e-n.width*a)/2-n.x*a,y:(t-n.height*a)/2-n.y*a}),this.afterViewChange()};s(),s()}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(s){let n=s instanceof Error?s.message:String(s);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 o=t.getContext("2d");if(!o)throw new Error("Canvas 2D is unavailable; this browser cannot create an export.");o.fillStyle=this.canvasBackground,o.fillRect(0,0,t.width,t.height);try{o.drawImage(e,0,0)}finally{e.width=1,e.height=1}return t}updateFreeTextVisibility(){let e=this.exportMode?Math.max(this.effScale(),se):this.effScale();for(let{node:t,backdrop:o,kind:s}of this.freeTextById.values()){if(s==="ga-label"||s==="ga-capacity")continue;let n=s==="free-text"&&this.nodeBelongsToFocusedSection(t),r=s==="direct-landmark";if(r){let a=Number(t.getAttr("directLandmarkBaseFontSize"))||t.fontSize();t.setAttr("directLandmarkBaseFontSize",a),t.fontSize(Math.max(a,N/e))}let l=r||n||ge(t.fontSize(),e);t.visible(l),o?.visible(l)}for(let{node:t,fontSize:o}of this.iconNodeById.values())t.visible(this.nodeBelongsToFocusedSection(t)||ge(o,e))}nodeBelongsToFocusedSection(e){let t=this.focusedSectionId;if(!t)return!1;this.focusMembershipKey!==t&&(this.focusMembership.clear(),this.focusMembershipKey=t);let o=this.focusMembership.get(e);if(o!==void 0)return o;let s=this.sections.filter(r=>r.id===t||r.logicalId===t||r.zone===t),n=!1;if(s.length){let r=e.getClientRect({relativeTo:this.bgLayer,skipShadow:!0}),l={x:r.x+r.width/2,y:r.y+r.height/2};n=s.some(a=>oe(l,a.outline,a.holes))}return this.focusMembership.set(e,n),n}buildRowLabelPlan(e){this.rowLabelPlan=Aa(e,{theme:this.theme,canvasBackground:this.canvasBackground,seats:this.seats,seatSection:this.seatSection,seatR:this.seatR,objectFilteredOut:t=>this.objectFilteredOut(t)})}rowLabelBox(e,t,o=Q){return vo(e,t,o)}resolveAutomaticRowLabelPosition(e,t,o){return Ea(e,t,o,this.seatIndex)}objectFilteredOut(e){let t=e.categoryKey;return t?!!(this.categoryHighlight&&t!==this.categoryHighlight||this.categoryFilter&&!this.categoryFilter.has(t)):!1}updateLabels(){Wa(this.viewportLabelContext)}get viewportLabelContext(){return{exportMode:this.exportMode,effScale:()=>this.effScale(),labelsWereVisible:()=>this.labelsVisible,onLabelVisibilityChange:e=>this.applyLabelVisibility(e),boothLabelById:this.boothLabelById,circleById:this.circleById,focusedSeatOpacity:(e,t)=>this.focusedSeatOpacity(e,t),labelGroup:this.labelGroup,rowLabelGroup:this.rowLabelGroup,seatLabelPool:this.seatLabelPool,statusCuePool:this.statusCuePool,labelLiftGroups:this.labelLiftGroups,seatLabelById:this.seatLabelById,seatLabelDrops:this.seatLabelDrops,setSeatLabelRungOpen:e=>{this.seatLabelRungOpen=e},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,hasSeatMark:e=>this.seatMarks.has(e),filterExcluded:e=>this.filterExcludesSeat(e),focusDims:e=>this.selectionFocusDims(e)||this.focusedSeatOpacity(e,1)<1,statusCueInk:e=>fa(this.circleById.get(e)?.fill(),this.canvasBackground,this.filterExcludesSeat(e)),statusCueScale:()=>ua(this.markerR),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,o)=>this.resolveAutomaticRowLabelPosition(e,t,o),rowLabelBox:(e,t)=>this.rowLabelBox(e,t),isoT:this.isoT,applyUprightLabels:()=>this.applyUprightLabels(),overlayLayer:this.overlayLayer}}handleResize(){this.gestures.invalidateRect();let e=ma({width:this.container.clientWidth,height:this.container.clientHeight,stageWidth:this.stage.width(),stageHeight:this.stage.height()});if(e==="hidden"){this.hiddenPose??=this.getCameraPose();return}let t=this.hiddenPose;if(this.hiddenPose=null,e==="unchanged"){t&&this.setCameraPose(t);return}this.stage.size(e),t&&this.setCameraPose(t),this.refitCurrentView()}};kt.ZOOM_STEP=1.4;var Po=kt;function sl(i,e){return new Po(i,e)}function nl(i,e,t){let o=new Map,s=new Map,n=new Map,r=new Map,l=[],a=new Map(Xo(i).map(d=>[d.id,d])),c=Et(i),h=new Map(c.sections.map(d=>[d.id,d.label]));for(let d of e){o.set(d.label,d.id),s.set(d.label,d),n.set(d.id,d),l.push(d.id);let u=a.get(d.rowId),f=u&&"label"in u&&typeof u.label=="string"?u.label:void 0,y=u?.type==="row"?u.segmentedRow:void 0,m=y?.displayLabel??(u&&"displayLabel"in u&&typeof u.displayLabel=="string"&&u.displayLabel?u.displayLabel:f),p=t.get(d.rowId),g=u?.type==="table"?"table":u?.type==="booth"?"booth":"seat",b=m,S=y?.displayType?.trim()||(u&&"displayType"in u&&typeof u.displayType=="string"&&u.displayType.trim()?u.displayType.trim():void 0),v=d.displayLabel??d.label,L=v.split("-"),w=p||d.kind==="booth"?void 0:m&&v.startsWith(`${m}-`)?v.slice(m.length+1):L[L.length-1]??v;r.set(d.id,{objectId:d.rowId,objectType:g,sectionLabel:h.get(c.objectToSection.get(d.rowId)??""),rowLabel:b,seatNumber:w,...S?{displayType:S,rowType:S}:{}})}return{labelToId:o,labelToSeat:s,seatById:n,seatContext:r,allIds:l}}function rl(i,e={}){let{baseMs:t=1e3,factor:o=2,maxMs:s=1/0,jitter:n=0,random:r=Math.random}=e,l=Math.min(t*o**Math.max(0,i),s);if(n<=0)return l;let a=Math.min(1,n);return l*(1-a+a*r())}function al(i,e,t){return at(i).map(o=>{let s=i.categories.find(n=>n.key===o.categoryKey);return{id:o.id,label:o.label,...o.displayLabel?{displayLabel:o.displayLabel}:{},...o.displayType?{displayType:o.displayType}:{},capacity:Math.max(0,Math.floor(o.capacity)),available:At(o).filter(n=>t(n)==="free").length,categoryKey:o.categoryKey,tiers:s?.tiers,price:s?.tiers?.[0]?.price??s?.price??0,currency:e}})}function ll(i,e){let t={};for(let o of i)t[o.id]=e?{available:o.available,selected:e.get(o.id)??0}:{available:o.available};return t}function cl(i){let e={};for(let[t,o]of i.seatById)i.groupedTableBySeatId.has(t)||i.closedMembers.has(t)||(i.statusOf(t)??"free")==="free"&&(e[o.categoryKey]=(e[o.categoryKey]??0)+1);for(let t of i.groupedTablesByLabel.values()){if(t.chairs.some(s=>i.closedMembers.has(s.id)))continue;let o=t.chairs[0];o&&(i.statusOf(o.id)??"free")==="free"&&(e[t.categoryKey]=(e[t.categoryKey]??0)+t.maxOccupancy)}for(let t of i.gaAreas??[])e[t.categoryKey]=(e[t.categoryKey]??0)+t.available;return e}function pd(i){return i.accessibility?.length?i.accessibility:i.accessible?["wheelchair"]:[]}function hl(i,e){let t=new Set,o=new Map;for(let s of i){let n=pd(s);if(!n.length)continue;let r=e(s.id)==="free";for(let l of n)t.add(l),r&&o.set(l,(o.get(l)??0)+1)}return t.size?Go.filter(s=>t.has(s.key)).map(s=>({key:s.key,count:o.get(s.key)??0})):[]}var ub=5e3,pb={lost:[],holdLapsed:!1,lapsedLabels:[],recoverable:[]};function fd(i){if(!i.holdActive||i.holdLabels.length===0)return!1;let e=i.now??Date.now();return i.holdExpiresAt!=null&&e>=i.holdExpiresAt+5e3||i.serverHoldActive===!1?!0:!i.holdLabels.some(t=>i.statusOf(t)==="held")}function dl(i){let e=new Set(i.holdLabels),t=i.selection.filter(s=>!e.has(s)&&i.statusOf(s)!=="free");if(!fd(i))return{lost:t,holdLapsed:!1,lapsedLabels:[],recoverable:[]};let o=[...i.holdLabels];return{lost:t,holdLapsed:!0,lapsedLabels:o,recoverable:o.filter(s=>i.statusOf(s)==="free")}}function fb(i){return i.lost.length>0||i.holdLapsed}function mb(i){return!i.lapsedLabels.length||!i.recoverable.length?"none":i.recoverable.length===i.lapsedLabels.length?"all":"partial"}function ul(i,e,t=Date.now()){return e&&t<i+5e3}function pl(i){if(typeof document>"u"||typeof document.addEventListener!="function")return()=>{};let e=()=>{document.visibilityState==="visible"&&i()};return document.addEventListener("visibilitychange",e),()=>{typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",e)}}function fl(i){if(!i?.zones?.length)return[];let e=new Set(Et(i).sections.filter(t=>t.seatCount>0&&!!t.zone).map(t=>t.zone));return i.zones.filter(t=>e.has(t.id)).map(t=>({id:t.id,label:t.label}))}function ml(i){let e=i.doc;if(!e?.objects?.length)return null;let t=e.focalPoint??{x:0,y:0},o=Ye(e).filter(r=>!i.groupedObjectIds.has(r.rowId)),s=new Set;for(let r of o)i.heldLabels.has(r.label)||i.tierApplies(r)&&(i.accessFilter&&!Le(r,i.accessFilter)||i.statusOfLabel(r.label)==="free"&&s.add(r.label));let n=ks(o,s,{qty:i.qty,categoryKey:i.categoryKey,zoneId:i.zoneId,focal:t,preferPremium:!0});return n.labels.length!==i.qty?null:n.labels.every(r=>i.isPremium(r))?[...n.labels]:null}var Mo=["background","rowLabelColor","textColor","selectionColor"];function yl(i,e){return!i||!e?!i&&!e:Mo.every(t=>i[t]===e[t])}function Ct(i){let e=i??{};return{status:e.status,conflicts:e.conflicts,reason:e.reason}}function gi(i){return i==="blocked"?"not_for_sale":i==="held"||i==="booked"||i==="free"||i==="not_for_sale"?i:"free"}function gl(i,e,t){let o=qo(e,t);o==="all"?i.setFloorOverview?.(!0):o&&i.setActiveFloor?.(o)}var Pe=class extends Error{constructor(t){super(t.message);this.status=422;this.name="PickerSelectionError",this.reason=t.code,this.labels=t.labels}};function bl(i,e){return!e||i.eventConfigurationId===e.id&&i.eventConfigurationVersion===e.version?i:{...i,eventConfigurationId:e.id,eventConfigurationVersion:e.version}}var bi=class{constructor(){this.ref=null;this.pending=null}reset(e){this.ref=e??null,this.pending=null}load(e,t){if(!this.ref||!e.eventConfiguration)return Promise.resolve(null);if(!this.pending){let o=this.ref;this.pending=e.eventConfiguration(t).then(s=>{if(s.reference.id!==o.id||s.reference.version!==o.version||s.configuration.id!==o.id||s.configuration.version!==o.version)throw new Error("seatlayer: Event configuration response did not match the chart reference");return s.configuration})}return this.pending}};function Sl(i){if(i!=null&&(!Number.isInteger(i)||i<1))throw new Error("picker: `numberOfPlacesToSelect` must be a positive integer");return i??null}function vl(i,e,t,o){if(t!=null&&!Array.isArray(t))throw new TypeError("picker: `selectionValidators` must be an array");let s=[],n=0,r=!1,l=!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")l=!0;else throw new TypeError(`picker: unsupported selection validator "${String(c?.type??"")}"`);if(n&&s.push({type:"minimumSelectedPlaces",minimum:n}),r&&s.push({type:"consecutiveSeats"}),l&&s.push({type:"noOrphanSeats"}),i!=null&&n>i)throw new Error("picker: `minimumSelectedPlaces.minimum` cannot exceed `numberOfPlacesToSelect`");let a=Math.max(0,Math.floor(e??i??Math.max(o,n)));if(i!=null&&a<i)throw new Error("picker: `maxSelection` cannot be lower than `numberOfPlacesToSelect`");if(e!=null&&a<n)throw new Error("picker: `maxSelection` cannot be lower than `minimumSelectedPlaces.minimum`");return{validators:s,maxSelection:i??a}}function md(i){let e=Number(i.slice(i.lastIndexOf(":")+1));return Number.isInteger(e)?e:-1}function yd(i){if(i.length<=1)return!1;let e=i[0]?.objectId,t=i[0]?.categoryKey;if(!e||i.some(s=>s.objectId!==e||s.categoryKey!==t))return!0;let o=i.map(s=>md(s.id)).sort((s,n)=>s-n);return o.some((s,n)=>s<0||n>0&&s!==o[n-1]+1)}function wl(i,e,t,o,s){let n=o.find(a=>a.type==="minimumSelectedPlaces")?.minimum??0,r=t??n,l=[];return t!=null&&e!==t&&l.push("numberOfPlacesToSelect"),n&&e<n&&l.push("minimumSelectedPlaces"),o.some(a=>a.type==="consecutiveSeats")&&yd(i)&&l.push("consecutiveSeats"),o.some(a=>a.type==="noOrphanSeats")&&s()&&l.push("noOrphanSeats"),{isValid:l.length===0,count:e,required:r,remaining:Math.max(0,r-e),seats:i,violations:l}}function Ll(i){let{id:e,doc:t,seatById:o,groupedTableBySeatId:s}=i,n=t.objects.find(v=>v.type==="section"&&v.id===e);if(!n)return null;let r=i.sectionMembers(e),l=new Map,a=new Map,c=new Set,h=0,d=0;for(let v of r){let L=o.get(v);if(!L)continue;i.matchesAccessFilter&&i.statusOf(v)==="free"&&i.matchesAccessFilter(L)&&(d+=1);let w=s.get(v);if(w){if(c.has(w.label))continue;c.add(w.label),l.set(w.categoryKey,(l.get(w.categoryKey)??0)+w.maxOccupancy),i.statusOf(w.chairs[0]?.id??v)==="free"&&(h+=w.maxOccupancy,a.set(w.categoryKey,(a.get(w.categoryKey)??0)+w.maxOccupancy))}else l.set(L.categoryKey,(l.get(L.categoryKey)??0)+1),i.statusOf(v)==="free"&&(h++,a.set(L.categoryKey,(a.get(L.categoryKey)??0)+1))}let u=[...l.entries()].map(([v,L])=>{let w=t.categories.find(T=>T.key===v),k=w?.tiers?.length?w.tiers.map(T=>T.price):[w?.price??0],C=Math.min(...k),x=Math.max(...k);return{key:v,count:L,label:w?.label??v,color:w?.color??"#6e7bff",price:C,priceMin:C,priceMax:x}}).sort((v,L)=>v.price-L.price),f=u.map(v=>v.priceMin),y=u.map(v=>v.priceMax),m=n.zone?t.zones?.find(v=>v.id===n.zone):void 0,p=v=>{let L=null,w=0;for(let[k,C]of v)(C>w||C===w&&L!=null&&k<L)&&(L=k,w=C);return L},g=p(a)??p(l),S=(g?u.find(v=>v.key===g)?.color:void 0)??m?.color??n.color??"#6e7bff";return{id:e,...g?{dominantCategoryKey:g}:{},...i.matchesAccessFilter?{accessibleLeft:d}:{},label:n.displayLabel??n.label,zoneLabel:m?.label??"",...n.entrance&&n.entrance.trim()?{entrance:n.entrance.trim()}:{},color:S,seatsLeft:h,priceMin:f.length?Math.min(...f):0,priceMax:y.length?Math.max(...y):0,categories:u}}var Si=class{constructor(e={}){this.inFlight=null;this.lastSettledAt=Number.NEGATIVE_INFINITY;this.windowMs=e.windowMs??250,this.now=e.now??(()=>Date.now())}run(e,t=!1){if(!t){if(this.inFlight)return this.inFlight;if(this.now()-this.lastSettledAt<this.windowMs)return Promise.resolve()}let o=e().then(()=>{this.lastSettledAt=this.now()},()=>{}).finally(()=>{this.inFlight===o&&(this.inFlight=null)});return this.inFlight=o,o}markSettled(){this.lastSettledAt=this.now()}reset(){this.inFlight=null,this.lastSettledAt=Number.NEGATIVE_INFINITY}};var gd=10,bd=15e3,kl=class{constructor(e){this.selectableSeatIds=null;this.lastSelectionValidity=null;this.renderer=null;this.gaSelected=null;this._doc=null;this.eventConfiguration=new bi;this.hidden=new Set;this.mapTheme=null;this.closedSections=new Set;this.labelToId=new Map;this.labelToSeat=new Map;this.expandedSeats=[];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.detachVisibility=null;this.hold_=null;this.liveStatuses=new Map;this.liveDefault="free";this.currency="USD";this.expiryTimer=null;this.snapshots=new Si;this.accessFilter=null;this.viewportInsets=null;this.hintShown=!1;this.opts=e,this.api=e.transport,this.key=e.eventKey,this.numberOfPlacesToSelect=Sl(e.numberOfPlacesToSelect);let t=vl(this.numberOfPlacesToSelect,e.maxSelection,e.selectionValidators,gd);this.selectionValidators=t.validators,this.maxSelection=t.maxSelection,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=jo(this._doc,this.hidden);if(!this.mapTheme)return e;let t={...e.theme??{}};for(let o of Mo){let s=this.mapTheme[o];s&&(t[o]=s)}return{...e,theme:t}}setMapTheme(e){return yl(this.mapTheme,e??null)?!1:(this.mapTheme=e??null,this.rebuildPreservingState(),!0)}rebuildPreservingState(){let e=this.renderer;if(!e)return!1;let t=e.getSelection().map(l=>l.id),o=this.getActiveFloorId(),s=e.isFloorOverview?.()??!1,n=e.getFocusedSection?.()??null,r=e.getCameraPose?.();return e.setChart(this.visibleDoc(),o?{floorId:o}:void 0),s&&e.setFloorOverview?.(!0),this.opts.colorblindSafe&&e.setColorblindSafe?.(!0),this.closedSections.size&&e.setClosedSections?.([...this.closedSections]),this.applySeatsMap(Object.fromEntries(this.liveStatuses),this.liveDefault),t.length&&e.select?.(t),n&&e.focusSection?.(n),r&&e.setCameraPose&&e.setCameraPose(r),e.settleView?.(),!0}refreshMapCopy(){this.rebuildPreservingState()&&this.renderer?.forceDraw()}syncHidden(e){let t=e.filter(s=>typeof s=="string");if(t.length===this.hidden.size&&t.every(s=>this.hidden.has(s)))return!1;this.hidden=new Set(t);let o=this.renderer?.isFloorOverview?.()??!1;return this.renderer?.setChart(this.visibleDoc()),o&&this.renderer?.setFloorOverview?.(!0),!0}syncClosed(e){let t=(e??[]).filter(o=>typeof o=="string");return t.length===this.closedSections.size&&t.every(o=>this.closedSections.has(o))?!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)}getExpandedSeats(){return this.expandedSeats}loadEventConfiguration(){return this.eventConfiguration.load(this.api,this.key)}idForLabel(e){return this.labelToId.get(e)}idsForLabel(e){let t=this.groupedTablesByLabel.get(e);if(t)return t.chairs.map(s=>s.id);let o=this.labelToId.get(e);return o?[o]:[]}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 s=this.visibleDoc(),n=at(s).find(r=>r.id===e.objectId);return{...n?.displayLabel?{displayLabel:n.displayLabel}:{},...n?.displayType?{displayType:n.displayType}:{}}}if(e.objectType==="table"){let s=this.groupedTablesByLabel.get(e.label);return{...s?.displayLabel&&s.displayLabel!==s.label?{displayLabel:s.displayLabel}:{},...s?.displayType?{displayType:s.displayType}:{}}}let t=this.labelToSeat.get(e.label),o=t?this.seatContext.get(t.id):void 0;return{...t?.displayLabel?{displayLabel:t.displayLabel}:{},...o?.displayType?{displayType:o.displayType}:{}}}async render(e){if(this.renderer)return null;let t=performance.now(),o={},s=C=>Math.round((performance.now()-C)*100)/100;this.closed=!1;let n=performance.now(),r=(async()=>this.api.chart(this.key))().then(C=>({ok:!0,res:C,elapsed:s(n)}),C=>({ok:!1,error:C,elapsed:s(n)})),l=performance.now(),a=(async()=>this.api.objects(this.key))().then(C=>({ok:!0,objects:C,elapsed:s(l)}),()=>({ok:!1,elapsed:s(l)})),c=await r;if(o.loadChart=c.elapsed,!c.ok)return this.emitError(c.error),null;let h=c.res;if(this.closed)return null;this._doc=bl(h.doc,h.event.eventConfiguration),this.eventConfiguration.reset(h.event.eventConfiguration);let d=performance.now();try{let C=Cs(h.doc,h.event.inventoryModelVersion===2?2:1);this.groupedTablesByObject=new Map(C.map(x=>[x.objectId,x])),this.groupedTablesByLabel=new Map(C.map(x=>[x.label,x])),this.groupedTableBySeatId=new Map(C.flatMap(x=>x.chairs.map(T=>[T.id,x]))),this.tableQuantities=new Map(C.map(x=>[x.label,x.mode==="whole"?x.capacity:x.minOccupancy])),this.confirmedVariableTables=new Set,this.groupedSelectionOverhead=C.reduce((x,T)=>x+Math.max(0,T.chairs.length-1),0)}catch(C){return this.emitError(C),null}this.expandedSeats=Ye(h.doc,{deriveRestrictedView:h.doc.derivedRestrictedView===!0});let u=nl(h.doc,this.expandedSeats,this.groupedTablesByObject);this.labelToId=u.labelToId,this.labelToSeat=u.labelToSeat,this.seatById=u.seatById,this.seatContext=u.seatContext,this.allIds=u.allIds;for(let C of this.groupedTablesByLabel.values()){let x=C.chairs[0];x&&(this.labelToId.set(C.label,x.id),this.labelToSeat.set(C.label,x))}o.normalizeBuyerModel=s(d);let f=h.event.currency??this.opts.currency;this.currency=f??"USD";let y=performance.now(),m=sl(e,{maxSelection:this.rendererSelectionCap(),confirmSelection:this.opts.confirmSelection,portraitFitCrop:!1,gaPickerMode:!0,currency:f,...this.opts.loadingReveal?{loadingReveal:this.opts.loadingReveal}:{},onSeatsRevealed:()=>{o.seatsComplete=s(t),this.opts.onSeatsRevealed?.()},onSelect:C=>{this.handleRendererSelect(C)},onDeselect:C=>{this.handleRendererDeselect(C)},onSelectionLimit:this.opts.onSelectionLimit,onHover:(C,x)=>{this.opts.onHover?.(C),this.opts.onSeatHover&&this.opts.onSeatHover(C?this.describeSeat(C,x):null)},onFocusSeat:this.opts.onFocusSeat,onViewChange:this.opts.onViewChange,onGAClick:this.opts.onGAClick,onSectionTap:(C,x)=>this.handleSectionTap(C,x),onBackdropTap:()=>this.overview(),onFocusedSectionChange:C=>this.opts.onSectionFocus?.(this.isSectionClosed(C)?null:this.sectionSummary(C)),onDeckTap:C=>this.handleDeckTap(C),onFps:this.opts.onFps});if(o.createRenderer=s(y),this.closed)return m.destroy(),null;this.renderer=m,this.viewportInsets&&m.setViewportInsets?.(this.viewportInsets);let p=null,g="free",b=[],S=await a;if(S.ok){let C=S.objects;this.hidden=new Set(C.hidden??[]),b=(C.closed??[]).filter(x=>typeof x=="string"),p=C.seats,g=C.default??"free"}if(o.loadStatuses=S.elapsed,this.closed)return m.destroy(),this.renderer=null,null;let v=performance.now();m.setChart(this.visibleDoc()),gl(m,h.doc,e.clientWidth),this.opts.colorblindSafe&&m.setColorblindSafe?.(!0),o.buildScene=s(v),this.closedSections=new Set(b);let L=performance.now();b.length&&m.setClosedSections?.(b),p&&this.applySeatsMap(p,g),this.rebuildSelectableSeatIds(),this.opts.selectedObjects?.length?this.select(this.opts.selectedObjects):this.emitSelectionValidity(),this.pushGAState(),o.applyInitialState=s(L);let w=performance.now();m.forceDraw(),o.firstPaint=s(w);let k=performance.now();return S.ok&&this.snapshots.markSettled(),this.attachVisibility(),this.connect(),o.startRealtime=s(k),o.controllerTotal=s(t),{doc:h.doc,salesClosed:!!h.event.salesClosed,eventName:h.event.name,venue:h.event.venue,startsAt:h.event.startsAt,timezone:h.event.timezone??null,currency:f,mode:h.event.mode??"live",locale:h.event.locale??null,posterUrl:h.event.posterUrl??null,chartDelivery:h.chartDelivery,performanceProfile:o}}getSelection(){if(!this.renderer)return[];let e=[],t=new Set;for(let o of this.renderer.getSelection()){let s=this.groupedTableBySeatId.get(o.id);s?t.has(s.label)||(t.add(s.label),e.push(this.toTableSeat(s))):e.push(this.toSeat(o))}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 o of e){let s=this.groupedTableBySeatId.get(o)??this.groupedTablesByLabel.get(o);if(s)s.chairs.forEach(n=>t.add(n.id)),this.hold_?.labels.includes(s.label)||(this.tableQuantities.set(s.label,s.mode==="whole"?s.capacity:s.minOccupancy),s.mode==="variable"&&this.confirmedVariableTables.delete(s.label));else{let n=this.seatById.has(o)?o:this.labelToId.get(o);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)),o=new Set,s=[];for(let r of e){let l=this.groupedTableBySeatId.get(r)??this.groupedTablesByLabel.get(r);if(l)this.tableTierResolution(l).kind==="invalid"?s.push(l.label):l.chairs.forEach(c=>{this.isSelectableByPolicy(c.id)&&o.add(c.id)});else{let a=this.seatById.has(r)?r:this.labelToId.get(r);if(!a||!this.isSelectableByPolicy(a))continue;let c=this.seatById.get(a);c&&this.seatTierResolution(c).kind==="invalid"?s.push(c.label):o.add(a)}}if(s.length&&this.emitError(new Pe(_i(s))),!o.size)return[];if(this.renderer?.select?.([...o]),this.selectionGuestCount()>this.maxSelection)return this.renderer?.deselect([...o]),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(o=>t.has(o.categoryKey)).map(o=>o.id))}deselectCategories(e){let t=new Set(e);this.deselect(this.getSelection().filter(o=>t.has(o.categoryKey)).map(o=>o.id))}setSelectableObjects(e){this.selectableObjectRefs=e==null?null:[...new Set(e.filter(o=>typeof o=="string"&&!!o))],this.rebuildSelectableSeatIds();let t=this.renderer?.getSelection().filter(o=>!this.isSelectableByPolicy(o.id)).map(o=>o.id)??[];t.length&&this.deselect(t)}getSelectionValidity(e){if(this.numberOfPlacesToSelect==null&&!this.selectionValidators.length)return null;let t=this.getSelection(),o=e??t.reduce((s,n)=>s+(n.quantity??1),0);return wl(t,o,this.numberOfPlacesToSelect,this.selectionValidators,()=>this.hasOrphanedSelection())}hasOrphanedSelection(){let e=this.renderer;if(!e)return!1;let t=new Set(e.getSelection().map(o=>o.id));return t.size>0&&Ei(this.seatById.values(),o=>e.getStatus(o),t).length>0}rebuildSelectableSeatIds(){if(this.selectableObjectRefs==null){this.selectableSeatIds=null;return}let e=new Set;for(let t of this.selectableObjectRefs){let o=this.groupedTableBySeatId.get(t)??this.groupedTablesByLabel.get(t);if(o){o.chairs.forEach(n=>e.add(n.id));continue}let s=this.seatById.has(t)?t:this.labelToId.get(t);s&&e.add(s)}this.selectableSeatIds=e}isSelectableByPolicy(e){return this.selectableSeatIds==null||this.selectableSeatIds.has(e)}setTableQuantity(e,t){let o=this.groupedTablesByLabel.get(e);if(!o)return!1;let s=o.mode==="whole"?o.capacity:Math.floor(t);if(!Number.isInteger(s)||s<o.minOccupancy||s>o.maxOccupancy)return!1;let n=this.tableQuantities.get(e)??o.minOccupancy;return this.tableQuantities.set(e,s),this.selectionGuestCount()>this.maxSelection?(this.tableQuantities.set(e,n),this.opts.onSelectionLimit?.(this.maxSelection),!1):(o.mode==="variable"&&this.confirmedVariableTables.add(e),this.emitSelectionChange(),!0)}async replaceTableQuantity(e,t,o){let s=this.groupedTablesByLabel.get(e),n=this.hold_;if(!s||s.mode!=="variable"||!n?.labels.includes(e))return null;let r=Math.floor(t);if(!Number.isInteger(r)||r<s.minOccupancy||r>s.maxOccupancy)return null;if((n.items??[]).filter(h=>h.label!==e).reduce((h,d)=>h+(d.quantity??1),0)+r>this.maxSelection)return this.opts.onSelectionLimit?.(this.maxSelection),null;let a=(n.items??[]).map(h=>({label:h.label,tierId:h.tierId,quantity:h.label===e?r:h.quantity}));if(!a.some(h=>h.label===e))return null;let c=await this.api.hold(this.key,a,o,n.holdId);return this.tableQuantities.set(e,r),this.setHold({holdId:c.holdId,labels:a.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(s=>s.id):[e.id]),this.emitSelectionChange();return}if((t?this.tableTierResolution(t):this.seatTierResolution(e)).kind==="invalid"){this.renderer?.deselect(t?t.chairs.map(s=>s.id):[e.id]),this.emitError(new Pe(_i([t?.label??e.label]))),this.emitSelectionChange();return}if(t){if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect(t.chairs.map(s=>s.id)),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.renderer?.select?.(t.chairs.map(s=>s.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),o=t?.label??e.label;if(this.hold_?.labels.includes(o)){this.opts.onDeselect?.(t?{...e,label:o}:e);return}t?(this.renderer?.deselect(t.chairs.map(s=>s.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 o=this.groupedTablesByLabel.get(t);o&&(this.tableQuantities.set(t,o.mode==="whole"?o.capacity:o.minOccupancy),o.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 s=e??this.getSelection().map(a=>a.label),n=(this.hold_?.items??[]).filter(a=>a.objectType==="ga"),r=[...new Set([...n.map(a=>a.label),...s])];if(!r.length)return null;let l=this.ticketIssue(r);if(l)throw new Pe(l);if(this.hold_&&this.holdCovers(r))return this.hold_;try{let a=r.map(h=>{let d=n.find(y=>y.label===h);if(d)return{label:h,tierId:d.tierId,quantity:d.quantity};let u=this.labelToSeat.get(h),f=u?this.toSeat(u):null;return{label:h,...f?.tierId?{tierId:f.tierId}:{},...this.tableQuantityRequest(f)}}),c=await this.api.hold(this.key,a,t,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:r,expiresAt:c.expiresAt,items:c.items}),this.hold_}catch(a){throw this.handle409Conflicts(a),a}}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 o=[...new Set(t.items.map(s=>s.label))];return o.length?(this.setHold({holdId:t.holdId,labels:o,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 o=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:o.expiresAt,items:t.items}),this.hold_)}catch{return null}}categoryAvailability(){return cl({seatById:this.seatById,groupedTableBySeatId:this.groupedTableBySeatId,groupedTablesByLabel:this.groupedTablesByLabel,closedMembers:this.closedMemberIds(),statusOf:e=>this.getStatus(e),gaAreas:this.getGAAreas()})}closedMemberIds(){let e=new Set,t=this.renderer;if(!t||!this.closedSections.size)return e;for(let o of this.closedSections)for(let s of t.sectionMembers?.(o)??[])e.add(s);return e}getGAAreas(){let e=this.visibleDoc();return e?al(e,this.currency,t=>this.statusOf(t)):[]}setGASelection(e){this.gaSelected=e?new Map(e):null,this.pushGAState()}pushGAState(){this.renderer?.setGAStates?.(ll(this.getGAAreas(),this.gaSelected))}async holdGA(e,t,o={}){let s=this.visibleDoc();if(!s||!Number.isFinite(t)||t<1)return null;let n=at(s).find(h=>h.id===e);if(!n)return null;let r=At(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 l=new Map;for(let h of this.hold_?.items??[])l.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)l.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{}});for(let h of this.getSelection())l.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{},...this.tableQuantityRequest(h)});for(let h of r)l.set(h,{label:h,...o.tierId?{tierId:o.tierId}:{}});let a=[...l.values()],c=await this.api.hold(this.key,a,o.ttlMs,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:a.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(){return fl(this.visibleDoc())}pickPremiumBlock(e,t,o){return ml({doc:this.visibleDoc(),qty:e,categoryKey:t,zoneId:o,groupedObjectIds:new Set(this.groupedTablesByObject.keys()),heldLabels:new Set(this.hold_?.labels??[]),accessFilter:this.accessFilter,tierApplies:s=>this.seatTierResolution(s).kind!=="invalid",statusOfLabel:s=>this.getStatus(this.labelToId.get(s)??"")??"free",isPremium:s=>!!this.labelToSeat.get(s)?.commercial?.premium})}async bestAvailable(e,t,o={}){let s=this.renderer;if(!s)return null;if(o.preferPremium){let n=this.pickPremiumBlock(e,t,o.zoneId);if(n){if(this.hold_&&!await this.release())return null;try{let r=n.map(h=>{let d=this.labelToSeat.get(h),u=d?this.toSeat(d):null;return{label:h,...u?.tierId?{tierId:u.tierId}:{}}}),l=await this.api.hold(this.key,r,o.ttlMs);s.clearSelection();let a=this.idsForLabels(n);a.length&&s.setStatus(a,"held"),this.setHold({holdId:l.holdId,labels:[...n],expiresAt:l.expiresAt,items:l.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:l,reason:a}=Ct(r);if(l===409&&a==="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,o.zoneId,o.ttlMs);s.clearSelection();let r=this.idsForLabels(n.labels);r.length&&s.setStatus(r,"held"),this.setHold({holdId:n.holdId,labels:[...n.labels],expiresAt:n.expiresAt,items:n.items});let l=n.labels.map(a=>this.labelToSeat.get(a)).filter(a=>!!a).map(a=>this.toSeat(a));return this.opts.onSelectionChange?.(l),this.hold_}catch(n){let{status:r,reason:l}=Ct(n);throw r===409&&l==="event_closed"&&this.opts.onSalesClosed?.(),n}}async book(e,t,o){let s=this.renderer;if(!s)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 Pe(r);let l;try{if(this.hold_&&this.holdCovers(n))l=this.hold_.holdId;else{let c=this.hold_?.holdId,h=await this.api.hold(this.key,n.map(d=>{let u=this.labelToSeat.get(d),f=u?this.toSeat(u):null;return{label:d,...f?.tierId?{tierId:f.tierId}:{},...this.tableQuantityRequest(f)}}),o,c);l=h.holdId,this.setHold({holdId:l,labels:[...n],expiresAt:h.expiresAt,items:h.items})}await this.api.book(this.key,n,l,e)}catch(c){let{status:h,conflicts:d,reason:u}=Ct(c);if(this.clearHold(),h===409&&u==="event_closed")this.opts.onSalesClosed?.();else if(h===409&&d?.length){let f=new Set(d.map(p=>p.label)),y=this.idsForLabels(f);y.length&&(s.setStatus(y,"booked"),s.deselect(y),this.resetTableQuantitiesForLabels(f));let m=n.filter(p=>!f.has(p));m.length&&l&&this.api.release(this.key,m,l).catch(()=>{}),this.emitSelectionChange()}else l&&this.api.release(this.key,n,l).catch(()=>{});throw c}let a=this.idsForLabels(n);return a.length&&(s.setStatus(a,"booked"),s.deselect(a)),this.clearHold(),this.resetTableQuantitiesForLabels(n),this.emitSelectionChange(),this.opts.onBook?.(e),n}async release(){let e=this.hold_;if(!e)return!0;try{let o=await this.api.release(this.key,e.labels,e.holdId);if(!this.releaseConfirmed(o,e.labels))return await this.resnapshot(),!1}catch(o){return this.emitError(o),!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 o=e.filter(l=>t.labels.includes(l));if(!o.length)return!0;try{let l=await this.api.release(this.key,o,t.holdId);if(!this.releaseConfirmed(l,o))return await this.resnapshot(),!1}catch(l){return this.emitError(l),!1}if(this.hold_?.holdId!==t.holdId)return!0;let s=t.labels.filter(l=>!o.includes(l)),n=t.items?.filter(l=>!o.includes(l.label));s.length?this.setHold({...t,labels:s,items:n}):this.clearHold(),this.resetTableQuantitiesForLabels(o);let r=this.idsForLabels(o);return r.length&&(this.renderer?.deselect(r),this.renderer?.setStatus(r,"free")),!0}releaseConfirmed(e,t){let o=e?.released;return!Array.isArray(o)||t.every(s=>o.includes(s))}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(s=>s.notForSale).map(s=>s.key));if(!t.size)return[];let o=[];for(let[s,n]of this.seatById)t.has(n.categoryKey)&&o.push(s);return o}flashSeat(e,t){this.renderer?.flashSeat(e,t)}zoomIn(){this.renderer?.zoomIn()}zoomOut(){let e=this.renderer;if(!e?.zoomOutLevel)return void e?.zoomOut();let t=!!e.getFocusedSection?.();e.zoomOutLevel()==="venue"&&t&&this.overview()}zoomToFit(){this.renderer?.zoomToFit()}refitCurrentView(){this.renderer?.refitCurrentView?this.renderer.refitCurrentView():this.renderer?.zoomToFit()}setViewportInsets(e){this.viewportInsets=e?{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}:null,this.renderer?.setViewportInsets?.(this.viewportInsets)}getViewportInsets(){return this.renderer?.getViewportInsets?.()??this.viewportInsets??{top:0,right:0,bottom:0,left:0}}worldToScreen(e){return this.renderer?.worldToScreen(e)??{x:0,y:0}}setSelectionFocus(e){this.renderer?.setSelectionFocus?.(e)}setAccessibilityFilter(e){this.accessFilter=e===null?null:[...e],this.renderer?.setAccessibilityFilter?.(e);let t=this.renderer?.getFocusedSection?.()??null;t&&this.opts.onSectionFocus?.(this.sectionSummary(t))}getAccessibilityFilter(){return this.accessFilter?[...this.accessFilter]:null}focusAccessibilityFilter(e){let t=this.renderer;if(!t?.focusAccessibleSeats)return!1;let o=e===void 0?this.accessFilter:e;if(!o)return!1;let s=this.floorForAccessibility(o);s&&this.setFloor(s);let n=t.focusAccessibleSeats(o);return n&&this.opts.onSectionFocus?.(null),n}floorForAccessibility(e){let t=this._doc;if(!t?.floors||t.floors.length<2)return null;let o=new Set(e),s=a=>o.size===0?!!a.accessible:!!a.accessibility?.some(c=>o.has(c)),n=a=>a.some(c=>c.type==="row"&&(c.overrides??[]).some(s)),r=this.getActiveFloorId(),l=t.floors.find(a=>a.id===r);return l&&n(l.objects)?null:t.floors.find(a=>n(a.objects))?.id??null}accessibilityFilterDims(e){return this.accessFilter?tt(e,this.accessFilter)==="other":!1}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"}getFocusedSection(){return this.renderer?.getFocusedSection?.()??null}seatsRevealed(){let e=this.renderer;return e?.seatsRevealed?e.seatsRevealed():this.getRung()==="seats"||!!this.getFocusedSection()}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 o=this.floorForCategories(e);o&&this.setFloor(o)}!e?.length&&this.accessFilter&&this.focusAccessibilityFilter()||e?.length&&(t.focusCategories?t.focusCategories(e):t.zoomToFit())}}floorForCategories(e){let t=this._doc;if(!t?.floors||t.floors.length<2)return null;let o=new Set(e),s=l=>l.some(a=>a.type==="row"&&(o.has(a.categoryKey)||(a.overrides??[]).some(c=>c.categoryKey!=null&&o.has(c.categoryKey)))||a.type==="gaArea"&&o.has(a.categoryKey)),n=this.getActiveFloorId(),r=t.floors.find(l=>l.id===n);return r&&s(r.objects)?null:t.floors.find(l=>s(l.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,t){this.handleSectionTap(e,t)}getSectionSeatCount(e){return this.renderer?.sectionMembers?.(e)?.length??0}overview(){this.renderer?.clearSectionFocus?.(),this.renderer?.zoomToFit(),this.opts.onSectionFocus?.(null)}handleSectionTap(e,t){let o=this.renderer;if(o){if(o.focusSection?o.focusSection(e,t?{anchor:t}:void 0):o.focusRegion?.(e),this.isSectionClosed(e)){this.opts.onSectionFocus?.(null);return}this.opts.onSectionFocus?.(this.sectionSummary(e))}}sectionSummary(e){return!this.renderer||!this._doc?null:Ll({id:e,doc:this._doc,sectionMembers:t=>this.renderer?.sectionMembers?.(t)??[],statusOf:t=>this.renderer?.getStatus(t)??"free",seatById:this.seatById,groupedTableBySeatId:this.groupedTableBySeatId,...this.accessFilter?{matchesAccessFilter:t=>Le(t,this.accessFilter)}:{}})}destroy(){if(this.closed=!0,this.detachVisibility?.(),this.detachVisibility=null,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 o=e.commercial?{commercial:e.commercial}:void 0,s=e.displayLabel?{displayLabel:e.displayLabel}:void 0,n=e.accessibility?.length?{accessibility:e.accessibility}:void 0,r=e.wheelchairSpaceType?{wheelchairSpaceType:e.wheelchairSpaceType}:void 0,l=this.seatContext.get(e.id),a=this.tiersForSeat(e),c=this.seatTierResolution(e);if(c.kind!=="resolved"||!a)return{id:e.id,label:e.label,...s,...l,categoryKey:e.categoryKey,price:this.priceFor(e.categoryKey),currency:this.currency,...o,...n,...r};let h=c.tier;return{id:e.id,label:e.label,...s,...l,categoryKey:e.categoryKey,price:h.price,currency:this.currency,tiers:a,tierId:h.id,...o,...n,...r}}toTableSeat(e){let t=e.chairs[0],o=this.tiersFor(e.categoryKey)?.filter(r=>Wt(this._doc,this.tableTierSeat(e),r.id).kind==="resolved"),s=this.tableTierResolution(e),n=s.kind==="resolved"?s.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,...o?{tiers:o,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,t){let o=this._doc?.categories.find(s=>s.key===e.categoryKey);return{...this.toSeat(e),categoryLabel:o?.label??e.categoryKey,categoryColor:o?.color??"#6e7bff",status:this.renderer?.getStatus(e.id)??"free",mark:this.renderer?.getSeatMark?.(e.id)??null,...t?.interaction?{interaction:t.interaction}:{},...t?.unavailable?{unavailable:!0}:{},...t?.filteredOut?{filteredOut:!0}:{},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(o=>o.key===e)?.tiers;return t&&t.length?t:void 0}tiersForSeat(e){if(!this._doc)return;let t=ws(this._doc,e);return t.length?t:void 0}seatTierResolution(e){return this._doc?Wt(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 Wt(this._doc,this.tableTierSeat(e),this.seatTiers.get(t))}setSeatTier(e,t){let o=this.seatById.get(e);if(!o)return;let s=this.tiersForSeat(o);if(s){if(t==null)this.seatTiers.delete(e);else if(s.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 o of e){let s=this.labelToSeat.get(o);s&&t.push(this.toSeat(s))}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 Ls(this._doc,t.map(o=>({label:o.label,...o.tierId?{tierId:o.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"?H("picker.companionPairRequired"):"That ticket choice is not available for the selected seat.");return}let o=this.selectionValidators.some(r=>r.type==="noOrphanSeats"),s=new Set(e.getSelection().map(r=>r.id));(o&&s.size?Ei(this.seatById.values(),r=>e.getStatus(r),s):[]).length>0?(this.hintShown=!0,this.opts.onHint(H("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 o=new Map((t.items??[]).map(n=>[n.label,n.tierId])),s=new Map((t.items??[]).map(n=>[n.label,n.quantity??1]));return e.every(n=>{let r=this.labelToSeat.get(n),l=r?this.toSeat(r):null,a=l?.tierId??null;return(l?.objectType!=="table"||(l.bookingMode!=="variable"||this.confirmedVariableTables.has(n))&&(!s.has(n)||s.get(n)===l.quantity))&&(!o.has(n)||o.get(n)===a)})}handle409Conflicts(e){let{status:t,conflicts:o}=Ct(e);if(t!==409||!o?.length)return;let s=this.renderer;if(!s)return;let n=this.idsForLabels(o.map(r=>r.label));n.length&&(s.deselect(n),s.setStatus(n,"held"),this.resetTableQuantitiesForLabels(o.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 o={...e,seats:this.seatsForLabels(e.labels)};this.hold_=o,this.renderer?.setOwnedHold?.(this.idsForLabels(o.labels)),this.expiryTimer&&clearTimeout(this.expiryTimer);let s=Math.max(0,o.expiresAt-Date.now());this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},s),t==="restored"?this.opts.onHoldRestored?.(o):this.opts.onHold?.(o)}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(ul(e.expiresAt,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 o=this.renderer;if(!o)return;this.liveStatuses=new Map(Object.entries(e)),this.liveDefault=t;let s=gi(t);this.allIds.length&&o.setStatus(this.allIds,s),o.setOwnedHold?.(this.idsForLabels(this.hold_?.labels??[]));let n={free:[],held:[],booked:[],not_for_sale:[]};for(let[l,a]of Object.entries(e))n[gi(a)].push(...this.idsForLabel(l));["free","held","booked","not_for_sale"].forEach(l=>{l!==s&&n[l].length&&o.setStatus(n[l],l)});let r=this.notForSaleCategorySeatIds();r.length&&o.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))}resnapshot(e=!1){return this.snapshots.run(async()=>{let t=await this.api.objects(this.key);this.applySeatsMap(t.seats,t.default??"free")},e)}refresh(){return this.resnapshot(!0)}async refreshAvailability(){await this.resnapshot();let e=this.hold_,t=dl({selection:this.getSelection().map(o=>o.label),holdLabels:e?.labels??[],holdActive:!!e,holdExpiresAt:e?.expiresAt??null,statusOf:o=>this.statusOf(o)});if(t.lost.length&&this.deselect(t.lost),t.holdLapsed){this.clearHold(),this.resetTableQuantitiesForLabels(t.lapsedLabels);let o=this.idsForLabels(t.lapsedLabels);o.length&&this.renderer?.deselect(o),this.opts.onHoldExpired?.()}return this.opts.onAvailabilityRefresh?.(t),t}getAccessNeeds(){return hl(this.seatById.values(),e=>this.getStatus(e)??"free")}attachVisibility(){this.detachVisibility||(this.detachVisibility=pl(()=>{this.closed||this.refreshAvailability().then(()=>{this.closed||this.renderer?.forceDraw()})}))}realtimeSink(){return{applyStatuses:e=>this.applyStatusChanges(e),applyProjection:e=>this.applySeatsMap(e.exceptions,e.default),resync:()=>this.resnapshot(),onSections:(e,t)=>{let o=this.syncHidden(e),s=this.syncClosed(t);o&&this.resnapshot(),(o||s)&&this.opts.onStatusChange?.()}}}applyStatusChanges(e){let t=this.renderer;if(t){for(let o of e){this.liveStatuses.set(o.label,o.status);let s=this.idsForLabel(o.label);if(!s.length)continue;let n=gi(o.status);this.opts.flashOnLiveChange&&n!=="free"&&s.some(r=>t.getStatus(r)==="free")&&!this.hold_?.labels.includes(o.label)&&s.forEach(r=>t.flashSeat(r,n==="held"?"#f4b740":"#f43f5e")),t.setStatus(s,n)}this.opts.keepLiveWhileHidden&&typeof document<"u"&&document.visibilityState==="hidden"&&t.forceDraw(),this.pushGAState(),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 o=null;try{o=this.api.createRealtime(this.key,this.realtimeSink())}catch{o=null}if(o){this.realtime=o,o.start();return}}if(this.realtime)return;let t;try{let o=this.api.socketProtocols?.(this.key);t=o&&o.length?new WebSocket(e,o):new WebSocket(e)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.attempt=0,this.resnapshot()},t.onmessage=o=>{let s;try{s=JSON.parse(typeof o.data=="string"?o.data:"")}catch{return}if(!this.renderer||!s||typeof s!="object")return;let r=s;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=rl(e,{baseMs:1e3,maxMs:bd,jitter:1});this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}};var Sd=5,vd=-1.1,Ro=35;function Ao(i,e){let t=i-ee,o=Math.atan2(Sd-t,e)*180/Math.PI,s=Math.atan2(vd-t,e)*180/Math.PI;return s<-Ro&&(o+=-Ro-s,s=-Ro),{topPitch:o,basePitch:s}}var q=2048,pe=1024,Tt=Wo,E=Math.PI*2,wd=pe/180,nt=i=>(i+180)/360*q,z=i=>(90-i)/180*pe;function Pl(i){let e=2166136261;for(let t=0;t<i.length;t++)e^=i.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function Ml(i){let e=i>>>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 vi=96,Bo=360/vi,Ld=.6,Eo=[17,23,42];function _o(i,e,t=1){let o=Math.max(0,Math.min(.58,e)),s=Math.round(i[0]+(Eo[0]-i[0])*o),n=Math.round(i[1]+(Eo[1]-i[1])*o),r=Math.round(i[2]+(Eo[2]-i[2])*o);return`rgba(${s},${n},${r},${t})`}function Cl(i,e,t){return[Math.round(i[0]+(e[0]-i[0])*t),Math.round(i[1]+(e[1]-i[1])*t),Math.round(i[2]+(e[2]-i[2])*t)]}function ie(i,e,t){let o=(1-Math.abs(2*t-1))*e,s=(i%360+360)%360/60,n=o*(1-Math.abs(s%2-1)),r=0,l=0,a=0;s<1?[r,l,a]=[o,n,0]:s<2?[r,l,a]=[n,o,0]:s<3?[r,l,a]=[0,o,n]:s<4?[r,l,a]=[0,n,o]:s<5?[r,l,a]=[n,0,o]:[r,l,a]=[o,0,n];let c=t-o/2;return[Math.round((r+c)*255),Math.round((l+c)*255),Math.round((a+c)*255)]}var xl=new Map;function Tl(i){if(!i)return null;let e=xl.get(i);if(e)return e;let t=2166136261;for(let n=0;n<i.length;n++)t^=i.charCodeAt(n),t=Math.imul(t,16777619);let o=(t>>>0)%360,s=ie(o,.3,.42);return xl.set(i,s),s}function kd(i,e,t,o){let s=new Array(vi).fill(null),n=0,r=i.sectionId;for(let l of e){if(l.id===i.id)continue;let a=l.sectionId;if(!a||r&&a===r)continue;let c=l.x-i.x,h=l.y-i.y,d=Math.hypot(c,h)*Tt;if(d<1.5||d>95)continue;let u=l.eyeHeightM??ee,f=u-o;Math.abs(f)>n&&(n=Math.abs(f));let y=Math.atan2(f,d)*180/Math.PI,m=Math.atan2(u-ee-o,d)*180/Math.PI,g=((Math.atan2(c,-h)-t)*180/Math.PI+540)%360-180,b=Math.min(vi-1,Math.max(0,Math.floor((g+180)/Bo))),S=y>34&&d<16,v=s[b];v?(y>v.top&&(v.top=y),m<v.base&&(v.base=m),d<v.nearM&&(v.nearM=d,v.tint=Tl(l.categoryKey)),v.overhead=v.overhead||S):s[b]={top:y,base:m,nearM:d,overhead:S,tint:Tl(l.categoryKey)}}return{bins:s,maxDelta:n}}function Cd(i,e,t,o){for(let s=0;s<vi;s++){let n=e[s];if(!n)continue;let r=-180+s*Bo,l=t(r),a=t(r+Bo);if(!(a>l))continue;let c=Math.min(72,n.top),h=Math.min(n.base,-4),d=o(c),u=o(h);if(u<=d)continue;let f=n.nearM/95,y=n.tint,m=y?Cl([44,54,80],y,.34):[44,54,80],p=y?Cl([24,30,48],y,.28):[24,30,48],g=i.createLinearGradient(0,d,0,u);g.addColorStop(0,_o(m,f)),g.addColorStop(.24,_o(p,f)),g.addColorStop(1,_o([10,13,22],f)),i.fillStyle=g,i.fillRect(l,d,a-l+1,u-d),i.fillStyle=`rgba(150,165,205,${.35*(1-f*.55)})`,i.fillRect(l,d,a-l+1,1.5);let S=Math.min(u,o(0))-d;if(S>8){let L=1-f*.4;for(let w=1;w<6;w++){let k=d+S*w/6;i.fillStyle=`rgba(0,0,0,${.16*L})`,i.fillRect(l,k,a-l+1,1.5),i.fillStyle=`rgba(120,134,170,${.1*L})`,i.fillRect(l,k+1.5,a-l+1,1.2)}}if(n.overhead){let v=o(Math.min(86,c+12)),L=i.createLinearGradient(0,v,0,d);L.addColorStop(0,"rgba(3,4,8,0.9)"),L.addColorStop(1,"rgba(3,4,8,0)"),i.fillStyle=L,i.fillRect(l,v,a-l+1,d-v),i.fillStyle="rgba(120,130,160,0.14)",i.fillRect(l,d-1.5,a-l+1,1.5)}}}function xd(i,e,t){let s=new Array(72).fill(!1),n=new Array(72).fill(1/0),r=new Set,l=0;for(let g of t){l++,g.sectionId&&r.add(g.sectionId);let b=g.x-e.x,S=g.y-e.y,v=Math.hypot(b,S)*Tt;if(v<.5)continue;let L=Math.atan2(b,-S),w=Math.floor((L+Math.PI)/E*72);w<0?w=0:w>=72&&(w=71),s[w]=!0,v<n[w]&&(n[w]=v)}let a=0,c=[];for(let g=0;g<72;g++)s[g]&&(a++,c.push(n[g]));let h=a/72*360;c.sort((g,b)=>g-b);let d=c.length?c[c.length>>1]:0,u=c.length?c[Math.floor(c.length*.15)]??d:0,f=c.length?c[Math.floor(c.length*.85)]??d:0,y=u>.5?f/u:1,m=Pl(`${l}|${[...r].sort().join(",")}|${Math.round(e.x)},${Math.round(e.y)}`),p;return h>=300&&d>11&&y>1.35?p="sport":h>=285?p="arena":p="proscenium",{mode:p,seed:m,voidRadiusM:d,aspect:y}}var Td=5;function Id(i,e,t){switch(t){case 1:i.beginPath(),i.ellipse(0,-e*.14,e*1.16,e*1.16,0,0,E),i.fill();break;case 2:i.beginPath(),i.ellipse(0,-e*1.02,e*.42,e*.42,0,0,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.2,e*.98,e*1.02,0,0,E),i.fill();break;case 3:i.beginPath(),i.ellipse(0,-e*.36,e*1.04,e*.6,0,Math.PI,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.52,e*1.22,e*.24,0,0,E),i.fill();break;case 4:i.beginPath(),i.ellipse(-e*.66,e*.5,e*.5,e*1.35,0,0,E),i.fill(),i.beginPath(),i.ellipse(e*.66,e*.5,e*.5,e*1.35,0,0,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.08,e*1.06,e*1.08,0,0,E),i.fill();break;default:break}}function Pd(i,e,t,o,s){let n=o*.44,r=o*s.shoulderK,l=o*.66,a=o*1.68,c=o*5.4,h=`rgba(${s.clothing[0]},${s.clothing[1]},${s.clothing[2]},${s.alpha})`,d=`rgba(${s.tone[0]},${s.tone[1]},${s.tone[2]},${s.alpha})`;i.save(),i.translate(e,t);let u=s.lean*o;i.fillStyle=h,i.beginPath(),i.moveTo(-n,l),i.quadraticCurveTo(-n*1.18,a-u-o*.6,-r,a-u),i.quadraticCurveTo(-r*1.05,a+o*1.2,-r*.94,c),i.lineTo(r*.94,c),i.quadraticCurveTo(r*1.05,a+o*1.2,r,a+u),i.quadraticCurveTo(n*1.18,a+u-o*.6,n,l),i.closePath(),i.fill(),i.fillStyle=d,i.fillRect(-n*.82,o*.5,n*1.64,o*.9),i.save(),i.rotate(s.tilt),i.translate(s.turn*o,0),i.fillStyle=d,o>=18?(i.beginPath(),i.moveTo(-o*.9,-o*.15),i.quadraticCurveTo(-o*.96,-o*1.12,0,-o*1.06),i.quadraticCurveTo(o*.96,-o*1.12,o*.9,-o*.15),i.quadraticCurveTo(o*.86,o*.55,o*.36,o*.98),i.quadraticCurveTo(0,o*1.14,-o*.36,o*.98),i.quadraticCurveTo(-o*.86,o*.55,-o*.9,-o*.15),i.closePath(),i.fill(),o>=22&&(i.beginPath(),i.ellipse(-o*.9,o*.18,o*.13,o*.22,0,0,E),i.ellipse(o*.9,o*.18,o*.13,o*.22,0,0,E),i.fill())):(i.beginPath(),i.ellipse(0,0,o*.9,o*1.06,0,0,E),i.fill()),Id(i,o,s.hair),s.rim>.01&&(i.strokeStyle=`rgba(245,205,150,${(.5*s.rim).toFixed(3)})`,i.lineWidth=Math.max(1,o*.14),i.beginPath(),i.ellipse(0,-o*.06,o*.86,o*1,0,Math.PI*1.12,Math.PI*1.9),i.stroke()),i.restore(),s.rim>.01&&(i.strokeStyle=`rgba(240,200,150,${(.28*s.rim).toFixed(3)})`,i.lineWidth=Math.max(1,o*.12),i.beginPath(),i.moveTo(-r*.8,a-o*.05),i.quadraticCurveTo(-n,a-o*.75,0,a-o*.82),i.quadraticCurveTo(n,a-o*.75,r*.8,a-o*.05),i.stroke()),i.restore()}function Md(i,e,t,o,s,n,r){i.fillStyle=`rgba(${s[0]},${s[1]},${s[2]},${r})`,i.beginPath(),i.moveTo(e-o*1.72,t+o*4),i.quadraticCurveTo(e-o*1.78,t+o*1.55,e-o*.46,t+o*1.02),i.lineTo(e-o*.4,t+o*.62),i.lineTo(e+o*.4,t+o*.62),i.lineTo(e+o*.46,t+o*1.02),i.quadraticCurveTo(e+o*1.78,t+o*1.55,e+o*1.72,t+o*4),i.closePath(),i.fill(),i.fillStyle=`rgba(${n[0]},${n[1]},${n[2]},${r})`,i.beginPath(),i.ellipse(e,t,o*.9,o*1.05,0,0,E),i.fill()}function Oo(i,e,t,o,s){let n=o*.1,r=t-o*.9,l=t-o*.74,a=t-o*.46,c=o*.13,h=o*.09,d=`rgba(${s.tone[0]},${s.tone[1]},${s.tone[2]},${s.alpha})`,u=i.createRadialGradient(e,t,1,e,t,o*.24);u.addColorStop(0,"rgba(0,0,0,0.4)"),u.addColorStop(1,"rgba(0,0,0,0)"),i.save(),i.scale(1,.28),i.fillStyle=u,i.beginPath(),i.ellipse(e,t/.28,o*.24,o*.24,0,0,E),i.fill(),i.restore(),i.fillStyle=d,i.beginPath(),i.moveTo(e-h,a),i.lineTo(e-h*.7,t),i.lineTo(e-h*.1,t),i.lineTo(e-h*.1,a+o*.02),i.lineTo(e+h*.1,a+o*.02),i.lineTo(e+h*.1,t),i.lineTo(e+h*.7,t),i.lineTo(e+h,a),i.closePath(),i.fill(),i.beginPath(),i.moveTo(e-c,l),i.quadraticCurveTo(e-c*.9,a-o*.12,e-h,a),i.lineTo(e+h,a),i.quadraticCurveTo(e+c*.9,a-o*.12,e+c,l),i.quadraticCurveTo(e,l-o*.05,e-c,l),i.closePath(),i.fill(),i.lineCap="round",i.lineJoin="round",i.strokeStyle=d,i.lineWidth=o*.055;let f=l+o*.02;s.pose===1?(i.beginPath(),i.moveTo(e-c*.8,f),i.lineTo(e-c*1.5,t-o*1.02),i.moveTo(e+c*.8,f),i.lineTo(e+c*1.5,t-o*1.02),i.stroke()):s.pose===2?(i.beginPath(),i.moveTo(e-c*.8,f),i.lineTo(e+h*1.4,a-o*.02),i.moveTo(e+c*.8,f),i.lineTo(e-h*.4,a-o*.06),i.stroke(),i.fillStyle=d,i.beginPath(),i.ellipse(e+h*1.5,a-o*.04,o*.07,o*.09,-.5,0,E),i.fill()):s.pose===3?(i.beginPath(),i.moveTo(e-c*.8,f),i.lineTo(e-c*.2,r+n*.6),i.moveTo(e+c*.8,f),i.lineTo(e+c*1.1,a),i.stroke(),i.lineWidth=o*.02,i.beginPath(),i.moveTo(e-c*.2,r+n*.9),i.lineTo(e-c*.2,t-o*.02),i.stroke()):(i.beginPath(),i.moveTo(e-c*.85,f),i.lineTo(e-c*.95,a+o*.02),i.moveTo(e+c*.85,f),i.lineTo(e+c*.95,a+o*.02),i.stroke()),i.fillStyle=d,i.fillRect(e-n*.34,r+n*.6,n*.68,n*.9),i.beginPath(),i.ellipse(e,r,n*.86,n*1.05,0,0,E),i.fill(),s.rimStrength>.01&&(i.strokeStyle=`rgba(${s.rim[0]},${s.rim[1]},${s.rim[2]},${(.6*s.rimStrength).toFixed(3)})`,i.lineWidth=Math.max(1,o*.02),i.beginPath(),i.moveTo(e-c,l),i.lineTo(e-n*.6,r+n*.4),i.moveTo(e-n*.7,r),i.ellipse(e,r,n*.84,n*1.02,0,Math.PI*1.05,Math.PI*1.55),i.stroke())}function wi(i,e,t,o,s,n,r,l,a){i.save(),i.globalCompositeOperation="lighter";let c=i.createLinearGradient(0,t,0,s);c.addColorStop(0,`rgba(${l},${a})`),c.addColorStop(.5,`rgba(${l},${(a*.4).toFixed(3)})`),c.addColorStop(1,`rgba(${l},0)`),i.fillStyle=c,i.beginPath(),i.moveTo(e-n,t),i.lineTo(o-r,s),i.lineTo(o+r,s),i.lineTo(e+n,t),i.closePath(),i.fill(),i.restore()}function Do(i,e,t,o,s){let n=i.createRadialGradient(e,t,0,e,t,o*3);n.addColorStop(0,`rgba(${s},0.9)`),n.addColorStop(.4,`rgba(${s},0.35)`),n.addColorStop(1,`rgba(${s},0)`),i.fillStyle=n,i.beginPath(),i.arc(e,t,o*3,0,E),i.fill(),i.fillStyle=`rgba(${s},1)`,i.beginPath(),i.arc(e,t,o,0,E),i.fill()}function sS(i,e,t){let o=document.createElement("canvas");o.width=q,o.height=pe;let s=o.getContext("2d"),n=e.x-i.x,r=e.y-i.y,l=Math.hypot(n,r),a=Math.max(2,l*Tt),c=i.eyeHeightM??ee,h=xd(i,e,t),d=Ml(h.seed),u=210+d()*150,f=ie(220+(d()-.5)*60,.55,.82),y=`${f[0]},${f[1]},${f[2]}`,m=s.createLinearGradient(0,0,0,pe);m.addColorStop(0,"#080b12"),m.addColorStop(.42,"#12182c"),m.addColorStop(.5,"#1c2440"),m.addColorStop(.56,"#151b2c"),m.addColorStop(.78,"#171e30"),m.addColorStop(1,"#131829"),s.fillStyle=m,s.fillRect(0,0,q,pe);let p=s.createLinearGradient(0,z(-6),0,pe);p.addColorStop(0,"rgba(30, 37, 56, 0)"),p.addColorStop(.55,"rgba(30, 37, 56, 0.22)"),p.addColorStop(1,"rgba(22, 28, 44, 0.12)"),s.fillStyle=p,s.fillRect(0,z(-6),q,pe-z(-6));let g=Math.atan2(n,-r),b=kd(i,t,g,c),S=b.maxDelta>=Ld;S&&Cd(s,b.bins,nt,z);let v=Math.max(.3,Math.min(1,1-(a-6)/60)),L=Ao(c,a),w=Math.min(80,Math.atan2(4,a)*180/Math.PI),k=Math.min(45,L.topPitch),C=L.basePitch;h.mode==="sport"?Ed(s,a,c,h,v,u,y,d):h.mode==="arena"?Ad(s,a,c,h,v,y,d):Rd(s,w,k,C,v,u,y,d);let x=h.mode==="sport"?34:24+Math.floor(d()*8);s.fillStyle=`rgba(${y},0.8)`;for(let P=0;P<x;P++){let I=(P+.5)/x*q,A=z(h.mode==="sport"?58:54+P*7%3*6);s.beginPath(),s.arc(I,A,h.mode==="sport"?2.6:3.2,0,E),s.fill()}_d(s,i,t,e,g,c,n,r,S,h);let T=s.createLinearGradient(0,0,0,pe);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)"),s.fillStyle=T,s.fillRect(0,0,q,pe),{url:o.toDataURL("image/jpeg",.82),distanceM:Math.round(a)}}function Rd(i,e,t,o,s,n,r,l){let a=nt(-e),c=nt(e),h=z(t),d=z(o),u=c-a,f=d-h,y=z(Math.min(50,t+10)),m=u*(1.1+(1-s)*.5),p=i.createRadialGradient(q/2,(h+d)/2,8,q/2,(h+d)/2,m);p.addColorStop(0,"rgba(255, 214, 150, 0.34)"),p.addColorStop(.28,"rgba(150, 150, 230, 0.3)"),p.addColorStop(.6,"rgba(99, 102, 241, 0.12)"),p.addColorStop(1,"rgba(99, 102, 241, 0)"),i.fillStyle=p,i.fillRect(a-u*.6,h-f*1.2,u*2.2,f*3.4);let g=ie(n,.62,.55),b=ie(n+40,.7,.5),S=ie(n+70,.78,.52);i.save(),i.beginPath(),i.rect(a,h,u,f),i.clip();let v=i.createLinearGradient(0,h,0,d);v.addColorStop(0,`rgb(${g[0]},${g[1]},${g[2]})`),v.addColorStop(.5,`rgb(${b[0]},${b[1]},${b[2]})`),v.addColorStop(1,`rgb(${S[0]},${S[1]},${S[2]})`),i.globalAlpha=.8,i.fillStyle=v,i.fillRect(a,h,u,f),i.globalAlpha=1;let L=i.createRadialGradient(q/2,(h+d)/2,u*.12,q/2,(h+d)/2,u*.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)"),i.fillStyle=L,i.fillRect(a,h,u,f),i.restore();let w=3+Math.floor(l()*3),k=f*.46,C=d-f*.08;for(let _=0;_<w;_++){let $=(_+1)/(w+1),X=a+u*(.22+$*.56+(l()-.5)*.06);Oo(i,X,C,k*(.9+l()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(l()*4),rim:ie(n+20,.5,.7),rimStrength:.7})}i.fillStyle="#05070d",i.fillRect(a-u*.5,y,u*.5,d-y),i.fillRect(c,y,u*.5,d-y);let x=u*.055+3,T=x*1.35;i.fillStyle="#03050a",i.beginPath(),i.moveTo(a,d),i.lineTo(a-x,d),i.lineTo(a-T,y),i.lineTo(a+u*.012,y),i.closePath(),i.fill(),i.beginPath(),i.moveTo(c,d),i.lineTo(c+x,d),i.lineTo(c+T,y),i.lineTo(c-u*.012,y),i.closePath(),i.fill(),i.fillRect(a-T,y,u+T*2,(d-y)*.12);let P=f*.14,I=y+(d-y)*.12;i.fillStyle="rgba(4,6,12,0.96)";let A=7;i.beginPath(),i.moveTo(a-T,I);for(let _=0;_<=A;_++){let $=a-T+(u+T*2)*_/A;i.quadraticCurveTo($-(u+T*2)/A/2,I+P,$,I)}i.lineTo(c+T,I),i.lineTo(c+T,y),i.lineTo(a-T,y),i.closePath(),i.fill(),i.fillStyle=`rgba(${r},0.12)`,i.fillRect(a-1.5,I,1.5,d-I),i.fillRect(c,I,1.5,d-I),i.fillStyle="#0b0f18",i.fillRect(a-x,d-f*.05,u+x*2,f*.05+3);let R=i.createLinearGradient(0,d-f*.05,0,d+f*.12);R.addColorStop(0,`rgba(255,206,140,${(.5*s).toFixed(3)})`),R.addColorStop(1,"rgba(255,206,140,0)"),i.fillStyle=R,i.fillRect(a-x,d-f*.05,u+x*2,f*.2);let M=3+Math.floor(l()*2);for(let _=0;_<M;_++){let $=(_+1)/(M+1),X=a+u*($+(l()-.5)*.08),Y=z(Math.min(62,t+26)),J=(l()-.5)*u*.16;wi(i,X,Y,X+J,d,4,u*.09,r,.16*(.7+s*.5)),Do(i,X,Y,2.4,r)}}function Ad(i,e,t,o,s,n,r){let l=Math.min(e*.6,Math.max(3,o.voidRadiusM)),a=Math.min(55,Math.atan2(l,e)*180/Math.PI),c=q/2,h=1.2,d=Math.max(e*.45,e-l),u=e+l,f=Math.atan2(h-t,d)*180/Math.PI,y=Math.atan2(h-t,u)*180/Math.PI,m=Math.atan2(-t,d)*180/Math.PI,p=z(f),g=z(y),b=z(m),S=nt(a)-c,v=Math.max(6,(p-g)/2),L=(p+g)/2,w=i.createRadialGradient(c,b,4,c,b,S*2.6);w.addColorStop(0,`rgba(255,206,150,${(.2*s).toFixed(3)})`),w.addColorStop(.5,"rgba(150,140,190,0.08)"),w.addColorStop(1,"rgba(40,44,60,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=w,i.fillRect(c-S*2.6,g-v,S*5.2,b-g+v+40),i.restore(),i.fillStyle="#0c1019",i.beginPath(),i.moveTo(c-S,L),i.ellipse(c,L,S,v,0,Math.PI,0,!1),i.lineTo(c+S,b),i.ellipse(c,b,S,v,0,0,Math.PI,!1),i.closePath(),i.fill();let k=i.createLinearGradient(0,L,0,b);k.addColorStop(0,`rgba(${n},0.14)`),k.addColorStop(1,"rgba(0,0,0,0)"),i.fillStyle=k,i.fillRect(c-S,L,S*2,b-L);let C=[[{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}]],x=C[Math.floor(r()*C.length)],T=r()<.5?-1:1,P=O=>c+O.u*T*S*.84,I=O=>L+O.v*v*.8,A=x.find(O=>O.lead)??x[0],R=P(A),M=i.createLinearGradient(0,L-v,0,L+v);M.addColorStop(0,"#3d4a72"),M.addColorStop(1,"#232b47"),i.fillStyle=M,i.beginPath(),i.ellipse(c,L,S,v,0,0,E),i.fill();let _=i.createRadialGradient(R,L,2,R,L,S);_.addColorStop(0,`rgba(255,214,160,${(.5*s).toFixed(3)})`),_.addColorStop(1,"rgba(255,214,160,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=_,i.beginPath(),i.ellipse(c,L,S,v,0,0,E),i.fill(),i.restore(),i.strokeStyle=`rgba(${n},0.7)`,i.lineWidth=2,i.beginPath(),i.ellipse(c,L,S,v,0,0,E),i.stroke();let $=Math.max(24,(b-g)*1.3),X=x.length>=3?3:2;for(let O=0;O<X;O++){let fe=(-.62+O*.52+(r()-.5)*.12)*-T,Me=c+fe*S*.7,rt=L-v*(.45+r()*.18),ze=S*(.07+r()*.04),Ii=$*(.26+r()*.12);i.fillStyle="#0a0e18",i.fillRect(Me-ze/2,rt-Ii,ze,Ii),i.fillStyle=`rgba(${n},0.3)`,i.fillRect(Me-ze/2,rt-Ii,ze,1.5)}if(x.length>=3){let O=c-A.u*T*S*.4;i.fillStyle="#0b0f1a",i.beginPath(),i.ellipse(O,L-v*.34,S*.08,v*.1,0,0,E),i.fill(),i.strokeStyle=`rgba(${n},0.35)`,i.lineWidth=1,i.stroke()}for(let O of[...x].sort((fe,Me)=>fe.v-Me.v)){let fe=.82+(O.v+1)*.14;Oo(i,P(O),I(O),$*fe*(O.lead?1.06:.92),{tone:[18,21,34],alpha:.95,pose:O.pose,rim:ie(40,.72,.8),rimStrength:O.lead?1.4:.9})}let Y=z(Math.min(60,y+34)),J=v*1.1+6;i.strokeStyle="rgba(60,68,92,0.85)",i.lineWidth=3,i.beginPath(),i.ellipse(c,Y,S*1.15,J,0,0,E),i.stroke();let D=4+Math.floor(r()*3);for(let O=0;O<D;O++){let fe=O/D*E,Me=c+Math.cos(fe)*S*1.15,rt=Y+Math.sin(fe)*J;if(Math.sin(fe)>-.2){let ze=c+(r()-.5)*S*.8;wi(i,Me,rt,ze,L,3,S*.32,n,.2*(.7+s*.4))}Do(i,Me,rt,3,n)}let U=z(Math.min(52,y+24)),G=Math.max(60,S*.4),Z=Math.max(24,G*.34);i.strokeStyle="rgba(70,78,102,0.6)",i.lineWidth=1.5,i.beginPath(),i.moveTo(c-G*.3,U-Z/2),i.lineTo(c-G*.16,U-Z*2.2),i.moveTo(c+G*.3,U-Z/2),i.lineTo(c+G*.16,U-Z*2.2),i.stroke(),i.fillStyle="#0d1220",i.fillRect(c-G/2,U-Z/2,G,Z);let ki=i.createLinearGradient(0,U-Z*.3,0,U+Z*.42);ki.addColorStop(0,`rgba(${n},0.5)`),ki.addColorStop(1,"rgba(255,214,160,0.32)"),i.fillStyle=ki,i.fillRect(c-G*.42,U-Z*.3,G*.84,Z*.72),i.fillStyle="rgba(255,214,160,0.55)",i.fillRect(c-G/2,U+Z/2-2,G,2);let Ci=i.createRadialGradient(c,U,4,c,U,G*1.1);Ci.addColorStop(0,`rgba(${n},0.2)`),Ci.addColorStop(1,"rgba(0,0,0,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=Ci,i.fillRect(c-G*1.1,U-G*.8,G*2.2,G*1.6);let xi=i.createRadialGradient(c,(Y+L)/2,6,c,(Y+L)/2,S*1.5);xi.addColorStop(0,`rgba(${n},${(.1*(.6+s*.5)).toFixed(3)})`),xi.addColorStop(1,"rgba(0,0,0,0)"),i.fillStyle=xi,i.fillRect(c-S*1.5,Y-40,S*3,L-Y+80),i.restore();let Al=c+Math.sign(R-c||1)*S*.5;wi(i,Al,Y-J*.4,R,I(A),2.5,S*.16,"255,224,178",.42*(.7+s*.4));let Ti=i.createRadialGradient(R,I(A),1,R,I(A),S*.2);Ti.addColorStop(0,`rgba(255,228,185,${(.4*s).toFixed(3)})`),Ti.addColorStop(1,"rgba(255,228,185,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=Ti,i.beginPath(),i.ellipse(R,I(A),S*.2,v*.24,0,0,E),i.fill(),i.restore()}function Ed(i,e,t,o,s,n,r,l){let a=q/2,c=Math.max(10,o.voidRadiusM),h=Math.max(2,e-c),d=e+c,u=Math.min(78,Math.atan2(c*1.15,e)*180/Math.PI),f=Math.atan2(-t,h)*180/Math.PI,y=Math.atan2(-t,d)*180/Math.PI,m=z(f),p=z(y),g=nt(u)-a,b=(m+p)/2,S=Math.max(10,(m-p)/2),v=i.createRadialGradient(a,b,4,a,b,g);v.addColorStop(0,"#e8f0fb"),v.addColorStop(.7,"#b9c9e2"),v.addColorStop(1,"#8fa3c4"),i.save(),i.beginPath(),i.ellipse(a,b,g,S,0,0,E),i.clip(),i.fillStyle=v,i.fillRect(a-g,b-S,g*2,S*2),i.strokeStyle="rgba(90,120,170,0.5)",i.lineWidth=3,i.beginPath(),i.moveTo(a,b-S),i.lineTo(a,b+S),i.moveTo(a-g*.5,b-S),i.lineTo(a-g*.5,b+S),i.moveTo(a+g*.5,b-S),i.lineTo(a+g*.5,b+S),i.stroke(),i.strokeStyle="rgba(180,90,110,0.45)",i.beginPath(),i.ellipse(a,b,S*.9,S*.5,0,0,E),i.stroke(),i.restore(),i.strokeStyle="rgba(210,225,245,0.6)",i.lineWidth=2.5,i.beginPath(),i.ellipse(a,b,g,S,0,0,E),i.stroke(),i.fillStyle="rgba(20,26,40,0.8)";for(let P=0;P<5;P++){let I=a+(l()-.5)*g*1.4,A=b+(l()-.5)*S*1.1,R=Math.max(2,S*.06);i.beginPath(),i.ellipse(I,A,R*.6,R,0,0,E),i.fill()}let L=i.createRadialGradient(a,b,4,a,b,g*1.4);L.addColorStop(0,"rgba(200,220,255,0.12)"),L.addColorStop(1,"rgba(200,220,255,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=L,i.fillRect(a-g*1.4,p-S,g*2.8,m-p+S*2),i.restore();let w=z(Math.min(66,y+60)),k=Math.max(80,g*.7),C=k*.5,x=i.createRadialGradient(a,w,4,a,w,k*1.6);x.addColorStop(0,`rgba(${r},0.3)`),x.addColorStop(1,`rgba(${r},0)`),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=x,i.fillRect(a-k*1.6,w-k*1.2,k*3.2,k*2.4),i.restore(),i.fillStyle="#080b12",i.beginPath(),i.moveTo(a-k/2,w-C/2),i.lineTo(a+k/2,w-C/2),i.lineTo(a+k*.6,w),i.lineTo(a+k/2,w+C/2),i.lineTo(a-k/2,w+C/2),i.lineTo(a-k*.6,w),i.closePath(),i.fill();let T=n;for(let P=0;P<3;P++){let I=ie(T+P*30,.5,.5);i.fillStyle=`rgba(${I[0]},${I[1]},${I[2]},0.75)`;let A=k*.26;i.fillRect(a-k*.42+P*(A+k*.06),w-C*.32,A,C*.64)}i.fillStyle=`rgba(${r},0.9)`;for(let P=0;P<8;P++){let I=a-k*.6+k*1.2*P/7;i.beginPath(),i.arc(I,w+C*.62,2.4,0,E),i.fill()}}function _d(i,e,t,o,s,n,r,l,a,c){let h=e.sectionId,d=!1,u=[];for(let m of t){if(m.id===e.id)continue;let p=m.x-e.x,g=m.y-e.y,b=Math.hypot(p,g)*Tt;if(h&&m.sectionId===h&&b<3&&p*r+g*l>0&&(d=!0),b<.3||b>32)continue;let v=((Math.atan2(p,-g)-s)*180/Math.PI+540)%360-180,L=a?(m.eyeHeightM??ee)-n:0,w=Math.atan2(L-.28,b)*180/Math.PI;if(w>10&&b>5)continue;let k=0;for(let T=0;T<m.id.length;T++)k=k*31+m.id.charCodeAt(T)&65535;let C=.9+(k&15)/40,x=Math.min(78,Math.atan2(.16,b)*180/Math.PI*wd*C);x<1.2||u.push({hx:nt(v),hy:z(w),r:x,d:b,hash:k})}u.sort((m,p)=>p.d-m.d);let f=[];{let m=[...u].sort((b,S)=>b.hy-S.hy),p=[],g=()=>{if(!p.length)return;let b=p.reduce((L,w)=>L+w.d,0)/p.length,S=p.reduce((L,w)=>L+w.hy,0)/p.length,v=p.reduce((L,w)=>L+w.r,0)/p.length;f.push({figs:p.sort((L,w)=>w.d-L.d),d:b,hy:S,r:v}),p=[]};for(let b of m){let S=p[p.length-1];S&&Math.abs(b.hy-S.hy)>Math.max(5,(S.r+b.r)/2*1.7)&&g(),p.push(b)}g()}f.sort((m,p)=>p.d-m.d);let y=[[22,26,40],[28,27,42],[24,31,46],[31,30,47],[20,24,36]];for(let m of f){if(m.figs.length>=3&&m.r>=1.6&&m.r<26){let p=[],g=[...m.figs].sort((v,L)=>v.hx-L.hx),b=[];for(let v of g){let L=b[b.length-1];L&&v.hx-L.hx>Math.max(14,v.r*7)&&(b.length>=3&&p.push(b),b=[]),b.push(v)}b.length>=3&&p.push(b);let S=Math.min(.42,.5*(1-m.d/42));if(S>.05){i.fillStyle=`rgba(15, 19, 31, ${S.toFixed(3)})`;for(let v of p){let L=v[0].hx-m.r*1.6,w=v[v.length-1].hx+m.r*1.6;i.beginPath(),i.roundRect(L,m.hy+m.r*.8,w-L,m.r*2.4,m.r*.8),i.fill()}}}for(let p of m.figs){let g=p.d<12?.95:p.d<17?Math.max(.66,.95-(p.d-12)/18):Math.max(.3,.68-(p.d-17)/34),b=Math.round((1-Math.min(1,p.d/16))*10),S=[14+(p.hash>>4&6)+b,17+(p.hash>>4&6)+b,25+(p.hash>>4&6)+b],v=y[p.hash%y.length],L=[v[0]+b,v[1]+b,v[2]+b];if(p.r>=13){let w=p.d<9?.16*(1-p.d/9)+(c.mode==="proscenium"?.06:0):0;Pd(i,p.hx,p.hy,p.r,{tone:S,clothing:L,alpha:g,tilt:((p.hash>>2&7)-3.5)*.018,shoulderK:1.72+(p.hash>>5&7)/22,hair:p.hash%Td,rim:w,turn:((p.hash>>8&7)-3.5)*.034,lean:((p.hash>>10&3)-1.5)*.09})}else p.r>=5.5?Md(i,p.hx,p.hy,p.r,L,S,g):(i.fillStyle=`rgba(${S[0]},${S[1]},${S[2]},${g.toFixed(3)})`,i.beginPath(),i.arc(p.hx,p.hy,p.r,0,E),i.fill(),i.beginPath(),i.ellipse(p.hx,p.hy+p.r*1.4,p.r*1.85,p.r*.95,0,Math.PI,0,!0),i.fill())}}if(d){let m=z(-34);i.fillStyle="rgba(6, 8, 14, 0.92)",i.fillRect(0,m,q,pe-m),i.fillStyle="rgba(24, 30, 46, 0.9)";let p=16;for(let g=0;g<p;g++){let b=(g+.5)/p*q;i.beginPath(),i.ellipse(b,m+6,q/p*.42,22,0,Math.PI,0,!0),i.fill()}}}var ne=480,st=270,Fo=50,Ke=30,Il=i=>(i+Fo)/(2*Fo)*ne,xt=i=>(Ke-i)/(2*Ke)*st;function nS(i,e,t){let o=document.createElement("canvas");o.width=ne,o.height=st;let s=o.getContext("2d"),n=e.x-i.x,r=e.y-i.y,l=Math.max(2,Math.hypot(n,r)*Tt),a=Ml(Pl(`${i.id}|${Math.round(e.x)},${Math.round(e.y)}`)),c=210+a()*150,h=ie(220+(a()-.5)*60,.55,.82),d=`${h[0]},${h[1]},${h[2]}`,u=s.createLinearGradient(0,0,0,st);u.addColorStop(0,"#080b12"),u.addColorStop(.44,"#151c32"),u.addColorStop(.5,"#1d2644"),u.addColorStop(.58,"#161c2e"),u.addColorStop(1,"#131829"),s.fillStyle=u,s.fillRect(0,0,ne,st);let f=i.eyeHeightM??ee,y=Ao(f,l),m=Math.min(Fo-2,Math.atan2(4,l)*180/Math.PI),p=Math.min(Ke-2,y.topPitch),g=Math.max(-Ke+2,y.basePitch),b=Il(-m),S=Il(m),v=xt(p),L=xt(g),w=S-b,k=L-v,C=Math.max(.35,Math.min(1,1-(l-6)/60)),x=xt(Math.min(Ke-1,p+8)),T=s.createRadialGradient(ne/2,(v+L)/2,4,ne/2,(v+L)/2,w*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)"),s.fillStyle=T,s.fillRect(b-w*.6,v-k*1.2,w*2.2,k*3.4);let P=ie(c,.62,.55),I=ie(c+40,.7,.5),A=ie(c+70,.78,.52);s.save(),s.beginPath(),s.rect(b,v,w,k),s.clip();let R=s.createLinearGradient(0,v,0,L);R.addColorStop(0,`rgb(${P[0]},${P[1]},${P[2]})`),R.addColorStop(.5,`rgb(${I[0]},${I[1]},${I[2]})`),R.addColorStop(1,`rgb(${A[0]},${A[1]},${A[2]})`),s.globalAlpha=.8,s.fillStyle=R,s.fillRect(b,v,w,k),s.globalAlpha=1;let M=s.createRadialGradient(ne/2,(v+L)/2,w*.12,ne/2,(v+L)/2,w*.6);M.addColorStop(0,"rgba(6,8,14,0)"),M.addColorStop(.7,"rgba(6,8,14,0.15)"),M.addColorStop(1,"rgba(5,6,11,0.9)"),s.fillStyle=M,s.fillRect(b,v,w,k),s.restore();let _=3,$=L-k*.08;for(let D=0;D<_;D++){let U=(D+1)/(_+1);Oo(s,b+w*(.24+U*.52),$,k*.46*(.9+a()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(a()*4),rim:ie(c+20,.5,.7),rimStrength:.7})}s.fillStyle="#05070d",s.fillRect(b-w*.5,x,w*.5,L-x),s.fillRect(S,x,w*.5,L-x);let X=w*.05+2,Y=X*1.35;s.fillStyle="#03050a",s.beginPath(),s.moveTo(b,L),s.lineTo(b-X,L),s.lineTo(b-Y,x),s.lineTo(b+w*.012,x),s.closePath(),s.fill(),s.beginPath(),s.moveTo(S,L),s.lineTo(S+X,L),s.lineTo(S+Y,x),s.lineTo(S-w*.012,x),s.closePath(),s.fill(),s.fillRect(b-Y,x,w+Y*2,(L-x)*.13),s.fillStyle=`rgba(${d},0.12)`,s.fillRect(b-1.2,x,1.2,L-x),s.fillRect(S,x,1.2,L-x),s.fillStyle="#0b0f18",s.fillRect(b-X,L-k*.05,w+X*2,k*.05+2);let J=s.createLinearGradient(0,L-k*.05,0,L+k*.14);J.addColorStop(0,`rgba(255,206,140,${(.5*C).toFixed(3)})`),J.addColorStop(1,"rgba(255,206,140,0)"),s.fillStyle=J,s.fillRect(b-X,L-k*.05,w+X*2,k*.22);for(let D=0;D<3;D++){let U=(D+1)/4,G=b+w*U,Z=xt(Math.min(Ke-1,p+20));wi(s,G,Z,G+(a()-.5)*w*.14,L,3,w*.09,d,.17*C),Do(s,G,Z,1.8,d)}s.fillStyle=`rgba(${d},0.75)`;for(let D=0;D<8;D++)s.beginPath(),s.arc((D+.5)/8*ne,xt(Ke-4-D%2*3),2.2,0,E),s.fill();s.fillStyle="rgba(10,13,20,0.9)",s.fillRect(0,st-26,ne,26),s.fillStyle="rgba(30,37,54,0.9)";for(let D=0;D<9;D++){let U=D*(ne/9)+ne/18;s.beginPath(),s.ellipse(U,st-22,ne/9*.4,15,0,Math.PI,0,!0),s.fill()}return{url:o.toDataURL("image/jpeg",.8),distanceM:Math.round(l)}}var Rl=new Set(["en"]),Li=new Map;async function Bd(i){if(typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__)return(await import(xs(`i18n/${i}.mjs`))).default??null;let{LOADERS:e}=await import("./localeLoaders-ETY2H7H3.js"),t=e[i];return t?await t():null}async function cS(i,e){let t=Pn(i,e);if(t==="en"||Rl.has(t))return je(t),t;if(!In.includes(t))return je("en"),"en";try{let o=Li.get(t);o||(o=Bd(t),Li.set(t,o));let s=await o;return Li.delete(t),s?(je(t,s),Rl.add(t),t):(je("en"),"en")}catch{return Li.delete(t),je("en"),"en"}}export{Gd as ACCESSIBILITY_RING_COLOR,Go as ACCESSIBILITY_TYPES,wu as AUTOMATIC_ROUND_TABLE_RADIUS_MAX,vu as AUTOMATIC_ROUND_TABLE_RADIUS_MIN,Od as CHART_STORAGE_KEY,zu as CURRENCY_CHOICES,Ku as DEFAULT_CURRENCY,pb as EMPTY_AVAILABILITY_REFRESH,Yd as EVENT_CONFIGURATION_EXPORT_SCHEMA,Xd as EVENT_CONFIGURATION_SCHEMA,yu as FLOOR_STACK_GAP_RATIO,Su as FLOOR_STACK_MIN_SURFACE_PX,ub as HOLD_CLOCK_SKEW_MS,Bi as LABEL_FADE_MS,Vd as LABEL_STYLE_MAX_SIZE,Wd as LABEL_STYLE_MIN_SIZE,Bu as LEGIBILITY_HYSTERESIS_PX,Qu as LOCALE_NAMES,Cu as MAX_EVENT_INVENTORY,ku as MAX_GA_CAPACITY,os as MIN_POINTER_TARGET_PX,kl as PickerController,Pe as PickerSelectionError,Eu as RENDERED_QUALITY_REPORT_VERSION,Nd as SEAT_COMMERCIAL_MARKS,Fd as STAGE_LABEL_STYLE_MAX_SIZE,sc as SUPPORTED_LOCALES,Kd as SURROUNDINGS_SHAPE_ROLES,Po as SeatmapRenderer,tu as TABLE_SEAT_OFFSET,eu as TIER_HEIGHT_M,In as TRANSLATED_LOCALES,Zo as UNGROUPED_ID,hl as accessNeedsFor,Dd as accessibilityMeta,It as accessibilityRingColor,Xo as allObjects,jo as applyHidden,pl as attachVisibilityCatchUp,Lu as automaticRoundTableRadius,jd as canTransitionEventConfiguration,qd as canonicalEventConfigurationJson,Uo as chartBounds,Ra as compactRowLabel,Et as computeSections,sl as createRenderer,Ts as crossesThreshold,ic as currencyExponent,Yu as currencySymbol,hu as expandBooth,Ye as expandChart,nu as expandRow,su as expandRowSlots,cu as expandTable,au as expandTableSlots,fu as floorObjects,gu as floorStackPlacements,Rt as floorsOf,op as formatDate,Xu as formatMinor,mt as formatMoney,oc as fromMinorUnits,at as gaAreasOf,Iu as gaInventorySegments,xu as gaUnitLabel,At as gaUnitLabels,sS as generateSeatPanorama,nS as generateSeatThumb,Ju as getLocale,Pu as growJoinedGAInventory,Au as hiddenObjectIds,fd as holdHasLapsed,mb as holdRecoveryShape,Oi as hysteresisScale,qo as initialFloorMode,Zd as inspectEventConfigurationCompatibility,_u as inspectRenderedQualityEvidence,Mu as isGaUnitLabel,tp as isLocaleLoaded,Ru as isSectionHidden,zd as layerOf,$o as layoutFloorStack,cS as loadLocale,ep as localeDirection,bu as mainFloorId,Jd as migrateLegacyEventConfigurations,uu as objectCenter,pu as owningSectionForObject,$d as parseEventConfigurationExport,Ud as parseEventConfigurationVersion,du as pointInPolygon,oe as pointInPolygonWithHoles,Mt as polygonLabelPoint,dl as reconcileAvailability,fb as refreshChangedSomething,Fi as renderedPx,Qd as resolveEventConfigurationRollback,Pn as resolveLocale,ou as rowInventoryCount,iu as rowSeatPositions,Hd as seatCommercialMeta,Pt as sectionGeometry,je as setLocale,Tn as setMoneyLocale,ip as setStringOverrides,ul as shouldWaitForHoldExpiry,Yo as stackFloors,H as t,Rn as tCount,lu as tableInventoryCount,ru as tableSeatCountsBySide,mu as translateObject,Tu as validGAInventorySegments,Fu as zoomTowardPoint};