@seatlayer/core 0.77.0 → 0.77.2

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 Di,b as Gi,d as As,e as Yt,g as Es,h as _s,k as Fs}from"./chunk-O5UH442K.js";import{a as Ku,b as Xu,c as ss,d as Yu,e as Uu,f as ns,h as vs,k as Kt,m as ws,n as be,o as ae,p as ks,q as Ls,r as Xt,s as Cs}from"./chunk-NQZAZFAC.js";import{a as rp,b as ps,c as ap}from"./chunk-BXU5D2Q5.js";import{b as Bs}from"./chunk-FOYQOIWG.js";import{a as Oi}from"./chunk-QJXSZT3H.js";import{a as $u,b as qu,c as Zu}from"./chunk-BT2KJXQC.js";import{a as ye,b as hs,c as _e,d as Gt,e as Nt,f as Fe,g as H,m as ge,n as xe,q as Ht,r as Wt,t as us,u as Ue,v as re,w as Ie,x as Bi}from"./chunk-XD2P4ZS4.js";import{A as Ms,B as Rs,b as bs,c as Ss,e as ht,i as xs,j as Is,p as Ps}from"./chunk-QLDV5ZGA.js";import{a as ju,b as Qu,c as Ju,d as ep,e as tp,f as Bt,g as ip,h as ct,i as op,j as rs,k as Ot,l as sp,m as np,n as as}from"./chunk-Q3U3F4YJ.js";import{a as cu,b as du,c as $o,d as hu,e as uu,f as At,g as pu,h as fu,i as mu,j as yu,k as gu,l as bu,n as fs,q as dt,u as Ts}from"./chunk-WXGW2SYC.js";import{b as Vt,f as ms,h as zt,i as ys,k as gs}from"./chunk-UL5OIGIF.js";import{Aa as es,Ca as Mu,Da as Ru,E as qo,Ea as Au,Fa as Eu,G as Zo,Ga as _u,Ha as Fu,I as z,Ia as Bu,Ja as Ou,Ka as Du,La as Gu,Ma as Nu,Na as te,Oa as _t,Pa as Hu,Qa as Wu,Ra as Ft,Sa as Vu,Ta as ts,Ua as zu,Va as is,Wa as Ye,Xa as os,d as Su,e as vu,f as wu,g as ku,ga as jo,h as Lu,ha as Xe,i as Cu,ia as Pu,j as Tu,k as xu,l as Iu,qa as ee,ra as Qo,sa as Et,ya as Jo}from"./chunk-24O23MNB.js";import{C as F,c as _i,h as Fi,m as ls,o as cs,t as B,u as Te,v as me,w as j,x as Dt,z as ds}from"./chunk-JBOTRSMY.js";import"./chunk-CRCGO52K.js";var lp=1,Ni=90;function Hi(t,e){return!Number.isFinite(t)||!Number.isFinite(e)?0:Math.max(0,t*e)}function Os(t,e,i,o=1){if(!Number.isFinite(t))return i;let s=Math.max(0,o);return i?t>=e-s:t>=e+s}function Wi(t,e,i,o=1){if(!Number.isFinite(t)||!(i>0))return t;let s=Math.max(0,o)/i;return e?t*(1+s):t*(1-s)}function cp(t){let{point:e,camera:i,scale:o,nextScale:s}=t;if(!Number.isFinite(o)||o<=0||!Number.isFinite(s))return{...i};let n=(e.x-i.x)/o,r=(e.y-i.y)/o;return{x:e.x-n*s,y:e.y-r*s}}import{Konva as wi}from"konva/lib/Core";import{Stage as _h}from"konva/lib/Stage";import{Layer as Fo}from"konva/lib/Layer";import{Group as xt}from"konva/lib/Group";import{Circle as Sl}from"konva/lib/shapes/Circle";import{Group as ji}from"konva/lib/Group";import{Circle as We}from"konva/lib/shapes/Circle";import{Line as Qi}from"konva/lib/shapes/Line";import{Rect as Ji}from"konva/lib/shapes/Rect";import{Text as Xn}from"konva/lib/shapes/Text";var le=9,Be=.9,ce=.55*Be,se=H/ye,ut=4,Oe=14,Ds=10,Gs=14,Se=.45*Be,ve=.9*Be,we=(Se+ve)/2,Ns=Math.max(Be*1.1,ve),Pe=8,Hs=700,Q=2,Ws=H,Ut=.85,Vs=H,pt=64,$e=.55*Se,$t=700,zs=2500,qt=-11.5,ft=.58,Ks=320,Xs=420,Ys=420,Us=1,De=1,$s=2,qe=16,he=12,Vi=[.85,.72,.62],Zt=13,jt=12,qs=0,Zs="700",js="600",Qs=8,Js=5,en=10,tn=6,on=8,sn=.6,nn=.6,rn=.7,an=[0,18,-18,36,-36,54,-54],Ge="600",ln="500",ue=640,Qt="700",Ne=.02,cn=14,dn=.34,Jt=.92,mt=7,ei=3,hn=6;function zi(t){return Math.min(1,Math.max(he/qe,t/900))}function Ze(t,e){return Math.max(he,t*zi(e))}var un=.1,yt=1.02;var pn=2;function fn(t,e){return!(t>0)||!(e>0)||t>=e?null:e}var tc="#e5e7eb",ic="#c7cbd1",oc="#595f69",sc="#d1d5db",nc="#b8bdc4",rc="#273142",ac="#526078",lc="#f1f5f9",cc="#374151",dc="#64748b",hc="#111827",ti="#6b7280",ii="#374151";var mn="#4b5563",yn=.4,ke=.16,gn="rgba(244,246,248,0.06)",oi=["#E69F00","#56B4E9","#009E73","#F0E442","#0072B2","#D55E00","#CC79A7"];function bn(t,e,i){let o=new Map;for(let r of t){let l=e(r);!l||i(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 ie(t){return B(t)?{sectionFill:tc,sectionStroke:ic,sectionInk:oc,focalFill:sc,focalStroke:nc}:{sectionFill:rc,sectionStroke:ac,sectionInk:lc,focalFill:cc,focalStroke:dc}}function Ki(t,e){let i=t.sectionFill,o=ds(me(i,.2),.85);switch(e){case"closed":return me(i,.12);case"sold-out":return o;case"nearly-gone":return j(i,o,.4);default:return i}}var Sn=.28,vn=.32,uc=.55,pc=.7;function wn(t,e,i){let o=ie(t),s=Ki(o,e);if(!i||e==="sold-out"||e==="closed")return{fill:s,stroke:o.sectionStroke};let n=B(t);return{fill:j(s,i,n?vn:Sn),stroke:F(i,n?pc:uc)}}var fc=.03;function kn(t,e){let i=ie(t);return!["normal","nearly-gone","sold-out","closed"].map(s=>Ki(i,s).toLowerCase()).includes(e.trim().toLowerCase())&&Xi(t,e)}function Xi(t,e){let i=_i(e);if(!i)return!1;let o=ie(t),s=Math.max(Sn,vn)+fc;return["normal","nearly-gone","sold-out","closed"].some(n=>{let r=_i(Ki(o,n));return r?Math.max(Math.abs(r[0]-i[0]),Math.abs(r[1]-i[1]),Math.abs(r[2]-i[2]))/255<=s:!1})}var mc="#f8fafc",yc="#f4f6fb",gc="#111827",bc=.72;function Ln(t){let e=B(t),i=e?mc:hc,o=e?gc:yc,s=j(o,i,1-bc);return{plate:i,ink:o,subInk:ls(s,i)>=cs?s:o}}function si(t){return t?.35:.3}function xn(t){if(t<=0||t>=1)return 1;let e=1.25-1;if(t<.45){let o=t/.45;return 1+e*(1-(1-o)**2)}let i=(t-.45)/(1-.45);return 1+e*Math.cos(i*Math.PI*1.5)*(1-i)**2}function Yi(t){let e=t<=0?0:t>=1?1:t,i=1-(1-e)**3;return{radiusScale:1+(2.5-1)*i,opacity:.55*(1-e)}}var In=700,Sc=2400,Ui=12,Pn=30,Cn=1,vc=1.16,Tn=.5,wc=1;function $i(t){return t*.61803398875%1}function Mn(t,e){let o=((t/Sc+e)%1+1)%1,s=(1-Math.cos(o*2*Math.PI))/2;return{scale:Cn+(vc-Cn)*s,opacity:Tn+(wc-Tn)*s}}var An;function En(t){An=t}function kc(t){return typeof t=="number"?t:t instanceof Date?t.getTime():Date.parse(t)}var Rn=new Map;function Lc(t,e){let i=t??An,o=`${i??""}|${JSON.stringify(e)}`,s=Rn.get(o);return s||(s=new Intl.DateTimeFormat(i,e),Rn.set(o,s)),s}var Cc={dateStyle:"medium",timeStyle:"short"};function _n(t,e={}){let{locale:i,...o}=e,s=kc(t);if(!Number.isFinite(s))return"";let n=Object.keys(o).length?o:Cc;return Lc(i,n).format(s)}var gp="USD",bp=["USD","EUR","GBP","CAD","AUD","INR","AED","SGD","JPY","CHF","SEK","NZD","ZAR","MXN","BRL"],Bn;function On(t){Bn=t}var Fn=new Map;function ni(t,e,i,o){let s=o??Bn,n=`${s??""}|${t}|${e??"auto"}|${i??"auto"}`,r=Fn.get(n);return r||(r=new Intl.NumberFormat(s,{style:"currency",currency:t,minimumFractionDigits:e,maximumFractionDigits:i}),Fn.set(n,r)),r}function gt(t,e="USD",i,o){if(typeof i=="object"){let n=i;try{return ni(e,n.minimumFractionDigits,n.maximumFractionDigits,n.locale).format(t)}catch(r){if(n.fallback)return n.fallback(t,e);throw r}}let s=i??(Number.isInteger(t)?0:void 0);return ni(e,s,s,o).format(t)}function Tc(t="USD"){try{return ni(t,void 0,void 0).resolvedOptions().maximumFractionDigits??2}catch{return 2}}function xc(t,e="USD"){return t/10**Tc(e)}function Sp(t,e="USD",i){return gt(xc(t,e),e,void 0,i)}function vp(t="USD"){return ni(t,0,0).formatToParts(0).find(i=>i.type==="currency")?.value??t}var bt={"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.accessSpreadHint":"{count} accessible spaces in {sections} sections \xB7 tap a highlighted section","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 Ic=["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"],xp={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"},Dn=["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"],Pc=new Set(["ar","fa","he"]),qi={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"},Zi=new Map(Ic.map(t=>[t.toLowerCase(),t]));function Mc(t){let e=t.trim().toLowerCase().replace(/_/g,"-");if(!e)return;let i=Zi.get(e)??qi[e];if(i)return i;let o=e.split("-");if(o.length>=2){let s=`${o[0]}-${o[1]}`,n=Zi.get(s)??qi[s];if(n)return n}return Zi.get(o[0])??qi[o[0]]}var He={en:bt},ri={},de="en";function Gn(t,e){let i=typeof navigator<"u"?navigator.languages?.length?navigator.languages:[navigator.language]:[];for(let o of[t,e,...i]){if(!o)continue;let s=Mc(o);if(s)return s}return"en"}function Ip(){return de}function Pp(t=de){return Pc.has(t)?"rtl":"ltr"}function Mp(t){return!!He[t]}function je(t,e){e&&(He[t]={...He[t],...e}),de=He[t]?t:"en",On(de),En(de),typeof document<"u"&&(document.documentElement.lang=de)}function Rp(t){ri=t}var Nn=/\{(\w+)\}/g;function G(t,e){let i=ri[t]??He[de]?.[t]??bt[t]??t;return e?i.replace(Nn,(o,s)=>String(e[s]??`{${s}}`)):i}function Hn(t,e,i){let o=new Intl.PluralRules(de).select(e);return(ri[`${t}.${o}`]??He[de]?.[`${t}.${o}`]??bt[`${t}.${o}`]??ri[`${t}.other`]??He[de]?.[`${t}.other`]??bt[`${t}.other`]??t).replace(Nn,(r,l)=>String({count:e,...i}[l]??`{${l}}`))}function Ap(t,e){return _n(t,{...e??{dateStyle:"medium",timeStyle:"short"},locale:de})}function Vn(t,e,i,o=!1){let s=t.displayLabel?.trim()||t.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:i()??"",sellable:!0}}var Qe=32,Wn=70;function zn(t,e){let i=Qe+6,o=t.y-Wn;return{x:Math.min(Math.max(t.x,i),Math.max(i,e.width-i)),y:o>=i?o:Math.min(t.y+Wn,e.height-i)}}var _c=220,Fc=.08,ai=class{constructor(e){this.pulses=new Map;this.pulseGroup=null;this.loupe=null;this.echoTimers=new Map;this.host=e}syncMarker(e,i,o){let s=o.get(e);if(o.delete(e),!i){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,d=n.boothDims(r.rowId),h=n.seatRadius(),u=n.seatPoint(r),y=new ji({name:"selection-ring",x:u.x,y:u.y,rotation:d?.rotation??0,listening:!1,perfectDrawEnabled:!1,opacity:n.selectionFocusDims(e)?.2:1});if(n.viewMode()==="perspective"){let p=n.perspectiveSeatScale(e);y.scale({x:p,y:p})}y.setAttrs({seatId:e,ringColor:a});let f={name:"selection-halo",stroke:F(n.categoryColor(r.categoryKey),si(B(n.canvasBackground()))),listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(d){let p=h*1.2;y.add(new Ji({...f,width:d.width+p*2,height:d.height+p*2,offsetX:(d.width+p*2)/2,offsetY:(d.height+p*2)/2,cornerRadius:8,strokeWidth:Math.max(2,h*.5)}))}else y.add(new We({...f,radius:h*1.6,strokeWidth:Math.max(2,h*.55)}));let m={stroke:a,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(d)if(y.add(new Ji({...m,width:d.width,height:d.height,offsetX:d.width/2,offsetY:d.height/2,cornerRadius:4,strokeWidth:c?4:3})),c)y.add(new Ji({...m,width:d.width+10,height:d.height+10,offsetX:(d.width+10)/2,offsetY:(d.height+10)/2,cornerRadius:7,strokeWidth:2,opacity:.55}));else{let p=Math.max(0,d.width/2-14),g=-Math.max(0,d.height/2-14);y.add(new We({x:p,y:g,radius:10,fill:a,listening:!1})),y.add(new Qi({x:p,y:g,points:[-4.5,0,-1,3.5,5.5,-4.5],stroke:B(a)?"#0b1220":"#ffffff",strokeWidth:2.4,lineCap:"round",lineJoin:"round",listening:!1}))}else y.add(new We({...m,radius:Math.max(1,h-1.25),strokeWidth:Math.min(2.5,Math.max(1.8,h*.22))})),c?y.add(new We({...m,radius:h+2,strokeWidth:2,opacity:.55})):y.add(new Qi({points:[-h*.52,0,-h*.12,h*.4,h*.6,-h*.46],stroke:"#ffffff",strokeWidth:Math.max(2.6,h*.34),lineCap:"round",lineJoin:"round",shadowColor:"#0b1220",shadowBlur:1.5,shadowOpacity:.55,listening:!1}));o.set(e,y),this.host.overlayLayer.add(y)}retire(e){let i=this.host;if(!e)return;if(i.reducedMotion()||i.isDestroyed()||typeof document<"u"&&document.hidden){e.destroy();return}let o=performance.now(),s=n=>{if(i.isDestroyed()||!e.getLayer()){e.destroy();return}let r=Math.min(1,(n-o)/160);e.opacity(1-r),i.overlayLayer.batchDraw(),r<1?requestAnimationFrame(s):(e.destroy(),i.overlayLayer.batchDraw())};requestAnimationFrame(s)}play(e){let i=this.host;if(i.reducedMotion()||i.isDestroyed()||typeof document<"u"&&document.hidden||!i.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),!(i.isDestroyed()||i.reducedMotion())&&(typeof document<"u"&&document.hidden||this.emitPulse(e,!1))},In))}emitPulse(e,i){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 We({name:"selection-pulse",x:r.x,y:r.y,radius:n,stroke:o.categoryColor(s.categoryKey),strokeWidth:Math.max(1.5,n*.24),opacity:Yi(0).opacity,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.pulses.set(e,l),this.pulseHome().add(l);let a=i&&!o.isCached()?o.seatShape(e):void 0,c=performance.now(),d=()=>{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()},h=u=>{if(o.isDestroyed()){d();return}l.getLayer()||this.pulseHome().add(l);let y=u-c,f=Yi(y/420);if(l.radius(n*f.radiusScale),l.opacity(f.opacity),a){let m=xn(y/320);a.scale({x:m,y:m})}o.overlayLayer.batchDraw(),a&&!o.isCached()&&o.seatLayer.batchDraw(),y<420?requestAnimationFrame(h):d()};queueMicrotask(()=>{o.isDestroyed()||typeof requestAnimationFrame!="function"||requestAnimationFrame(h)})}nudge(e){let i=this.host;if(i.reducedMotion()||i.isDestroyed()||i.isCached()||typeof document<"u"&&document.hidden)return;let o=i.seatShape(e);if(!o)return;let s=performance.now(),n=()=>{o.scale({x:1,y:1}),i.seatLayer.batchDraw()},r=l=>{if(i.isDestroyed()||i.isCached()||!o.getLayer()){n();return}let a=l-s,c=Math.min(1,a/_c),d=1+Fc*Math.sin(Math.PI*c);o.scale({x:d,y:d}),i.seatLayer.batchDraw(),c<1?requestAnimationFrame(r):n()};requestAnimationFrame(r)}pulseHome(){return(!this.pulseGroup||!this.pulseGroup.getLayer())&&(this.pulseGroup=new ji({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 i=this.host;if(i.isExportMode()||i.isDestroyed())return;let o=i.nearestSeat(e,Oe),s=o?i.seat(o):void 0;if(!s){this.hideLoupe();return}let n=Vn(s,i.seatStatus(s.id),()=>i.priceLabel(s),i.seatClosed(s.id)),r=zn(e,{width:i.stage.width(),height:i.stage.height()}),l=1/(i.stage.scaleX()||1),a=this.loupe??this.buildLoupe();a.seatId=s.id,a.group.position(i.screenToWorld(r)),a.group.scale({x:l,y:l}),a.group.opacity(n.sellable?1:.75),a.group.visible(!0),a.disc.fill(i.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),i.overlayLayer.batchDraw()}buildLoupe(){let e=this.host,i=e.canvasBackground(),o=re(i,ie(i).sectionInk),s=new ji({name:"touch-loupe",listening:!1,visible:!1});s.add(new Qi({points:[-7,Qe-4,0,Qe+12,7,Qe-4],closed:!0,fill:i,stroke:F(o,.25),strokeWidth:1,listening:!1})),s.add(new We({radius:Qe,fill:i,stroke:F(o,.28),strokeWidth:1.25,shadowColor:"#000000",shadowBlur:16,shadowOpacity:.45,listening:!1}));let n=new We({y:-15,radius:6,fill:"#6e7bff",listening:!1}),r=new Xn({y:-6,text:"",fontSize:15,fontStyle:"800",fontFamily:e.labelFont(),fill:o,listening:!1,perfectDrawEnabled:!1}),l=new Xn({y:12,text:"",fontSize:10.5,fontStyle:"700",fontFamily:e.labelFont(),fill:F(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 Bc}from"konva/lib/Animation";var Oc=1e3/Pn;function Yn(t){return t.findOne(".selection-halo")??null}var li=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,i=this.markers.size>0||this.beaconRings.length>0;if(i&&!e.isDestroyed()&&!e.reducedMotion()&&this.bindVisibility(),e.isDestroyed()||e.reducedMotion()||!this.pageVisible()||!i){this.stop(),this.rest(),(!i||e.isDestroyed()||e.reducedMotion())&&this.unbindVisibility();return}let o=[],s=0;for(let[r,l]of this.markers){let a=Yn(l);if(a){if(this.paintHalo(r,a),s>=Ui){a.scale({x:1,y:1}),a.opacity(1);continue}o.push({node:a,phase:$i(s)}),s+=1}}let n=0;for(let r of this.beaconRings){if(n>=Ui){r.scale({x:1,y:1}),r.opacity(1);continue}o.push({node:r,phase:$i(n)}),n+=1}if(this.targets=o,!o.length){this.stop();return}this.animation||(this.startedAt=performance.now(),this.lastFrameAt=0,this.animation=new Bc(()=>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,i){let o=this.host,s=si(B(o.canvasBackground())),n=o.seatCategoryKey(e),r=o.isOwnedHold(e)?j(o.selectionColor(),o.canvasBackground(),.55):n?o.categoryColor(n):o.selectionColor();i.stroke(F(r,s))}rest(){let e=!1;for(let[i,o]of this.markers){let s=Yn(o);s&&(this.paintHalo(i,s),s.scale({x:1,y:1}),s.opacity(1),e=!0)}for(let i of this.beaconRings)i.scale({x:1,y:1}),i.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 i=performance.now();if(i-this.lastFrameAt<Oc)return!1;this.lastFrameAt=i;let o=i-this.startedAt;for(let s of this.targets){let{scale:n,opacity:r}=Mn(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 Dc}from"konva/lib/Group";import{Circle as Un}from"konva/lib/shapes/Circle";import{Text as Gc}from"konva/lib/shapes/Text";var ci=28,Nc=12,Hc="800",Wc=44;function $n(t){if(t.rung==="seats")return[];let e=new Map,i=new Map(t.zones.map(s=>[s.id,s.name])),o=new Map(t.zones.map(s=>[s.id,s.anchor]));for(let s of t.sections){let n=t.ownedSeatIds(s);if(!n.length)continue;let r=t.rung==="zones"&&s.zone!=null&&i.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?i.get(s.zone):t.sectionName(s),count:n.length,seatId:n[0],anchor:r?o.get(s.zone):t.sectionAnchor(s)})}return[...e.values()]}function Vc(t,e){return G("map.beaconAria",{seats:Hn("picker.seatCount",t),name:e})}var zc="selection-beacon-ring",di=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 i=Math.max(this.host.stageScale(),1e-4),o=`${i.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=ci/2/i,n=this.host.accent(),r=this.host.accentInk(),l=new Dc({listening:!1,name:"selection-beacons"});for(let a of e){let c={x:a.anchor.x,y:a.anchor.y-s*1.6},d=new Un({name:zc,x:c.x,y:c.y,radius:s*1.25,stroke:F(n,.55),strokeWidth:Math.max(1,s*.22),listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});l.add(d),l.add(new Un({name:"selection-beacon-disc",x:c.x,y:c.y,radius:s,fill:n,stroke:F(r,.28),strokeWidth:1/i,listening:!1,perfectDrawEnabled:!1}));let h=new Gc({x:c.x,y:c.y,text:String(a.count),fontSize:Nc/i,fontStyle:Hc,fontFamily:this.host.labelFont(),fill:r,listening:!1,perfectDrawEnabled:!1});h.offsetX(h.width()/2),h.offsetY(h.height()/2),l.add(h),this.rings.push(d),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 i=this.buttons[e],o=this.host.worldToScreen(this.centres[e]),s=i.offsetWidth||parseFloat(i.style.width)||ci;i.style.left=`${o.x-s/2}px`,i.style.top=`${o.y-s/2}px`}}buildButton(e,i){let o=this.host.worldToScreen(i),s=typeof globalThis.matchMedia=="function"&&globalThis.matchMedia("(pointer: coarse)").matches,n=Math.max(ci,s?Wc:ci),r=document.createElement("button");return r.type="button",r.className="sl-beacon",r.dataset.beacon=e.id,r.setAttribute("aria-label",Vc(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 eo(t,e){let i=t.width(),o=t.height(),s=1/0,n=1/0,r=-1/0,l=-1/0,a=i*2,c=o*2;for(let d of e){let h=d.getClientRect();if(!(!(h.width>1)||!(h.height>1))){if(h.x<-a||h.y<-c||h.x+h.width>i+a||h.y+h.height>o+c)return null;h.x<s&&(s=h.x),h.y<n&&(n=h.y),h.x+h.width>r&&(r=h.x+h.width),h.y+h.height>l&&(l=h.y+h.height)}}return isFinite(s)?{x:s,y:n,width:r-s,height:l-n}:null}var qn=8,Kc=.02,Zn=1,jn=.5;function Qn(t,e,i,o){let s=i??{x:0,y:0,width:t.width(),height:t.height()},n=eo(t,e);if(!n)return 0;to(t,n,s);let r=Math.min((s.width-2*qn)/n.width,(s.height-2*qn)/n.height);if(!(r>0))return 1;let l=Math.max(n.width-s.width,n.height-s.height),a=l>jn?r:Math.min(r,Xc(t.scaleX(),o));if(!(a>1+Kc)&&!(l>jn)||!(a>0)||a===1)return 1;let c=s.x+s.width/2,d=s.y+s.height/2;t.scale({x:t.scaleX()*a,y:t.scaleY()*a}),t.position({x:c+(t.x()-c)*a,y:d+(t.y()-d)*a});let h=eo(t,e);return h&&to(t,h,s),a}function Jn(t,e,i){let o=i??{x:0,y:0,width:t.width(),height:t.height()},s=eo(t,e);return s?to(t,s,o):!1}function Xc(t,e){let i=Math.max(t,1e-9);return(e!=null&&e>i?Math.min(Zn,e):Zn)/i}function to(t,e,i){let o=i.x+i.width/2-(e.x+e.width/2),s=i.y+i.height/2-(e.y+e.height/2);return o===0&&s===0?!1:(t.position({x:t.x()+o,y:t.y()+s}),!0)}function io(t){return`${t.x()},${t.y()},${t.scaleX()}`}import{Group as Yc}from"konva/lib/Group";import{Circle as er}from"konva/lib/shapes/Circle";import{Line as Uc}from"konva/lib/shapes/Line";import{Text as $c}from"konva/lib/shapes/Text";var qc=6;function oo(t){return B(t)?"#0b1220":"#ffffff"}function tr(t){let{points:e}=t;if(!e.length)return null;let i=t.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:i,ink:oo(i)}}var hi=class{constructor(e){this.group=null;this.badges=[];this.host=e}anchorFor(e){for(let i of this.host.sections()){if(i.logicalId!==e&&i.id!==e)continue;let o=tr({points:this.host.ownedPoints(i),categoryColor:null});if(o)return o.centroid}return null}badgeAt(e){for(let i of this.badges)if(Math.hypot(e.x-i.centre.x,e.y-i.centre.y)<=i.radius)return i.id;return null}sync(e,i="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 Yc({listening:!1,name:"owned-sections"}),n=new Set;for(let r of this.host.sections()){let l=this.host.ownedPoints(r),a=tr({points:l,categoryColor:this.host.sectionColor(r)});if(!a)continue;let c=Math.max(qc/2/o,1);for(let m of l)s.add(new er({name:"owned-seat-dot",x:m.x,y:m.y,radius:c,fill:a.fill,stroke:F("#ffffff",.55),strokeWidth:Math.max(.5,c*.28),shadowColor:a.fill,shadowBlur:c*2.4,shadowOpacity:.7,listening:!1,perfectDrawEnabled:!1}));if(i!=="seats"||n.has(r.logicalId))continue;n.add(r.logicalId);let d=this.host.sections().filter(m=>m.logicalId===r.logicalId).reduce((m,p)=>m+this.host.ownedPoints(p).length,0),h=this.host.labelAnchor(r),u=11/o,y={x:h.x,y:h.y-u*2.1};s.add(new er({name:"owned-section-badge",x:y.x,y:y.y,radius:u,fill:a.fill,stroke:F(a.ink,.35),strokeWidth:1/o,listening:!1,perfectDrawEnabled:!1})),s.add(new Uc({x:y.x-u*.62,y:y.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 f=new $c({x:y.x+u*.12,y:y.y-u*.5,text:String(d),fontSize:u,fontStyle:"800",fontFamily:this.host.labelFont(),fill:a.ink,listening:!1,perfectDrawEnabled:!1});s.add(f),this.badges.push({id:r.logicalId,centre:y,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 W(t){let e=fs(t);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(t,e,i,o){let s=o*Math.PI/180,n=Math.cos(s),r=Math.sin(s);return[{x:-e/2,y:-i/2},{x:e/2,y:-i/2},{x:e/2,y:i/2},{x:-e/2,y:i/2}].map(l=>({x:t.x+l.x*n-l.y*r,y:t.y+l.x*r+l.y*n}))}function ui(t,e,i,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 d=0;d<=6;d++){let h=e*(d/6-.5),u=i*(c/4-.5),y={x:t.x+h*l-u*a,y:t.y+h*a+u*l};if(!te(y,s,n))return!1}return!0}function ir(t,e,i){let o=W(t),s=[i];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};te(a,t,e)&&s.push(a)}let n=[t,...e];return s.map(r=>({point:r,room:qo(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 or(t,e){let{stageScale:i,stageX:o,stageY:s}=t;if(t.viewMode==="perspective"&&e.perspectiveAffine)return W(e.outline.map(r=>{let l=t.projectedSectionPoint(e,r);return{x:l.x*i+o,y:l.y*i+s}}));let n=e.liftWorld>0?t.isoLiftLocal(e.liftWorld):{x:0,y:0};return W(e.outline.map(r=>{let l={x:r.x+n.x,y:r.y+n.y},a=t.isoT===0?l:t.isoForward(l);return{x:a.x*i+o,y:a.y*i+s}}))}function Zc(t,e){let i=t.width*t.height;if(i<=0)return 0;let o=Math.max(0,Math.min(t.x+t.width,e.width)-Math.max(t.x,0)),s=Math.max(0,Math.min(t.y+t.height,e.height)-Math.max(t.y,0));return o*s/i}function sr(t){let{current:e,viewport:i}=t,o=new Map;for(let l of t.sections){let a=Zc(l.bounds,i)*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 Qc}from"konva/lib/shapes/Text";function jc(t,e){return t.x<e.x+e.width&&e.x<t.x+t.width&&t.y<e.y+e.height&&e.y<t.y+t.height}var et=class{constructor(){this.cells=new Map}insert(e){for(let i of this.keys(e)){let o=this.cells.get(i);o?o.push(e):this.cells.set(i,[e])}}collisionCount(e){let i=new Set,o=0;for(let s of this.keys(e))for(let n of this.cells.get(s)??[])i.has(n)||(i.add(n),jc(e,n)&&o++);return o}keys(e){let i=Math.floor(e.x/pt),o=Math.floor((e.x+Math.max(0,e.width))/pt),s=Math.floor(e.y/pt),n=Math.floor((e.y+Math.max(0,e.height))/pt),r=[];for(let l=s;l<=n;l++)for(let a=i;a<=o;a++)r.push(`${a}:${l}`);return r}};function nr(t,e){let i=t.sections.filter(f=>f.id===e||f.logicalId===e),o=i.map(f=>{if(t.viewMode==="perspective"&&f.perspectiveAffine)return W(f.outline.map(g=>t.projectedSectionPoint(f,g)));let m=f.liftWorld>0?t.isoLiftLocal(f.liftWorld):{x:0,y:0},p=f.outline.map(g=>{let b={x:g.x+m.x,y:g.y+m.y};return t.isoT===0?b:t.isoForward(b)});return W(p)});if(!o.length)return null;let s=Math.min(...o.map(f=>f.x)),n=Math.min(...o.map(f=>f.y)),r=Math.max(...o.map(f=>f.x+f.width)),l=Math.max(...o.map(f=>f.y+f.height)),a=new Set(i.flatMap(f=>f.memberIds));for(let f of a){let m=t.seatById.get(f);if(!m)continue;let p=t.renderedSeatPoint(m);s=Math.min(s,p.x-t.seatR),n=Math.min(n,p.y-t.seatR),r=Math.max(r,p.x+t.seatR),l=Math.max(l,p.y+t.seatR)}let c=f=>{[f.x,f.y,f.width,f.height].every(Number.isFinite)&&(s=Math.min(s,f.x),n=Math.min(n,f.y),r=Math.max(r,f.x+f.width),l=Math.max(l,f.y+f.height))},d=f=>{let m={x:f.x+f.width/2,y:f.y+f.height/2};return i.some(p=>te(m,p.outline,p.holes))};for(let{node:f,backdrop:m}of t.freeTextById.values()){let p=f.getClientRect({relativeTo:t.bgLayer,skipShadow:!0});d(p)&&(c(p),m&&c(m.getClientRect({relativeTo:t.bgLayer,skipShadow:!0})))}for(let{node:f}of t.iconNodeById.values()){let m=f.getClientRect({relativeTo:t.bgLayer,skipShadow:!0});d(m)&&c(m)}let h=new et;for(let{node:f}of t.freeTextById.values()){let m=f.getClientRect({relativeTo:t.bgLayer,skipShadow:!0,skipStroke:!0});h.insert({x:m.x-Q,y:m.y-Q,width:m.width+Q*2,height:m.height+Q*2})}for(let f of t.rowLabelPlan){let m=(f.focusKeys??[]).some(S=>S===e||i.some(v=>S===v.id||S===v.logicalId)),p=new Qc({text:f.text,fontSize:f.fontSize,fontStyle:"700",fontFamily:t.labelFont(),rotation:f.rotation,listening:!1});p.offsetX(p.width()/2),p.offsetY(p.height()/2);let g=t.resolveAutomaticRowLabelPosition(p,f,h),b=t.rowLabelBox(p,g);m&&c(b),h.insert(b),p.destroy()}let u=Math.max(r-s,l-n),y=Math.max(t.seatR*2,Math.min(24,u*.025));return{x:s-y,y:n-y,width:Math.max(1,r-s+y*2),height:Math.max(1,l-n+y*2)}}import{Rect as Jc}from"konva/lib/shapes/Rect";import{Text as rr}from"konva/lib/shapes/Text";var so="\0";function ed(t){let i=[...G("map.fromPrice",{price:so}).toLocaleLowerCase()],o=i.findIndex(s=>s!==so&&s.toLocaleUpperCase()!==s.toLocaleLowerCase());return o>=0&&(i[o]=i[o].toLocaleUpperCase()),i.join("").split(so).join(t)}function ar(t,e){if(!e.zones?.length||!t.sections.length)return;let i=Ln(t.canvasBackground),o=new Map;for(let s of t.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,d=-1/0;for(let p of n)for(let g of p.outline)g.x<c&&(c=g.x),g.x>d&&(d=g.x);let h=isFinite(c)&&d>c?d-c:0,u=1/0;for(let p of n)for(let g of p.memberIds){let b=t.seatById.get(g),S=b&&t.catPrice.get(b.categoryKey);typeof S=="number"&&S<u&&(u=S)}let y=new Jc({x:l,y:a,width:1,height:1,offsetX:.5,offsetY:.5,cornerRadius:1,fill:i.plate,stroke:F(s.color??r.outlineTint,sn),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});t.bgLayer.add(y);let f=new rr({x:l,y:a,text:s.label,fontSize:Zt,fontStyle:Zs,letterSpacing:0,fontFamily:t.labelFont(),fill:i.ink,opacity:0,listening:!1,perfectDrawEnabled:!1});f.offsetX(f.width()/2),f.offsetY(f.height()/2),t.bgLayer.add(f);let m=null;isFinite(u)&&(m=new rr({x:l,y:a,text:ed(gt(u,t.currency)),fontSize:jt,fontStyle:js,fontFamily:t.labelFont(),fill:i.subInk,opacity:0,listening:!1,perfectDrawEnabled:!1}),m.offsetX(m.width()/2),t.bgLayer.add(m)),t.zones.push({id:s.id,anchor:{x:l,y:a},back:y,background:i.plate,name:s.label,spanWorld:h,label:f,sub:m})}}import{Circle as ad}from"konva/lib/shapes/Circle";import{Line as ld}from"konva/lib/shapes/Line";import{Rect as cd}from"konva/lib/shapes/Rect";import{Text as dd}from"konva/lib/shapes/Text";function Le(t,e){return e.length===0?!!t.accessible:!!t.accessibility?.some(i=>e.includes(i))}function Me(t,e){return Le(t,e)?"match":t.accessibility?.includes("companion")?"companion":"other"}var lr=.35,cr=.7,tt="#0b1220",St="#ffffff",dr="#0b1220",hr="#232c40",ur="#8b93a7";function no(t,e,i="normal"){let o=t?"bold":i;return e?`italic ${o}`.trim():o}var ro="#f7f8fb";import{Shape as id}from"konva/lib/Shape";import{Circle as od}from"konva/lib/shapes/Circle";import{Rect as sd}from"konva/lib/shapes/Rect";var td={M:2,L:2,Q:4,C:6,Z:0},ao=new Map;function lo(t){let e=ao.get(t);if(e)return e;let i=zt(t);if(!i)return ao.set(t,[]),[];let o=i.match(/[MLQCZ]|-?(?:\d+(?:\.\d+)?|\.\d+)/g)??[],s=[],n=0;for(;n<o.length;){let r=o[n++],l=td[r];if(l===void 0||n+l>o.length)throw new Error(`Invalid path data for seat glyph "${t}".`);let a=o.slice(n,n+l).map(Number);if(a.some(c=>!Number.isFinite(c)))throw new Error(`Invalid coordinate in seat glyph "${t}".`);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 ao.set(t,s),s}function pr(t,e,i,o=0,s=0){let n=lo(e),r=ms(e).bounds;if(!n.length||!r||!(i>0))return!1;let l=ys(r,i);t.save(),t.translate(o,s),t.scale(l.scale,l.scale),t.translate(-l.centreX,-l.centreY);for(let a of n)a.command==="M"?t.moveTo(a.points[0],a.points[1]):a.command==="L"?t.lineTo(a.points[0],a.points[1]):a.command==="Q"?t.quadraticCurveTo(a.points[0],a.points[1],a.points[2],a.points[3]):a.command==="C"?t.bezierCurveTo(a.points[0],a.points[1],a.points[2],a.points[3],a.points[4],a.points[5]):t.closePath();return t.restore(),!0}function fr(t,e){t.beginPath(),t.arc(0,0,e,0,Math.PI*2,!1),t.closePath()}var vt=class extends id{_sceneFunc(e){let i=this.attrs.seatRadius||1,o=this.attrs.seatGlyph,s=lo(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=i*2*c>=16}else r=n;if(!s.length||!r){fr(e,i),e.fillStrokeShape(this);return}e.beginPath(),pr(e,o,i),e.fillStrokeShape(this)}_hitFunc(e){fr(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 nd(t,e){return t==="circle"||!zt(t)?null:new vt({x:e.x,y:e.y,seatRadius:e.radius,seatGlyph:t,...e.detail===void 0?{}:{seatGlyphDetail:e.detail},...e.fill?{fill:e.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function mr(t){let{x:e,y:i,radius:o}=t;return t.wheelchairBay?new sd({x:e,y:i,width:o*2,height:o*2,offsetX:o,offsetY:o,cornerRadius:2,...t.fill?{fill:t.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}):nd(t.glyph,{x:e,y:i,radius:o,detail:t.detail,fill:t.fill})??new od({x:e,y:i,radius:o,...t.fill?{fill:t.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function rd(t,e){return t*2*e>=16}function yr(t,e,i,o){let s=rd(e,i);if(s===o||!t.length)return s;for(let n of t)n.setAttr("seatGlyphDetail",s);return s}function gr(t){let e=[...t.seats].sort((i,o)=>(t.perspectiveSeatDepth.get(o.id)??0)-(t.perspectiveSeatDepth.get(i.id)??0));for(let i of e){if(i.kind==="booth"){hd(t,i);continue}let o=t.seatContainer(i.id),s=mr({x:i.x,y:i.y,radius:t.seatR,detail:t.seatGlyphDetail,glyph:gs(i.glyph,t.catByKey.get(i.categoryKey)),wheelchairBay:i.wheelchairSpaceType==="no-seat"});if(s instanceof vt&&t.glyphMarkers.push(s),s.setAttr("seatId",i.id),t.circleById.set(i.id,s),t.paintSeat(s,i.id),o.add(s),i.accessible){if(i.wheelchairSpaceType!=="no-seat"){let n=new ad({x:i.x,y:i.y,radius:t.seatR+1.5,stroke:At(i.accessibility),strokeWidth:2.5,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});t.accessRingById.set(i.id,n),o.add(n)}if(i.accessibility?.includes("wheelchair")&&Ht(i.accessibility)){let n=t.buildAccessGlyph(i,typeof s.fill()=="string"?s.fill():"");t.accessGlyphById.set(i.id,n),o.add(n)}}}}function hd(t,e){let i=t.seatContainer(e.id),o=t.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 ld({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 cd({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),t.circleById.set(e.id,r),i.add(r);let l=new dd({x:s,y:n,text:e.displayLabel??e.label,fontSize:_e,fontStyle:"600",fontFamily:t.labelFont(),fill:t.theme.seatLabelColor??tt,listening:!1,perfectDrawEnabled:!1});l.offsetX(l.width()/2),l.offsetY(l.height()/2),l.visible(!1),t.setHasBoothText(),t.boothLabelById.set(e.id,l),i.add(l),t.paintSeat(r,e.id)}function br(t,e,i,o){let s=null,n=1/0,r=t.stage.scaleX()||1;for(let l of t.seats){if(!o?.includeUnavailable&&!t.selection.has(l.id)&&!t.isSelectable(l.id))continue;let a=t.worldToScreen(l),c=t.viewMode==="perspective"?t.perspectiveSeatScale.get(l.id)??1:1,d=t.seatR*r*c+i,h=Math.hypot(a.x-e.x,a.y-e.y);h<=d&&h<n&&(n=h,s=l.id)}return s}function Sr(t){if(!t.objectFloor.size)return null;let e=t.stage.getPointerPosition();if(!e)return null;let i=t.screenToWorld(e),o=null,s=1/0;for(let n of t.seats){let r=t.renderedSeatPoint(n),l=r.x-i.x,a=r.y-i.y,c=l*l+a*a;c<s&&(s=c,o=n.rowId)}return o?t.objectFloor.get(o)??null:null}import{Circle as Ld}from"konva/lib/shapes/Circle";import{Group as Dr}from"konva/lib/Group";import{Rect as Cd}from"konva/lib/shapes/Rect";import{Text as Td}from"konva/lib/shapes/Text";var Ce=1.12;function it(t,e,i,o){if(e.width<=0||e.height<=0)return t.scaleX();let s=o??{x:0,y:0,width:t.width(),height:t.height()},n=Math.min(s.width/(e.width*Ce),s.height/(e.height*Ce));return z(n,i.min,i.max)}var wt=.55;function pi(t,e){return e==null?t.max:Math.max(t.min,Math.min(t.max,e))}function co(t){let{stage:e,box:i,bounds:o,viewport:s,centreScreen:n}=t,r=t.ratio??yt,l=e.scaleX(),a=it(e,i,o,s)/Math.max(l,1e-4);if(a>=r||a<=1/r)return!1;let c=n.x-(s.x+s.width/2),d=n.y-(s.y+s.height/2);return Math.hypot(c,d)<=Math.min(s.width,s.height)*.02}function vr(t,e,i,o){let s=z(e,o.min,o.max),n=t.scaleX();if(s===n)return!1;let r=(i.x-t.x())/n,l=(i.y-t.y())/n;return t.scale({x:s,y:s}),t.position({x:i.x-r*s,y:i.y-l*s}),!0}function wr(t,e,i,o,s,n){let r=s??{x:0,y:0,width:t.width(),height:t.height()},l=Math.min(r.width/(e.width*Ce),r.height/(e.height*Ce)),a=o??i.min,c=z(Math.max(l,a),i.min,Math.max(a,pi(i,n)));t.scale({x:c,y:c}),t.position({x:r.x+r.width/2-(e.x+e.width/2)*c,y:r.y+r.height/2-(e.y+e.height/2)*c})}function kr(t,e){return t===null||e===null?t===e:t.size===e.size&&[...t].every(i=>e.has(i))}function ho(t,e){let i=null;for(let o of t){let s=e.get(o)?.logicalId;if(!s||i!=null&&i!==s)return null;i=s}return i}function Lr(t,e){if(!e?.size)return!1;for(let i of t)if(e.has(i))return!1;return!0}function Ir(t,e){let i=t.sectionHeat.get(e.id)??t.sectionHeat.get(e.logicalId)??(e.zone?t.sectionHeat.get(e.zone):void 0);if(i==null||i<=0){e.outlinePoly.stroke(F(e.outlineTint,.5)),e.outlinePoly.fill(F(e.outlineTint,.08)),e.outlinePoly.strokeWidth(1.75),e.outlinePoly.shadowOpacity(0);return}let o=j("#f4b740","#ef4444",i);e.outlinePoly.stroke(F(o,.72+i*.25)),e.outlinePoly.fill(F(o,.08+i*.13)),e.outlinePoly.strokeWidth(2+i*3.5),e.outlinePoly.shadowColor(o),e.outlinePoly.shadowBlur(4+i*12),e.outlinePoly.shadowOpacity(.25+i*.45)}function po(t,e){return t.closedSections.has(e.id)||t.closedSections.has(e.logicalId)||e.zone!=null&&t.closedSections.has(e.zone)}function Pr(t,e,i,o){if(!e)return 0;let s=0;for(let n of t){if(i(n)!=="free")continue;let r=o(n);r&&Le(r,e)&&(s+=1)}return s}function Mr(t,e){return po(t,e)?"closed":e.total<=0?"normal":e.free<=0?"sold-out":e.free<=e.total*un?"nearly-gone":"normal"}function Rr(t,e){let i=Mr(t,e),o=t.accessFilterActive&&t.sectionAccessibleFree(e)<=0,s=wn(t.canvasBackground,i,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(i==="sold-out"?G("map.soldOut"):G("map.seatsLeft",{count:e.free})),e.subLabel.offsetX(e.subLabel.width()/2)}function fo(t,e){return j(e,B(t)?"#ffffff":"#000000",dn)}function mo(t,e,i=0){let o=cn-i;return!e||t.length<=o?t:`${t.slice(0,Math.max(1,o-1)).trimEnd()}\u2026`}function ud(t,e){return Ar(t,e)!=null}function Ar(t,e){if(!t.accessFilterActive)return null;let i=t.sectionAccessibleFree(e);return i>0?`\u267F ${i}`:null}function Er(t,e,i){let o=mo(t.label,e,i?i.length+1:0);return i?[`${i} ${o}`,i]:[o]}function pd(t,e,i){let o=Er(t,e,i),s=(t.nameLabelBadgeOnly?o[1]:o[0])??o[0];t.nameLabel.text()!==s&&t.nameLabel.text(s),t.nameLabel.fontStyle(e?Qt:Ge),t.nameLabel.letterSpacing(e?t.nameLabel.fontSize()*Ne:0)}function fd(t,e,i){let o=t.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&&Mr(t,e)==="sold-out",l=mt/i,a=ei/i,c=r?2/i:0,d={x:e.nameLabel.x(),y:e.nameLabel.y()},h=e.nameLabel.height(),u=0;r?(Re(e.subLabel,he/i,d.y),u=e.subLabel.height(),e.subLabel.rotation(0),e.subLabel.x(d.x),e.subLabel.y(d.y+h/2+c+u/2),e.subLabel.opacity(s)):e.subLabel.opacity(0);let y=r?c+u:0,f=Math.max(e.nameLabel.width(),r?e.subLabel.width():0)+l*2,m=h+y+a*2;e.namePlate.position({x:d.x,y:d.y+y/2}),e.namePlate.rotation(n),e.namePlate.size({width:f,height:m}),e.namePlate.offset({x:f/2,y:m/2}),e.namePlate.cornerRadius(hn/i),e.namePlate.opacity(s*Jt)}function _r(t,e){let i,o;t.reducedMotion?(i=e<=Se?1:0,o=e<=$e?1:0):(i=z((ve-e)/(ve-Se),0,1),o=z((Se-e)/(Se-$e),0,1)),(t.floorOverview||t.focusedSectionId)&&(i=0,o=0);let s=!t.floorOverview&&!t.focusedSectionId&&e<ce;s&&(i=1),t.zones.length||(o=0);let n=t.viewMode==="perspective"&&t.glideInProgress&&t.seatCount>2500;t.seatLayer.opacity(s||n?0:1-i);let r=t.stageScaleX,l=!t.glideInProgress&&(t.lodScale===0||Math.abs(e-t.lodScale)/(t.lodScale||1)>.08);l&&t.setLodScale(e);let a=t.focusedSectionId,c=t.stageWidth<ue,d=ie(t.canvasBackground),h=z((i-.2)/.8,0,1),u=new Set;for(let f of t.sections){let m=t.hasFocusDimOverlay?1:a&&f.id!==a&&f.logicalId!==a&&f.zone!==a?ke:1,p=Ar(t,f);p&&f.zone&&u.add(f.zone);let g=Math.min(m,Lr(f.memberCategoryKeys,t.categoryFilter)?ke:1,t.accessFilterActive&&!p?ke:1);f.outlinePoly.opacity(s?0:(1-i)*g),f.blockPoly.opacity(Us*i*g);let b=t.sectionIsOwned(f);f.blockPoly.stroke(b?t.selectionColor:f.shellStroke||d.sectionStroke),f.blockPoly.strokeWidth((b?$s:De)/Math.max(r,1e-4));let S=f.blockPoly.fill(),v=typeof S=="string"?S:f.baseFill,k=c?fo(t.canvasBackground,v):null;k&&f.namePlate.fill(k);let w=Ie(k??v,f.explicitInk,f.preferredInk);f.nameLabel.fill(w),f.subLabel.fill(w),pd(f,c,p),l&&h>.01&&gd(t,f,r,Er(f,c,p));let L=p?1:1-o;f.nameLabel.opacity(f.nameLabelFits?h*L*g:0),f.subLabel.opacity(0)}let y=o*(1-t.isoT);for(let f of t.zones){let m=t.accessFilterActive&&!u.has(f.id)?ke:1,p=f.label.visible()?y*m:0;f.back.opacity(p),f.label.opacity(p),f.sub&&f.sub.opacity(Cr(t,f)?0:p),l&&bd(t,f,r)}if(!t.glideInProgress&&(h>.01||y>.01)){yd(t,r),md(t.sections);for(let f of t.zones){let m=f.label.opacity();f.back.opacity(m),f.sub&&f.sub.opacity(Cr(t,f)?0:m)}}for(let f of t.sections)fd(t,f,r);t.bgLayer.batchDraw()}function Cr(t,e){return t.stageWidth<ue||!e.sub||!e.sub.visible()}function md(t){let e=new Map;for(let i of t)(e.get(i.logicalId)??e.set(i.logicalId,[]).get(i.logicalId)).push(i);for(let i of e.values()){if(i.length<2)continue;let o=i.filter(s=>s.nameLabel.opacity()>.05).sort((s,n)=>{let r=W(s.outline),l=W(n.outline);return l.width*l.height-r.width*r.height});for(let s of o.slice(1))s.nameLabel.opacity(0)}}function yd(t,e){let o=[],s=a=>{let c=t.worldToScreen({x:a.x(),y:a.y()}),d=W(Je({x:0,y:0},a.width()*e,a.height()*e,a.rotation()));return{x:c.x-d.width/2,y:c.y-d.height/2,w:d.width,h:d.height}};for(let a of t.zones){if(a.label.opacity()<=.05)continue;let c=a.back.getAbsolutePosition(),d=a.back.width()*e,h=a.back.height()*e;o.push({node:a.label,tier:0,section:!1,zone:a,box:{x:c.x-d/2,y:c.y-h/2,w:d,h}})}for(let a of t.sections)if(a.nameLabel.opacity()>.05){let c=ud(t,a)?-1:1;o.push({node:a.nameLabel,tier:c,section:!0,area:a.labelArea,box:s(a.nameLabel)})}let n=t.landmarks.map(a=>{let c=t.worldToScreen({x:a.x,y:a.y}),d=t.worldToScreen({x:a.x+a.width,y:a.y+a.height});return{x:Math.min(c.x,d.x),y:Math.min(c.y,d.y),w:Math.abs(d.x-c.x),h:Math.abs(d.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 d of an){if(d===0)continue;let h={...a.box,y:a.box.y+d};if(!l(h)){uo(a.zone,0,d/e),r.push(h),c=!0;break}}if(a.section){let d=a.node.fontSize(),h=a.node.y(),u=a.node.letterSpacing()>0;for(let y of Vi){let f=d*y;if(f*e<he)break;Re(a.node,f,h),u&&(a.node.letterSpacing(a.node.fontSize()*Ne),a.node.offsetX(a.node.width()/2));let m=s(a.node);if(!l(m)){r.push(m),c=!0;break}}c||(Re(a.node,d,h),u&&(a.node.letterSpacing(a.node.fontSize()*Ne),a.node.offsetX(a.node.width()/2)))}c||a.node.opacity(0)}}function Re(t,e,i){t.fontSize(Math.max(1,e)),t.offsetX(t.width()/2),t.offsetY(t.height()/2),t.y(i)}function gd(t,e,i,o){e.subLabelFits=!1;let s=t.stageWidth<ue,n=s?mt*2:0,r=Ze(qe*e.labelScale,t.stageWidth),l=he;for(let[a,c]of o.entries()){e.nameLabel.text(c);for(let d=r;d>=l;d-=1)for(let h of[0,-90]){e.nameLabel.rotation(h),Re(e.nameLabel,d/i,e.nameLabel.y()),s&&(e.nameLabel.letterSpacing(e.nameLabel.fontSize()*Ne),e.nameLabel.offsetX(e.nameLabel.width()/2));for(let u of e.labelAnchors){e.nameLabel.position(u);let y=(8+n)/i;if(ui(u,e.nameLabel.width()+y,e.nameLabel.height()+y,h,e.outline,e.holes)){e.nameLabelFits=!0,e.nameLabelBadgeOnly=a>0;return}}}}e.nameLabel.text(o[0]),e.nameLabelBadgeOnly=!1,e.nameLabel.position(e.centroid),e.nameLabel.rotation(0),e.nameLabelFits=!1}function Tr(t,e,i){let o=s=>(t.text(s),t.width());if(!(o(e)<=i)){for(let s=e.length-1;s>=1;s-=1)if(o(`${e.slice(0,s).trimEnd()}\u2026`)<=i)return;o("\u2026")}}function bd(t,e,i){let o=zi(t.stageWidth),s=t.stageWidth<ue,n=e.sub!=null&&!s,r=(s?Qs:en)*o/i,l=(s?Js:tn)*o/i,a=Ze(Zt,t.stageWidth);e.label.text(e.name),Re(e.label,a/i,e.anchor.y),n&&(Re(e.sub,Ze(jt,t.stageWidth)/i,e.anchor.y),e.sub.letterSpacing(e.sub.fontSize()*qs),e.sub.offsetX(e.sub.width()/2));let c=s?t.stageWidth*nn/i-r*2:1/0,d=!s&&e.spanWorld>0?e.spanWorld*rn-r*2:1/0,h=Math.min(c,d),u=()=>Math.max(e.label.width(),n?e.sub.width():0);if(n&&u()>h&&(n=!1),u()>h)for(let L of Vi){let C=Math.max(he,a*L);if(C>=e.label.fontSize()*i-.001||(Re(e.label,C/i,e.anchor.y),e.label.width()<=h))break}if(e.label.width()>h&&(Tr(e.label,e.name,Math.max(h,1)),Sd(e.label.text())<vd(e.name)&&Tr(e.label,e.name,Math.max(c,1)),Re(e.label,e.label.fontSize(),e.anchor.y)),e.sub&&e.sub.visible(n),c<=0||e.label.width()>c+.001){xr(e);return}e.label.visible(!0),e.back.visible(!0);let y=n?3*o/i:0;e.label.x(e.anchor.x),n?e.sub.x(e.anchor.x):e.sub&&e.sub.opacity(0);let f=Math.max(e.label.width(),n?e.sub.width():0)+r*2,m=e.label.height()+(n?y+e.sub.height():0)+l*2;e.label.y(e.anchor.y-(n?(y+e.sub.height())/2:0)),n&&e.sub.y(e.anchor.y+(e.label.height()+y)/2),e.back.position(e.anchor),e.back.size({width:f,height:m}),e.back.offset({x:f/2,y:m/2}),e.back.cornerRadius(on*o/i),e.back.strokeWidth(1/i);let p=e.back.getAbsolutePosition(),g=6,b=f*i;if(b>t.stageWidth-g*2){xr(e);return}let S=b/2,k=(z(p.x,g+S,t.stageWidth-g-S)-p.x)/i;Math.abs(k)>.001&&uo(e,k,0);let w=62+m*i/2;p.y<w&&uo(e,0,(w-p.y)/i)}function Sd(t){return t.endsWith("\u2026")?t.slice(0,-1).trimEnd().length:t.length}function vd(t){return Math.min(t.length,Math.max(6,Math.ceil(t.length/2)))}function xr(t){t.label.visible(!1),t.label.opacity(0),t.back.visible(!1),t.back.opacity(0),t.sub&&(t.sub.visible(!1),t.sub.opacity(0))}function uo(t,e,i){t.label.x(t.label.x()+e),t.label.y(t.label.y()+i),t.sub&&(t.sub.x(t.sub.x()+e),t.sub.y(t.sub.y()+i)),t.back.x(t.back.x()+e),t.back.y(t.back.y()+i)}function wd(t,e){if(!t.length)return null;let i=1/0,o=1/0,s=-1/0,n=-1/0;for(let r of t)!Number.isFinite(r.x)||!Number.isFinite(r.y)||(r.x<i&&(i=r.x),r.y<o&&(o=r.y),r.x>s&&(s=r.x),r.y>n&&(n=r.y));return!Number.isFinite(i)||!Number.isFinite(o)?null:{x:i-e,y:o-e,width:s-i+e*2,height:n-o+e*2}}function bo(t,e=0){let i=new Map;for(let s of t){let n=`${s.rowId}|${s.categoryKey}`,r=i.get(n);r||(r={categoryKey:s.categoryKey,points:[]},i.set(n,r)),r.points.push({x:s.x,y:s.y})}let o=[];for(let[s,n]of i){let r=wd(n.points,e);r&&o.push({id:s,categoryKey:n.categoryKey,seatCount:n.points.length,bounds:r})}return o}function yo(t,e){let i=Math.max(0,Math.max(t.x-(e.x+e.width),e.x-(t.x+t.width))),o=Math.max(0,Math.max(t.y-(e.y+e.height),e.y-(t.y+t.height)));return Math.hypot(i,o)}function go(t,e){let i=Math.min(t.x,e.x),o=Math.min(t.y,e.y);return{x:i,y:o,width:Math.max(t.x+t.width,e.x+e.width)-i,height:Math.max(t.y+t.height,e.y+e.height)-o}}function Fr(t){if(!t.length)return 0;let e=[...t].sort((o,s)=>o-s),i=Math.floor(e.length/2);return e.length%2?e[i]:(e[i-1]+e[i])/2}function kd(t){if(!t.length)return 0;let e=Fr(t.map(o=>Math.min(o.bounds.width,o.bounds.height)));if(t.length<2)return e;let i=[];for(let o=0;o<t.length;o+=1){let s=1/0;for(let n=0;n<t.length;n+=1)o!==n&&(s=Math.min(s,yo(t[o].bounds,t[n].bounds)));Number.isFinite(s)&&i.push(s)}return Fr(i)+e}function So(t,e){if(!t.length)return[];let i=kd(t)*(e?.gapRows??2),o=e?.minRows??2,s=e?.minSeats??12,n=new Map;for(let l of t){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,y)=>u.bounds.y-y.bounds.y||u.bounds.x-y.bounds.x||u.id.localeCompare(y.id)),d=[];for(let u of c){let y=d.find(f=>yo(f.bounds,u.bounds)<=i);y?(y.bounds=go(y.bounds,u.bounds),y.rowIds.push(u.id),y.seatCount+=u.seatCount):d.push({categoryKey:l,bounds:{...u.bounds},rowIds:[u.id],seatCount:u.seatCount})}let h=!0;for(;h&&d.length>1;){h=!1;e:for(let u=0;u<d.length;u+=1)for(let y=u+1;y<d.length;y+=1)if(!(yo(d[u].bounds,d[y].bounds)>i)){d[u].bounds=go(d[u].bounds,d[y].bounds),d[u].rowIds.push(...d[y].rowIds),d[u].seatCount+=d[y].seatCount,d.splice(y,1),h=!0;break e}}for(let u of d)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 Br(t){let e=null;for(let i of t)e=e?go(e,i.bounds):{...i.bounds};return e}function Or(t,e){let i=null,o=1/0;for(let s of t){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&&(i=s,o=c)}return i}function Hr(t){return t*.3}function Gr(t){return Hr(t)*2+t*.42}var fi=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=So(bo(this.host.seats(),this.host.seatR()));if(!e.length)return;let i=this.host.canvasBackground(),o=ie(i),s=fo(i,i),n=re(s,o.sectionInk),r=new Dr({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},d=new Dr({listening:!1}),h=new Cd({...c,width:0,height:0,fill:s,stroke:o.sectionStroke,strokeWidth:De,opacity:Jt,listening:!1,perfectDrawEnabled:!1}),u=new Ld({...c,radius:0,fill:this.host.categoryColor(l.categoryKey),listening:!1,perfectDrawEnabled:!1}),y=this.host.categoryPriceLabel(l.categoryKey),f=new Td({...c,text:a,fontSize:qe,fontStyle:Ge,fontFamily:this.host.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});d.add(h),d.add(u),d.add(f),r.add(d),this.labels.push({cluster:l,pill:d,plate:h,swatch:u,text:f,label:a,price:y})}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 i=this.host.seatR()*2,o=this.host.exportMode||this.host.viewMode()!=="flat"||this.host.seatsPickable()&&e<we;return this.revealed=o||Os(Hi(i,e),Hi(i,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 i=this.clusterAt(this.host.screenToWorld(e));if(!i)return!1;let o=this.host.seatR()*2,s={x:i.bounds.x-o,y:i.bounds.y-o,width:i.bounds.width+o*2,height:i.bounds.height+o*2},n=this.host.stage;if(it(n,s,this.host.zoomBounds(),this.host.framingViewport())<=n.scaleX()*yt)return!1;let l=this.diveTarget(s);return l?(this.host.focusRegion(l,{durationMs:this.host.cameraGlideMs()}),!0):!1}diveTarget(e,i){let o=this.host.stage,s=this.host.framingViewport(),n=this.host.zoomBounds(),r=it(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*Ce),c=s.height/(l*Ce);if(!(a>0)||!(c>0))return null;let d=i??{x:e.x+e.width/2,y:e.y+e.height/2};return{x:d.x-a/2,y:d.y-c/2,width:a,height:c}}glideTowardTap(e){if(this.host.viewMode()!=="flat")return!1;let i=this.host.stage.scaleX(),o=fn(i,this.host.pickableScale());if(o==null||o<=i*yt)return!1;let s=this.host.screenToWorld(e),n=this.host.framingViewport(),r=n.width/(o*Ce),l=n.height/(o*Ce);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 i=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!==i&&(o.style.cursor=i)}clusterAt(e){let i=Or(this.all,e);if(i)return i;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,i){let o=Math.max(e,1e-4),s=i<ue,n=`${o.toFixed(4)}|${i}`;if(n===this.lastFontKey)return!1;this.lastFontKey=n;let r=Ze(qe,i),l=mt/o,a=ei/o;for(let c of this.labels){let{text:d,plate:h,swatch:u,cluster:y}=c,f=mo(c.label,s);d.text(c.price?`${f} \xB7 ${c.price}`:f),d.fontStyle(s?Qt:Ge);let m=r,p=0;for(;d.fontSize(Math.max(1,m/o)),d.letterSpacing(d.fontSize()*Ne),p=Gr(d.fontSize())+d.width()+l*2,!(p<=y.bounds.width||m<=he);)m=Math.max(he,m-1);let g={x:y.bounds.x+y.bounds.width/2,y:y.bounds.y+y.bounds.height/2},b=d.height()+a*2,S=p-l*2,v=g.x-S/2;u.radius(Hr(d.fontSize())),u.position({x:v+u.radius(),y:g.y}),d.offsetX(0),d.offsetY(d.height()/2),d.position({x:v+Gr(d.fontSize()),y:g.y}),h.size({width:p,height:b}),h.offset({x:p/2,y:b/2}),h.cornerRadius(b/2),h.strokeWidth(De/o),h.position(g)}return!0}applyFilterDim(){if(!this.labels.length)return;let e=this.host.categoryFilter(),i=!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),i=!0)}i&&this.host.labelLayer.batchDraw()}boundsForSeats(e,i){if(!e.length)return null;let o=bo(e,this.host.seatR()),s=So(o);s.length||(s=o.map(l=>({categoryKey:l.categoryKey,bounds:l.bounds,rowIds:[l.id],seatCount:l.seatCount})));let n=Br(s);if(!n)return null;let r=s.reduce((l,a)=>a.seatCount>l.seatCount?a:l,s[0]);return{bounds:{x:n.x-i,y:n.y-i,width:n.width+i*2,height:n.height+i*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 i=this.group;if(!i||e===this.visible)return;if(this.visible=e,this.fadeRaf&&(cancelAnimationFrame(this.fadeRaf),this.fadeRaf=0),i.visible(!0),this.host.reducedMotion()){i.opacity(e?1:0),i.visible(e),this.host.labelLayer.batchDraw();return}let o=i.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);i.opacity(o+(s-o)*a),a>=1&&i.visible(s>0),this.host.labelLayer.batchDraw(),this.fadeRaf=a<1?requestAnimationFrame(r):0};this.fadeRaf=requestAnimationFrame(r)}};import{Circle as xd}from"konva/lib/shapes/Circle";import{Line as Id}from"konva/lib/shapes/Line";function Wr(t,e,i,o){let s=t.seatRadius(),n=new xd({x:i.x,y:i.y,radius:s,stroke:o,strokeWidth:3,opacity:.9,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),r=t.viewMode()==="perspective"?t.perspectiveSeatScale(e):1;n.scale({x:r,y:r}),t.overlayLayer.add(n);let l=performance.now(),a=620,c=d=>{if(!n.getLayer())return;let h=Math.min(1,(d-l)/a);n.radius(s*(1+h*1.8)),n.opacity(.9*(1-h)),t.overlayLayer.batchDraw(),h<1?requestAnimationFrame(c):(n.destroy(),t.overlayLayer.batchDraw())};requestAnimationFrame(c)}function Vr(t,e,i){for(let o of e){let s=t.viewMode()==="perspective"&&o.perspectiveAffine?o.outline.map(h=>t.perspectiveLocalPoint(t.projectedSectionPoint(o,h))):o.outline.map(h=>{let u=o.liftWorld>0?t.isoLiftLocal(o.liftWorld):{x:0,y:0};return{x:h.x+u.x,y:h.y+u.y}}),n=s.reduce((h,u)=>({x:h.x+u.x,y:h.y+u.y}),{x:0,y:0});n.x/=s.length,n.y/=s.length;let r=new Id({x:n.x,y:n.y,points:s.flatMap(h=>[h.x-n.x,h.y-n.y]),closed:!0,stroke:i,strokeWidth:3,strokeScaleEnabled:!1,opacity:.92,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!0,shadowColor:i,shadowBlur:14,shadowOpacity:.7});t.overlayLayer.add(r),t.overlayLayer.batchDraw();let l=()=>{r.getLayer()&&(r.destroy(),t.overlayLayer.batchDraw())};if(t.reducedMotion()||typeof document<"u"&&document.hidden){setTimeout(l,520);continue}let a=performance.now(),c=820,d=h=>{if(t.isDestroyed()||!r.getLayer())return;let u=Math.min(1,(h-a)/c),f=1+(1-Math.pow(1-u,3))*.04;r.scale({x:f,y:f}),r.opacity(.92*(1-u)),t.overlayLayer.batchDraw(),u<1?requestAnimationFrame(d):l()};requestAnimationFrame(d)}}import{Group as Ad}from"konva/lib/Group";import{Shape as Ed}from"konva/lib/Shape";import{Group as Pd}from"konva/lib/Group";import{Shape as Md}from"konva/lib/Shape";function Rd(t,e,i){let o=e.length,s={x:(e[o-1].x+e[0].x)/2,y:(e[o-1].y+e[0].y)/2};t.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);t.arcTo(r.x,r.y,l.x,l.y,Math.max(0,Math.min(i,c)))}t.closePath()}function Ve(t,e,i,o){let s=dt(t)>0,n=i.cornerRadius&&i.cornerRadius>0?i.cornerRadius:0;return new Md({...i,sceneFunc(r,l){r.beginPath();let a=d=>{if(d.length){if(n>0&&d.length>=3)return Rd(r,d,n);r.moveTo(d[0].x,d[0].y);for(let h=1;h<d.length;h+=1)r.lineTo(d[h].x,d[h].y);r.closePath()}};o?(d=>{r.moveTo(d.start.x,d.start.y);let h=d.start;for(let u of d.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(h.y-u.center.y,h.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),h=u.end;r.closePath()})(o):a(t);for(let d of e??[]){let h=dt(d)>0;a(h===s?[...d].reverse():d)}r.fillStrokeShape(l)},perfectDrawEnabled:!1})}var ot=class extends Pd{constructor(){super(...arguments);this.viewportCulled=!1}setViewportCulled(i){i!==this.viewportCulled&&(this.viewportCulled=i,i||super._clearSelfAndDescendantCache())}isViewportCulled(){return this.viewportCulled}drawScene(...i){return this.viewportCulled?this:super.drawScene(...i)}drawHit(...i){return this.viewportCulled?this:super.drawHit(...i)}_clearSelfAndDescendantCache(i){if(!this.viewportCulled){super._clearSelfAndDescendantCache(i);return}this._clearCache(i)}};function zr(t,e){if(!e.length)return null;let i=new Ad({listening:!1});for(let o of e){let s=t.viewMode==="perspective"&&o.perspectiveAffine,n=s?o.outline.map(l=>t.perspectiveLocalPoint(t.projectedSectionPoint(o,l))):o.outline,r=s?o.holes.map(l=>l.map(a=>t.perspectiveLocalPoint(t.projectedSectionPoint(o,a)))):o.holes;i.add(Ve(n,r,{fill:gn,stroke:F("#ffffff",.1),strokeWidth:1,listening:!1},s?void 0:o.outlinePath))}return t.bgLayer.add(i),i.moveToTop(),i}function Kr(t,e){let{bounds:i}=t,s=Math.max(i.width,i.height,1)*4+1e3,n=[{x:i.x-s,y:i.y-s},{x:i.x+i.width+s,y:i.y-s},{x:i.x+i.width+s,y:i.y+i.height+s},{x:i.x-s,y:i.y+i.height+s}],r=new Ed({fill:t.canvasBackground,opacity:1-ke,listening:!1,perfectDrawEnabled:!1,sceneFunc:(l,a)=>{let c=d=>{if(d.length){l.moveTo(d[0].x,d[0].y);for(let h=1;h<d.length;h++)l.lineTo(d[h].x,d[h].y);l.closePath()}};l.beginPath(),c(n);for(let d of e){let h=t.viewMode==="perspective"&&d.perspectiveAffine?d.outline.map(u=>t.perspectiveLocalPoint(t.projectedSectionPoint(d,u))):d.outline.map(u=>{let y=d.liftWorld>0?t.isoLiftLocal(d.liftWorld):{x:0,y:0};return{x:u.x+y.x,y:u.y+y.y}});c(dt(h)>0?[...h].reverse():h)}l.fillStrokeShape(a)}});return t.overlayLayer.add(r),r.moveToTop(),r}import{Rect as Fh}from"konva/lib/shapes/Rect";import{Path as Bh}from"konva/lib/shapes/Path";import{Text as _d}from"konva/lib/shapes/Text";function Xr(t){let e=_e,i=new _d({fontSize:ye,fontStyle:"600",fontFamily:t.labelFont(),listening:!1}),o=t.seatR*2-3;for(let s of t.seats){if(s.kind==="booth"){e=Math.min(e,_e);continue}let n=ye*t.seatLabelScale(s);i.fontSize(n),i.text(Wt(s.displayLabel??s.label));let r=i.width()>o?Math.max(ut,n*o/i.width()):n;e=Math.min(e,r)}return i.destroy(),H/Math.max(ut,e)}var vo={top:0,right:0,bottom:0,left:0};function Yr(t){let e=i=>typeof i=="number"&&Number.isFinite(i)&&i>0?i:0;return t?{top:e(t.top),right:e(t.right),bottom:e(t.bottom),left:e(t.left)}:{...vo}}var Fd=.7;function Ur(t,e,i){let{top:o,right:s,bottom:n,left:r}=i,l=(u,y,f)=>{let m=u+y,p=f*Fd;if(m<=p||m<=0)return[u,y];let g=p/m;return[u*g,y*g]},[a,c]=l(r,s,t),[d,h]=l(o,n,e);return{x:a,y:d,width:Math.max(1,t-a-c),height:Math.max(1,e-d-h)}}function $r(t){return{x:t.x(),y:t.y(),scale:t.scaleX()}}function qr(t,e){return!Number.isFinite(e.x)||!Number.isFinite(e.y)||!(e.scale>0)?!1:(t.scale({x:e.scale,y:e.scale}),t.position({x:e.x,y:e.y}),!0)}function mi(t){return{x:t.x+t.width/2,y:t.y+t.height/2}}function Zr(t,e){let i=e({x:t.x,y:t.y}),o=e({x:t.x+t.width,y:t.y+t.height});return{x:Math.min(i.x,o.x),y:Math.min(i.y,o.y),width:Math.abs(o.x-i.x),height:Math.abs(o.y-i.y)}}function Qr(){return typeof navigator<"u"&&navigator.maxTouchPoints>0?Ys:Xs}function Jr(t){return Math.max(t*1.05,Ns,ce*1.3)}var Bd=56;function ea(t){return Bd/(2*Math.max(t,1e-4))}function st(t,e){let i=1/0,o=-1/0,s=1/0,n=-1/0;for(let r of t)i=Math.min(i,r.x),o=Math.max(o,r.x),s=Math.min(s,r.y),n=Math.max(n,r.y);return i-=e,o+=e,s-=e,n+=e,{x:i,y:s,width:Math.max(40,o-i),height:Math.max(40,n-s)}}function ta(t){let{stageWidth:e,stageHeight:i,fullBounds:o,visibleBounds:s,seatPoints:n,minScale:r}=t;if(!n.length)return null;let l=1.12;if(Math.min(e/(o.width*l),i/(o.height*l))>=r)return null;let c=t.tapAnchor??{x:s.x+s.width/2,y:s.y+s.height/2},d=n[0],h=1/0;for(let m of n){let p=(m.x-c.x)**2+(m.y-c.y)**2;p<h&&(d=m,h=p)}let u=e/(r*l),y=i/(r*l),f=st(n,0);return{bounds:{x:jr(d.x,u,f.x,f.width),y:jr(d.y,y,f.y,f.height),width:u,height:y},minScale:r}}function jr(t,e,i,o){return o<=e?i+o/2-e/2:Math.min(Math.max(t-e/2,i),i+o-e)}var ra=.5,V=Math.SQRT1_2,Od="#f3f4f6",ia=4;function Dd(t){let e=t.fraction;return typeof e!="number"||!Number.isFinite(e)?ra:Math.min(1,Math.max(0,e))}function Gd(t){return t==="booked"||t==="not_for_sale"?ii:ti}function oa(t,e){return Number.parseInt(t.slice(e,e+2),16)}function sa(t){let e=t.trim();if(!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(e))return null;if(e.length===7)return e.toLowerCase();let[,i,o,s]=e.toLowerCase();return`#${i}${i}${o}${o}${s}${s}`}function Nd(t,e,i){let o=sa(t),s=sa(e);if(!o||!s)return t;let n=Math.min(1,Math.max(0,i)),r="#";for(let l=1;l<7;l+=2){let a=Math.round(oa(o,l)*(1-n)+oa(s,l)*n);r+=a.toString(16).padStart(2,"0")}return r}function na(t,e,i,o){let s=i*4,n=e*V,r=-e*V,l=o*V*2*s,a=o*-V*2*s,c=n+s*V,d=r+s*V,h=n-s*V,u=r-s*V;t.beginPath(),t.moveTo(c,d),t.lineTo(h,u),t.lineTo(h+l,u+a),t.lineTo(c+l,d+a),t.closePath(),t.clip()}function Hd(t,e){let i=e*4,o=Math.max(e*.45,1);t.beginPath();for(let s=-ia;s<=ia;s++){let n=s*o*2,r=n+o,l=n*V,a=-n*V,c=r*V,d=-r*V;t.moveTo(l+i*V,a+i*V),t.lineTo(l-i*V,a-i*V),t.lineTo(c-i*V,d-i*V),t.lineTo(c+i*V,d+i*V),t.closePath()}t.clip()}function yi(t,e){t._sceneFunc(e)}function aa(t){let e=this,i=e.attrs,o=i.markRadius||1,s=i.fill,n=e.getStage(),r=Math.abs((n?n.scaleX():1)*(e.scaleX()||1))||1;if(o*2*r<16){i.fill=i.markMidtone??s,yi(e,t),i.fill=s;return}let a=(1-2*(i.markFraction??ra))*o;t.save(),na(t,a,o,1),i.fill=i.markBase??s,yi(e,t),t.restore(),t.save(),na(t,a,o,-1),i.fill=i.markFill??s,yi(e,t),i.markHatch&&(Hd(t,o),i.fill=Od,yi(e,t)),t.restore(),i.fill=s}function Wd(t,e,i,o,s,n){let r=Dd(e),l=Gd(i),a=t.attrs;a.markFraction=r,a.markBase=o,a.markFill=l,a.markMidtone=Nd(o,l,1-r),a.markHatch=n,a.markRadius=s>0?s:1,t.fill(a.markMidtone),t.stroke(""),t.strokeWidth(0),t.dash([]),t.opacity(1),t.sceneFunc(aa)}function Vd(t){t.setAttr("sceneFunc",void 0)}function wo(t){return t.attrs.sceneFunc===aa}var gi=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,i){let o=new Set;for(let[s,n]of Object.entries(e))i.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,i,o,s,n,r,l){let a=l?void 0:this.marks.get(i);if(!a){wo(e)&&Vd(e);return}Wd(e,a,o,s,n,r)}};function bi(t){let e=t.getClientRect({skipTransform:!0,skipShadow:!0});!Number.isFinite(e.width)||!Number.isFinite(e.height)||(t.offsetX(e.x+e.width/2),t.offsetY(e.y+e.height/2))}var la=.85,zd=1,Kd=.7,Xd=.8,ca="rgba(0,0,0,0)",Yd=[2,2],Ud=1,ko=.6;function da(t){return B(t)?"#334155":"#e2e8f0"}function ha(t,e,i){return t==="held"?{fill:ti,stroke:da(e),strokeWidth:Ud,dash:[...Yd],opacity:1,scale:1}:t==="booked"||t==="not_for_sale"?i?{fill:ca,stroke:ii,strokeWidth:1.5,dash:[],opacity:.9,scale:la}:{fill:ca,stroke:da(e),strokeWidth:zd,dash:[],opacity:t==="booked"?Kd:Xd,scale:la}:null}var Lo=1e6;function $d(){return typeof navigator>"u"?!1:navigator.maxTouchPoints>0&&/AppleWebKit/i.test(navigator.userAgent)}var Si=class{constructor(e,i=$d()){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 i=this.toLocal(e.clientX,e.clientY);this.updatePointer(e.pointerId,i)&&this.applyPointerMove(i)};this.onPointerEnd=e=>{this.useWebKitTouchEvents&&e.pointerType==="touch"||this.endPointer(e.pointerId)};this.onTouchStart=e=>{e.preventDefault(),this.rect=null;for(let i=0;i<e.changedTouches.length;i+=1){let o=e.changedTouches.item(i);o&&this.beginPointer(Lo+o.identifier,this.toLocal(o.clientX,o.clientY),"touch",0)}};this.onTouchMove=e=>{e.preventDefault();let i=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(Lo+s.identifier,n)&&(i=n)}i&&this.applyPointerMove(i)};this.onTouchEnd=e=>{e.preventDefault();for(let i=0;i<e.changedTouches.length;i+=1){let o=e.changedTouches.item(i);o&&this.endPointer(Lo+o.identifier)}};this.host=e,this.useWebKitTouchEvents=i}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<Hs}invalidateRect(){this.rect=null}toLocal(e,i){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:i-o.top}}beginPointer(e,i,o,s){if(this.host.cancelGlide(),this.pointers.set(e,i),this.pointers.size===1)this.movedPx=0,this.singleTouch=o==="touch",this.singleTouch&&this.host.touchProbeStart?.(i),this.pinch=null,this.panStart=i,this.panStarted=!1,this.host.marqueeShouldStart({pointerType:o,button:s})?(this.host.beginMarquee(i),this.panLast=null):this.panLast=i;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=Pe+1}}updatePointer(e,i){return this.pointers.has(e)?(this.pointers.set(e,i),this.pointers.size===1&&this.panStart?this.movedPx=Math.max(this.movedPx,Math.hypot(i.x-this.panStart.x,i.y-this.panStart.y)):this.pointers.size>=2&&(this.movedPx=Pe+1),!0):!1}applyPointerMove(e){if(this.singleTouch&&this.pointers.size===1&&(this.panStarted||this.movedPx>Pe?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[i,o]=[...this.pointers.values()],s=Math.hypot(o.x-i.x,o.y-i.y);if(this.pinch.startDist<1)return;let n={x:(i.x+o.x)/2,y:(i.y+o.y)/2},{min:r,max:l}=this.host.zoomBounds(),a=z(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<=Pe)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 qd}from"konva/lib/shapes/Circle";import{Group as Zd}from"konva/lib/Group";import{Text as jd}from"konva/lib/shapes/Text";var ua=13,Qd=15,Jd=.3,eh=.08;function ya(t,e,i){return!!(t&&i!==t||e&&!e.has(i))}function th(t,e){return!e||t.available==null?`cap ${t.capacity}`:t.available<=0?G("map.soldOut"):G("map.seatsLeft",{count:t.available})}function ih(t,e){return e&&t.available!=null&&t.available<=0}function ga(t){for(let e of t.gaById.values()){let i=t.filteredOut(e.categoryKey),o=t.overviewHidden(e),s=ih(e,t.pickerMode),n=t.pickerMode?e.selected??0:0;e.polygon.opacity(o?0:t.dimmed(e.categoryKey)?Fe*eh:s?Fe*Jd:Fe),e.polygon.listening(!t.exportMode&&!o&&!i&&!s),e.polygon.stroke(n>0?t.selectionColor:e.strokeColor),e.polygon.strokeWidth(n>0?3:1.5),oh(t,e,s,n,o,t.dimmed(e.categoryKey))}}function oh(t,e,i,o,s,n){if(e.capacityNode){let r=th(e,t.pickerMode);e.capacityNode.text()!==r&&(e.capacityNode.text(r),e.capacityNode.offsetX(e.capacityNode.width()/2)),e.capacityNode.opacity(i?.75:1)}sh(t,e,s||n),o>0&&!s?rh(t,e,o):e.chip&&e.chip.visible(!1)}var Co=9,pa=.86;function sh(t,e,i){let{labelNode:o,capacityNode:s}=e;if(!o&&!s)return;let n=Math.max(t.effScale(),1e-4);if(i){o?.visible(!1),s?.visible(!1);return}if(!t.pickerMode){o?.visible(t.labelLegible(o.fontSize())),s?.visible(t.labelLegible(s.fontSize()));return}let r=nh(e,n),l=fa(o,Gt,r.width*pa,n),a=fa(s,Nt,r.width*pa,n),c=l!=null,d=a!=null&&c&&l+a+Co<=r.height;ma(o,c?l:null,e.labelPoint.y-Co/n,n),ma(s,d?a:null,e.labelPoint.y+Co/n,n)}function nh(t,e){let i=1/0,o=-1/0,s=1/0,n=-1/0;for(let r of t.points)r.x<i&&(i=r.x),r.x>o&&(o=r.x),r.y<s&&(s=r.y),r.y>n&&(n=r.y);return Number.isFinite(i)?{width:(o-i)*e,height:(n-s)*e}:{width:0,height:0}}function fa(t,e,i,o){if(!t||!t.text())return null;t.fontSize(e/o);let s=t.width()*o;if(s<=i||s<=0)return e;let n=e*(i/s);return n>=H?n:null}function ma(t,e,i,o){if(t){if(e==null){t.visible(!1);return}t.fontSize(e/o),t.offsetX(t.width()/2),t.offsetY(t.height()/2),t.y(i),t.visible(!0)}}function rh(t,e,i){if(!e.chip){let o=new Zd({x:e.labelPoint.x,y:e.labelPoint.y-ua-16,listening:!1}),s=new qd({radius:ua,fill:t.selectionColor,listening:!1,perfectDrawEnabled:!1}),n=new jd({text:String(i),fontSize:Qd,fontStyle:"800",fontFamily:t.labelFont(),fill:"#0b0d12",listening:!1,perfectDrawEnabled:!1});o.add(s),o.add(n),t.bgLayer.add(o),e.chip=o,e.chipText=n}e.chipText&&e.chipText.text()!==String(i)&&e.chipText.text(String(i)),e.chipText&&(e.chipText.offsetX(e.chipText.width()/2),e.chipText.offsetY(e.chipText.height()/2)),e.chip.visible(!0),e.chip.moveToTop()}function ba(t,e){let i=!1;for(let[o,s]of Object.entries(e)){let n=t.get(o);n&&(s.available!==void 0&&n.available!==s.available&&(n.available=s.available,i=!0),s.selected!==void 0&&n.selected!==s.selected&&(n.selected=s.selected,i=!0))}return i}function Sa(t){let{focusedId:e}=t;if(!e)return null;let i=new Set([e]),o=t.sectionOf(e);if(o!=null){for(let c of t.seats){let d=t.seatId(c);t.sectionOf(d)===o&&i.add(d)}return i}let s=t.seats.find(c=>t.seatId(c)===e);if(!s)return i;let n=t.seatPoint(s),r=t.seatPitch>0?t.seatPitch:t.seatRadius*2,l=6*(r>0?r:1),a=l*l;for(let c of t.seats){let d=t.seatPoint(c),h=d.x-n.x,u=d.y-n.y;h*h+u*u<=a&&i.add(t.seatId(c))}return i}function va(t,e,i){let o=i(t);return o!=null&&o===i(e)}var ah=.2,lh=.55;function wa(t,e){return t.startsWith("#")?j(e,t,ah):t}function ka(t){return B(t)?"#0b1220":"#ffffff"}function ch(t){return j(t,ka(t),lh)}function La(t){return t>0?Math.min(1,t/le):1}function Ca(t){let{categoryFilter:e,status:i}=t;return!e||t.selected||i!=="free"&&!(i==="held"&&!t.ownHold)?!1:!e.has(t.categoryKey)}function Ta(t,e,i){let o=typeof t=="string"&&t.startsWith("#")?t:e;return i?ch(o):ka(o)}function xa(t){let{width:e,height:i}=t;return!(e>0)||!(i>0)?"hidden":e===t.stageWidth&&i===t.stageHeight?"unchanged":{width:e,height:i}}import{Rect as Ia}from"konva/lib/shapes/Rect";import{Text as dh}from"konva/lib/shapes/Text";function Pa(t){let e=t.effScale(),i=t.stage.scaleX(),o={width:t.stage.width(),height:t.stage.height()},s=m=>Math.round(m*100)/100,n=new Map(t.overlayLayer.find(".selection-ring").map(m=>[String(m.getAttr("seatId")??""),String(m.getAttr("ringColor")??t.effSelection)])),r=t.seats.map(m=>{let p=t.circleById.get(m.id),g=t.boothLabelById.get(m.id)??t.seatLabelById.get(m.id),b=t.viewMode==="perspective"?t.perspectiveSeatScale.get(m.id)??1:1,S=(t.viewMode==="perspective"?i:e)*b,v=m.kind==="booth"?_e:ye*t.seatLabelScale(m),k=t.viewMode==="perspective"&&m.kind!=="booth"?e*b:S,w=s((g?.fontSize()??v)*k),L=t.worldToScreen(m),C=g?g.width()*i*b:0,T=g?g.height()*(t.viewMode==="perspective"&&m.kind==="booth"?i:e)*b:0,x=L.x-C/2<0||L.x+C/2>o.width||L.y-T/2<0||L.y+T/2>o.height,I=t.focusedSeatOpacity(m.id,p?.getAbsoluteOpacity()??0),P=t.seatSection.get(m.id),A=!!g?.isVisible()&&I>=.5&&!x,R;A||(I<.5?R="dimmed-or-unavailable":w<H?R="below-minimum-size":x?R="outside-viewport":g?R="renderer-hidden":R=t.seatLabelDrops.get(m.id)??(t.seatLabelRungOpen()?"clutter-or-fit":"below-label-rung"));let M=p instanceof Ia?p.width()*i*b:t.seatR*2*S,_=p instanceof Ia?p.height()*(t.viewMode==="perspective"?i:e)*b:t.seatR*2*S,$=2*(t.seatR*S+Oe),X=p?.fill(),Y=g?.fill(),J=t.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,...P?{sectionId:P.id}:{},...P?.zone?{zoneId:P.zone}:{},status:t.statusById.get(m.id)??"free",selected:t.selection.has(m.id),visible:A,renderedFontPx:w,fill:typeof X=="string"?X:"",ink:typeof Y=="string"?Y:p?t.seatLabelInk(m,p):t.seatPreferredLabelInk(m),...n.has(m.id)?{selectionRingColor:n.get(m.id)}:{},opacity:s(I),...J?{accessibilityMarker:{glyphVisible:J.isVisible(),glyphWidthPx:s(xe*Math.abs(D?.x??0)),emphasizedByFilter:t.accessGlyphFilterEmphasized(m.id)}}:{},pointerTarget:{active:!t.cached&&!t.seatViewportCulled(m.id)&&!!p?.isVisible()&&!!p?.isListening()&&t.isSelectable(m.id),directWidthPx:s(M),directHeightPx:s(_),effectiveMinimumPx:s(Math.max(Math.min(M,_),$))},screenCenter:{x:s(L.x),y:s(L.y)},...A?{screenBox:{x:s(L.x-C/2),y:s(L.y-T/2),width:s(C),height:s(T)}}:{},...R?{hiddenReason:R}:{}}}),l=r.filter(m=>m.visible).length,a=(m,p,g,b,S,v)=>{let k=Je({x:b.x(),y:b.y()},b.width(),b.height(),b.rotation()),w=v&&v.liftWorld>0?t.isoLiftLocal(v.liftWorld):{x:0,y:0},L=W(k.map(A=>t.worldToScreen({x:A.x+w.x,y:A.y+w.y}))),C=s(b.opacity()),T=b.fill(),x=L.x+L.width<0||L.x>o.width||L.y+L.height<0||L.y>o.height,I=b.isVisible()&&C>.05&&!x,P=v?ui({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:I,renderedFontPx:s(b.fontSize()*i),opacity:C,fill:S,ink:typeof T=="string"?T:"",...P==null?{}:{fitsContainer:P},...I?{screenBox:{x:s(L.x),y:s(L.y),width:s(L.width),height:s(L.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},d=[...t.sections.map(m=>a(m.id,"section","name",m.nameLabel,c(m),m)),...t.sections.map(m=>a(`${m.id}:availability`,"section","availability",m.subLabel,c(m),m)),...t.zones.flatMap(m=>[a(m.id,"zone","name",m.label,m.background),...m.sub?[a(`${m.id}:price`,"zone","price",m.sub,m.background)]:[]])],h=[...t.gaById].map(([m,p])=>{let g=p.points.map(x=>t.worldToScreen(x)),b=Math.min(...g.map(x=>x.x)),S=Math.min(...g.map(x=>x.y)),v=Math.max(...g.map(x=>x.x)),k=Math.max(...g.map(x=>x.y)),w=v<0||b>o.width||k<0||S>o.height,L=s(p.polygon.opacity()),C=L>=.1&&!w,T=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:L,fill:typeof T=="string"?T:"",effectiveBackground:p.effectiveBackground,...C?{screenBox:{x:s(b),y:s(S),width:s(v-b),height:s(k-S)}}:{}}}),u=[...t.freeTextById].map(([m,p])=>{let{node:g,background:b,kind:S}=p,v=t.worldToScreen({x:g.x(),y:g.y()}),k=g.width()*i,w=g.height()*e,L=v.x-g.offsetX()*i,C=v.y-g.offsetY()*e,T=s(g.fontSize()*e),x=L+k<0||L>o.width||C+w<0||C>o.height,I=g.isVisible()&&!x,P=g.fill(),A=s(g.getAbsoluteOpacity()),R;return I||(T<H?R="below-minimum-size":x?R="outside-viewport":R="renderer-hidden"),{objectId:p.objectId??m,kind:S,text:g.text(),visible:I,renderedFontPx:T,ink:typeof P=="string"?P:"",background:b,opacity:A,...I?{screenBox:{x:s(L),y:s(C),width:s(k),height:s(w)}}:{},...R?{hiddenReason:R}:{}}}),y=t.labelGroup.find(m=>m.getAttr("rowLabel")===!0).filter(m=>m instanceof dh).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)}}}}),f=t.sections.filter(m=>m.blockPoly.opacity()>.05);return{viewport:o,projection:t.viewMode,...t.viewMode==="perspective"?{perspective:{model:"pinhole-exact-seat-anchors",sectionSurfaceModel:"tangent-plane",exactSeatAnchorCount:t.perspectiveSeatProjected.size,depthSorted:!0}}:{},canvasBackground:t.canvasBackground,effectiveScale:s(e),rung:t.getRung(),minimumVisibleLabelPx:H,totalLabelledBookableUnits:r.length,visibleLabels:l,hiddenLabels:r.length-l,totalBookableUnits:r.length+h.reduce((m,p)=>m+p.capacity,0),selectionRingSeatIds:t.overlayLayer.find(".selection-ring").map(m=>String(m.getAttr("seatId")??"")).filter(Boolean),selectionRingColor:t.effSelection,focusedSectionId:t.focusedSectionId,focusBackdropVisible:!!t.focusBackdrop?.isVisible(),categoryFilterKeys:t.categoryFilter?[...t.categoryFilter].sort():null,overviewStyle:{visibleSectionShells:f.length,categoryPaintedSectionShells:f.filter(m=>{let p=m.blockPoly.fill();return typeof p!="string"||!Xi(t.canvasBackground,p)}).length,tintedSectionShells:f.filter(m=>{let p=m.blockPoly.fill();return typeof p=="string"&&kn(t.canvasBackground,p)}).length,visibleCategoryDetailOutlines:t.sections.filter(m=>m.outlinePoly.opacity()>.05).length,visibleSectionRowHints:0,visibleSectionAvailabilityLabels:t.sections.filter(m=>m.subLabel.opacity()>.05).length,visibleSectionGADetails:[...t.gaById.values()].filter(m=>m.sectionId!=null&&m.polygon.opacity()>.05).length},labels:r,gaAreas:h,hierarchyLabels:d,freeTextLabels:u,rowLabels:y}}import{Circle as hh}from"konva/lib/shapes/Circle";import{Ellipse as uh}from"konva/lib/shapes/Ellipse";import{Line as Ma}from"konva/lib/shapes/Line";import{Arrow as ph}from"konva/lib/shapes/Arrow";import{Path as fh}from"konva/lib/shapes/Path";import{Rect as kt}from"konva/lib/shapes/Rect";import{Text as xo}from"konva/lib/shapes/Text";import{Image as Ra}from"konva/lib/shapes/Image";function Aa(t,e){if(!e.url||e.visible===!1)return;let i=new window.Image;t.trackAssetImage(i,e.url,"Buyer background image",()=>{let o=i.naturalWidth||4,s=i.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,d=c*(s*a.height/(o*a.width)),h=new Ra({image:i,x:e.center.x,y:e.center.y,offsetX:c/2,offsetY:d/2,width:c,height:d,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});t.bgLayer.add(h),h.moveToBottom(),t.bgLayer.batchDraw()})}function Ea(t,e){let i=new window.Image,o=new Ra({image:i,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:z(e.opacity??1,0,1),listening:!1,perfectDrawEnabled:!1});e.layer==="foreground"?t.fgDecorGroup.add(o):t.bgLayer.add(o),e.role&&t.landmarkBoxes.push(W(Je({x:e.x+e.width/2,y:e.y+e.height/2},e.width,e.height,e.rotation??0))),t.trackAssetImage(i,e.href,`Decor image \u201C${e.label||e.id}\u201D`,()=>{let s=o.getLayer();s&&s.batchDraw()})}function _a(t,e){if(e.shape==="round")t.bgLayer.add(new hh({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;t.bgLayer.add(new kt({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 i=Lt(t,t.bgLayer,e.displayLabel??e.label,e.center.x,e.center.y,"#cbd5e1",12,!0);t.freeTextById.set(e.id,{node:i,background:"#232c40",kind:"table"})}var mh=8,yh=6;function Fa(t,e){let i=e.background?.color??t.canvasBackground,o=e.color??re(i,t.theme.textColor??ur),s=e.semanticKind==="icon"?Ps(e.iconKey):void 0;if(s){let d=e.fontSize/24,h=new fh({x:e.position.x,y:e.position.y,data:s,rotation:e.rotation,scaleX:d,scaleY:d,stroke:o,strokeWidth:2,lineCap:"round",lineJoin:"round",fillEnabled:!1,listening:!1,perfectDrawEnabled:!1});t.iconNodeById.set(e.id,{node:h,fontSize:e.fontSize}),t.bgLayer.add(h);return}let n=e.background?.padding??0,r=e.opacity??1,l=Ss(e),a=new xo({x:e.position.x,y:e.position.y,text:e.text,fontSize:e.fontSize,rotation:e.rotation,fontStyle:no(e.bold,e.italic,"600"),fill:o,fontFamily:e.fontFamily??t.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 d=a.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:!0}),h=Math.max(mh,e.fontSize*.35),u=Math.max(yh,e.fontSize*.28);c=new kt({x:e.position.x,y:e.position.y,offsetX:-(d.x-h),offsetY:-(d.y-u),width:d.width+h*2,height:d.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"}),t.bgLayer.add(c)}t.freeTextById.set(e.id,{node:a,backdrop:c,background:i,kind:l?"direct-landmark":"free-text"}),t.bgLayer.add(a)}function Ba(t,e){let i=e.fill??t.theme.decorFill??hr,o=e.role==="stage",s=e.role==="reference-focal",n=!!e.role&&!o,r=bs(e),l=ie(t.canvasBackground),a=s?l.focalFill:i,c=e.kind==="line"||e.kind==="polyline",d=e.stroke?.color??(o?Te(a,.28):s?l.focalStroke:c?"#9aa3b5":void 0),h=e.stroke?.width??(o?1:s||c?2:0),u=e.opacity!=null?z(e.opacity,.1,1):1,y=0,f=0,m=null;if(c&&e.points&&e.points.length>=2){y=e.points.reduce((S,v)=>S+v.x,0)/e.points.length,f=e.points.reduce((S,v)=>S+v.y,0)/e.points.length;let p=Ms(e),g=Rs(h),b=new ph({points:e.points.flatMap(S=>[S.x,S.y]),closed:!1,x:y,y:f,offsetX:y,offsetY:f,rotation:e.rotation??0,stroke:d,fill:d,strokeWidth:h,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),t.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,Te(a,.12)]}:{fill:a};y=e.x+e.width/2,f=e.y+e.height/2,m={x:e.x,y:e.y,width:e.width,height:e.height},t.bgLayer.add(new kt({x:y,y:f,offsetX:e.width/2,offsetY:e.height/2,rotation:e.rotation??0,width:e.width,height:e.height,...p,stroke:d,strokeWidth:h,cornerRadius:z(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){y=e.x+e.width/2,f=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,Te(a,.12)]}:{fill:a};t.bgLayer.add(new uh({x:y,y:f,rotation:e.rotation??0,radiusX:e.width/2,radiusY:e.height/2,...p,stroke:d,strokeWidth:h,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=W(e.points);y=e.points.reduce((S,v)=>S+v.x,0)/e.points.length,f=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,Te(a,.12)]}:{fill:a};t.bgLayer.add(new Ma({points:p,closed:!0,x:y,y:f,offsetX:y,offsetY:f,rotation:e.rotation??0,...b,stroke:d,strokeWidth:h,opacity:u,listening:!1}))}m&&e.role&&t.landmarkBoxes.push(m);for(let p of es(e))t.bgLayer.add(new Ma({points:p.points.flatMap(g=>[g.x,g.y]),closed:p.closed,x:y,y:f,offsetX:y,offsetY:f,rotation:e.rotation??0,stroke:p.ink??Jo,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}=bh(t,y,f,e.label,a,m,e.labelStyle);t.primaryFocalLabels.set(p,g),t.freeTextById.set(e.id,{node:p,background:a,kind:"stage"})}else if(n){let p=s||r,g=Lt(t,t.bgLayer,e.label,y,f,p?re(a,"#e6e9f0"):"#9aa3b5",p?18:12,!1);p&&t.primaryFocalLabels.set(g,{targetPx:18,trackingRatio:0,ink:String(g.fill()??""),plateInk:String(g.fill()??""),plate:new kt({width:0,height:0,opacity:0,listening:!1})}),t.freeTextById.set(e.id,{node:g,background:a,kind:"decor"})}else{let p=Lt(t,t.bgLayer,e.label,y,f,"#cbd5e1",16,!0);t.freeTextById.set(e.id,{node:p,background:a,kind:"decor"})}}var To=22,gh=H,vi=6;function bh(t,e,i,o,s,n,r){let l=r?.size??To,a=r?.color??t.theme.textColor??"#e6e9f0",c=r?.color??re(s,a),d=n?n.x+n.width/2:e,h=n?n.y+n.height/2:i,u=Sh(t.canvasBackground,s),y=new kt({x:d,y:h,width:0,height:0,cornerRadius:4,fill:u,opacity:0,listening:!1,perfectDrawEnabled:!1});t.bgLayer.add(y);let f=new xo({x:d,y:h,text:o,fontSize:l,fontStyle:no(r?.bold??!0,r?.italic,"normal"),letterSpacing:l*(4/To),fontFamily:r?.fontFamily??t.labelFont(),fill:c,textDecoration:r?.underline?"underline":"",listening:!1,perfectDrawEnabled:!1});return f.offsetX(f.width()/2),f.offsetY(f.height()/2),t.bgLayer.add(f),{node:f,spec:{targetPx:l,...n?{bounds:n}:{},trackingRatio:4/To,ink:c,plateInk:r?.color??re(u,a),plate:y}}}function Sh(t,e){return j(e,B(t)?"#ffffff":"#000000",.34)}function Oa(t,e,i,o){let s=Math.max(i,1e-4),n=e.targetPx/s,r=y=>{t.letterSpacing(y*e.trackingRatio),o(t,y)};r(n);let l=e.bounds;if(!l){e.plate.opacity(0),t.fill(e.ink);return}let a={width:l.width-vi*2,height:l.height-vi*2},c=Math.min(1,a.width/Math.max(t.width(),1e-6),a.height/Math.max(t.height(),1e-6));if(c<1&&(n=Math.max(gh/s,n*c),r(n)),t.width()<=a.width&&t.height()<=a.height){e.plate.opacity(0),t.fill(e.ink);return}let h=t.width()+vi*2,u=t.height()+vi;e.plate.size({width:h,height:u}),e.plate.offset({x:h/2,y:u/2}),e.plate.opacity(1),t.fill(e.plateInk)}function Da(t,e){let i=t.catColor.get(e.categoryKey)??"#6e7bff",o=t.canvasBackground,s=us(i,o,Fe),n=t.theme.textColor??"#e6e9f0",r=re(s,n),l=Ve(e.points,e.holes,{fill:i,opacity:Fe,stroke:i,strokeWidth:1.5,cornerRadius:e.cornerRadius});l.setAttr("gaId",e.id),l.on("click tap",u=>{t.isGhostClick(u)||t.opts.onGAClick?.(e.id)}),l.on("mouseenter",()=>{t.container.style.cursor="pointer"}),l.on("mouseleave",()=>{t.container.style.cursor="default"}),t.bgLayer.add(l);let a=_t(e.points,e.holes),c=t.sections.find(u=>te(a,u.outline,u.holes)),d=Lt(t,t.bgLayer,e.displayLabel??e.label,a.x,a.y-8,r,Gt,!1),h=Lt(t,t.bgLayer,`cap ${e.capacity}`,a.x,a.y+10,r,Nt,!1);t.freeTextById.set(`${e.id}:label`,{objectId:e.id,node:d,background:s,kind:"ga-label",categoryKey:e.categoryKey}),t.freeTextById.set(`${e.id}:capacity`,{objectId:e.id,node:h,background:s,kind:"ga-capacity",categoryKey:e.categoryKey}),t.gaById.set(e.id,{label:e.displayLabel??e.label,capacity:e.capacity,categoryKey:e.categoryKey,points:e.points,polygon:l,effectiveBackground:s,strokeColor:i,labelPoint:a,labelNode:d,capacityNode:h,...c?{sectionId:c.logicalId}:{}})}function Lt(t,e,i,o,s,n,r,l){let a=new xo({x:o,y:s,text:i,fontSize:r,fontStyle:l?"700":"500",fontFamily:t.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 vh}from"konva/lib/shapes/Text";var wh=4;function Ga(t){return B(t)?{plate:"#ffffff",stroke:"rgba(15,23,42,0.18)"}:{plate:"#0f1622",stroke:"rgba(226,232,240,0.22)"}}function kh(t,e,i,o){let s=Math.max(0,Math.min(o,e/2,i/2));t.beginPath(),t.moveTo(s,0),t.arcTo(e,0,e,i,s),t.arcTo(e,i,0,i,s),t.arcTo(0,i,0,0,s),t.arcTo(0,0,e,0,s),t.closePath()}function Na(t,e){t.padding(wh),t.shadowBlur(0),t.shadowOpacity(0),t.sceneFunc(function(o){let s=this.width(),n=this.height();o.save(),kh(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(),vh.prototype._sceneFunc.call(this,o)})}function Ha(t,e){let i=[],o=e.canvasBackground,s=new Map,n=(c,d)=>{let h=s.get(c)??[];h.push(d),s.set(c,h)};for(let c of e.seats){if(c.kind==="booth")continue;let d=c.logicalRowId??c.rowId;n(d,c),d!==c.rowId&&n(c.rowId,c)}let r=c=>c.logicalSeatIndex??Number(c.id.split(":").pop()??0);for(let c of t.objects){if(c.type!=="row")continue;let d=c.segmentedRow?.repeatLabelOnComponents===!0;if(c.segmentedRow&&!d&&c.segmentedRow.componentIndex!==0)continue;let h=d?c.labelPresentation:c.segmentedRow?.labelPresentation??c.labelPresentation;if(h?.visible===!1||h?.positionPreset==="none")continue;let u=c.segmentedRow&&!d?c.segmentedRow.groupId:c.id,y=(s.get(u)??[]).slice().sort((R,M)=>r(R)-r(M));if(!y.length)continue;let f=y[0],m=y[y.length-1],p=h?.labelStyle,g=h?.style==="pill"?Ga(o):null,b=g?g.plate:o,S=Ie(b,p?.color,e.theme.rowLabelColor??e.theme.textColor??"#e6e9f0",Ue),v=p?.size??hs,k=h?.rotation??0,w=e.objectFilteredOut(c)?.15:1,L=y.reduce((R,M)=>R??e.seatSection.get(M.id),void 0),T=c.segmentedRow?.displayLabel??c.displayLabel??Oi(c.label,L?.label);if(!T)continue;let x=L?[...new Set([L.id,L.logicalId,L.zone].filter(R=>!!R))]:void 0,I=(R,M,_)=>i.push({text:T,x:R,y:M,rotation:k,fontSize:v,ink:S,opacity:w,...g?{pill:g}:{},...x?.length?{focusKeys:x}:{},..._?{automaticAway:_}:{}});if(h?.position){I(h.position.x,h.position.y);continue}let P=e.seatR+12,A=h?.positionPreset??"start";if(A==="start"||A==="both"){let R=c.rotation*Math.PI/180,M={x:-Math.cos(R),y:-Math.sin(R)};I(f.x+M.x*P,f.y+M.y*P,M)}if(A==="end"||A==="both"){let R=(c.rotation+c.curve)*Math.PI/180,M={x:Math.cos(R),y:Math.sin(R)};I(m.x+M.x*P,m.y+M.y*P,M)}}let l=(e.seatR+12)*2.2,a=[];for(let c of i){let d=a.find(h=>h.text===c.text&&Math.hypot(h.x-c.x,h.y-c.y)<=l);if(d){d.x=(d.x+c.x)/2,d.y=(d.y+c.y)/2;continue}a.push(c)}return a}function Io(t,e,i=Q){let o=t.rotation()*Math.PI/180,s=Math.abs(Math.cos(o)),n=Math.abs(Math.sin(o)),r=(t.width()*s+t.height()*n)/2+i,l=(t.width()*n+t.height()*s)/2+i;return{x:e.x-r,y:e.y-l,width:r*2,height:l*2}}function Wa(t,e,i,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 y=l*u;a.push({x:r.x*y,y:r.y*y},{x:-r.x*y,y:-r.y*y},{x:n.x*y,y:n.y*y},{x:(n.x+r.x)*y,y:(n.y+r.y)*y},{x:(n.x-r.x)*y,y:(n.y-r.y)*y})}let c=s,d=1/0,h=1/0;for(let u of a){let y={x:s.x+u.x,y:s.y+u.y},f=Io(t,y),p=(o?Kt(o,f,{mode:"overlap"}).length:0)+i.collisionCount(f),g=Math.hypot(u.x,u.y);if((p<d||p===d&&g<h)&&(c=y,d=p,h=g),p===0)break}return c}function Va(t,e){let i=e,o=i._cache.get("canvas");if(!o)return;let s=[o.scene,o.filter,o.hit].map(n=>n?._canvas).filter(n=>!!n);s.length&&t.Util.releaseCanvas(...s),i._cache.delete("canvas")}function za(t,e){let i=0,o=0,s=n=>{i||(i=n),o+=1;let r=n-i;r>=1e3&&(t(Math.round(o*1e3/r)),o=0,i=n),e(requestAnimationFrame(s))};e(requestAnimationFrame(s))}import{Group as Lh}from"konva/lib/Group";import{Line as Ka}from"konva/lib/shapes/Line";import{Rect as Ch}from"konva/lib/shapes/Rect";import{Text as Xa}from"konva/lib/shapes/Text";var Ya=.6;function Th(t,e){return t>=se||e&&t>=Ut}function xh(t){return t.effectiveScale<Ut?!1:t.focusActive||t.stageWidth<ue}function Ih(t,e,i){return i&&e>=Ut?Math.max(t,Vs/Math.max(e,1e-4)):t}function Ph(t){let{authoredFontSize:e,measuredWidth:i,maxWidth:o,effectiveScale:s}=t;if(!(i>o)||!(i>0))return e;let n=H/Math.max(s,1e-4),r=e*o/i;return Math.max(Math.min(ut,n),r)}function Mo(t,e){let i=(e?1:3)*Math.min(1,t/le);return Math.max(1,t*2-i)}function Ua(t){let e=new Map;for(let s of t){let n=e.get(s.rowId);n?n.push(s):e.set(s.rowId,[s])}let i=[];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)&&i.push(r)}if(!i.length)return 0;i.sort((s,n)=>s-n);let o=Math.floor(i.length/2);return i.length%2?i[o]:(i[o-1]+i[o])/2}function $a(t,e){return e>0?Math.min(t,e/2):t}function Ro(t){let e=Math.max(t*2,1e-4);return Math.max(we,ps/e)}function Ct(t){let e=Mo(t,!1),i=Mo(le,!1),o=e>0?i/e:1;return se*Math.max(1,o)/Wi(1,!1,H)}function qa(t){return Ct(t)*pn}function Po(t,e,i){let o=t.seatLabelContainer(e);i.getParent()!==o&&o.add(i)}function Za(t){let e=t.exportMode?Math.max(t.effScale(),se):t.effScale(),i=xh({effectiveScale:e,focusActive:t.focusedSectionId!=null,stageWidth:t.stage.width()}),o=t.exportMode?e:Wi(e,t.labelsWereVisible(),H),s=Th(o,i);t.onLabelVisibilityChange(s),t.setSeatLabelRungOpen(s);let n=d=>{let h=d.getClientRect({skipShadow:!0,skipStroke:!0});return h.x>=0&&h.y>=0&&h.x+h.width<=t.stage.width()&&h.y+h.height<=t.stage.height()};for(let[d,h]of t.boothLabelById){let u=t.circleById.get(d);h.visible(ge(h.fontSize(),o)&&!!u?.isVisible()&&t.focusedSeatOpacity(d,u?.getAbsoluteOpacity()??1)>=.5&&n(h))}t.rowLabelGroup.destroyChildren(),t.seatLabelById.clear(),t.seatLabelDrops.clear();let r=new Set,l=new Set,a=0;if(s)for(let d of t.visibleSeatCandidates()){if(d.kind==="booth")continue;let h=t.worldToScreen(d);if(h.x<-20||h.x>t.stage.width()+20||h.y<-20||h.y>t.stage.height()+20||t.accessGlyphById.has(d.id)&&t.accessGlyphShouldShow(d.id))continue;let u=t.circleById.get(d.id);if(!u?.isVisible()){t.seatLabelDrops.set(d.id,"dimmed-or-unavailable");continue}let y=t.statusById.get(d.id)??"free",f=!t.hasSeatMark(d.id)&&(y==="booked"||y==="not_for_sale"||y==="held"&&!t.ownedHold.has(d.id)&&!t.opts.manageMode),m=t.focusedSeatOpacity(d.id,u.getAbsoluteOpacity()),p=f&&!t.focusDims(d.id);if(m<.5&&!p){t.seatLabelDrops.set(d.id,"dimmed-or-unavailable");continue}let g=t.renderedSeatPoint(d),b=t.viewMode==="perspective"?t.perspectiveSeatScale.get(d.id)??1:1;if(f){let C=b*t.statusCueScale(),T=t.statusCueInk(d.id),x=t.statusCuePool.get(d.id);if(x&&x.status===y){let P=x.node;P.position(g),P.scale({x:C,y:C}),P.opacity(m<1?Ya:y==="held"?1:ko);for(let A of P.getChildren())A.stroke(T);if(Po(t,d.id,P),l.add(d.id),++a>=$t)break;continue}x?.node.destroy();let I=new Lh({x:g.x,y:g.y,listening:!1});if(I.scale({x:C,y:C}),m<1&&I.opacity(Ya),y==="held"?(I.add(new Ch({x:-4.2,y:-.7,width:8.4,height:6.5,cornerRadius:1.3,stroke:T,strokeWidth:1.25,listening:!1})),I.add(new Ka({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:T,strokeWidth:1.2,lineCap:"round",lineJoin:"round",listening:!1}))):(I.opacity(ko),I.add(new Ka({points:[-4.2,4.2,4.2,-4.2],stroke:T,strokeWidth:1.8,lineCap:"round",listening:!1}))),bi(I),t.statusCuePool.set(d.id,{node:I,status:y}),Po(t,d.id,I),l.add(d.id),++a>=$t)break;continue}let S=Ih(ye*t.seatLabelScale(d),e,i),v=Wt(d.displayLabel??d.label),k=u?t.seatLabelInk(d,u):t.seatPreferredLabelInk(d),w=t.seatLabelPool.get(d.id);w?(w.position(g),w.text(v),w.fontSize(S),w.fontFamily(t.labelFont()),w.fill(k),w.offset({x:0,y:0}),w.scale({x:1,y:1})):(w=new Xa({x:g.x,y:g.y,text:v,fontSize:S,fontStyle:"600",fontFamily:t.labelFont(),fill:k,listening:!1,perfectDrawEnabled:!1}),t.seatLabelPool.set(d.id,w));let L=Mo(t.seatR,i);if(w.fontSize(Ph({authoredFontSize:S,measuredWidth:w.width(),maxWidth:L,effectiveScale:e})),w.width()>L+.01){t.seatLabelDrops.set(d.id,"label-overflows-marker");continue}if(!ge(w.fontSize(),e)){t.seatLabelDrops.set(d.id,"below-minimum-size");continue}if(w.offsetX(w.width()/2),w.offsetY(w.height()/2),w.scale({x:b,y:b}),Po(t,d.id,w),!n(w)){t.seatLabelDrops.set(d.id,"outside-viewport");continue}if(r.add(d.id),t.seatLabelById.set(d.id,w),++a>=$t)break}for(let[d,h]of t.seatLabelPool)r.has(d)||(h.destroy(),t.seatLabelPool.delete(d));for(let[d,h]of t.statusCuePool)l.has(d)||(h.node.destroy(),t.statusCuePool.delete(d));let c=new et;for(let{node:d}of t.freeTextById.values()){if(!d.isVisible())continue;let h=d.getClientRect({relativeTo:t.bgLayer,skipShadow:!0,skipStroke:!0});c.insert({x:h.x-Q,y:h.y-Q,width:h.width+Q*2,height:h.height+Q*2})}for(let d of t.rowLabelPlan){let h=t.focusedSectionId!=null&&d.focusKeys?.includes(t.focusedSectionId),u=h?Math.max(d.fontSize,Ws/Math.max(e,1e-4)):d.fontSize;if(!h&&!ge(u,o))continue;let y=t.worldToScreen({x:d.x,y:d.y});if(y.x<-40||y.x>t.stage.width()+40||y.y<-40||y.y>t.stage.height()+40)continue;let f=new Xa({x:d.x,y:d.y,text:d.text,fontSize:u,fontStyle:"700",fontFamily:t.labelFont(),fill:d.ink,rotation:d.rotation,opacity:d.opacity,shadowColor:"#05070c",shadowBlur:d.ink.toLowerCase()==="#ffffff"?5:0,shadowOpacity:d.ink.toLowerCase()==="#ffffff"?.8:0,shadowForStrokeEnabled:!1,listening:!1,perfectDrawEnabled:!1});d.pill&&Na(f,d.pill),f.offsetX(f.width()/2),f.offsetY(f.height()/2);let m=t.resolveAutomaticRowLabelPosition(f,d,c);f.position(m),f.setAttr("rowLabel",!0),t.rowLabelGroup.add(f);let p=f.getClientRect({skipShadow:!0,skipStroke:!0}),g=6,b=p.x<g?g-p.x:p.x+p.width>t.stage.width()-g?t.stage.width()-g-p.x-p.width:0,S=p.y<g?g-p.y:p.y+p.height>t.stage.height()-g?t.stage.height()-g-p.y-p.height:0,v=m;if(b||S){let w=t.labelGroup.getAbsoluteTransform(),L=w.point(m);v=w.copy().invert().point({x:L.x+b,y:L.y+S}),f.position(v)}let k=t.rowLabelBox(f,v);if(d.automaticAway&&c.collisionCount(k)>0){f.destroy();continue}c.insert(k)}t.isoT>0&&t.viewMode!=="perspective"&&t.applyUprightLabels(),t.overlayLayer.batchDraw()}function Mh(t){return t<0?0:t>1?1:t}function ja(t){let e=t.now??(()=>typeof performance<"u"?performance.now():Date.now()),i=t.budgetMs??8,o=t.reducedMotion===!0,s=t.chunks.length>1?Math.min(30,Math.max(0,840/(t.chunks.length-1))):0,n=0,r=!1,l=!1,a=null,c=[],d=typeof globalThis<"u"?globalThis:{},h=()=>{a&&(a.kind==="idle"?d.cancelIdleCallback?.(a.id):a.kind==="frame"?d.cancelAnimationFrame?.(a.id):clearTimeout(a.id),a=null)},u=p=>{if(!c.length&&typeof d.requestIdleCallback=="function"){a={kind:"idle",id:d.requestIdleCallback(()=>{a=null,p()},{timeout:120})};return}if(typeof d.requestAnimationFrame=="function"){a={kind:"frame",id:d.requestAnimationFrame(()=>{a=null,p()})};return}a={kind:"timer",id:setTimeout(()=>{a=null,p()},16)}},y=()=>{l||r||(l=!0,h(),t.done())},f=p=>{for(let g=c.length-1;g>=0;g--){let b=c[g],S=o?1:Mh((p-b.startedAt)/160);t.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<t.chunks.length&&(n===0||e()-g<i);){let S=t.chunks[n++];if(t.build(S.work),t.fade(S.work,o?1:0),o||c.push({work:S.work,startedAt:p+(n-1)*s}),e()-g>=i)break}let b=f(p);t.draw(),n<t.chunks.length||b?u(m):y()};return u(m),{cancel(){if(!l){r=!0,h();for(let p of c)t.fade(p.work,1);c.length=0}},finishNow(){if(!(r||l)){for(;n<t.chunks.length;){let p=t.chunks[n++];t.build(p.work)}for(let p of t.chunks)t.fade(p.work,1);c.length=0,t.draw(),y()}},get done(){return l}}}function Qa(t){let e=new Map,i=[];for(let s of t.seats){let n=t.sectionIdOf(s.id);if(n==null){i.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=t.sections.find(l=>l.id===s);return r?[{chunk:{id:s,work:{seats:n,group:r.liftGroupSeat}},distance:Math.hypot(r.centroid.x-t.viewportCentre.x,r.centroid.y-t.viewportCentre.y)}]:[]}).sort((s,n)=>s.distance-n.distance).map(s=>s.chunk);return i.length&&t.looseGroup&&o.push({id:"",work:{seats:i,group:t.looseGroup}}),o}function Tt(t){return{th:qt*Math.PI/180*t.isoT,sg:1-(1-ft)*t.isoT}}function Ja(t,e){let{th:i,sg:o}=Tt(e),s=e.centre,n=t.x-s.x,r=t.y-s.y,l=n*Math.cos(i)-r*Math.sin(i),a=(n*Math.sin(i)+r*Math.cos(i))*o;return{x:s.x+l,y:s.y+a}}function el(t,e){let{th:i,sg:o}=Tt(e),s=e.centre,n=t.x-s.x,l=(t.y-s.y)/o,a=n*Math.cos(i)+l*Math.sin(i),c=-n*Math.sin(i)+l*Math.cos(i);return{x:s.x+a,y:s.y+c}}function tl(t,e){let{th:i,sg:o}=Tt(e),s=t*e.isoT;return{x:-(s/o)*Math.sin(i),y:-(s/o)*Math.cos(i)}}function il(t,e,i){let o=Cs(e);t.offset(i),t.position(ae(e,i)),t.rotation(o.rotationDeg),t.scale({x:o.scaleX,y:o.scaleY}),t.skewX(o.skewX),t.skewY(0)}function ol(t){t.position({x:0,y:0}),t.offset({x:0,y:0}),t.scale({x:1,y:1}),t.rotation(0),t.skewX(0),t.skewY(0)}function sl(t,e){let i=Math.hypot(e.x-t.surfaceFocal.x,e.y-t.surfaceFocal.y),o=Math.max(0,i-t.frontDistanceWorld);return t.liftWorld+o*Math.tan(t.rakeDeg*Math.PI/180)}function nl(t,e,i){return t.perspectiveAffine?ae(t.perspectiveAffine,e):ae(i,e)}function rl(t,e){return e?ae(e,t):t}function al(t,e){let i=0;for(let h of t.seats){let u=Math.max(0,(h.eyeHeightM??ee)-ee);i=Math.max(i,u*Xe)}for(let h of t.objects)h.type==="section"&&(i=Math.max(i,Et(h,{floorBaseHeightM:t.floorBaseHeightMFor(h.id)}).height*Xe));let o=ws(t.bounds,i),s=Xt(o,o.target),n=ks(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 h of t.seats){let u=Math.max(0,(h.eyeHeightM??ee)-ee),y=be(o,h,u*Xe),f={x:y.x,y:y.y};e.seatProjected.set(h.id,f),e.seatLocal.set(h.id,ae(n,f)),e.seatDepth.set(h.id,y.depth),e.seatScale.set(h.id,y.scale),r=Math.min(r,y.x),l=Math.min(l,y.y),a=Math.max(a,y.x),c=Math.max(c,y.y)}for(let h of[{x:t.bounds.x,y:t.bounds.y},{x:t.bounds.x+t.bounds.width,y:t.bounds.y},{x:t.bounds.x+t.bounds.width,y:t.bounds.y+t.bounds.height},{x:t.bounds.x,y:t.bounds.y+t.bounds.height}]){let u=be(o,h,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 d=Math.max(24,t.seatR*3);return{camera:o,baseAffine:s,baseInverse:n,bounds:Number.isFinite(r)?{x:r-d,y:l-d,width:Math.max(1,a-r+d*2),height:Math.max(1,c-l+d*2)}:null}}function ll(t,e,i){let o=i?[...i].map(s=>t.seatById.get(s)).filter(s=>!!s):e?t.seats:[...t.perspectiveAppliedSeats].map(s=>t.seatById.get(s)).filter(s=>!!s);for(let s of o){if(e&&t.perspectiveAppliedSeats.has(s.id))continue;let n=e?t.perspectiveSeatProjected.get(s.id)??s:s,r=e?t.perspectiveSeatScale.get(s.id)??1:1,l=t.circleById.get(s.id);l?.position(n),l?.scale({x:r,y:r});let a=t.accessRingById.get(s.id);a?.position(n),a?.scale({x:r,y:r});let c=t.accessGlyphById.get(s.id);if(c){let h=t.seatR*1.5/xe;c.position(n),c.scale({x:h*r,y:h*r})}let d=t.boothLabelById.get(s.id);d?.position(n),d?.scale({x:r,y:r}),e&&t.perspectiveAppliedSeats.add(s.id)}e||t.perspectiveAppliedSeats.clear()}import{Group as cl}from"konva/lib/Group";import{Line as Rh}from"konva/lib/shapes/Line";import{Rect as Ah}from"konva/lib/shapes/Rect";import{Text as dl}from"konva/lib/shapes/Text";function hl(t,e){let i=_t(e.outline,e.holes),o=ie(t.canvasBackground),s=[],n=new Map,r=0,l=W(e.outline),a=t.seatIndex?Kt(t.seatIndex,l).map(M=>t.seatById.get(M)).filter(M=>!!M):t.seats;for(let M of a)t.seatSection.has(M.id)||te(M,e.outline,e.holes)&&(s.push(M.id),n.set(M.categoryKey,(n.get(M.categoryKey)??0)+1),(t.statusById.get(M.id)??"free")==="free"&&r++);let c=e.color??Dt([...n].map(([M,_])=>({hex:t.catColor.get(M)??"#6e7bff",w:_})),"#3a4358"),d=Qo(e.elevation),h=Et(e,{floorBaseHeightM:t.floorBaseHeightMFor(e.id)}),u=h.height*Xe,y=new cl({listening:!1});t.bgLayer.add(y);let f=new cl({listening:!1});y.add(f);let m=new ot({listening:!0});t.seatLayer.add(m);let p=[];if(u>0){let M=me(t.zoneColor.get(e.zone??"")??c,.42);for(let _=0;_<e.outline.length;_++){let $=new Rh({points:[],closed:!0,fill:M,stroke:F("#000000",.25),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});p.push($),y.add($)}}f.moveToTop();let g=f,b=e.color??t.zoneColor.get(e.zone??"")??"#3a4358",S=Ve(e.outline,e.holes,{stroke:F(b,.5),strokeWidth:1,fill:F(b,.08),listening:!1},e.outlinePath);g.add(S);let v=Ve(e.outline,e.holes,{fill:o.sectionFill,stroke:o.sectionStroke,strokeWidth:De,opacity:0,listening:!1},e.outlinePath);g.add(v);let k=e.labelPresentation?.labelStyle,w=k?.color,L=o.sectionInk,C=(k?.size??18)/18,T=new Ah({x:e.labelPresentation?.position?.x??i.x,y:e.labelPresentation?.position?.y??i.y,width:0,height:0,opacity:0,listening:!1,perfectDrawEnabled:!1});g.add(T);let x=new dl({x:e.labelPresentation?.position?.x??i.x,y:e.labelPresentation?.position?.y??i.y,text:e.displayLabel??e.label,rotation:e.labelPresentation?.rotation??0,visible:e.labelPresentation?.visible!==!1,fontSize:18*C,fontStyle:Ge,fontFamily:t.labelFont(),fill:Ie(o.sectionFill,w,L),listening:!1,perfectDrawEnabled:!1});x.offsetX(x.width()/2),x.offsetY(x.height()/2),g.add(x);let I=new dl({x:i.x,y:i.y,text:G("map.seatsLeft",{count:r}),fontSize:12,fontStyle:ln,fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:o.sectionInk,opacity:0,listening:!1,perfectDrawEnabled:!1});I.offsetX(I.width()/2),g.add(I);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:i,labelAnchors:ir(e.outline,e.holes??[],i),memberCategoryKeys:new Set(s.map(M=>t.seatById.get(M)?.categoryKey).filter(Boolean)),shellCategoryColor:t.dominantSellableColor(s),shellFill:o.sectionFill,shellStroke:o.sectionStroke,labelArea:Zo(e.outline,e.holes),zone:e.zone,memberIds:s,total:s.length,free:r,baseFill:c,outlineTint:b,outlinePoly:S,blockPoly:v,namePlate:T,nameLabel:x,subLabel:I,preferredInk:L,...w?{explicitInk:w}:{},labelScale:C,nameLabelFits:!1,subLabelFits:!0,elevation:d,liftWorld:u,rakeDeg:h.rake,surfaceFocal:s.length?{...t.seatById.get(s[0])?.focalPoint??t.isoCentre}:{...t.chartDoc?.focalPoint??t.isoCentre},frontDistanceWorld:0,rootGroupBg:y,bgZIndex:y.zIndex(),seatZIndex:m.zIndex(),liftGroupBg:f,liftGroupSeat:m,sideFaces:p},A=s.map(M=>t.seatById.get(M)).filter(M=>!!M),R=A.length?A:e.outline;return P.frontDistanceWorld=Math.min(...R.map(M=>Math.hypot(M.x-P.surfaceFocal.x,M.y-P.surfaceFocal.y))),P}function ul(t,e,i){if(!e?.length)return;let o=new Set(e),s=t.seats.filter(h=>!o.has(h.categoryKey)||t.seatInClosedSection(h.id)?!1:(t.statusById.get(h.id)??"free")==="free"||t.ownedHold.has(h.id));if(!s.length)return;let n=ho(s.map(h=>h.id),t.seatSection);n&&t.focusSection(n);let r=Math.max(24,t.seatR*3),l=s.map(h=>t.renderedSeatPoint(h)),a=t.clusterLabels.boundsForSeats(s.map((h,u)=>({...h,...l[u]})),r),c=st(l,r);if(a?.singleBlock&&(!t.hasSections||n!=null)){let h=t.clusterLabels.diveTarget(a.bounds,a.anchor);if(h){t.focusRegion(h,{animate:i?.animate,durationMs:t.cameraGlideMs,minScale:Math.min(t.seatLabelTargetScale(),t.zoomBounds().max),maxScale:nt(t)});return}}let d={x:c.x+c.width/2,y:c.y+c.height/2};co({stage:t.stage,box:c,bounds:t.zoomBounds(),viewport:t.framingViewport(),centreScreen:t.worldToScreen(d)})||t.focusRegion(c,{animate:i?.animate,durationMs:t.cameraGlideMs})}function nt(t){let e=ea(Math.max(t.seatR,t.markerR));return Math.max(e,Ct(t.markerR))}function pl(t,e){let i=e===void 0?t.accessFilter:e;if(!i)return!1;let o=fl(t,i);if(!o.length)return!1;t.clearSectionFocus();let s=Math.max(24,t.seatR*3),n=st(o.map(l=>t.renderedSeatPoint(l)),s),r={x:n.x+n.width/2,y:n.y+n.height/2};return co({stage:t.stage,box:n,bounds:t.zoomBounds(),viewport:t.framingViewport(),centreScreen:t.worldToScreen(r)})||t.focusRegion(n,{durationMs:t.cameraGlideMs,maxScale:nt(t)}),!0}function fl(t,e){return t.seats.filter(i=>t.seatInClosedSection(i.id)||Me(i,e)!=="match"?!1:(t.statusById.get(i.id)??"free")==="free"||t.ownedHold.has(i.id))}function ml(t,e,i){let o=i===void 0?t.accessFilter:i;if(!o||!t.sections.some(n=>n.id===e||n.logicalId===e))return!1;let s=t.sectionMembers(e).filter(n=>{if((t.statusById.get(n)??"free")!=="free")return!1;let r=t.seatById.get(n);return r!=null&&Me(r,o)==="match"});return s.length&&Ao(t,s)||t.focusSection(e),!0}function yl(t,e){let i=e===void 0?t.accessFilter:e;if(!i)return null;let o=fl(t,i);if(!o.length)return null;let s=Math.max(24,t.seatR*3),n=st(o.map(a=>t.renderedSeatPoint(a)),s),r=t.getWorldBounds(),l=r.width>0&&r.height>0&&n.width>=r.width*wt&&n.height>=r.height*wt;return{spaces:o.length,sections:_o(t,i),wholeVenue:l}}function Ao(t,e,i){let o=e.map(a=>t.seatById.get(a)).filter(a=>a!=null);if(!o.length)return!1;let s=t.seatPitch>0?t.seatPitch:t.seatR*2,n=st(o.map(a=>t.renderedSeatPoint(a)),Math.max(24,t.seatR*3,s*4)),r=t.getWorldBounds();if(r.width>0&&r.height>0&&n.width>=r.width*wt&&n.height>=r.height*wt)return!1;let l=ho(o.map(a=>a.id),t.seatSection);return l&&t.markSectionFocus(l,{x:n.x+n.width/2,y:n.y+n.height/2}),t.focusRegion(n,{animate:i?.animate,durationMs:t.cameraGlideMs,minScale:Math.min(t.seatLabelTargetScale(),t.zoomBounds().max),maxScale:nt(t)}),!0}function gl(t,e,i=!0,o){let s=t.sectionBounds(e);if(!s)return;let n=t.sectionMembers(e).map(c=>t.seatById.get(c)).filter(c=>c!=null),r=n.filter(c=>(t.statusById.get(c.id)??"free")==="free"||t.ownedHold.has(c.id)),l=(r.length?r:n).map(c=>t.renderedSeatPoint(c)),a=t.narrowSeatDetailFocus(l,s,o);t.focusRegion(a?.bounds??s,{animate:i,minScale:a?.minScale,maxScale:nt(t)})}function Eo(t,e){if(!t.accessFilter)return 0;let i=t.accessFreeBySection.get(e.id);if(i!==void 0)return i;let o=bl(t,e,t.accessFilter);return t.accessFreeBySection.set(e.id,o),o}function bl(t,e,i){return Pr(e.memberIds,i,o=>t.statusById.get(o)??"free",o=>t.seatById.get(o))}function _o(t,e){let i=e===void 0?t.accessFilter:e;if(!i)return[];let o=i===t.accessFilter,s=new Map;for(let n of t.sections){if(t.isSectionClosed(n))continue;let r=o?Eo(t,n):bl(t,n,i);if(r<=0)continue;let l=s.get(n.logicalId);l?l.free+=r:s.set(n.logicalId,{id:n.logicalId,label:n.label,free:r})}return[...s.values()]}function Bo(t){return t?.getAttr?.("seatId")??void 0}var Oo=Object.freeze([]),vl=.85,Oh=.38,Dh=Object.freeze([3,3]),It=class It{constructor(e,i={}){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=ro;this.effSelection=St;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 gi;this.selectionFocusId=null;this.selectionFocusKeep=null;this.hiddenPose=null;this.hoveredId=null;this.focusedId=null;this.accessFilter=null;this.accessFreeBySection=new Map;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=Qr();this.fitScale=1;this.fitPose="";this.viewportInsets={...vo};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 i=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(i){e.preventDefault();let o=this.focusedId?this.nearestSeat(this.focusedId,i):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"],...i},this.exportMode=i.exportMode===!0,this.loadingReveal=i.loadingReveal??"progressive",this.onSeatsRevealed=i.onSeatsRevealed,this.currency=i.currency;let o=wi.pixelRatio;if(this.exportMode&&(this.dpr=1),wi.pixelRatio=this.dpr,this.stage=new _h({container:e,width:e.clientWidth||1,height:e.clientHeight||1,draggable:!1}),this.gestures=new Si(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 Fo({listening:!this.exportMode}),this.seatLayer=new Fo({listening:!this.exportMode}),this.overlayLayer=new Fo({listening:!1}),this.labelGroup=new xt({listening:!1}),this.overlayLayer.add(this.labelGroup),this.rowLabelGroup=new xt({listening:!1}),this.labelGroup.add(this.rowLabelGroup),this.fgDecorGroup=new xt({listening:!1}),this.overlayLayer.add(this.fgDecorGroup),this.clusterLabels=new fi({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:()=>Ct(this.markerR),pickableScale:()=>Ro(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 Sl({radius:le+2,stroke:"#ffffff",strokeWidth:2,opacity:vl,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.hoverRing),this.focusRing=new Sl({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&&(wi.pixelRatio=o),!this.exportMode){this.wireInteraction();let s=this.opts.onFps;s&&za(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 ai({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,i)=>this.nearestSeatToScreen(e,i)})),this.momentsCache}get breath(){return this.breathCache||(this.breathCache=new li({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 di({overlayLayer:this.overlayLayer,container:this.container,accent:()=>this.effSelection,accentInk:()=>oo(this.effSelection),labelFont:()=>this.labelFont(),stageScale:()=>this.stage.scaleX(),worldToScreen:e=>this.worldToScreen(e),activate:e=>this.activateBeacon(e)})),this.beaconsCache}activateBeacon(e){let i=e.kind==="section"?e.id:this.seatSection.get(e.seatId)?.logicalId??null;if(i){let o=this.sectionTapAnchor(i,this.renderedSeatPoint(this.seatById.get(e.seatId)??{x:0,y:0}));this.opts.onSectionTap?this.opts.onSectionTap(i,o):this.focusSection(i,{anchor:o})}this.focusSeat(e.seatId,{move:!i})}syncBeacons(){if(!this.beaconsCache&&!this.selectionMarkers.size)return;let e=this.beacons;e.sync($n({rung:this.getRung(),sections:this.sections,zones:this.zones,ownedSeatIds:i=>this.ownedSeatIds(i),sectionName:i=>i.nameLabel.text()||i.logicalId,sectionAnchor:i=>({x:i.nameLabel.x(),y:i.nameLabel.y()})})),this.breath.syncBeacons(e.breathingRings())}ownedSeatIds(e){return e.memberIds.filter(i=>this.selection.has(i)||this.ownedHold.has(i))}get owned(){return this.ownedCache||(this.ownedCache=new hi({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,i){return this.owned.anchorFor(e)??i}ownedSeatPoints(e){let i=[];for(let o of e.memberIds){if(!this.selection.has(o)&&!this.ownedHold.has(o))continue;let s=this.seatById.get(o);s&&i.push(this.renderedSeatPoint(s))}return i}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,i){if(e!==this.chartDoc&&(this.stacked=!1,this.floorOverview=!1),this.cancelAssetLoads(),this.cancelSeatReveal(),this.chartDoc=e,this.activeFloorId=i?.floorId??Ft(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 xt({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.accessFreeBySection.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=Ts(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,oi[r%oi.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=vs(this.seats,{seatRadius:this.seatR}),this.seatPitch=Ua(this.seats),this.markerR=$a(this.seatR,this.seatPitch),this.clusterLabels.rebuild(),this.bounds=os(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 xt({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=Qa({seats:this.seats,sections:this.sections,sectionIdOf:i=>this.seatSection.get(i)?.id??null,looseGroup:this.unsectionedSeatGroup,viewportCentre:this.viewportCentreInChartSpace()});this.seatReveal=ja({chunks:e,build:i=>this.renderSeats(i.seats),fade:(i,o)=>i.group.opacity(o),draw:()=>{this.seatLayer.batchDraw()},reducedMotion:this.reducedMotion,done:()=>{this.seatReveal=null,this.seatRevealPending=!1,this.afterViewChange(),this.fitPose&&io(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 i=this.seatReveal;this.seatRevealPending=!1,i&&(this.seatReveal=null,e?i.finishNow():i.cancel(),this.seats.length&&!this.destroyed&&this.updateLabels())}floorView(e){if(!e.floors?.length)return{...e,referenceImage:void 0,backgroundImage:ht(e)};if(this.floorOverview&&e.floors.length>=2)return ss(e,{labelStyle:this.floorLabelStyle});if(this.stacked&&e.floors.length>=2)return{...is(e),referenceImage:void 0,backgroundImage:ht(e)};let i=e.floors.find(o=>o.id===this.activeFloorId)??e.floors[0];return{...e,objects:i.objects,focalPoint:i.focalPoint,referenceImage:void 0,backgroundImage:ht(i),floors:void 0}}floorBaseHeightMFor(e){let i=this.chartDoc?.floors;if(!i?.length)return 0;let o=this.stacked&&e?this.objectFloor.get(e)??this.activeFloorId:this.activeFloorId;return i.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?Ft(this.chartDoc).map(e=>({id:e.id,name:e.name})):[]}getActiveFloorId(){return this.activeFloorId}setStatus(e,i){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===i)continue;this.statusById.set(n,i);let l=this.circleById.get(n);if(l&&(this.paintSeat(l,n),o=!0),s){let a=this.seatSection.get(n);a&&(this.accessFreeBySection.delete(a.id),r==="free"!=(i==="free")&&(a.free+=i==="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 i=!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),i=!0);let c=this.seatSection.get(n);c&&o.add(c)}if(!i)return;let s=new Map((this.chartDoc?Ft(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=Dt([...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 i=new Set((e??[]).filter(s=>this.statusById.has(s))),o=new Set([...this.ownedHold,...i]);this.ownedHold=i;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 i=e&&this.selection.has(e)?e:null;if(i===this.selectionFocusId)return;let o=this.selectionFocusId;this.selectionFocusId=i,this.selectionFocusKeep=Sa({focusedId:i,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&&i!=null&&va(o,i,r=>this.seatSection.get(r)?.logicalId??null)?[o,i]: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),i&&this.syncSelectionMarker(i);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 i=this.seatMarks.merge(e,this.statusById);for(let o of i){let s=this.circleById.get(o);s&&this.paintSeat(s,o)}i.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 i of this.selection){let o=this.seatById.get(i);o&&e.push(o)}return e}clearSelection(){let e=[...this.selection];for(let i of e)this.setSelected(i,!1,!0);this.overlayLayer.batchDraw()}setMaxSelection(e){this.opts.maxSelection=Math.max(0,Math.floor(e))}select(e){let i=[];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&&i.push(s)}return i.length&&this.overlayLayer.batchDraw(),i}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 i=[...this.selection].filter(o=>!this.isSelectable(o));i.length&&this.deselect(i),!e.manageMode&&this.selection.size&&this.clearSelection(),this.clusterLabels.syncCursor(!1),this.overlayLayer.batchDraw()}setSectionHeat(e){this.sectionHeat.clear();for(let[i,o]of Object.entries(e??{}))Number.isFinite(o)&&this.sectionHeat.set(i,Math.max(0,Math.min(1,o)));for(let i of this.sections)this.refreshSectionHeat(i);this.bgLayer.batchDraw()}deselect(e){let i=!1;for(let o of e)this.selection.has(o)&&(this.setSelected(o,!1,!0),i=!0);i&&this.overlayLayer.batchDraw()}selectAllSelectable(){if(!this.opts.manageMode)return[];let e=[];for(let i of this.seats)this.isSelectable(i.id)&&e.push(i.id);return this.selectMany(e)}selectByLabels(e){if(!this.opts.manageMode)return[];let i=new Set(e),o=[];for(let s of this.seats)i.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 i=[],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&&i.push(r)}return i}selectMany(e){let i=e.filter(s=>!this.selection.has(s));if(!i.length)return this.getSelection();let o=this.selection.size+i.length<=zs;for(let s of i)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 i=this.screenToWorld(e),o=this.stage.scaleX()||1,s=new Fh({x:i.x,y:i.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:i,rect:s},this.marqueeCur=i,this.overlayLayer.batchDraw()}updateMarquee(e){if(!this.marquee)return;let i=this.screenToWorld(e),{start:o,rect:s}=this.marquee;s.setAttrs({x:Math.min(o.x,i.x),y:Math.min(o.y,i.y),width:Math.abs(i.x-o.x),height:Math.abs(i.y-o.y)}),this.marqueeCur=i,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 i=this.marqueeCur??e.start;this.marqueeCur=null;let o=Math.min(e.start.x,i.x),s=Math.max(e.start.x,i.x),n=Math.min(e.start.y,i.y),r=Math.max(e.start.y,i.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 d=this.renderedSeatPoint(c);d.x<o||d.x>s||d.y<n||d.y>r||this.isSelectable(c.id)&&a.push(c.id)}this.selectMany(a),this.opts.onMarquee?.(this.getSelection())}flashSeat(e,i="#f43f5e"){let o=this.seatById.get(e);o&&Wr(this.flashHost,e,this.renderedSeatPoint(o),i)}flashSection(e,i="#22a06b"){Vr(this.flashHost,this.sections.filter(o=>o.id===e||o.zone===e),i)}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,i)=>this.projectedSectionPoint(e,i),isoLiftLocal:e=>this.isoLiftLocal(e)}}nearestSeat(e,i){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,d=a.y-s.y,h=c*i.x+d*i.y;if(h<=.5)continue;let u=Math.abs(c*i.y-d*i.x),y=h+u*2.5;y<r&&(r=y,n=l.id)}return n}focusSeat(e,i){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),i?.move!==!1&&this.ensureVisible(o),this.overlayLayer.batchDraw(),this.opts.onFocusSeat?.(o)}ensureVisible(e){let i=this.stage.width(),o=this.stage.height(),s=Math.max(this.stage.scaleX(),Be*1.2),n=this.worldToScreen(e),r=70,l=n.x<r||n.x>i-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:i/2-c.x*s,y:o/2-c.y*s}),this.afterViewChange(),this.stage.batchDraw()}}setViewportInsets(e){this.viewportInsets=Yr(e),this.refitCurrentView()}getViewportInsets(){return{...this.viewportInsets}}framingViewport(){return Ur(this.stage.width(),this.stage.height(),this.viewportInsets)}framingWorldRect(){return Zr(this.framingViewport(),e=>this.screenToWorld(e))}zoomToFit(){let e=this.framingViewport(),i=e.width,o=e.height,s=this.viewMode==="perspective"&&this.perspectiveBounds?this.perspectiveBounds:this.bounds;if(this.fitScale=Math.min(i/s.width,o/s.height)||1,this.opts.portraitFitCrop&&!this.exportMode){let r=i/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+(i-s.width*n)/2-s.x*n,y:e.y+(o-s.height*n)/2-s.y*n}),this.settleView(),!this.exportMode){let r=Qn(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(),Jn(this.stage,[this.bgLayer,this.seatLayer],e)),this.fitPose=io(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 $r(this.stage)}setCameraPose(e){this.cancelGlide(),qr(this.stage,e)&&(this.settleView(),this.stage.batchDraw())}zoomIn(){this.zoomAbout(this.stage.scaleX()*It.ZOOM_STEP,mi(this.framingViewport()))}zoomOut(){this.zoomAbout(this.stage.scaleX()/It.ZOOM_STEP,mi(this.framingViewport()))}zoomOutLevel(){let e=this.focusedSectionId;return e?this.sectionBounds(e)&&this.stage.scaleX()>this.sectionFrameScale(e)*1.05?(this.focusRegion(e,{maxScale:this.diveCeiling()}),"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 i of this.gaById.values())e+=i.capacity;return e}worldToScreen(e){let i=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*i+this.stage.x(),y:l.y*i+this.stage.y()}}let n=s?this.renderedSeatPoint(s):e,r=this.isoT===0?n:this.isoForward(n);return{x:r.x*i+this.stage.x(),y:r.y*i+this.stage.y()}}setAccessibleFilter(e){this.setAccessibilityFilter(e?[]:null)}setAccessibilityFilter(e){let i=e===null?null:[...e];if(!this.sameAccessFilter(i)){this.accessFilter=i,this.accessFreeBySection.clear();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 i=this.accessFilter;return i===null||e===null?i===e:i.length===e.length&&i.every((o,s)=>o===e[s])}setCommercialLimitedFilter(e){if(this.commercialLimitedFilter!==e){this.commercialLimitedFilter=e;for(let i of this.seats){let o=this.circleById.get(i.id);o&&this.paintSeat(o,i.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setCategoryFilter(e){let i=e===null?null:new Set(e);if(!kr(i,this.categoryFilter)){this.categoryFilter=i;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(){ga({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=>ya(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){ba(this.gaById,e)&&this.applyGAFilterState()}setGAState(e,i){this.setGAStates({[e]:i})}get focusFramingContext(){return{stage:this.stage,seats:this.seats,sections:this.sections,hasSections:this.hasSections,seatById:this.seatById,seatSection:this.seatSection,statusById:this.statusById,ownedHold:this.ownedHold,accessFilter:this.accessFilter,accessFreeBySection:this.accessFreeBySection,clusterLabels:this.clusterLabels,seatR:this.seatR,markerR:this.markerR,seatPitch:this.seatPitch,cameraGlideMs:this.cameraGlideMs,seatInClosedSection:e=>this.seatInClosedSection(e),isSectionClosed:e=>this.isSectionClosed(e),renderedSeatPoint:e=>this.renderedSeatPoint(e),sectionMembers:e=>this.sectionMembers(e),sectionBounds:e=>this.sectionBounds(e),seatLabelTargetScale:()=>this.seatLabelTargetScale(),zoomBounds:()=>this.zoomBounds(),framingViewport:()=>this.framingViewport(),worldToScreen:e=>this.worldToScreen(e),getWorldBounds:()=>this.getWorldBounds(),narrowSeatDetailFocus:(e,i,o)=>this.narrowSeatDetailFocus(e,i,o),focusSection:(e,i)=>this.focusSection(e,i),markSectionFocus:(e,i)=>this.markSectionFocus(e,i),clearSectionFocus:()=>this.clearSectionFocus(),focusRegion:(e,i)=>this.focusRegion(e,i)}}focusCategories(e,i){ul(this.focusFramingContext,e,i)}diveCeiling(){return nt(this.focusFramingContext)}focusAccessibleSeats(e){return pl(this.focusFramingContext,e)}focusAccessibleSection(e,i){return ml(this.focusFramingContext,e,i)}accessibleSpread(e){return yl(this.focusFramingContext,e)}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 i=e==="isometric"?1:0,o=this.viewMode==="perspective";if(this.viewMode=e,this.isoTarget=i,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),o){this.isoT=i,this.applyIso(),this.afterViewChange();return}if(this.reducedMotion){this.isoT=i,this.applyIso(),this.afterViewChange();return}let s=this.isoT;if(s===i){this.applyIso(),this.afterViewChange();return}let n=performance.now(),r=l=>{if(this.destroyed)return;let a=Math.min(1,(l-n)/Ks),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 Tt(this.isoState)}effScale(){if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let e=Math.hypot(this.perspectiveBaseAffine.a,this.perspectiveBaseAffine.b),i=Math.hypot(this.perspectiveBaseAffine.c,this.perspectiveBaseAffine.d);return this.stage.scaleX()*Math.min(e,i)}return this.stage.scaleX()*(1-(1-ft)*this.isoT)}isoForward(e){return Ja(e,this.isoState)}isoInverse(e){return el(e,this.isoState)}buildPerspectiveProjection(e){let i=al({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=i.camera,this.perspectiveBaseAffine=i.baseAffine,this.perspectiveBaseInverse=i.baseInverse,this.perspectiveBounds=i.bounds}setContainerAffine(e,i,o){il(e,i,o)}resetContainerTransform(e){ol(e)}sectionSurfaceHeight(e,i){return sl(e,i)}projectedSectionPoint(e,i){return nl(e,i,this.perspectiveBaseAffine)}perspectiveLocalPoint(e){return rl(e,this.perspectiveBaseInverse)}isoLiftLocal(e){return tl(e,this.isoState)}resetLayerTransforms(e=!0){let i=e?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let o of i)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 i of this.sections){this.resetContainerTransform(i.rootGroupBg),this.resetContainerTransform(i.liftGroupBg),e&&this.resetContainerTransform(i.liftGroupSeat),i.rootGroupBg.zIndex(i.bgZIndex),e&&i.liftGroupSeat.zIndex(i.seatZIndex);let o=this.labelLiftGroups.get(i.id);o&&e&&this.resetContainerTransform(o),i.perspectiveAffine=void 0,i.perspectiveCorrection=void 0,i.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,i){ll(this.seatAnchorContext,e,i)}applyPerspective(e=!0){let i=this.perspectiveCamera,o=this.perspectiveBaseAffine,s=this.perspectiveBaseInverse;if(!i||!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,i.target);this.perspectiveAppliedSeats.clear(),n||this.applyExactSeatAnchors(!0);for(let l of this.sections){let a=h=>this.sectionSurfaceHeight(l,h),c=Xt(i,l.centroid,a),d=Ls(s,c);l.perspectiveAffine=c,l.perspectiveCorrection=d,l.perspectiveDepth=be(i,l.centroid,a(l.centroid)).depth,this.setContainerAffine(l.liftGroupBg,d,l.centroid);for(let h=0;h<l.sideFaces.length;h++){let u=l.outline[h],y=l.outline[(h+1)%l.outline.length],f=this.perspectiveLocalPoint(be(i,u,0)),m=this.perspectiveLocalPoint(be(i,y,0)),p=this.perspectiveLocalPoint(be(i,y,a(y))),g=this.perspectiveLocalPoint(be(i,u,a(u)));l.sideFaces[h].points([f.x,f.y,m.x,m.y,p.x,p.y,g.x,g.y]),l.sideFaces[h].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:i,sg:o}=this.isoParams(),s=Math.cos(i),n=o*Math.sin(i),r=-Math.sin(i),l=o*Math.cos(i),a=Math.sqrt(s*s+n*n),c=s*l-n*r,d=Math.atan2(n,s)*180/Math.PI,h=a,u=c/a,y=(s*r+n*l)/c,f=this.isoCentre;for(let m of[this.bgLayer,this.seatLayer,this.overlayLayer])m.position({x:f.x,y:f.y}),m.offset({x:f.x,y:f.y}),m.rotation(d),m.scaleX(h),m.scaleY(u),m.skewX(y),m.skewY(0)}this.applyUprightLabels(),this.applyElevation(),this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyUprightLabels(){let e=qt*this.isoT,i=1/(1-(1-ft)*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(i),r.skewX(0)}}}applyElevation(){let e=this.isoT;for(let i of this.sections){if(i.liftWorld<=0)continue;let o=this.isoLiftLocal(i.liftWorld);i.liftGroupBg?.position(o),i.liftGroupSeat.position(o),this.labelLiftGroups.get(i.id)?.position(o);let s=.9*e;for(let n=0;n<i.sideFaces.length;n++){let r=i.sideFaces[n],l=i.outline[n],a=i.outline[(n+1)%i.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 i=this.focusedSectionId;return i==null||e.id===i||e.logicalId===i||e.zone===i}selectionFocusDims(e){return this.selectionFocusId?!(this.selectionFocusKeep?.has(e)??e===this.selectionFocusId):!1}focusedSeatOpacity(e,i){if(!this.focusedSectionId||!this.focusDimOverlay)return i;let o=this.seatSection.get(e);return i*(o&&this.sectionMatchesFocus(o)?1:ke)}sectionScreenBounds(e){return or({viewMode:this.viewMode,isoT:this.isoT,stageScale:this.stage.scaleX(),stageX:this.stage.x(),stageY:this.stage.y(),projectedSectionPoint:(i,o)=>this.projectedSectionPoint(i,o),isoLiftLocal:i=>this.isoLiftLocal(i),isoForward:i=>this.isoForward(i)},e)}updateSeatGroupVisibility(){let e=this.exportMode||this.effScale()>=ce,i=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"&&!i&&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"&&!i&&(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 i of this.sections)if(!i.liftGroupSeat.isViewportCulled())for(let o of i.memberIds){let s=this.seatById.get(o);s&&e.push(s)}for(let i of this.seats)this.seatSection.has(i.id)||e.push(i);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 i=this.seatSection.get(e.id);if(!i||i.liftWorld<=0||this.isoT===0)return e;let o=this.isoLiftLocal(i.liftWorld);return{x:e.x+o.x,y:e.y+o.y}}seatLabelContainer(e){let i=this.seatSection.get(e);if(!i)return this.labelGroup;let o=this.labelLiftGroups.get(i.id);return o||(o=new ot({listening:!1}),o.setViewportCulled(i.liftGroupSeat.isViewportCulled()),o.position(this.viewMode==="perspective"?{x:0,y:0}:this.isoLiftLocal(i.liftWorld)),this.labelGroup.add(o),this.labelLiftGroups.set(i.id,o)),o}syncSeatOverlayPositions(){if(this.hoveredId){let e=this.seatById.get(this.hoveredId);if(e){this.hoverRing.position(this.renderedSeatPoint(e));let i=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.hoverRing.scale({x:i,y:i})}}if(this.focusedId){let e=this.seatById.get(this.focusedId);if(e){this.focusRing.position(this.renderedSeatPoint(e));let i=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.focusRing.scale({x:i,y:i})}}for(let[e,i]of this.selectionMarkers){let o=this.seatById.get(e);if(o){i.position(this.renderedSeatPoint(o));let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(o.id)??1:1;i.scale({x:s,y:s})}}}renderSeats(e=this.seats){gr({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:i=>this.seatContainer(i),buildAccessGlyph:(i,o)=>this.buildAccessGlyph(i,o),paintSeat:(i,o)=>this.paintSeat(i,o),labelFont:()=>this.labelFont()})}buildAccessGlyph(e,i){let o=this.seatR*1.5/xe,s=new Bh({x:e.x,y:e.y,data:Ht(e.accessibility??[])??"",scaleX:o,scaleY:o,fill:Bi(i),listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});return bi(s),s}updateAccessGlyphs(e){if(this.accessGlyphById.size)for(let[i,o]of this.accessGlyphById){let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(i)??1:1,n=this.seatR*1.5/xe*s,l=this.accessGlyphFilterEmphasized(i)?Gs:Ds,a=Math.max(n,l/(xe*Math.max(e,.001)));o.scale({x:a,y:a}),o.visible(this.accessGlyphShouldShow(i))}}accessGlyphFilterEmphasized(e){let i=this.seatById.get(e),o=this.accessFilter;return!!i&&o!==null&&!!i.accessibility?.includes("wheelchair")&&(o.length===0||o.includes("wheelchair"))&&Le(i,o)}accessGlyphShouldShow(e){return this.accessGlyphById.has(e)&&this.accessGlyphEligible(e)}accessGlyphEligible(e){let i=this.statusById.get(e)??"free";return!(i==="booked"||i==="held"&&!this.ownedHold.has(e)&&!this.opts.manageMode)}categoryPriceLabel(e){let i=this.catPrice.get(e);return typeof i=="number"?gt(i,this.currency):null}categoryDisplayColor(e){return this.colorblind?this.cbHueByKey.get(e)??oi[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,i){let o=i.fill();return Ie(typeof o=="string"?o:"",e.labelStyle?.color,this.theme.seatLabelColor??tt,Ue)}paintSeat(e,i){let o=this.seatById.get(i),s=this.statusById.get(i)??"free",n=this.selection.has(i),r=this.categoryDisplayColor(o.categoryKey),l=this.boothLabelById.get(i);e.dash(Oo),e.strokeWidth(0),e.stroke(""),e.opacity(1),e.scale({x:1,y:1});let a=s==="held"&&this.ownedHold.has(i),c=a?null:ha(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(Te(r,this.effSelection===St?.24:.1)),e.stroke(this.effSelection),e.strokeWidth(3)):e.fill(n&&this.effSelection===St?Te(r,.28):r),this.seatMarks.paint(e,i,s,r,this.seatR,this.colorblind,this.seatInClosedSection(i)),wo(e)&&e.scale({x:1,y:1}),o.wheelchairSpaceType==="no-seat"&&s==="free"&&(e.stroke(At(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??tt:"#ffffff"),l.offsetX(l.width()/2),l.offsetY(l.height()/2));let d=s==="free"||s==="held"&&!this.ownedHold.has(i),h=()=>{let f=e.fill();typeof f=="string"&&e.fill(wa(f,this.canvasBackground))};if(this.accessFilter&&d&&!n){let f=Me(o,this.accessFilter);f==="other"?(h(),e.opacity(Math.min(e.opacity(),lr))):f==="companion"&&e.opacity(Math.min(e.opacity(),cr))}if(this.categoryHighlight&&s==="free"&&!n&&o.categoryKey!==this.categoryHighlight&&e.opacity(.25),this.categoryFilter&&d&&!n&&!this.categoryFilter.has(o.categoryKey)&&(h(),e.opacity(.22)),this.commercialLimitedFilter&&s==="free"&&!n&&(o.commercial?.restrictedView||o.commercial?.obstructedView)&&e.opacity(.22),this.dimmedSections.size){let f=this.seatSection.get(i);(f?this.dimmedSections.has(f.id)||this.dimmedSections.has(f.logicalId)||f.zone!=null&&this.dimmedSections.has(f.zone):this.dimmedSections.has(rs))&&e.opacity(.18)}this.closedSections.size&&this.seatInClosedSection(i)&&(e.fill(mn),e.stroke(""),e.strokeWidth(0),e.dash(Oo),e.opacity(yn),e.scale({x:1,y:1})),this.selectionFocusDims(i)&&e.opacity(Math.min(e.opacity(),.16));let u=this.boothLabelById.get(i)??this.seatLabelById.get(i);u&&(u.fill(this.seatLabelInk(o,e)),u.visible(ge(u.fontSize(),this.effScale())&&e.opacity()>=.5));let y=this.accessGlyphById.get(i);if(y){let f=e.fill();y.fill(Bi(typeof f=="string"?f:"")),y.opacity(e.opacity()),y.visible(this.accessGlyphShouldShow(i))}this.accessRingById.get(i)?.opacity(e.opacity())}seatInClosedSection(e){if(!this.closedSections.size)return!1;let i=this.seatSection.get(e);return!!i&&(this.closedSections.has(i.id)||this.closedSections.has(i.logicalId)||i.zone!=null&&this.closedSections.has(i.zone))}setColorblindSafe(e){if(e!==this.colorblind){this.colorblind=e;for(let i of this.seats){let o=this.circleById.get(i.id);o&&this.paintSeat(o,i.id)}for(let i of this.sections)i.shellCategoryColor=this.dominantSellableColor(i.memberIds),this.refreshSectionFill(i);this.bgLayer.batchDraw(),this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setDimmedSections(e){let i=new Set(e??[]);if(!(i.size===this.dimmedSections.size&&[...i].every(o=>this.dimmedSections.has(o)))){this.dimmedSections=i;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 i=new Set(e??[]);i.size===this.closedSections.size&&[...i].every(o=>this.closedSections.has(o))||(this.closedSections=i,this.repaintSectionsAndSeats())}focusSection(e,i){this.markSectionFocus(e,i?.anchor??null)&&this.focusSectionCamera(e,!0,i?.anchor)}markSectionFocus(e,i){return this.sections.some(o=>o.id===e||o.logicalId===e)?(this.focusedSectionId=e,this.focusAnchor=i,this.focusRoams=!1,this.drawFocusBackdrop(e),this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD(),!0):!1}focusSeats(e,i){return Ao(this.focusFramingContext,e,i)}focusSectionCamera(e,i=!0,o){gl(this.focusFramingContext,e,i,o)}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()>=Ro(this.markerR)}drawFocusBackdrop(e){this.focusBackdrop?.destroy(),this.focusBackdrop=null;let i=this.sections.filter(o=>o.id===e||o.logicalId===e);if(this.focusBackdrop=zr(this.focusBackdropHost,i),!!this.focusBackdrop){this.focusDimOverlay?.destroy(),this.focusDimOverlay=Kr(this.focusBackdropHost,i);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,i)=>this.projectedSectionPoint(e,i),isoLiftLocal:e=>this.isoLiftLocal(e)}}repaintSectionsAndSeats(){for(let e of this.seats){let i=this.circleById.get(e.id);i&&this.paintSeat(i,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}),i=this.screenToWorld({x:this.stage.width(),y:this.stage.height()});return{x:Math.min(e.x,i.x),y:Math.min(e.y,i.y),width:Math.abs(i.x-e.x),height:Math.abs(i.y-e.y)}}getWorldBounds(){let e=1/0,i=1/0,o=-1/0,s=-1/0,n=(r,l)=>{r<e&&(e=r),l<i&&(i=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:i,width:Math.max(1,o-e),height:Math.max(1,s-i)}:{x:0,y:0,width:1,height:1}}getMinimapSnapshot(){let e=this.sections.map(i=>{let o=this.isSectionClosed(i)||i.free<=0,s=i.memberIds.some(l=>this.selection.has(l)),n=s||i.memberIds.some(l=>this.ownedHold.has(l)),r=this.focusedSectionId===i.id||this.focusedSectionId===i.logicalId;return{id:i.logicalId,label:i.label,outline:i.outline.map(l=>({...l})),...this.objectFloor.get(i.id)?{floorId:this.objectFloor.get(i.id)}:{},state:s?"selected":o?"inactive":"available",active:r,paint:{fill:i.shellFill,stroke:i.shellStroke},owned:n}});return{sections:e,seats:e.length?[]:this.seats.map(i=>({x:i.x,y:i.y,categoryKey:i.categoryKey,state:this.selection.has(i.id)?"selected":this.statusById.get(i.id)==="free"?"available":"inactive"}))}}panToWorld(e){this.cancelGlide();let i=this.worldToScreen(e);this.stage.position({x:this.stage.x()+this.stage.width()/2-i.x,y:this.stage.y()+this.stage.height()/2-i.y}),this.afterViewChange(),this.stage.batchDraw()}setCategoryHighlight(e){if(this.categoryHighlight!==e){this.categoryHighlight=e;for(let i of this.seats){let o=this.circleById.get(i.id);o&&this.paintSeat(o,i.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}renderBackground(e){let i=ht(e);i&&this.renderBackgroundImage(i);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,i,o,s){let n=this.assetGeneration;/^https?:\/\//i.test(i)&&(e.crossOrigin="anonymous");let r=new Promise(l=>{let a=!1,c=()=>{a||(a=!0,this.assetCancels.delete(d),l())},d=()=>{e.onload=null,e.onerror=null;try{e.removeAttribute("src"),e.src=""}catch{}c()};this.assetCancels.add(d),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=i});this.assetPromises.push(r)}cancelAssetLoads(){this.assetGeneration++;for(let e of[...this.assetCancels])e();this.assetCancels.clear(),this.assetPromises=[],this.assetErrors=[]}renderBackgroundImage(e){Aa(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,i,o,s)=>this.trackAssetImage(e,i,o,s),isGhostClick:e=>this.isGhostClick(e)}}renderDecorImage(e){Ea(this.objectDrawContext,e)}renderTable(e){_a(this.objectDrawContext,e)}renderText(e){Fa(this.objectDrawContext,e)}renderShape(e){Ba(this.objectDrawContext,e)}renderGA(e){Da(this.objectDrawContext,e)}renderSection(e){let i=hl(this.sectionBuildContext,e);for(let o of i.memberIds)this.seatSection.set(o,i);this.unsectionedSeatIds=null,this.refreshSectionFill(i),this.refreshSectionHeat(i),this.sections.push(i)}get sectionBuildContext(){return{bgLayer:this.bgLayer,seatLayer:this.seatLayer,canvasBackground:this.canvasBackground,seats:this.seats,seatById:this.seatById,seatSection:this.seatSection,seatIndex:this.seatIndex,statusById:this.statusById,catColor:this.catColor,zoneColor:this.zoneColor,chartDoc:this.chartDoc,isoCentre:this.isoCentre,labelFont:()=>this.labelFont(),floorBaseHeightMFor:e=>this.floorBaseHeightMFor(e),dominantSellableColor:e=>this.dominantSellableColor(e)}}refreshSectionHeat(e){Ir(this.sectionLodPaintContext,e)}refreshSectionFill(e){Rr(this.sectionLodPaintContext,e)}isSectionClosed(e){return po(this.sectionLodPaintContext,e)}dominantSellableColor(e){let i=bn(e,o=>this.seatById.get(o)?.categoryKey,o=>this.catByKey.get(o)?.notForSale===!0);return i?this.categoryDisplayColor(i):null}sectionAccessibleFree(e){return Eo(this.focusFramingContext,e)}accessibleSections(e){return _o(this.focusFramingContext,e)}get sectionLodPaintContext(){return{sections:this.sections,zones:this.zones,sectionHeat:this.sectionHeat,closedSections:this.closedSections,canvasBackground:this.canvasBackground,sectionIsOwned:e=>e.memberIds.some(i=>this.selection.has(i)||this.ownedHold.has(i)),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){ar({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 i=this.stage.scaleX(),o={x:(e.x-this.stage.x())/i,y:(e.y-this.stage.y())/i};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 i=this.screenToWorld(e),o=this.sections.find(s=>{if(this.viewMode==="perspective"&&s.perspectiveAffine)return te(i,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 te({x:i.x-n.x,y:i.y-n.y},s.outline,s.holes)});return o?o.logicalId:null}sectionMembers(e){return[...new Set(this.sections.filter(i=>i.id===e||i.logicalId===e||i.zone===e).flatMap(i=>i.memberIds))]}isSelectable(e){return this.seatInClosedSection(e)||!(this.opts.selectableStatuses??["free"]).includes(this.statusById.get(e)??"free")?!1:!this.hiddenByAccessFilter(e)}filterExcludesSeat(e){let i=this.seatById.get(e);return this.hiddenByAccessFilter(e)||i!=null&&Ca({categoryFilter:this.categoryFilter,categoryKey:i.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 i=this.seatById.get(e);return i?Me(i,this.accessFilter)==="other":!1}toggleSeat(e){if(this.ownedHold.has(e)){let i=this.seatById.get(e);i&&this.opts.onDeselect?.(i);return}if(this.selection.has(e)){this.setSelected(e,!1);let i=this.seatById.get(e);i&&this.opts.onDeselect?.(i)}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 i=this.seatById.get(e);i&&this.opts.onSelect?.(i)}this.overlayLayer.batchDraw()}resolveCanvasBackground(){let e=this.theme.background?Fi(this.theme.background):null;if(e)return e;if(typeof getComputedStyle=="function"){let i=this.container;for(;i;){let o=Fi(getComputedStyle(i).backgroundColor);if(o)return o;i=i.parentElement}}return ro}resolveSelectionColor(){return this.theme.selectionColor?this.theme.selectionColor:B(this.canvasBackground)?dr:St}setSelected(e,i,o=!1){let s=this.circleById.get(e);i?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 nr({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:(i,o)=>this.projectedSectionPoint(i,o),isoLiftLocal:i=>this.isoLiftLocal(i),isoForward:i=>this.isoForward(i),renderedSeatPoint:i=>this.renderedSeatPoint(i),labelFont:()=>this.labelFont(),resolveAutomaticRowLabelPosition:(i,o,s)=>this.resolveAutomaticRowLabelPosition(i,o,s),rowLabelBox:(i,o)=>this.rowLabelBox(i,o)},e)}sectionFrameScale(e){let i=this.sectionBounds(e);return i?Math.min(it(this.stage,i,this.zoomBounds(),this.framingViewport()),pi(this.zoomBounds(),this.diveCeiling())):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 Sr(this.screenPickingHost)}nearestSeatToScreen(e,i,o=!1){return br(this.screenPickingHost,e,i,{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>Pe||this.isGhostClick(e))return;let i=Bo(e.target);i&&this.seatsPickable()&&this.handleSeatTap(i)}),this.seatLayer.on("mouseover",e=>{let i=Bo(e.target);if(!i)return;let o=this.seatById.get(i);if(!o)return;this.hoveredId=i;let s=this.hoverAffordance(i);this.hoverRing.position(this.renderedSeatPoint(o));let n=this.viewMode==="perspective"?this.perspectiveSeatScale.get(i)??1:1;this.hoverRing.scale({x:n,y:n}),this.hoverRing.opacity(s==="muted"?Oh:vl),this.hoverRing.dash(s==="muted"?Dh:Oo),this.hoverRing.visible(s!=="none"),this.overlayLayer.batchDraw(),this.clusterLabels.syncCursor(s==="full"),this.opts.onHover?.(o,{mark:this.seatMarks.get(i),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 i=this.container.getBoundingClientRect(),o={x:e.evt.clientX-i.left,y:e.evt.clientY-i.top},s=Math.exp(-e.evt.deltaY*.002);this.zoomAbout(this.stage.scaleX()*z(s,.5,2),o,"frame")}),this.stage.on("click tap",e=>{if(this.moved>Pe||this.isGhostClick(e))return;let i=this.stage.getPointerPosition();if(!i)return;if(!this.cached){if(Bo(e.target)&&this.seatsPickable())return;if(this.seatsPickable()){let s=this.focusedSectionId,n=this.nearestSeatToScreen(i,Oe),r=n?this.seatSection.get(n):null;if(n&&(!s||r&&this.sectionMatchesFocus(r))){this.handleSeatTap(n);return}let l=n?null:this.nearestSeatToScreen(i,Oe,!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 d=this.sectionAt(i);if(d&&d!==s){let h=this.sectionTapAnchor(d,this.screenToWorld(i));this.opts.onSectionTap?this.opts.onSectionTap(d,h):this.focusSection(d,{anchor:h})}else d||this.opts.onBackdropTap();return}if(s)return;let c=this.sections.length?this.sectionAt(i):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(i):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(i),n=this.owned.badgeAt(s)??this.sectionAt(i);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(i)||this.clusterLabels.glideTowardTap(i))return;let o=Math.max(Be*1.2,this.stage.scaleX()*2.5);this.zoomAbout(o,i)})}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,qa(this.markerR))}}zoomAbout(e,i,o="now"){vr(this.stage,e,i,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,i,o){wr(this.stage,e,this.zoomBounds(),i,this.framingViewport(),o),this.settleView(),this.stage.batchDraw()}focusRegion(e,i){let o=typeof e=="string"?this.sectionBounds(e):e;if(!o)return;if(this.cancelGlide(),i?.animate===!1||this.reducedMotion){this.zoomToBounds(o,i?.minScale,i?.maxScale);return}let s=this.framingViewport(),n=s.width,r=s.height,{min:l,max:a}=this.zoomBounds(),c=1.12,d=Math.min(n/(o.width*c),r/(o.height*c)),h=i?.minScale??l,u=z(Math.max(d,h),l,Math.max(h,pi({min:l,max:a},i?.maxScale))),y=s.x+n/2-(o.x+o.width/2)*u,f=s.y+r/2-(o.y+o.height/2)*u,m=this.stage.scaleX(),p=this.stage.x(),g=this.stage.y();if(Math.abs(u-m)<1e-4&&Math.abs(y-p)<.5&&Math.abs(f-g)<.5){this.settleView();return}let b=performance.now(),S=Math.max(180,Math.min(1200,i?.durationMs??this.cameraGlideMs));this.glideInProgress=!0;let v=k=>{if(this.destroyed){this.glideRaf=0,this.glideInProgress=!1;return}let w=Math.min(1,(k-b)/S),L=w<.5?4*w*w*w:1-Math.pow(-2*w+2,3)/2,C=m+(u-m)*L;this.stage.scale({x:C,y:C}),this.stage.position({x:p+(y-p)*L,y:g+(f-g)*L}),this.updateSeatGroupVisibility(),this.updateLOD(),this.scheduleViewChange(),this.stage.batchDraw(),w<1?this.glideRaf=requestAnimationFrame(v):(this.glideRaf=0,this.glideInProgress=!1,this.settleView())};this.glideRaf=requestAnimationFrame(v)}applyLabelVisibility(e){let i=e!==this.labelsVisible;if(this.labelsVisible=e,!i||!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,i)=>this.focusedSeatOpacity(e,i),accessGlyphFilterEmphasized:e=>this.accessGlyphFilterEmphasized(e),seatLabelScale:e=>this.seatLabelScale(e),seatLabelInk:(e,i)=>this.seatLabelInk(e,i),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e)}}getRenderedQualityEvidence(){return this.cancelSeatReveal(!0),Pa(this.renderedQualityContext)}setRung(e){if(e==="zones"){this.cancelGlide(),this.zoomToFit();return}let i=e==="sections"?(Se+ce)/2:this.seatRungScale(),o=this.framingViewport(),s=o.width,n=o.height,r=mi(this.framingWorldRect()),l=r.x,a=r.y;if(e==="sections"&&this.sections.length>0){let u=this.sections.map(p=>{let g=W(p.outline);return{x:g.x+g.width/2,y:g.y+g.height/2}}),y=s/(i*2),f=n/(i*2);if(!u.some(p=>Math.abs(p.x-r.x)<=y&&Math.abs(p.y-r.y)<=f)){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],y=1/0;for(let f of c){let m=f.x-r.x,p=f.y-r.y,g=m*m+p*p;g<y&&(u=f,y=g)}l=u.x,a=u.y}let d=s/(i*1.12),h=n/(i*1.12);this.focusRegion({x:l-d/2,y:a-h/2,width:d,height:h})}seatRungScale(){return Jr(this.seatLabelTargetScale())}narrowSeatDetailFocus(e,i,o){let s=this.framingViewport();return ta({stageWidth:s.width,stageHeight:s.height,fullBounds:i,seatPoints:e,visibleBounds:this.framingWorldRect(),minScale:this.seatRungScale(),tapAnchor:o})}seatLabelTargetScale(){return Xr({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=sr({sections:this.sections.map(i=>({logicalId:i.logicalId,members:i.memberIds.length,bounds:this.sectionScreenBounds(i)})),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,i,o){e.fontSize(Math.max(1,i)),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(),i=Math.max(e,1e-4);for(let[n,r]of this.primaryFocalLabels)Oa(n,r,i,(l,a)=>{this.sizeLabel(l,a,l.y())});this.hasSections?(_r(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=yr(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=z(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(){Va(wi,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,i=typeof document<"u"&&"fonts"in document?document.fonts:null;if(await Promise.all([...this.assetPromises.slice(),...i?[i.ready.then(()=>{}),i.load("700 24px Inter").then(()=>{}),i.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 i=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:i,y:o,width:Math.max(1,s-i),height:Math.max(1,n-o)}}fitExportContent(){if(!this.exportMode)return;let e=this.stage.width(),i=this.stage.height(),o=Math.max(12,Math.min(36,Math.min(e,i)*.025)),s=()=>{let n=this.exportSceneBounds(),r=Math.max(1,e-o*2),l=Math.max(1,i-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:(i-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 i=document.createElement("canvas");i.width=this.stage.width(),i.height=this.stage.height();let o=i.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,i.width,i.height);try{o.drawImage(e,0,0)}finally{e.width=1,e.height=1}return i}updateFreeTextVisibility(){let e=this.exportMode?Math.max(this.effScale(),se):this.effScale();for(let{node:i,backdrop:o,kind:s}of this.freeTextById.values()){if(s==="ga-label"||s==="ga-capacity")continue;let n=s==="free-text"&&this.nodeBelongsToFocusedSection(i),r=s==="direct-landmark";if(r){let a=Number(i.getAttr("directLandmarkBaseFontSize"))||i.fontSize();i.setAttr("directLandmarkBaseFontSize",a),i.fontSize(Math.max(a,H/e))}let l=r||n||ge(i.fontSize(),e);i.visible(l),o?.visible(l)}for(let{node:i,fontSize:o}of this.iconNodeById.values())i.visible(this.nodeBelongsToFocusedSection(i)||ge(o,e))}nodeBelongsToFocusedSection(e){let i=this.focusedSectionId;if(!i)return!1;this.focusMembershipKey!==i&&(this.focusMembership.clear(),this.focusMembershipKey=i);let o=this.focusMembership.get(e);if(o!==void 0)return o;let s=this.sections.filter(r=>r.id===i||r.logicalId===i||r.zone===i),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=>te(l,a.outline,a.holes))}return this.focusMembership.set(e,n),n}buildRowLabelPlan(e){this.rowLabelPlan=Ha(e,{theme:this.theme,canvasBackground:this.canvasBackground,seats:this.seats,seatSection:this.seatSection,seatR:this.seatR,objectFilteredOut:i=>this.objectFilteredOut(i)})}rowLabelBox(e,i,o=Q){return Io(e,i,o)}resolveAutomaticRowLabelPosition(e,i,o){return Wa(e,i,o,this.seatIndex)}objectFilteredOut(e){let i=e.categoryKey;return i?!!(this.categoryHighlight&&i!==this.categoryHighlight||this.categoryFilter&&!this.categoryFilter.has(i)):!1}updateLabels(){Za(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,i)=>this.focusedSeatOpacity(e,i),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=>Ta(this.circleById.get(e)?.fill(),this.canvasBackground,this.filterExcludesSeat(e)),statusCueScale:()=>La(this.markerR),opts:this.opts,seatLabelContainer:e=>this.seatLabelContainer(e),seatLabelScale:e=>this.seatLabelScale(e),labelFont:()=>this.labelFont(),seatLabelInk:(e,i)=>this.seatLabelInk(e,i),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e),seatR:this.seatR,freeTextById:this.freeTextById,bgLayer:this.bgLayer,rowLabelPlan:this.rowLabelPlan,focusedSectionId:this.focusedSectionId,resolveAutomaticRowLabelPosition:(e,i,o)=>this.resolveAutomaticRowLabelPosition(e,i,o),rowLabelBox:(e,i)=>this.rowLabelBox(e,i),isoT:this.isoT,applyUprightLabels:()=>this.applyUprightLabels(),overlayLayer:this.overlayLayer}}handleResize(){this.gestures.invalidateRect();let e=xa({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 i=this.hiddenPose;if(this.hiddenPose=null,e==="unchanged"){i&&this.setCameraPose(i);return}this.stage.size(e),i&&this.setCameraPose(i),this.refitCurrentView()}};It.ZOOM_STEP=1.4;var Do=It;function wl(t,e){return new Do(t,e)}function kl(t,e){t.accessFilter=e===null?null:[...e],t.renderer?.setAccessibilityFilter?.(e);let i=t.renderer?.getFocusedSection?.()??null;i&&t.emitSectionFocus(t.sectionSummary(i))}function Go(t,e){let i=t.renderer;if(!i?.focusAccessibleSeats)return!1;let o=e===void 0?t.accessFilter:e;if(!o)return!1;let s=Tl(t,o);s&&t.setFloor(s);let n=i.focusAccessibleSeats(o);return n&&t.emitSectionFocus(null),n}function Ll(t,e){let i=t.renderer;if(!i?.accessibleSpread)return null;let o=e===void 0?t.accessFilter:e;return o?i.accessibleSpread(o):null}function Cl(t,e){let i=e===void 0?t.accessFilter:e;if(!i)return null;let o=Tl(t,i);o&&t.setFloor(o);let s=t.renderer,n=s?.accessibleSections?.(i)??[];if(!n.length)return null;let r=t.accessStepAt?n.findIndex(a=>a.id===t.accessStepAt):-1,l=n[(r+1)%n.length];return t.accessStepAt=l.id,s?.focusAccessibleSection?.(l.id,i)||s?.focusSection?.(l.id),t.emitSectionFocus(t.sectionSummary(l.id)),{...l,index:n.indexOf(l),total:n.length}}function Tl(t,e){let i=t.doc;if(!i?.floors||i.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=t.getActiveFloorId(),l=i.floors.find(a=>a.id===r);return l&&n(l.objects)?null:i.floors.find(a=>n(a.objects))?.id??null}function xl(t,e){return t.accessFilter?Me(e,t.accessFilter)==="other":!1}function Il(t,e){let i=t.renderer;if(i){if(i.clearSectionFocus?.(),t.emitSectionFocus(null),e?.length){let o=Gh(t,e);o&&t.setFloor(o)}!e?.length&&t.accessFilter&&Go(t)||e?.length&&(i.focusCategories?i.focusCategories(e):i.zoomToFit())}}function Gh(t,e){let i=t.doc;if(!i?.floors||i.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=t.getActiveFloorId(),r=i.floors.find(l=>l.id===n);return r&&s(r.objects)?null:i.floors.find(l=>s(l.objects))?.id??null}function Pl(t,e,i){let o=new Map,s=new Map,n=new Map,r=new Map,l=[],a=new Map(ts(t).map(h=>[h.id,h])),c=Ot(t),d=new Map(c.sections.map(h=>[h.id,h.label]));for(let h of e){o.set(h.label,h.id),s.set(h.label,h),n.set(h.id,h),l.push(h.id);let u=a.get(h.rowId),y=u&&"label"in u&&typeof u.label=="string"?u.label:void 0,f=u?.type==="row"?u.segmentedRow:void 0,m=f?.displayLabel??(u&&"displayLabel"in u&&typeof u.displayLabel=="string"&&u.displayLabel?u.displayLabel:y),p=i.get(h.rowId),g=u?.type==="table"?"table":u?.type==="booth"?"booth":"seat",b=m,S=f?.displayType?.trim()||(u&&"displayType"in u&&typeof u.displayType=="string"&&u.displayType.trim()?u.displayType.trim():void 0),v=h.displayLabel??h.label,k=v.split("-"),w=p||h.kind==="booth"?void 0:m&&v.startsWith(`${m}-`)?v.slice(m.length+1):k[k.length-1]??v;r.set(h.id,{objectId:h.rowId,objectType:g,sectionLabel:d.get(c.objectToSection.get(h.rowId)??""),rowLabel:b,seatNumber:w,...S?{displayType:S,rowType:S}:{}})}return{labelToId:o,labelToSeat:s,seatById:n,seatContext:r,allIds:l}}function Ml(t,e={}){let{baseMs:i=1e3,factor:o=2,maxMs:s=1/0,jitter:n=0,random:r=Math.random}=e,l=Math.min(i*o**Math.max(0,t),s);if(n<=0)return l;let a=Math.min(1,n);return l*(1-a+a*r())}function Rl(t,e,i){return ct(t).map(o=>{let s=t.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:Bt(o).filter(n=>i(n)==="free").length,categoryKey:o.categoryKey,tiers:s?.tiers,price:s?.tiers?.[0]?.price??s?.price??0,currency:e}})}function Al(t,e){let i={};for(let o of t)i[o.id]=e?{available:o.available,selected:e.get(o.id)??0}:{available:o.available};return i}function El(t){let e={};for(let[i,o]of t.seatById)t.groupedTableBySeatId.has(i)||t.closedMembers.has(i)||(t.statusOf(i)??"free")==="free"&&(e[o.categoryKey]=(e[o.categoryKey]??0)+1);for(let i of t.groupedTablesByLabel.values()){if(i.chairs.some(s=>t.closedMembers.has(s.id)))continue;let o=i.chairs[0];o&&(t.statusOf(o.id)??"free")==="free"&&(e[i.categoryKey]=(e[i.categoryKey]??0)+i.maxOccupancy)}for(let i of t.gaAreas??[])e[i.categoryKey]=(e[i.categoryKey]??0)+i.available;return e}function Nh(t){return t.accessibility?.length?t.accessibility:t.accessible?["wheelchair"]:[]}function _l(t,e){let i=new Set,o=new Map;for(let s of t){let n=Nh(s);if(!n.length)continue;let r=e(s.id)==="free";for(let l of n)i.add(l),r&&o.set(l,(o.get(l)??0)+1)}return i.size?$o.filter(s=>i.has(s.key)).map(s=>({key:s.key,count:o.get(s.key)??0})):[]}var hS=5e3,uS={lost:[],holdLapsed:!1,lapsedLabels:[],recoverable:[]};function Hh(t){if(!t.holdActive||t.holdLabels.length===0)return!1;let e=t.now??Date.now();return t.holdExpiresAt!=null&&e>=t.holdExpiresAt+5e3||t.serverHoldActive===!1?!0:!t.holdLabels.some(i=>t.statusOf(i)==="held")}function Fl(t){let e=new Set(t.holdLabels),i=t.selection.filter(s=>!e.has(s)&&t.statusOf(s)!=="free");if(!Hh(t))return{lost:i,holdLapsed:!1,lapsedLabels:[],recoverable:[]};let o=[...t.holdLabels];return{lost:i,holdLapsed:!0,lapsedLabels:o,recoverable:o.filter(s=>t.statusOf(s)==="free")}}function pS(t){return t.lost.length>0||t.holdLapsed}function fS(t){return!t.lapsedLabels.length||!t.recoverable.length?"none":t.recoverable.length===t.lapsedLabels.length?"all":"partial"}function Bl(t,e,i=Date.now()){return e&&i<t+5e3}function Ol(t){if(typeof document>"u"||typeof document.addEventListener!="function")return()=>{};let e=()=>{document.visibilityState==="visible"&&t()};return document.addEventListener("visibilitychange",e),()=>{typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",e)}}function Dl(t){if(!t?.zones?.length)return[];let e=new Set(Ot(t).sections.filter(i=>i.seatCount>0&&!!i.zone).map(i=>i.zone));return t.zones.filter(i=>e.has(i.id)).map(i=>({id:i.id,label:i.label}))}function Gl(t){let e=t.doc;if(!e?.objects?.length)return null;let i=e.focalPoint??{x:0,y:0},o=Ye(e).filter(r=>!t.groupedObjectIds.has(r.rowId)),s=new Set;for(let r of o)t.heldLabels.has(r.label)||t.tierApplies(r)&&(t.accessFilter&&!Le(r,t.accessFilter)||t.statusOfLabel(r.label)==="free"&&s.add(r.label));let n=_s(o,s,{qty:t.qty,categoryKey:t.categoryKey,zoneId:t.zoneId,focal:i,preferPremium:!0});return n.labels.length!==t.qty?null:n.labels.every(r=>t.isPremium(r))?[...n.labels]:null}var No=["background","rowLabelColor","textColor","selectionColor"];function Nl(t,e){return!t||!e?!t&&!e:No.every(i=>t[i]===e[i])}function Pt(t){let e=t??{};return{status:e.status,conflicts:e.conflicts,reason:e.reason}}function ki(t){return t==="blocked"?"not_for_sale":t==="held"||t==="booked"||t==="free"||t==="not_for_sale"?t:"free"}function Hl(t,e,i){let o=ns(e,i);o==="all"?t.setFloorOverview?.(!0):o&&t.setActiveFloor?.(o)}var Ae=class extends Error{constructor(i){super(i.message);this.status=422;this.name="PickerSelectionError",this.reason=i.code,this.labels=i.labels}};function Wl(t,e){return!e||t.eventConfigurationId===e.id&&t.eventConfigurationVersion===e.version?t:{...t,eventConfigurationId:e.id,eventConfigurationVersion:e.version}}var Li=class{constructor(){this.ref=null;this.pending=null}reset(e){this.ref=e??null,this.pending=null}load(e,i){if(!this.ref||!e.eventConfiguration)return Promise.resolve(null);if(!this.pending){let o=this.ref;this.pending=e.eventConfiguration(i).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 Vl(t){if(t!=null&&(!Number.isInteger(t)||t<1))throw new Error("picker: `numberOfPlacesToSelect` must be a positive integer");return t??null}function zl(t,e,i,o){if(i!=null&&!Array.isArray(i))throw new TypeError("picker: `selectionValidators` must be an array");let s=[],n=0,r=!1,l=!1;for(let c of i??[])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"}),t!=null&&n>t)throw new Error("picker: `minimumSelectedPlaces.minimum` cannot exceed `numberOfPlacesToSelect`");let a=Math.max(0,Math.floor(e??t??Math.max(o,n)));if(t!=null&&a<t)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:t??a}}function Wh(t){let e=Number(t.slice(t.lastIndexOf(":")+1));return Number.isInteger(e)?e:-1}function Vh(t){if(t.length<=1)return!1;let e=t[0]?.objectId,i=t[0]?.categoryKey;if(!e||t.some(s=>s.objectId!==e||s.categoryKey!==i))return!0;let o=t.map(s=>Wh(s.id)).sort((s,n)=>s-n);return o.some((s,n)=>s<0||n>0&&s!==o[n-1]+1)}function Kl(t,e,i,o,s){let n=o.find(a=>a.type==="minimumSelectedPlaces")?.minimum??0,r=i??n,l=[];return i!=null&&e!==i&&l.push("numberOfPlacesToSelect"),n&&e<n&&l.push("minimumSelectedPlaces"),o.some(a=>a.type==="consecutiveSeats")&&Vh(t)&&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:t,violations:l}}function Xl(t){let{id:e,doc:i,seatById:o,groupedTableBySeatId:s}=t,n=i.objects.find(v=>v.type==="section"&&v.id===e);if(!n)return null;let r=t.sectionMembers(e),l=new Map,a=new Map,c=new Set,d=0,h=0;for(let v of r){let k=o.get(v);if(!k)continue;t.matchesAccessFilter&&t.statusOf(v)==="free"&&t.matchesAccessFilter(k)&&(h+=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),t.statusOf(w.chairs[0]?.id??v)==="free"&&(d+=w.maxOccupancy,a.set(w.categoryKey,(a.get(w.categoryKey)??0)+w.maxOccupancy))}else l.set(k.categoryKey,(l.get(k.categoryKey)??0)+1),t.statusOf(v)==="free"&&(d++,a.set(k.categoryKey,(a.get(k.categoryKey)??0)+1))}let u=[...l.entries()].map(([v,k])=>{let w=i.categories.find(x=>x.key===v),L=w?.tiers?.length?w.tiers.map(x=>x.price):[w?.price??0],C=Math.min(...L),T=Math.max(...L);return{key:v,count:k,label:w?.label??v,color:w?.color??"#6e7bff",price:C,priceMin:C,priceMax:T}}).sort((v,k)=>v.price-k.price),y=u.map(v=>v.priceMin),f=u.map(v=>v.priceMax),m=n.zone?i.zones?.find(v=>v.id===n.zone):void 0,p=v=>{let k=null,w=0;for(let[L,C]of v)(C>w||C===w&&k!=null&&L<k)&&(k=L,w=C);return k},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}:{},...t.matchesAccessFilter?{accessibleLeft:h}:{},label:n.displayLabel??n.label,zoneLabel:m?.label??"",...n.entrance&&n.entrance.trim()?{entrance:n.entrance.trim()}:{},color:S,seatsLeft:d,priceMin:y.length?Math.min(...y):0,priceMax:f.length?Math.max(...f):0,categories:u}}var Ci=class{constructor(e={}){this.inFlight=null;this.lastSettledAt=Number.NEGATIVE_INFINITY;this.windowMs=e.windowMs??250,this.now=e.now??(()=>Date.now())}run(e,i=!1){if(!i){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 Xh=10,Yh=15e3,Yl=class{constructor(e){this.selectableSeatIds=null;this.lastSelectionValidity=null;this.renderer=null;this.gaSelected=null;this._doc=null;this.eventConfiguration=new Li;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.connectFallback=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 Ci;this.accessFilter=null;this.viewportInsets=null;this.accessStepAt=null;this.hintShown=!1;this.lastSnapshotAt=0;this.opts=e,this.api=e.transport,this.key=e.eventKey,this.numberOfPlacesToSelect=Vl(e.numberOfPlacesToSelect);let i=zl(this.numberOfPlacesToSelect,e.maxSelection,e.selectionValidators,Xh);this.selectionValidators=i.validators,this.maxSelection=i.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=as(this._doc,this.hidden);if(!this.mapTheme)return e;let i={...e.theme??{}};for(let o of No){let s=this.mapTheme[o];s&&(i[o]=s)}return{...e,theme:i}}setMapTheme(e){return Nl(this.mapTheme,e??null)?!1:(this.mapTheme=e??null,this.rebuildPreservingState(),!0)}rebuildPreservingState(){let e=this.renderer;if(!e)return!1;let i=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),i.length&&e.select?.(i),n&&e.focusSection?.(n),r&&e.setCameraPose&&e.setCameraPose(r),e.settleView?.(),!0}refreshMapCopy(){this.rebuildPreservingState()&&this.renderer?.forceDraw()}syncHidden(e){let i=e.filter(s=>typeof s=="string");if(i.length===this.hidden.size&&i.every(s=>this.hidden.has(s)))return!1;this.hidden=new Set(i);let o=this.renderer?.isFloorOverview?.()??!1;return this.renderer?.setChart(this.visibleDoc()),o&&this.renderer?.setFloorOverview?.(!0),!0}syncClosed(e){let i=(e??[]).filter(o=>typeof o=="string");return i.length===this.closedSections.size&&i.every(o=>this.closedSections.has(o))?!1:(this.closedSections=new Set(i),this.renderer?.setClosedSections?.(i),!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 i=this.groupedTablesByLabel.get(e);if(i)return i.chairs.map(s=>s.id);let o=this.labelToId.get(e);return o?[o]:[]}idsForLabels(e){return[...new Set([...e].flatMap(i=>this.idsForLabel(i)))]}tableSelection(e){let i=this.groupedTableBySeatId.get(e)??this.groupedTablesByLabel.get(e);return i?this.toTableSeat(i):null}lineItemDisplay(e){if(e.objectType==="ga"){let s=this.visibleDoc(),n=ct(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 i=this.labelToSeat.get(e.label),o=i?this.seatContext.get(i.id):void 0;return{...i?.displayLabel?{displayLabel:i.displayLabel}:{},...o?.displayType?{displayType:o.displayType}:{}}}async render(e){if(this.renderer)return null;let i=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 d=c.res;if(this.closed)return null;this._doc=Wl(d.doc,d.event.eventConfiguration),this.eventConfiguration.reset(d.event.eventConfiguration);let h=performance.now();try{let C=Fs(d.doc,d.event.inventoryModelVersion===2?2:1);this.groupedTablesByObject=new Map(C.map(T=>[T.objectId,T])),this.groupedTablesByLabel=new Map(C.map(T=>[T.label,T])),this.groupedTableBySeatId=new Map(C.flatMap(T=>T.chairs.map(x=>[x.id,T]))),this.tableQuantities=new Map(C.map(T=>[T.label,T.mode==="whole"?T.capacity:T.minOccupancy])),this.confirmedVariableTables=new Set,this.groupedSelectionOverhead=C.reduce((T,x)=>T+Math.max(0,x.chairs.length-1),0)}catch(C){return this.emitError(C),null}this.expandedSeats=Ye(d.doc,{deriveRestrictedView:d.doc.derivedRestrictedView===!0});let u=Pl(d.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 T=C.chairs[0];T&&(this.labelToId.set(C.label,T.id),this.labelToSeat.set(C.label,T))}o.normalizeBuyerModel=s(h);let y=d.event.currency??this.opts.currency;this.currency=y??"USD";let f=performance.now(),m=wl(e,{maxSelection:this.rendererSelectionCap(),confirmSelection:this.opts.confirmSelection,portraitFitCrop:!1,gaPickerMode:!0,currency:y,...this.opts.loadingReveal?{loadingReveal:this.opts.loadingReveal}:{},onSeatsRevealed:()=>{o.seatsComplete=s(i),this.opts.onSeatsRevealed?.()},onSelect:C=>{this.handleRendererSelect(C)},onDeselect:C=>{this.handleRendererDeselect(C)},onSelectionLimit:this.opts.onSelectionLimit,onHover:(C,T)=>{this.opts.onHover?.(C),this.opts.onSeatHover&&this.opts.onSeatHover(C?this.describeSeat(C,T):null)},onFocusSeat:this.opts.onFocusSeat,onViewChange:this.opts.onViewChange,onGAClick:this.opts.onGAClick,onSectionTap:(C,T)=>this.handleSectionTap(C,T),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(f),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(T=>typeof T=="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()),Hl(m,d.doc,e.clientWidth),this.opts.colorblindSafe&&m.setColorblindSafe?.(!0),o.buildScene=s(v),this.closedSections=new Set(b);let k=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(k);let w=performance.now();m.forceDraw(),o.firstPaint=s(w);let L=performance.now();return S.ok&&this.snapshots.markSettled(),this.attachVisibility(),this.connect(),o.startRealtime=s(L),o.controllerTotal=s(i),{doc:d.doc,salesClosed:!!d.event.salesClosed,eventName:d.event.name,venue:d.event.venue,startsAt:d.event.startsAt,timezone:d.event.timezone??null,currency:y,mode:d.event.mode??"live",locale:d.event.locale??null,posterUrl:d.event.posterUrl??null,chartDelivery:d.chartDelivery,performanceProfile:o}}getSelection(){if(!this.renderer)return[];let e=[],i=new Set;for(let o of this.renderer.getSelection()){let s=this.groupedTableBySeatId.get(o.id);s?i.has(s.label)||(i.add(s.label),e.push(this.toTableSeat(s))):e.push(this.toSeat(o))}return e}seatDetails(e){let i=this.seatById.get(e);return i?this.describeSeat(i):null}clearSelection(){this.renderer?.clearSelection(),this.resetUnheldTableQuantities(),this.emitSelectionChange()}deselect(e){let i=new Set;for(let o of e){let s=this.groupedTableBySeatId.get(o)??this.groupedTablesByLabel.get(o);if(s)s.chairs.forEach(n=>i.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&&i.add(n)}}this.renderer?.deselect([...i]),this.emitSelectionChange()}setMaxSelection(e){this.maxSelection=Math.max(0,Math.floor(e)),this.renderer?.setMaxSelection?.(this.rendererSelectionCap())}select(e){let i=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 Ae(Gi(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=>!i.has(r.label));return n.length&&this.emitSelectionChange(),n}selectCategories(e){let i=new Set(e);return this.select([...this.seatById.values()].filter(o=>i.has(o.categoryKey)).map(o=>o.id))}deselectCategories(e){let i=new Set(e);this.deselect(this.getSelection().filter(o=>i.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 i=this.renderer?.getSelection().filter(o=>!this.isSelectableByPolicy(o.id)).map(o=>o.id)??[];i.length&&this.deselect(i)}getSelectionValidity(e){if(this.numberOfPlacesToSelect==null&&!this.selectionValidators.length)return null;let i=this.getSelection(),o=e??i.reduce((s,n)=>s+(n.quantity??1),0);return Kl(i,o,this.numberOfPlacesToSelect,this.selectionValidators,()=>this.hasOrphanedSelection())}hasOrphanedSelection(){let e=this.renderer;if(!e)return!1;let i=new Set(e.getSelection().map(o=>o.id));return i.size>0&&Di(this.seatById.values(),o=>e.getStatus(o),i).length>0}rebuildSelectableSeatIds(){if(this.selectableObjectRefs==null){this.selectableSeatIds=null;return}let e=new Set;for(let i of this.selectableObjectRefs){let o=this.groupedTableBySeatId.get(i)??this.groupedTablesByLabel.get(i);if(o){o.chairs.forEach(n=>e.add(n.id));continue}let s=this.seatById.has(i)?i:this.labelToId.get(i);s&&e.add(s)}this.selectableSeatIds=e}isSelectableByPolicy(e){return this.selectableSeatIds==null||this.selectableSeatIds.has(e)}setTableQuantity(e,i){let o=this.groupedTablesByLabel.get(e);if(!o)return!1;let s=o.mode==="whole"?o.capacity:Math.floor(i);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,i,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(i);if(!Number.isInteger(r)||r<s.minOccupancy||r>s.maxOccupancy)return null;if((n.items??[]).filter(d=>d.label!==e).reduce((d,h)=>d+(h.quantity??1),0)+r>this.maxSelection)return this.opts.onSelectionLimit?.(this.maxSelection),null;let a=(n.items??[]).map(d=>({label:d.label,tierId:d.tierId,quantity:d.label===e?r:d.quantity}));if(!a.some(d=>d.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(d=>d.label),expiresAt:c.expiresAt,items:c.items}),this.hold_}rendererSelectionCap(){return this.maxSelection+this.groupedSelectionOverhead}selectionGuestCount(){return this.getSelection().reduce((e,i)=>e+(i.quantity??1),0)}handleRendererSelect(e){let i=this.groupedTableBySeatId.get(e.id);if(!this.isSelectableByPolicy(e.id)){this.renderer?.deselect(i?i.chairs.map(s=>s.id):[e.id]),this.emitSelectionChange();return}if((i?this.tableTierResolution(i):this.seatTierResolution(e)).kind==="invalid"){this.renderer?.deselect(i?i.chairs.map(s=>s.id):[e.id]),this.emitError(new Ae(Gi([i?.label??e.label]))),this.emitSelectionChange();return}if(i){if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect(i.chairs.map(s=>s.id)),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.renderer?.select?.(i.chairs.map(s=>s.id)),this.opts.onSelect?.(i.chairs[0]??e),this.opts.onTableSelectionRequest?.(this.toTableSeat(i)),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 i=this.groupedTableBySeatId.get(e.id),o=i?.label??e.label;if(this.hold_?.labels.includes(o)){this.opts.onDeselect?.(i?{...e,label:o}:e);return}i?(this.renderer?.deselect(i.chairs.map(s=>s.id)),this.hold_?.labels.includes(i.label)||(this.tableQuantities.set(i.label,i.mode==="whole"?i.capacity:i.minOccupancy),i.mode==="variable"&&this.confirmedVariableTables.delete(i.label)),this.opts.onDeselect?.(i.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 i of e){let o=this.groupedTablesByLabel.get(i);o&&(this.tableQuantities.set(i,o.mode==="whole"?o.capacity:o.minOccupancy),o.mode==="variable"&&this.confirmedVariableTables.delete(i))}}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,i){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 Ae(l);if(this.hold_&&this.holdCovers(r))return this.hold_;try{let a=r.map(d=>{let h=n.find(f=>f.label===d);if(h)return{label:d,tierId:h.tierId,quantity:h.quantity};let u=this.labelToSeat.get(d),y=u?this.toSeat(u):null;return{label:d,...y?.tierId?{tierId:y.tierId}:{},...this.tableQuantityRequest(y)}}),c=await this.api.hold(this.key,a,i,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 i=await this.api.resume(this.key,e);if(this.closed)return null;let o=[...new Set(i.items.map(s=>s.label))];return o.length?(this.setHold({holdId:i.holdId,labels:o,expiresAt:i.expiresAt,items:i.items},"restored"),this.hold_):null}async extendHold(e){let i=this.hold_;if(!i||!this.api.extend)return null;try{let o=await this.api.extend(this.key,i.holdId,e);return this.hold_?.holdId!==i.holdId?this.hold_:(this.setHold({holdId:i.holdId,labels:i.labels,expiresAt:o.expiresAt,items:i.items}),this.hold_)}catch{return null}}categoryAvailability(){return El({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,i=this.renderer;if(!i||!this.closedSections.size)return e;for(let o of this.closedSections)for(let s of i.sectionMembers?.(o)??[])e.add(s);return e}getGAAreas(){let e=this.visibleDoc();return e?Rl(e,this.currency,i=>this.statusOf(i)):[]}setGASelection(e){this.gaSelected=e?new Map(e):null,this.pushGAState()}pushGAState(){this.renderer?.setGAStates?.(Al(this.getGAAreas(),this.gaSelected))}async holdGA(e,i,o={}){let s=this.visibleDoc();if(!s||!Number.isFinite(i)||i<1)return null;let n=ct(s).find(d=>d.id===e);if(!n)return null;let r=Bt(n).filter(d=>!this.hold_?.labels.includes(d)&&this.statusOf(d)==="free").slice(0,Math.floor(i));if(r.length!==Math.floor(i))return null;let l=new Map;for(let d of this.hold_?.items??[])l.set(d.label,{label:d.label,tierId:d.tierId,quantity:d.quantity});if(this.hold_&&!this.hold_?.items?.length)for(let d of this.hold_.seats)l.set(d.label,{label:d.label,...d.tierId?{tierId:d.tierId}:{}});for(let d of this.getSelection())l.set(d.label,{label:d.label,...d.tierId?{tierId:d.tierId}:{},...this.tableQuantityRequest(d)});for(let d of r)l.set(d,{label:d,...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(d=>d.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 Dl(this.visibleDoc())}pickPremiumBlock(e,i,o){return Gl({doc:this.visibleDoc(),qty:e,categoryKey:i,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,i,o={}){let s=this.renderer;if(!s)return null;if(o.preferPremium){let n=this.pickPremiumBlock(e,i,o.zoneId);if(n){if(this.hold_&&!await this.release())return null;try{let r=n.map(d=>{let h=this.labelToSeat.get(d),u=h?this.toSeat(h):null;return{label:d,...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(d=>this.labelToSeat.get(d)).filter(d=>!!d).map(d=>this.toSeat(d));return this.opts.onSelectionChange?.(c),this.hold_}catch(r){let{status:l,reason:a}=Pt(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,i,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}=Pt(n);throw r===409&&l==="event_closed"&&this.opts.onSalesClosed?.(),n}}async book(e,i,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=i??this.getSelection().map(c=>c.label);if(!n.length)return null;let r=this.ticketIssue(n);if(r)throw new Ae(r);let l;try{if(this.hold_&&this.holdCovers(n))l=this.hold_.holdId;else{let c=this.hold_?.holdId,d=await this.api.hold(this.key,n.map(h=>{let u=this.labelToSeat.get(h),y=u?this.toSeat(u):null;return{label:h,...y?.tierId?{tierId:y.tierId}:{},...this.tableQuantityRequest(y)}}),o,c);l=d.holdId,this.setHold({holdId:l,labels:[...n],expiresAt:d.expiresAt,items:d.items})}await this.api.book(this.key,n,l,e)}catch(c){let{status:d,conflicts:h,reason:u}=Pt(c);if(this.clearHold(),d===409&&u==="event_closed")this.opts.onSalesClosed?.();else if(d===409&&h?.length){let y=new Set(h.map(p=>p.label)),f=this.idsForLabels(y);f.length&&(s.setStatus(f,"booked"),s.deselect(f),this.resetTableQuantitiesForLabels(y));let m=n.filter(p=>!y.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 i=this.idsForLabels(e.labels);return i.length&&(this.renderer?.deselect(i),this.renderer?.setStatus(i,"free")),!0}async releaseLabels(e){let i=this.hold_;if(!i)return!0;let o=e.filter(l=>i.labels.includes(l));if(!o.length)return!0;try{let l=await this.api.release(this.key,o,i.holdId);if(!this.releaseConfirmed(l,o))return await this.resnapshot(),!1}catch(l){return this.emitError(l),!1}if(this.hold_?.holdId!==i.holdId)return!0;let s=i.labels.filter(l=>!o.includes(l)),n=i.items?.filter(l=>!o.includes(l.label));s.length?this.setHold({...i,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,i){let o=e?.released;return!Array.isArray(o)||i.every(s=>o.includes(s))}setStatus(e,i){this.renderer?.setStatus(e,i)}getStatus(e){return this.renderer?.getStatus(e)}notForSaleCategorySeatIds(){let e=this.doc;if(!e)return[];let i=new Set(e.categories.filter(s=>s.notForSale).map(s=>s.key));if(!i.size)return[];let o=[];for(let[s,n]of this.seatById)i.has(n.categoryKey)&&o.push(s);return o}flashSeat(e,i){this.renderer?.flashSeat(e,i)}zoomIn(){this.renderer?.zoomIn()}zoomOut(){let e=this.renderer;if(!e?.zoomOutLevel)return void e?.zoomOut();let i=!!e.getFocusedSection?.();e.zoomOutLevel()==="venue"&&i&&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){kl(this.pickerFocusContext,e)}getAccessibilityFilter(){return this.accessFilter?[...this.accessFilter]:null}get pickerFocusContext(){let e=this;return{renderer:e.renderer,doc:e._doc,get accessFilter(){return e.accessFilter},set accessFilter(i){e.accessFilter=i},get accessStepAt(){return e.accessStepAt},set accessStepAt(i){e.accessStepAt=i},getActiveFloorId:()=>e.getActiveFloorId(),setFloor:i=>e.setFloor(i),sectionSummary:i=>e.sectionSummary(i),emitSectionFocus:i=>{e.opts.onSectionFocus?.(i)}}}focusAccessibilityFilter(e){return Go(this.pickerFocusContext,e)}accessibilitySpread(e){return Ll(this.pickerFocusContext,e)}focusNextAccessibleSection(e){return Cl(this.pickerFocusContext,e)}accessibilityFilterDims(e){return xl(this.pickerFocusContext,e)}setCommercialLimitedFilter(e){this.renderer?.setCommercialLimitedFilter?.(e)}getFloors(){return this.renderer?.getFloors?.()??[]}getActiveFloorId(){return this.renderer?.getActiveFloorId?.()??""}setFloor(e){let i=this.renderer;!i?.setActiveFloor||e===i.getActiveFloorId?.()&&!i.isFloorOverview?.()||(i.setFloorOverview?.(!1),i.setStacked?.(!1),i.setActiveFloor(e),this.resnapshot(),this.emitSelectionChange())}setStacked(e){let i=this.renderer;!i?.setStacked||e===i.isStacked?.()||(i.setStacked(e),this.resnapshot())}isMultiFloor(){return(this._doc?.floors?.length??0)>1}setFloorOverview(e){let i=this.renderer;!i?.setFloorOverview||e===i.isFloorOverview?.()||(i.setFloorOverview(e),this.resnapshot(),this.emitSelectionChange())}isFloorOverview(){return this.renderer?.isFloorOverview?.()??!1}handleDeckTap(e){let i=this.renderer;i&&(i.setViewMode?.("flat"),i.setFloorOverview?.(!1),i.setStacked?.(!1),i.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){Il(this.pickerFocusContext,e)}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,i){this.handleSectionTap(e,i)}focusSeats(e,i){let o=this.renderer;if(!o?.focusSeats?.(e,i))return!1;let s=o.getFocusedSection?.()??null;return this.opts.onSectionFocus?.(s?this.sectionSummary(s):null),!0}getSectionSeatCount(e){return this.renderer?.sectionMembers?.(e)?.length??0}overview(){this.renderer?.clearSectionFocus?.(),this.renderer?.zoomToFit(),this.opts.onSectionFocus?.(null)}handleSectionTap(e,i){let o=this.renderer;if(o){if(o.focusSection?o.focusSection(e,i?{anchor:i}: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:Xl({id:e,doc:this._doc,sectionMembers:i=>this.renderer?.sectionMembers?.(i)??[],statusOf:i=>this.renderer?.getStatus(i)??"free",seatById:this.seatById,groupedTableBySeatId:this.groupedTableBySeatId,...this.accessFilter?{matchesAccessFilter:i=>Le(i,this.accessFilter)}:{}})}clearConnectFallback(){this.connectFallback&&(clearTimeout(this.connectFallback),this.connectFallback=null)}destroy(){if(this.closed=!0,this.clearConnectFallback(),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 i=this.groupedTableBySeatId.get(e.id);if(i)return this.toTableSeat(i);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 d=c.tier;return{id:e.id,label:e.label,...s,...l,categoryKey:e.categoryKey,price:d.price,currency:this.currency,tiers:a,tierId:d.id,...o,...n,...r}}toTableSeat(e){let i=e.chairs[0],o=this.tiersFor(e.categoryKey)?.filter(r=>Yt(this._doc,this.tableTierSeat(e),r.id).kind==="resolved"),s=this.tableTierResolution(e),n=s.kind==="resolved"?s.tier:void 0;return{id:i?.id??e.objectId,label:e.label,displayLabel:e.displayLabel??e.label,...e.displayType?{displayType:e.displayType,rowType:e.displayType}:{},objectId:e.objectId,sectionLabel:i?this.seatContext.get(i.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,i){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,...i?.interaction?{interaction:i.interaction}:{},...i?.unavailable?{unavailable:!0}:{},...i?.filteredOut?{filteredOut:!0}:{},currency:this.currency,...this.seatContext.get(e.id)}}priceFor(e){return this._doc?.categories.find(i=>i.key===e)?.price??0}tiersFor(e){let i=this._doc?.categories.find(o=>o.key===e)?.tiers;return i&&i.length?i:void 0}tiersForSeat(e){if(!this._doc)return;let i=As(this._doc,e);return i.length?i:void 0}seatTierResolution(e){return this._doc?Yt(this._doc,e,this.seatTiers.get(e.id)):{kind:"none"}}tableTierSeat(e){return{label:e.label,categoryKey:e.categoryKey,accessibility:e.chairs.flatMap(i=>i.accessibility??[])}}tableTierResolution(e){if(!this._doc)return{kind:"none"};let i=e.chairs[0]?.id??"";return Yt(this._doc,this.tableTierSeat(e),this.seatTiers.get(i))}setSeatTier(e,i){let o=this.seatById.get(e);if(!o)return;let s=this.tiersForSeat(o);if(s){if(i==null)this.seatTiers.delete(e);else if(s.some(n=>n.id===i))this.seatTiers.set(e,i);else return;this.emitSelectionChange(),this.hold_&&(this.hold_={...this.hold_,seats:this.seatsForLabels(this.hold_.labels)})}}seatsForLabels(e){let i=[];for(let o of e){let s=this.labelToSeat.get(o);s&&i.push(this.toSeat(s))}return i}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 i=e?this.seatsForLabels(e):this.getSelection();return Es(this._doc,i.map(o=>({label:o.label,...o.tierId?{tierId:o.tierId}:{}})))}emitOrphanHint(){if(!this.opts.onHint)return;let e=this.renderer;if(!e)return;let i=this.ticketIssue();if(i){this.hintShown=!0,this.opts.onHint(i.code==="companion_pair_required"?G("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?Di(this.seatById.values(),r=>e.getStatus(r),s):[]).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 i=this.hold_;if(!i||i.labels.length!==e.length||!e.every(n=>i.labels.includes(n)))return!1;let o=new Map((i.items??[]).map(n=>[n.label,n.tierId])),s=new Map((i.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:i,conflicts:o}=Pt(e);if(i!==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,i="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),i==="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 i=await this.api.objects(this.key);if(this.hold_?.holdId!==e.holdId)return;this.applySeatsMap(i.seats,i.default??"free")}catch{this.hold_?.holdId===e.holdId&&(this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},2e3));return}if(this.hold_?.holdId===e.holdId){if(Bl(e.expiresAt,e.labels.some(i=>this.statusOf(i)==="held"))){this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},1e3);return}this.clearHold(),this.opts.onHoldExpired?.()}}}applySeatsMap(e,i="free"){let o=this.renderer;if(!o)return;let s=this.seatsMapDiffers(e,i);this.lastSnapshotAt=Date.now(),this.liveStatuses=new Map(Object.entries(e)),this.liveDefault=i;let n=ki(i);this.allIds.length&&o.setStatus(this.allIds,n),o.setOwnedHold?.(this.idsForLabels(this.hold_?.labels??[]));let r={free:[],held:[],booked:[],not_for_sale:[]};for(let[a,c]of Object.entries(e))r[ki(c)].push(...this.idsForLabel(a));["free","held","booked","not_for_sale"].forEach(a=>{a!==n&&r[a].length&&o.setStatus(r[a],a)});let l=this.notForSaleCategorySeatIds();l.length&&o.setStatus(l,"not_for_sale"),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.({changed:s})}snapshotIsFresh(e=5e3){return this.lastSnapshotAt>0&&Date.now()-this.lastSnapshotAt<e}statusOf(e){return this.liveStatuses.get(e)??this.liveDefault}clearBookedHoldIfSettled(){let e=this.hold_;e?.labels.every(i=>this.statusOf(i)==="booked")&&(this.clearHold(),this.resetTableQuantitiesForLabels(e.labels))}resnapshot(e=!1){return this.snapshots.run(async()=>{let i=await this.api.objects(this.key);this.applySeatsMap(i.seats,i.default??"free")},e)}refresh(){return this.resnapshot(!0)}async refreshAvailability(){await this.resnapshot();let e=this.hold_,i=Fl({selection:this.getSelection().map(o=>o.label),holdLabels:e?.labels??[],holdActive:!!e,holdExpiresAt:e?.expiresAt??null,statusOf:o=>this.statusOf(o)});if(i.lost.length&&this.deselect(i.lost),i.holdLapsed){this.clearHold(),this.resetTableQuantitiesForLabels(i.lapsedLabels);let o=this.idsForLabels(i.lapsedLabels);o.length&&this.renderer?.deselect(o),this.opts.onHoldExpired?.()}return this.opts.onAvailabilityRefresh?.(i),i}getAccessNeeds(){return _l(this.seatById.values(),e=>this.getStatus(e)??"free")}attachVisibility(){this.detachVisibility||(this.detachVisibility=Ol(()=>{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:e=>e?.reason==="connect"&&this.snapshotIsFresh()?Promise.resolve():this.resnapshot(),onSections:(e,i)=>{let o=this.syncHidden(e),s=this.syncClosed(i);o&&this.resnapshot(),(o||s)&&this.opts.onStatusChange?.({changed:!0})}}}seatsMapDiffers(e,i){if(this.lastSnapshotAt===0||i!==this.liveDefault)return!0;let o=Object.entries(e);if(o.length!==this.liveStatuses.size)return!0;for(let[s,n]of o)if(this.liveStatuses.get(s)!==n)return!0;return!1}applyStatusChanges(e){let i=this.renderer;if(!i)return;let o=e.some(s=>this.liveStatuses.get(s.label)!==s.status);for(let s of e){this.liveStatuses.set(s.label,s.status);let n=this.idsForLabel(s.label);if(!n.length)continue;let r=ki(s.status);this.opts.flashOnLiveChange&&r!=="free"&&n.some(l=>i.getStatus(l)==="free")&&!this.hold_?.labels.includes(s.label)&&n.forEach(l=>i.flashSeat(l,r==="held"?"#f4b740":"#f43f5e")),i.setStatus(n,r)}this.opts.keepLiveWhileHidden&&typeof document<"u"&&document.visibilityState==="hidden"&&i.forceDraw(),this.pushGAState(),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.({changed:o})}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 i;try{let o=this.api.socketProtocols?.(this.key);i=o&&o.length?new WebSocket(e,o):new WebSocket(e)}catch{this.scheduleReconnect();return}this.ws=i,i.onopen=()=>{if(this.attempt=0,!this.snapshotIsFresh()){this.resnapshot();return}this.clearConnectFallback(),this.connectFallback=setTimeout(()=>{this.connectFallback=null,this.resnapshot()},2500)},i.onmessage=o=>{this.clearConnectFallback();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?.({changed:!0})),Array.isArray(r.closed)&&this.syncClosed(r.closed)&&this.opts.onStatusChange?.({changed:!0}),r.type!=="hidden"&&(r.seats&&typeof r.seats=="object"?this.applySeatsMap(r.seats):Array.isArray(r.changes)&&this.applyStatusChanges(r.changes))},i.onclose=()=>{this.ws===i&&(this.ws=null),this.scheduleReconnect()},i.onerror=()=>{try{i.close()}catch{}}}scheduleReconnect(){if(this.closed||this.reconnectTimer)return;let e=Math.min(this.attempt++,5),i=Ml(e,{baseMs:1e3,maxMs:Yh,jitter:1});this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},i)}};var Uh=5,$h=-1.1,Ho=35;function Wo(t,e){let i=t-ee,o=Math.atan2(Uh-i,e)*180/Math.PI,s=Math.atan2($h-i,e)*180/Math.PI;return s<-Ho&&(o+=-Ho-s,s=-Ho),{topPitch:o,basePitch:s}}var q=2048,pe=1024,Rt=jo,E=Math.PI*2,qh=pe/180,at=t=>(t+180)/360*q,K=t=>(90-t)/180*pe;function jl(t){let e=2166136261;for(let i=0;i<t.length;i++)e^=t.charCodeAt(i),e=Math.imul(e,16777619);return e>>>0}function Ql(t){let e=t>>>0;return()=>{e|=0,e=e+1831565813|0;let i=Math.imul(e^e>>>15,1|e);return i=i+Math.imul(i^i>>>7,61|i)^i,((i^i>>>14)>>>0)/4294967296}}var Ti=96,Ko=360/Ti,Zh=.6,Vo=[17,23,42];function zo(t,e,i=1){let o=Math.max(0,Math.min(.58,e)),s=Math.round(t[0]+(Vo[0]-t[0])*o),n=Math.round(t[1]+(Vo[1]-t[1])*o),r=Math.round(t[2]+(Vo[2]-t[2])*o);return`rgba(${s},${n},${r},${i})`}function Ul(t,e,i){return[Math.round(t[0]+(e[0]-t[0])*i),Math.round(t[1]+(e[1]-t[1])*i),Math.round(t[2]+(e[2]-t[2])*i)]}function oe(t,e,i){let o=(1-Math.abs(2*i-1))*e,s=(t%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=i-o/2;return[Math.round((r+c)*255),Math.round((l+c)*255),Math.round((a+c)*255)]}var $l=new Map;function ql(t){if(!t)return null;let e=$l.get(t);if(e)return e;let i=2166136261;for(let n=0;n<t.length;n++)i^=t.charCodeAt(n),i=Math.imul(i,16777619);let o=(i>>>0)%360,s=oe(o,.3,.42);return $l.set(t,s),s}function jh(t,e,i,o){let s=new Array(Ti).fill(null),n=0,r=t.sectionId;for(let l of e){if(l.id===t.id)continue;let a=l.sectionId;if(!a||r&&a===r)continue;let c=l.x-t.x,d=l.y-t.y,h=Math.hypot(c,d)*Rt;if(h<1.5||h>95)continue;let u=l.eyeHeightM??ee,y=u-o;Math.abs(y)>n&&(n=Math.abs(y));let f=Math.atan2(y,h)*180/Math.PI,m=Math.atan2(u-ee-o,h)*180/Math.PI,g=((Math.atan2(c,-d)-i)*180/Math.PI+540)%360-180,b=Math.min(Ti-1,Math.max(0,Math.floor((g+180)/Ko))),S=f>34&&h<16,v=s[b];v?(f>v.top&&(v.top=f),m<v.base&&(v.base=m),h<v.nearM&&(v.nearM=h,v.tint=ql(l.categoryKey)),v.overhead=v.overhead||S):s[b]={top:f,base:m,nearM:h,overhead:S,tint:ql(l.categoryKey)}}return{bins:s,maxDelta:n}}function Qh(t,e,i,o){for(let s=0;s<Ti;s++){let n=e[s];if(!n)continue;let r=-180+s*Ko,l=i(r),a=i(r+Ko);if(!(a>l))continue;let c=Math.min(72,n.top),d=Math.min(n.base,-4),h=o(c),u=o(d);if(u<=h)continue;let y=n.nearM/95,f=n.tint,m=f?Ul([44,54,80],f,.34):[44,54,80],p=f?Ul([24,30,48],f,.28):[24,30,48],g=t.createLinearGradient(0,h,0,u);g.addColorStop(0,zo(m,y)),g.addColorStop(.24,zo(p,y)),g.addColorStop(1,zo([10,13,22],y)),t.fillStyle=g,t.fillRect(l,h,a-l+1,u-h),t.fillStyle=`rgba(150,165,205,${.35*(1-y*.55)})`,t.fillRect(l,h,a-l+1,1.5);let S=Math.min(u,o(0))-h;if(S>8){let k=1-y*.4;for(let w=1;w<6;w++){let L=h+S*w/6;t.fillStyle=`rgba(0,0,0,${.16*k})`,t.fillRect(l,L,a-l+1,1.5),t.fillStyle=`rgba(120,134,170,${.1*k})`,t.fillRect(l,L+1.5,a-l+1,1.2)}}if(n.overhead){let v=o(Math.min(86,c+12)),k=t.createLinearGradient(0,v,0,h);k.addColorStop(0,"rgba(3,4,8,0.9)"),k.addColorStop(1,"rgba(3,4,8,0)"),t.fillStyle=k,t.fillRect(l,v,a-l+1,h-v),t.fillStyle="rgba(120,130,160,0.14)",t.fillRect(l,h-1.5,a-l+1,1.5)}}}function Jh(t,e,i){let s=new Array(72).fill(!1),n=new Array(72).fill(1/0),r=new Set,l=0;for(let g of i){l++,g.sectionId&&r.add(g.sectionId);let b=g.x-e.x,S=g.y-e.y,v=Math.hypot(b,S)*Rt;if(v<.5)continue;let k=Math.atan2(b,-S),w=Math.floor((k+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 d=a/72*360;c.sort((g,b)=>g-b);let h=c.length?c[c.length>>1]:0,u=c.length?c[Math.floor(c.length*.15)]??h:0,y=c.length?c[Math.floor(c.length*.85)]??h:0,f=u>.5?y/u:1,m=jl(`${l}|${[...r].sort().join(",")}|${Math.round(e.x)},${Math.round(e.y)}`),p;return d>=300&&h>11&&f>1.35?p="sport":d>=285?p="arena":p="proscenium",{mode:p,seed:m,voidRadiusM:h,aspect:f}}var eu=5;function tu(t,e,i){switch(i){case 1:t.beginPath(),t.ellipse(0,-e*.14,e*1.16,e*1.16,0,0,E),t.fill();break;case 2:t.beginPath(),t.ellipse(0,-e*1.02,e*.42,e*.42,0,0,E),t.fill(),t.beginPath(),t.ellipse(0,-e*.2,e*.98,e*1.02,0,0,E),t.fill();break;case 3:t.beginPath(),t.ellipse(0,-e*.36,e*1.04,e*.6,0,Math.PI,E),t.fill(),t.beginPath(),t.ellipse(0,-e*.52,e*1.22,e*.24,0,0,E),t.fill();break;case 4:t.beginPath(),t.ellipse(-e*.66,e*.5,e*.5,e*1.35,0,0,E),t.fill(),t.beginPath(),t.ellipse(e*.66,e*.5,e*.5,e*1.35,0,0,E),t.fill(),t.beginPath(),t.ellipse(0,-e*.08,e*1.06,e*1.08,0,0,E),t.fill();break;default:break}}function iu(t,e,i,o,s){let n=o*.44,r=o*s.shoulderK,l=o*.66,a=o*1.68,c=o*5.4,d=`rgba(${s.clothing[0]},${s.clothing[1]},${s.clothing[2]},${s.alpha})`,h=`rgba(${s.tone[0]},${s.tone[1]},${s.tone[2]},${s.alpha})`;t.save(),t.translate(e,i);let u=s.lean*o;t.fillStyle=d,t.beginPath(),t.moveTo(-n,l),t.quadraticCurveTo(-n*1.18,a-u-o*.6,-r,a-u),t.quadraticCurveTo(-r*1.05,a+o*1.2,-r*.94,c),t.lineTo(r*.94,c),t.quadraticCurveTo(r*1.05,a+o*1.2,r,a+u),t.quadraticCurveTo(n*1.18,a+u-o*.6,n,l),t.closePath(),t.fill(),t.fillStyle=h,t.fillRect(-n*.82,o*.5,n*1.64,o*.9),t.save(),t.rotate(s.tilt),t.translate(s.turn*o,0),t.fillStyle=h,o>=18?(t.beginPath(),t.moveTo(-o*.9,-o*.15),t.quadraticCurveTo(-o*.96,-o*1.12,0,-o*1.06),t.quadraticCurveTo(o*.96,-o*1.12,o*.9,-o*.15),t.quadraticCurveTo(o*.86,o*.55,o*.36,o*.98),t.quadraticCurveTo(0,o*1.14,-o*.36,o*.98),t.quadraticCurveTo(-o*.86,o*.55,-o*.9,-o*.15),t.closePath(),t.fill(),o>=22&&(t.beginPath(),t.ellipse(-o*.9,o*.18,o*.13,o*.22,0,0,E),t.ellipse(o*.9,o*.18,o*.13,o*.22,0,0,E),t.fill())):(t.beginPath(),t.ellipse(0,0,o*.9,o*1.06,0,0,E),t.fill()),tu(t,o,s.hair),s.rim>.01&&(t.strokeStyle=`rgba(245,205,150,${(.5*s.rim).toFixed(3)})`,t.lineWidth=Math.max(1,o*.14),t.beginPath(),t.ellipse(0,-o*.06,o*.86,o*1,0,Math.PI*1.12,Math.PI*1.9),t.stroke()),t.restore(),s.rim>.01&&(t.strokeStyle=`rgba(240,200,150,${(.28*s.rim).toFixed(3)})`,t.lineWidth=Math.max(1,o*.12),t.beginPath(),t.moveTo(-r*.8,a-o*.05),t.quadraticCurveTo(-n,a-o*.75,0,a-o*.82),t.quadraticCurveTo(n,a-o*.75,r*.8,a-o*.05),t.stroke()),t.restore()}function ou(t,e,i,o,s,n,r){t.fillStyle=`rgba(${s[0]},${s[1]},${s[2]},${r})`,t.beginPath(),t.moveTo(e-o*1.72,i+o*4),t.quadraticCurveTo(e-o*1.78,i+o*1.55,e-o*.46,i+o*1.02),t.lineTo(e-o*.4,i+o*.62),t.lineTo(e+o*.4,i+o*.62),t.lineTo(e+o*.46,i+o*1.02),t.quadraticCurveTo(e+o*1.78,i+o*1.55,e+o*1.72,i+o*4),t.closePath(),t.fill(),t.fillStyle=`rgba(${n[0]},${n[1]},${n[2]},${r})`,t.beginPath(),t.ellipse(e,i,o*.9,o*1.05,0,0,E),t.fill()}function Yo(t,e,i,o,s){let n=o*.1,r=i-o*.9,l=i-o*.74,a=i-o*.46,c=o*.13,d=o*.09,h=`rgba(${s.tone[0]},${s.tone[1]},${s.tone[2]},${s.alpha})`,u=t.createRadialGradient(e,i,1,e,i,o*.24);u.addColorStop(0,"rgba(0,0,0,0.4)"),u.addColorStop(1,"rgba(0,0,0,0)"),t.save(),t.scale(1,.28),t.fillStyle=u,t.beginPath(),t.ellipse(e,i/.28,o*.24,o*.24,0,0,E),t.fill(),t.restore(),t.fillStyle=h,t.beginPath(),t.moveTo(e-d,a),t.lineTo(e-d*.7,i),t.lineTo(e-d*.1,i),t.lineTo(e-d*.1,a+o*.02),t.lineTo(e+d*.1,a+o*.02),t.lineTo(e+d*.1,i),t.lineTo(e+d*.7,i),t.lineTo(e+d,a),t.closePath(),t.fill(),t.beginPath(),t.moveTo(e-c,l),t.quadraticCurveTo(e-c*.9,a-o*.12,e-d,a),t.lineTo(e+d,a),t.quadraticCurveTo(e+c*.9,a-o*.12,e+c,l),t.quadraticCurveTo(e,l-o*.05,e-c,l),t.closePath(),t.fill(),t.lineCap="round",t.lineJoin="round",t.strokeStyle=h,t.lineWidth=o*.055;let y=l+o*.02;s.pose===1?(t.beginPath(),t.moveTo(e-c*.8,y),t.lineTo(e-c*1.5,i-o*1.02),t.moveTo(e+c*.8,y),t.lineTo(e+c*1.5,i-o*1.02),t.stroke()):s.pose===2?(t.beginPath(),t.moveTo(e-c*.8,y),t.lineTo(e+d*1.4,a-o*.02),t.moveTo(e+c*.8,y),t.lineTo(e-d*.4,a-o*.06),t.stroke(),t.fillStyle=h,t.beginPath(),t.ellipse(e+d*1.5,a-o*.04,o*.07,o*.09,-.5,0,E),t.fill()):s.pose===3?(t.beginPath(),t.moveTo(e-c*.8,y),t.lineTo(e-c*.2,r+n*.6),t.moveTo(e+c*.8,y),t.lineTo(e+c*1.1,a),t.stroke(),t.lineWidth=o*.02,t.beginPath(),t.moveTo(e-c*.2,r+n*.9),t.lineTo(e-c*.2,i-o*.02),t.stroke()):(t.beginPath(),t.moveTo(e-c*.85,y),t.lineTo(e-c*.95,a+o*.02),t.moveTo(e+c*.85,y),t.lineTo(e+c*.95,a+o*.02),t.stroke()),t.fillStyle=h,t.fillRect(e-n*.34,r+n*.6,n*.68,n*.9),t.beginPath(),t.ellipse(e,r,n*.86,n*1.05,0,0,E),t.fill(),s.rimStrength>.01&&(t.strokeStyle=`rgba(${s.rim[0]},${s.rim[1]},${s.rim[2]},${(.6*s.rimStrength).toFixed(3)})`,t.lineWidth=Math.max(1,o*.02),t.beginPath(),t.moveTo(e-c,l),t.lineTo(e-n*.6,r+n*.4),t.moveTo(e-n*.7,r),t.ellipse(e,r,n*.84,n*1.02,0,Math.PI*1.05,Math.PI*1.55),t.stroke())}function xi(t,e,i,o,s,n,r,l,a){t.save(),t.globalCompositeOperation="lighter";let c=t.createLinearGradient(0,i,0,s);c.addColorStop(0,`rgba(${l},${a})`),c.addColorStop(.5,`rgba(${l},${(a*.4).toFixed(3)})`),c.addColorStop(1,`rgba(${l},0)`),t.fillStyle=c,t.beginPath(),t.moveTo(e-n,i),t.lineTo(o-r,s),t.lineTo(o+r,s),t.lineTo(e+n,i),t.closePath(),t.fill(),t.restore()}function Uo(t,e,i,o,s){let n=t.createRadialGradient(e,i,0,e,i,o*3);n.addColorStop(0,`rgba(${s},0.9)`),n.addColorStop(.4,`rgba(${s},0.35)`),n.addColorStop(1,`rgba(${s},0)`),t.fillStyle=n,t.beginPath(),t.arc(e,i,o*3,0,E),t.fill(),t.fillStyle=`rgba(${s},1)`,t.beginPath(),t.arc(e,i,o,0,E),t.fill()}function sv(t,e,i){let o=document.createElement("canvas");o.width=q,o.height=pe;let s=o.getContext("2d"),n=e.x-t.x,r=e.y-t.y,l=Math.hypot(n,r),a=Math.max(2,l*Rt),c=t.eyeHeightM??ee,d=Jh(t,e,i),h=Ql(d.seed),u=210+h()*150,y=oe(220+(h()-.5)*60,.55,.82),f=`${y[0]},${y[1]},${y[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,K(-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,K(-6),q,pe-K(-6));let g=Math.atan2(n,-r),b=jh(t,i,g,c),S=b.maxDelta>=Zh;S&&Qh(s,b.bins,at,K);let v=Math.max(.3,Math.min(1,1-(a-6)/60)),k=Wo(c,a),w=Math.min(80,Math.atan2(4,a)*180/Math.PI),L=Math.min(45,k.topPitch),C=k.basePitch;d.mode==="sport"?ru(s,a,c,d,v,u,f,h):d.mode==="arena"?nu(s,a,c,d,v,f,h):su(s,w,L,C,v,u,f,h);let T=d.mode==="sport"?34:24+Math.floor(h()*8);s.fillStyle=`rgba(${f},0.8)`;for(let I=0;I<T;I++){let P=(I+.5)/T*q,A=K(d.mode==="sport"?58:54+I*7%3*6);s.beginPath(),s.arc(P,A,d.mode==="sport"?2.6:3.2,0,E),s.fill()}au(s,t,i,e,g,c,n,r,S,d);let x=s.createLinearGradient(0,0,0,pe);return x.addColorStop(0,"rgba(0,0,0,0.85)"),x.addColorStop(.12,"rgba(0,0,0,0)"),x.addColorStop(.9,"rgba(0,0,0,0)"),x.addColorStop(1,"rgba(0,0,0,0.55)"),s.fillStyle=x,s.fillRect(0,0,q,pe),{url:o.toDataURL("image/jpeg",.82),distanceM:Math.round(a)}}function su(t,e,i,o,s,n,r,l){let a=at(-e),c=at(e),d=K(i),h=K(o),u=c-a,y=h-d,f=K(Math.min(50,i+10)),m=u*(1.1+(1-s)*.5),p=t.createRadialGradient(q/2,(d+h)/2,8,q/2,(d+h)/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)"),t.fillStyle=p,t.fillRect(a-u*.6,d-y*1.2,u*2.2,y*3.4);let g=oe(n,.62,.55),b=oe(n+40,.7,.5),S=oe(n+70,.78,.52);t.save(),t.beginPath(),t.rect(a,d,u,y),t.clip();let v=t.createLinearGradient(0,d,0,h);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]})`),t.globalAlpha=.8,t.fillStyle=v,t.fillRect(a,d,u,y),t.globalAlpha=1;let k=t.createRadialGradient(q/2,(d+h)/2,u*.12,q/2,(d+h)/2,u*.62);k.addColorStop(0,"rgba(6,8,14,0)"),k.addColorStop(.7,"rgba(6,8,14,0.15)"),k.addColorStop(1,"rgba(5,6,11,0.92)"),t.fillStyle=k,t.fillRect(a,d,u,y),t.restore();let w=3+Math.floor(l()*3),L=y*.46,C=h-y*.08;for(let _=0;_<w;_++){let $=(_+1)/(w+1),X=a+u*(.22+$*.56+(l()-.5)*.06);Yo(t,X,C,L*(.9+l()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(l()*4),rim:oe(n+20,.5,.7),rimStrength:.7})}t.fillStyle="#05070d",t.fillRect(a-u*.5,f,u*.5,h-f),t.fillRect(c,f,u*.5,h-f);let T=u*.055+3,x=T*1.35;t.fillStyle="#03050a",t.beginPath(),t.moveTo(a,h),t.lineTo(a-T,h),t.lineTo(a-x,f),t.lineTo(a+u*.012,f),t.closePath(),t.fill(),t.beginPath(),t.moveTo(c,h),t.lineTo(c+T,h),t.lineTo(c+x,f),t.lineTo(c-u*.012,f),t.closePath(),t.fill(),t.fillRect(a-x,f,u+x*2,(h-f)*.12);let I=y*.14,P=f+(h-f)*.12;t.fillStyle="rgba(4,6,12,0.96)";let A=7;t.beginPath(),t.moveTo(a-x,P);for(let _=0;_<=A;_++){let $=a-x+(u+x*2)*_/A;t.quadraticCurveTo($-(u+x*2)/A/2,P+I,$,P)}t.lineTo(c+x,P),t.lineTo(c+x,f),t.lineTo(a-x,f),t.closePath(),t.fill(),t.fillStyle=`rgba(${r},0.12)`,t.fillRect(a-1.5,P,1.5,h-P),t.fillRect(c,P,1.5,h-P),t.fillStyle="#0b0f18",t.fillRect(a-T,h-y*.05,u+T*2,y*.05+3);let R=t.createLinearGradient(0,h-y*.05,0,h+y*.12);R.addColorStop(0,`rgba(255,206,140,${(.5*s).toFixed(3)})`),R.addColorStop(1,"rgba(255,206,140,0)"),t.fillStyle=R,t.fillRect(a-T,h-y*.05,u+T*2,y*.2);let M=3+Math.floor(l()*2);for(let _=0;_<M;_++){let $=(_+1)/(M+1),X=a+u*($+(l()-.5)*.08),Y=K(Math.min(62,i+26)),J=(l()-.5)*u*.16;xi(t,X,Y,X+J,h,4,u*.09,r,.16*(.7+s*.5)),Uo(t,X,Y,2.4,r)}}function nu(t,e,i,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,d=1.2,h=Math.max(e*.45,e-l),u=e+l,y=Math.atan2(d-i,h)*180/Math.PI,f=Math.atan2(d-i,u)*180/Math.PI,m=Math.atan2(-i,h)*180/Math.PI,p=K(y),g=K(f),b=K(m),S=at(a)-c,v=Math.max(6,(p-g)/2),k=(p+g)/2,w=t.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)"),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=w,t.fillRect(c-S*2.6,g-v,S*5.2,b-g+v+40),t.restore(),t.fillStyle="#0c1019",t.beginPath(),t.moveTo(c-S,k),t.ellipse(c,k,S,v,0,Math.PI,0,!1),t.lineTo(c+S,b),t.ellipse(c,b,S,v,0,0,Math.PI,!1),t.closePath(),t.fill();let L=t.createLinearGradient(0,k,0,b);L.addColorStop(0,`rgba(${n},0.14)`),L.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=L,t.fillRect(c-S,k,S*2,b-k);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}]],T=C[Math.floor(r()*C.length)],x=r()<.5?-1:1,I=O=>c+O.u*x*S*.84,P=O=>k+O.v*v*.8,A=T.find(O=>O.lead)??T[0],R=I(A),M=t.createLinearGradient(0,k-v,0,k+v);M.addColorStop(0,"#3d4a72"),M.addColorStop(1,"#232b47"),t.fillStyle=M,t.beginPath(),t.ellipse(c,k,S,v,0,0,E),t.fill();let _=t.createRadialGradient(R,k,2,R,k,S);_.addColorStop(0,`rgba(255,214,160,${(.5*s).toFixed(3)})`),_.addColorStop(1,"rgba(255,214,160,0)"),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=_,t.beginPath(),t.ellipse(c,k,S,v,0,0,E),t.fill(),t.restore(),t.strokeStyle=`rgba(${n},0.7)`,t.lineWidth=2,t.beginPath(),t.ellipse(c,k,S,v,0,0,E),t.stroke();let $=Math.max(24,(b-g)*1.3),X=T.length>=3?3:2;for(let O=0;O<X;O++){let fe=(-.62+O*.52+(r()-.5)*.12)*-x,Ee=c+fe*S*.7,lt=k-v*(.45+r()*.18),Ke=S*(.07+r()*.04),Ei=$*(.26+r()*.12);t.fillStyle="#0a0e18",t.fillRect(Ee-Ke/2,lt-Ei,Ke,Ei),t.fillStyle=`rgba(${n},0.3)`,t.fillRect(Ee-Ke/2,lt-Ei,Ke,1.5)}if(T.length>=3){let O=c-A.u*x*S*.4;t.fillStyle="#0b0f1a",t.beginPath(),t.ellipse(O,k-v*.34,S*.08,v*.1,0,0,E),t.fill(),t.strokeStyle=`rgba(${n},0.35)`,t.lineWidth=1,t.stroke()}for(let O of[...T].sort((fe,Ee)=>fe.v-Ee.v)){let fe=.82+(O.v+1)*.14;Yo(t,I(O),P(O),$*fe*(O.lead?1.06:.92),{tone:[18,21,34],alpha:.95,pose:O.pose,rim:oe(40,.72,.8),rimStrength:O.lead?1.4:.9})}let Y=K(Math.min(60,f+34)),J=v*1.1+6;t.strokeStyle="rgba(60,68,92,0.85)",t.lineWidth=3,t.beginPath(),t.ellipse(c,Y,S*1.15,J,0,0,E),t.stroke();let D=4+Math.floor(r()*3);for(let O=0;O<D;O++){let fe=O/D*E,Ee=c+Math.cos(fe)*S*1.15,lt=Y+Math.sin(fe)*J;if(Math.sin(fe)>-.2){let Ke=c+(r()-.5)*S*.8;xi(t,Ee,lt,Ke,k,3,S*.32,n,.2*(.7+s*.4))}Uo(t,Ee,lt,3,n)}let U=K(Math.min(52,f+24)),N=Math.max(60,S*.4),Z=Math.max(24,N*.34);t.strokeStyle="rgba(70,78,102,0.6)",t.lineWidth=1.5,t.beginPath(),t.moveTo(c-N*.3,U-Z/2),t.lineTo(c-N*.16,U-Z*2.2),t.moveTo(c+N*.3,U-Z/2),t.lineTo(c+N*.16,U-Z*2.2),t.stroke(),t.fillStyle="#0d1220",t.fillRect(c-N/2,U-Z/2,N,Z);let Pi=t.createLinearGradient(0,U-Z*.3,0,U+Z*.42);Pi.addColorStop(0,`rgba(${n},0.5)`),Pi.addColorStop(1,"rgba(255,214,160,0.32)"),t.fillStyle=Pi,t.fillRect(c-N*.42,U-Z*.3,N*.84,Z*.72),t.fillStyle="rgba(255,214,160,0.55)",t.fillRect(c-N/2,U+Z/2-2,N,2);let Mi=t.createRadialGradient(c,U,4,c,U,N*1.1);Mi.addColorStop(0,`rgba(${n},0.2)`),Mi.addColorStop(1,"rgba(0,0,0,0)"),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=Mi,t.fillRect(c-N*1.1,U-N*.8,N*2.2,N*1.6);let Ri=t.createRadialGradient(c,(Y+k)/2,6,c,(Y+k)/2,S*1.5);Ri.addColorStop(0,`rgba(${n},${(.1*(.6+s*.5)).toFixed(3)})`),Ri.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=Ri,t.fillRect(c-S*1.5,Y-40,S*3,k-Y+80),t.restore();let ec=c+Math.sign(R-c||1)*S*.5;xi(t,ec,Y-J*.4,R,P(A),2.5,S*.16,"255,224,178",.42*(.7+s*.4));let Ai=t.createRadialGradient(R,P(A),1,R,P(A),S*.2);Ai.addColorStop(0,`rgba(255,228,185,${(.4*s).toFixed(3)})`),Ai.addColorStop(1,"rgba(255,228,185,0)"),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=Ai,t.beginPath(),t.ellipse(R,P(A),S*.2,v*.24,0,0,E),t.fill(),t.restore()}function ru(t,e,i,o,s,n,r,l){let a=q/2,c=Math.max(10,o.voidRadiusM),d=Math.max(2,e-c),h=e+c,u=Math.min(78,Math.atan2(c*1.15,e)*180/Math.PI),y=Math.atan2(-i,d)*180/Math.PI,f=Math.atan2(-i,h)*180/Math.PI,m=K(y),p=K(f),g=at(u)-a,b=(m+p)/2,S=Math.max(10,(m-p)/2),v=t.createRadialGradient(a,b,4,a,b,g);v.addColorStop(0,"#e8f0fb"),v.addColorStop(.7,"#b9c9e2"),v.addColorStop(1,"#8fa3c4"),t.save(),t.beginPath(),t.ellipse(a,b,g,S,0,0,E),t.clip(),t.fillStyle=v,t.fillRect(a-g,b-S,g*2,S*2),t.strokeStyle="rgba(90,120,170,0.5)",t.lineWidth=3,t.beginPath(),t.moveTo(a,b-S),t.lineTo(a,b+S),t.moveTo(a-g*.5,b-S),t.lineTo(a-g*.5,b+S),t.moveTo(a+g*.5,b-S),t.lineTo(a+g*.5,b+S),t.stroke(),t.strokeStyle="rgba(180,90,110,0.45)",t.beginPath(),t.ellipse(a,b,S*.9,S*.5,0,0,E),t.stroke(),t.restore(),t.strokeStyle="rgba(210,225,245,0.6)",t.lineWidth=2.5,t.beginPath(),t.ellipse(a,b,g,S,0,0,E),t.stroke(),t.fillStyle="rgba(20,26,40,0.8)";for(let I=0;I<5;I++){let P=a+(l()-.5)*g*1.4,A=b+(l()-.5)*S*1.1,R=Math.max(2,S*.06);t.beginPath(),t.ellipse(P,A,R*.6,R,0,0,E),t.fill()}let k=t.createRadialGradient(a,b,4,a,b,g*1.4);k.addColorStop(0,"rgba(200,220,255,0.12)"),k.addColorStop(1,"rgba(200,220,255,0)"),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=k,t.fillRect(a-g*1.4,p-S,g*2.8,m-p+S*2),t.restore();let w=K(Math.min(66,f+60)),L=Math.max(80,g*.7),C=L*.5,T=t.createRadialGradient(a,w,4,a,w,L*1.6);T.addColorStop(0,`rgba(${r},0.3)`),T.addColorStop(1,`rgba(${r},0)`),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=T,t.fillRect(a-L*1.6,w-L*1.2,L*3.2,L*2.4),t.restore(),t.fillStyle="#080b12",t.beginPath(),t.moveTo(a-L/2,w-C/2),t.lineTo(a+L/2,w-C/2),t.lineTo(a+L*.6,w),t.lineTo(a+L/2,w+C/2),t.lineTo(a-L/2,w+C/2),t.lineTo(a-L*.6,w),t.closePath(),t.fill();let x=n;for(let I=0;I<3;I++){let P=oe(x+I*30,.5,.5);t.fillStyle=`rgba(${P[0]},${P[1]},${P[2]},0.75)`;let A=L*.26;t.fillRect(a-L*.42+I*(A+L*.06),w-C*.32,A,C*.64)}t.fillStyle=`rgba(${r},0.9)`;for(let I=0;I<8;I++){let P=a-L*.6+L*1.2*I/7;t.beginPath(),t.arc(P,w+C*.62,2.4,0,E),t.fill()}}function au(t,e,i,o,s,n,r,l,a,c){let d=e.sectionId,h=!1,u=[];for(let m of i){if(m.id===e.id)continue;let p=m.x-e.x,g=m.y-e.y,b=Math.hypot(p,g)*Rt;if(d&&m.sectionId===d&&b<3&&p*r+g*l>0&&(h=!0),b<.3||b>32)continue;let v=((Math.atan2(p,-g)-s)*180/Math.PI+540)%360-180,k=a?(m.eyeHeightM??ee)-n:0,w=Math.atan2(k-.28,b)*180/Math.PI;if(w>10&&b>5)continue;let L=0;for(let x=0;x<m.id.length;x++)L=L*31+m.id.charCodeAt(x)&65535;let C=.9+(L&15)/40,T=Math.min(78,Math.atan2(.16,b)*180/Math.PI*qh*C);T<1.2||u.push({hx:at(v),hy:K(w),r:T,d:b,hash:L})}u.sort((m,p)=>p.d-m.d);let y=[];{let m=[...u].sort((b,S)=>b.hy-S.hy),p=[],g=()=>{if(!p.length)return;let b=p.reduce((k,w)=>k+w.d,0)/p.length,S=p.reduce((k,w)=>k+w.hy,0)/p.length,v=p.reduce((k,w)=>k+w.r,0)/p.length;y.push({figs:p.sort((k,w)=>w.d-k.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()}y.sort((m,p)=>p.d-m.d);let f=[[22,26,40],[28,27,42],[24,31,46],[31,30,47],[20,24,36]];for(let m of y){if(m.figs.length>=3&&m.r>=1.6&&m.r<26){let p=[],g=[...m.figs].sort((v,k)=>v.hx-k.hx),b=[];for(let v of g){let k=b[b.length-1];k&&v.hx-k.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){t.fillStyle=`rgba(15, 19, 31, ${S.toFixed(3)})`;for(let v of p){let k=v[0].hx-m.r*1.6,w=v[v.length-1].hx+m.r*1.6;t.beginPath(),t.roundRect(k,m.hy+m.r*.8,w-k,m.r*2.4,m.r*.8),t.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=f[p.hash%f.length],k=[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;iu(t,p.hx,p.hy,p.r,{tone:S,clothing:k,alpha:g,tilt:((p.hash>>2&7)-3.5)*.018,shoulderK:1.72+(p.hash>>5&7)/22,hair:p.hash%eu,rim:w,turn:((p.hash>>8&7)-3.5)*.034,lean:((p.hash>>10&3)-1.5)*.09})}else p.r>=5.5?ou(t,p.hx,p.hy,p.r,k,S,g):(t.fillStyle=`rgba(${S[0]},${S[1]},${S[2]},${g.toFixed(3)})`,t.beginPath(),t.arc(p.hx,p.hy,p.r,0,E),t.fill(),t.beginPath(),t.ellipse(p.hx,p.hy+p.r*1.4,p.r*1.85,p.r*.95,0,Math.PI,0,!0),t.fill())}}if(h){let m=K(-34);t.fillStyle="rgba(6, 8, 14, 0.92)",t.fillRect(0,m,q,pe-m),t.fillStyle="rgba(24, 30, 46, 0.9)";let p=16;for(let g=0;g<p;g++){let b=(g+.5)/p*q;t.beginPath(),t.ellipse(b,m+6,q/p*.42,22,0,Math.PI,0,!0),t.fill()}}}var ne=480,rt=270,Xo=50,ze=30,Zl=t=>(t+Xo)/(2*Xo)*ne,Mt=t=>(ze-t)/(2*ze)*rt;function nv(t,e,i){let o=document.createElement("canvas");o.width=ne,o.height=rt;let s=o.getContext("2d"),n=e.x-t.x,r=e.y-t.y,l=Math.max(2,Math.hypot(n,r)*Rt),a=Ql(jl(`${t.id}|${Math.round(e.x)},${Math.round(e.y)}`)),c=210+a()*150,d=oe(220+(a()-.5)*60,.55,.82),h=`${d[0]},${d[1]},${d[2]}`,u=s.createLinearGradient(0,0,0,rt);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,rt);let y=t.eyeHeightM??ee,f=Wo(y,l),m=Math.min(Xo-2,Math.atan2(4,l)*180/Math.PI),p=Math.min(ze-2,f.topPitch),g=Math.max(-ze+2,f.basePitch),b=Zl(-m),S=Zl(m),v=Mt(p),k=Mt(g),w=S-b,L=k-v,C=Math.max(.35,Math.min(1,1-(l-6)/60)),T=Mt(Math.min(ze-1,p+8)),x=s.createRadialGradient(ne/2,(v+k)/2,4,ne/2,(v+k)/2,w*1.15);x.addColorStop(0,"rgba(255,214,150,0.34)"),x.addColorStop(.28,"rgba(150,150,230,0.3)"),x.addColorStop(.6,"rgba(99,102,241,0.12)"),x.addColorStop(1,"rgba(99,102,241,0)"),s.fillStyle=x,s.fillRect(b-w*.6,v-L*1.2,w*2.2,L*3.4);let I=oe(c,.62,.55),P=oe(c+40,.7,.5),A=oe(c+70,.78,.52);s.save(),s.beginPath(),s.rect(b,v,w,L),s.clip();let R=s.createLinearGradient(0,v,0,k);R.addColorStop(0,`rgb(${I[0]},${I[1]},${I[2]})`),R.addColorStop(.5,`rgb(${P[0]},${P[1]},${P[2]})`),R.addColorStop(1,`rgb(${A[0]},${A[1]},${A[2]})`),s.globalAlpha=.8,s.fillStyle=R,s.fillRect(b,v,w,L),s.globalAlpha=1;let M=s.createRadialGradient(ne/2,(v+k)/2,w*.12,ne/2,(v+k)/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,L),s.restore();let _=3,$=k-L*.08;for(let D=0;D<_;D++){let U=(D+1)/(_+1);Yo(s,b+w*(.24+U*.52),$,L*.46*(.9+a()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(a()*4),rim:oe(c+20,.5,.7),rimStrength:.7})}s.fillStyle="#05070d",s.fillRect(b-w*.5,T,w*.5,k-T),s.fillRect(S,T,w*.5,k-T);let X=w*.05+2,Y=X*1.35;s.fillStyle="#03050a",s.beginPath(),s.moveTo(b,k),s.lineTo(b-X,k),s.lineTo(b-Y,T),s.lineTo(b+w*.012,T),s.closePath(),s.fill(),s.beginPath(),s.moveTo(S,k),s.lineTo(S+X,k),s.lineTo(S+Y,T),s.lineTo(S-w*.012,T),s.closePath(),s.fill(),s.fillRect(b-Y,T,w+Y*2,(k-T)*.13),s.fillStyle=`rgba(${h},0.12)`,s.fillRect(b-1.2,T,1.2,k-T),s.fillRect(S,T,1.2,k-T),s.fillStyle="#0b0f18",s.fillRect(b-X,k-L*.05,w+X*2,L*.05+2);let J=s.createLinearGradient(0,k-L*.05,0,k+L*.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,k-L*.05,w+X*2,L*.22);for(let D=0;D<3;D++){let U=(D+1)/4,N=b+w*U,Z=Mt(Math.min(ze-1,p+20));xi(s,N,Z,N+(a()-.5)*w*.14,k,3,w*.09,h,.17*C),Uo(s,N,Z,1.8,h)}s.fillStyle=`rgba(${h},0.75)`;for(let D=0;D<8;D++)s.beginPath(),s.arc((D+.5)/8*ne,Mt(ze-4-D%2*3),2.2,0,E),s.fill();s.fillStyle="rgba(10,13,20,0.9)",s.fillRect(0,rt-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,rt-22,ne/9*.4,15,0,Math.PI,0,!0),s.fill()}return{url:o.toDataURL("image/jpeg",.8),distanceM:Math.round(l)}}var Jl=new Set(["en"]),Ii=new Map;async function lu(t){if(typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__)return(await import(Bs(`i18n/${t}.mjs`))).default??null;let{LOADERS:e}=await import("./localeLoaders-BZZWN35C.js"),i=e[t];return i?await i():null}async function cv(t,e){let i=Gn(t,e);if(i==="en"||Jl.has(i))return je(i),i;if(!Dn.includes(i))return je("en"),"en";try{let o=Ii.get(i);o||(o=lu(i),Ii.set(i,o));let s=await o;return Ii.delete(i),s?(je(i,s),Jl.add(i),i):(je("en"),"en")}catch{return Ii.delete(i),je("en"),"en"}}export{uu as ACCESSIBILITY_RING_COLOR,$o as ACCESSIBILITY_TYPES,qu as AUTOMATIC_ROUND_TABLE_RADIUS_MAX,$u as AUTOMATIC_ROUND_TABLE_RADIUS_MIN,du as CHART_STORAGE_KEY,bp as CURRENCY_CHOICES,gp as DEFAULT_CURRENCY,uS as EMPTY_AVAILABILITY_REFRESH,vu as EVENT_CONFIGURATION_EXPORT_SCHEMA,Su as EVENT_CONFIGURATION_SCHEMA,Ku as FLOOR_STACK_GAP_RATIO,Uu as FLOOR_STACK_MIN_SURFACE_PX,hS as HOLD_CLOCK_SKEW_MS,Ni as LABEL_FADE_MS,yu as LABEL_STYLE_MAX_SIZE,mu as LABEL_STYLE_MIN_SIZE,lp as LEGIBILITY_HYSTERESIS_PX,xp as LOCALE_NAMES,Qu as MAX_EVENT_INVENTORY,ju as MAX_GA_CAPACITY,ps as MIN_POINTER_TARGET_PX,Yl as PickerController,Ae as PickerSelectionError,rp as RENDERED_QUALITY_REPORT_VERSION,pu as SEAT_COMMERCIAL_MARKS,cu as STAGE_LABEL_STYLE_MAX_SIZE,Ic as SUPPORTED_LOCALES,gu as SURROUNDINGS_SHAPE_ROLES,Do as SeatmapRenderer,Mu as TABLE_SEAT_OFFSET,Pu as TIER_HEIGHT_M,Dn as TRANSLATED_LOCALES,rs as UNGROUPED_ID,_l as accessNeedsFor,hu as accessibilityMeta,At as accessibilityRingColor,ts as allObjects,as as applyHidden,Ol as attachVisibilityCatchUp,Zu as automaticRoundTableRadius,Tu as canTransitionEventConfiguration,Lu as canonicalEventConfigurationJson,os as chartBounds,Oi as compactRowLabel,Ot as computeSections,wl as createRenderer,Os as crossesThreshold,Tc as currencyExponent,vp as currencySymbol,Gu as expandBooth,Ye as expandChart,_u as expandRow,Eu as expandRowSlots,Du as expandTable,Bu as expandTableSlots,Vu as floorObjects,Xu as floorStackPlacements,Ft as floorsOf,Ap as formatDate,Sp as formatMinor,gt as formatMoney,xc as fromMinorUnits,ct as gaAreasOf,tp as gaInventorySegments,Ju as gaUnitLabel,Bt as gaUnitLabels,sv as generateSeatPanorama,nv as generateSeatThumb,Ip as getLocale,ip as growJoinedGAInventory,np as hiddenObjectIds,Hh as holdHasLapsed,fS as holdRecoveryShape,Wi as hysteresisScale,ns as initialFloorMode,Cu as inspectEventConfigurationCompatibility,ap as inspectRenderedQualityEvidence,op as isGaUnitLabel,Mp as isLocaleLoaded,sp as isSectionHidden,bu as layerOf,ss as layoutFloorStack,cv as loadLocale,Pp as localeDirection,Yu as mainFloorId,Iu as migrateLegacyEventConfigurations,Hu as objectCenter,Wu as owningSectionForObject,ku as parseEventConfigurationExport,wu as parseEventConfigurationVersion,Nu as pointInPolygon,te as pointInPolygonWithHoles,_t as polygonLabelPoint,Fl as reconcileAvailability,pS as refreshChangedSomething,Hi as renderedPx,xu as resolveEventConfigurationRollback,Gn as resolveLocale,Au as rowInventoryCount,Ru as rowSeatPositions,fu as seatCommercialMeta,Et as sectionGeometry,je as setLocale,On as setMoneyLocale,Rp as setStringOverrides,Bl as shouldWaitForHoldExpiry,is as stackFloors,G as t,Hn as tCount,Ou as tableInventoryCount,Fu as tableSeatCountsBySide,zu as translateObject,ep as validGAInventorySegments,cp as zoomTowardPoint};
1
+ import{a as Di,b as Gi,d as As,e as Yt,g as Es,h as _s,k as Fs}from"./chunk-O5UH442K.js";import{a as Xu,b as Yu,c as ss,d as Uu,e as $u,f as ns,h as vs,k as Kt,m as ws,n as be,o as ae,p as ks,q as Ls,r as Xt,s as Cs}from"./chunk-NQZAZFAC.js";import{a as ap,b as ps,c as lp}from"./chunk-BXU5D2Q5.js";import{b as Bs}from"./chunk-FOYQOIWG.js";import{a as Oi}from"./chunk-QJXSZT3H.js";import{a as qu,b as Zu,c as ju}from"./chunk-BT2KJXQC.js";import{a as ye,b as hs,c as _e,d as Gt,e as Nt,f as Fe,g as H,m as ge,n as xe,q as Ht,r as Wt,t as us,u as Ue,v as re,w as Ie,x as Bi}from"./chunk-XD2P4ZS4.js";import{A as Ms,B as Rs,b as bs,c as Ss,e as ht,i as xs,j as Is,p as Ps}from"./chunk-QLDV5ZGA.js";import{a as Qu,b as Ju,c as ep,d as tp,e as ip,f as Bt,g as op,h as ct,i as sp,j as rs,k as Ot,l as np,m as rp,n as as}from"./chunk-Q3U3F4YJ.js";import{a as du,b as hu,c as $o,d as uu,e as pu,f as At,g as fu,h as mu,i as yu,j as gu,k as bu,l as Su,n as fs,q as dt,u as Ts}from"./chunk-WXGW2SYC.js";import{b as Vt,f as ms,h as zt,i as ys,k as gs}from"./chunk-UL5OIGIF.js";import{Aa as es,Ca as Ru,Da as Au,E as qo,Ea as Eu,Fa as _u,G as Zo,Ga as Fu,Ha as Bu,I as z,Ia as Ou,Ja as Du,Ka as Gu,La as Nu,Ma as Hu,Na as te,Oa as _t,Pa as Wu,Qa as Vu,Ra as Ft,Sa as zu,Ta as ts,Ua as Ku,Va as is,Wa as Ye,Xa as os,d as vu,e as wu,f as ku,g as Lu,ga as jo,h as Cu,ha as Xe,i as Tu,ia as Mu,j as xu,k as Iu,l as Pu,qa as ee,ra as Qo,sa as Et,ya as Jo}from"./chunk-24O23MNB.js";import{C as F,c as _i,h as Fi,m as ls,o as cs,t as B,u as Te,v as me,w as j,x as Dt,z as ds}from"./chunk-JBOTRSMY.js";import"./chunk-CRCGO52K.js";var cp=1,Ni=90;function Hi(t,e){return!Number.isFinite(t)||!Number.isFinite(e)?0:Math.max(0,t*e)}function Os(t,e,i,o=1){if(!Number.isFinite(t))return i;let s=Math.max(0,o);return i?t>=e-s:t>=e+s}function Wi(t,e,i,o=1){if(!Number.isFinite(t)||!(i>0))return t;let s=Math.max(0,o)/i;return e?t*(1+s):t*(1-s)}function dp(t){let{point:e,camera:i,scale:o,nextScale:s}=t;if(!Number.isFinite(o)||o<=0||!Number.isFinite(s))return{...i};let n=(e.x-i.x)/o,r=(e.y-i.y)/o;return{x:e.x-n*s,y:e.y-r*s}}import{Konva as wi}from"konva/lib/Core";import{Stage as Fh}from"konva/lib/Stage";import{Layer as Fo}from"konva/lib/Layer";import{Group as xt}from"konva/lib/Group";import{Circle as Sl}from"konva/lib/shapes/Circle";import{Group as ji}from"konva/lib/Group";import{Circle as We}from"konva/lib/shapes/Circle";import{Line as Qi}from"konva/lib/shapes/Line";import{Rect as Ji}from"konva/lib/shapes/Rect";import{Text as Xn}from"konva/lib/shapes/Text";var le=9,Be=.9,ce=.55*Be,se=H/ye,ut=4,Oe=14,Ds=10,Gs=14,Se=.45*Be,ve=.9*Be,we=(Se+ve)/2,Ns=Math.max(Be*1.1,ve),Pe=8,Hs=700,Q=2,Ws=H,Ut=.85,Vs=H,pt=64,$e=.55*Se,$t=700,zs=2500,qt=-11.5,ft=.58,Ks=320,Xs=420,Ys=420,Us=1,De=1,$s=2,qe=16,he=12,Vi=[.85,.72,.62],Zt=13,jt=12,qs=0,Zs="700",js="600",Qs=8,Js=5,en=10,tn=6,on=8,sn=.6,nn=.6,rn=.7,an=[0,18,-18,36,-36,54,-54],Ge="600",ln="500",ue=640,Qt="700",Ne=.02,cn=14,dn=.34,Jt=.92,mt=7,ei=3,hn=6;function zi(t){return Math.min(1,Math.max(he/qe,t/900))}function Ze(t,e){return Math.max(he,t*zi(e))}var un=.1,yt=1.02;var pn=2;function fn(t,e){return!(t>0)||!(e>0)||t>=e?null:e}var ic="#e5e7eb",oc="#c7cbd1",sc="#595f69",nc="#d1d5db",rc="#b8bdc4",ac="#273142",lc="#526078",cc="#f1f5f9",dc="#374151",hc="#64748b",uc="#111827",ti="#6b7280",ii="#374151";var mn="#4b5563",yn=.4,ke=.16,gn="rgba(244,246,248,0.06)",oi=["#E69F00","#56B4E9","#009E73","#F0E442","#0072B2","#D55E00","#CC79A7"];function bn(t,e,i){let o=new Map;for(let r of t){let l=e(r);!l||i(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 ie(t){return B(t)?{sectionFill:ic,sectionStroke:oc,sectionInk:sc,focalFill:nc,focalStroke:rc}:{sectionFill:ac,sectionStroke:lc,sectionInk:cc,focalFill:dc,focalStroke:hc}}function Ki(t,e){let i=t.sectionFill,o=ds(me(i,.2),.85);switch(e){case"closed":return me(i,.12);case"sold-out":return o;case"nearly-gone":return j(i,o,.4);default:return i}}var Sn=.28,vn=.32,pc=.55,fc=.7;function wn(t,e,i){let o=ie(t),s=Ki(o,e);if(!i||e==="sold-out"||e==="closed")return{fill:s,stroke:o.sectionStroke};let n=B(t);return{fill:j(s,i,n?vn:Sn),stroke:F(i,n?fc:pc)}}var mc=.03;function kn(t,e){let i=ie(t);return!["normal","nearly-gone","sold-out","closed"].map(s=>Ki(i,s).toLowerCase()).includes(e.trim().toLowerCase())&&Xi(t,e)}function Xi(t,e){let i=_i(e);if(!i)return!1;let o=ie(t),s=Math.max(Sn,vn)+mc;return["normal","nearly-gone","sold-out","closed"].some(n=>{let r=_i(Ki(o,n));return r?Math.max(Math.abs(r[0]-i[0]),Math.abs(r[1]-i[1]),Math.abs(r[2]-i[2]))/255<=s:!1})}var yc="#f8fafc",gc="#f4f6fb",bc="#111827",Sc=.72;function Ln(t){let e=B(t),i=e?yc:uc,o=e?bc:gc,s=j(o,i,1-Sc);return{plate:i,ink:o,subInk:ls(s,i)>=cs?s:o}}function si(t){return t?.35:.3}function xn(t){if(t<=0||t>=1)return 1;let e=1.25-1;if(t<.45){let o=t/.45;return 1+e*(1-(1-o)**2)}let i=(t-.45)/(1-.45);return 1+e*Math.cos(i*Math.PI*1.5)*(1-i)**2}function Yi(t){let e=t<=0?0:t>=1?1:t,i=1-(1-e)**3;return{radiusScale:1+(2.5-1)*i,opacity:.55*(1-e)}}var In=700,vc=2400,Ui=12,Pn=30,Cn=1,wc=1.16,Tn=.5,kc=1;function $i(t){return t*.61803398875%1}function Mn(t,e){let o=((t/vc+e)%1+1)%1,s=(1-Math.cos(o*2*Math.PI))/2;return{scale:Cn+(wc-Cn)*s,opacity:Tn+(kc-Tn)*s}}var An;function En(t){An=t}function Lc(t){return typeof t=="number"?t:t instanceof Date?t.getTime():Date.parse(t)}var Rn=new Map;function Cc(t,e){let i=t??An,o=`${i??""}|${JSON.stringify(e)}`,s=Rn.get(o);return s||(s=new Intl.DateTimeFormat(i,e),Rn.set(o,s)),s}var Tc={dateStyle:"medium",timeStyle:"short"};function _n(t,e={}){let{locale:i,...o}=e,s=Lc(t);if(!Number.isFinite(s))return"";let n=Object.keys(o).length?o:Tc;return Cc(i,n).format(s)}var bp="USD",Sp=["USD","EUR","GBP","CAD","AUD","INR","AED","SGD","JPY","CHF","SEK","NZD","ZAR","MXN","BRL"],Bn;function On(t){Bn=t}var Fn=new Map;function ni(t,e,i,o){let s=o??Bn,n=`${s??""}|${t}|${e??"auto"}|${i??"auto"}`,r=Fn.get(n);return r||(r=new Intl.NumberFormat(s,{style:"currency",currency:t,minimumFractionDigits:e,maximumFractionDigits:i}),Fn.set(n,r)),r}function gt(t,e="USD",i,o){if(typeof i=="object"){let n=i;try{return ni(e,n.minimumFractionDigits,n.maximumFractionDigits,n.locale).format(t)}catch(r){if(n.fallback)return n.fallback(t,e);throw r}}let s=i??(Number.isInteger(t)?0:void 0);return ni(e,s,s,o).format(t)}function xc(t="USD"){try{return ni(t,void 0,void 0).resolvedOptions().maximumFractionDigits??2}catch{return 2}}function Ic(t,e="USD"){return t/10**xc(e)}function vp(t,e="USD",i){return gt(Ic(t,e),e,void 0,i)}function wp(t="USD"){return ni(t,0,0).formatToParts(0).find(i=>i.type==="currency")?.value??t}var bt={"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.accessSpreadHint":"{count} accessible spaces in {sections} sections \xB7 tap a highlighted section","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 Pc=["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"],Ip={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"},Dn=["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"],Mc=new Set(["ar","fa","he"]),qi={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"},Zi=new Map(Pc.map(t=>[t.toLowerCase(),t]));function Rc(t){let e=t.trim().toLowerCase().replace(/_/g,"-");if(!e)return;let i=Zi.get(e)??qi[e];if(i)return i;let o=e.split("-");if(o.length>=2){let s=`${o[0]}-${o[1]}`,n=Zi.get(s)??qi[s];if(n)return n}return Zi.get(o[0])??qi[o[0]]}var He={en:bt},ri={},de="en";function Gn(t,e){let i=typeof navigator<"u"?navigator.languages?.length?navigator.languages:[navigator.language]:[];for(let o of[t,e,...i]){if(!o)continue;let s=Rc(o);if(s)return s}return"en"}function Pp(){return de}function Mp(t=de){return Mc.has(t)?"rtl":"ltr"}function Rp(t){return!!He[t]}function je(t,e){e&&(He[t]={...He[t],...e}),de=He[t]?t:"en",On(de),En(de),typeof document<"u"&&(document.documentElement.lang=de)}function Ap(t){ri=t}var Nn=/\{(\w+)\}/g;function G(t,e){let i=ri[t]??He[de]?.[t]??bt[t]??t;return e?i.replace(Nn,(o,s)=>String(e[s]??`{${s}}`)):i}function Hn(t,e,i){let o=new Intl.PluralRules(de).select(e);return(ri[`${t}.${o}`]??He[de]?.[`${t}.${o}`]??bt[`${t}.${o}`]??ri[`${t}.other`]??He[de]?.[`${t}.other`]??bt[`${t}.other`]??t).replace(Nn,(r,l)=>String({count:e,...i}[l]??`{${l}}`))}function Ep(t,e){return _n(t,{...e??{dateStyle:"medium",timeStyle:"short"},locale:de})}function Vn(t,e,i,o=!1){let s=t.displayLabel?.trim()||t.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:i()??"",sellable:!0}}var Qe=32,Wn=70;function zn(t,e){let i=Qe+6,o=t.y-Wn;return{x:Math.min(Math.max(t.x,i),Math.max(i,e.width-i)),y:o>=i?o:Math.min(t.y+Wn,e.height-i)}}var Fc=220,Bc=.08,ai=class{constructor(e){this.pulses=new Map;this.pulseGroup=null;this.loupe=null;this.echoTimers=new Map;this.host=e}syncMarker(e,i,o){let s=o.get(e);if(o.delete(e),!i){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,d=n.boothDims(r.rowId),h=n.seatRadius(),u=n.seatPoint(r),y=new ji({name:"selection-ring",x:u.x,y:u.y,rotation:d?.rotation??0,listening:!1,perfectDrawEnabled:!1,opacity:n.selectionFocusDims(e)?.2:1});if(n.viewMode()==="perspective"){let p=n.perspectiveSeatScale(e);y.scale({x:p,y:p})}y.setAttrs({seatId:e,ringColor:a});let f={name:"selection-halo",stroke:F(n.categoryColor(r.categoryKey),si(B(n.canvasBackground()))),listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(d){let p=h*1.2;y.add(new Ji({...f,width:d.width+p*2,height:d.height+p*2,offsetX:(d.width+p*2)/2,offsetY:(d.height+p*2)/2,cornerRadius:8,strokeWidth:Math.max(2,h*.5)}))}else y.add(new We({...f,radius:h*1.6,strokeWidth:Math.max(2,h*.55)}));let m={stroke:a,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(d)if(y.add(new Ji({...m,width:d.width,height:d.height,offsetX:d.width/2,offsetY:d.height/2,cornerRadius:4,strokeWidth:c?4:3})),c)y.add(new Ji({...m,width:d.width+10,height:d.height+10,offsetX:(d.width+10)/2,offsetY:(d.height+10)/2,cornerRadius:7,strokeWidth:2,opacity:.55}));else{let p=Math.max(0,d.width/2-14),g=-Math.max(0,d.height/2-14);y.add(new We({x:p,y:g,radius:10,fill:a,listening:!1})),y.add(new Qi({x:p,y:g,points:[-4.5,0,-1,3.5,5.5,-4.5],stroke:B(a)?"#0b1220":"#ffffff",strokeWidth:2.4,lineCap:"round",lineJoin:"round",listening:!1}))}else y.add(new We({...m,radius:Math.max(1,h-1.25),strokeWidth:Math.min(2.5,Math.max(1.8,h*.22))})),c?y.add(new We({...m,radius:h+2,strokeWidth:2,opacity:.55})):y.add(new Qi({points:[-h*.52,0,-h*.12,h*.4,h*.6,-h*.46],stroke:"#ffffff",strokeWidth:Math.max(2.6,h*.34),lineCap:"round",lineJoin:"round",shadowColor:"#0b1220",shadowBlur:1.5,shadowOpacity:.55,listening:!1}));o.set(e,y),this.host.overlayLayer.add(y)}retire(e){let i=this.host;if(!e)return;if(i.reducedMotion()||i.isDestroyed()||typeof document<"u"&&document.hidden){e.destroy();return}let o=performance.now(),s=n=>{if(i.isDestroyed()||!e.getLayer()){e.destroy();return}let r=Math.min(1,(n-o)/160);e.opacity(1-r),i.overlayLayer.batchDraw(),r<1?requestAnimationFrame(s):(e.destroy(),i.overlayLayer.batchDraw())};requestAnimationFrame(s)}play(e){let i=this.host;if(i.reducedMotion()||i.isDestroyed()||typeof document<"u"&&document.hidden||!i.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),!(i.isDestroyed()||i.reducedMotion())&&(typeof document<"u"&&document.hidden||this.emitPulse(e,!1))},In))}emitPulse(e,i){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 We({name:"selection-pulse",x:r.x,y:r.y,radius:n,stroke:o.categoryColor(s.categoryKey),strokeWidth:Math.max(1.5,n*.24),opacity:Yi(0).opacity,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.pulses.set(e,l),this.pulseHome().add(l);let a=i&&!o.isCached()?o.seatShape(e):void 0,c=performance.now(),d=()=>{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()},h=u=>{if(o.isDestroyed()){d();return}l.getLayer()||this.pulseHome().add(l);let y=u-c,f=Yi(y/420);if(l.radius(n*f.radiusScale),l.opacity(f.opacity),a){let m=xn(y/320);a.scale({x:m,y:m})}o.overlayLayer.batchDraw(),a&&!o.isCached()&&o.seatLayer.batchDraw(),y<420?requestAnimationFrame(h):d()};queueMicrotask(()=>{o.isDestroyed()||typeof requestAnimationFrame!="function"||requestAnimationFrame(h)})}nudge(e){let i=this.host;if(i.reducedMotion()||i.isDestroyed()||i.isCached()||typeof document<"u"&&document.hidden)return;let o=i.seatShape(e);if(!o)return;let s=performance.now(),n=()=>{o.scale({x:1,y:1}),i.seatLayer.batchDraw()},r=l=>{if(i.isDestroyed()||i.isCached()||!o.getLayer()){n();return}let a=l-s,c=Math.min(1,a/Fc),d=1+Bc*Math.sin(Math.PI*c);o.scale({x:d,y:d}),i.seatLayer.batchDraw(),c<1?requestAnimationFrame(r):n()};requestAnimationFrame(r)}pulseHome(){return(!this.pulseGroup||!this.pulseGroup.getLayer())&&(this.pulseGroup=new ji({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 i=this.host;if(i.isExportMode()||i.isDestroyed())return;let o=i.nearestSeat(e,Oe),s=o?i.seat(o):void 0;if(!s){this.hideLoupe();return}let n=Vn(s,i.seatStatus(s.id),()=>i.priceLabel(s),i.seatClosed(s.id)),r=zn(e,{width:i.stage.width(),height:i.stage.height()}),l=1/(i.stage.scaleX()||1),a=this.loupe??this.buildLoupe();a.seatId=s.id,a.group.position(i.screenToWorld(r)),a.group.scale({x:l,y:l}),a.group.opacity(n.sellable?1:.75),a.group.visible(!0),a.disc.fill(i.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),i.overlayLayer.batchDraw()}buildLoupe(){let e=this.host,i=e.canvasBackground(),o=re(i,ie(i).sectionInk),s=new ji({name:"touch-loupe",listening:!1,visible:!1});s.add(new Qi({points:[-7,Qe-4,0,Qe+12,7,Qe-4],closed:!0,fill:i,stroke:F(o,.25),strokeWidth:1,listening:!1})),s.add(new We({radius:Qe,fill:i,stroke:F(o,.28),strokeWidth:1.25,shadowColor:"#000000",shadowBlur:16,shadowOpacity:.45,listening:!1}));let n=new We({y:-15,radius:6,fill:"#6e7bff",listening:!1}),r=new Xn({y:-6,text:"",fontSize:15,fontStyle:"800",fontFamily:e.labelFont(),fill:o,listening:!1,perfectDrawEnabled:!1}),l=new Xn({y:12,text:"",fontSize:10.5,fontStyle:"700",fontFamily:e.labelFont(),fill:F(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 Oc}from"konva/lib/Animation";var Dc=1e3/Pn;function Yn(t){return t.findOne(".selection-halo")??null}var li=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,i=this.markers.size>0||this.beaconRings.length>0;if(i&&!e.isDestroyed()&&!e.reducedMotion()&&this.bindVisibility(),e.isDestroyed()||e.reducedMotion()||!this.pageVisible()||!i){this.stop(),this.rest(),(!i||e.isDestroyed()||e.reducedMotion())&&this.unbindVisibility();return}let o=[],s=0;for(let[r,l]of this.markers){let a=Yn(l);if(a){if(this.paintHalo(r,a),s>=Ui){a.scale({x:1,y:1}),a.opacity(1);continue}o.push({node:a,phase:$i(s)}),s+=1}}let n=0;for(let r of this.beaconRings){if(n>=Ui){r.scale({x:1,y:1}),r.opacity(1);continue}o.push({node:r,phase:$i(n)}),n+=1}if(this.targets=o,!o.length){this.stop();return}this.animation||(this.startedAt=performance.now(),this.lastFrameAt=0,this.animation=new Oc(()=>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,i){let o=this.host,s=si(B(o.canvasBackground())),n=o.seatCategoryKey(e),r=o.isOwnedHold(e)?j(o.selectionColor(),o.canvasBackground(),.55):n?o.categoryColor(n):o.selectionColor();i.stroke(F(r,s))}rest(){let e=!1;for(let[i,o]of this.markers){let s=Yn(o);s&&(this.paintHalo(i,s),s.scale({x:1,y:1}),s.opacity(1),e=!0)}for(let i of this.beaconRings)i.scale({x:1,y:1}),i.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 i=performance.now();if(i-this.lastFrameAt<Dc)return!1;this.lastFrameAt=i;let o=i-this.startedAt;for(let s of this.targets){let{scale:n,opacity:r}=Mn(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 Gc}from"konva/lib/Group";import{Circle as Un}from"konva/lib/shapes/Circle";import{Text as Nc}from"konva/lib/shapes/Text";var ci=28,Hc=12,Wc="800",Vc=44;function $n(t){if(t.rung==="seats")return[];let e=new Map,i=new Map(t.zones.map(s=>[s.id,s.name])),o=new Map(t.zones.map(s=>[s.id,s.anchor]));for(let s of t.sections){let n=t.ownedSeatIds(s);if(!n.length)continue;let r=t.rung==="zones"&&s.zone!=null&&i.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?i.get(s.zone):t.sectionName(s),count:n.length,seatId:n[0],anchor:r?o.get(s.zone):t.sectionAnchor(s)})}return[...e.values()]}function zc(t,e){return G("map.beaconAria",{seats:Hn("picker.seatCount",t),name:e})}var Kc="selection-beacon-ring",di=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 i=Math.max(this.host.stageScale(),1e-4),o=`${i.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=ci/2/i,n=this.host.accent(),r=this.host.accentInk(),l=new Gc({listening:!1,name:"selection-beacons"});for(let a of e){let c={x:a.anchor.x,y:a.anchor.y-s*1.6},d=new Un({name:Kc,x:c.x,y:c.y,radius:s*1.25,stroke:F(n,.55),strokeWidth:Math.max(1,s*.22),listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});l.add(d),l.add(new Un({name:"selection-beacon-disc",x:c.x,y:c.y,radius:s,fill:n,stroke:F(r,.28),strokeWidth:1/i,listening:!1,perfectDrawEnabled:!1}));let h=new Nc({x:c.x,y:c.y,text:String(a.count),fontSize:Hc/i,fontStyle:Wc,fontFamily:this.host.labelFont(),fill:r,listening:!1,perfectDrawEnabled:!1});h.offsetX(h.width()/2),h.offsetY(h.height()/2),l.add(h),this.rings.push(d),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 i=this.buttons[e],o=this.host.worldToScreen(this.centres[e]),s=i.offsetWidth||parseFloat(i.style.width)||ci;i.style.left=`${o.x-s/2}px`,i.style.top=`${o.y-s/2}px`}}buildButton(e,i){let o=this.host.worldToScreen(i),s=typeof globalThis.matchMedia=="function"&&globalThis.matchMedia("(pointer: coarse)").matches,n=Math.max(ci,s?Vc:ci),r=document.createElement("button");return r.type="button",r.className="sl-beacon",r.dataset.beacon=e.id,r.setAttribute("aria-label",zc(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 eo(t,e){let i=t.width(),o=t.height(),s=1/0,n=1/0,r=-1/0,l=-1/0,a=i*2,c=o*2;for(let d of e){let h=d.getClientRect();if(!(!(h.width>1)||!(h.height>1))){if(h.x<-a||h.y<-c||h.x+h.width>i+a||h.y+h.height>o+c)return null;h.x<s&&(s=h.x),h.y<n&&(n=h.y),h.x+h.width>r&&(r=h.x+h.width),h.y+h.height>l&&(l=h.y+h.height)}}return isFinite(s)?{x:s,y:n,width:r-s,height:l-n}:null}var qn=8,Xc=.02,Zn=1,jn=.5;function Qn(t,e,i,o){let s=i??{x:0,y:0,width:t.width(),height:t.height()},n=eo(t,e);if(!n)return 0;to(t,n,s);let r=Math.min((s.width-2*qn)/n.width,(s.height-2*qn)/n.height);if(!(r>0))return 1;let l=Math.max(n.width-s.width,n.height-s.height),a=l>jn?r:Math.min(r,Yc(t.scaleX(),o));if(!(a>1+Xc)&&!(l>jn)||!(a>0)||a===1)return 1;let c=s.x+s.width/2,d=s.y+s.height/2;t.scale({x:t.scaleX()*a,y:t.scaleY()*a}),t.position({x:c+(t.x()-c)*a,y:d+(t.y()-d)*a});let h=eo(t,e);return h&&to(t,h,s),a}function Jn(t,e,i){let o=i??{x:0,y:0,width:t.width(),height:t.height()},s=eo(t,e);return s?to(t,s,o):!1}function Yc(t,e){let i=Math.max(t,1e-9);return(e!=null&&e>i?Math.min(Zn,e):Zn)/i}function to(t,e,i){let o=i.x+i.width/2-(e.x+e.width/2),s=i.y+i.height/2-(e.y+e.height/2);return o===0&&s===0?!1:(t.position({x:t.x()+o,y:t.y()+s}),!0)}function io(t){return`${t.x()},${t.y()},${t.scaleX()}`}import{Group as Uc}from"konva/lib/Group";import{Circle as er}from"konva/lib/shapes/Circle";import{Line as $c}from"konva/lib/shapes/Line";import{Text as qc}from"konva/lib/shapes/Text";var Zc=6;function oo(t){return B(t)?"#0b1220":"#ffffff"}function tr(t){let{points:e}=t;if(!e.length)return null;let i=t.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:i,ink:oo(i)}}var hi=class{constructor(e){this.group=null;this.badges=[];this.host=e}anchorFor(e){for(let i of this.host.sections()){if(i.logicalId!==e&&i.id!==e)continue;let o=tr({points:this.host.ownedPoints(i),categoryColor:null});if(o)return o.centroid}return null}badgeAt(e){for(let i of this.badges)if(Math.hypot(e.x-i.centre.x,e.y-i.centre.y)<=i.radius)return i.id;return null}sync(e,i="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 Uc({listening:!1,name:"owned-sections"}),n=new Set;for(let r of this.host.sections()){let l=this.host.ownedPoints(r),a=tr({points:l,categoryColor:this.host.sectionColor(r)});if(!a)continue;let c=Math.max(Zc/2/o,1);for(let m of l)s.add(new er({name:"owned-seat-dot",x:m.x,y:m.y,radius:c,fill:a.fill,stroke:F("#ffffff",.55),strokeWidth:Math.max(.5,c*.28),shadowColor:a.fill,shadowBlur:c*2.4,shadowOpacity:.7,listening:!1,perfectDrawEnabled:!1}));if(i!=="seats"||n.has(r.logicalId))continue;n.add(r.logicalId);let d=this.host.sections().filter(m=>m.logicalId===r.logicalId).reduce((m,p)=>m+this.host.ownedPoints(p).length,0),h=this.host.labelAnchor(r),u=11/o,y={x:h.x,y:h.y-u*2.1};s.add(new er({name:"owned-section-badge",x:y.x,y:y.y,radius:u,fill:a.fill,stroke:F(a.ink,.35),strokeWidth:1/o,listening:!1,perfectDrawEnabled:!1})),s.add(new $c({x:y.x-u*.62,y:y.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 f=new qc({x:y.x+u*.12,y:y.y-u*.5,text:String(d),fontSize:u,fontStyle:"800",fontFamily:this.host.labelFont(),fill:a.ink,listening:!1,perfectDrawEnabled:!1});s.add(f),this.badges.push({id:r.logicalId,centre:y,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 W(t){let e=fs(t);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(t,e,i,o){let s=o*Math.PI/180,n=Math.cos(s),r=Math.sin(s);return[{x:-e/2,y:-i/2},{x:e/2,y:-i/2},{x:e/2,y:i/2},{x:-e/2,y:i/2}].map(l=>({x:t.x+l.x*n-l.y*r,y:t.y+l.x*r+l.y*n}))}function ui(t,e,i,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 d=0;d<=6;d++){let h=e*(d/6-.5),u=i*(c/4-.5),y={x:t.x+h*l-u*a,y:t.y+h*a+u*l};if(!te(y,s,n))return!1}return!0}function ir(t,e,i){let o=W(t),s=[i];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};te(a,t,e)&&s.push(a)}let n=[t,...e];return s.map(r=>({point:r,room:qo(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 or(t,e){let{stageScale:i,stageX:o,stageY:s}=t;if(t.viewMode==="perspective"&&e.perspectiveAffine)return W(e.outline.map(r=>{let l=t.projectedSectionPoint(e,r);return{x:l.x*i+o,y:l.y*i+s}}));let n=e.liftWorld>0?t.isoLiftLocal(e.liftWorld):{x:0,y:0};return W(e.outline.map(r=>{let l={x:r.x+n.x,y:r.y+n.y},a=t.isoT===0?l:t.isoForward(l);return{x:a.x*i+o,y:a.y*i+s}}))}function jc(t,e){let i=t.width*t.height;if(i<=0)return 0;let o=Math.max(0,Math.min(t.x+t.width,e.width)-Math.max(t.x,0)),s=Math.max(0,Math.min(t.y+t.height,e.height)-Math.max(t.y,0));return o*s/i}function sr(t){let{current:e,viewport:i}=t,o=new Map;for(let l of t.sections){let a=jc(l.bounds,i)*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 Jc}from"konva/lib/shapes/Text";function Qc(t,e){return t.x<e.x+e.width&&e.x<t.x+t.width&&t.y<e.y+e.height&&e.y<t.y+t.height}var et=class{constructor(){this.cells=new Map}insert(e){for(let i of this.keys(e)){let o=this.cells.get(i);o?o.push(e):this.cells.set(i,[e])}}collisionCount(e){let i=new Set,o=0;for(let s of this.keys(e))for(let n of this.cells.get(s)??[])i.has(n)||(i.add(n),Qc(e,n)&&o++);return o}keys(e){let i=Math.floor(e.x/pt),o=Math.floor((e.x+Math.max(0,e.width))/pt),s=Math.floor(e.y/pt),n=Math.floor((e.y+Math.max(0,e.height))/pt),r=[];for(let l=s;l<=n;l++)for(let a=i;a<=o;a++)r.push(`${a}:${l}`);return r}};function nr(t,e){let i=t.sections.filter(f=>f.id===e||f.logicalId===e),o=i.map(f=>{if(t.viewMode==="perspective"&&f.perspectiveAffine)return W(f.outline.map(g=>t.projectedSectionPoint(f,g)));let m=f.liftWorld>0?t.isoLiftLocal(f.liftWorld):{x:0,y:0},p=f.outline.map(g=>{let b={x:g.x+m.x,y:g.y+m.y};return t.isoT===0?b:t.isoForward(b)});return W(p)});if(!o.length)return null;let s=Math.min(...o.map(f=>f.x)),n=Math.min(...o.map(f=>f.y)),r=Math.max(...o.map(f=>f.x+f.width)),l=Math.max(...o.map(f=>f.y+f.height)),a=new Set(i.flatMap(f=>f.memberIds));for(let f of a){let m=t.seatById.get(f);if(!m)continue;let p=t.renderedSeatPoint(m);s=Math.min(s,p.x-t.seatR),n=Math.min(n,p.y-t.seatR),r=Math.max(r,p.x+t.seatR),l=Math.max(l,p.y+t.seatR)}let c=f=>{[f.x,f.y,f.width,f.height].every(Number.isFinite)&&(s=Math.min(s,f.x),n=Math.min(n,f.y),r=Math.max(r,f.x+f.width),l=Math.max(l,f.y+f.height))},d=f=>{let m={x:f.x+f.width/2,y:f.y+f.height/2};return i.some(p=>te(m,p.outline,p.holes))};for(let{node:f,backdrop:m}of t.freeTextById.values()){let p=f.getClientRect({relativeTo:t.bgLayer,skipShadow:!0});d(p)&&(c(p),m&&c(m.getClientRect({relativeTo:t.bgLayer,skipShadow:!0})))}for(let{node:f}of t.iconNodeById.values()){let m=f.getClientRect({relativeTo:t.bgLayer,skipShadow:!0});d(m)&&c(m)}let h=new et;for(let{node:f}of t.freeTextById.values()){let m=f.getClientRect({relativeTo:t.bgLayer,skipShadow:!0,skipStroke:!0});h.insert({x:m.x-Q,y:m.y-Q,width:m.width+Q*2,height:m.height+Q*2})}for(let f of t.rowLabelPlan){let m=(f.focusKeys??[]).some(S=>S===e||i.some(v=>S===v.id||S===v.logicalId)),p=new Jc({text:f.text,fontSize:f.fontSize,fontStyle:"700",fontFamily:t.labelFont(),rotation:f.rotation,listening:!1});p.offsetX(p.width()/2),p.offsetY(p.height()/2);let g=t.resolveAutomaticRowLabelPosition(p,f,h),b=t.rowLabelBox(p,g);m&&c(b),h.insert(b),p.destroy()}let u=Math.max(r-s,l-n),y=Math.max(t.seatR*2,Math.min(24,u*.025));return{x:s-y,y:n-y,width:Math.max(1,r-s+y*2),height:Math.max(1,l-n+y*2)}}import{Rect as ed}from"konva/lib/shapes/Rect";import{Text as rr}from"konva/lib/shapes/Text";var so="\0";function td(t){let i=[...G("map.fromPrice",{price:so}).toLocaleLowerCase()],o=i.findIndex(s=>s!==so&&s.toLocaleUpperCase()!==s.toLocaleLowerCase());return o>=0&&(i[o]=i[o].toLocaleUpperCase()),i.join("").split(so).join(t)}function ar(t,e){if(!e.zones?.length||!t.sections.length)return;let i=Ln(t.canvasBackground),o=new Map;for(let s of t.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,d=-1/0;for(let p of n)for(let g of p.outline)g.x<c&&(c=g.x),g.x>d&&(d=g.x);let h=isFinite(c)&&d>c?d-c:0,u=1/0;for(let p of n)for(let g of p.memberIds){let b=t.seatById.get(g),S=b&&t.catPrice.get(b.categoryKey);typeof S=="number"&&S<u&&(u=S)}let y=new ed({x:l,y:a,width:1,height:1,offsetX:.5,offsetY:.5,cornerRadius:1,fill:i.plate,stroke:F(s.color??r.outlineTint,sn),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});t.bgLayer.add(y);let f=new rr({x:l,y:a,text:s.label,fontSize:Zt,fontStyle:Zs,letterSpacing:0,fontFamily:t.labelFont(),fill:i.ink,opacity:0,listening:!1,perfectDrawEnabled:!1});f.offsetX(f.width()/2),f.offsetY(f.height()/2),t.bgLayer.add(f);let m=null;isFinite(u)&&(m=new rr({x:l,y:a,text:td(gt(u,t.currency)),fontSize:jt,fontStyle:js,fontFamily:t.labelFont(),fill:i.subInk,opacity:0,listening:!1,perfectDrawEnabled:!1}),m.offsetX(m.width()/2),t.bgLayer.add(m)),t.zones.push({id:s.id,anchor:{x:l,y:a},back:y,background:i.plate,name:s.label,spanWorld:h,label:f,sub:m})}}import{Circle as ld}from"konva/lib/shapes/Circle";import{Line as cd}from"konva/lib/shapes/Line";import{Rect as dd}from"konva/lib/shapes/Rect";import{Text as hd}from"konva/lib/shapes/Text";function Le(t,e){return e.length===0?!!t.accessible:!!t.accessibility?.some(i=>e.includes(i))}function Me(t,e){return Le(t,e)?"match":t.accessibility?.includes("companion")?"companion":"other"}var lr=.35,cr=.7,tt="#0b1220",St="#ffffff",dr="#0b1220",hr="#232c40",ur="#8b93a7";function no(t,e,i="normal"){let o=t?"bold":i;return e?`italic ${o}`.trim():o}var ro="#f7f8fb";import{Shape as od}from"konva/lib/Shape";import{Circle as sd}from"konva/lib/shapes/Circle";import{Rect as nd}from"konva/lib/shapes/Rect";var id={M:2,L:2,Q:4,C:6,Z:0},ao=new Map;function lo(t){let e=ao.get(t);if(e)return e;let i=zt(t);if(!i)return ao.set(t,[]),[];let o=i.match(/[MLQCZ]|-?(?:\d+(?:\.\d+)?|\.\d+)/g)??[],s=[],n=0;for(;n<o.length;){let r=o[n++],l=id[r];if(l===void 0||n+l>o.length)throw new Error(`Invalid path data for seat glyph "${t}".`);let a=o.slice(n,n+l).map(Number);if(a.some(c=>!Number.isFinite(c)))throw new Error(`Invalid coordinate in seat glyph "${t}".`);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 ao.set(t,s),s}function pr(t,e,i,o=0,s=0){let n=lo(e),r=ms(e).bounds;if(!n.length||!r||!(i>0))return!1;let l=ys(r,i);t.save(),t.translate(o,s),t.scale(l.scale,l.scale),t.translate(-l.centreX,-l.centreY);for(let a of n)a.command==="M"?t.moveTo(a.points[0],a.points[1]):a.command==="L"?t.lineTo(a.points[0],a.points[1]):a.command==="Q"?t.quadraticCurveTo(a.points[0],a.points[1],a.points[2],a.points[3]):a.command==="C"?t.bezierCurveTo(a.points[0],a.points[1],a.points[2],a.points[3],a.points[4],a.points[5]):t.closePath();return t.restore(),!0}function fr(t,e){t.beginPath(),t.arc(0,0,e,0,Math.PI*2,!1),t.closePath()}var vt=class extends od{_sceneFunc(e){let i=this.attrs.seatRadius||1,o=this.attrs.seatGlyph,s=lo(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=i*2*c>=16}else r=n;if(!s.length||!r){fr(e,i),e.fillStrokeShape(this);return}e.beginPath(),pr(e,o,i),e.fillStrokeShape(this)}_hitFunc(e){fr(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 rd(t,e){return t==="circle"||!zt(t)?null:new vt({x:e.x,y:e.y,seatRadius:e.radius,seatGlyph:t,...e.detail===void 0?{}:{seatGlyphDetail:e.detail},...e.fill?{fill:e.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function mr(t){let{x:e,y:i,radius:o}=t;return t.wheelchairBay?new nd({x:e,y:i,width:o*2,height:o*2,offsetX:o,offsetY:o,cornerRadius:2,...t.fill?{fill:t.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}):rd(t.glyph,{x:e,y:i,radius:o,detail:t.detail,fill:t.fill})??new sd({x:e,y:i,radius:o,...t.fill?{fill:t.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function ad(t,e){return t*2*e>=16}function yr(t,e,i,o){let s=ad(e,i);if(s===o||!t.length)return s;for(let n of t)n.setAttr("seatGlyphDetail",s);return s}function gr(t){let e=[...t.seats].sort((i,o)=>(t.perspectiveSeatDepth.get(o.id)??0)-(t.perspectiveSeatDepth.get(i.id)??0));for(let i of e){if(i.kind==="booth"){ud(t,i);continue}let o=t.seatContainer(i.id),s=mr({x:i.x,y:i.y,radius:t.seatR,detail:t.seatGlyphDetail,glyph:gs(i.glyph,t.catByKey.get(i.categoryKey)),wheelchairBay:i.wheelchairSpaceType==="no-seat"});if(s instanceof vt&&t.glyphMarkers.push(s),s.setAttr("seatId",i.id),t.circleById.set(i.id,s),t.paintSeat(s,i.id),o.add(s),i.accessible){if(i.wheelchairSpaceType!=="no-seat"){let n=new ld({x:i.x,y:i.y,radius:t.seatR+1.5,stroke:At(i.accessibility),strokeWidth:2.5,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});t.accessRingById.set(i.id,n),o.add(n)}if(i.accessibility?.includes("wheelchair")&&Ht(i.accessibility)){let n=t.buildAccessGlyph(i,typeof s.fill()=="string"?s.fill():"");t.accessGlyphById.set(i.id,n),o.add(n)}}}}function ud(t,e){let i=t.seatContainer(e.id),o=t.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 cd({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 dd({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),t.circleById.set(e.id,r),i.add(r);let l=new hd({x:s,y:n,text:e.displayLabel??e.label,fontSize:_e,fontStyle:"600",fontFamily:t.labelFont(),fill:t.theme.seatLabelColor??tt,listening:!1,perfectDrawEnabled:!1});l.offsetX(l.width()/2),l.offsetY(l.height()/2),l.visible(!1),t.setHasBoothText(),t.boothLabelById.set(e.id,l),i.add(l),t.paintSeat(r,e.id)}function br(t,e,i,o){let s=null,n=1/0,r=t.stage.scaleX()||1;for(let l of t.seats){if(!o?.includeUnavailable&&!t.selection.has(l.id)&&!t.isSelectable(l.id))continue;let a=t.worldToScreen(l),c=t.viewMode==="perspective"?t.perspectiveSeatScale.get(l.id)??1:1,d=t.seatR*r*c+i,h=Math.hypot(a.x-e.x,a.y-e.y);h<=d&&h<n&&(n=h,s=l.id)}return s}function Sr(t){if(!t.objectFloor.size)return null;let e=t.stage.getPointerPosition();if(!e)return null;let i=t.screenToWorld(e),o=null,s=1/0;for(let n of t.seats){let r=t.renderedSeatPoint(n),l=r.x-i.x,a=r.y-i.y,c=l*l+a*a;c<s&&(s=c,o=n.rowId)}return o?t.objectFloor.get(o)??null:null}import{Circle as Cd}from"konva/lib/shapes/Circle";import{Group as Dr}from"konva/lib/Group";import{Rect as Td}from"konva/lib/shapes/Rect";import{Text as xd}from"konva/lib/shapes/Text";var Ce=1.12;function it(t,e,i,o){if(e.width<=0||e.height<=0)return t.scaleX();let s=o??{x:0,y:0,width:t.width(),height:t.height()},n=Math.min(s.width/(e.width*Ce),s.height/(e.height*Ce));return z(n,i.min,i.max)}var wt=.55;function pi(t,e){return e==null?t.max:Math.max(t.min,Math.min(t.max,e))}function co(t){let{stage:e,box:i,bounds:o,viewport:s,centreScreen:n}=t,r=t.ratio??yt,l=e.scaleX(),a=it(e,i,o,s)/Math.max(l,1e-4);if(a>=r||a<=1/r)return!1;let c=n.x-(s.x+s.width/2),d=n.y-(s.y+s.height/2);return Math.hypot(c,d)<=Math.min(s.width,s.height)*.02}function vr(t,e,i,o){let s=z(e,o.min,o.max),n=t.scaleX();if(s===n)return!1;let r=(i.x-t.x())/n,l=(i.y-t.y())/n;return t.scale({x:s,y:s}),t.position({x:i.x-r*s,y:i.y-l*s}),!0}function wr(t,e,i,o,s,n){let r=s??{x:0,y:0,width:t.width(),height:t.height()},l=Math.min(r.width/(e.width*Ce),r.height/(e.height*Ce)),a=o??i.min,c=z(Math.max(l,a),i.min,Math.max(a,pi(i,n)));t.scale({x:c,y:c}),t.position({x:r.x+r.width/2-(e.x+e.width/2)*c,y:r.y+r.height/2-(e.y+e.height/2)*c})}function kr(t,e){return t===null||e===null?t===e:t.size===e.size&&[...t].every(i=>e.has(i))}function ho(t,e){let i=null;for(let o of t){let s=e.get(o)?.logicalId;if(!s||i!=null&&i!==s)return null;i=s}return i}function Lr(t,e){if(!e?.size)return!1;for(let i of t)if(e.has(i))return!1;return!0}function Ir(t,e){let i=t.sectionHeat.get(e.id)??t.sectionHeat.get(e.logicalId)??(e.zone?t.sectionHeat.get(e.zone):void 0);if(i==null||i<=0){e.outlinePoly.stroke(F(e.outlineTint,.5)),e.outlinePoly.fill(F(e.outlineTint,.08)),e.outlinePoly.strokeWidth(1.75),e.outlinePoly.shadowOpacity(0);return}let o=j("#f4b740","#ef4444",i);e.outlinePoly.stroke(F(o,.72+i*.25)),e.outlinePoly.fill(F(o,.08+i*.13)),e.outlinePoly.strokeWidth(2+i*3.5),e.outlinePoly.shadowColor(o),e.outlinePoly.shadowBlur(4+i*12),e.outlinePoly.shadowOpacity(.25+i*.45)}function po(t,e){return t.closedSections.has(e.id)||t.closedSections.has(e.logicalId)||e.zone!=null&&t.closedSections.has(e.zone)}function Pr(t,e,i,o){if(!e)return 0;let s=0;for(let n of t){if(i(n)!=="free")continue;let r=o(n);r&&Le(r,e)&&(s+=1)}return s}function Mr(t,e){return po(t,e)?"closed":e.total<=0?"normal":e.free<=0?"sold-out":e.free<=e.total*un?"nearly-gone":"normal"}function Rr(t,e){let i=Mr(t,e),o=t.accessFilterActive&&t.sectionAccessibleFree(e)<=0,s=wn(t.canvasBackground,i,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(i==="sold-out"?G("map.soldOut"):G("map.seatsLeft",{count:e.free})),e.subLabel.offsetX(e.subLabel.width()/2)}function fo(t,e){return j(e,B(t)?"#ffffff":"#000000",dn)}function mo(t,e,i=0){let o=cn-i;return!e||t.length<=o?t:`${t.slice(0,Math.max(1,o-1)).trimEnd()}\u2026`}function pd(t,e){return Ar(t,e)!=null}function Ar(t,e){if(!t.accessFilterActive)return null;let i=t.sectionAccessibleFree(e);return i>0?`\u267F ${i}`:null}function Er(t,e,i){let o=mo(t.label,e,i?i.length+1:0);return i?[`${i} ${o}`,i]:[o]}function fd(t,e,i){let o=Er(t,e,i),s=(t.nameLabelBadgeOnly?o[1]:o[0])??o[0];t.nameLabel.text()!==s&&t.nameLabel.text(s),t.nameLabel.fontStyle(e?Qt:Ge),t.nameLabel.letterSpacing(e?t.nameLabel.fontSize()*Ne:0)}function md(t,e,i){let o=t.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&&Mr(t,e)==="sold-out",l=mt/i,a=ei/i,c=r?2/i:0,d={x:e.nameLabel.x(),y:e.nameLabel.y()},h=e.nameLabel.height(),u=0;r?(Re(e.subLabel,he/i,d.y),u=e.subLabel.height(),e.subLabel.rotation(0),e.subLabel.x(d.x),e.subLabel.y(d.y+h/2+c+u/2),e.subLabel.opacity(s)):e.subLabel.opacity(0);let y=r?c+u:0,f=Math.max(e.nameLabel.width(),r?e.subLabel.width():0)+l*2,m=h+y+a*2;e.namePlate.position({x:d.x,y:d.y+y/2}),e.namePlate.rotation(n),e.namePlate.size({width:f,height:m}),e.namePlate.offset({x:f/2,y:m/2}),e.namePlate.cornerRadius(hn/i),e.namePlate.opacity(s*Jt)}function _r(t,e){let i,o;t.reducedMotion?(i=e<=Se?1:0,o=e<=$e?1:0):(i=z((ve-e)/(ve-Se),0,1),o=z((Se-e)/(Se-$e),0,1)),(t.floorOverview||t.focusedSectionId)&&(i=0,o=0);let s=!t.floorOverview&&!t.focusedSectionId&&e<ce;s&&(i=1),t.zones.length||(o=0);let n=t.viewMode==="perspective"&&t.glideInProgress&&t.seatCount>2500;t.seatLayer.opacity(s||n?0:1-i);let r=t.stageScaleX,l=!t.glideInProgress&&(t.lodScale===0||Math.abs(e-t.lodScale)/(t.lodScale||1)>.08);l&&t.setLodScale(e);let a=t.focusedSectionId,c=t.stageWidth<ue,d=ie(t.canvasBackground),h=z((i-.2)/.8,0,1),u=new Set;for(let f of t.sections){let m=t.hasFocusDimOverlay?1:a&&f.id!==a&&f.logicalId!==a&&f.zone!==a?ke:1,p=Ar(t,f);p&&f.zone&&u.add(f.zone);let g=Math.min(m,Lr(f.memberCategoryKeys,t.categoryFilter)?ke:1,t.accessFilterActive&&!p?ke:1);f.outlinePoly.opacity(s?0:(1-i)*g),f.blockPoly.opacity(Us*i*g);let b=t.sectionIsOwned(f);f.blockPoly.stroke(b?t.selectionColor:f.shellStroke||d.sectionStroke),f.blockPoly.strokeWidth((b?$s:De)/Math.max(r,1e-4));let S=f.blockPoly.fill(),v=typeof S=="string"?S:f.baseFill,k=c?fo(t.canvasBackground,v):null;k&&f.namePlate.fill(k);let w=Ie(k??v,f.explicitInk,f.preferredInk);f.nameLabel.fill(w),f.subLabel.fill(w),fd(f,c,p),l&&h>.01&&bd(t,f,r,Er(f,c,p));let L=p?1:1-o;f.nameLabel.opacity(f.nameLabelFits?h*L*g:0),f.subLabel.opacity(0)}let y=o*(1-t.isoT);for(let f of t.zones){let m=t.accessFilterActive&&!u.has(f.id)?ke:1,p=f.label.visible()?y*m:0;f.back.opacity(p),f.label.opacity(p),f.sub&&f.sub.opacity(Cr(t,f)?0:p),l&&Sd(t,f,r)}if(!t.glideInProgress&&(h>.01||y>.01)){gd(t,r),yd(t.sections);for(let f of t.zones){let m=f.label.opacity();f.back.opacity(m),f.sub&&f.sub.opacity(Cr(t,f)?0:m)}}for(let f of t.sections)md(t,f,r);t.bgLayer.batchDraw()}function Cr(t,e){return t.stageWidth<ue||!e.sub||!e.sub.visible()}function yd(t){let e=new Map;for(let i of t)(e.get(i.logicalId)??e.set(i.logicalId,[]).get(i.logicalId)).push(i);for(let i of e.values()){if(i.length<2)continue;let o=i.filter(s=>s.nameLabel.opacity()>.05).sort((s,n)=>{let r=W(s.outline),l=W(n.outline);return l.width*l.height-r.width*r.height});for(let s of o.slice(1))s.nameLabel.opacity(0)}}function gd(t,e){let o=[],s=a=>{let c=t.worldToScreen({x:a.x(),y:a.y()}),d=W(Je({x:0,y:0},a.width()*e,a.height()*e,a.rotation()));return{x:c.x-d.width/2,y:c.y-d.height/2,w:d.width,h:d.height}};for(let a of t.zones){if(a.label.opacity()<=.05)continue;let c=a.back.getAbsolutePosition(),d=a.back.width()*e,h=a.back.height()*e;o.push({node:a.label,tier:0,section:!1,zone:a,box:{x:c.x-d/2,y:c.y-h/2,w:d,h}})}for(let a of t.sections)if(a.nameLabel.opacity()>.05){let c=pd(t,a)?-1:1;o.push({node:a.nameLabel,tier:c,section:!0,area:a.labelArea,box:s(a.nameLabel)})}let n=t.landmarks.map(a=>{let c=t.worldToScreen({x:a.x,y:a.y}),d=t.worldToScreen({x:a.x+a.width,y:a.y+a.height});return{x:Math.min(c.x,d.x),y:Math.min(c.y,d.y),w:Math.abs(d.x-c.x),h:Math.abs(d.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 d of an){if(d===0)continue;let h={...a.box,y:a.box.y+d};if(!l(h)){uo(a.zone,0,d/e),r.push(h),c=!0;break}}if(a.section){let d=a.node.fontSize(),h=a.node.y(),u=a.node.letterSpacing()>0;for(let y of Vi){let f=d*y;if(f*e<he)break;Re(a.node,f,h),u&&(a.node.letterSpacing(a.node.fontSize()*Ne),a.node.offsetX(a.node.width()/2));let m=s(a.node);if(!l(m)){r.push(m),c=!0;break}}c||(Re(a.node,d,h),u&&(a.node.letterSpacing(a.node.fontSize()*Ne),a.node.offsetX(a.node.width()/2)))}c||a.node.opacity(0)}}function Re(t,e,i){t.fontSize(Math.max(1,e)),t.offsetX(t.width()/2),t.offsetY(t.height()/2),t.y(i)}function bd(t,e,i,o){e.subLabelFits=!1;let s=t.stageWidth<ue,n=s?mt*2:0,r=Ze(qe*e.labelScale,t.stageWidth),l=he;for(let[a,c]of o.entries()){e.nameLabel.text(c);for(let d=r;d>=l;d-=1)for(let h of[0,-90]){e.nameLabel.rotation(h),Re(e.nameLabel,d/i,e.nameLabel.y()),s&&(e.nameLabel.letterSpacing(e.nameLabel.fontSize()*Ne),e.nameLabel.offsetX(e.nameLabel.width()/2));for(let u of e.labelAnchors){e.nameLabel.position(u);let y=(8+n)/i;if(ui(u,e.nameLabel.width()+y,e.nameLabel.height()+y,h,e.outline,e.holes)){e.nameLabelFits=!0,e.nameLabelBadgeOnly=a>0;return}}}}e.nameLabel.text(o[0]),e.nameLabelBadgeOnly=!1,e.nameLabel.position(e.centroid),e.nameLabel.rotation(0),e.nameLabelFits=!1}function Tr(t,e,i){let o=s=>(t.text(s),t.width());if(!(o(e)<=i)){for(let s=e.length-1;s>=1;s-=1)if(o(`${e.slice(0,s).trimEnd()}\u2026`)<=i)return;o("\u2026")}}function Sd(t,e,i){let o=zi(t.stageWidth),s=t.stageWidth<ue,n=e.sub!=null&&!s,r=(s?Qs:en)*o/i,l=(s?Js:tn)*o/i,a=Ze(Zt,t.stageWidth);e.label.text(e.name),Re(e.label,a/i,e.anchor.y),n&&(Re(e.sub,Ze(jt,t.stageWidth)/i,e.anchor.y),e.sub.letterSpacing(e.sub.fontSize()*qs),e.sub.offsetX(e.sub.width()/2));let c=s?t.stageWidth*nn/i-r*2:1/0,d=!s&&e.spanWorld>0?e.spanWorld*rn-r*2:1/0,h=Math.min(c,d),u=()=>Math.max(e.label.width(),n?e.sub.width():0);if(n&&u()>h&&(n=!1),u()>h)for(let L of Vi){let C=Math.max(he,a*L);if(C>=e.label.fontSize()*i-.001||(Re(e.label,C/i,e.anchor.y),e.label.width()<=h))break}if(e.label.width()>h&&(Tr(e.label,e.name,Math.max(h,1)),vd(e.label.text())<wd(e.name)&&Tr(e.label,e.name,Math.max(c,1)),Re(e.label,e.label.fontSize(),e.anchor.y)),e.sub&&e.sub.visible(n),c<=0||e.label.width()>c+.001){xr(e);return}e.label.visible(!0),e.back.visible(!0);let y=n?3*o/i:0;e.label.x(e.anchor.x),n?e.sub.x(e.anchor.x):e.sub&&e.sub.opacity(0);let f=Math.max(e.label.width(),n?e.sub.width():0)+r*2,m=e.label.height()+(n?y+e.sub.height():0)+l*2;e.label.y(e.anchor.y-(n?(y+e.sub.height())/2:0)),n&&e.sub.y(e.anchor.y+(e.label.height()+y)/2),e.back.position(e.anchor),e.back.size({width:f,height:m}),e.back.offset({x:f/2,y:m/2}),e.back.cornerRadius(on*o/i),e.back.strokeWidth(1/i);let p=e.back.getAbsolutePosition(),g=6,b=f*i;if(b>t.stageWidth-g*2){xr(e);return}let S=b/2,k=(z(p.x,g+S,t.stageWidth-g-S)-p.x)/i;Math.abs(k)>.001&&uo(e,k,0);let w=62+m*i/2;p.y<w&&uo(e,0,(w-p.y)/i)}function vd(t){return t.endsWith("\u2026")?t.slice(0,-1).trimEnd().length:t.length}function wd(t){return Math.min(t.length,Math.max(6,Math.ceil(t.length/2)))}function xr(t){t.label.visible(!1),t.label.opacity(0),t.back.visible(!1),t.back.opacity(0),t.sub&&(t.sub.visible(!1),t.sub.opacity(0))}function uo(t,e,i){t.label.x(t.label.x()+e),t.label.y(t.label.y()+i),t.sub&&(t.sub.x(t.sub.x()+e),t.sub.y(t.sub.y()+i)),t.back.x(t.back.x()+e),t.back.y(t.back.y()+i)}function kd(t,e){if(!t.length)return null;let i=1/0,o=1/0,s=-1/0,n=-1/0;for(let r of t)!Number.isFinite(r.x)||!Number.isFinite(r.y)||(r.x<i&&(i=r.x),r.y<o&&(o=r.y),r.x>s&&(s=r.x),r.y>n&&(n=r.y));return!Number.isFinite(i)||!Number.isFinite(o)?null:{x:i-e,y:o-e,width:s-i+e*2,height:n-o+e*2}}function bo(t,e=0){let i=new Map;for(let s of t){let n=`${s.rowId}|${s.categoryKey}`,r=i.get(n);r||(r={categoryKey:s.categoryKey,points:[]},i.set(n,r)),r.points.push({x:s.x,y:s.y})}let o=[];for(let[s,n]of i){let r=kd(n.points,e);r&&o.push({id:s,categoryKey:n.categoryKey,seatCount:n.points.length,bounds:r})}return o}function yo(t,e){let i=Math.max(0,Math.max(t.x-(e.x+e.width),e.x-(t.x+t.width))),o=Math.max(0,Math.max(t.y-(e.y+e.height),e.y-(t.y+t.height)));return Math.hypot(i,o)}function go(t,e){let i=Math.min(t.x,e.x),o=Math.min(t.y,e.y);return{x:i,y:o,width:Math.max(t.x+t.width,e.x+e.width)-i,height:Math.max(t.y+t.height,e.y+e.height)-o}}function Fr(t){if(!t.length)return 0;let e=[...t].sort((o,s)=>o-s),i=Math.floor(e.length/2);return e.length%2?e[i]:(e[i-1]+e[i])/2}function Ld(t){if(!t.length)return 0;let e=Fr(t.map(o=>Math.min(o.bounds.width,o.bounds.height)));if(t.length<2)return e;let i=[];for(let o=0;o<t.length;o+=1){let s=1/0;for(let n=0;n<t.length;n+=1)o!==n&&(s=Math.min(s,yo(t[o].bounds,t[n].bounds)));Number.isFinite(s)&&i.push(s)}return Fr(i)+e}function So(t,e){if(!t.length)return[];let i=Ld(t)*(e?.gapRows??2),o=e?.minRows??2,s=e?.minSeats??12,n=new Map;for(let l of t){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,y)=>u.bounds.y-y.bounds.y||u.bounds.x-y.bounds.x||u.id.localeCompare(y.id)),d=[];for(let u of c){let y=d.find(f=>yo(f.bounds,u.bounds)<=i);y?(y.bounds=go(y.bounds,u.bounds),y.rowIds.push(u.id),y.seatCount+=u.seatCount):d.push({categoryKey:l,bounds:{...u.bounds},rowIds:[u.id],seatCount:u.seatCount})}let h=!0;for(;h&&d.length>1;){h=!1;e:for(let u=0;u<d.length;u+=1)for(let y=u+1;y<d.length;y+=1)if(!(yo(d[u].bounds,d[y].bounds)>i)){d[u].bounds=go(d[u].bounds,d[y].bounds),d[u].rowIds.push(...d[y].rowIds),d[u].seatCount+=d[y].seatCount,d.splice(y,1),h=!0;break e}}for(let u of d)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 Br(t){let e=null;for(let i of t)e=e?go(e,i.bounds):{...i.bounds};return e}function Or(t,e){let i=null,o=1/0;for(let s of t){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&&(i=s,o=c)}return i}function Hr(t){return t*.3}function Gr(t){return Hr(t)*2+t*.42}var fi=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=So(bo(this.host.seats(),this.host.seatR()));if(!e.length)return;let i=this.host.canvasBackground(),o=ie(i),s=fo(i,i),n=re(s,o.sectionInk),r=new Dr({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},d=new Dr({listening:!1}),h=new Td({...c,width:0,height:0,fill:s,stroke:o.sectionStroke,strokeWidth:De,opacity:Jt,listening:!1,perfectDrawEnabled:!1}),u=new Cd({...c,radius:0,fill:this.host.categoryColor(l.categoryKey),listening:!1,perfectDrawEnabled:!1}),y=this.host.categoryPriceLabel(l.categoryKey),f=new xd({...c,text:a,fontSize:qe,fontStyle:Ge,fontFamily:this.host.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});d.add(h),d.add(u),d.add(f),r.add(d),this.labels.push({cluster:l,pill:d,plate:h,swatch:u,text:f,label:a,price:y})}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 i=this.host.seatR()*2,o=this.host.exportMode||this.host.viewMode()!=="flat"||this.host.seatsPickable()&&e<we;return this.revealed=o||Os(Hi(i,e),Hi(i,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 i=this.clusterAt(this.host.screenToWorld(e));if(!i)return!1;let o=this.host.seatR()*2,s={x:i.bounds.x-o,y:i.bounds.y-o,width:i.bounds.width+o*2,height:i.bounds.height+o*2},n=this.host.stage;if(it(n,s,this.host.zoomBounds(),this.host.framingViewport())<=n.scaleX()*yt)return!1;let l=this.diveTarget(s);return l?(this.host.focusRegion(l,{durationMs:this.host.cameraGlideMs()}),!0):!1}diveTarget(e,i){let o=this.host.stage,s=this.host.framingViewport(),n=this.host.zoomBounds(),r=it(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*Ce),c=s.height/(l*Ce);if(!(a>0)||!(c>0))return null;let d=i??{x:e.x+e.width/2,y:e.y+e.height/2};return{x:d.x-a/2,y:d.y-c/2,width:a,height:c}}glideTowardTap(e){if(this.host.viewMode()!=="flat")return!1;let i=this.host.stage.scaleX(),o=fn(i,this.host.pickableScale());if(o==null||o<=i*yt)return!1;let s=this.host.screenToWorld(e),n=this.host.framingViewport(),r=n.width/(o*Ce),l=n.height/(o*Ce);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 i=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!==i&&(o.style.cursor=i)}clusterAt(e){let i=Or(this.all,e);if(i)return i;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,i){let o=Math.max(e,1e-4),s=i<ue,n=`${o.toFixed(4)}|${i}`;if(n===this.lastFontKey)return!1;this.lastFontKey=n;let r=Ze(qe,i),l=mt/o,a=ei/o;for(let c of this.labels){let{text:d,plate:h,swatch:u,cluster:y}=c,f=mo(c.label,s);d.text(c.price?`${f} \xB7 ${c.price}`:f),d.fontStyle(s?Qt:Ge);let m=r,p=0;for(;d.fontSize(Math.max(1,m/o)),d.letterSpacing(d.fontSize()*Ne),p=Gr(d.fontSize())+d.width()+l*2,!(p<=y.bounds.width||m<=he);)m=Math.max(he,m-1);let g={x:y.bounds.x+y.bounds.width/2,y:y.bounds.y+y.bounds.height/2},b=d.height()+a*2,S=p-l*2,v=g.x-S/2;u.radius(Hr(d.fontSize())),u.position({x:v+u.radius(),y:g.y}),d.offsetX(0),d.offsetY(d.height()/2),d.position({x:v+Gr(d.fontSize()),y:g.y}),h.size({width:p,height:b}),h.offset({x:p/2,y:b/2}),h.cornerRadius(b/2),h.strokeWidth(De/o),h.position(g)}return!0}applyFilterDim(){if(!this.labels.length)return;let e=this.host.categoryFilter(),i=!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),i=!0)}i&&this.host.labelLayer.batchDraw()}boundsForSeats(e,i){if(!e.length)return null;let o=bo(e,this.host.seatR()),s=So(o);s.length||(s=o.map(l=>({categoryKey:l.categoryKey,bounds:l.bounds,rowIds:[l.id],seatCount:l.seatCount})));let n=Br(s);if(!n)return null;let r=s.reduce((l,a)=>a.seatCount>l.seatCount?a:l,s[0]);return{bounds:{x:n.x-i,y:n.y-i,width:n.width+i*2,height:n.height+i*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 i=this.group;if(!i||e===this.visible)return;if(this.visible=e,this.fadeRaf&&(cancelAnimationFrame(this.fadeRaf),this.fadeRaf=0),i.visible(!0),this.host.reducedMotion()){i.opacity(e?1:0),i.visible(e),this.host.labelLayer.batchDraw();return}let o=i.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);i.opacity(o+(s-o)*a),a>=1&&i.visible(s>0),this.host.labelLayer.batchDraw(),this.fadeRaf=a<1?requestAnimationFrame(r):0};this.fadeRaf=requestAnimationFrame(r)}};import{Circle as Id}from"konva/lib/shapes/Circle";import{Line as Pd}from"konva/lib/shapes/Line";function Wr(t,e,i,o){let s=t.seatRadius(),n=new Id({x:i.x,y:i.y,radius:s,stroke:o,strokeWidth:3,opacity:.9,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),r=t.viewMode()==="perspective"?t.perspectiveSeatScale(e):1;n.scale({x:r,y:r}),t.overlayLayer.add(n);let l=performance.now(),a=620,c=d=>{if(!n.getLayer())return;let h=Math.min(1,(d-l)/a);n.radius(s*(1+h*1.8)),n.opacity(.9*(1-h)),t.overlayLayer.batchDraw(),h<1?requestAnimationFrame(c):(n.destroy(),t.overlayLayer.batchDraw())};requestAnimationFrame(c)}function Vr(t,e,i){for(let o of e){let s=t.viewMode()==="perspective"&&o.perspectiveAffine?o.outline.map(h=>t.perspectiveLocalPoint(t.projectedSectionPoint(o,h))):o.outline.map(h=>{let u=o.liftWorld>0?t.isoLiftLocal(o.liftWorld):{x:0,y:0};return{x:h.x+u.x,y:h.y+u.y}}),n=s.reduce((h,u)=>({x:h.x+u.x,y:h.y+u.y}),{x:0,y:0});n.x/=s.length,n.y/=s.length;let r=new Pd({x:n.x,y:n.y,points:s.flatMap(h=>[h.x-n.x,h.y-n.y]),closed:!0,stroke:i,strokeWidth:3,strokeScaleEnabled:!1,opacity:.92,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!0,shadowColor:i,shadowBlur:14,shadowOpacity:.7});t.overlayLayer.add(r),t.overlayLayer.batchDraw();let l=()=>{r.getLayer()&&(r.destroy(),t.overlayLayer.batchDraw())};if(t.reducedMotion()||typeof document<"u"&&document.hidden){setTimeout(l,520);continue}let a=performance.now(),c=820,d=h=>{if(t.isDestroyed()||!r.getLayer())return;let u=Math.min(1,(h-a)/c),f=1+(1-Math.pow(1-u,3))*.04;r.scale({x:f,y:f}),r.opacity(.92*(1-u)),t.overlayLayer.batchDraw(),u<1?requestAnimationFrame(d):l()};requestAnimationFrame(d)}}import{Group as Ed}from"konva/lib/Group";import{Shape as _d}from"konva/lib/Shape";import{Group as Md}from"konva/lib/Group";import{Shape as Rd}from"konva/lib/Shape";function Ad(t,e,i){let o=e.length,s={x:(e[o-1].x+e[0].x)/2,y:(e[o-1].y+e[0].y)/2};t.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);t.arcTo(r.x,r.y,l.x,l.y,Math.max(0,Math.min(i,c)))}t.closePath()}function Ve(t,e,i,o){let s=dt(t)>0,n=i.cornerRadius&&i.cornerRadius>0?i.cornerRadius:0;return new Rd({...i,sceneFunc(r,l){r.beginPath();let a=d=>{if(d.length){if(n>0&&d.length>=3)return Ad(r,d,n);r.moveTo(d[0].x,d[0].y);for(let h=1;h<d.length;h+=1)r.lineTo(d[h].x,d[h].y);r.closePath()}};o?(d=>{r.moveTo(d.start.x,d.start.y);let h=d.start;for(let u of d.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(h.y-u.center.y,h.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),h=u.end;r.closePath()})(o):a(t);for(let d of e??[]){let h=dt(d)>0;a(h===s?[...d].reverse():d)}r.fillStrokeShape(l)},perfectDrawEnabled:!1})}var ot=class extends Md{constructor(){super(...arguments);this.viewportCulled=!1}setViewportCulled(i){i!==this.viewportCulled&&(this.viewportCulled=i,i||super._clearSelfAndDescendantCache())}isViewportCulled(){return this.viewportCulled}drawScene(...i){return this.viewportCulled?this:super.drawScene(...i)}drawHit(...i){return this.viewportCulled?this:super.drawHit(...i)}_clearSelfAndDescendantCache(i){if(!this.viewportCulled){super._clearSelfAndDescendantCache(i);return}this._clearCache(i)}};function zr(t,e){if(!e.length)return null;let i=new Ed({listening:!1});for(let o of e){let s=t.viewMode==="perspective"&&o.perspectiveAffine,n=s?o.outline.map(l=>t.perspectiveLocalPoint(t.projectedSectionPoint(o,l))):o.outline,r=s?o.holes.map(l=>l.map(a=>t.perspectiveLocalPoint(t.projectedSectionPoint(o,a)))):o.holes;i.add(Ve(n,r,{fill:gn,stroke:F("#ffffff",.1),strokeWidth:1,listening:!1},s?void 0:o.outlinePath))}return t.bgLayer.add(i),i.moveToTop(),i}function Kr(t,e){let{bounds:i}=t,s=Math.max(i.width,i.height,1)*4+1e3,n=[{x:i.x-s,y:i.y-s},{x:i.x+i.width+s,y:i.y-s},{x:i.x+i.width+s,y:i.y+i.height+s},{x:i.x-s,y:i.y+i.height+s}],r=new _d({fill:t.canvasBackground,opacity:1-ke,listening:!1,perfectDrawEnabled:!1,sceneFunc:(l,a)=>{let c=d=>{if(d.length){l.moveTo(d[0].x,d[0].y);for(let h=1;h<d.length;h++)l.lineTo(d[h].x,d[h].y);l.closePath()}};l.beginPath(),c(n);for(let d of e){let h=t.viewMode==="perspective"&&d.perspectiveAffine?d.outline.map(u=>t.perspectiveLocalPoint(t.projectedSectionPoint(d,u))):d.outline.map(u=>{let y=d.liftWorld>0?t.isoLiftLocal(d.liftWorld):{x:0,y:0};return{x:u.x+y.x,y:u.y+y.y}});c(dt(h)>0?[...h].reverse():h)}l.fillStrokeShape(a)}});return t.overlayLayer.add(r),r.moveToTop(),r}import{Rect as Bh}from"konva/lib/shapes/Rect";import{Path as Oh}from"konva/lib/shapes/Path";import{Text as Fd}from"konva/lib/shapes/Text";function Xr(t){let e=_e,i=new Fd({fontSize:ye,fontStyle:"600",fontFamily:t.labelFont(),listening:!1}),o=t.seatR*2-3;for(let s of t.seats){if(s.kind==="booth"){e=Math.min(e,_e);continue}let n=ye*t.seatLabelScale(s);i.fontSize(n),i.text(Wt(s.displayLabel??s.label));let r=i.width()>o?Math.max(ut,n*o/i.width()):n;e=Math.min(e,r)}return i.destroy(),H/Math.max(ut,e)}var vo={top:0,right:0,bottom:0,left:0};function Yr(t){let e=i=>typeof i=="number"&&Number.isFinite(i)&&i>0?i:0;return t?{top:e(t.top),right:e(t.right),bottom:e(t.bottom),left:e(t.left)}:{...vo}}var Bd=.7;function Ur(t,e,i){let{top:o,right:s,bottom:n,left:r}=i,l=(u,y,f)=>{let m=u+y,p=f*Bd;if(m<=p||m<=0)return[u,y];let g=p/m;return[u*g,y*g]},[a,c]=l(r,s,t),[d,h]=l(o,n,e);return{x:a,y:d,width:Math.max(1,t-a-c),height:Math.max(1,e-d-h)}}function $r(t){return{x:t.x(),y:t.y(),scale:t.scaleX()}}function qr(t,e){return!Number.isFinite(e.x)||!Number.isFinite(e.y)||!(e.scale>0)?!1:(t.scale({x:e.scale,y:e.scale}),t.position({x:e.x,y:e.y}),!0)}function mi(t){return{x:t.x+t.width/2,y:t.y+t.height/2}}function Zr(t,e){let i=e({x:t.x,y:t.y}),o=e({x:t.x+t.width,y:t.y+t.height});return{x:Math.min(i.x,o.x),y:Math.min(i.y,o.y),width:Math.abs(o.x-i.x),height:Math.abs(o.y-i.y)}}function Qr(){return typeof navigator<"u"&&navigator.maxTouchPoints>0?Ys:Xs}function Jr(t){return Math.max(t*1.05,Ns,ce*1.3)}var Od=56;function ea(t){return Od/(2*Math.max(t,1e-4))}function st(t,e){let i=1/0,o=-1/0,s=1/0,n=-1/0;for(let r of t)i=Math.min(i,r.x),o=Math.max(o,r.x),s=Math.min(s,r.y),n=Math.max(n,r.y);return i-=e,o+=e,s-=e,n+=e,{x:i,y:s,width:Math.max(40,o-i),height:Math.max(40,n-s)}}function ta(t){let{stageWidth:e,stageHeight:i,fullBounds:o,visibleBounds:s,seatPoints:n,minScale:r}=t;if(!n.length)return null;let l=1.12;if(Math.min(e/(o.width*l),i/(o.height*l))>=r)return null;let c=t.tapAnchor??{x:s.x+s.width/2,y:s.y+s.height/2},d=n[0],h=1/0;for(let m of n){let p=(m.x-c.x)**2+(m.y-c.y)**2;p<h&&(d=m,h=p)}let u=e/(r*l),y=i/(r*l),f=st(n,0);return{bounds:{x:jr(d.x,u,f.x,f.width),y:jr(d.y,y,f.y,f.height),width:u,height:y},minScale:r}}function jr(t,e,i,o){return o<=e?i+o/2-e/2:Math.min(Math.max(t-e/2,i),i+o-e)}var ra=.5,V=Math.SQRT1_2,Dd="#f3f4f6",ia=4;function Gd(t){let e=t.fraction;return typeof e!="number"||!Number.isFinite(e)?ra:Math.min(1,Math.max(0,e))}function Nd(t){return t==="booked"||t==="not_for_sale"?ii:ti}function oa(t,e){return Number.parseInt(t.slice(e,e+2),16)}function sa(t){let e=t.trim();if(!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(e))return null;if(e.length===7)return e.toLowerCase();let[,i,o,s]=e.toLowerCase();return`#${i}${i}${o}${o}${s}${s}`}function Hd(t,e,i){let o=sa(t),s=sa(e);if(!o||!s)return t;let n=Math.min(1,Math.max(0,i)),r="#";for(let l=1;l<7;l+=2){let a=Math.round(oa(o,l)*(1-n)+oa(s,l)*n);r+=a.toString(16).padStart(2,"0")}return r}function na(t,e,i,o){let s=i*4,n=e*V,r=-e*V,l=o*V*2*s,a=o*-V*2*s,c=n+s*V,d=r+s*V,h=n-s*V,u=r-s*V;t.beginPath(),t.moveTo(c,d),t.lineTo(h,u),t.lineTo(h+l,u+a),t.lineTo(c+l,d+a),t.closePath(),t.clip()}function Wd(t,e){let i=e*4,o=Math.max(e*.45,1);t.beginPath();for(let s=-ia;s<=ia;s++){let n=s*o*2,r=n+o,l=n*V,a=-n*V,c=r*V,d=-r*V;t.moveTo(l+i*V,a+i*V),t.lineTo(l-i*V,a-i*V),t.lineTo(c-i*V,d-i*V),t.lineTo(c+i*V,d+i*V),t.closePath()}t.clip()}function yi(t,e){t._sceneFunc(e)}function aa(t){let e=this,i=e.attrs,o=i.markRadius||1,s=i.fill,n=e.getStage(),r=Math.abs((n?n.scaleX():1)*(e.scaleX()||1))||1;if(o*2*r<16){i.fill=i.markMidtone??s,yi(e,t),i.fill=s;return}let a=(1-2*(i.markFraction??ra))*o;t.save(),na(t,a,o,1),i.fill=i.markBase??s,yi(e,t),t.restore(),t.save(),na(t,a,o,-1),i.fill=i.markFill??s,yi(e,t),i.markHatch&&(Wd(t,o),i.fill=Dd,yi(e,t)),t.restore(),i.fill=s}function Vd(t,e,i,o,s,n){let r=Gd(e),l=Nd(i),a=t.attrs;a.markFraction=r,a.markBase=o,a.markFill=l,a.markMidtone=Hd(o,l,1-r),a.markHatch=n,a.markRadius=s>0?s:1,t.fill(a.markMidtone),t.stroke(""),t.strokeWidth(0),t.dash([]),t.opacity(1),t.sceneFunc(aa)}function zd(t){t.setAttr("sceneFunc",void 0)}function wo(t){return t.attrs.sceneFunc===aa}var gi=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,i){let o=new Set;for(let[s,n]of Object.entries(e))i.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,i,o,s,n,r,l){let a=l?void 0:this.marks.get(i);if(!a){wo(e)&&zd(e);return}Vd(e,a,o,s,n,r)}};function bi(t){let e=t.getClientRect({skipTransform:!0,skipShadow:!0});!Number.isFinite(e.width)||!Number.isFinite(e.height)||(t.offsetX(e.x+e.width/2),t.offsetY(e.y+e.height/2))}var la=.85,Kd=1,Xd=.7,Yd=.8,ca="rgba(0,0,0,0)",Ud=[2,2],$d=1,ko=.6;function da(t){return B(t)?"#334155":"#e2e8f0"}function ha(t,e,i){return t==="held"?{fill:ti,stroke:da(e),strokeWidth:$d,dash:[...Ud],opacity:1,scale:1}:t==="booked"||t==="not_for_sale"?i?{fill:ca,stroke:ii,strokeWidth:1.5,dash:[],opacity:.9,scale:la}:{fill:ca,stroke:da(e),strokeWidth:Kd,dash:[],opacity:t==="booked"?Xd:Yd,scale:la}:null}var Lo=1e6;function qd(){return typeof navigator>"u"?!1:navigator.maxTouchPoints>0&&/AppleWebKit/i.test(navigator.userAgent)}var Si=class{constructor(e,i=qd()){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 i=this.toLocal(e.clientX,e.clientY);this.updatePointer(e.pointerId,i)&&this.applyPointerMove(i)};this.onPointerEnd=e=>{this.useWebKitTouchEvents&&e.pointerType==="touch"||this.endPointer(e.pointerId)};this.onTouchStart=e=>{e.preventDefault(),this.rect=null;for(let i=0;i<e.changedTouches.length;i+=1){let o=e.changedTouches.item(i);o&&this.beginPointer(Lo+o.identifier,this.toLocal(o.clientX,o.clientY),"touch",0)}};this.onTouchMove=e=>{e.preventDefault();let i=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(Lo+s.identifier,n)&&(i=n)}i&&this.applyPointerMove(i)};this.onTouchEnd=e=>{e.preventDefault();for(let i=0;i<e.changedTouches.length;i+=1){let o=e.changedTouches.item(i);o&&this.endPointer(Lo+o.identifier)}};this.host=e,this.useWebKitTouchEvents=i}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<Hs}invalidateRect(){this.rect=null}toLocal(e,i){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:i-o.top}}beginPointer(e,i,o,s){if(this.host.cancelGlide(),this.pointers.set(e,i),this.pointers.size===1)this.movedPx=0,this.singleTouch=o==="touch",this.singleTouch&&this.host.touchProbeStart?.(i),this.pinch=null,this.panStart=i,this.panStarted=!1,this.host.marqueeShouldStart({pointerType:o,button:s})?(this.host.beginMarquee(i),this.panLast=null):this.panLast=i;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=Pe+1}}updatePointer(e,i){return this.pointers.has(e)?(this.pointers.set(e,i),this.pointers.size===1&&this.panStart?this.movedPx=Math.max(this.movedPx,Math.hypot(i.x-this.panStart.x,i.y-this.panStart.y)):this.pointers.size>=2&&(this.movedPx=Pe+1),!0):!1}applyPointerMove(e){if(this.singleTouch&&this.pointers.size===1&&(this.panStarted||this.movedPx>Pe?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[i,o]=[...this.pointers.values()],s=Math.hypot(o.x-i.x,o.y-i.y);if(this.pinch.startDist<1)return;let n={x:(i.x+o.x)/2,y:(i.y+o.y)/2},{min:r,max:l}=this.host.zoomBounds(),a=z(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<=Pe)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 Zd}from"konva/lib/shapes/Circle";import{Group as jd}from"konva/lib/Group";import{Text as Qd}from"konva/lib/shapes/Text";var ua=13,Jd=15,eh=.3,th=.08;function ya(t,e,i){return!!(t&&i!==t||e&&!e.has(i))}function ih(t,e){return!e||t.available==null?`cap ${t.capacity}`:t.available<=0?G("map.soldOut"):G("map.seatsLeft",{count:t.available})}function oh(t,e){return e&&t.available!=null&&t.available<=0}function ga(t){for(let e of t.gaById.values()){let i=t.filteredOut(e.categoryKey),o=t.overviewHidden(e),s=oh(e,t.pickerMode),n=t.pickerMode?e.selected??0:0;e.polygon.opacity(o?0:t.dimmed(e.categoryKey)?Fe*th:s?Fe*eh:Fe),e.polygon.listening(!t.exportMode&&!o&&!i&&!s),e.polygon.stroke(n>0?t.selectionColor:e.strokeColor),e.polygon.strokeWidth(n>0?3:1.5),sh(t,e,s,n,o,t.dimmed(e.categoryKey))}}function sh(t,e,i,o,s,n){if(e.capacityNode){let r=ih(e,t.pickerMode);e.capacityNode.text()!==r&&(e.capacityNode.text(r),e.capacityNode.offsetX(e.capacityNode.width()/2)),e.capacityNode.opacity(i?.75:1)}nh(t,e,s||n),o>0&&!s?ah(t,e,o):e.chip&&e.chip.visible(!1)}var Co=9,pa=.86;function nh(t,e,i){let{labelNode:o,capacityNode:s}=e;if(!o&&!s)return;let n=Math.max(t.effScale(),1e-4);if(i){o?.visible(!1),s?.visible(!1);return}if(!t.pickerMode){o?.visible(t.labelLegible(o.fontSize())),s?.visible(t.labelLegible(s.fontSize()));return}let r=rh(e,n),l=fa(o,Gt,r.width*pa,n),a=fa(s,Nt,r.width*pa,n),c=l!=null,d=a!=null&&c&&l+a+Co<=r.height;ma(o,c?l:null,e.labelPoint.y-Co/n,n),ma(s,d?a:null,e.labelPoint.y+Co/n,n)}function rh(t,e){let i=1/0,o=-1/0,s=1/0,n=-1/0;for(let r of t.points)r.x<i&&(i=r.x),r.x>o&&(o=r.x),r.y<s&&(s=r.y),r.y>n&&(n=r.y);return Number.isFinite(i)?{width:(o-i)*e,height:(n-s)*e}:{width:0,height:0}}function fa(t,e,i,o){if(!t||!t.text())return null;t.fontSize(e/o);let s=t.width()*o;if(s<=i||s<=0)return e;let n=e*(i/s);return n>=H?n:null}function ma(t,e,i,o){if(t){if(e==null){t.visible(!1);return}t.fontSize(e/o),t.offsetX(t.width()/2),t.offsetY(t.height()/2),t.y(i),t.visible(!0)}}function ah(t,e,i){if(!e.chip){let o=new jd({x:e.labelPoint.x,y:e.labelPoint.y-ua-16,listening:!1}),s=new Zd({radius:ua,fill:t.selectionColor,listening:!1,perfectDrawEnabled:!1}),n=new Qd({text:String(i),fontSize:Jd,fontStyle:"800",fontFamily:t.labelFont(),fill:"#0b0d12",listening:!1,perfectDrawEnabled:!1});o.add(s),o.add(n),t.bgLayer.add(o),e.chip=o,e.chipText=n}e.chipText&&e.chipText.text()!==String(i)&&e.chipText.text(String(i)),e.chipText&&(e.chipText.offsetX(e.chipText.width()/2),e.chipText.offsetY(e.chipText.height()/2)),e.chip.visible(!0),e.chip.moveToTop()}function ba(t,e){let i=!1;for(let[o,s]of Object.entries(e)){let n=t.get(o);n&&(s.available!==void 0&&n.available!==s.available&&(n.available=s.available,i=!0),s.selected!==void 0&&n.selected!==s.selected&&(n.selected=s.selected,i=!0))}return i}function Sa(t){let{focusedId:e}=t;if(!e)return null;let i=new Set([e]),o=t.sectionOf(e);if(o!=null){for(let c of t.seats){let d=t.seatId(c);t.sectionOf(d)===o&&i.add(d)}return i}let s=t.seats.find(c=>t.seatId(c)===e);if(!s)return i;let n=t.seatPoint(s),r=t.seatPitch>0?t.seatPitch:t.seatRadius*2,l=6*(r>0?r:1),a=l*l;for(let c of t.seats){let d=t.seatPoint(c),h=d.x-n.x,u=d.y-n.y;h*h+u*u<=a&&i.add(t.seatId(c))}return i}function va(t,e,i){let o=i(t);return o!=null&&o===i(e)}var lh=.2,ch=.55;function wa(t,e){return t.startsWith("#")?j(e,t,lh):t}function ka(t){return B(t)?"#0b1220":"#ffffff"}function dh(t){return j(t,ka(t),ch)}function La(t){return t>0?Math.min(1,t/le):1}function Ca(t){let{categoryFilter:e,status:i}=t;return!e||t.selected||i!=="free"&&!(i==="held"&&!t.ownHold)?!1:!e.has(t.categoryKey)}function Ta(t,e,i){let o=typeof t=="string"&&t.startsWith("#")?t:e;return i?dh(o):ka(o)}function xa(t){let{width:e,height:i}=t;return!(e>0)||!(i>0)?"hidden":e===t.stageWidth&&i===t.stageHeight?"unchanged":{width:e,height:i}}import{Rect as Ia}from"konva/lib/shapes/Rect";import{Text as hh}from"konva/lib/shapes/Text";function Pa(t){let e=t.effScale(),i=t.stage.scaleX(),o={width:t.stage.width(),height:t.stage.height()},s=m=>Math.round(m*100)/100,n=new Map(t.overlayLayer.find(".selection-ring").map(m=>[String(m.getAttr("seatId")??""),String(m.getAttr("ringColor")??t.effSelection)])),r=t.seats.map(m=>{let p=t.circleById.get(m.id),g=t.boothLabelById.get(m.id)??t.seatLabelById.get(m.id),b=t.viewMode==="perspective"?t.perspectiveSeatScale.get(m.id)??1:1,S=(t.viewMode==="perspective"?i:e)*b,v=m.kind==="booth"?_e:ye*t.seatLabelScale(m),k=t.viewMode==="perspective"&&m.kind!=="booth"?e*b:S,w=s((g?.fontSize()??v)*k),L=t.worldToScreen(m),C=g?g.width()*i*b:0,T=g?g.height()*(t.viewMode==="perspective"&&m.kind==="booth"?i:e)*b:0,x=L.x-C/2<0||L.x+C/2>o.width||L.y-T/2<0||L.y+T/2>o.height,I=t.focusedSeatOpacity(m.id,p?.getAbsoluteOpacity()??0),P=t.seatSection.get(m.id),A=!!g?.isVisible()&&I>=.5&&!x,R;A||(I<.5?R="dimmed-or-unavailable":w<H?R="below-minimum-size":x?R="outside-viewport":g?R="renderer-hidden":R=t.seatLabelDrops.get(m.id)??(t.seatLabelRungOpen()?"clutter-or-fit":"below-label-rung"));let M=p instanceof Ia?p.width()*i*b:t.seatR*2*S,_=p instanceof Ia?p.height()*(t.viewMode==="perspective"?i:e)*b:t.seatR*2*S,$=2*(t.seatR*S+Oe),X=p?.fill(),Y=g?.fill(),J=t.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,...P?{sectionId:P.id}:{},...P?.zone?{zoneId:P.zone}:{},status:t.statusById.get(m.id)??"free",selected:t.selection.has(m.id),visible:A,renderedFontPx:w,fill:typeof X=="string"?X:"",ink:typeof Y=="string"?Y:p?t.seatLabelInk(m,p):t.seatPreferredLabelInk(m),...n.has(m.id)?{selectionRingColor:n.get(m.id)}:{},opacity:s(I),...J?{accessibilityMarker:{glyphVisible:J.isVisible(),glyphWidthPx:s(xe*Math.abs(D?.x??0)),emphasizedByFilter:t.accessGlyphFilterEmphasized(m.id)}}:{},pointerTarget:{active:!t.cached&&!t.seatViewportCulled(m.id)&&!!p?.isVisible()&&!!p?.isListening()&&t.isSelectable(m.id),directWidthPx:s(M),directHeightPx:s(_),effectiveMinimumPx:s(Math.max(Math.min(M,_),$))},screenCenter:{x:s(L.x),y:s(L.y)},...A?{screenBox:{x:s(L.x-C/2),y:s(L.y-T/2),width:s(C),height:s(T)}}:{},...R?{hiddenReason:R}:{}}}),l=r.filter(m=>m.visible).length,a=(m,p,g,b,S,v)=>{let k=Je({x:b.x(),y:b.y()},b.width(),b.height(),b.rotation()),w=v&&v.liftWorld>0?t.isoLiftLocal(v.liftWorld):{x:0,y:0},L=W(k.map(A=>t.worldToScreen({x:A.x+w.x,y:A.y+w.y}))),C=s(b.opacity()),T=b.fill(),x=L.x+L.width<0||L.x>o.width||L.y+L.height<0||L.y>o.height,I=b.isVisible()&&C>.05&&!x,P=v?ui({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:I,renderedFontPx:s(b.fontSize()*i),opacity:C,fill:S,ink:typeof T=="string"?T:"",...P==null?{}:{fitsContainer:P},...I?{screenBox:{x:s(L.x),y:s(L.y),width:s(L.width),height:s(L.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},d=[...t.sections.map(m=>a(m.id,"section","name",m.nameLabel,c(m),m)),...t.sections.map(m=>a(`${m.id}:availability`,"section","availability",m.subLabel,c(m),m)),...t.zones.flatMap(m=>[a(m.id,"zone","name",m.label,m.background),...m.sub?[a(`${m.id}:price`,"zone","price",m.sub,m.background)]:[]])],h=[...t.gaById].map(([m,p])=>{let g=p.points.map(x=>t.worldToScreen(x)),b=Math.min(...g.map(x=>x.x)),S=Math.min(...g.map(x=>x.y)),v=Math.max(...g.map(x=>x.x)),k=Math.max(...g.map(x=>x.y)),w=v<0||b>o.width||k<0||S>o.height,L=s(p.polygon.opacity()),C=L>=.1&&!w,T=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:L,fill:typeof T=="string"?T:"",effectiveBackground:p.effectiveBackground,...C?{screenBox:{x:s(b),y:s(S),width:s(v-b),height:s(k-S)}}:{}}}),u=[...t.freeTextById].map(([m,p])=>{let{node:g,background:b,kind:S}=p,v=t.worldToScreen({x:g.x(),y:g.y()}),k=g.width()*i,w=g.height()*e,L=v.x-g.offsetX()*i,C=v.y-g.offsetY()*e,T=s(g.fontSize()*e),x=L+k<0||L>o.width||C+w<0||C>o.height,I=g.isVisible()&&!x,P=g.fill(),A=s(g.getAbsoluteOpacity()),R;return I||(T<H?R="below-minimum-size":x?R="outside-viewport":R="renderer-hidden"),{objectId:p.objectId??m,kind:S,text:g.text(),visible:I,renderedFontPx:T,ink:typeof P=="string"?P:"",background:b,opacity:A,...I?{screenBox:{x:s(L),y:s(C),width:s(k),height:s(w)}}:{},...R?{hiddenReason:R}:{}}}),y=t.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)}}}}),f=t.sections.filter(m=>m.blockPoly.opacity()>.05);return{viewport:o,projection:t.viewMode,...t.viewMode==="perspective"?{perspective:{model:"pinhole-exact-seat-anchors",sectionSurfaceModel:"tangent-plane",exactSeatAnchorCount:t.perspectiveSeatProjected.size,depthSorted:!0}}:{},canvasBackground:t.canvasBackground,effectiveScale:s(e),rung:t.getRung(),minimumVisibleLabelPx:H,totalLabelledBookableUnits:r.length,visibleLabels:l,hiddenLabels:r.length-l,totalBookableUnits:r.length+h.reduce((m,p)=>m+p.capacity,0),selectionRingSeatIds:t.overlayLayer.find(".selection-ring").map(m=>String(m.getAttr("seatId")??"")).filter(Boolean),selectionRingColor:t.effSelection,focusedSectionId:t.focusedSectionId,focusBackdropVisible:!!t.focusBackdrop?.isVisible(),categoryFilterKeys:t.categoryFilter?[...t.categoryFilter].sort():null,overviewStyle:{visibleSectionShells:f.length,categoryPaintedSectionShells:f.filter(m=>{let p=m.blockPoly.fill();return typeof p!="string"||!Xi(t.canvasBackground,p)}).length,tintedSectionShells:f.filter(m=>{let p=m.blockPoly.fill();return typeof p=="string"&&kn(t.canvasBackground,p)}).length,visibleCategoryDetailOutlines:t.sections.filter(m=>m.outlinePoly.opacity()>.05).length,visibleSectionRowHints:0,visibleSectionAvailabilityLabels:t.sections.filter(m=>m.subLabel.opacity()>.05).length,visibleSectionGADetails:[...t.gaById.values()].filter(m=>m.sectionId!=null&&m.polygon.opacity()>.05).length},labels:r,gaAreas:h,hierarchyLabels:d,freeTextLabels:u,rowLabels:y}}import{Circle as uh}from"konva/lib/shapes/Circle";import{Ellipse as ph}from"konva/lib/shapes/Ellipse";import{Line as Ma}from"konva/lib/shapes/Line";import{Arrow as fh}from"konva/lib/shapes/Arrow";import{Path as mh}from"konva/lib/shapes/Path";import{Rect as kt}from"konva/lib/shapes/Rect";import{Text as xo}from"konva/lib/shapes/Text";import{Image as Ra}from"konva/lib/shapes/Image";function Aa(t,e){if(!e.url||e.visible===!1)return;let i=new window.Image;t.trackAssetImage(i,e.url,"Buyer background image",()=>{let o=i.naturalWidth||4,s=i.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,d=c*(s*a.height/(o*a.width)),h=new Ra({image:i,x:e.center.x,y:e.center.y,offsetX:c/2,offsetY:d/2,width:c,height:d,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});t.bgLayer.add(h),h.moveToBottom(),t.bgLayer.batchDraw()})}function Ea(t,e){let i=new window.Image,o=new Ra({image:i,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:z(e.opacity??1,0,1),listening:!1,perfectDrawEnabled:!1});e.layer==="foreground"?t.fgDecorGroup.add(o):t.bgLayer.add(o),e.role&&t.landmarkBoxes.push(W(Je({x:e.x+e.width/2,y:e.y+e.height/2},e.width,e.height,e.rotation??0))),t.trackAssetImage(i,e.href,`Decor image \u201C${e.label||e.id}\u201D`,()=>{let s=o.getLayer();s&&s.batchDraw()})}function _a(t,e){if(e.shape==="round")t.bgLayer.add(new uh({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;t.bgLayer.add(new kt({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 i=Lt(t,t.bgLayer,e.displayLabel??e.label,e.center.x,e.center.y,"#cbd5e1",12,!0);t.freeTextById.set(e.id,{node:i,background:"#232c40",kind:"table"})}var yh=8,gh=6;function Fa(t,e){let i=e.background?.color??t.canvasBackground,o=e.color??re(i,t.theme.textColor??ur),s=e.semanticKind==="icon"?Ps(e.iconKey):void 0;if(s){let d=e.fontSize/24,h=new mh({x:e.position.x,y:e.position.y,data:s,rotation:e.rotation,scaleX:d,scaleY:d,stroke:o,strokeWidth:2,lineCap:"round",lineJoin:"round",fillEnabled:!1,listening:!1,perfectDrawEnabled:!1});t.iconNodeById.set(e.id,{node:h,fontSize:e.fontSize}),t.bgLayer.add(h);return}let n=e.background?.padding??0,r=e.opacity??1,l=Ss(e),a=new xo({x:e.position.x,y:e.position.y,text:e.text,fontSize:e.fontSize,rotation:e.rotation,fontStyle:no(e.bold,e.italic,"600"),fill:o,fontFamily:e.fontFamily??t.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 d=a.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:!0}),h=Math.max(yh,e.fontSize*.35),u=Math.max(gh,e.fontSize*.28);c=new kt({x:e.position.x,y:e.position.y,offsetX:-(d.x-h),offsetY:-(d.y-u),width:d.width+h*2,height:d.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"}),t.bgLayer.add(c)}t.freeTextById.set(e.id,{node:a,backdrop:c,background:i,kind:l?"direct-landmark":"free-text"}),t.bgLayer.add(a)}function Ba(t,e){let i=e.fill??t.theme.decorFill??hr,o=e.role==="stage",s=e.role==="reference-focal",n=!!e.role&&!o,r=bs(e),l=ie(t.canvasBackground),a=s?l.focalFill:i,c=e.kind==="line"||e.kind==="polyline",d=e.stroke?.color??(o?Te(a,.28):s?l.focalStroke:c?"#9aa3b5":void 0),h=e.stroke?.width??(o?1:s||c?2:0),u=e.opacity!=null?z(e.opacity,.1,1):1,y=0,f=0,m=null;if(c&&e.points&&e.points.length>=2){y=e.points.reduce((S,v)=>S+v.x,0)/e.points.length,f=e.points.reduce((S,v)=>S+v.y,0)/e.points.length;let p=Ms(e),g=Rs(h),b=new fh({points:e.points.flatMap(S=>[S.x,S.y]),closed:!1,x:y,y:f,offsetX:y,offsetY:f,rotation:e.rotation??0,stroke:d,fill:d,strokeWidth:h,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),t.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,Te(a,.12)]}:{fill:a};y=e.x+e.width/2,f=e.y+e.height/2,m={x:e.x,y:e.y,width:e.width,height:e.height},t.bgLayer.add(new kt({x:y,y:f,offsetX:e.width/2,offsetY:e.height/2,rotation:e.rotation??0,width:e.width,height:e.height,...p,stroke:d,strokeWidth:h,cornerRadius:z(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){y=e.x+e.width/2,f=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,Te(a,.12)]}:{fill:a};t.bgLayer.add(new ph({x:y,y:f,rotation:e.rotation??0,radiusX:e.width/2,radiusY:e.height/2,...p,stroke:d,strokeWidth:h,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=W(e.points);y=e.points.reduce((S,v)=>S+v.x,0)/e.points.length,f=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,Te(a,.12)]}:{fill:a};t.bgLayer.add(new Ma({points:p,closed:!0,x:y,y:f,offsetX:y,offsetY:f,rotation:e.rotation??0,...b,stroke:d,strokeWidth:h,opacity:u,listening:!1}))}m&&e.role&&t.landmarkBoxes.push(m);for(let p of es(e))t.bgLayer.add(new Ma({points:p.points.flatMap(g=>[g.x,g.y]),closed:p.closed,x:y,y:f,offsetX:y,offsetY:f,rotation:e.rotation??0,stroke:p.ink??Jo,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}=Sh(t,y,f,e.label,a,m,e.labelStyle);t.primaryFocalLabels.set(p,g),t.freeTextById.set(e.id,{node:p,background:a,kind:"stage"})}else if(n){let p=s||r,g=Lt(t,t.bgLayer,e.label,y,f,p?re(a,"#e6e9f0"):"#9aa3b5",p?18:12,!1);p&&t.primaryFocalLabels.set(g,{targetPx:18,trackingRatio:0,ink:String(g.fill()??""),plateInk:String(g.fill()??""),plate:new kt({width:0,height:0,opacity:0,listening:!1})}),t.freeTextById.set(e.id,{node:g,background:a,kind:"decor"})}else{let p=Lt(t,t.bgLayer,e.label,y,f,"#cbd5e1",16,!0);t.freeTextById.set(e.id,{node:p,background:a,kind:"decor"})}}var To=22,bh=H,vi=6;function Sh(t,e,i,o,s,n,r){let l=r?.size??To,a=r?.color??t.theme.textColor??"#e6e9f0",c=r?.color??re(s,a),d=n?n.x+n.width/2:e,h=n?n.y+n.height/2:i,u=vh(t.canvasBackground,s),y=new kt({x:d,y:h,width:0,height:0,cornerRadius:4,fill:u,opacity:0,listening:!1,perfectDrawEnabled:!1});t.bgLayer.add(y);let f=new xo({x:d,y:h,text:o,fontSize:l,fontStyle:no(r?.bold??!0,r?.italic,"normal"),letterSpacing:l*(4/To),fontFamily:r?.fontFamily??t.labelFont(),fill:c,textDecoration:r?.underline?"underline":"",listening:!1,perfectDrawEnabled:!1});return f.offsetX(f.width()/2),f.offsetY(f.height()/2),t.bgLayer.add(f),{node:f,spec:{targetPx:l,...n?{bounds:n}:{},trackingRatio:4/To,ink:c,plateInk:r?.color??re(u,a),plate:y}}}function vh(t,e){return j(e,B(t)?"#ffffff":"#000000",.34)}function Oa(t,e,i,o){let s=Math.max(i,1e-4),n=e.targetPx/s,r=y=>{t.letterSpacing(y*e.trackingRatio),o(t,y)};r(n);let l=e.bounds;if(!l){e.plate.opacity(0),t.fill(e.ink);return}let a={width:l.width-vi*2,height:l.height-vi*2},c=Math.min(1,a.width/Math.max(t.width(),1e-6),a.height/Math.max(t.height(),1e-6));if(c<1&&(n=Math.max(bh/s,n*c),r(n)),t.width()<=a.width&&t.height()<=a.height){e.plate.opacity(0),t.fill(e.ink);return}let h=t.width()+vi*2,u=t.height()+vi;e.plate.size({width:h,height:u}),e.plate.offset({x:h/2,y:u/2}),e.plate.opacity(1),t.fill(e.plateInk)}function Da(t,e){let i=t.catColor.get(e.categoryKey)??"#6e7bff",o=t.canvasBackground,s=us(i,o,Fe),n=t.theme.textColor??"#e6e9f0",r=re(s,n),l=Ve(e.points,e.holes,{fill:i,opacity:Fe,stroke:i,strokeWidth:1.5,cornerRadius:e.cornerRadius});l.setAttr("gaId",e.id),l.on("click tap",u=>{t.isGhostClick(u)||t.opts.onGAClick?.(e.id)}),l.on("mouseenter",()=>{t.container.style.cursor="pointer"}),l.on("mouseleave",()=>{t.container.style.cursor="default"}),t.bgLayer.add(l);let a=_t(e.points,e.holes),c=t.sections.find(u=>te(a,u.outline,u.holes)),d=Lt(t,t.bgLayer,e.displayLabel??e.label,a.x,a.y-8,r,Gt,!1),h=Lt(t,t.bgLayer,`cap ${e.capacity}`,a.x,a.y+10,r,Nt,!1);t.freeTextById.set(`${e.id}:label`,{objectId:e.id,node:d,background:s,kind:"ga-label",categoryKey:e.categoryKey}),t.freeTextById.set(`${e.id}:capacity`,{objectId:e.id,node:h,background:s,kind:"ga-capacity",categoryKey:e.categoryKey}),t.gaById.set(e.id,{label:e.displayLabel??e.label,capacity:e.capacity,categoryKey:e.categoryKey,points:e.points,polygon:l,effectiveBackground:s,strokeColor:i,labelPoint:a,labelNode:d,capacityNode:h,...c?{sectionId:c.logicalId}:{}})}function Lt(t,e,i,o,s,n,r,l){let a=new xo({x:o,y:s,text:i,fontSize:r,fontStyle:l?"700":"500",fontFamily:t.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 wh}from"konva/lib/shapes/Text";var kh=4;function Ga(t){return B(t)?{plate:"#ffffff",stroke:"rgba(15,23,42,0.18)"}:{plate:"#0f1622",stroke:"rgba(226,232,240,0.22)"}}function Lh(t,e,i,o){let s=Math.max(0,Math.min(o,e/2,i/2));t.beginPath(),t.moveTo(s,0),t.arcTo(e,0,e,i,s),t.arcTo(e,i,0,i,s),t.arcTo(0,i,0,0,s),t.arcTo(0,0,e,0,s),t.closePath()}function Na(t,e){t.padding(kh),t.shadowBlur(0),t.shadowOpacity(0),t.sceneFunc(function(o){let s=this.width(),n=this.height();o.save(),Lh(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(),wh.prototype._sceneFunc.call(this,o)})}function Ha(t,e){let i=[],o=e.canvasBackground,s=new Map,n=(c,d)=>{let h=s.get(c)??[];h.push(d),s.set(c,h)};for(let c of e.seats){if(c.kind==="booth")continue;let d=c.logicalRowId??c.rowId;n(d,c),d!==c.rowId&&n(c.rowId,c)}let r=c=>c.logicalSeatIndex??Number(c.id.split(":").pop()??0);for(let c of t.objects){if(c.type!=="row")continue;let d=c.segmentedRow?.repeatLabelOnComponents===!0;if(c.segmentedRow&&!d&&c.segmentedRow.componentIndex!==0)continue;let h=d?c.labelPresentation:c.segmentedRow?.labelPresentation??c.labelPresentation;if(h?.visible===!1||h?.positionPreset==="none")continue;let u=c.segmentedRow&&!d?c.segmentedRow.groupId:c.id,y=(s.get(u)??[]).slice().sort((R,M)=>r(R)-r(M));if(!y.length)continue;let f=y[0],m=y[y.length-1],p=h?.labelStyle,g=h?.style==="pill"?Ga(o):null,b=g?g.plate:o,S=Ie(b,p?.color,e.theme.rowLabelColor??e.theme.textColor??"#e6e9f0",Ue),v=p?.size??hs,k=h?.rotation??0,w=e.objectFilteredOut(c)?.15:1,L=y.reduce((R,M)=>R??e.seatSection.get(M.id),void 0),T=c.segmentedRow?.displayLabel??c.displayLabel??Oi(c.label,L?.label);if(!T)continue;let x=L?[...new Set([L.id,L.logicalId,L.zone].filter(R=>!!R))]:void 0,I=(R,M,_)=>i.push({text:T,x:R,y:M,rotation:k,fontSize:v,ink:S,opacity:w,...g?{pill:g}:{},...x?.length?{focusKeys:x}:{},..._?{automaticAway:_}:{}});if(h?.position){I(h.position.x,h.position.y);continue}let P=e.seatR+12,A=h?.positionPreset??"start";if(A==="start"||A==="both"){let R=c.rotation*Math.PI/180,M={x:-Math.cos(R),y:-Math.sin(R)};I(f.x+M.x*P,f.y+M.y*P,M)}if(A==="end"||A==="both"){let R=(c.rotation+c.curve)*Math.PI/180,M={x:Math.cos(R),y:Math.sin(R)};I(m.x+M.x*P,m.y+M.y*P,M)}}let l=(e.seatR+12)*2.2,a=[];for(let c of i){let d=a.find(h=>h.text===c.text&&Math.hypot(h.x-c.x,h.y-c.y)<=l);if(d){d.x=(d.x+c.x)/2,d.y=(d.y+c.y)/2;continue}a.push(c)}return a}function Io(t,e,i=Q){let o=t.rotation()*Math.PI/180,s=Math.abs(Math.cos(o)),n=Math.abs(Math.sin(o)),r=(t.width()*s+t.height()*n)/2+i,l=(t.width()*n+t.height()*s)/2+i;return{x:e.x-r,y:e.y-l,width:r*2,height:l*2}}function Wa(t,e,i,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 y=l*u;a.push({x:r.x*y,y:r.y*y},{x:-r.x*y,y:-r.y*y},{x:n.x*y,y:n.y*y},{x:(n.x+r.x)*y,y:(n.y+r.y)*y},{x:(n.x-r.x)*y,y:(n.y-r.y)*y})}let c=s,d=1/0,h=1/0;for(let u of a){let y={x:s.x+u.x,y:s.y+u.y},f=Io(t,y),p=(o?Kt(o,f,{mode:"overlap"}).length:0)+i.collisionCount(f),g=Math.hypot(u.x,u.y);if((p<d||p===d&&g<h)&&(c=y,d=p,h=g),p===0)break}return c}function Va(t,e){let i=e,o=i._cache.get("canvas");if(!o)return;let s=[o.scene,o.filter,o.hit].map(n=>n?._canvas).filter(n=>!!n);s.length&&t.Util.releaseCanvas(...s),i._cache.delete("canvas")}function za(t,e){let i=0,o=0,s=n=>{i||(i=n),o+=1;let r=n-i;r>=1e3&&(t(Math.round(o*1e3/r)),o=0,i=n),e(requestAnimationFrame(s))};e(requestAnimationFrame(s))}import{Group as Ch}from"konva/lib/Group";import{Line as Ka}from"konva/lib/shapes/Line";import{Rect as Th}from"konva/lib/shapes/Rect";import{Text as Xa}from"konva/lib/shapes/Text";var Ya=.6;function xh(t,e){return t>=se||e&&t>=Ut}function Ih(t){return t.effectiveScale<Ut?!1:t.focusActive||t.stageWidth<ue}function Ph(t,e,i){return i&&e>=Ut?Math.max(t,Vs/Math.max(e,1e-4)):t}function Mh(t){let{authoredFontSize:e,measuredWidth:i,maxWidth:o,effectiveScale:s}=t;if(!(i>o)||!(i>0))return e;let n=H/Math.max(s,1e-4),r=e*o/i;return Math.max(Math.min(ut,n),r)}function Mo(t,e){let i=(e?1:3)*Math.min(1,t/le);return Math.max(1,t*2-i)}function Ua(t){let e=new Map;for(let s of t){let n=e.get(s.rowId);n?n.push(s):e.set(s.rowId,[s])}let i=[];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)&&i.push(r)}if(!i.length)return 0;i.sort((s,n)=>s-n);let o=Math.floor(i.length/2);return i.length%2?i[o]:(i[o-1]+i[o])/2}function $a(t,e){return e>0?Math.min(t,e/2):t}function Ro(t){let e=Math.max(t*2,1e-4);return Math.max(we,ps/e)}function Ct(t){let e=Mo(t,!1),i=Mo(le,!1),o=e>0?i/e:1;return se*Math.max(1,o)/Wi(1,!1,H)}function qa(t){return Ct(t)*pn}function Po(t,e,i){let o=t.seatLabelContainer(e);i.getParent()!==o&&o.add(i)}function Za(t){let e=t.exportMode?Math.max(t.effScale(),se):t.effScale(),i=Ih({effectiveScale:e,focusActive:t.focusedSectionId!=null,stageWidth:t.stage.width()}),o=t.exportMode?e:Wi(e,t.labelsWereVisible(),H),s=xh(o,i);t.onLabelVisibilityChange(s),t.setSeatLabelRungOpen(s);let n=d=>{let h=d.getClientRect({skipShadow:!0,skipStroke:!0});return h.x>=0&&h.y>=0&&h.x+h.width<=t.stage.width()&&h.y+h.height<=t.stage.height()};for(let[d,h]of t.boothLabelById){let u=t.circleById.get(d);h.visible(ge(h.fontSize(),o)&&!!u?.isVisible()&&t.focusedSeatOpacity(d,u?.getAbsoluteOpacity()??1)>=.5&&n(h))}t.rowLabelGroup.destroyChildren(),t.seatLabelById.clear(),t.seatLabelDrops.clear();let r=new Set,l=new Set,a=0;if(s)for(let d of t.visibleSeatCandidates()){if(d.kind==="booth")continue;let h=t.worldToScreen(d);if(h.x<-20||h.x>t.stage.width()+20||h.y<-20||h.y>t.stage.height()+20||t.accessGlyphById.has(d.id)&&t.accessGlyphShouldShow(d.id))continue;let u=t.circleById.get(d.id);if(!u?.isVisible()){t.seatLabelDrops.set(d.id,"dimmed-or-unavailable");continue}let y=t.statusById.get(d.id)??"free",f=!t.hasSeatMark(d.id)&&(y==="booked"||y==="not_for_sale"||y==="held"&&!t.ownedHold.has(d.id)&&!t.opts.manageMode),m=t.focusedSeatOpacity(d.id,u.getAbsoluteOpacity()),p=f&&!t.focusDims(d.id);if(m<.5&&!p){t.seatLabelDrops.set(d.id,"dimmed-or-unavailable");continue}let g=t.renderedSeatPoint(d),b=t.viewMode==="perspective"?t.perspectiveSeatScale.get(d.id)??1:1;if(f){let C=b*t.statusCueScale(),T=t.statusCueInk(d.id),x=t.statusCuePool.get(d.id);if(x&&x.status===y){let P=x.node;P.position(g),P.scale({x:C,y:C}),P.opacity(m<1?Ya:y==="held"?1:ko);for(let A of P.getChildren())A.stroke(T);if(Po(t,d.id,P),l.add(d.id),++a>=$t)break;continue}x?.node.destroy();let I=new Ch({x:g.x,y:g.y,listening:!1});if(I.scale({x:C,y:C}),m<1&&I.opacity(Ya),y==="held"?(I.add(new Th({x:-4.2,y:-.7,width:8.4,height:6.5,cornerRadius:1.3,stroke:T,strokeWidth:1.25,listening:!1})),I.add(new Ka({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:T,strokeWidth:1.2,lineCap:"round",lineJoin:"round",listening:!1}))):(I.opacity(ko),I.add(new Ka({points:[-4.2,4.2,4.2,-4.2],stroke:T,strokeWidth:1.8,lineCap:"round",listening:!1}))),bi(I),t.statusCuePool.set(d.id,{node:I,status:y}),Po(t,d.id,I),l.add(d.id),++a>=$t)break;continue}let S=Ph(ye*t.seatLabelScale(d),e,i),v=Wt(d.displayLabel??d.label),k=u?t.seatLabelInk(d,u):t.seatPreferredLabelInk(d),w=t.seatLabelPool.get(d.id);w?(w.position(g),w.text(v),w.fontSize(S),w.fontFamily(t.labelFont()),w.fill(k),w.offset({x:0,y:0}),w.scale({x:1,y:1})):(w=new Xa({x:g.x,y:g.y,text:v,fontSize:S,fontStyle:"600",fontFamily:t.labelFont(),fill:k,listening:!1,perfectDrawEnabled:!1}),t.seatLabelPool.set(d.id,w));let L=Mo(t.seatR,i);if(w.fontSize(Mh({authoredFontSize:S,measuredWidth:w.width(),maxWidth:L,effectiveScale:e})),w.width()>L+.01){t.seatLabelDrops.set(d.id,"label-overflows-marker");continue}if(!ge(w.fontSize(),e)){t.seatLabelDrops.set(d.id,"below-minimum-size");continue}if(w.offsetX(w.width()/2),w.offsetY(w.height()/2),w.scale({x:b,y:b}),Po(t,d.id,w),!n(w)){t.seatLabelDrops.set(d.id,"outside-viewport");continue}if(r.add(d.id),t.seatLabelById.set(d.id,w),++a>=$t)break}for(let[d,h]of t.seatLabelPool)r.has(d)||(h.destroy(),t.seatLabelPool.delete(d));for(let[d,h]of t.statusCuePool)l.has(d)||(h.node.destroy(),t.statusCuePool.delete(d));let c=new et;for(let{node:d}of t.freeTextById.values()){if(!d.isVisible())continue;let h=d.getClientRect({relativeTo:t.bgLayer,skipShadow:!0,skipStroke:!0});c.insert({x:h.x-Q,y:h.y-Q,width:h.width+Q*2,height:h.height+Q*2})}for(let d of t.rowLabelPlan){let h=t.focusedSectionId!=null&&d.focusKeys?.includes(t.focusedSectionId),u=h?Math.max(d.fontSize,Ws/Math.max(e,1e-4)):d.fontSize;if(!h&&!ge(u,o))continue;let y=t.worldToScreen({x:d.x,y:d.y});if(y.x<-40||y.x>t.stage.width()+40||y.y<-40||y.y>t.stage.height()+40)continue;let f=new Xa({x:d.x,y:d.y,text:d.text,fontSize:u,fontStyle:"700",fontFamily:t.labelFont(),fill:d.ink,rotation:d.rotation,opacity:d.opacity,shadowColor:"#05070c",shadowBlur:d.ink.toLowerCase()==="#ffffff"?5:0,shadowOpacity:d.ink.toLowerCase()==="#ffffff"?.8:0,shadowForStrokeEnabled:!1,listening:!1,perfectDrawEnabled:!1});d.pill&&Na(f,d.pill),f.offsetX(f.width()/2),f.offsetY(f.height()/2);let m=t.resolveAutomaticRowLabelPosition(f,d,c);f.position(m),f.setAttr("rowLabel",!0),t.rowLabelGroup.add(f);let p=f.getClientRect({skipShadow:!0,skipStroke:!0}),g=6,b=p.x<g?g-p.x:p.x+p.width>t.stage.width()-g?t.stage.width()-g-p.x-p.width:0,S=p.y<g?g-p.y:p.y+p.height>t.stage.height()-g?t.stage.height()-g-p.y-p.height:0,v=m;if(b||S){let w=t.labelGroup.getAbsoluteTransform(),L=w.point(m);v=w.copy().invert().point({x:L.x+b,y:L.y+S}),f.position(v)}let k=t.rowLabelBox(f,v);if(d.automaticAway&&c.collisionCount(k)>0){f.destroy();continue}c.insert(k)}t.isoT>0&&t.viewMode!=="perspective"&&t.applyUprightLabels(),t.overlayLayer.batchDraw()}function Rh(t){return t<0?0:t>1?1:t}function ja(t){let e=t.now??(()=>typeof performance<"u"?performance.now():Date.now()),i=t.budgetMs??8,o=t.reducedMotion===!0,s=t.chunks.length>1?Math.min(30,Math.max(0,840/(t.chunks.length-1))):0,n=0,r=!1,l=!1,a=null,c=[],d=typeof globalThis<"u"?globalThis:{},h=()=>{a&&(a.kind==="idle"?d.cancelIdleCallback?.(a.id):a.kind==="frame"?d.cancelAnimationFrame?.(a.id):clearTimeout(a.id),a=null)},u=p=>{if(!c.length&&typeof d.requestIdleCallback=="function"){a={kind:"idle",id:d.requestIdleCallback(()=>{a=null,p()},{timeout:120})};return}if(typeof d.requestAnimationFrame=="function"){a={kind:"frame",id:d.requestAnimationFrame(()=>{a=null,p()})};return}a={kind:"timer",id:setTimeout(()=>{a=null,p()},16)}},y=()=>{l||r||(l=!0,h(),t.done())},f=p=>{for(let g=c.length-1;g>=0;g--){let b=c[g],S=o?1:Rh((p-b.startedAt)/160);t.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<t.chunks.length&&(n===0||e()-g<i);){let S=t.chunks[n++];if(t.build(S.work),t.fade(S.work,o?1:0),o||c.push({work:S.work,startedAt:p+(n-1)*s}),e()-g>=i)break}let b=f(p);t.draw(),n<t.chunks.length||b?u(m):y()};return u(m),{cancel(){if(!l){r=!0,h();for(let p of c)t.fade(p.work,1);c.length=0}},finishNow(){if(!(r||l)){for(;n<t.chunks.length;){let p=t.chunks[n++];t.build(p.work)}for(let p of t.chunks)t.fade(p.work,1);c.length=0,t.draw(),y()}},get done(){return l}}}function Qa(t){let e=new Map,i=[];for(let s of t.seats){let n=t.sectionIdOf(s.id);if(n==null){i.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=t.sections.find(l=>l.id===s);return r?[{chunk:{id:s,work:{seats:n,group:r.liftGroupSeat}},distance:Math.hypot(r.centroid.x-t.viewportCentre.x,r.centroid.y-t.viewportCentre.y)}]:[]}).sort((s,n)=>s.distance-n.distance).map(s=>s.chunk);return i.length&&t.looseGroup&&o.push({id:"",work:{seats:i,group:t.looseGroup}}),o}function Tt(t){return{th:qt*Math.PI/180*t.isoT,sg:1-(1-ft)*t.isoT}}function Ja(t,e){let{th:i,sg:o}=Tt(e),s=e.centre,n=t.x-s.x,r=t.y-s.y,l=n*Math.cos(i)-r*Math.sin(i),a=(n*Math.sin(i)+r*Math.cos(i))*o;return{x:s.x+l,y:s.y+a}}function el(t,e){let{th:i,sg:o}=Tt(e),s=e.centre,n=t.x-s.x,l=(t.y-s.y)/o,a=n*Math.cos(i)+l*Math.sin(i),c=-n*Math.sin(i)+l*Math.cos(i);return{x:s.x+a,y:s.y+c}}function tl(t,e){let{th:i,sg:o}=Tt(e),s=t*e.isoT;return{x:-(s/o)*Math.sin(i),y:-(s/o)*Math.cos(i)}}function il(t,e,i){let o=Cs(e);t.offset(i),t.position(ae(e,i)),t.rotation(o.rotationDeg),t.scale({x:o.scaleX,y:o.scaleY}),t.skewX(o.skewX),t.skewY(0)}function ol(t){t.position({x:0,y:0}),t.offset({x:0,y:0}),t.scale({x:1,y:1}),t.rotation(0),t.skewX(0),t.skewY(0)}function sl(t,e){let i=Math.hypot(e.x-t.surfaceFocal.x,e.y-t.surfaceFocal.y),o=Math.max(0,i-t.frontDistanceWorld);return t.liftWorld+o*Math.tan(t.rakeDeg*Math.PI/180)}function nl(t,e,i){return t.perspectiveAffine?ae(t.perspectiveAffine,e):ae(i,e)}function rl(t,e){return e?ae(e,t):t}function al(t,e){let i=0;for(let h of t.seats){let u=Math.max(0,(h.eyeHeightM??ee)-ee);i=Math.max(i,u*Xe)}for(let h of t.objects)h.type==="section"&&(i=Math.max(i,Et(h,{floorBaseHeightM:t.floorBaseHeightMFor(h.id)}).height*Xe));let o=ws(t.bounds,i),s=Xt(o,o.target),n=ks(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 h of t.seats){let u=Math.max(0,(h.eyeHeightM??ee)-ee),y=be(o,h,u*Xe),f={x:y.x,y:y.y};e.seatProjected.set(h.id,f),e.seatLocal.set(h.id,ae(n,f)),e.seatDepth.set(h.id,y.depth),e.seatScale.set(h.id,y.scale),r=Math.min(r,y.x),l=Math.min(l,y.y),a=Math.max(a,y.x),c=Math.max(c,y.y)}for(let h of[{x:t.bounds.x,y:t.bounds.y},{x:t.bounds.x+t.bounds.width,y:t.bounds.y},{x:t.bounds.x+t.bounds.width,y:t.bounds.y+t.bounds.height},{x:t.bounds.x,y:t.bounds.y+t.bounds.height}]){let u=be(o,h,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 d=Math.max(24,t.seatR*3);return{camera:o,baseAffine:s,baseInverse:n,bounds:Number.isFinite(r)?{x:r-d,y:l-d,width:Math.max(1,a-r+d*2),height:Math.max(1,c-l+d*2)}:null}}function ll(t,e,i){let o=i?[...i].map(s=>t.seatById.get(s)).filter(s=>!!s):e?t.seats:[...t.perspectiveAppliedSeats].map(s=>t.seatById.get(s)).filter(s=>!!s);for(let s of o){if(e&&t.perspectiveAppliedSeats.has(s.id))continue;let n=e?t.perspectiveSeatProjected.get(s.id)??s:s,r=e?t.perspectiveSeatScale.get(s.id)??1:1,l=t.circleById.get(s.id);l?.position(n),l?.scale({x:r,y:r});let a=t.accessRingById.get(s.id);a?.position(n),a?.scale({x:r,y:r});let c=t.accessGlyphById.get(s.id);if(c){let h=t.seatR*1.5/xe;c.position(n),c.scale({x:h*r,y:h*r})}let d=t.boothLabelById.get(s.id);d?.position(n),d?.scale({x:r,y:r}),e&&t.perspectiveAppliedSeats.add(s.id)}e||t.perspectiveAppliedSeats.clear()}import{Group as cl}from"konva/lib/Group";import{Line as Ah}from"konva/lib/shapes/Line";import{Rect as Eh}from"konva/lib/shapes/Rect";import{Text as dl}from"konva/lib/shapes/Text";function hl(t,e){let i=_t(e.outline,e.holes),o=ie(t.canvasBackground),s=[],n=new Map,r=0,l=W(e.outline),a=t.seatIndex?Kt(t.seatIndex,l).map(M=>t.seatById.get(M)).filter(M=>!!M):t.seats;for(let M of a)t.seatSection.has(M.id)||te(M,e.outline,e.holes)&&(s.push(M.id),n.set(M.categoryKey,(n.get(M.categoryKey)??0)+1),(t.statusById.get(M.id)??"free")==="free"&&r++);let c=e.color??Dt([...n].map(([M,_])=>({hex:t.catColor.get(M)??"#6e7bff",w:_})),"#3a4358"),d=Qo(e.elevation),h=Et(e,{floorBaseHeightM:t.floorBaseHeightMFor(e.id)}),u=h.height*Xe,y=new cl({listening:!1});t.bgLayer.add(y);let f=new cl({listening:!1});y.add(f);let m=new ot({listening:!0});t.seatLayer.add(m);let p=[];if(u>0){let M=me(t.zoneColor.get(e.zone??"")??c,.42);for(let _=0;_<e.outline.length;_++){let $=new Ah({points:[],closed:!0,fill:M,stroke:F("#000000",.25),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});p.push($),y.add($)}}f.moveToTop();let g=f,b=e.color??t.zoneColor.get(e.zone??"")??"#3a4358",S=Ve(e.outline,e.holes,{stroke:F(b,.5),strokeWidth:1,fill:F(b,.08),listening:!1},e.outlinePath);g.add(S);let v=Ve(e.outline,e.holes,{fill:o.sectionFill,stroke:o.sectionStroke,strokeWidth:De,opacity:0,listening:!1},e.outlinePath);g.add(v);let k=e.labelPresentation?.labelStyle,w=k?.color,L=o.sectionInk,C=(k?.size??18)/18,T=new Eh({x:e.labelPresentation?.position?.x??i.x,y:e.labelPresentation?.position?.y??i.y,width:0,height:0,opacity:0,listening:!1,perfectDrawEnabled:!1});g.add(T);let x=new dl({x:e.labelPresentation?.position?.x??i.x,y:e.labelPresentation?.position?.y??i.y,text:e.displayLabel??e.label,rotation:e.labelPresentation?.rotation??0,visible:e.labelPresentation?.visible!==!1,fontSize:18*C,fontStyle:Ge,fontFamily:t.labelFont(),fill:Ie(o.sectionFill,w,L),listening:!1,perfectDrawEnabled:!1});x.offsetX(x.width()/2),x.offsetY(x.height()/2),g.add(x);let I=new dl({x:i.x,y:i.y,text:G("map.seatsLeft",{count:r}),fontSize:12,fontStyle:ln,fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:o.sectionInk,opacity:0,listening:!1,perfectDrawEnabled:!1});I.offsetX(I.width()/2),g.add(I);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:i,labelAnchors:ir(e.outline,e.holes??[],i),memberCategoryKeys:new Set(s.map(M=>t.seatById.get(M)?.categoryKey).filter(Boolean)),shellCategoryColor:t.dominantSellableColor(s),shellFill:o.sectionFill,shellStroke:o.sectionStroke,labelArea:Zo(e.outline,e.holes),zone:e.zone,memberIds:s,total:s.length,free:r,baseFill:c,outlineTint:b,outlinePoly:S,blockPoly:v,namePlate:T,nameLabel:x,subLabel:I,preferredInk:L,...w?{explicitInk:w}:{},labelScale:C,nameLabelFits:!1,subLabelFits:!0,elevation:d,liftWorld:u,rakeDeg:h.rake,surfaceFocal:s.length?{...t.seatById.get(s[0])?.focalPoint??t.isoCentre}:{...t.chartDoc?.focalPoint??t.isoCentre},frontDistanceWorld:0,rootGroupBg:y,bgZIndex:y.zIndex(),seatZIndex:m.zIndex(),liftGroupBg:f,liftGroupSeat:m,sideFaces:p},A=s.map(M=>t.seatById.get(M)).filter(M=>!!M),R=A.length?A:e.outline;return P.frontDistanceWorld=Math.min(...R.map(M=>Math.hypot(M.x-P.surfaceFocal.x,M.y-P.surfaceFocal.y))),P}function ul(t,e,i){if(!e?.length)return;let o=new Set(e),s=t.seats.filter(h=>!o.has(h.categoryKey)||t.seatInClosedSection(h.id)?!1:(t.statusById.get(h.id)??"free")==="free"||t.ownedHold.has(h.id));if(!s.length)return;let n=ho(s.map(h=>h.id),t.seatSection);n&&t.focusSection(n);let r=Math.max(24,t.seatR*3),l=s.map(h=>t.renderedSeatPoint(h)),a=t.clusterLabels.boundsForSeats(s.map((h,u)=>({...h,...l[u]})),r),c=st(l,r);if(a?.singleBlock&&(!t.hasSections||n!=null)){let h=t.clusterLabels.diveTarget(a.bounds,a.anchor);if(h){t.focusRegion(h,{animate:i?.animate,durationMs:t.cameraGlideMs,minScale:Math.min(t.seatLabelTargetScale(),t.zoomBounds().max),maxScale:nt(t)});return}}let d={x:c.x+c.width/2,y:c.y+c.height/2};co({stage:t.stage,box:c,bounds:t.zoomBounds(),viewport:t.framingViewport(),centreScreen:t.worldToScreen(d)})||t.focusRegion(c,{animate:i?.animate,durationMs:t.cameraGlideMs})}function nt(t){let e=ea(Math.max(t.seatR,t.markerR));return Math.max(e,Ct(t.markerR))}function pl(t,e){let i=e===void 0?t.accessFilter:e;if(!i)return!1;let o=fl(t,i);if(!o.length)return!1;t.clearSectionFocus();let s=Math.max(24,t.seatR*3),n=st(o.map(l=>t.renderedSeatPoint(l)),s),r={x:n.x+n.width/2,y:n.y+n.height/2};return co({stage:t.stage,box:n,bounds:t.zoomBounds(),viewport:t.framingViewport(),centreScreen:t.worldToScreen(r)})||t.focusRegion(n,{durationMs:t.cameraGlideMs,maxScale:nt(t)}),!0}function fl(t,e){return t.seats.filter(i=>t.seatInClosedSection(i.id)||Me(i,e)!=="match"?!1:(t.statusById.get(i.id)??"free")==="free"||t.ownedHold.has(i.id))}function ml(t,e,i){let o=i===void 0?t.accessFilter:i;if(!o||!t.sections.some(n=>n.id===e||n.logicalId===e))return!1;let s=t.sectionMembers(e).filter(n=>{if((t.statusById.get(n)??"free")!=="free")return!1;let r=t.seatById.get(n);return r!=null&&Me(r,o)==="match"});return s.length&&Ao(t,s)||t.focusSection(e),!0}function yl(t,e){let i=e===void 0?t.accessFilter:e;if(!i)return null;let o=fl(t,i);if(!o.length)return null;let s=Math.max(24,t.seatR*3),n=st(o.map(a=>t.renderedSeatPoint(a)),s),r=t.getWorldBounds(),l=r.width>0&&r.height>0&&n.width>=r.width*wt&&n.height>=r.height*wt;return{spaces:o.length,sections:_o(t,i),wholeVenue:l}}function Ao(t,e,i){let o=e.map(a=>t.seatById.get(a)).filter(a=>a!=null);if(!o.length)return!1;let s=t.seatPitch>0?t.seatPitch:t.seatR*2,n=st(o.map(a=>t.renderedSeatPoint(a)),Math.max(24,t.seatR*3,s*4)),r=t.getWorldBounds();if(r.width>0&&r.height>0&&n.width>=r.width*wt&&n.height>=r.height*wt)return!1;let l=ho(o.map(a=>a.id),t.seatSection);return l&&t.markSectionFocus(l,{x:n.x+n.width/2,y:n.y+n.height/2}),t.focusRegion(n,{animate:i?.animate,durationMs:t.cameraGlideMs,minScale:Math.min(t.seatLabelTargetScale(),t.zoomBounds().max),maxScale:nt(t)}),!0}function gl(t,e,i=!0,o){let s=t.sectionBounds(e);if(!s)return;let n=t.sectionMembers(e).map(c=>t.seatById.get(c)).filter(c=>c!=null),r=n.filter(c=>(t.statusById.get(c.id)??"free")==="free"||t.ownedHold.has(c.id)),l=(r.length?r:n).map(c=>t.renderedSeatPoint(c)),a=t.narrowSeatDetailFocus(l,s,o);t.focusRegion(a?.bounds??s,{animate:i,minScale:a?.minScale,maxScale:nt(t)})}function Eo(t,e){if(!t.accessFilter)return 0;let i=t.accessFreeBySection.get(e.id);if(i!==void 0)return i;let o=bl(t,e,t.accessFilter);return t.accessFreeBySection.set(e.id,o),o}function bl(t,e,i){return Pr(e.memberIds,i,o=>t.statusById.get(o)??"free",o=>t.seatById.get(o))}function _o(t,e){let i=e===void 0?t.accessFilter:e;if(!i)return[];let o=i===t.accessFilter,s=new Map;for(let n of t.sections){if(t.isSectionClosed(n))continue;let r=o?Eo(t,n):bl(t,n,i);if(r<=0)continue;let l=s.get(n.logicalId);l?l.free+=r:s.set(n.logicalId,{id:n.logicalId,label:n.label,free:r})}return[...s.values()]}function Bo(t){return t?.getAttr?.("seatId")??void 0}var Oo=Object.freeze([]),vl=.85,Dh=.38,Gh=Object.freeze([3,3]),It=class It{constructor(e,i={}){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=ro;this.effSelection=St;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 gi;this.selectionFocusId=null;this.selectionFocusKeep=null;this.hiddenPose=null;this.hoveredId=null;this.focusedId=null;this.accessFilter=null;this.accessFreeBySection=new Map;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=Qr();this.fitScale=1;this.fitPose="";this.viewportInsets={...vo};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 i=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(i){e.preventDefault();let o=this.focusedId?this.nearestSeat(this.focusedId,i):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"],...i},this.exportMode=i.exportMode===!0,this.loadingReveal=i.loadingReveal??"progressive",this.onSeatsRevealed=i.onSeatsRevealed,this.currency=i.currency;let o=wi.pixelRatio;if(this.exportMode&&(this.dpr=1),wi.pixelRatio=this.dpr,this.stage=new Fh({container:e,width:e.clientWidth||1,height:e.clientHeight||1,draggable:!1}),this.gestures=new Si(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 Fo({listening:!this.exportMode}),this.seatLayer=new Fo({listening:!this.exportMode}),this.overlayLayer=new Fo({listening:!1}),this.labelGroup=new xt({listening:!1}),this.overlayLayer.add(this.labelGroup),this.rowLabelGroup=new xt({listening:!1}),this.labelGroup.add(this.rowLabelGroup),this.fgDecorGroup=new xt({listening:!1}),this.overlayLayer.add(this.fgDecorGroup),this.clusterLabels=new fi({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:()=>Ct(this.markerR),pickableScale:()=>Ro(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 Sl({radius:le+2,stroke:"#ffffff",strokeWidth:2,opacity:vl,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.hoverRing),this.focusRing=new Sl({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&&(wi.pixelRatio=o),!this.exportMode){this.wireInteraction();let s=this.opts.onFps;s&&za(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 ai({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,i)=>this.nearestSeatToScreen(e,i)})),this.momentsCache}get breath(){return this.breathCache||(this.breathCache=new li({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 di({overlayLayer:this.overlayLayer,container:this.container,accent:()=>this.effSelection,accentInk:()=>oo(this.effSelection),labelFont:()=>this.labelFont(),stageScale:()=>this.stage.scaleX(),worldToScreen:e=>this.worldToScreen(e),activate:e=>this.activateBeacon(e)})),this.beaconsCache}activateBeacon(e){let i=e.kind==="section"?e.id:this.seatSection.get(e.seatId)?.logicalId??null;if(i){let o=this.sectionTapAnchor(i,this.renderedSeatPoint(this.seatById.get(e.seatId)??{x:0,y:0}));this.opts.onSectionTap?this.opts.onSectionTap(i,o):this.focusSection(i,{anchor:o})}this.focusSeat(e.seatId,{move:!i})}syncBeacons(){if(!this.beaconsCache&&!this.selectionMarkers.size)return;let e=this.beacons;e.sync($n({rung:this.getRung(),sections:this.sections,zones:this.zones,ownedSeatIds:i=>this.ownedSeatIds(i),sectionName:i=>i.nameLabel.text()||i.logicalId,sectionAnchor:i=>this.ownedAnchor(i)})),this.breath.syncBeacons(e.breathingRings())}ownedSeatIds(e){return e.memberIds.filter(i=>this.selection.has(i)||this.ownedHold.has(i))}ownedAnchor(e){let i=this.ownedSeatIds(e).map(n=>this.seatById.get(n)).filter(n=>n!=null).map(n=>this.renderedSeatPoint(n));if(!i.length)return{x:e.nameLabel.x(),y:e.nameLabel.y()};let o=0,s=0;for(let n of i)o+=n.x,s+=n.y;return{x:o/i.length,y:s/i.length}}get owned(){return this.ownedCache||(this.ownedCache=new hi({overlayLayer:this.overlayLayer,sections:()=>this.sections,ownedPoints:e=>this.ownedSeatPoints(e),sectionColor:e=>e.shellCategoryColor,labelAnchor:e=>this.ownedAnchor(e),stageScale:()=>this.stage.scaleX(),labelFont:()=>this.labelFont()})),this.ownedCache}sectionTapAnchor(e,i){return this.owned.anchorFor(e)??i}ownedSeatPoints(e){let i=[];for(let o of e.memberIds){if(!this.selection.has(o)&&!this.ownedHold.has(o))continue;let s=this.seatById.get(o);s&&i.push(this.renderedSeatPoint(s))}return i}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,i){if(e!==this.chartDoc&&(this.stacked=!1,this.floorOverview=!1),this.cancelAssetLoads(),this.cancelSeatReveal(),this.chartDoc=e,this.activeFloorId=i?.floorId??Ft(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 xt({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.accessFreeBySection.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=Ts(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,oi[r%oi.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=vs(this.seats,{seatRadius:this.seatR}),this.seatPitch=Ua(this.seats),this.markerR=$a(this.seatR,this.seatPitch),this.clusterLabels.rebuild(),this.bounds=os(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 xt({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=Qa({seats:this.seats,sections:this.sections,sectionIdOf:i=>this.seatSection.get(i)?.id??null,looseGroup:this.unsectionedSeatGroup,viewportCentre:this.viewportCentreInChartSpace()});this.seatReveal=ja({chunks:e,build:i=>this.renderSeats(i.seats),fade:(i,o)=>i.group.opacity(o),draw:()=>{this.seatLayer.batchDraw()},reducedMotion:this.reducedMotion,done:()=>{this.seatReveal=null,this.seatRevealPending=!1,this.afterViewChange(),this.fitPose&&io(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 i=this.seatReveal;this.seatRevealPending=!1,i&&(this.seatReveal=null,e?i.finishNow():i.cancel(),this.seats.length&&!this.destroyed&&this.updateLabels())}floorView(e){if(!e.floors?.length)return{...e,referenceImage:void 0,backgroundImage:ht(e)};if(this.floorOverview&&e.floors.length>=2)return ss(e,{labelStyle:this.floorLabelStyle});if(this.stacked&&e.floors.length>=2)return{...is(e),referenceImage:void 0,backgroundImage:ht(e)};let i=e.floors.find(o=>o.id===this.activeFloorId)??e.floors[0];return{...e,objects:i.objects,focalPoint:i.focalPoint,referenceImage:void 0,backgroundImage:ht(i),floors:void 0}}floorBaseHeightMFor(e){let i=this.chartDoc?.floors;if(!i?.length)return 0;let o=this.stacked&&e?this.objectFloor.get(e)??this.activeFloorId:this.activeFloorId;return i.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?Ft(this.chartDoc).map(e=>({id:e.id,name:e.name})):[]}getActiveFloorId(){return this.activeFloorId}setStatus(e,i){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===i)continue;this.statusById.set(n,i);let l=this.circleById.get(n);if(l&&(this.paintSeat(l,n),o=!0),s){let a=this.seatSection.get(n);a&&(this.accessFreeBySection.delete(a.id),r==="free"!=(i==="free")&&(a.free+=i==="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 i=!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),i=!0);let c=this.seatSection.get(n);c&&o.add(c)}if(!i)return;let s=new Map((this.chartDoc?Ft(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=Dt([...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 i=new Set((e??[]).filter(s=>this.statusById.has(s))),o=new Set([...this.ownedHold,...i]);this.ownedHold=i;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 i=e&&this.selection.has(e)?e:null;if(i===this.selectionFocusId)return;let o=this.selectionFocusId;this.selectionFocusId=i,this.selectionFocusKeep=Sa({focusedId:i,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&&i!=null&&va(o,i,r=>this.seatSection.get(r)?.logicalId??null)?[o,i]: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),i&&this.syncSelectionMarker(i);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 i=this.seatMarks.merge(e,this.statusById);for(let o of i){let s=this.circleById.get(o);s&&this.paintSeat(s,o)}i.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 i of this.selection){let o=this.seatById.get(i);o&&e.push(o)}return e}clearSelection(){let e=[...this.selection];for(let i of e)this.setSelected(i,!1,!0);this.overlayLayer.batchDraw()}setMaxSelection(e){this.opts.maxSelection=Math.max(0,Math.floor(e))}select(e){let i=[];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&&i.push(s)}return i.length&&this.overlayLayer.batchDraw(),i}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 i=[...this.selection].filter(o=>!this.isSelectable(o));i.length&&this.deselect(i),!e.manageMode&&this.selection.size&&this.clearSelection(),this.clusterLabels.syncCursor(!1),this.overlayLayer.batchDraw()}setSectionHeat(e){this.sectionHeat.clear();for(let[i,o]of Object.entries(e??{}))Number.isFinite(o)&&this.sectionHeat.set(i,Math.max(0,Math.min(1,o)));for(let i of this.sections)this.refreshSectionHeat(i);this.bgLayer.batchDraw()}deselect(e){let i=!1;for(let o of e)this.selection.has(o)&&(this.setSelected(o,!1,!0),i=!0);i&&this.overlayLayer.batchDraw()}selectAllSelectable(){if(!this.opts.manageMode)return[];let e=[];for(let i of this.seats)this.isSelectable(i.id)&&e.push(i.id);return this.selectMany(e)}selectByLabels(e){if(!this.opts.manageMode)return[];let i=new Set(e),o=[];for(let s of this.seats)i.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 i=[],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&&i.push(r)}return i}selectMany(e){let i=e.filter(s=>!this.selection.has(s));if(!i.length)return this.getSelection();let o=this.selection.size+i.length<=zs;for(let s of i)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 i=this.screenToWorld(e),o=this.stage.scaleX()||1,s=new Bh({x:i.x,y:i.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:i,rect:s},this.marqueeCur=i,this.overlayLayer.batchDraw()}updateMarquee(e){if(!this.marquee)return;let i=this.screenToWorld(e),{start:o,rect:s}=this.marquee;s.setAttrs({x:Math.min(o.x,i.x),y:Math.min(o.y,i.y),width:Math.abs(i.x-o.x),height:Math.abs(i.y-o.y)}),this.marqueeCur=i,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 i=this.marqueeCur??e.start;this.marqueeCur=null;let o=Math.min(e.start.x,i.x),s=Math.max(e.start.x,i.x),n=Math.min(e.start.y,i.y),r=Math.max(e.start.y,i.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 d=this.renderedSeatPoint(c);d.x<o||d.x>s||d.y<n||d.y>r||this.isSelectable(c.id)&&a.push(c.id)}this.selectMany(a),this.opts.onMarquee?.(this.getSelection())}flashSeat(e,i="#f43f5e"){let o=this.seatById.get(e);o&&Wr(this.flashHost,e,this.renderedSeatPoint(o),i)}flashSection(e,i="#22a06b"){Vr(this.flashHost,this.sections.filter(o=>o.id===e||o.zone===e),i)}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,i)=>this.projectedSectionPoint(e,i),isoLiftLocal:e=>this.isoLiftLocal(e)}}nearestSeat(e,i){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,d=a.y-s.y,h=c*i.x+d*i.y;if(h<=.5)continue;let u=Math.abs(c*i.y-d*i.x),y=h+u*2.5;y<r&&(r=y,n=l.id)}return n}focusSeat(e,i){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),i?.move!==!1&&this.ensureVisible(o),this.overlayLayer.batchDraw(),this.opts.onFocusSeat?.(o)}ensureVisible(e){let i=this.stage.width(),o=this.stage.height(),s=Math.max(this.stage.scaleX(),Be*1.2),n=this.worldToScreen(e),r=70,l=n.x<r||n.x>i-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:i/2-c.x*s,y:o/2-c.y*s}),this.afterViewChange(),this.stage.batchDraw()}}setViewportInsets(e){this.viewportInsets=Yr(e),this.refitCurrentView()}getViewportInsets(){return{...this.viewportInsets}}framingViewport(){return Ur(this.stage.width(),this.stage.height(),this.viewportInsets)}framingWorldRect(){return Zr(this.framingViewport(),e=>this.screenToWorld(e))}zoomToFit(){let e=this.framingViewport(),i=e.width,o=e.height,s=this.viewMode==="perspective"&&this.perspectiveBounds?this.perspectiveBounds:this.bounds;if(this.fitScale=Math.min(i/s.width,o/s.height)||1,this.opts.portraitFitCrop&&!this.exportMode){let r=i/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+(i-s.width*n)/2-s.x*n,y:e.y+(o-s.height*n)/2-s.y*n}),this.settleView(),!this.exportMode){let r=Qn(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(),Jn(this.stage,[this.bgLayer,this.seatLayer],e)),this.fitPose=io(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 $r(this.stage)}setCameraPose(e){this.cancelGlide(),qr(this.stage,e)&&(this.settleView(),this.stage.batchDraw())}zoomIn(){this.zoomAbout(this.stage.scaleX()*It.ZOOM_STEP,mi(this.framingViewport()))}zoomOut(){this.zoomAbout(this.stage.scaleX()/It.ZOOM_STEP,mi(this.framingViewport()))}zoomOutLevel(){let e=this.focusedSectionId;return e?this.sectionBounds(e)&&this.stage.scaleX()>this.sectionFrameScale(e)*1.05?(this.focusRegion(e,{maxScale:this.diveCeiling()}),"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 i of this.gaById.values())e+=i.capacity;return e}worldToScreen(e){let i=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*i+this.stage.x(),y:l.y*i+this.stage.y()}}let n=s?this.renderedSeatPoint(s):e,r=this.isoT===0?n:this.isoForward(n);return{x:r.x*i+this.stage.x(),y:r.y*i+this.stage.y()}}setAccessibleFilter(e){this.setAccessibilityFilter(e?[]:null)}setAccessibilityFilter(e){let i=e===null?null:[...e];if(!this.sameAccessFilter(i)){this.accessFilter=i,this.accessFreeBySection.clear();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 i=this.accessFilter;return i===null||e===null?i===e:i.length===e.length&&i.every((o,s)=>o===e[s])}setCommercialLimitedFilter(e){if(this.commercialLimitedFilter!==e){this.commercialLimitedFilter=e;for(let i of this.seats){let o=this.circleById.get(i.id);o&&this.paintSeat(o,i.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setCategoryFilter(e){let i=e===null?null:new Set(e);if(!kr(i,this.categoryFilter)){this.categoryFilter=i;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(){ga({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=>ya(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){ba(this.gaById,e)&&this.applyGAFilterState()}setGAState(e,i){this.setGAStates({[e]:i})}get focusFramingContext(){return{stage:this.stage,seats:this.seats,sections:this.sections,hasSections:this.hasSections,seatById:this.seatById,seatSection:this.seatSection,statusById:this.statusById,ownedHold:this.ownedHold,accessFilter:this.accessFilter,accessFreeBySection:this.accessFreeBySection,clusterLabels:this.clusterLabels,seatR:this.seatR,markerR:this.markerR,seatPitch:this.seatPitch,cameraGlideMs:this.cameraGlideMs,seatInClosedSection:e=>this.seatInClosedSection(e),isSectionClosed:e=>this.isSectionClosed(e),renderedSeatPoint:e=>this.renderedSeatPoint(e),sectionMembers:e=>this.sectionMembers(e),sectionBounds:e=>this.sectionBounds(e),seatLabelTargetScale:()=>this.seatLabelTargetScale(),zoomBounds:()=>this.zoomBounds(),framingViewport:()=>this.framingViewport(),worldToScreen:e=>this.worldToScreen(e),getWorldBounds:()=>this.getWorldBounds(),narrowSeatDetailFocus:(e,i,o)=>this.narrowSeatDetailFocus(e,i,o),focusSection:(e,i)=>this.focusSection(e,i),markSectionFocus:(e,i)=>this.markSectionFocus(e,i),clearSectionFocus:()=>this.clearSectionFocus(),focusRegion:(e,i)=>this.focusRegion(e,i)}}focusCategories(e,i){ul(this.focusFramingContext,e,i)}diveCeiling(){return nt(this.focusFramingContext)}focusAccessibleSeats(e){return pl(this.focusFramingContext,e)}focusAccessibleSection(e,i){return ml(this.focusFramingContext,e,i)}accessibleSpread(e){return yl(this.focusFramingContext,e)}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 i=e==="isometric"?1:0,o=this.viewMode==="perspective";if(this.viewMode=e,this.isoTarget=i,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),o){this.isoT=i,this.applyIso(),this.afterViewChange();return}if(this.reducedMotion){this.isoT=i,this.applyIso(),this.afterViewChange();return}let s=this.isoT;if(s===i){this.applyIso(),this.afterViewChange();return}let n=performance.now(),r=l=>{if(this.destroyed)return;let a=Math.min(1,(l-n)/Ks),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 Tt(this.isoState)}effScale(){if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let e=Math.hypot(this.perspectiveBaseAffine.a,this.perspectiveBaseAffine.b),i=Math.hypot(this.perspectiveBaseAffine.c,this.perspectiveBaseAffine.d);return this.stage.scaleX()*Math.min(e,i)}return this.stage.scaleX()*(1-(1-ft)*this.isoT)}isoForward(e){return Ja(e,this.isoState)}isoInverse(e){return el(e,this.isoState)}buildPerspectiveProjection(e){let i=al({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=i.camera,this.perspectiveBaseAffine=i.baseAffine,this.perspectiveBaseInverse=i.baseInverse,this.perspectiveBounds=i.bounds}setContainerAffine(e,i,o){il(e,i,o)}resetContainerTransform(e){ol(e)}sectionSurfaceHeight(e,i){return sl(e,i)}projectedSectionPoint(e,i){return nl(e,i,this.perspectiveBaseAffine)}perspectiveLocalPoint(e){return rl(e,this.perspectiveBaseInverse)}isoLiftLocal(e){return tl(e,this.isoState)}resetLayerTransforms(e=!0){let i=e?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let o of i)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 i of this.sections){this.resetContainerTransform(i.rootGroupBg),this.resetContainerTransform(i.liftGroupBg),e&&this.resetContainerTransform(i.liftGroupSeat),i.rootGroupBg.zIndex(i.bgZIndex),e&&i.liftGroupSeat.zIndex(i.seatZIndex);let o=this.labelLiftGroups.get(i.id);o&&e&&this.resetContainerTransform(o),i.perspectiveAffine=void 0,i.perspectiveCorrection=void 0,i.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,i){ll(this.seatAnchorContext,e,i)}applyPerspective(e=!0){let i=this.perspectiveCamera,o=this.perspectiveBaseAffine,s=this.perspectiveBaseInverse;if(!i||!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,i.target);this.perspectiveAppliedSeats.clear(),n||this.applyExactSeatAnchors(!0);for(let l of this.sections){let a=h=>this.sectionSurfaceHeight(l,h),c=Xt(i,l.centroid,a),d=Ls(s,c);l.perspectiveAffine=c,l.perspectiveCorrection=d,l.perspectiveDepth=be(i,l.centroid,a(l.centroid)).depth,this.setContainerAffine(l.liftGroupBg,d,l.centroid);for(let h=0;h<l.sideFaces.length;h++){let u=l.outline[h],y=l.outline[(h+1)%l.outline.length],f=this.perspectiveLocalPoint(be(i,u,0)),m=this.perspectiveLocalPoint(be(i,y,0)),p=this.perspectiveLocalPoint(be(i,y,a(y))),g=this.perspectiveLocalPoint(be(i,u,a(u)));l.sideFaces[h].points([f.x,f.y,m.x,m.y,p.x,p.y,g.x,g.y]),l.sideFaces[h].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:i,sg:o}=this.isoParams(),s=Math.cos(i),n=o*Math.sin(i),r=-Math.sin(i),l=o*Math.cos(i),a=Math.sqrt(s*s+n*n),c=s*l-n*r,d=Math.atan2(n,s)*180/Math.PI,h=a,u=c/a,y=(s*r+n*l)/c,f=this.isoCentre;for(let m of[this.bgLayer,this.seatLayer,this.overlayLayer])m.position({x:f.x,y:f.y}),m.offset({x:f.x,y:f.y}),m.rotation(d),m.scaleX(h),m.scaleY(u),m.skewX(y),m.skewY(0)}this.applyUprightLabels(),this.applyElevation(),this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyUprightLabels(){let e=qt*this.isoT,i=1/(1-(1-ft)*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(i),r.skewX(0)}}}applyElevation(){let e=this.isoT;for(let i of this.sections){if(i.liftWorld<=0)continue;let o=this.isoLiftLocal(i.liftWorld);i.liftGroupBg?.position(o),i.liftGroupSeat.position(o),this.labelLiftGroups.get(i.id)?.position(o);let s=.9*e;for(let n=0;n<i.sideFaces.length;n++){let r=i.sideFaces[n],l=i.outline[n],a=i.outline[(n+1)%i.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 i=this.focusedSectionId;return i==null||e.id===i||e.logicalId===i||e.zone===i}selectionFocusDims(e){return this.selectionFocusId?!(this.selectionFocusKeep?.has(e)??e===this.selectionFocusId):!1}focusedSeatOpacity(e,i){if(!this.focusedSectionId||!this.focusDimOverlay)return i;let o=this.seatSection.get(e);return i*(o&&this.sectionMatchesFocus(o)?1:ke)}sectionScreenBounds(e){return or({viewMode:this.viewMode,isoT:this.isoT,stageScale:this.stage.scaleX(),stageX:this.stage.x(),stageY:this.stage.y(),projectedSectionPoint:(i,o)=>this.projectedSectionPoint(i,o),isoLiftLocal:i=>this.isoLiftLocal(i),isoForward:i=>this.isoForward(i)},e)}updateSeatGroupVisibility(){let e=this.exportMode||this.effScale()>=ce,i=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"&&!i&&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"&&!i&&(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 i of this.sections)if(!i.liftGroupSeat.isViewportCulled())for(let o of i.memberIds){let s=this.seatById.get(o);s&&e.push(s)}for(let i of this.seats)this.seatSection.has(i.id)||e.push(i);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 i=this.seatSection.get(e.id);if(!i||i.liftWorld<=0||this.isoT===0)return e;let o=this.isoLiftLocal(i.liftWorld);return{x:e.x+o.x,y:e.y+o.y}}seatLabelContainer(e){let i=this.seatSection.get(e);if(!i)return this.labelGroup;let o=this.labelLiftGroups.get(i.id);return o||(o=new ot({listening:!1}),o.setViewportCulled(i.liftGroupSeat.isViewportCulled()),o.position(this.viewMode==="perspective"?{x:0,y:0}:this.isoLiftLocal(i.liftWorld)),this.labelGroup.add(o),this.labelLiftGroups.set(i.id,o)),o}syncSeatOverlayPositions(){if(this.hoveredId){let e=this.seatById.get(this.hoveredId);if(e){this.hoverRing.position(this.renderedSeatPoint(e));let i=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.hoverRing.scale({x:i,y:i})}}if(this.focusedId){let e=this.seatById.get(this.focusedId);if(e){this.focusRing.position(this.renderedSeatPoint(e));let i=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.focusRing.scale({x:i,y:i})}}for(let[e,i]of this.selectionMarkers){let o=this.seatById.get(e);if(o){i.position(this.renderedSeatPoint(o));let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(o.id)??1:1;i.scale({x:s,y:s})}}}renderSeats(e=this.seats){gr({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:i=>this.seatContainer(i),buildAccessGlyph:(i,o)=>this.buildAccessGlyph(i,o),paintSeat:(i,o)=>this.paintSeat(i,o),labelFont:()=>this.labelFont()})}buildAccessGlyph(e,i){let o=this.seatR*1.5/xe,s=new Oh({x:e.x,y:e.y,data:Ht(e.accessibility??[])??"",scaleX:o,scaleY:o,fill:Bi(i),listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});return bi(s),s}updateAccessGlyphs(e){if(this.accessGlyphById.size)for(let[i,o]of this.accessGlyphById){let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(i)??1:1,n=this.seatR*1.5/xe*s,l=this.accessGlyphFilterEmphasized(i)?Gs:Ds,a=Math.max(n,l/(xe*Math.max(e,.001)));o.scale({x:a,y:a}),o.visible(this.accessGlyphShouldShow(i))}}accessGlyphFilterEmphasized(e){let i=this.seatById.get(e),o=this.accessFilter;return!!i&&o!==null&&!!i.accessibility?.includes("wheelchair")&&(o.length===0||o.includes("wheelchair"))&&Le(i,o)}accessGlyphShouldShow(e){return this.accessGlyphById.has(e)&&this.accessGlyphEligible(e)}accessGlyphEligible(e){let i=this.statusById.get(e)??"free";return!(i==="booked"||i==="held"&&!this.ownedHold.has(e)&&!this.opts.manageMode)}categoryPriceLabel(e){let i=this.catPrice.get(e);return typeof i=="number"?gt(i,this.currency):null}categoryDisplayColor(e){return this.colorblind?this.cbHueByKey.get(e)??oi[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,i){let o=i.fill();return Ie(typeof o=="string"?o:"",e.labelStyle?.color,this.theme.seatLabelColor??tt,Ue)}paintSeat(e,i){let o=this.seatById.get(i),s=this.statusById.get(i)??"free",n=this.selection.has(i),r=this.categoryDisplayColor(o.categoryKey),l=this.boothLabelById.get(i);e.dash(Oo),e.strokeWidth(0),e.stroke(""),e.opacity(1),e.scale({x:1,y:1});let a=s==="held"&&this.ownedHold.has(i),c=a?null:ha(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(Te(r,this.effSelection===St?.24:.1)),e.stroke(this.effSelection),e.strokeWidth(3)):e.fill(n&&this.effSelection===St?Te(r,.28):r),this.seatMarks.paint(e,i,s,r,this.seatR,this.colorblind,this.seatInClosedSection(i)),wo(e)&&e.scale({x:1,y:1}),o.wheelchairSpaceType==="no-seat"&&s==="free"&&(e.stroke(At(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??tt:"#ffffff"),l.offsetX(l.width()/2),l.offsetY(l.height()/2));let d=s==="free"||s==="held"&&!this.ownedHold.has(i),h=()=>{let f=e.fill();typeof f=="string"&&e.fill(wa(f,this.canvasBackground))};if(this.accessFilter&&d&&!n){let f=Me(o,this.accessFilter);f==="other"?(h(),e.opacity(Math.min(e.opacity(),lr))):f==="companion"&&e.opacity(Math.min(e.opacity(),cr))}if(this.categoryHighlight&&s==="free"&&!n&&o.categoryKey!==this.categoryHighlight&&e.opacity(.25),this.categoryFilter&&d&&!n&&!this.categoryFilter.has(o.categoryKey)&&(h(),e.opacity(.22)),this.commercialLimitedFilter&&s==="free"&&!n&&(o.commercial?.restrictedView||o.commercial?.obstructedView)&&e.opacity(.22),this.dimmedSections.size){let f=this.seatSection.get(i);(f?this.dimmedSections.has(f.id)||this.dimmedSections.has(f.logicalId)||f.zone!=null&&this.dimmedSections.has(f.zone):this.dimmedSections.has(rs))&&e.opacity(.18)}this.closedSections.size&&this.seatInClosedSection(i)&&(e.fill(mn),e.stroke(""),e.strokeWidth(0),e.dash(Oo),e.opacity(yn),e.scale({x:1,y:1})),this.selectionFocusDims(i)&&e.opacity(Math.min(e.opacity(),.16));let u=this.boothLabelById.get(i)??this.seatLabelById.get(i);u&&(u.fill(this.seatLabelInk(o,e)),u.visible(ge(u.fontSize(),this.effScale())&&e.opacity()>=.5));let y=this.accessGlyphById.get(i);if(y){let f=e.fill();y.fill(Bi(typeof f=="string"?f:"")),y.opacity(e.opacity()),y.visible(this.accessGlyphShouldShow(i))}this.accessRingById.get(i)?.opacity(e.opacity())}seatInClosedSection(e){if(!this.closedSections.size)return!1;let i=this.seatSection.get(e);return!!i&&(this.closedSections.has(i.id)||this.closedSections.has(i.logicalId)||i.zone!=null&&this.closedSections.has(i.zone))}setColorblindSafe(e){if(e!==this.colorblind){this.colorblind=e;for(let i of this.seats){let o=this.circleById.get(i.id);o&&this.paintSeat(o,i.id)}for(let i of this.sections)i.shellCategoryColor=this.dominantSellableColor(i.memberIds),this.refreshSectionFill(i);this.bgLayer.batchDraw(),this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setDimmedSections(e){let i=new Set(e??[]);if(!(i.size===this.dimmedSections.size&&[...i].every(o=>this.dimmedSections.has(o)))){this.dimmedSections=i;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 i=new Set(e??[]);i.size===this.closedSections.size&&[...i].every(o=>this.closedSections.has(o))||(this.closedSections=i,this.repaintSectionsAndSeats())}focusSection(e,i){this.markSectionFocus(e,i?.anchor??null)&&this.focusSectionCamera(e,!0,i?.anchor)}markSectionFocus(e,i){return this.sections.some(o=>o.id===e||o.logicalId===e)?(this.focusedSectionId=e,this.focusAnchor=i,this.focusRoams=!1,this.drawFocusBackdrop(e),this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD(),!0):!1}focusSeats(e,i){return Ao(this.focusFramingContext,e,i)}focusSectionCamera(e,i=!0,o){gl(this.focusFramingContext,e,i,o)}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()>=Ro(this.markerR)}drawFocusBackdrop(e){this.focusBackdrop?.destroy(),this.focusBackdrop=null;let i=this.sections.filter(o=>o.id===e||o.logicalId===e);if(this.focusBackdrop=zr(this.focusBackdropHost,i),!!this.focusBackdrop){this.focusDimOverlay?.destroy(),this.focusDimOverlay=Kr(this.focusBackdropHost,i);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,i)=>this.projectedSectionPoint(e,i),isoLiftLocal:e=>this.isoLiftLocal(e)}}repaintSectionsAndSeats(){for(let e of this.seats){let i=this.circleById.get(e.id);i&&this.paintSeat(i,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}),i=this.screenToWorld({x:this.stage.width(),y:this.stage.height()});return{x:Math.min(e.x,i.x),y:Math.min(e.y,i.y),width:Math.abs(i.x-e.x),height:Math.abs(i.y-e.y)}}getWorldBounds(){let e=1/0,i=1/0,o=-1/0,s=-1/0,n=(r,l)=>{r<e&&(e=r),l<i&&(i=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:i,width:Math.max(1,o-e),height:Math.max(1,s-i)}:{x:0,y:0,width:1,height:1}}getMinimapSnapshot(){let e=this.sections.map(i=>{let o=this.isSectionClosed(i)||i.free<=0,s=i.memberIds.some(l=>this.selection.has(l)),n=s||i.memberIds.some(l=>this.ownedHold.has(l)),r=this.focusedSectionId===i.id||this.focusedSectionId===i.logicalId;return{id:i.logicalId,label:i.label,outline:i.outline.map(l=>({...l})),...this.objectFloor.get(i.id)?{floorId:this.objectFloor.get(i.id)}:{},state:s?"selected":o?"inactive":"available",active:r,paint:{fill:i.shellFill,stroke:i.shellStroke},owned:n}});return{sections:e,seats:e.length?[]:this.seats.map(i=>({x:i.x,y:i.y,categoryKey:i.categoryKey,state:this.selection.has(i.id)?"selected":this.statusById.get(i.id)==="free"?"available":"inactive"}))}}panToWorld(e){this.cancelGlide();let i=this.worldToScreen(e);this.stage.position({x:this.stage.x()+this.stage.width()/2-i.x,y:this.stage.y()+this.stage.height()/2-i.y}),this.afterViewChange(),this.stage.batchDraw()}setCategoryHighlight(e){if(this.categoryHighlight!==e){this.categoryHighlight=e;for(let i of this.seats){let o=this.circleById.get(i.id);o&&this.paintSeat(o,i.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}renderBackground(e){let i=ht(e);i&&this.renderBackgroundImage(i);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,i,o,s){let n=this.assetGeneration;/^https?:\/\//i.test(i)&&(e.crossOrigin="anonymous");let r=new Promise(l=>{let a=!1,c=()=>{a||(a=!0,this.assetCancels.delete(d),l())},d=()=>{e.onload=null,e.onerror=null;try{e.removeAttribute("src"),e.src=""}catch{}c()};this.assetCancels.add(d),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=i});this.assetPromises.push(r)}cancelAssetLoads(){this.assetGeneration++;for(let e of[...this.assetCancels])e();this.assetCancels.clear(),this.assetPromises=[],this.assetErrors=[]}renderBackgroundImage(e){Aa(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,i,o,s)=>this.trackAssetImage(e,i,o,s),isGhostClick:e=>this.isGhostClick(e)}}renderDecorImage(e){Ea(this.objectDrawContext,e)}renderTable(e){_a(this.objectDrawContext,e)}renderText(e){Fa(this.objectDrawContext,e)}renderShape(e){Ba(this.objectDrawContext,e)}renderGA(e){Da(this.objectDrawContext,e)}renderSection(e){let i=hl(this.sectionBuildContext,e);for(let o of i.memberIds)this.seatSection.set(o,i);this.unsectionedSeatIds=null,this.refreshSectionFill(i),this.refreshSectionHeat(i),this.sections.push(i)}get sectionBuildContext(){return{bgLayer:this.bgLayer,seatLayer:this.seatLayer,canvasBackground:this.canvasBackground,seats:this.seats,seatById:this.seatById,seatSection:this.seatSection,seatIndex:this.seatIndex,statusById:this.statusById,catColor:this.catColor,zoneColor:this.zoneColor,chartDoc:this.chartDoc,isoCentre:this.isoCentre,labelFont:()=>this.labelFont(),floorBaseHeightMFor:e=>this.floorBaseHeightMFor(e),dominantSellableColor:e=>this.dominantSellableColor(e)}}refreshSectionHeat(e){Ir(this.sectionLodPaintContext,e)}refreshSectionFill(e){Rr(this.sectionLodPaintContext,e)}isSectionClosed(e){return po(this.sectionLodPaintContext,e)}dominantSellableColor(e){let i=bn(e,o=>this.seatById.get(o)?.categoryKey,o=>this.catByKey.get(o)?.notForSale===!0);return i?this.categoryDisplayColor(i):null}sectionAccessibleFree(e){return Eo(this.focusFramingContext,e)}accessibleSections(e){return _o(this.focusFramingContext,e)}get sectionLodPaintContext(){return{sections:this.sections,zones:this.zones,sectionHeat:this.sectionHeat,closedSections:this.closedSections,canvasBackground:this.canvasBackground,sectionIsOwned:e=>e.memberIds.some(i=>this.selection.has(i)||this.ownedHold.has(i)),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){ar({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 i=this.stage.scaleX(),o={x:(e.x-this.stage.x())/i,y:(e.y-this.stage.y())/i};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 i=this.screenToWorld(e),o=this.sections.find(s=>{if(this.viewMode==="perspective"&&s.perspectiveAffine)return te(i,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 te({x:i.x-n.x,y:i.y-n.y},s.outline,s.holes)});return o?o.logicalId:null}sectionMembers(e){return[...new Set(this.sections.filter(i=>i.id===e||i.logicalId===e||i.zone===e).flatMap(i=>i.memberIds))]}isSelectable(e){return this.seatInClosedSection(e)||!(this.opts.selectableStatuses??["free"]).includes(this.statusById.get(e)??"free")?!1:!this.hiddenByAccessFilter(e)}filterExcludesSeat(e){let i=this.seatById.get(e);return this.hiddenByAccessFilter(e)||i!=null&&Ca({categoryFilter:this.categoryFilter,categoryKey:i.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 i=this.seatById.get(e);return i?Me(i,this.accessFilter)==="other":!1}toggleSeat(e){if(this.ownedHold.has(e)){let i=this.seatById.get(e);i&&this.opts.onDeselect?.(i);return}if(this.selection.has(e)){this.setSelected(e,!1);let i=this.seatById.get(e);i&&this.opts.onDeselect?.(i)}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 i=this.seatById.get(e);i&&this.opts.onSelect?.(i)}this.overlayLayer.batchDraw()}resolveCanvasBackground(){let e=this.theme.background?Fi(this.theme.background):null;if(e)return e;if(typeof getComputedStyle=="function"){let i=this.container;for(;i;){let o=Fi(getComputedStyle(i).backgroundColor);if(o)return o;i=i.parentElement}}return ro}resolveSelectionColor(){return this.theme.selectionColor?this.theme.selectionColor:B(this.canvasBackground)?dr:St}setSelected(e,i,o=!1){let s=this.circleById.get(e);i?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 nr({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:(i,o)=>this.projectedSectionPoint(i,o),isoLiftLocal:i=>this.isoLiftLocal(i),isoForward:i=>this.isoForward(i),renderedSeatPoint:i=>this.renderedSeatPoint(i),labelFont:()=>this.labelFont(),resolveAutomaticRowLabelPosition:(i,o,s)=>this.resolveAutomaticRowLabelPosition(i,o,s),rowLabelBox:(i,o)=>this.rowLabelBox(i,o)},e)}sectionFrameScale(e){let i=this.sectionBounds(e);return i?Math.min(it(this.stage,i,this.zoomBounds(),this.framingViewport()),pi(this.zoomBounds(),this.diveCeiling())):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 Sr(this.screenPickingHost)}nearestSeatToScreen(e,i,o=!1){return br(this.screenPickingHost,e,i,{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>Pe||this.isGhostClick(e))return;let i=Bo(e.target);i&&this.seatsPickable()&&this.handleSeatTap(i)}),this.seatLayer.on("mouseover",e=>{let i=Bo(e.target);if(!i)return;let o=this.seatById.get(i);if(!o)return;this.hoveredId=i;let s=this.hoverAffordance(i);this.hoverRing.position(this.renderedSeatPoint(o));let n=this.viewMode==="perspective"?this.perspectiveSeatScale.get(i)??1:1;this.hoverRing.scale({x:n,y:n}),this.hoverRing.opacity(s==="muted"?Dh:vl),this.hoverRing.dash(s==="muted"?Gh:Oo),this.hoverRing.visible(s!=="none"),this.overlayLayer.batchDraw(),this.clusterLabels.syncCursor(s==="full"),this.opts.onHover?.(o,{mark:this.seatMarks.get(i),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 i=this.container.getBoundingClientRect(),o={x:e.evt.clientX-i.left,y:e.evt.clientY-i.top},s=Math.exp(-e.evt.deltaY*.002);this.zoomAbout(this.stage.scaleX()*z(s,.5,2),o,"frame")}),this.stage.on("click tap",e=>{if(this.moved>Pe||this.isGhostClick(e))return;let i=this.stage.getPointerPosition();if(!i)return;if(!this.cached){if(Bo(e.target)&&this.seatsPickable())return;if(this.seatsPickable()){let s=this.focusedSectionId,n=this.nearestSeatToScreen(i,Oe),r=n?this.seatSection.get(n):null;if(n&&(!s||r&&this.sectionMatchesFocus(r))){this.handleSeatTap(n);return}let l=n?null:this.nearestSeatToScreen(i,Oe,!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 d=this.sectionAt(i);if(d&&d!==s){let h=this.sectionTapAnchor(d,this.screenToWorld(i));this.opts.onSectionTap?this.opts.onSectionTap(d,h):this.focusSection(d,{anchor:h})}else d||this.opts.onBackdropTap();return}if(s)return;let c=this.sections.length?this.sectionAt(i):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(i):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(i),n=this.owned.badgeAt(s)??this.sectionAt(i);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(i)||this.clusterLabels.glideTowardTap(i))return;let o=Math.max(Be*1.2,this.stage.scaleX()*2.5);this.zoomAbout(o,i)})}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,qa(this.markerR))}}zoomAbout(e,i,o="now"){vr(this.stage,e,i,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,i,o){wr(this.stage,e,this.zoomBounds(),i,this.framingViewport(),o),this.settleView(),this.stage.batchDraw()}focusRegion(e,i){let o=typeof e=="string"?this.sectionBounds(e):e;if(!o)return;if(this.cancelGlide(),i?.animate===!1||this.reducedMotion){this.zoomToBounds(o,i?.minScale,i?.maxScale);return}let s=this.framingViewport(),n=s.width,r=s.height,{min:l,max:a}=this.zoomBounds(),c=1.12,d=Math.min(n/(o.width*c),r/(o.height*c)),h=i?.minScale??l,u=z(Math.max(d,h),l,Math.max(h,pi({min:l,max:a},i?.maxScale))),y=s.x+n/2-(o.x+o.width/2)*u,f=s.y+r/2-(o.y+o.height/2)*u,m=this.stage.scaleX(),p=this.stage.x(),g=this.stage.y();if(Math.abs(u-m)<1e-4&&Math.abs(y-p)<.5&&Math.abs(f-g)<.5){this.settleView();return}let b=performance.now(),S=Math.max(180,Math.min(1200,i?.durationMs??this.cameraGlideMs));this.glideInProgress=!0;let v=k=>{if(this.destroyed){this.glideRaf=0,this.glideInProgress=!1;return}let w=Math.min(1,(k-b)/S),L=w<.5?4*w*w*w:1-Math.pow(-2*w+2,3)/2,C=m+(u-m)*L;this.stage.scale({x:C,y:C}),this.stage.position({x:p+(y-p)*L,y:g+(f-g)*L}),this.updateSeatGroupVisibility(),this.updateLOD(),this.scheduleViewChange(),this.stage.batchDraw(),w<1?this.glideRaf=requestAnimationFrame(v):(this.glideRaf=0,this.glideInProgress=!1,this.settleView())};this.glideRaf=requestAnimationFrame(v)}applyLabelVisibility(e){let i=e!==this.labelsVisible;if(this.labelsVisible=e,!i||!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,i)=>this.focusedSeatOpacity(e,i),accessGlyphFilterEmphasized:e=>this.accessGlyphFilterEmphasized(e),seatLabelScale:e=>this.seatLabelScale(e),seatLabelInk:(e,i)=>this.seatLabelInk(e,i),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e)}}getRenderedQualityEvidence(){return this.cancelSeatReveal(!0),Pa(this.renderedQualityContext)}setRung(e){if(e==="zones"){this.cancelGlide(),this.zoomToFit();return}let i=e==="sections"?(Se+ce)/2:this.seatRungScale(),o=this.framingViewport(),s=o.width,n=o.height,r=mi(this.framingWorldRect()),l=r.x,a=r.y;if(e==="sections"&&this.sections.length>0){let u=this.sections.map(p=>{let g=W(p.outline);return{x:g.x+g.width/2,y:g.y+g.height/2}}),y=s/(i*2),f=n/(i*2);if(!u.some(p=>Math.abs(p.x-r.x)<=y&&Math.abs(p.y-r.y)<=f)){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],y=1/0;for(let f of c){let m=f.x-r.x,p=f.y-r.y,g=m*m+p*p;g<y&&(u=f,y=g)}l=u.x,a=u.y}let d=s/(i*1.12),h=n/(i*1.12);this.focusRegion({x:l-d/2,y:a-h/2,width:d,height:h})}seatRungScale(){return Jr(this.seatLabelTargetScale())}narrowSeatDetailFocus(e,i,o){let s=this.framingViewport();return ta({stageWidth:s.width,stageHeight:s.height,fullBounds:i,seatPoints:e,visibleBounds:this.framingWorldRect(),minScale:this.seatRungScale(),tapAnchor:o})}seatLabelTargetScale(){return Xr({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=sr({sections:this.sections.map(i=>({logicalId:i.logicalId,members:i.memberIds.length,bounds:this.sectionScreenBounds(i)})),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,i,o){e.fontSize(Math.max(1,i)),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(),i=Math.max(e,1e-4);for(let[n,r]of this.primaryFocalLabels)Oa(n,r,i,(l,a)=>{this.sizeLabel(l,a,l.y())});this.hasSections?(_r(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=yr(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=z(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(){Va(wi,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,i=typeof document<"u"&&"fonts"in document?document.fonts:null;if(await Promise.all([...this.assetPromises.slice(),...i?[i.ready.then(()=>{}),i.load("700 24px Inter").then(()=>{}),i.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 i=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:i,y:o,width:Math.max(1,s-i),height:Math.max(1,n-o)}}fitExportContent(){if(!this.exportMode)return;let e=this.stage.width(),i=this.stage.height(),o=Math.max(12,Math.min(36,Math.min(e,i)*.025)),s=()=>{let n=this.exportSceneBounds(),r=Math.max(1,e-o*2),l=Math.max(1,i-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:(i-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 i=document.createElement("canvas");i.width=this.stage.width(),i.height=this.stage.height();let o=i.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,i.width,i.height);try{o.drawImage(e,0,0)}finally{e.width=1,e.height=1}return i}updateFreeTextVisibility(){let e=this.exportMode?Math.max(this.effScale(),se):this.effScale();for(let{node:i,backdrop:o,kind:s}of this.freeTextById.values()){if(s==="ga-label"||s==="ga-capacity")continue;let n=s==="free-text"&&this.nodeBelongsToFocusedSection(i),r=s==="direct-landmark";if(r){let a=Number(i.getAttr("directLandmarkBaseFontSize"))||i.fontSize();i.setAttr("directLandmarkBaseFontSize",a),i.fontSize(Math.max(a,H/e))}let l=r||n||ge(i.fontSize(),e);i.visible(l),o?.visible(l)}for(let{node:i,fontSize:o}of this.iconNodeById.values())i.visible(this.nodeBelongsToFocusedSection(i)||ge(o,e))}nodeBelongsToFocusedSection(e){let i=this.focusedSectionId;if(!i)return!1;this.focusMembershipKey!==i&&(this.focusMembership.clear(),this.focusMembershipKey=i);let o=this.focusMembership.get(e);if(o!==void 0)return o;let s=this.sections.filter(r=>r.id===i||r.logicalId===i||r.zone===i),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=>te(l,a.outline,a.holes))}return this.focusMembership.set(e,n),n}buildRowLabelPlan(e){this.rowLabelPlan=Ha(e,{theme:this.theme,canvasBackground:this.canvasBackground,seats:this.seats,seatSection:this.seatSection,seatR:this.seatR,objectFilteredOut:i=>this.objectFilteredOut(i)})}rowLabelBox(e,i,o=Q){return Io(e,i,o)}resolveAutomaticRowLabelPosition(e,i,o){return Wa(e,i,o,this.seatIndex)}objectFilteredOut(e){let i=e.categoryKey;return i?!!(this.categoryHighlight&&i!==this.categoryHighlight||this.categoryFilter&&!this.categoryFilter.has(i)):!1}updateLabels(){Za(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,i)=>this.focusedSeatOpacity(e,i),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=>Ta(this.circleById.get(e)?.fill(),this.canvasBackground,this.filterExcludesSeat(e)),statusCueScale:()=>La(this.markerR),opts:this.opts,seatLabelContainer:e=>this.seatLabelContainer(e),seatLabelScale:e=>this.seatLabelScale(e),labelFont:()=>this.labelFont(),seatLabelInk:(e,i)=>this.seatLabelInk(e,i),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e),seatR:this.seatR,freeTextById:this.freeTextById,bgLayer:this.bgLayer,rowLabelPlan:this.rowLabelPlan,focusedSectionId:this.focusedSectionId,resolveAutomaticRowLabelPosition:(e,i,o)=>this.resolveAutomaticRowLabelPosition(e,i,o),rowLabelBox:(e,i)=>this.rowLabelBox(e,i),isoT:this.isoT,applyUprightLabels:()=>this.applyUprightLabels(),overlayLayer:this.overlayLayer}}handleResize(){this.gestures.invalidateRect();let e=xa({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 i=this.hiddenPose;if(this.hiddenPose=null,e==="unchanged"){i&&this.setCameraPose(i);return}this.stage.size(e),i&&this.setCameraPose(i),this.refitCurrentView()}};It.ZOOM_STEP=1.4;var Do=It;function wl(t,e){return new Do(t,e)}function kl(t,e){t.accessFilter=e===null?null:[...e],t.renderer?.setAccessibilityFilter?.(e);let i=t.renderer?.getFocusedSection?.()??null;i&&t.emitSectionFocus(t.sectionSummary(i))}function Go(t,e){let i=t.renderer;if(!i?.focusAccessibleSeats)return!1;let o=e===void 0?t.accessFilter:e;if(!o)return!1;let s=xl(t,o);s&&t.setFloor(s);let n=i.focusAccessibleSeats(o);return n&&t.emitSectionFocus(null),n}function Ll(t,e){let i=t.renderer;if(!i?.accessibleSpread)return null;let o=e===void 0?t.accessFilter:e;return o?i.accessibleSpread(o):null}function Cl(t,e,i,o){let s=t.renderer;s&&(t.accessFilter&&(i?.accessibleLeft??0)>0&&s.focusAccessibleSection?.(e,t.accessFilter)||(s.focusSection?s.focusSection(e,o?{anchor:o}:void 0):s.focusRegion?.(e)))}function Tl(t,e){let i=e===void 0?t.accessFilter:e;if(!i)return null;let o=xl(t,i);o&&t.setFloor(o);let s=t.renderer,n=s?.accessibleSections?.(i)??[];if(!n.length)return null;let r=t.accessStepAt?n.findIndex(a=>a.id===t.accessStepAt):-1,l=n[(r+1)%n.length];return t.accessStepAt=l.id,s?.focusAccessibleSection?.(l.id,i)||s?.focusSection?.(l.id),t.emitSectionFocus(t.sectionSummary(l.id)),{...l,index:n.indexOf(l),total:n.length}}function xl(t,e){let i=t.doc;if(!i?.floors||i.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=t.getActiveFloorId(),l=i.floors.find(a=>a.id===r);return l&&n(l.objects)?null:i.floors.find(a=>n(a.objects))?.id??null}function Il(t,e){return t.accessFilter?Me(e,t.accessFilter)==="other":!1}function Pl(t,e){let i=t.renderer;if(i){if(i.clearSectionFocus?.(),t.emitSectionFocus(null),e?.length){let o=Nh(t,e);o&&t.setFloor(o)}!e?.length&&t.accessFilter&&Go(t)||e?.length&&(i.focusCategories?i.focusCategories(e):i.zoomToFit())}}function Nh(t,e){let i=t.doc;if(!i?.floors||i.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=t.getActiveFloorId(),r=i.floors.find(l=>l.id===n);return r&&s(r.objects)?null:i.floors.find(l=>s(l.objects))?.id??null}function Ml(t,e,i){let o=new Map,s=new Map,n=new Map,r=new Map,l=[],a=new Map(ts(t).map(h=>[h.id,h])),c=Ot(t),d=new Map(c.sections.map(h=>[h.id,h.label]));for(let h of e){o.set(h.label,h.id),s.set(h.label,h),n.set(h.id,h),l.push(h.id);let u=a.get(h.rowId),y=u&&"label"in u&&typeof u.label=="string"?u.label:void 0,f=u?.type==="row"?u.segmentedRow:void 0,m=f?.displayLabel??(u&&"displayLabel"in u&&typeof u.displayLabel=="string"&&u.displayLabel?u.displayLabel:y),p=i.get(h.rowId),g=u?.type==="table"?"table":u?.type==="booth"?"booth":"seat",b=m,S=f?.displayType?.trim()||(u&&"displayType"in u&&typeof u.displayType=="string"&&u.displayType.trim()?u.displayType.trim():void 0),v=h.displayLabel??h.label,k=v.split("-"),w=p||h.kind==="booth"?void 0:m&&v.startsWith(`${m}-`)?v.slice(m.length+1):k[k.length-1]??v;r.set(h.id,{objectId:h.rowId,objectType:g,sectionLabel:d.get(c.objectToSection.get(h.rowId)??""),rowLabel:b,seatNumber:w,...S?{displayType:S,rowType:S}:{}})}return{labelToId:o,labelToSeat:s,seatById:n,seatContext:r,allIds:l}}function Rl(t,e={}){let{baseMs:i=1e3,factor:o=2,maxMs:s=1/0,jitter:n=0,random:r=Math.random}=e,l=Math.min(i*o**Math.max(0,t),s);if(n<=0)return l;let a=Math.min(1,n);return l*(1-a+a*r())}function Al(t,e,i){return ct(t).map(o=>{let s=t.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:Bt(o).filter(n=>i(n)==="free").length,categoryKey:o.categoryKey,tiers:s?.tiers,price:s?.tiers?.[0]?.price??s?.price??0,currency:e}})}function El(t,e){let i={};for(let o of t)i[o.id]=e?{available:o.available,selected:e.get(o.id)??0}:{available:o.available};return i}function _l(t){let e={};for(let[i,o]of t.seatById)t.groupedTableBySeatId.has(i)||t.closedMembers.has(i)||(t.statusOf(i)??"free")==="free"&&(e[o.categoryKey]=(e[o.categoryKey]??0)+1);for(let i of t.groupedTablesByLabel.values()){if(i.chairs.some(s=>t.closedMembers.has(s.id)))continue;let o=i.chairs[0];o&&(t.statusOf(o.id)??"free")==="free"&&(e[i.categoryKey]=(e[i.categoryKey]??0)+i.maxOccupancy)}for(let i of t.gaAreas??[])e[i.categoryKey]=(e[i.categoryKey]??0)+i.available;return e}function Hh(t){return t.accessibility?.length?t.accessibility:t.accessible?["wheelchair"]:[]}function Fl(t,e){let i=new Set,o=new Map;for(let s of t){let n=Hh(s);if(!n.length)continue;let r=e(s.id)==="free";for(let l of n)i.add(l),r&&o.set(l,(o.get(l)??0)+1)}return i.size?$o.filter(s=>i.has(s.key)).map(s=>({key:s.key,count:o.get(s.key)??0})):[]}var uS=5e3,pS={lost:[],holdLapsed:!1,lapsedLabels:[],recoverable:[]};function Wh(t){if(!t.holdActive||t.holdLabels.length===0)return!1;let e=t.now??Date.now();return t.holdExpiresAt!=null&&e>=t.holdExpiresAt+5e3||t.serverHoldActive===!1?!0:!t.holdLabels.some(i=>t.statusOf(i)==="held")}function Bl(t){let e=new Set(t.holdLabels),i=t.selection.filter(s=>!e.has(s)&&t.statusOf(s)!=="free");if(!Wh(t))return{lost:i,holdLapsed:!1,lapsedLabels:[],recoverable:[]};let o=[...t.holdLabels];return{lost:i,holdLapsed:!0,lapsedLabels:o,recoverable:o.filter(s=>t.statusOf(s)==="free")}}function fS(t){return t.lost.length>0||t.holdLapsed}function mS(t){return!t.lapsedLabels.length||!t.recoverable.length?"none":t.recoverable.length===t.lapsedLabels.length?"all":"partial"}function Ol(t,e,i=Date.now()){return e&&i<t+5e3}function Dl(t){if(typeof document>"u"||typeof document.addEventListener!="function")return()=>{};let e=()=>{document.visibilityState==="visible"&&t()};return document.addEventListener("visibilitychange",e),()=>{typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",e)}}function Gl(t){if(!t?.zones?.length)return[];let e=new Set(Ot(t).sections.filter(i=>i.seatCount>0&&!!i.zone).map(i=>i.zone));return t.zones.filter(i=>e.has(i.id)).map(i=>({id:i.id,label:i.label}))}function Nl(t){let e=t.doc;if(!e?.objects?.length)return null;let i=e.focalPoint??{x:0,y:0},o=Ye(e).filter(r=>!t.groupedObjectIds.has(r.rowId)),s=new Set;for(let r of o)t.heldLabels.has(r.label)||t.tierApplies(r)&&(t.accessFilter&&!Le(r,t.accessFilter)||t.statusOfLabel(r.label)==="free"&&s.add(r.label));let n=_s(o,s,{qty:t.qty,categoryKey:t.categoryKey,zoneId:t.zoneId,focal:i,preferPremium:!0});return n.labels.length!==t.qty?null:n.labels.every(r=>t.isPremium(r))?[...n.labels]:null}var No=["background","rowLabelColor","textColor","selectionColor"];function Hl(t,e){return!t||!e?!t&&!e:No.every(i=>t[i]===e[i])}function Pt(t){let e=t??{};return{status:e.status,conflicts:e.conflicts,reason:e.reason}}function ki(t){return t==="blocked"?"not_for_sale":t==="held"||t==="booked"||t==="free"||t==="not_for_sale"?t:"free"}function Wl(t,e,i){let o=ns(e,i);o==="all"?t.setFloorOverview?.(!0):o&&t.setActiveFloor?.(o)}var Ae=class extends Error{constructor(i){super(i.message);this.status=422;this.name="PickerSelectionError",this.reason=i.code,this.labels=i.labels}};function Vl(t,e){return!e||t.eventConfigurationId===e.id&&t.eventConfigurationVersion===e.version?t:{...t,eventConfigurationId:e.id,eventConfigurationVersion:e.version}}var Li=class{constructor(){this.ref=null;this.pending=null}reset(e){this.ref=e??null,this.pending=null}load(e,i){if(!this.ref||!e.eventConfiguration)return Promise.resolve(null);if(!this.pending){let o=this.ref;this.pending=e.eventConfiguration(i).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 zl(t){if(t!=null&&(!Number.isInteger(t)||t<1))throw new Error("picker: `numberOfPlacesToSelect` must be a positive integer");return t??null}function Kl(t,e,i,o){if(i!=null&&!Array.isArray(i))throw new TypeError("picker: `selectionValidators` must be an array");let s=[],n=0,r=!1,l=!1;for(let c of i??[])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"}),t!=null&&n>t)throw new Error("picker: `minimumSelectedPlaces.minimum` cannot exceed `numberOfPlacesToSelect`");let a=Math.max(0,Math.floor(e??t??Math.max(o,n)));if(t!=null&&a<t)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:t??a}}function Vh(t){let e=Number(t.slice(t.lastIndexOf(":")+1));return Number.isInteger(e)?e:-1}function zh(t){if(t.length<=1)return!1;let e=t[0]?.objectId,i=t[0]?.categoryKey;if(!e||t.some(s=>s.objectId!==e||s.categoryKey!==i))return!0;let o=t.map(s=>Vh(s.id)).sort((s,n)=>s-n);return o.some((s,n)=>s<0||n>0&&s!==o[n-1]+1)}function Xl(t,e,i,o,s){let n=o.find(a=>a.type==="minimumSelectedPlaces")?.minimum??0,r=i??n,l=[];return i!=null&&e!==i&&l.push("numberOfPlacesToSelect"),n&&e<n&&l.push("minimumSelectedPlaces"),o.some(a=>a.type==="consecutiveSeats")&&zh(t)&&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:t,violations:l}}function Yl(t){let{id:e,doc:i,seatById:o,groupedTableBySeatId:s}=t,n=i.objects.find(v=>v.type==="section"&&v.id===e);if(!n)return null;let r=t.sectionMembers(e),l=new Map,a=new Map,c=new Set,d=0,h=0;for(let v of r){let k=o.get(v);if(!k)continue;t.matchesAccessFilter&&t.statusOf(v)==="free"&&t.matchesAccessFilter(k)&&(h+=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),t.statusOf(w.chairs[0]?.id??v)==="free"&&(d+=w.maxOccupancy,a.set(w.categoryKey,(a.get(w.categoryKey)??0)+w.maxOccupancy))}else l.set(k.categoryKey,(l.get(k.categoryKey)??0)+1),t.statusOf(v)==="free"&&(d++,a.set(k.categoryKey,(a.get(k.categoryKey)??0)+1))}let u=[...l.entries()].map(([v,k])=>{let w=i.categories.find(x=>x.key===v),L=w?.tiers?.length?w.tiers.map(x=>x.price):[w?.price??0],C=Math.min(...L),T=Math.max(...L);return{key:v,count:k,label:w?.label??v,color:w?.color??"#6e7bff",price:C,priceMin:C,priceMax:T}}).sort((v,k)=>v.price-k.price),y=u.map(v=>v.priceMin),f=u.map(v=>v.priceMax),m=n.zone?i.zones?.find(v=>v.id===n.zone):void 0,p=v=>{let k=null,w=0;for(let[L,C]of v)(C>w||C===w&&k!=null&&L<k)&&(k=L,w=C);return k},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}:{},...t.matchesAccessFilter?{accessibleLeft:h}:{},label:n.displayLabel??n.label,zoneLabel:m?.label??"",...n.entrance&&n.entrance.trim()?{entrance:n.entrance.trim()}:{},color:S,seatsLeft:d,priceMin:y.length?Math.min(...y):0,priceMax:f.length?Math.max(...f):0,categories:u}}var Ci=class{constructor(e={}){this.inFlight=null;this.lastSettledAt=Number.NEGATIVE_INFINITY;this.windowMs=e.windowMs??250,this.now=e.now??(()=>Date.now())}run(e,i=!1){if(!i){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 Yh=10,Uh=15e3,Ul=class{constructor(e){this.selectableSeatIds=null;this.lastSelectionValidity=null;this.renderer=null;this.gaSelected=null;this._doc=null;this.eventConfiguration=new Li;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.connectFallback=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 Ci;this.accessFilter=null;this.viewportInsets=null;this.accessStepAt=null;this.hintShown=!1;this.lastSnapshotAt=0;this.opts=e,this.api=e.transport,this.key=e.eventKey,this.numberOfPlacesToSelect=zl(e.numberOfPlacesToSelect);let i=Kl(this.numberOfPlacesToSelect,e.maxSelection,e.selectionValidators,Yh);this.selectionValidators=i.validators,this.maxSelection=i.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=as(this._doc,this.hidden);if(!this.mapTheme)return e;let i={...e.theme??{}};for(let o of No){let s=this.mapTheme[o];s&&(i[o]=s)}return{...e,theme:i}}setMapTheme(e){return Hl(this.mapTheme,e??null)?!1:(this.mapTheme=e??null,this.rebuildPreservingState(),!0)}rebuildPreservingState(){let e=this.renderer;if(!e)return!1;let i=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),i.length&&e.select?.(i),n&&e.focusSection?.(n),r&&e.setCameraPose&&e.setCameraPose(r),e.settleView?.(),!0}refreshMapCopy(){this.rebuildPreservingState()&&this.renderer?.forceDraw()}syncHidden(e){let i=e.filter(s=>typeof s=="string");if(i.length===this.hidden.size&&i.every(s=>this.hidden.has(s)))return!1;this.hidden=new Set(i);let o=this.renderer?.isFloorOverview?.()??!1;return this.renderer?.setChart(this.visibleDoc()),o&&this.renderer?.setFloorOverview?.(!0),!0}syncClosed(e){let i=(e??[]).filter(o=>typeof o=="string");return i.length===this.closedSections.size&&i.every(o=>this.closedSections.has(o))?!1:(this.closedSections=new Set(i),this.renderer?.setClosedSections?.(i),!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 i=this.groupedTablesByLabel.get(e);if(i)return i.chairs.map(s=>s.id);let o=this.labelToId.get(e);return o?[o]:[]}idsForLabels(e){return[...new Set([...e].flatMap(i=>this.idsForLabel(i)))]}tableSelection(e){let i=this.groupedTableBySeatId.get(e)??this.groupedTablesByLabel.get(e);return i?this.toTableSeat(i):null}lineItemDisplay(e){if(e.objectType==="ga"){let s=this.visibleDoc(),n=ct(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 i=this.labelToSeat.get(e.label),o=i?this.seatContext.get(i.id):void 0;return{...i?.displayLabel?{displayLabel:i.displayLabel}:{},...o?.displayType?{displayType:o.displayType}:{}}}async render(e){if(this.renderer)return null;let i=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 d=c.res;if(this.closed)return null;this._doc=Vl(d.doc,d.event.eventConfiguration),this.eventConfiguration.reset(d.event.eventConfiguration);let h=performance.now();try{let C=Fs(d.doc,d.event.inventoryModelVersion===2?2:1);this.groupedTablesByObject=new Map(C.map(T=>[T.objectId,T])),this.groupedTablesByLabel=new Map(C.map(T=>[T.label,T])),this.groupedTableBySeatId=new Map(C.flatMap(T=>T.chairs.map(x=>[x.id,T]))),this.tableQuantities=new Map(C.map(T=>[T.label,T.mode==="whole"?T.capacity:T.minOccupancy])),this.confirmedVariableTables=new Set,this.groupedSelectionOverhead=C.reduce((T,x)=>T+Math.max(0,x.chairs.length-1),0)}catch(C){return this.emitError(C),null}this.expandedSeats=Ye(d.doc,{deriveRestrictedView:d.doc.derivedRestrictedView===!0});let u=Ml(d.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 T=C.chairs[0];T&&(this.labelToId.set(C.label,T.id),this.labelToSeat.set(C.label,T))}o.normalizeBuyerModel=s(h);let y=d.event.currency??this.opts.currency;this.currency=y??"USD";let f=performance.now(),m=wl(e,{maxSelection:this.rendererSelectionCap(),confirmSelection:this.opts.confirmSelection,portraitFitCrop:!1,gaPickerMode:!0,currency:y,...this.opts.loadingReveal?{loadingReveal:this.opts.loadingReveal}:{},onSeatsRevealed:()=>{o.seatsComplete=s(i),this.opts.onSeatsRevealed?.()},onSelect:C=>{this.handleRendererSelect(C)},onDeselect:C=>{this.handleRendererDeselect(C)},onSelectionLimit:this.opts.onSelectionLimit,onHover:(C,T)=>{this.opts.onHover?.(C),this.opts.onSeatHover&&this.opts.onSeatHover(C?this.describeSeat(C,T):null)},onFocusSeat:this.opts.onFocusSeat,onViewChange:this.opts.onViewChange,onGAClick:this.opts.onGAClick,onSectionTap:(C,T)=>this.handleSectionTap(C,T),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(f),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(T=>typeof T=="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()),Wl(m,d.doc,e.clientWidth),this.opts.colorblindSafe&&m.setColorblindSafe?.(!0),o.buildScene=s(v),this.closedSections=new Set(b);let k=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(k);let w=performance.now();m.forceDraw(),o.firstPaint=s(w);let L=performance.now();return S.ok&&this.snapshots.markSettled(),this.attachVisibility(),this.connect(),o.startRealtime=s(L),o.controllerTotal=s(i),{doc:d.doc,salesClosed:!!d.event.salesClosed,eventName:d.event.name,venue:d.event.venue,startsAt:d.event.startsAt,timezone:d.event.timezone??null,currency:y,mode:d.event.mode??"live",locale:d.event.locale??null,posterUrl:d.event.posterUrl??null,chartDelivery:d.chartDelivery,performanceProfile:o}}getSelection(){if(!this.renderer)return[];let e=[],i=new Set;for(let o of this.renderer.getSelection()){let s=this.groupedTableBySeatId.get(o.id);s?i.has(s.label)||(i.add(s.label),e.push(this.toTableSeat(s))):e.push(this.toSeat(o))}return e}seatDetails(e){let i=this.seatById.get(e);return i?this.describeSeat(i):null}clearSelection(){this.renderer?.clearSelection(),this.resetUnheldTableQuantities(),this.emitSelectionChange()}deselect(e){let i=new Set;for(let o of e){let s=this.groupedTableBySeatId.get(o)??this.groupedTablesByLabel.get(o);if(s)s.chairs.forEach(n=>i.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&&i.add(n)}}this.renderer?.deselect([...i]),this.emitSelectionChange()}setMaxSelection(e){this.maxSelection=Math.max(0,Math.floor(e)),this.renderer?.setMaxSelection?.(this.rendererSelectionCap())}select(e){let i=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 Ae(Gi(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=>!i.has(r.label));return n.length&&this.emitSelectionChange(),n}selectCategories(e){let i=new Set(e);return this.select([...this.seatById.values()].filter(o=>i.has(o.categoryKey)).map(o=>o.id))}deselectCategories(e){let i=new Set(e);this.deselect(this.getSelection().filter(o=>i.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 i=this.renderer?.getSelection().filter(o=>!this.isSelectableByPolicy(o.id)).map(o=>o.id)??[];i.length&&this.deselect(i)}getSelectionValidity(e){if(this.numberOfPlacesToSelect==null&&!this.selectionValidators.length)return null;let i=this.getSelection(),o=e??i.reduce((s,n)=>s+(n.quantity??1),0);return Xl(i,o,this.numberOfPlacesToSelect,this.selectionValidators,()=>this.hasOrphanedSelection())}hasOrphanedSelection(){let e=this.renderer;if(!e)return!1;let i=new Set(e.getSelection().map(o=>o.id));return i.size>0&&Di(this.seatById.values(),o=>e.getStatus(o),i).length>0}rebuildSelectableSeatIds(){if(this.selectableObjectRefs==null){this.selectableSeatIds=null;return}let e=new Set;for(let i of this.selectableObjectRefs){let o=this.groupedTableBySeatId.get(i)??this.groupedTablesByLabel.get(i);if(o){o.chairs.forEach(n=>e.add(n.id));continue}let s=this.seatById.has(i)?i:this.labelToId.get(i);s&&e.add(s)}this.selectableSeatIds=e}isSelectableByPolicy(e){return this.selectableSeatIds==null||this.selectableSeatIds.has(e)}setTableQuantity(e,i){let o=this.groupedTablesByLabel.get(e);if(!o)return!1;let s=o.mode==="whole"?o.capacity:Math.floor(i);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,i,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(i);if(!Number.isInteger(r)||r<s.minOccupancy||r>s.maxOccupancy)return null;if((n.items??[]).filter(d=>d.label!==e).reduce((d,h)=>d+(h.quantity??1),0)+r>this.maxSelection)return this.opts.onSelectionLimit?.(this.maxSelection),null;let a=(n.items??[]).map(d=>({label:d.label,tierId:d.tierId,quantity:d.label===e?r:d.quantity}));if(!a.some(d=>d.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(d=>d.label),expiresAt:c.expiresAt,items:c.items}),this.hold_}rendererSelectionCap(){return this.maxSelection+this.groupedSelectionOverhead}selectionGuestCount(){return this.getSelection().reduce((e,i)=>e+(i.quantity??1),0)}handleRendererSelect(e){let i=this.groupedTableBySeatId.get(e.id);if(!this.isSelectableByPolicy(e.id)){this.renderer?.deselect(i?i.chairs.map(s=>s.id):[e.id]),this.emitSelectionChange();return}if((i?this.tableTierResolution(i):this.seatTierResolution(e)).kind==="invalid"){this.renderer?.deselect(i?i.chairs.map(s=>s.id):[e.id]),this.emitError(new Ae(Gi([i?.label??e.label]))),this.emitSelectionChange();return}if(i){if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect(i.chairs.map(s=>s.id)),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.renderer?.select?.(i.chairs.map(s=>s.id)),this.opts.onSelect?.(i.chairs[0]??e),this.opts.onTableSelectionRequest?.(this.toTableSeat(i)),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 i=this.groupedTableBySeatId.get(e.id),o=i?.label??e.label;if(this.hold_?.labels.includes(o)){this.opts.onDeselect?.(i?{...e,label:o}:e);return}i?(this.renderer?.deselect(i.chairs.map(s=>s.id)),this.hold_?.labels.includes(i.label)||(this.tableQuantities.set(i.label,i.mode==="whole"?i.capacity:i.minOccupancy),i.mode==="variable"&&this.confirmedVariableTables.delete(i.label)),this.opts.onDeselect?.(i.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 i of e){let o=this.groupedTablesByLabel.get(i);o&&(this.tableQuantities.set(i,o.mode==="whole"?o.capacity:o.minOccupancy),o.mode==="variable"&&this.confirmedVariableTables.delete(i))}}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,i){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 Ae(l);if(this.hold_&&this.holdCovers(r))return this.hold_;try{let a=r.map(d=>{let h=n.find(f=>f.label===d);if(h)return{label:d,tierId:h.tierId,quantity:h.quantity};let u=this.labelToSeat.get(d),y=u?this.toSeat(u):null;return{label:d,...y?.tierId?{tierId:y.tierId}:{},...this.tableQuantityRequest(y)}}),c=await this.api.hold(this.key,a,i,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 i=await this.api.resume(this.key,e);if(this.closed)return null;let o=[...new Set(i.items.map(s=>s.label))];return o.length?(this.setHold({holdId:i.holdId,labels:o,expiresAt:i.expiresAt,items:i.items},"restored"),this.hold_):null}async extendHold(e){let i=this.hold_;if(!i||!this.api.extend)return null;try{let o=await this.api.extend(this.key,i.holdId,e);return this.hold_?.holdId!==i.holdId?this.hold_:(this.setHold({holdId:i.holdId,labels:i.labels,expiresAt:o.expiresAt,items:i.items}),this.hold_)}catch{return null}}categoryAvailability(){return _l({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,i=this.renderer;if(!i||!this.closedSections.size)return e;for(let o of this.closedSections)for(let s of i.sectionMembers?.(o)??[])e.add(s);return e}getGAAreas(){let e=this.visibleDoc();return e?Al(e,this.currency,i=>this.statusOf(i)):[]}setGASelection(e){this.gaSelected=e?new Map(e):null,this.pushGAState()}pushGAState(){this.renderer?.setGAStates?.(El(this.getGAAreas(),this.gaSelected))}async holdGA(e,i,o={}){let s=this.visibleDoc();if(!s||!Number.isFinite(i)||i<1)return null;let n=ct(s).find(d=>d.id===e);if(!n)return null;let r=Bt(n).filter(d=>!this.hold_?.labels.includes(d)&&this.statusOf(d)==="free").slice(0,Math.floor(i));if(r.length!==Math.floor(i))return null;let l=new Map;for(let d of this.hold_?.items??[])l.set(d.label,{label:d.label,tierId:d.tierId,quantity:d.quantity});if(this.hold_&&!this.hold_?.items?.length)for(let d of this.hold_.seats)l.set(d.label,{label:d.label,...d.tierId?{tierId:d.tierId}:{}});for(let d of this.getSelection())l.set(d.label,{label:d.label,...d.tierId?{tierId:d.tierId}:{},...this.tableQuantityRequest(d)});for(let d of r)l.set(d,{label:d,...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(d=>d.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 Gl(this.visibleDoc())}pickPremiumBlock(e,i,o){return Nl({doc:this.visibleDoc(),qty:e,categoryKey:i,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,i,o={}){let s=this.renderer;if(!s)return null;if(o.preferPremium){let n=this.pickPremiumBlock(e,i,o.zoneId);if(n){if(this.hold_&&!await this.release())return null;try{let r=n.map(d=>{let h=this.labelToSeat.get(d),u=h?this.toSeat(h):null;return{label:d,...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(d=>this.labelToSeat.get(d)).filter(d=>!!d).map(d=>this.toSeat(d));return this.opts.onSelectionChange?.(c),this.hold_}catch(r){let{status:l,reason:a}=Pt(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,i,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}=Pt(n);throw r===409&&l==="event_closed"&&this.opts.onSalesClosed?.(),n}}async book(e,i,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=i??this.getSelection().map(c=>c.label);if(!n.length)return null;let r=this.ticketIssue(n);if(r)throw new Ae(r);let l;try{if(this.hold_&&this.holdCovers(n))l=this.hold_.holdId;else{let c=this.hold_?.holdId,d=await this.api.hold(this.key,n.map(h=>{let u=this.labelToSeat.get(h),y=u?this.toSeat(u):null;return{label:h,...y?.tierId?{tierId:y.tierId}:{},...this.tableQuantityRequest(y)}}),o,c);l=d.holdId,this.setHold({holdId:l,labels:[...n],expiresAt:d.expiresAt,items:d.items})}await this.api.book(this.key,n,l,e)}catch(c){let{status:d,conflicts:h,reason:u}=Pt(c);if(this.clearHold(),d===409&&u==="event_closed")this.opts.onSalesClosed?.();else if(d===409&&h?.length){let y=new Set(h.map(p=>p.label)),f=this.idsForLabels(y);f.length&&(s.setStatus(f,"booked"),s.deselect(f),this.resetTableQuantitiesForLabels(y));let m=n.filter(p=>!y.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 i=this.idsForLabels(e.labels);return i.length&&(this.renderer?.deselect(i),this.renderer?.setStatus(i,"free")),!0}async releaseLabels(e){let i=this.hold_;if(!i)return!0;let o=e.filter(l=>i.labels.includes(l));if(!o.length)return!0;try{let l=await this.api.release(this.key,o,i.holdId);if(!this.releaseConfirmed(l,o))return await this.resnapshot(),!1}catch(l){return this.emitError(l),!1}if(this.hold_?.holdId!==i.holdId)return!0;let s=i.labels.filter(l=>!o.includes(l)),n=i.items?.filter(l=>!o.includes(l.label));s.length?this.setHold({...i,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,i){let o=e?.released;return!Array.isArray(o)||i.every(s=>o.includes(s))}setStatus(e,i){this.renderer?.setStatus(e,i)}getStatus(e){return this.renderer?.getStatus(e)}notForSaleCategorySeatIds(){let e=this.doc;if(!e)return[];let i=new Set(e.categories.filter(s=>s.notForSale).map(s=>s.key));if(!i.size)return[];let o=[];for(let[s,n]of this.seatById)i.has(n.categoryKey)&&o.push(s);return o}flashSeat(e,i){this.renderer?.flashSeat(e,i)}zoomIn(){this.renderer?.zoomIn()}zoomOut(){let e=this.renderer;if(!e?.zoomOutLevel)return void e?.zoomOut();let i=!!e.getFocusedSection?.();e.zoomOutLevel()==="venue"&&i&&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){kl(this.pickerFocusContext,e)}getAccessibilityFilter(){return this.accessFilter?[...this.accessFilter]:null}get pickerFocusContext(){let e=this;return{renderer:e.renderer,doc:e._doc,get accessFilter(){return e.accessFilter},set accessFilter(i){e.accessFilter=i},get accessStepAt(){return e.accessStepAt},set accessStepAt(i){e.accessStepAt=i},getActiveFloorId:()=>e.getActiveFloorId(),setFloor:i=>e.setFloor(i),sectionSummary:i=>e.sectionSummary(i),emitSectionFocus:i=>{e.opts.onSectionFocus?.(i)}}}focusAccessibilityFilter(e){return Go(this.pickerFocusContext,e)}accessibilitySpread(e){return Ll(this.pickerFocusContext,e)}focusNextAccessibleSection(e){return Tl(this.pickerFocusContext,e)}accessibilityFilterDims(e){return Il(this.pickerFocusContext,e)}setCommercialLimitedFilter(e){this.renderer?.setCommercialLimitedFilter?.(e)}getFloors(){return this.renderer?.getFloors?.()??[]}getActiveFloorId(){return this.renderer?.getActiveFloorId?.()??""}setFloor(e){let i=this.renderer;!i?.setActiveFloor||e===i.getActiveFloorId?.()&&!i.isFloorOverview?.()||(i.setFloorOverview?.(!1),i.setStacked?.(!1),i.setActiveFloor(e),this.resnapshot(),this.emitSelectionChange())}setStacked(e){let i=this.renderer;!i?.setStacked||e===i.isStacked?.()||(i.setStacked(e),this.resnapshot())}isMultiFloor(){return(this._doc?.floors?.length??0)>1}setFloorOverview(e){let i=this.renderer;!i?.setFloorOverview||e===i.isFloorOverview?.()||(i.setFloorOverview(e),this.resnapshot(),this.emitSelectionChange())}isFloorOverview(){return this.renderer?.isFloorOverview?.()??!1}handleDeckTap(e){let i=this.renderer;i&&(i.setViewMode?.("flat"),i.setFloorOverview?.(!1),i.setStacked?.(!1),i.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){Pl(this.pickerFocusContext,e)}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,i){this.handleSectionTap(e,i)}focusSeats(e,i){let o=this.renderer;if(!o?.focusSeats?.(e,i))return!1;let s=o.getFocusedSection?.()??null;return this.opts.onSectionFocus?.(s?this.sectionSummary(s):null),!0}getSectionSeatCount(e){return this.renderer?.sectionMembers?.(e)?.length??0}overview(){this.renderer?.clearSectionFocus?.(),this.renderer?.zoomToFit(),this.opts.onSectionFocus?.(null)}handleSectionTap(e,i){if(!this.renderer)return;let o=this.isSectionClosed(e)?null:this.sectionSummary(e);Cl(this.pickerFocusContext,e,o,i),this.opts.onSectionFocus?.(o)}sectionSummary(e){return!this.renderer||!this._doc?null:Yl({id:e,doc:this._doc,sectionMembers:i=>this.renderer?.sectionMembers?.(i)??[],statusOf:i=>this.renderer?.getStatus(i)??"free",seatById:this.seatById,groupedTableBySeatId:this.groupedTableBySeatId,...this.accessFilter?{matchesAccessFilter:i=>Le(i,this.accessFilter)}:{}})}clearConnectFallback(){this.connectFallback&&(clearTimeout(this.connectFallback),this.connectFallback=null)}destroy(){if(this.closed=!0,this.clearConnectFallback(),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 i=this.groupedTableBySeatId.get(e.id);if(i)return this.toTableSeat(i);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 d=c.tier;return{id:e.id,label:e.label,...s,...l,categoryKey:e.categoryKey,price:d.price,currency:this.currency,tiers:a,tierId:d.id,...o,...n,...r}}toTableSeat(e){let i=e.chairs[0],o=this.tiersFor(e.categoryKey)?.filter(r=>Yt(this._doc,this.tableTierSeat(e),r.id).kind==="resolved"),s=this.tableTierResolution(e),n=s.kind==="resolved"?s.tier:void 0;return{id:i?.id??e.objectId,label:e.label,displayLabel:e.displayLabel??e.label,...e.displayType?{displayType:e.displayType,rowType:e.displayType}:{},objectId:e.objectId,sectionLabel:i?this.seatContext.get(i.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,i){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,...i?.interaction?{interaction:i.interaction}:{},...i?.unavailable?{unavailable:!0}:{},...i?.filteredOut?{filteredOut:!0}:{},currency:this.currency,...this.seatContext.get(e.id)}}priceFor(e){return this._doc?.categories.find(i=>i.key===e)?.price??0}tiersFor(e){let i=this._doc?.categories.find(o=>o.key===e)?.tiers;return i&&i.length?i:void 0}tiersForSeat(e){if(!this._doc)return;let i=As(this._doc,e);return i.length?i:void 0}seatTierResolution(e){return this._doc?Yt(this._doc,e,this.seatTiers.get(e.id)):{kind:"none"}}tableTierSeat(e){return{label:e.label,categoryKey:e.categoryKey,accessibility:e.chairs.flatMap(i=>i.accessibility??[])}}tableTierResolution(e){if(!this._doc)return{kind:"none"};let i=e.chairs[0]?.id??"";return Yt(this._doc,this.tableTierSeat(e),this.seatTiers.get(i))}setSeatTier(e,i){let o=this.seatById.get(e);if(!o)return;let s=this.tiersForSeat(o);if(s){if(i==null)this.seatTiers.delete(e);else if(s.some(n=>n.id===i))this.seatTiers.set(e,i);else return;this.emitSelectionChange(),this.hold_&&(this.hold_={...this.hold_,seats:this.seatsForLabels(this.hold_.labels)})}}seatsForLabels(e){let i=[];for(let o of e){let s=this.labelToSeat.get(o);s&&i.push(this.toSeat(s))}return i}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 i=e?this.seatsForLabels(e):this.getSelection();return Es(this._doc,i.map(o=>({label:o.label,...o.tierId?{tierId:o.tierId}:{}})))}emitOrphanHint(){if(!this.opts.onHint)return;let e=this.renderer;if(!e)return;let i=this.ticketIssue();if(i){this.hintShown=!0,this.opts.onHint(i.code==="companion_pair_required"?G("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?Di(this.seatById.values(),r=>e.getStatus(r),s):[]).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 i=this.hold_;if(!i||i.labels.length!==e.length||!e.every(n=>i.labels.includes(n)))return!1;let o=new Map((i.items??[]).map(n=>[n.label,n.tierId])),s=new Map((i.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:i,conflicts:o}=Pt(e);if(i!==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,i="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),i==="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 i=await this.api.objects(this.key);if(this.hold_?.holdId!==e.holdId)return;this.applySeatsMap(i.seats,i.default??"free")}catch{this.hold_?.holdId===e.holdId&&(this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},2e3));return}if(this.hold_?.holdId===e.holdId){if(Ol(e.expiresAt,e.labels.some(i=>this.statusOf(i)==="held"))){this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},1e3);return}this.clearHold(),this.opts.onHoldExpired?.()}}}applySeatsMap(e,i="free"){let o=this.renderer;if(!o)return;let s=this.seatsMapDiffers(e,i);this.lastSnapshotAt=Date.now(),this.liveStatuses=new Map(Object.entries(e)),this.liveDefault=i;let n=ki(i);this.allIds.length&&o.setStatus(this.allIds,n),o.setOwnedHold?.(this.idsForLabels(this.hold_?.labels??[]));let r={free:[],held:[],booked:[],not_for_sale:[]};for(let[a,c]of Object.entries(e))r[ki(c)].push(...this.idsForLabel(a));["free","held","booked","not_for_sale"].forEach(a=>{a!==n&&r[a].length&&o.setStatus(r[a],a)});let l=this.notForSaleCategorySeatIds();l.length&&o.setStatus(l,"not_for_sale"),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.({changed:s})}snapshotIsFresh(e=5e3){return this.lastSnapshotAt>0&&Date.now()-this.lastSnapshotAt<e}statusOf(e){return this.liveStatuses.get(e)??this.liveDefault}clearBookedHoldIfSettled(){let e=this.hold_;e?.labels.every(i=>this.statusOf(i)==="booked")&&(this.clearHold(),this.resetTableQuantitiesForLabels(e.labels))}resnapshot(e=!1){return this.snapshots.run(async()=>{let i=await this.api.objects(this.key);this.applySeatsMap(i.seats,i.default??"free")},e)}refresh(){return this.resnapshot(!0)}async refreshAvailability(){await this.resnapshot();let e=this.hold_,i=Bl({selection:this.getSelection().map(o=>o.label),holdLabels:e?.labels??[],holdActive:!!e,holdExpiresAt:e?.expiresAt??null,statusOf:o=>this.statusOf(o)});if(i.lost.length&&this.deselect(i.lost),i.holdLapsed){this.clearHold(),this.resetTableQuantitiesForLabels(i.lapsedLabels);let o=this.idsForLabels(i.lapsedLabels);o.length&&this.renderer?.deselect(o),this.opts.onHoldExpired?.()}return this.opts.onAvailabilityRefresh?.(i),i}getAccessNeeds(){return Fl(this.seatById.values(),e=>this.getStatus(e)??"free")}attachVisibility(){this.detachVisibility||(this.detachVisibility=Dl(()=>{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:e=>e?.reason==="connect"&&this.snapshotIsFresh()?Promise.resolve():this.resnapshot(),onSections:(e,i)=>{let o=this.syncHidden(e),s=this.syncClosed(i);o&&this.resnapshot(),(o||s)&&this.opts.onStatusChange?.({changed:!0})}}}seatsMapDiffers(e,i){if(this.lastSnapshotAt===0||i!==this.liveDefault)return!0;let o=Object.entries(e);if(o.length!==this.liveStatuses.size)return!0;for(let[s,n]of o)if(this.liveStatuses.get(s)!==n)return!0;return!1}applyStatusChanges(e){let i=this.renderer;if(!i)return;let o=e.some(s=>this.liveStatuses.get(s.label)!==s.status);for(let s of e){this.liveStatuses.set(s.label,s.status);let n=this.idsForLabel(s.label);if(!n.length)continue;let r=ki(s.status);this.opts.flashOnLiveChange&&r!=="free"&&n.some(l=>i.getStatus(l)==="free")&&!this.hold_?.labels.includes(s.label)&&n.forEach(l=>i.flashSeat(l,r==="held"?"#f4b740":"#f43f5e")),i.setStatus(n,r)}this.opts.keepLiveWhileHidden&&typeof document<"u"&&document.visibilityState==="hidden"&&i.forceDraw(),this.pushGAState(),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.({changed:o})}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 i;try{let o=this.api.socketProtocols?.(this.key);i=o&&o.length?new WebSocket(e,o):new WebSocket(e)}catch{this.scheduleReconnect();return}this.ws=i,i.onopen=()=>{if(this.attempt=0,!this.snapshotIsFresh()){this.resnapshot();return}this.clearConnectFallback(),this.connectFallback=setTimeout(()=>{this.connectFallback=null,this.resnapshot()},2500)},i.onmessage=o=>{this.clearConnectFallback();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?.({changed:!0})),Array.isArray(r.closed)&&this.syncClosed(r.closed)&&this.opts.onStatusChange?.({changed:!0}),r.type!=="hidden"&&(r.seats&&typeof r.seats=="object"?this.applySeatsMap(r.seats):Array.isArray(r.changes)&&this.applyStatusChanges(r.changes))},i.onclose=()=>{this.ws===i&&(this.ws=null),this.scheduleReconnect()},i.onerror=()=>{try{i.close()}catch{}}}scheduleReconnect(){if(this.closed||this.reconnectTimer)return;let e=Math.min(this.attempt++,5),i=Rl(e,{baseMs:1e3,maxMs:Uh,jitter:1});this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},i)}};var $h=5,qh=-1.1,Ho=35;function Wo(t,e){let i=t-ee,o=Math.atan2($h-i,e)*180/Math.PI,s=Math.atan2(qh-i,e)*180/Math.PI;return s<-Ho&&(o+=-Ho-s,s=-Ho),{topPitch:o,basePitch:s}}var q=2048,pe=1024,Rt=jo,E=Math.PI*2,Zh=pe/180,at=t=>(t+180)/360*q,K=t=>(90-t)/180*pe;function Ql(t){let e=2166136261;for(let i=0;i<t.length;i++)e^=t.charCodeAt(i),e=Math.imul(e,16777619);return e>>>0}function Jl(t){let e=t>>>0;return()=>{e|=0,e=e+1831565813|0;let i=Math.imul(e^e>>>15,1|e);return i=i+Math.imul(i^i>>>7,61|i)^i,((i^i>>>14)>>>0)/4294967296}}var Ti=96,Ko=360/Ti,jh=.6,Vo=[17,23,42];function zo(t,e,i=1){let o=Math.max(0,Math.min(.58,e)),s=Math.round(t[0]+(Vo[0]-t[0])*o),n=Math.round(t[1]+(Vo[1]-t[1])*o),r=Math.round(t[2]+(Vo[2]-t[2])*o);return`rgba(${s},${n},${r},${i})`}function $l(t,e,i){return[Math.round(t[0]+(e[0]-t[0])*i),Math.round(t[1]+(e[1]-t[1])*i),Math.round(t[2]+(e[2]-t[2])*i)]}function oe(t,e,i){let o=(1-Math.abs(2*i-1))*e,s=(t%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=i-o/2;return[Math.round((r+c)*255),Math.round((l+c)*255),Math.round((a+c)*255)]}var ql=new Map;function Zl(t){if(!t)return null;let e=ql.get(t);if(e)return e;let i=2166136261;for(let n=0;n<t.length;n++)i^=t.charCodeAt(n),i=Math.imul(i,16777619);let o=(i>>>0)%360,s=oe(o,.3,.42);return ql.set(t,s),s}function Qh(t,e,i,o){let s=new Array(Ti).fill(null),n=0,r=t.sectionId;for(let l of e){if(l.id===t.id)continue;let a=l.sectionId;if(!a||r&&a===r)continue;let c=l.x-t.x,d=l.y-t.y,h=Math.hypot(c,d)*Rt;if(h<1.5||h>95)continue;let u=l.eyeHeightM??ee,y=u-o;Math.abs(y)>n&&(n=Math.abs(y));let f=Math.atan2(y,h)*180/Math.PI,m=Math.atan2(u-ee-o,h)*180/Math.PI,g=((Math.atan2(c,-d)-i)*180/Math.PI+540)%360-180,b=Math.min(Ti-1,Math.max(0,Math.floor((g+180)/Ko))),S=f>34&&h<16,v=s[b];v?(f>v.top&&(v.top=f),m<v.base&&(v.base=m),h<v.nearM&&(v.nearM=h,v.tint=Zl(l.categoryKey)),v.overhead=v.overhead||S):s[b]={top:f,base:m,nearM:h,overhead:S,tint:Zl(l.categoryKey)}}return{bins:s,maxDelta:n}}function Jh(t,e,i,o){for(let s=0;s<Ti;s++){let n=e[s];if(!n)continue;let r=-180+s*Ko,l=i(r),a=i(r+Ko);if(!(a>l))continue;let c=Math.min(72,n.top),d=Math.min(n.base,-4),h=o(c),u=o(d);if(u<=h)continue;let y=n.nearM/95,f=n.tint,m=f?$l([44,54,80],f,.34):[44,54,80],p=f?$l([24,30,48],f,.28):[24,30,48],g=t.createLinearGradient(0,h,0,u);g.addColorStop(0,zo(m,y)),g.addColorStop(.24,zo(p,y)),g.addColorStop(1,zo([10,13,22],y)),t.fillStyle=g,t.fillRect(l,h,a-l+1,u-h),t.fillStyle=`rgba(150,165,205,${.35*(1-y*.55)})`,t.fillRect(l,h,a-l+1,1.5);let S=Math.min(u,o(0))-h;if(S>8){let k=1-y*.4;for(let w=1;w<6;w++){let L=h+S*w/6;t.fillStyle=`rgba(0,0,0,${.16*k})`,t.fillRect(l,L,a-l+1,1.5),t.fillStyle=`rgba(120,134,170,${.1*k})`,t.fillRect(l,L+1.5,a-l+1,1.2)}}if(n.overhead){let v=o(Math.min(86,c+12)),k=t.createLinearGradient(0,v,0,h);k.addColorStop(0,"rgba(3,4,8,0.9)"),k.addColorStop(1,"rgba(3,4,8,0)"),t.fillStyle=k,t.fillRect(l,v,a-l+1,h-v),t.fillStyle="rgba(120,130,160,0.14)",t.fillRect(l,h-1.5,a-l+1,1.5)}}}function eu(t,e,i){let s=new Array(72).fill(!1),n=new Array(72).fill(1/0),r=new Set,l=0;for(let g of i){l++,g.sectionId&&r.add(g.sectionId);let b=g.x-e.x,S=g.y-e.y,v=Math.hypot(b,S)*Rt;if(v<.5)continue;let k=Math.atan2(b,-S),w=Math.floor((k+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 d=a/72*360;c.sort((g,b)=>g-b);let h=c.length?c[c.length>>1]:0,u=c.length?c[Math.floor(c.length*.15)]??h:0,y=c.length?c[Math.floor(c.length*.85)]??h:0,f=u>.5?y/u:1,m=Ql(`${l}|${[...r].sort().join(",")}|${Math.round(e.x)},${Math.round(e.y)}`),p;return d>=300&&h>11&&f>1.35?p="sport":d>=285?p="arena":p="proscenium",{mode:p,seed:m,voidRadiusM:h,aspect:f}}var tu=5;function iu(t,e,i){switch(i){case 1:t.beginPath(),t.ellipse(0,-e*.14,e*1.16,e*1.16,0,0,E),t.fill();break;case 2:t.beginPath(),t.ellipse(0,-e*1.02,e*.42,e*.42,0,0,E),t.fill(),t.beginPath(),t.ellipse(0,-e*.2,e*.98,e*1.02,0,0,E),t.fill();break;case 3:t.beginPath(),t.ellipse(0,-e*.36,e*1.04,e*.6,0,Math.PI,E),t.fill(),t.beginPath(),t.ellipse(0,-e*.52,e*1.22,e*.24,0,0,E),t.fill();break;case 4:t.beginPath(),t.ellipse(-e*.66,e*.5,e*.5,e*1.35,0,0,E),t.fill(),t.beginPath(),t.ellipse(e*.66,e*.5,e*.5,e*1.35,0,0,E),t.fill(),t.beginPath(),t.ellipse(0,-e*.08,e*1.06,e*1.08,0,0,E),t.fill();break;default:break}}function ou(t,e,i,o,s){let n=o*.44,r=o*s.shoulderK,l=o*.66,a=o*1.68,c=o*5.4,d=`rgba(${s.clothing[0]},${s.clothing[1]},${s.clothing[2]},${s.alpha})`,h=`rgba(${s.tone[0]},${s.tone[1]},${s.tone[2]},${s.alpha})`;t.save(),t.translate(e,i);let u=s.lean*o;t.fillStyle=d,t.beginPath(),t.moveTo(-n,l),t.quadraticCurveTo(-n*1.18,a-u-o*.6,-r,a-u),t.quadraticCurveTo(-r*1.05,a+o*1.2,-r*.94,c),t.lineTo(r*.94,c),t.quadraticCurveTo(r*1.05,a+o*1.2,r,a+u),t.quadraticCurveTo(n*1.18,a+u-o*.6,n,l),t.closePath(),t.fill(),t.fillStyle=h,t.fillRect(-n*.82,o*.5,n*1.64,o*.9),t.save(),t.rotate(s.tilt),t.translate(s.turn*o,0),t.fillStyle=h,o>=18?(t.beginPath(),t.moveTo(-o*.9,-o*.15),t.quadraticCurveTo(-o*.96,-o*1.12,0,-o*1.06),t.quadraticCurveTo(o*.96,-o*1.12,o*.9,-o*.15),t.quadraticCurveTo(o*.86,o*.55,o*.36,o*.98),t.quadraticCurveTo(0,o*1.14,-o*.36,o*.98),t.quadraticCurveTo(-o*.86,o*.55,-o*.9,-o*.15),t.closePath(),t.fill(),o>=22&&(t.beginPath(),t.ellipse(-o*.9,o*.18,o*.13,o*.22,0,0,E),t.ellipse(o*.9,o*.18,o*.13,o*.22,0,0,E),t.fill())):(t.beginPath(),t.ellipse(0,0,o*.9,o*1.06,0,0,E),t.fill()),iu(t,o,s.hair),s.rim>.01&&(t.strokeStyle=`rgba(245,205,150,${(.5*s.rim).toFixed(3)})`,t.lineWidth=Math.max(1,o*.14),t.beginPath(),t.ellipse(0,-o*.06,o*.86,o*1,0,Math.PI*1.12,Math.PI*1.9),t.stroke()),t.restore(),s.rim>.01&&(t.strokeStyle=`rgba(240,200,150,${(.28*s.rim).toFixed(3)})`,t.lineWidth=Math.max(1,o*.12),t.beginPath(),t.moveTo(-r*.8,a-o*.05),t.quadraticCurveTo(-n,a-o*.75,0,a-o*.82),t.quadraticCurveTo(n,a-o*.75,r*.8,a-o*.05),t.stroke()),t.restore()}function su(t,e,i,o,s,n,r){t.fillStyle=`rgba(${s[0]},${s[1]},${s[2]},${r})`,t.beginPath(),t.moveTo(e-o*1.72,i+o*4),t.quadraticCurveTo(e-o*1.78,i+o*1.55,e-o*.46,i+o*1.02),t.lineTo(e-o*.4,i+o*.62),t.lineTo(e+o*.4,i+o*.62),t.lineTo(e+o*.46,i+o*1.02),t.quadraticCurveTo(e+o*1.78,i+o*1.55,e+o*1.72,i+o*4),t.closePath(),t.fill(),t.fillStyle=`rgba(${n[0]},${n[1]},${n[2]},${r})`,t.beginPath(),t.ellipse(e,i,o*.9,o*1.05,0,0,E),t.fill()}function Yo(t,e,i,o,s){let n=o*.1,r=i-o*.9,l=i-o*.74,a=i-o*.46,c=o*.13,d=o*.09,h=`rgba(${s.tone[0]},${s.tone[1]},${s.tone[2]},${s.alpha})`,u=t.createRadialGradient(e,i,1,e,i,o*.24);u.addColorStop(0,"rgba(0,0,0,0.4)"),u.addColorStop(1,"rgba(0,0,0,0)"),t.save(),t.scale(1,.28),t.fillStyle=u,t.beginPath(),t.ellipse(e,i/.28,o*.24,o*.24,0,0,E),t.fill(),t.restore(),t.fillStyle=h,t.beginPath(),t.moveTo(e-d,a),t.lineTo(e-d*.7,i),t.lineTo(e-d*.1,i),t.lineTo(e-d*.1,a+o*.02),t.lineTo(e+d*.1,a+o*.02),t.lineTo(e+d*.1,i),t.lineTo(e+d*.7,i),t.lineTo(e+d,a),t.closePath(),t.fill(),t.beginPath(),t.moveTo(e-c,l),t.quadraticCurveTo(e-c*.9,a-o*.12,e-d,a),t.lineTo(e+d,a),t.quadraticCurveTo(e+c*.9,a-o*.12,e+c,l),t.quadraticCurveTo(e,l-o*.05,e-c,l),t.closePath(),t.fill(),t.lineCap="round",t.lineJoin="round",t.strokeStyle=h,t.lineWidth=o*.055;let y=l+o*.02;s.pose===1?(t.beginPath(),t.moveTo(e-c*.8,y),t.lineTo(e-c*1.5,i-o*1.02),t.moveTo(e+c*.8,y),t.lineTo(e+c*1.5,i-o*1.02),t.stroke()):s.pose===2?(t.beginPath(),t.moveTo(e-c*.8,y),t.lineTo(e+d*1.4,a-o*.02),t.moveTo(e+c*.8,y),t.lineTo(e-d*.4,a-o*.06),t.stroke(),t.fillStyle=h,t.beginPath(),t.ellipse(e+d*1.5,a-o*.04,o*.07,o*.09,-.5,0,E),t.fill()):s.pose===3?(t.beginPath(),t.moveTo(e-c*.8,y),t.lineTo(e-c*.2,r+n*.6),t.moveTo(e+c*.8,y),t.lineTo(e+c*1.1,a),t.stroke(),t.lineWidth=o*.02,t.beginPath(),t.moveTo(e-c*.2,r+n*.9),t.lineTo(e-c*.2,i-o*.02),t.stroke()):(t.beginPath(),t.moveTo(e-c*.85,y),t.lineTo(e-c*.95,a+o*.02),t.moveTo(e+c*.85,y),t.lineTo(e+c*.95,a+o*.02),t.stroke()),t.fillStyle=h,t.fillRect(e-n*.34,r+n*.6,n*.68,n*.9),t.beginPath(),t.ellipse(e,r,n*.86,n*1.05,0,0,E),t.fill(),s.rimStrength>.01&&(t.strokeStyle=`rgba(${s.rim[0]},${s.rim[1]},${s.rim[2]},${(.6*s.rimStrength).toFixed(3)})`,t.lineWidth=Math.max(1,o*.02),t.beginPath(),t.moveTo(e-c,l),t.lineTo(e-n*.6,r+n*.4),t.moveTo(e-n*.7,r),t.ellipse(e,r,n*.84,n*1.02,0,Math.PI*1.05,Math.PI*1.55),t.stroke())}function xi(t,e,i,o,s,n,r,l,a){t.save(),t.globalCompositeOperation="lighter";let c=t.createLinearGradient(0,i,0,s);c.addColorStop(0,`rgba(${l},${a})`),c.addColorStop(.5,`rgba(${l},${(a*.4).toFixed(3)})`),c.addColorStop(1,`rgba(${l},0)`),t.fillStyle=c,t.beginPath(),t.moveTo(e-n,i),t.lineTo(o-r,s),t.lineTo(o+r,s),t.lineTo(e+n,i),t.closePath(),t.fill(),t.restore()}function Uo(t,e,i,o,s){let n=t.createRadialGradient(e,i,0,e,i,o*3);n.addColorStop(0,`rgba(${s},0.9)`),n.addColorStop(.4,`rgba(${s},0.35)`),n.addColorStop(1,`rgba(${s},0)`),t.fillStyle=n,t.beginPath(),t.arc(e,i,o*3,0,E),t.fill(),t.fillStyle=`rgba(${s},1)`,t.beginPath(),t.arc(e,i,o,0,E),t.fill()}function nv(t,e,i){let o=document.createElement("canvas");o.width=q,o.height=pe;let s=o.getContext("2d"),n=e.x-t.x,r=e.y-t.y,l=Math.hypot(n,r),a=Math.max(2,l*Rt),c=t.eyeHeightM??ee,d=eu(t,e,i),h=Jl(d.seed),u=210+h()*150,y=oe(220+(h()-.5)*60,.55,.82),f=`${y[0]},${y[1]},${y[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,K(-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,K(-6),q,pe-K(-6));let g=Math.atan2(n,-r),b=Qh(t,i,g,c),S=b.maxDelta>=jh;S&&Jh(s,b.bins,at,K);let v=Math.max(.3,Math.min(1,1-(a-6)/60)),k=Wo(c,a),w=Math.min(80,Math.atan2(4,a)*180/Math.PI),L=Math.min(45,k.topPitch),C=k.basePitch;d.mode==="sport"?au(s,a,c,d,v,u,f,h):d.mode==="arena"?ru(s,a,c,d,v,f,h):nu(s,w,L,C,v,u,f,h);let T=d.mode==="sport"?34:24+Math.floor(h()*8);s.fillStyle=`rgba(${f},0.8)`;for(let I=0;I<T;I++){let P=(I+.5)/T*q,A=K(d.mode==="sport"?58:54+I*7%3*6);s.beginPath(),s.arc(P,A,d.mode==="sport"?2.6:3.2,0,E),s.fill()}lu(s,t,i,e,g,c,n,r,S,d);let x=s.createLinearGradient(0,0,0,pe);return x.addColorStop(0,"rgba(0,0,0,0.85)"),x.addColorStop(.12,"rgba(0,0,0,0)"),x.addColorStop(.9,"rgba(0,0,0,0)"),x.addColorStop(1,"rgba(0,0,0,0.55)"),s.fillStyle=x,s.fillRect(0,0,q,pe),{url:o.toDataURL("image/jpeg",.82),distanceM:Math.round(a)}}function nu(t,e,i,o,s,n,r,l){let a=at(-e),c=at(e),d=K(i),h=K(o),u=c-a,y=h-d,f=K(Math.min(50,i+10)),m=u*(1.1+(1-s)*.5),p=t.createRadialGradient(q/2,(d+h)/2,8,q/2,(d+h)/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)"),t.fillStyle=p,t.fillRect(a-u*.6,d-y*1.2,u*2.2,y*3.4);let g=oe(n,.62,.55),b=oe(n+40,.7,.5),S=oe(n+70,.78,.52);t.save(),t.beginPath(),t.rect(a,d,u,y),t.clip();let v=t.createLinearGradient(0,d,0,h);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]})`),t.globalAlpha=.8,t.fillStyle=v,t.fillRect(a,d,u,y),t.globalAlpha=1;let k=t.createRadialGradient(q/2,(d+h)/2,u*.12,q/2,(d+h)/2,u*.62);k.addColorStop(0,"rgba(6,8,14,0)"),k.addColorStop(.7,"rgba(6,8,14,0.15)"),k.addColorStop(1,"rgba(5,6,11,0.92)"),t.fillStyle=k,t.fillRect(a,d,u,y),t.restore();let w=3+Math.floor(l()*3),L=y*.46,C=h-y*.08;for(let _=0;_<w;_++){let $=(_+1)/(w+1),X=a+u*(.22+$*.56+(l()-.5)*.06);Yo(t,X,C,L*(.9+l()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(l()*4),rim:oe(n+20,.5,.7),rimStrength:.7})}t.fillStyle="#05070d",t.fillRect(a-u*.5,f,u*.5,h-f),t.fillRect(c,f,u*.5,h-f);let T=u*.055+3,x=T*1.35;t.fillStyle="#03050a",t.beginPath(),t.moveTo(a,h),t.lineTo(a-T,h),t.lineTo(a-x,f),t.lineTo(a+u*.012,f),t.closePath(),t.fill(),t.beginPath(),t.moveTo(c,h),t.lineTo(c+T,h),t.lineTo(c+x,f),t.lineTo(c-u*.012,f),t.closePath(),t.fill(),t.fillRect(a-x,f,u+x*2,(h-f)*.12);let I=y*.14,P=f+(h-f)*.12;t.fillStyle="rgba(4,6,12,0.96)";let A=7;t.beginPath(),t.moveTo(a-x,P);for(let _=0;_<=A;_++){let $=a-x+(u+x*2)*_/A;t.quadraticCurveTo($-(u+x*2)/A/2,P+I,$,P)}t.lineTo(c+x,P),t.lineTo(c+x,f),t.lineTo(a-x,f),t.closePath(),t.fill(),t.fillStyle=`rgba(${r},0.12)`,t.fillRect(a-1.5,P,1.5,h-P),t.fillRect(c,P,1.5,h-P),t.fillStyle="#0b0f18",t.fillRect(a-T,h-y*.05,u+T*2,y*.05+3);let R=t.createLinearGradient(0,h-y*.05,0,h+y*.12);R.addColorStop(0,`rgba(255,206,140,${(.5*s).toFixed(3)})`),R.addColorStop(1,"rgba(255,206,140,0)"),t.fillStyle=R,t.fillRect(a-T,h-y*.05,u+T*2,y*.2);let M=3+Math.floor(l()*2);for(let _=0;_<M;_++){let $=(_+1)/(M+1),X=a+u*($+(l()-.5)*.08),Y=K(Math.min(62,i+26)),J=(l()-.5)*u*.16;xi(t,X,Y,X+J,h,4,u*.09,r,.16*(.7+s*.5)),Uo(t,X,Y,2.4,r)}}function ru(t,e,i,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,d=1.2,h=Math.max(e*.45,e-l),u=e+l,y=Math.atan2(d-i,h)*180/Math.PI,f=Math.atan2(d-i,u)*180/Math.PI,m=Math.atan2(-i,h)*180/Math.PI,p=K(y),g=K(f),b=K(m),S=at(a)-c,v=Math.max(6,(p-g)/2),k=(p+g)/2,w=t.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)"),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=w,t.fillRect(c-S*2.6,g-v,S*5.2,b-g+v+40),t.restore(),t.fillStyle="#0c1019",t.beginPath(),t.moveTo(c-S,k),t.ellipse(c,k,S,v,0,Math.PI,0,!1),t.lineTo(c+S,b),t.ellipse(c,b,S,v,0,0,Math.PI,!1),t.closePath(),t.fill();let L=t.createLinearGradient(0,k,0,b);L.addColorStop(0,`rgba(${n},0.14)`),L.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=L,t.fillRect(c-S,k,S*2,b-k);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}]],T=C[Math.floor(r()*C.length)],x=r()<.5?-1:1,I=O=>c+O.u*x*S*.84,P=O=>k+O.v*v*.8,A=T.find(O=>O.lead)??T[0],R=I(A),M=t.createLinearGradient(0,k-v,0,k+v);M.addColorStop(0,"#3d4a72"),M.addColorStop(1,"#232b47"),t.fillStyle=M,t.beginPath(),t.ellipse(c,k,S,v,0,0,E),t.fill();let _=t.createRadialGradient(R,k,2,R,k,S);_.addColorStop(0,`rgba(255,214,160,${(.5*s).toFixed(3)})`),_.addColorStop(1,"rgba(255,214,160,0)"),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=_,t.beginPath(),t.ellipse(c,k,S,v,0,0,E),t.fill(),t.restore(),t.strokeStyle=`rgba(${n},0.7)`,t.lineWidth=2,t.beginPath(),t.ellipse(c,k,S,v,0,0,E),t.stroke();let $=Math.max(24,(b-g)*1.3),X=T.length>=3?3:2;for(let O=0;O<X;O++){let fe=(-.62+O*.52+(r()-.5)*.12)*-x,Ee=c+fe*S*.7,lt=k-v*(.45+r()*.18),Ke=S*(.07+r()*.04),Ei=$*(.26+r()*.12);t.fillStyle="#0a0e18",t.fillRect(Ee-Ke/2,lt-Ei,Ke,Ei),t.fillStyle=`rgba(${n},0.3)`,t.fillRect(Ee-Ke/2,lt-Ei,Ke,1.5)}if(T.length>=3){let O=c-A.u*x*S*.4;t.fillStyle="#0b0f1a",t.beginPath(),t.ellipse(O,k-v*.34,S*.08,v*.1,0,0,E),t.fill(),t.strokeStyle=`rgba(${n},0.35)`,t.lineWidth=1,t.stroke()}for(let O of[...T].sort((fe,Ee)=>fe.v-Ee.v)){let fe=.82+(O.v+1)*.14;Yo(t,I(O),P(O),$*fe*(O.lead?1.06:.92),{tone:[18,21,34],alpha:.95,pose:O.pose,rim:oe(40,.72,.8),rimStrength:O.lead?1.4:.9})}let Y=K(Math.min(60,f+34)),J=v*1.1+6;t.strokeStyle="rgba(60,68,92,0.85)",t.lineWidth=3,t.beginPath(),t.ellipse(c,Y,S*1.15,J,0,0,E),t.stroke();let D=4+Math.floor(r()*3);for(let O=0;O<D;O++){let fe=O/D*E,Ee=c+Math.cos(fe)*S*1.15,lt=Y+Math.sin(fe)*J;if(Math.sin(fe)>-.2){let Ke=c+(r()-.5)*S*.8;xi(t,Ee,lt,Ke,k,3,S*.32,n,.2*(.7+s*.4))}Uo(t,Ee,lt,3,n)}let U=K(Math.min(52,f+24)),N=Math.max(60,S*.4),Z=Math.max(24,N*.34);t.strokeStyle="rgba(70,78,102,0.6)",t.lineWidth=1.5,t.beginPath(),t.moveTo(c-N*.3,U-Z/2),t.lineTo(c-N*.16,U-Z*2.2),t.moveTo(c+N*.3,U-Z/2),t.lineTo(c+N*.16,U-Z*2.2),t.stroke(),t.fillStyle="#0d1220",t.fillRect(c-N/2,U-Z/2,N,Z);let Pi=t.createLinearGradient(0,U-Z*.3,0,U+Z*.42);Pi.addColorStop(0,`rgba(${n},0.5)`),Pi.addColorStop(1,"rgba(255,214,160,0.32)"),t.fillStyle=Pi,t.fillRect(c-N*.42,U-Z*.3,N*.84,Z*.72),t.fillStyle="rgba(255,214,160,0.55)",t.fillRect(c-N/2,U+Z/2-2,N,2);let Mi=t.createRadialGradient(c,U,4,c,U,N*1.1);Mi.addColorStop(0,`rgba(${n},0.2)`),Mi.addColorStop(1,"rgba(0,0,0,0)"),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=Mi,t.fillRect(c-N*1.1,U-N*.8,N*2.2,N*1.6);let Ri=t.createRadialGradient(c,(Y+k)/2,6,c,(Y+k)/2,S*1.5);Ri.addColorStop(0,`rgba(${n},${(.1*(.6+s*.5)).toFixed(3)})`),Ri.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=Ri,t.fillRect(c-S*1.5,Y-40,S*3,k-Y+80),t.restore();let tc=c+Math.sign(R-c||1)*S*.5;xi(t,tc,Y-J*.4,R,P(A),2.5,S*.16,"255,224,178",.42*(.7+s*.4));let Ai=t.createRadialGradient(R,P(A),1,R,P(A),S*.2);Ai.addColorStop(0,`rgba(255,228,185,${(.4*s).toFixed(3)})`),Ai.addColorStop(1,"rgba(255,228,185,0)"),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=Ai,t.beginPath(),t.ellipse(R,P(A),S*.2,v*.24,0,0,E),t.fill(),t.restore()}function au(t,e,i,o,s,n,r,l){let a=q/2,c=Math.max(10,o.voidRadiusM),d=Math.max(2,e-c),h=e+c,u=Math.min(78,Math.atan2(c*1.15,e)*180/Math.PI),y=Math.atan2(-i,d)*180/Math.PI,f=Math.atan2(-i,h)*180/Math.PI,m=K(y),p=K(f),g=at(u)-a,b=(m+p)/2,S=Math.max(10,(m-p)/2),v=t.createRadialGradient(a,b,4,a,b,g);v.addColorStop(0,"#e8f0fb"),v.addColorStop(.7,"#b9c9e2"),v.addColorStop(1,"#8fa3c4"),t.save(),t.beginPath(),t.ellipse(a,b,g,S,0,0,E),t.clip(),t.fillStyle=v,t.fillRect(a-g,b-S,g*2,S*2),t.strokeStyle="rgba(90,120,170,0.5)",t.lineWidth=3,t.beginPath(),t.moveTo(a,b-S),t.lineTo(a,b+S),t.moveTo(a-g*.5,b-S),t.lineTo(a-g*.5,b+S),t.moveTo(a+g*.5,b-S),t.lineTo(a+g*.5,b+S),t.stroke(),t.strokeStyle="rgba(180,90,110,0.45)",t.beginPath(),t.ellipse(a,b,S*.9,S*.5,0,0,E),t.stroke(),t.restore(),t.strokeStyle="rgba(210,225,245,0.6)",t.lineWidth=2.5,t.beginPath(),t.ellipse(a,b,g,S,0,0,E),t.stroke(),t.fillStyle="rgba(20,26,40,0.8)";for(let I=0;I<5;I++){let P=a+(l()-.5)*g*1.4,A=b+(l()-.5)*S*1.1,R=Math.max(2,S*.06);t.beginPath(),t.ellipse(P,A,R*.6,R,0,0,E),t.fill()}let k=t.createRadialGradient(a,b,4,a,b,g*1.4);k.addColorStop(0,"rgba(200,220,255,0.12)"),k.addColorStop(1,"rgba(200,220,255,0)"),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=k,t.fillRect(a-g*1.4,p-S,g*2.8,m-p+S*2),t.restore();let w=K(Math.min(66,f+60)),L=Math.max(80,g*.7),C=L*.5,T=t.createRadialGradient(a,w,4,a,w,L*1.6);T.addColorStop(0,`rgba(${r},0.3)`),T.addColorStop(1,`rgba(${r},0)`),t.save(),t.globalCompositeOperation="lighter",t.fillStyle=T,t.fillRect(a-L*1.6,w-L*1.2,L*3.2,L*2.4),t.restore(),t.fillStyle="#080b12",t.beginPath(),t.moveTo(a-L/2,w-C/2),t.lineTo(a+L/2,w-C/2),t.lineTo(a+L*.6,w),t.lineTo(a+L/2,w+C/2),t.lineTo(a-L/2,w+C/2),t.lineTo(a-L*.6,w),t.closePath(),t.fill();let x=n;for(let I=0;I<3;I++){let P=oe(x+I*30,.5,.5);t.fillStyle=`rgba(${P[0]},${P[1]},${P[2]},0.75)`;let A=L*.26;t.fillRect(a-L*.42+I*(A+L*.06),w-C*.32,A,C*.64)}t.fillStyle=`rgba(${r},0.9)`;for(let I=0;I<8;I++){let P=a-L*.6+L*1.2*I/7;t.beginPath(),t.arc(P,w+C*.62,2.4,0,E),t.fill()}}function lu(t,e,i,o,s,n,r,l,a,c){let d=e.sectionId,h=!1,u=[];for(let m of i){if(m.id===e.id)continue;let p=m.x-e.x,g=m.y-e.y,b=Math.hypot(p,g)*Rt;if(d&&m.sectionId===d&&b<3&&p*r+g*l>0&&(h=!0),b<.3||b>32)continue;let v=((Math.atan2(p,-g)-s)*180/Math.PI+540)%360-180,k=a?(m.eyeHeightM??ee)-n:0,w=Math.atan2(k-.28,b)*180/Math.PI;if(w>10&&b>5)continue;let L=0;for(let x=0;x<m.id.length;x++)L=L*31+m.id.charCodeAt(x)&65535;let C=.9+(L&15)/40,T=Math.min(78,Math.atan2(.16,b)*180/Math.PI*Zh*C);T<1.2||u.push({hx:at(v),hy:K(w),r:T,d:b,hash:L})}u.sort((m,p)=>p.d-m.d);let y=[];{let m=[...u].sort((b,S)=>b.hy-S.hy),p=[],g=()=>{if(!p.length)return;let b=p.reduce((k,w)=>k+w.d,0)/p.length,S=p.reduce((k,w)=>k+w.hy,0)/p.length,v=p.reduce((k,w)=>k+w.r,0)/p.length;y.push({figs:p.sort((k,w)=>w.d-k.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()}y.sort((m,p)=>p.d-m.d);let f=[[22,26,40],[28,27,42],[24,31,46],[31,30,47],[20,24,36]];for(let m of y){if(m.figs.length>=3&&m.r>=1.6&&m.r<26){let p=[],g=[...m.figs].sort((v,k)=>v.hx-k.hx),b=[];for(let v of g){let k=b[b.length-1];k&&v.hx-k.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){t.fillStyle=`rgba(15, 19, 31, ${S.toFixed(3)})`;for(let v of p){let k=v[0].hx-m.r*1.6,w=v[v.length-1].hx+m.r*1.6;t.beginPath(),t.roundRect(k,m.hy+m.r*.8,w-k,m.r*2.4,m.r*.8),t.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=f[p.hash%f.length],k=[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;ou(t,p.hx,p.hy,p.r,{tone:S,clothing:k,alpha:g,tilt:((p.hash>>2&7)-3.5)*.018,shoulderK:1.72+(p.hash>>5&7)/22,hair:p.hash%tu,rim:w,turn:((p.hash>>8&7)-3.5)*.034,lean:((p.hash>>10&3)-1.5)*.09})}else p.r>=5.5?su(t,p.hx,p.hy,p.r,k,S,g):(t.fillStyle=`rgba(${S[0]},${S[1]},${S[2]},${g.toFixed(3)})`,t.beginPath(),t.arc(p.hx,p.hy,p.r,0,E),t.fill(),t.beginPath(),t.ellipse(p.hx,p.hy+p.r*1.4,p.r*1.85,p.r*.95,0,Math.PI,0,!0),t.fill())}}if(h){let m=K(-34);t.fillStyle="rgba(6, 8, 14, 0.92)",t.fillRect(0,m,q,pe-m),t.fillStyle="rgba(24, 30, 46, 0.9)";let p=16;for(let g=0;g<p;g++){let b=(g+.5)/p*q;t.beginPath(),t.ellipse(b,m+6,q/p*.42,22,0,Math.PI,0,!0),t.fill()}}}var ne=480,rt=270,Xo=50,ze=30,jl=t=>(t+Xo)/(2*Xo)*ne,Mt=t=>(ze-t)/(2*ze)*rt;function rv(t,e,i){let o=document.createElement("canvas");o.width=ne,o.height=rt;let s=o.getContext("2d"),n=e.x-t.x,r=e.y-t.y,l=Math.max(2,Math.hypot(n,r)*Rt),a=Jl(Ql(`${t.id}|${Math.round(e.x)},${Math.round(e.y)}`)),c=210+a()*150,d=oe(220+(a()-.5)*60,.55,.82),h=`${d[0]},${d[1]},${d[2]}`,u=s.createLinearGradient(0,0,0,rt);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,rt);let y=t.eyeHeightM??ee,f=Wo(y,l),m=Math.min(Xo-2,Math.atan2(4,l)*180/Math.PI),p=Math.min(ze-2,f.topPitch),g=Math.max(-ze+2,f.basePitch),b=jl(-m),S=jl(m),v=Mt(p),k=Mt(g),w=S-b,L=k-v,C=Math.max(.35,Math.min(1,1-(l-6)/60)),T=Mt(Math.min(ze-1,p+8)),x=s.createRadialGradient(ne/2,(v+k)/2,4,ne/2,(v+k)/2,w*1.15);x.addColorStop(0,"rgba(255,214,150,0.34)"),x.addColorStop(.28,"rgba(150,150,230,0.3)"),x.addColorStop(.6,"rgba(99,102,241,0.12)"),x.addColorStop(1,"rgba(99,102,241,0)"),s.fillStyle=x,s.fillRect(b-w*.6,v-L*1.2,w*2.2,L*3.4);let I=oe(c,.62,.55),P=oe(c+40,.7,.5),A=oe(c+70,.78,.52);s.save(),s.beginPath(),s.rect(b,v,w,L),s.clip();let R=s.createLinearGradient(0,v,0,k);R.addColorStop(0,`rgb(${I[0]},${I[1]},${I[2]})`),R.addColorStop(.5,`rgb(${P[0]},${P[1]},${P[2]})`),R.addColorStop(1,`rgb(${A[0]},${A[1]},${A[2]})`),s.globalAlpha=.8,s.fillStyle=R,s.fillRect(b,v,w,L),s.globalAlpha=1;let M=s.createRadialGradient(ne/2,(v+k)/2,w*.12,ne/2,(v+k)/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,L),s.restore();let _=3,$=k-L*.08;for(let D=0;D<_;D++){let U=(D+1)/(_+1);Yo(s,b+w*(.24+U*.52),$,L*.46*(.9+a()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(a()*4),rim:oe(c+20,.5,.7),rimStrength:.7})}s.fillStyle="#05070d",s.fillRect(b-w*.5,T,w*.5,k-T),s.fillRect(S,T,w*.5,k-T);let X=w*.05+2,Y=X*1.35;s.fillStyle="#03050a",s.beginPath(),s.moveTo(b,k),s.lineTo(b-X,k),s.lineTo(b-Y,T),s.lineTo(b+w*.012,T),s.closePath(),s.fill(),s.beginPath(),s.moveTo(S,k),s.lineTo(S+X,k),s.lineTo(S+Y,T),s.lineTo(S-w*.012,T),s.closePath(),s.fill(),s.fillRect(b-Y,T,w+Y*2,(k-T)*.13),s.fillStyle=`rgba(${h},0.12)`,s.fillRect(b-1.2,T,1.2,k-T),s.fillRect(S,T,1.2,k-T),s.fillStyle="#0b0f18",s.fillRect(b-X,k-L*.05,w+X*2,L*.05+2);let J=s.createLinearGradient(0,k-L*.05,0,k+L*.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,k-L*.05,w+X*2,L*.22);for(let D=0;D<3;D++){let U=(D+1)/4,N=b+w*U,Z=Mt(Math.min(ze-1,p+20));xi(s,N,Z,N+(a()-.5)*w*.14,k,3,w*.09,h,.17*C),Uo(s,N,Z,1.8,h)}s.fillStyle=`rgba(${h},0.75)`;for(let D=0;D<8;D++)s.beginPath(),s.arc((D+.5)/8*ne,Mt(ze-4-D%2*3),2.2,0,E),s.fill();s.fillStyle="rgba(10,13,20,0.9)",s.fillRect(0,rt-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,rt-22,ne/9*.4,15,0,Math.PI,0,!0),s.fill()}return{url:o.toDataURL("image/jpeg",.8),distanceM:Math.round(l)}}var ec=new Set(["en"]),Ii=new Map;async function cu(t){if(typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__)return(await import(Bs(`i18n/${t}.mjs`))).default??null;let{LOADERS:e}=await import("./localeLoaders-BZZWN35C.js"),i=e[t];return i?await i():null}async function dv(t,e){let i=Gn(t,e);if(i==="en"||ec.has(i))return je(i),i;if(!Dn.includes(i))return je("en"),"en";try{let o=Ii.get(i);o||(o=cu(i),Ii.set(i,o));let s=await o;return Ii.delete(i),s?(je(i,s),ec.add(i),i):(je("en"),"en")}catch{return Ii.delete(i),je("en"),"en"}}export{pu as ACCESSIBILITY_RING_COLOR,$o as ACCESSIBILITY_TYPES,Zu as AUTOMATIC_ROUND_TABLE_RADIUS_MAX,qu as AUTOMATIC_ROUND_TABLE_RADIUS_MIN,hu as CHART_STORAGE_KEY,Sp as CURRENCY_CHOICES,bp as DEFAULT_CURRENCY,pS as EMPTY_AVAILABILITY_REFRESH,wu as EVENT_CONFIGURATION_EXPORT_SCHEMA,vu as EVENT_CONFIGURATION_SCHEMA,Xu as FLOOR_STACK_GAP_RATIO,$u as FLOOR_STACK_MIN_SURFACE_PX,uS as HOLD_CLOCK_SKEW_MS,Ni as LABEL_FADE_MS,gu as LABEL_STYLE_MAX_SIZE,yu as LABEL_STYLE_MIN_SIZE,cp as LEGIBILITY_HYSTERESIS_PX,Ip as LOCALE_NAMES,Ju as MAX_EVENT_INVENTORY,Qu as MAX_GA_CAPACITY,ps as MIN_POINTER_TARGET_PX,Ul as PickerController,Ae as PickerSelectionError,ap as RENDERED_QUALITY_REPORT_VERSION,fu as SEAT_COMMERCIAL_MARKS,du as STAGE_LABEL_STYLE_MAX_SIZE,Pc as SUPPORTED_LOCALES,bu as SURROUNDINGS_SHAPE_ROLES,Do as SeatmapRenderer,Ru as TABLE_SEAT_OFFSET,Mu as TIER_HEIGHT_M,Dn as TRANSLATED_LOCALES,rs as UNGROUPED_ID,Fl as accessNeedsFor,uu as accessibilityMeta,At as accessibilityRingColor,ts as allObjects,as as applyHidden,Dl as attachVisibilityCatchUp,ju as automaticRoundTableRadius,xu as canTransitionEventConfiguration,Cu as canonicalEventConfigurationJson,os as chartBounds,Oi as compactRowLabel,Ot as computeSections,wl as createRenderer,Os as crossesThreshold,xc as currencyExponent,wp as currencySymbol,Nu as expandBooth,Ye as expandChart,Fu as expandRow,_u as expandRowSlots,Gu as expandTable,Ou as expandTableSlots,zu as floorObjects,Yu as floorStackPlacements,Ft as floorsOf,Ep as formatDate,vp as formatMinor,gt as formatMoney,Ic as fromMinorUnits,ct as gaAreasOf,ip as gaInventorySegments,ep as gaUnitLabel,Bt as gaUnitLabels,nv as generateSeatPanorama,rv as generateSeatThumb,Pp as getLocale,op as growJoinedGAInventory,rp as hiddenObjectIds,Wh as holdHasLapsed,mS as holdRecoveryShape,Wi as hysteresisScale,ns as initialFloorMode,Tu as inspectEventConfigurationCompatibility,lp as inspectRenderedQualityEvidence,sp as isGaUnitLabel,Rp as isLocaleLoaded,np as isSectionHidden,Su as layerOf,ss as layoutFloorStack,dv as loadLocale,Mp as localeDirection,Uu as mainFloorId,Pu as migrateLegacyEventConfigurations,Wu as objectCenter,Vu as owningSectionForObject,Lu as parseEventConfigurationExport,ku as parseEventConfigurationVersion,Hu as pointInPolygon,te as pointInPolygonWithHoles,_t as polygonLabelPoint,Bl as reconcileAvailability,fS as refreshChangedSomething,Hi as renderedPx,Iu as resolveEventConfigurationRollback,Gn as resolveLocale,Eu as rowInventoryCount,Au as rowSeatPositions,mu as seatCommercialMeta,Et as sectionGeometry,je as setLocale,On as setMoneyLocale,Ap as setStringOverrides,Ol as shouldWaitForHoldExpiry,is as stackFloors,G as t,Hn as tCount,Du as tableInventoryCount,Bu as tableSeatCountsBySide,Ku as translateObject,tp as validGAInventorySegments,dp as zoomTowardPoint};