@seatlayer/core 0.67.12 → 0.67.13

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.
Files changed (78) hide show
  1. package/dist/{categoryInventory-DEgsjxCC.d.cts → categoryInventory-BI3jJaqD.d.cts} +1 -1
  2. package/dist/{categoryInventory-C3RogGHF.d.ts → categoryInventory-CDGQe2Ag.d.ts} +1 -1
  3. package/dist/chunk-3TAVIEVO.js +1 -0
  4. package/dist/chunk-52MZJZMW.js +1 -0
  5. package/dist/chunk-5BGP7S3Q.js +1 -0
  6. package/dist/chunk-BTW7IGNT.js +1 -0
  7. package/dist/{chunk-F4GG7KDS.js → chunk-BV6FHURE.js} +1 -1
  8. package/dist/chunk-CRCGO52K.js +1 -0
  9. package/dist/{chunk-5S3OQBZJ.js → chunk-HZT2U5IY.js} +1 -1
  10. package/dist/chunk-I6DNJFRF.js +1 -0
  11. package/dist/{chunk-V7PECHME.js → chunk-QYZ3P5L6.js} +1 -1
  12. package/dist/{chunk-L35GJOTC.js → chunk-RMNTGICO.js} +1 -1
  13. package/dist/chunk-Y2J55NLS.js +1 -0
  14. package/dist/core/chart-ops/index.cjs +1 -1
  15. package/dist/core/chart-ops/index.d.cts +71 -7
  16. package/dist/core/chart-ops/index.d.ts +71 -7
  17. package/dist/core/chart-ops/index.js +1 -1
  18. package/dist/core/inventory/index.cjs +1 -1
  19. package/dist/core/inventory/index.d.cts +4 -4
  20. package/dist/core/inventory/index.d.ts +4 -4
  21. package/dist/core/inventory/index.js +1 -1
  22. package/dist/core/layout/index.cjs +1 -1
  23. package/dist/core/layout/index.d.cts +4 -4
  24. package/dist/core/layout/index.d.ts +4 -4
  25. package/dist/core/layout/index.js +1 -1
  26. package/dist/core/quality/index.d.cts +3 -3
  27. package/dist/core/quality/index.d.ts +3 -3
  28. package/dist/core/render-assets/index.d.cts +1 -1
  29. package/dist/core/render-assets/index.d.ts +1 -1
  30. package/dist/core/seatConfidence.cjs +1 -1
  31. package/dist/core/seatConfidence.d.cts +5 -3
  32. package/dist/core/seatConfidence.d.ts +5 -3
  33. package/dist/core/seatConfidence.js +1 -1
  34. package/dist/core/sections/index.cjs +1 -1
  35. package/dist/core/sections/index.d.cts +5 -5
  36. package/dist/core/sections/index.d.ts +5 -5
  37. package/dist/core/sections/index.js +1 -1
  38. package/dist/eventConfigurations-DImP8Cd6.d.ts +130 -0
  39. package/dist/eventConfigurations-YqyHnreh.d.cts +130 -0
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.d.cts +32 -11
  42. package/dist/index.d.ts +32 -11
  43. package/dist/index.js +1 -1
  44. package/dist/{labeling-DTHo03rf.d.ts → labeling-Cb7ZwhoO.d.ts} +1 -1
  45. package/dist/{labeling-DRFC35VK.d.cts → labeling-lXzjJrgV.d.cts} +1 -1
  46. package/dist/{layout-BSb0-47G.d.ts → layout-ByBMw1t7.d.ts} +7 -3
  47. package/dist/{layout-wVlsj-_w.d.cts → layout-cZ3VfeJR.d.cts} +7 -3
  48. package/dist/{openPanorama-ALLZ6ADE.js → openPanorama-HGRYMWKC.js} +1 -1
  49. package/dist/{renderedQuality-8i9bYccr.d.cts → renderedQuality-6ta0nSPm.d.cts} +1 -1
  50. package/dist/{renderedQuality-CbHiqt1W.d.ts → renderedQuality-BJKHot_g.d.ts} +1 -1
  51. package/dist/{renderer-BxLV6zjl.d.ts → renderer-B9GavToM.d.ts} +3 -1
  52. package/dist/{renderer-DOVelTZw.d.cts → renderer-C9BLd1g2.d.cts} +3 -1
  53. package/dist/{sections-BrQV1WzI.d.ts → sections-BvZ1cQkD.d.ts} +1 -1
  54. package/dist/{sections-D2bxgVgg.d.cts → sections-ND5PRE4j.d.cts} +1 -1
  55. package/dist/{segmentedRowModel-BQYSdf7k.d.cts → segmentedRowModel-BB9MPufB.d.cts} +1 -1
  56. package/dist/{segmentedRowModel-Cl3X8SKt.d.ts → segmentedRowModel-CLKP-2ca.d.ts} +1 -1
  57. package/dist/{ticketRestrictions-D0GRRQ3i.d.cts → ticketRestrictions-CjV47RNG.d.cts} +2 -2
  58. package/dist/{ticketRestrictions-SteRFSGg.d.ts → ticketRestrictions-DUQ8wHjG.d.ts} +2 -2
  59. package/dist/{types-DmgX-iuD.d.cts → types-hv6QjPRV.d.cts} +32 -3
  60. package/dist/{types-DmgX-iuD.d.ts → types-hv6QjPRV.d.ts} +32 -3
  61. package/dist/view/panoramaDelivery.cjs +1 -1
  62. package/dist/view/panoramaDelivery.d.cts +5 -0
  63. package/dist/view/panoramaDelivery.d.ts +5 -0
  64. package/dist/view/panoramaDelivery.js +1 -1
  65. package/dist/view3d/crossfade/panorama.cjs +1 -1
  66. package/dist/view3d/crossfade/panorama.d.cts +7 -1
  67. package/dist/view3d/crossfade/panorama.d.ts +7 -1
  68. package/dist/view3d/crossfade/panorama.js +1 -1
  69. package/dist/view3d/index.cjs +30 -30
  70. package/dist/view3d/index.d.cts +27 -2
  71. package/dist/view3d/index.d.ts +27 -2
  72. package/dist/view3d/index.js +24 -24
  73. package/package.json +1 -1
  74. package/dist/chunk-EQM4FFN5.js +0 -1
  75. package/dist/chunk-IJI4WU57.js +0 -1
  76. package/dist/chunk-TTTRXXAA.js +0 -1
  77. package/dist/chunk-XHXBFFWR.js +0 -1
  78. package/dist/chunk-XPPT3OGQ.js +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";var Ni=Object.create;var Lt=Object.defineProperty;var Gi=Object.getOwnPropertyDescriptor;var Vi=Object.getOwnPropertyNames;var zi=Object.getPrototypeOf,Hi=Object.prototype.hasOwnProperty;var pt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var oo=(e,t)=>{for(var n in t)Lt(e,n,{get:t[n],enumerable:!0})},ro=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vi(t))!Hi.call(e,o)&&o!==n&&Lt(e,o,{get:()=>t[o],enumerable:!(r=Gi(t,o))||r.enumerable});return e};var tt=(e,t,n)=>(n=e!=null?Ni(zi(e)):{},ro(t||!e||!e.__esModule?Lt(n,"default",{value:e,enumerable:!0}):n,e)),Ui=e=>ro(Lt({},"__esModule",{value:!0}),e);function mc(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function hc(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function on(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:hc(t?.deviceMemory)}}function rn(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};return t.saveData?{...r,reason:"save-data"}:t.maxTextureSize!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&Math.max(e.sourceWidth,e.sourceHeight)>t.maxTextureSize?{...r,reason:"texture-limit"}:t.maxDecodedBytes!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&mc(e.sourceWidth,e.sourceHeight)>t.maxDecodedBytes?{...r,reason:"memory-limit"}:{...r,upgradeUrl:e.url,reason:"progressive"}}function hi(){return new DOMException("Panorama image load aborted","AbortError")}function Rt(e,t){return new Promise((n,r)=>{if(t?.aborted){r(hi());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=l=>{i||(i=!0,a(),l?r(l):n(o))},c=()=>{o.src="",s(hi())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),o.src=e})}function an(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var qn=pt(()=>{"use strict"});function fi(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":"AI-generated illustrative venue demo":e.coverage==="exact-seat"?"Exact seat photo":e.coverage==="row-representative"?"Representative row view":e.coverage==="section-representative"?"Representative section view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function Zn(e){return Math.max(pc,Math.min(fc,e))}function bc(e,t,n){let r=(.5+e/360)*n;return t/2-r}function yc(e,t=cn){return e*(180/t)}function pi(e,t,n){return(e-t)/2+sn(n,t)}function sn(e,t){let n=Ee/180*t;return Math.max(-n,Math.min(n,e))}function bi(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=rn(t,on()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let u=document.createElement("div");Object.assign(u.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(u);let p=document.createElement("button");if(p.type="button",p.setAttribute("aria-label","Close"),p.textContent="\u2715",Object.assign(p.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(p),n.disclosure){let F=document.createElement("div");F.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(F.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(F)}let m=document.createElement("div");m.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(m.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(m),e.appendChild(c),p.focus({preventScroll:!0});let d=0,h=0,f=0,b=0,y=cn,g=()=>{let F=c.clientHeight||1,L=c.clientWidth||1,X=I.naturalWidth||L*2,K=I.naturalHeight||F,J=d>0?(L/2-f)/d:0,Z=h>0?b/h:0;h=yc(F,y),d=h*(X/K),u.style.backgroundSize=`${d}px ${h}px`,x?f=L/2-J*d:(f=bc(o,L,d),b=sn((t.initialPitchDeg??0)/180*h,h),x=!0),b=sn(Z*h,h),u.style.backgroundPosition=`${f}px ${pi(F,h,b)}px`},x=!1,S=()=>{let F=c.clientHeight||1;b=sn(b,h),u.style.backgroundPosition=`${f}px ${pi(F,h,b)}px`},I=new Image;I.onload=g,I.src=i.initialUrl;let M=()=>{};i.upgradeUrl&&(M=an(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(L=>!L||a.signal.aborted?null:Rt(L,a.signal).then(X=>({full:X,url:L}))).then(L=>{L&&(A||a.signal.aborted||(I=L.full,u.style.backgroundImage=`url("${L.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let k=!1,O=0,N=0,j=0,G=new Map,P=()=>{let[F,L]=[...G.values()];return F&&L?Math.hypot(F.x-L.x,F.y-L.y):0},v=F=>{let L=Zn(F);L!==y&&(y=L,g())},w=F=>{G.set(F.pointerId,{x:F.clientX,y:F.clientY}),k=G.size===1,O=F.clientX,N=F.clientY,G.size===2&&(j=P()),u.style.cursor="grabbing";try{u.setPointerCapture?.(F.pointerId)}catch{}},R=F=>{if(G.has(F.pointerId)){if(G.set(F.pointerId,{x:F.clientX,y:F.clientY}),G.size>=2){let L=P();j>0&&L>0&&v(y*(j/L)),j=L,k=!1;return}k&&(f+=F.clientX-O,b+=F.clientY-N,O=F.clientX,N=F.clientY,S())}},T=F=>{G.delete(F.pointerId),j=G.size===2?P():0;let L=G.values().next().value;k=G.size===1,L?(O=L.x,N=L.y):u.style.cursor="grab";try{u.releasePointerCapture?.(F.pointerId)}catch{}},H=F=>{F.preventDefault(),v(y+F.deltaY*.04)};u.addEventListener("pointerdown",w),u.addEventListener("pointermove",R),u.addEventListener("pointerup",T),u.addEventListener("pointercancel",T),u.addEventListener("wheel",H,{passive:!1});let C=!1,A=!1,B=0,E=()=>{u.removeEventListener("pointerdown",w),u.removeEventListener("pointermove",R),u.removeEventListener("pointerup",T),u.removeEventListener("pointercancel",T),u.removeEventListener("wheel",H),window.removeEventListener("keydown",V)},D=()=>{M(),a.abort(),n.signal?.removeEventListener("abort",s),B&&(window.clearTimeout(B),B=0),E(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},z=()=>{if(C)return;C=!0,c.style.opacity="0";let F=()=>{B=0,!A&&(D(),n.onClose?.())};B=window.setTimeout(F,r)},V=F=>{if(F.key==="Tab"){F.preventDefault(),p.focus({preventScroll:!0});return}if(F.key==="Escape"){F.stopPropagation(),z();return}if(F.key==="ArrowLeft"||F.key==="ArrowRight")f+=F.key==="ArrowLeft"?-32:32;else if(F.key==="ArrowUp"||F.key==="ArrowDown")b+=(F.key==="ArrowUp"?4:-4)*(h/180);else if(F.key==="+"||F.key==="="){v(y-5),F.preventDefault();return}else if(F.key==="-"){v(y+5),F.preventDefault();return}else return;F.preventDefault(),S()};return window.addEventListener("keydown",V),p.addEventListener("click",z),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:z,dispose(){C=!0,A=!0,D()}}}var cn,pc,fc,Ee,$n=pt(()=>{"use strict";qn();cn=70,pc=35,fc=90;Ee=35});function Mc(e=gc,t=xc,n=vc){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<o;u++){let p=u/t,m=p*Math.PI,d=Math.sin(m),h=Math.cos(m);for(let f=0;f<r;f++){let b=f/e,y=(b-.5)*Math.PI*2,g=u*r+f;a[g*3]=n*d*Math.sin(y),a[g*3+1]=n*h,a[g*3+2]=-n*d*Math.cos(y),s[g*2]=b,s[g*2+1]=p}}let c=new Uint16Array(e*t*6),l=0;for(let u=0;u<t;u++)for(let p=0;p<e;p++){let m=u*r+p,d=m+r;c[l++]=m,c[l++]=d,c[l++]=m+1,c[l++]=m+1,c[l++]=d,c[l++]=d+1}return{position:a,uv:s,index:c}}function yi(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}function gi(e,t){let{position:n,uv:r,index:o}=Mc(),i=new Ue.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ue.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ue.Program(e,{vertex:Sc,fragment:wc,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new Ue.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var Ue,gc,xc,vc,Sc,wc,xi=pt(()=>{"use strict";Ue=require("ogl"),gc=64,xc=32,vc=500;Sc=`#version 300 es
1
+ "use strict";var Xi=Object.create;var Ft=Object.defineProperty;var Yi=Object.getOwnPropertyDescriptor;var Wi=Object.getOwnPropertyNames;var Ki=Object.getPrototypeOf,Qi=Object.prototype.hasOwnProperty;var bt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var so=(e,t)=>{for(var n in t)Ft(e,n,{get:t[n],enumerable:!0})},co=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wi(t))!Qi.call(e,o)&&o!==n&&Ft(e,o,{get:()=>t[o],enumerable:!(r=Yi(t,o))||r.enumerable});return e};var ot=(e,t,n)=>(n=e!=null?Xi(Ki(e)):{},co(t||!e||!e.__esModule?Ft(n,"default",{value:e,enumerable:!0}):n,e)),qi=e=>co(Ft({},"__esModule",{value:!0}),e);function Ic(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Ac(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function an(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Ac(t?.deviceMemory)}}function sn(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...r,reason:"save-data"};let o=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,u)=>c.width*c.height-u.width*u.height);if(!o.length)return{...r,upgradeUrl:e.url,reason:"progressive"};let i=o.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...r,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||Ic(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...r,reason:"memory-limit"};let s=a[a.length-1];return{...r,upgradeUrl:s.url,reason:"progressive"}}function vi(){return new DOMException("Panorama image load aborted","AbortError")}function Rt(e,t){return new Promise((n,r)=>{if(t?.aborted){r(vi());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=u=>{i||(i=!0,a(),u?r(u):n(o))},c=()=>{o.src="",s(vi())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),o.src=e})}function cn(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var eo=bt(()=>{"use strict"});function Si(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":e.coverage==="floor-representative"?"AI-generated representative floor demo":"AI-generated illustrative venue demo":e.coverage==="exact-seat"?"Exact seat photo":e.coverage==="row-representative"?"Representative row view":e.coverage==="section-representative"?"Representative section view":e.coverage==="floor-representative"?"Representative floor view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function to(e){return Math.max(Ec,Math.min(Rc,e))}function Tc(e,t,n){let r=(.5+e/360)*n;return t/2-r}function kc(e,t=un){return e*(180/t)}function Mi(e,t,n){return(e-t)/2+ln(n,t)}function ln(e,t){let n=Re/180*t;return Math.max(-n,Math.min(n,e))}function wi(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=sn(t,an()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),u=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let l=document.createElement("div");Object.assign(l.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(l);let h=document.createElement("button");if(h.type="button",h.setAttribute("aria-label","Close"),h.textContent="\u2715",Object.assign(h.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(h),n.disclosure){let _=document.createElement("div");_.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(_.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(_)}let m=document.createElement("div");m.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(m.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(m),e.appendChild(c),h.focus({preventScroll:!0});let d=0,f=0,p=0,y=0,b=un,g=()=>{let _=c.clientHeight||1,L=c.clientWidth||1,Y=I.naturalWidth||L*2,K=I.naturalHeight||_,J=d>0?(L/2-p)/d:0,Z=f>0?y/f:0;f=kc(_,b),d=f*(Y/K),l.style.backgroundSize=`${d}px ${f}px`,x?p=L/2-J*d:(p=Tc(o,L,d),y=ln((t.initialPitchDeg??0)/180*f,f),x=!0),y=ln(Z*f,f),l.style.backgroundPosition=`${p}px ${Mi(_,f,y)}px`},x=!1,S=()=>{let _=c.clientHeight||1;y=ln(y,f),l.style.backgroundPosition=`${p}px ${Mi(_,f,y)}px`},I=new Image;I.onload=g,I.src=i.initialUrl;let v=()=>{};i.upgradeUrl&&(v=cn(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(L=>!L||a.signal.aborted?null:Rt(L,a.signal).then(Y=>({full:Y,url:L}))).then(L=>{L&&(w||a.signal.aborted||(I=L.full,l.style.backgroundImage=`url("${L.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let R=!1,O=0,V=0,U=0,N=new Map,A=()=>{let[_,L]=[...N.values()];return _&&L?Math.hypot(_.x-L.x,_.y-L.y):0},M=_=>{let L=to(_);L!==b&&(b=L,g())},P=_=>{N.set(_.pointerId,{x:_.clientX,y:_.clientY}),R=N.size===1,O=_.clientX,V=_.clientY,N.size===2&&(U=A()),l.style.cursor="grabbing";try{l.setPointerCapture?.(_.pointerId)}catch{}},C=_=>{if(N.has(_.pointerId)){if(N.set(_.pointerId,{x:_.clientX,y:_.clientY}),N.size>=2){let L=A();U>0&&L>0&&M(b*(U/L)),U=L,R=!1;return}R&&(p+=_.clientX-O,y+=_.clientY-V,O=_.clientX,V=_.clientY,S())}},T=_=>{N.delete(_.pointerId),U=N.size===2?A():0;let L=N.values().next().value;R=N.size===1,L?(O=L.x,V=L.y):l.style.cursor="grab";try{l.releasePointerCapture?.(_.pointerId)}catch{}},H=_=>{_.preventDefault(),M(b+_.deltaY*.04)};l.addEventListener("pointerdown",P),l.addEventListener("pointermove",C),l.addEventListener("pointerup",T),l.addEventListener("pointercancel",T),l.addEventListener("wheel",H,{passive:!1});let k=!1,w=!1,B=0,E=()=>{l.removeEventListener("pointerdown",P),l.removeEventListener("pointermove",C),l.removeEventListener("pointerup",T),l.removeEventListener("pointercancel",T),l.removeEventListener("wheel",H),window.removeEventListener("keydown",G)},F=()=>{v(),a.abort(),n.signal?.removeEventListener("abort",s),B&&(window.clearTimeout(B),B=0),E(),c.parentNode&&c.parentNode.removeChild(c),u?.isConnected&&u.focus({preventScroll:!0})},z=()=>{if(k)return;k=!0,c.style.opacity="0";let _=()=>{B=0,!w&&(F(),n.onClose?.())};B=window.setTimeout(_,r)},G=_=>{if(_.key==="Tab"){_.preventDefault(),h.focus({preventScroll:!0});return}if(_.key==="Escape"){_.stopPropagation(),z();return}if(_.key==="ArrowLeft"||_.key==="ArrowRight")p+=_.key==="ArrowLeft"?-32:32;else if(_.key==="ArrowUp"||_.key==="ArrowDown")y+=(_.key==="ArrowUp"?4:-4)*(f/180);else if(_.key==="+"||_.key==="="){M(b-5),_.preventDefault();return}else if(_.key==="-"){M(b+5),_.preventDefault();return}else return;_.preventDefault(),S()};return window.addEventListener("keydown",G),h.addEventListener("click",z),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:z,dispose(){k=!0,w=!0,F()}}}var un,Ec,Rc,Re,no=bt(()=>{"use strict";eo();un=70,Ec=35,Rc=90;Re=35});function Dc(e=Lc,t=_c,n=Fc){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let l=0;l<o;l++){let h=l/t,m=h*Math.PI,d=Math.sin(m),f=Math.cos(m);for(let p=0;p<r;p++){let y=p/e,b=(y-.5)*Math.PI*2,g=l*r+p;a[g*3]=n*d*Math.sin(b),a[g*3+1]=n*f,a[g*3+2]=-n*d*Math.cos(b),s[g*2]=y,s[g*2+1]=h}}let c=new Uint16Array(e*t*6),u=0;for(let l=0;l<t;l++)for(let h=0;h<e;h++){let m=l*r+h,d=m+r;c[u++]=m,c[u++]=d,c[u++]=m+1,c[u++]=m+1,c[u++]=d,c[u++]=d+1}return{position:a,uv:s,index:c}}function Pi(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}function Ci(e,t){let{position:n,uv:r,index:o}=Dc(),i=new je.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new je.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new je.Program(e,{vertex:Oc,fragment:Bc,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new je.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(u){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,u))},setImage(u){a.image=u,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var je,Lc,_c,Fc,Oc,Bc,Ii=bt(()=>{"use strict";je=require("ogl"),Lc=64,_c=32,Fc=500;Oc=`#version 300 es
2
2
  precision highp float;
3
3
  in vec3 position;
4
4
  in vec2 uv;
@@ -8,7 +8,7 @@ out vec2 vUv;
8
8
  void main() {
9
9
  vUv = uv;
10
10
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
11
- }`,wc=`#version 300 es
11
+ }`,Bc=`#version 300 es
12
12
  precision highp float;
13
13
  in vec2 vUv;
14
14
  uniform sampler2D uPano;
@@ -17,15 +17,15 @@ out vec4 fragColor;
17
17
  void main() {
18
18
  vec3 rgb = texture(uPano, vUv).rgb;
19
19
  fragColor = vec4(rgb, uOpacity);
20
- }`});async function Mi(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Ee,Math.min(Ee,t?.initialPitchDeg??0)),s=cn,c=!1,l=new AbortController,u=()=>l.abort();r.signal?.addEventListener("abort",u,{once:!0});let p=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let E=n.camera.position,D=n.focalWorld[0]-E.x,z=n.focalWorld[1]-E.y,V=n.focalWorld[2]-E.z,F=Math.hypot(D,V);F>.001&&(i=Math.atan2(D,-V)*180/Math.PI,a=Math.max(-Ee,Math.min(Ee,Math.atan2(z,F)*180/Math.PI)))}let d=null;if(t){let E=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),D=rn(t,on(E)),z;try{let V=t.resolveUrl?await t.resolveUrl(D.initialUrl):D.initialUrl;if(!V)throw new Error("panorama_asset_unavailable");z=await Rt(V,l.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{d=gi(n.gl,z)}catch{return l.abort(),r.signal?.removeEventListener("abort",u),null}d.mesh.renderOrder=999,d.mesh.setParent(n.scene),D.upgradeUrl&&(p=an(()=>{(t.resolveUrl?t.resolveUrl(D.upgradeUrl):Promise.resolve(D.upgradeUrl)).then(F=>!F||l.signal.aborted?null:Rt(F,l.signal)).then(F=>{F&&(c||l.signal.aborted||(d?.setImage(F),n.requestRender()))}).catch(()=>{})}))}let h=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let f=n.camera.quaternion.slice(),b=()=>{let E=n.camera.position;d?.mesh.position.set(E.x,E.y,E.z);let[D,z,V]=yi(i,a);n.camera.lookAt([E.x+D,E.y+z,E.z+V]),n.requestRender()};b();let y=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),y.appendChild(x),r.disclosure){let E=document.createElement("div");E.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(E.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),y.appendChild(E)}let S=document.createElement("div");S.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(S.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),y.appendChild(S),e.appendChild(y),x.focus({preventScroll:!0});let I=!1,M=0,k=0,O=0,N=new Map,j=()=>{let[E,D]=[...N.values()];return E&&D?Math.hypot(E.x-D.x,E.y-D.y):0},G=E=>{let D=Zn(E);D!==s&&(s=D,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},P=E=>{E.target!==x&&(N.set(E.pointerId,{x:E.clientX,y:E.clientY}),I=N.size===1,M=E.clientX,k=E.clientY,N.size===2&&(O=j()),y.setPointerCapture?.(E.pointerId),y.style.cursor="grabbing")},v=E=>{if(N.has(E.pointerId)){if(N.set(E.pointerId,{x:E.clientX,y:E.clientY}),N.size>=2){let D=j();O>0&&D>0&&G(s*(O/D)),O=D,I=!1;return}I&&(i+=(E.clientX-M)*vi,a=Math.max(-Ee,Math.min(Ee,a+(E.clientY-k)*vi)),M=E.clientX,k=E.clientY,b())}},w=E=>{N.delete(E.pointerId),O=N.size===2?j():0;let D=N.values().next().value;I=N.size===1,D?(M=D.x,k=D.y):y.style.cursor="grab";try{y.releasePointerCapture?.(E.pointerId)}catch{}},R=E=>{E.preventDefault(),G(s+E.deltaY*.04)};y.addEventListener("pointerdown",P),y.addEventListener("pointermove",v),y.addEventListener("pointerup",w),y.addEventListener("pointercancel",w),y.addEventListener("wheel",R,{passive:!1});let T=E=>{if(!c){if(E.key==="Tab"){E.preventDefault(),x.focus({preventScroll:!0});return}if(E.key==="Escape"){E.stopPropagation(),B.close();return}if(E.key==="ArrowLeft"||E.key==="ArrowRight")i+=E.key==="ArrowLeft"?-4:4;else if(E.key==="ArrowUp"||E.key==="ArrowDown")a=Math.max(-Ee,Math.min(Ee,a+(E.key==="ArrowUp"?4:-4)));else if(E.key==="+"||E.key==="="){G(s-5),E.preventDefault();return}else if(E.key==="-"){G(s+5),E.preventDefault();return}else return;E.preventDefault(),b()}};window.addEventListener("keydown",T);let H=0,C=(E,D)=>{if(!d){D?.();return}let z=E===1?0:1,V=performance.now(),F=()=>{if(c)return;let L=o<=0?1:Math.min(1,(performance.now()-V)/o);d?.setOpacity(z+(E-z)*L),n.requestRender(),L<1?H=requestAnimationFrame(F):D?.()};H=requestAnimationFrame(F)};C(1);let A=()=>{c||(c=!0,p(),l.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(H),y.removeEventListener("pointerdown",P),y.removeEventListener("pointermove",v),y.removeEventListener("pointerup",w),y.removeEventListener("pointercancel",w),y.removeEventListener("wheel",R),window.removeEventListener("keydown",T),y.remove(),g?.isConnected&&g.focus({preventScroll:!0}),d?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:h,aspect:n.camera.aspect}),n.camera.quaternion.set(f[0],f[1],f[2],f[3]),n.requestRender())},B={close(){if(c)return;let E=()=>{A(),r.onClose?.()};cancelAnimationFrame(H),C(0,E)},dispose:A};return x.addEventListener("click",()=>B.close()),B}var vi,Si=pt(()=>{"use strict";xi();$n();qn();vi=.15});var wi={};oo(wi,{createOpenPanorama:()=>Pc});function Pc(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:p,isContextLost:m,isDisposed:d,flightGen:h,setPanorama:f,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:S,restorePanoramaLayer:I,getOverviewChip:M,labelOverlay:k,reducedMotion:O,removeArriveChip:N,showArriveChip:j}=e;return async(G,P,v)=>{b()?.abort();let w=new AbortController;y(w);let R=n.seats.idToIndex.get(G);if(R===void 0){i.syncFromCamera();return}let T=s.get(G)?.label??G,H=l(G,R),C=c(G);if(!C){w.abort(),b()===w&&y(null),i.syncFromCamera();return}x(!0),a.stop();let A;try{A=await C}catch{if(b()===w&&y(null),o.panoramaFailed(G,"source"),!d()&&v===h()){x(!1),i.resumeAfterFlight(H.focal),a.requestRender();let X=j(G,v,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(d()||v!==h()){w.abort(),b()===w&&y(null);return}N();let B=M(),E=()=>{w.abort(),b()===w&&y(null),f(null),g(!1),I(),B.style.display="",k.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(H.focal),a.requestRender();let X=j(G,h());requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())},D=A.generated===!0,z=fi(A);S(),g(!D),B.style.display="none";let V=O()?0:P,F=u(),L=F&&!m()?await Mi(t,D?null:A,{gl:p,scene:F.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:D?H.eye:void 0,focalWorld:H.focal},{fadeMs:V,seatLabel:T,disclosure:z,disclosurePrefix:D?"Live seat-eye view":"360\xB0 panorama",onClose:E,signal:w.signal}):null;if(d()||v!==h()){w.abort(),g(!1),b()===w&&y(null),L?.dispose(),B.style.display="",I();return}if(L)i.syncFromCamera(),k.setVisible(!1),x(!1),a.requestRender(),f(L);else if(D){I(),B.style.display="",x(!1),i.resumeAfterFlight(H.focal),a.requestRender(),f(null),g(!1),o.panoramaFailed(G,"mount");let X=j(G,h(),!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus()),b()===w&&y(null);return}else g(!1),o.panoramaFallback(G),f(bi(t,A,{fadeMs:V,seatLabel:T,disclosure:z,onClose:E,signal:w.signal}));o.panoramaOpened()}}var Pi=pt(()=>{"use strict";$n();Si()});var Tc={};oo(Tc,{VENUE3D_QUALITY_REPORT_VERSION:()=>jr,buildSceneModel:()=>lt,inspectVenue3DQualityEvidence:()=>Jt,mountVenue3D:()=>Ec,prepareVenue3D:()=>Fi});module.exports=Ui(Tc);var co=require("ogl");var ji=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Yi(e){let t=ji.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function te(e){let t=Yi(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function bn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Xi(e){return .2126*bn(e[0])+.7152*bn(e[1])+.0722*bn(e[2])}function io(e){return Xi([e[0]*255,e[1]*255,e[2]*255])}function Wi(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function pe(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function ft(e,t){let n=Wi(e);return pe(e,[n,n,n],t)}var xe=["available","held","sold","selected","dimmed"];function bt(e){let t=xe.indexOf(e);return t<0?0:t}var ao={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function so(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.42,r=.62;return[(t+(e[0]-t)*n)*r,(t+(e[1]-t)*n)*r,(t+(e[2]-t)*n)*r]}var yn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Ke={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ye(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Ki(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var Ft=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new co.Renderer({canvas:this.canvas,dpr:Ki(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ke.top[0],Ke.top[1],Ke.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var ot=require("ogl"),de=Math.PI/180,gn=15*de,xn=80*de,nt=.12,lo=35,uo=1.25,Dt=class{constructor(t,n,r,o){this.fovY=lo;this.target=new ot.Vec3;this.azimuth=-30*de;this.polar=55*de;this.distance=10;this.azT=-30*de;this.polT=55*de;this.distT=10;this.minDist=1;this.maxDist=100;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new ot.Vec3;this.panAnchor=new ot.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new ot.Camera(t,{fov:lo,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;let l=this.pinchCentroid();this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(gn,Math.min(xn,this.polT-s*.006)),this.requestRender())},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*de;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(gn,Math.min(xn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*de/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),u=Math.sin(this.polar),p=-i*l,m=-a*l;this.targetT.x+=(-t*s+n*p)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*u*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*de/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=r??-30*de,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*de;let u=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??uo)),this.minDist=Math.max(2,a*.12),this.maxDist=u*4,n?(this.azimuth=this.azT,this.polar=12*de,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*de/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*de;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??uo))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let l=Math.sin(i),u=-l*Math.sin(o),p=-Math.cos(i),m=-l*Math.cos(o);if(Math.abs(p)>.999)return s;let d=-m,h=u,f=Math.hypot(d,h);d/=f,h/=f;let b=-h*p,y=h*u-d*m,g=d*p,x=Math.tan(r),S=Math.tan(n),I=1;for(let M=0;M<8;M++){let k=(M&1?c.max[0]:c.min[0])-t.center[0],O=(M&2?c.max[1]:c.min[1])-t.center[1],N=(M&4?c.max[2]:c.min[2])-t.center[2],j=k*u+O*p+N*m,G=Math.abs(k*d+N*h),P=Math.abs(k*b+O*y+N*g);I=Math.max(I,G/x-j,P/S-j)}return Math.min(s,Math.max(I,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*nt,this.polar+=n*nt,this.distance+=r*nt,this.target.x+=o*nt,this.target.y+=i*nt,this.target.z+=a*nt,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,o=Math.hypot(t,n,r)||1,i=Math.max(gn,Math.min(xn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var _t=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};var rt=2.5,Qi=1.15,yt=6,it=10,mo=6,ho=9.5,po=.9,fo=2.2,vn=30,Mn=4,Ot=8192;var Gc=it+Mn;function bo(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:rt};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:rt+o*(Qi-rt)}}function yo(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function go(e,t,n,r,o){if(!(e>0)||!(t>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(o/2);return Math.PI*a*a/e>=64}var qi=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],zc=new Map(qi.map(e=>[e.key,e]));var Zi={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function xo(e){let t=e?.[0];return t&&Zi[t]||"#3b82f6"}var $i=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],Hc=new Map($i.map(e=>[e.key,e]));var Ji=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Uc=new Set(Ji);var Mo=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],So=Mo.map(e=>e.key),ea=new Map(Mo.map(e=>[e.key,e]));function vo(e){return typeof e=="string"&&ea.has(e)}function wo(e,t){return vo(e)?e:vo(t?.seatGlyph)?t.seatGlyph:"circle"}var Ae=.02291666666666667,Ne=1/Ae,ta=58,na=ta*Ae;var oa=3,Po=0,Sn=120,ra=0,ia=45,aa=7,Bt=1.2;function wn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function sa(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=aa?e:oa}function Co(e,t={}){let n=wn(t.floorBaseHeightM,Po,Sn,0),r=Math.min(Sn,n+sa(e.elevation)*na),o=e.height===void 0?r:wn(e.height,Po,Sn,r),i=wn(e.rake,ra,ia,0);return{height:o,rake:i}}var Ro=tt(require("earcut"),1),Io=tt(require("polygon-clipping"),1);var Qc=Math.PI/180;function Pn(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function gt(e){return e.length?Pn(e):null}function Qe(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function xt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var _=Ae,ca=.002;function la(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.max(r,o,i);if(a<1e-9)return!0;let s=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-i)))/a<ca}var qe=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Vt=class{constructor(){this.pos=new qe;this.nor=new qe;this.col=new qe;this.flr=new qe;this.mat=new qe;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){la(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,r,o,i,a,s,c=s,l=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function ua(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],l=o*c-i*s,u=i*a-r*c,p=r*s-o*a,m=Math.hypot(l,u,p)||1;return l/=m,u/=m,p/=m,[l,u,p]}function da(e,t){let n=[...e],r=[];for(let a of e)r.push(a.x,a.y);let o=[];if(t){for(let a of t)if(!(a.length<3)){o.push(n.length);for(let s of a)n.push(s),r.push(s.x,s.y)}}let i=(0,Ro.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Cn(e){return Qe(e)<0?[...e].reverse():e}var ma=3;function ha(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(d,h,f,b)=>Math.abs(r({x:(d.x+h.x)/2,y:(d.y+h.y)/2})-(f+b)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(o+i+a)/3,p=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:l})-u)),m=(d,h,f)=>{let b=Math.abs(r({x:(d+c)/2,y:(h+l)/2})-(f+u)/2);b>p&&(p=b)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),p}function vt(e,t,n,r,o){if(o<=0)return ha(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},s={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(vt(e,i,s,r,o-1),vt(i,t,a,r,o-1),vt(s,a,n,r,o-1),vt(i,a,s,r,o-1))}function Mt(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},d={x:(n.x+r.x)/2,y:(n.y+r.y)/2},h={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Mt(e,t,m,h,o,i,a-1,s),Mt(e,m,n,d,o,i,a-1,s),Mt(e,h,d,r,o,i,a-1,s),Mt(e,m,d,h,o,i,a-1,s);return}let c=[t.x*_,o(t),t.y*_],l=[n.x*_,o(n),n.y*_],u=[r.x*_,o(r),r.y*_];if(s){e.triN(c,l,u,s(t),s(n),s(r),i);return}let p=ua(c,l,u);p[1]<0&&(p=[-p[0],-p[1],-p[2]]),e.tri(c,l,u,p,i)}var pa=8;function Ao(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,l)=>{if(l>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},p=t(u);if(Math.abs(p-(s+c)/2)>n){o(i,u,s,p,l-1),o(u,a,p,c,l-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),pa)}return r}function Nt(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,l=s.y-i.y,u=Math.hypot(c,l);u>t&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/u<t||r.push(a)}return r.length>=3?r:n}var Gt=.001*Ne*.1;function se(e,t,n,r,o,i,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Qe(t))<1e-4))return;let u=Nt(Ao(Nt(Cn(t),Gt),r,c),Gt),p=n?.map(M=>Nt(Ao(Nt(Cn(M),Gt),r,c),Gt)).filter(M=>M.length>=3&&Math.abs(Qe(M))>=1e-4),{pts:m,tris:d}=da(u,p),h=[i[0]*s.top,i[1]*s.top,i[2]*s.top],f=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<ma;g++){let M=0;for(let k=0;k<d.length;k+=3){let O=vt(m[d[k]],m[d[k+1]],m[d[k+2]],r,g);O>M&&(M=O)}if(M<=c)break}for(let M=0;M<d.length;M+=3){let k=m[d[M]],O=m[d[M+1]],N=m[d[M+2]];Mt(e,k,O,N,r,h,g,l);let j=[k.x*_,o,k.y*_],G=[O.x*_,o,O.y*_],P=[N.x*_,o,N.y*_];e.tri(j,P,G,[0,-1,0],f)}let x=M=>{if(g<=0)return M;let k=1<<g,O=[];for(let N=0;N<M.length;N++){let j=M[N],G=M[(N+1)%M.length];for(let P=0;P<k;P++){let v=P/k;O.push({x:j.x+(G.x-j.x)*v,y:j.y+(G.y-j.y)*v})}}return O},S=Pn(u),I=[{ring:x(u),flip:!1}];if(p)for(let M of p)M.length>=3&&I.push({ring:x(M),flip:!0});for(let{ring:M,flip:k}of I)for(let O=0;O<M.length;O++){let N=M[O],j=M[(O+1)%M.length],G=(j.x-N.x)*_,v=(j.y-N.y)*_,w=-G,R=Math.hypot(v,w)||1;v/=R,w/=R;let T=(N.x+j.x)/2-S.x,H=(N.y+j.y)/2-S.y,C=v*T+w*H;k&&(C=-C),C<0&&(v=-v,w=-w);let A=[v,0,w],B=[N.x*_,r(N),N.y*_],E=[j.x*_,r(j),j.y*_],D=[N.x*_,o,N.y*_],z=[j.x*_,o,j.y*_];e.tri(B,E,z,A,b,b,y),e.tri(B,z,D,A,b,y,y)}}function Eo(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:t}}function zt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Cn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],u=l.x-c.x,p=l.y-c.y,m=Math.hypot(u,p)||1;i.push({x:p/m,y:-u/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],u=i[s],p=l.x+u.x,m=l.y+u.y,d=Math.hypot(p,m),h=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+u.x*t,c.y+u.y*t])};if(d<1e-9){h();continue}p/=d,m/=d;let f=p*l.x+m*l.y,b=1/Math.max(f,1e-6);if(!Number.isFinite(b)||b>n){h();continue}a.push([c.x+p*t*b,c.y+m*t*b])}if(a.length<3)return e;try{let s=Io.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let p of s){let m=Math.abs(Qe(p[0].map(([d,h])=>({x:d,y:h}))));m>l&&(l=m,c=p[0])}if(!c)return e;let u=c.map(([p,m])=>({x:p,y:m}));if(u.length>1){let p=u[0],m=u[u.length-1];Math.abs(p.x-m.x)<1e-9&&Math.abs(p.y-m.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function Ht(e,t,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+r*Math.sin(s)})}return i}function St(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ie={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},fa=.44,ba=.15,ya=.3,ga=.24;function To(e){return e===void 0||!Number.isFinite(e)||e<=0?ga:Math.min(ya,Math.max(ba,e*fa))}var An=.21,xa=.05,Rn=.45,Ut=Rn+xa,va=[{part:ie.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ie.pad,min:[-1,.36,-.95],max:[1,Rn,1]},{part:ie.back,min:[-1,Ut,-1],max:[1,.92,-.72]},{part:ie.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ie.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ie.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ie.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ie.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ie.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ie.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Ma=[{part:ie.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ie.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ie.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ie.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ie.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Sa=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function ko(){let e=[],t=[],n=[],r=[],o=(R,T,H)=>{let C=n.length,[A,B,E]=R,D=[B[0]-A[0],B[1]-A[1],B[2]-A[2]],z=[E[0]-A[0],E[1]-A[1],E[2]-A[2]],V=D[1]*z[2]-D[2]*z[1],F=D[2]*z[0]-D[0]*z[2],L=D[0]*z[1]-D[1]*z[0],X=Math.hypot(V,F,L);X>1e-9?(V/=X,F/=X,L/=X):[V,F,L]=T,V*T[0]+F*T[1]+L*T[2]<0&&(V=-V,F=-F,L=-L);for(let K of R)e.push(...K),t.push(V,F,L),n.push(H);r.push(C,C+1,C+2,C,C+2,C+3)},i=R=>{for(let T of Sa){let H=T.c.map(C=>C.map((A,B)=>A?R.max[B]:R.min[B]));o(H,T.n,R.part)}};for(let R of va)i(R);for(let R of Ma)i(R);let a=Rn,s=1.08,c=.47,l=.69,u=-.55,p=.08,m=-.48,d=.01,h=[-c,a,u],f=[c,a,u],b=[-c,a,p],y=[c,a,p],g=[-l,s,m],x=[l,s,m],S=[-l,s,d],I=[l,s,d];o([f,x,I,y],[1,0,0],ie.body),o([b,S,g,h],[-1,0,0],ie.body),o([S,I,x,g],[0,1,0],ie.body),o([h,f,y,b],[0,-1,0],ie.body),o([y,I,S,b],[0,0,1],ie.body),o([h,g,x,f],[0,0,-1],ie.body);let M=10,k=8,O=[0,1.205,-.23],N=[.42,.115,.38],j=n.length;for(let R=0;R<=k;R++){let T=Math.PI*R/k,H=Math.cos(T),C=Math.sin(T);for(let A=0;A<=M;A++){let B=Math.PI*2*A/M,E=C*Math.cos(B),D=C*Math.sin(B);e.push(O[0]+N[0]*E,O[1]+N[1]*H,O[2]+N[2]*D);let z=E/N[0],V=H/N[1],F=D/N[2],L=Math.hypot(z,V,F)||1;z/=L,V/=L,F/=L,t.push(z,V,F),n.push(ie.head)}}for(let R=0;R<k;R++)for(let T=0;T<M;T++){let H=j+R*(M+1)+T,C=H+M+1;r.push(H,C,H+1,H+1,C,C+1)}let G=new Float32Array(e),P=new Float32Array(t),v=new Float32Array(n),w=new Uint16Array(r);return{position:G,normal:P,part:v,index:w,vertexCount:n.length,indexCount:r.length}}function Lo(e,t,n,r){let o=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,u)=>{let p=u-l;for(let m=l;m<u;m++){let[d,h]=r(m),f=d-i(m),b=h-a(m);if(p>=2){let y=Math.max(l,m-1),g=Math.min(u-1,m+1),x=i(g)-i(y),S=a(g)-a(y),I=Math.hypot(x,S);if(I>1e-6){let M=-S/I,k=x/I;M*f+k*b<0&&(M=-M,k=-k),f=M,b=k}}o[m]=f===0&&b===0?0:Math.atan2(f,b)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var Te=.22;function Fo(e,t){let n=xe[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var wa=.42;function Pa(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let h of e)h.x<r&&(r=h.x),h.y<o&&(o=h.y),h.x>i&&(i=h.x),h.y>a&&(a=h.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/l)+1),p=Math.max(1,Math.ceil(c/l)+1),m=new Map,d=(h,f)=>{let b=Math.min(u-1,Math.max(0,Math.floor((h-r)/l)));return Math.min(p-1,Math.max(0,Math.floor((f-o)/l)))*u+b};for(let h=0;h<t;h++){let f=d(e[h].x,e[h].y),b=m.get(f);b?b.push(h):m.set(f,[h])}for(let h=0;h<t;h++){let f=e[h],b=Math.min(u-1,Math.max(0,Math.floor((f.x-r)/l))),y=Math.min(p-1,Math.max(0,Math.floor((f.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let S=y-x;S<=y+x;S++)if(!(S<0||S>=p))for(let I=b-x;I<=b+x;I++){if(I<0||I>=u||x>1&&Math.abs(S-y)<x&&Math.abs(I-b)<x)continue;let M=m.get(S*u+I);if(M)for(let k of M){if(k===h)continue;let O=Math.hypot(e[k].x-f.x,e[k].y-f.y);O<g&&(g=O)}}if(Number.isFinite(g)&&g<=x*l)break}n[h]=g}return n}function Ca(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Bt):0}function Do(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),u=new Float32Array(a),p=new Float32Array(a),m=new Float32Array(a),d=new Float32Array(a),h=new Float32Array(a*3),f=new Map,b=Pa(e);for(let y=0;y<a;y++){let g=e[y],S=(n?.seatPitchU(y)??b[y])*_;u[y]=Number.isFinite(S)?Math.max(.06,Math.min(Te,S*wa)):Te,p[y]=To(Number.isFinite(S)?S:void 0);let I=wo(g.glyph,{seatGlyph:i?.get(g.categoryKey)});m[y]=So.indexOf(I),d[y]=g.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=g.x*_,s[y*3+1]=n?n.seatDeckY(y):Ca(g),s[y*3+2]=g.y*_,c[y]=bt(t?t(g):"available");let M=te(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[y*3]=M[0],l[y*3+1]=M[1],l[y*3+2]=M[2],g.accessibility?.length){let k=te(xo(g.accessibility));k&&(h[y*3]=k[0],h[y*3+1]=k[1],h[y*3+2]=k[2])}f.set(g.id,y)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:h,idToIndex:f,iChairWidth:p,iGlyph:m,iPhysicalSeat:d,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var Aa=64;function In(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=bt(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+Aa){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var Ra=.15,Ia=.9,Ea=1.76,Ta=.7,ka=1.6;function La(){return{background:{top:[...Ke.top],bottom:[...Ke.bottom]},structure:yn,seatStates:{...ao},seatScale:1}}function _o(e){let t=La();if(!e)return t;let n=te(e.background);if(n){t.background={top:ye(n,Ia),bottom:ye(n,Ea)};let i={};for(let[a,s]of Object.entries(yn))i[a]=pe(s,n,Ra);t.structure=i}let r=te(e.selectionColor)??te(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(ka,Math.max(Ta,o))),t}function Oo(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Bo(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function at(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function Fa(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function No(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function En(e,t){let n=1/0;for(let r of Bo(e)){let o=at(t,r.x,r.y);o<n&&(n=o)}for(let r of Bo(t)){let o=at(e,r.x,r.y);o<n&&(n=o)}return n}function Da(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let u of e)n+=u.x,r+=u.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let u of e){let p=Math.hypot(u.x-n,u.y-r);p>o&&(o=p,i=u)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((u,p)=>({p:u,i:p,t:(u.x-n)*a+(u.y-r)*s})).sort((u,p)=>u.t-p.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function Tn(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let g of e)n+=g.x,r+=g.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,l=0,u=0;for(let g of e){let x=g.x-n,S=g.y-r;o+=x*x,a+=S*S,i+=x*S,s+=x*x*x,c+=S*S*S,l+=x*S*S,u+=S*x*x}let p=o*a-i*i;if(Math.abs(p)<1e-9)return null;let m=(s+l)/2,d=(c+u)/2,h=(m*a-d*i)/p,f=(d*o-m*i)/p,b=h+n,y=f+r;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var _a=.15;function Oa(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,S=0;for(let I of g.pts)x+=I.x,S+=I.y;return{x:x/g.pts.length,y:S/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let g of t){let x=g.x-n,S=g.y-r;o+=x*x,i+=x*S,a+=S*S}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,p;Math.abs(i)>1e-12?(u=l-a,p=i):o>=a?(u=1,p=0):(u=0,p=1);let m=Math.hypot(u,p);if(!(m>1e-12))return null;u/=m,p/=m;let d=1/0,h=-1/0,f=[];for(let g of e){let x=1/0,S=-1/0;for(let I of g.pts){let M=I.x*u+I.y*p;M<x&&(x=M),M>S&&(S=M),M<d&&(d=M),M>h&&(h=M)}f.push(S-x)}let b=h-d;return b>1e-9?(f.sort((g,x)=>g-x),f[Math.min(f.length-1,Math.floor(f.length*.9))]/b<=Ba?{x:u,y:p}:null):null}var Ba=.35;function Go(e,t,n,r){let o=new Map;for(let b of n){let y=t[b],g=y.rowId||`__seat-${b}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:y.x,y:y.y}),x.idx.push(b)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,y]of o){let g=Da(y.pts,y.idx),x=0;for(let S of g.pts)x+=Math.hypot(S.x-r.x,S.y-r.y);i.push({id:b,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(b=>Fa(b.pts)),s=[];for(let b=0;b<i.length;b++){let y=1/0;for(let g=0;g<i.length;g++){if(b===g||No(a[b],a[g])>=y)continue;let x=En(i[b].pts,i[g].pts);x<y&&(y=x)}Number.isFinite(y)&&s.push(y)}s.sort((b,y)=>b-y);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),u=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let y=b+1;y<i.length;y++)No(a[b],a[y])>l||En(i[b].pts,i[y].pts)<=l&&(u[b].push(y),u[y].push(b));let p=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let y=p++,g=[b];for(i[b].blockId=y;g.length;){let x=g.pop();for(let S of u[x])i[S].blockId===-1&&(i[S].blockId=y,g.push(S))}}let m=new Map;for(let b of i){let y=m.get(b.blockId)??[];y.push(b),m.set(b.blockId,y)}let d=[];for(let b of i){if(b.pts.length<4)continue;let y=Tn(b.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||d.push({x:y.cx,y:y.cy}))}let h=d.length>=2?(()=>{let b=d.map(x=>x.x).sort((x,S)=>x-S),y=d.map(x=>x.y).sort((x,S)=>x-S),g=Math.floor(d.length/2);return{cx:b[g],cy:y[g]}})():null;if(h){let b=M=>Math.hypot(M.x-h.cx,M.y-h.cy),y=1/0,g=-1/0,x=[];for(let M of i){let k=1/0,O=-1/0;for(let N of M.pts){let j=b(N);j<k&&(k=j),j>O&&(O=j)}x.push(O-k),k<y&&(y=k),O>g&&(g=O)}let S=g-y;x.sort((M,k)=>M-k);let I=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(S>1e-9&&I/S<=_a){let M=i.map(T=>{let H=0;for(let C of T.pts)H+=b(C);return{row:T,radius:H/T.pts.length}}),k=0,O=0;for(let T of M)k+=T.radius,O+=T.row.focalDistance;k/=M.length,O/=M.length;let N=0;for(let T of M)N+=(T.radius-k)*(T.row.focalDistance-O);if(N<0)for(let T of M)T.radius=-T.radius;let G=1/0;for(let T of M)T.radius<G&&(G=T.radius);M.sort((T,H)=>T.radius-H.radius);let P=-1,v=-1/0,w=S/Math.max(1,M.length)*.5,R=[];for(let T of M)T.radius-v>w&&(P++,v=T.radius),T.row.ordinal=P,T.row.blockDepth=T.radius-G,R.push(T.row);return{sectionId:e,rows:R,blockCount:p}}}let f=[];for(let[,b]of m){let y=Oa(b);if(y){let g=S=>{let I=0;for(let M of S.pts)I+=M.x*y.x+M.y*y.y;return I/S.pts.length};b.sort((S,I)=>g(S)-g(I)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let x=0;for(let S=0;S<b.length;S++)S>0&&(x+=En(b[S-1].pts,b[S].pts)),b[S].ordinal=S,b[S].blockDepth=x,f.push(b[S])}else{let g=1/0;for(let x of b)x.focalDistance<g&&(g=x.focalDistance);b.sort((x,S)=>x.focalDistance-S.focalDistance);for(let x=0;x<b.length;x++)b[x].ordinal=x,b[x].blockDepth=Math.max(0,b[x].focalDistance-g),f.push(b[x])}}return{sectionId:e,rows:f,blockCount:p}}var pl=Math.PI/180;function Vo(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function Na(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function kn(e,t,n){return Vo(e,t)&&!(n??[]).some(r=>Vo(e,r)||Na(e,r))}function Ga(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function Va(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let d of e)n+=d.x,r+=d.y,o+=Math.hypot(d.x-t.x,d.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let d of e){let h=Math.hypot(d.x-n,d.y-r);h>s&&(s=h,a=d)}let c=a.x-n,l=a.y-r,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let p=[...e].sort((d,h)=>(d.x-n)*c+(d.y-r)*l-((h.x-n)*c+(h.y-r)*l)),m=0;for(let d of p){let h=Math.hypot(d.x-n,d.y-r);h>m&&(m=h)}return{pts:p,cx:n,cy:r,radius:m,depth:o}}function zo(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,p=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;p<0?p=0:p>1&&(p=1);let m=Math.hypot(t-(a.x+p*c),n-(a.y+p*l));m<o&&(o=m)}return o}var jt=8;function za(e,t,n){let r=new Array(jt).fill(1/0),o=new Array(jt).fill(-1);for(let u=0;u<e.length;u++){let p=e[u],m=Math.hypot(t-p.cx,n-p.cy)-p.radius;for(let d=0;d<jt;d++)if(m<r[d]){for(let h=jt-1;h>d;h--)r[h]=r[h-1],o[h]=o[h-1];r[d]=m,o[d]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of o){if(u<0)continue;let p=zo(e[u],t,n);for(let m=0;m<3;m++)if(p<i[m]){for(let d=2;d>m;d--)i[d]=i[d-1],a[d]=a[d-1];i[m]=p,a[m]=u;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,l=0;for(let u=0;u<3;u++){let p=a[u];if(p<0||i[u]>s)continue;let m=1/(i[u]*i[u]);c+=m*e[p].depth,l+=m}return l>0?c/l:e[a[0]].depth}function Ha(e){let t=(r,o)=>za(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let l=zo(c,r,o);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function Ho(e,t){let n=[];for(let r of e){let o=Va(r.points,t);o&&n.push(o)}return n.length<2?Ga(t):(n.sort((r,o)=>r.depth-o.depth),Ha(n))}var Dn=tt(require("polygon-clipping"),1);var Xo=tt(require("earcut"),1);var Ua=.58,Uo=.01,ge=Te*1.5*Ne,ja=.5,Ya=.6;function Xa(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],l=c.x-s.x,u=c.y-s.y,p=Math.hypot(l,u);if(p<1e-9){r.push([0,0]);continue}l/=p,u/=p,r.push([-u,l])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function Wa(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,l=s.y-a.y,u=Math.hypot(c,l)||1;return{x:c/u,y:l/u}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var jo=Math.PI/12;function Ka(e){if(e.length<3)return[...e];let t=[...e].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function Wo(e,t){if(!e.length||!(t>0))return[];let n=Ka(e),r=(s,c,l,u)=>{let p=l-c;for(;p<0;)p+=Math.PI*2;for(;p>Math.PI*2;)p-=Math.PI*2;let m=Math.max(1,Math.ceil(p/jo)),d=t/Math.cos(p/m/2);for(let h=0;h<=m;h++){let f=c+p*h/m;u.push({x:s.x+Math.cos(f)*d,y:s.y+Math.sin(f)*d})}};if(n.length<3){let s=0,c=0;for(let d of n)s+=d.x,c+=d.y;s/=n.length||1,c/=n.length||1;let l=0;for(let d of n)l=Math.max(l,Math.hypot(d.x-s,d.y-c));let u=[],p=Math.max(3,Math.ceil(Math.PI*2/jo)),m=(l+t)/Math.cos(Math.PI/p);for(let d=0;d<p;d++){let h=d/p*Math.PI*2;u.push({x:s+Math.cos(h)*m,y:c+Math.sin(h)*m})}return u}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return $o(a)}function Qa(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function Yt(e){let t=e.map(o=>{let i=0,a=0;for(let l of o.pts)i+=l.x,a+=l.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let l of o.pts){let u=Math.hypot(l.x-i,l.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let u of i){let p=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let d=t[m],h=Math.hypot(u.x-d.cx,u.y-d.cy)-d.rad;if(h>=p&&h>=s)continue;let f=Qa(e[m].pts,u.x,u.y);f<p&&(p=f),e[m].depth<e[o].depth&&f<s&&(s=f,c=e[m].y)}Number.isFinite(p)&&p>0&&a.push(p)}a.sort((u,p)=>u-p);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function Ko(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],p=u.x-r.x,m=u.y-r.y,d=Math.hypot(p,m)||1;p/=d,m/=d;let h=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+m*h,y:u.y-p*h},{x:u.x-m*h,y:u.y+p*h}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let p=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);p>1e-6&&(a+=p,s++)}let c=s>0?a/s:0,l=Wa(i,Math.max(c*Ya,ge));return{pts:l,nrm:Xa(l,r),front:Math.max(n[t].pitch*Ua,ge),back:Math.max(n[t].pitch*ja,ge)}}var st=1.5,Qo=.3;function Ln(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let p=1;p<e.length-1;p++){let m=e[p],d=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);d>s&&(s=d,c=p)}if(s<=t||c<0)return[n,r];let l=Ln(e.slice(0,c+1),t),u=Ln(e.slice(c),t);return[...l.slice(0,-1),...u]}function qo(e,t){if(e.length<4)return e;let n=Ln([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Zo(e,t,n){if(e.length<2)return[];let r=n??Yt(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let g of a){let x=e[g].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,x)=>e[g].depth-e[x].depth);let l=s.map(g=>Ko(e,g,r,t)).filter(g=>g!==null);if(!l.length)continue;let u=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+st),y:g.pts[x].y-g.nrm[x][1]*(g.front+st)}),p=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+st),y:g.pts[x].y+g.nrm[x][1]*(g.back+st)}),m=l[0],d=l[l.length-1],h=[];for(let g=0;g<m.pts.length;g++)h.push(u(m,g));for(let g of l)h.push(p(g,g.pts.length-1));for(let g=d.pts.length-1;g>=0;g--)h.push(p(d,g));for(let g=l.length-1;g>=0;g--)h.push(u(l[g],0));let f=$o(h),b=1/0;for(let g of s)e[g].y<b&&(b=e[g].y);if(!Number.isFinite(b))continue;if(f.length>=3&&Math.abs(Qe(f))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return xt(f,x.x,x.y)})){i.push({outline:qo(f,Qo),holes:[],topY:b});continue}for(let g of qa(l))i.push({outline:g,holes:[],topY:b})}return i}function qa(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+st,a=n.back+st;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];r.push([l.x-u[0]*i,l.y-u[1]*i]),o.push([l.x+u[0]*a,l.y+u[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=Dn.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,l])=>({x:c,y:l})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(qo(i,Qo))}return r}catch{return[]}}function $o(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var Fn=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!xt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Yo(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],u=r[0];for(let p=1;p+1<r.length;p++){let m=r[p],d=r[p+1];e.tri([u.x*_,o,u.y*_],[m.x*_,o,m.y*_],[d.x*_,o,d.y*_],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=Dn.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let u=l[0],p=[],m=[];for(let h=0;h<u.length-1;h++)p.push(u[h][0],u[h][1]),m.push([u[h][0],u[h][1]]);if(m.length<3)continue;let d=(0,Xo.default)(p,void 0,2);for(let h=0;h<d.length;h+=3){let f=m[d[h]],b=m[d[h+1]],y=m[d[h+2]];e.tri([f[0]*_,o,f[1]*_],[b[0]*_,o,b[1]*_],[y[0]*_,o,y[1]*_],c,i)}}}function Jo(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??Yt(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(d=>[d.x,d.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new Fn([[...i]]):null,p=d=>{e.setMaterial(2),d(),e.setMaterial(0)},m=d=>{e.setMaterial(3),d(),e.setMaterial(0)};for(let d=0;d<t.length;d++){let h=t[d];if(h.patch&&h.patch.length>=3){let I=[...h.patch],M=s[d].belowY??r;if(m(()=>{if(l&&u)Yo(e,l,u,I,h.y,o.tread);else{let k=I[0];for(let O=1;O+1<I.length;O++){let N=I[O],j=I[O+1];e.tri([k.x*_,h.y,k.y*_],[N.x*_,h.y,N.y*_],[j.x*_,h.y,j.y*_],c,o.tread)}}}),h.y>M+Uo){let k=0,O=0;for(let N of I)k+=N.x,O+=N.y;k/=I.length,O/=I.length,p(()=>{for(let N=0;N<I.length;N++){let j=I[N],G=I[(N+1)%I.length],P=G.x-j.x,v=G.y-j.y,w=Math.hypot(P,v);if(w<1e-6)continue;let R=v/w,T=-P/w;(j.x-k)*R+(j.y-O)*T<0&&(R=-R,T=-T);let H=[R,0,T],C=[j.x*_,h.y,j.y*_],A=[G.x*_,h.y,G.y*_],B=[j.x*_,M,j.y*_],E=[G.x*_,M,G.y*_];e.tri(C,A,E,H,o.riser),e.tri(C,E,B,H,o.riser)}})}continue}let f=Ko(t,d,s,n);if(!f)continue;let{pts:b,nrm:y,front:g,back:x}=f,S=s[d].belowY??r;for(let I=0;I+1<b.length;I++){let M=b[I],k=b[I+1],O=y[I],N=y[I+1];if(Math.hypot(k.x-M.x,k.y-M.y)<1e-6||O[0]===0&&O[1]===0||N[0]===0&&N[1]===0)continue;let j=[(M.x-O[0]*g)*_,h.y,(M.y-O[1]*g)*_],G=[(k.x-N[0]*g)*_,h.y,(k.y-N[1]*g)*_],P=[(M.x+O[0]*x)*_,h.y,(M.y+O[1]*x)*_],v=[(k.x+N[0]*x)*_,h.y,(k.y+N[1]*x)*_];if(m(()=>{l&&u?Yo(e,l,u,[{x:M.x-O[0]*g,y:M.y-O[1]*g},{x:k.x-N[0]*g,y:k.y-N[1]*g},{x:k.x+N[0]*x,y:k.y+N[1]*x},{x:M.x+O[0]*x,y:M.y+O[1]*x}],h.y,o.tread):(e.tri(j,G,v,c,o.tread),e.tri(j,v,P,c,o.tread))}),h.y>S+Uo){let w=[j[0],S,j[2]],R=[G[0],S,G[2]],T=[-O[0],0,-O[1]];p(()=>{e.tri(j,G,R,T,o.riser),e.tri(j,R,w,T,o.riser)})}}}}function er(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function Xt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var _n=tt(require("polygon-clipping"),1);function Za(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function tr(e,t){return e.filter(n=>n.type!=="shape"||Za(n,t))}function nr(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:tr(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:tr(e.objects,t),focal:n,baseHeightM:0,index:0}]}var $a={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function ct(e){return er(e)??$a}function or(e,t){let n=zt(e.outline,ge),r=ct(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&Xt(r,ct(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=_n.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,p])=>({x:u,y:p}));if(l.length>1){let u=l[0],p=l[l.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function rr(e,t){if(!t.length)return e;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=t.map(i=>[n(i)]),o=[];for(let i of e){let a;try{a=_n.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([l,u])=>({x:l,y:u}));if(c.length>1){let l=c[0],u=c[c.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var Ja=.05,ir=.05,es=.15,On=25;function ar(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,l=[],u=new Set;for(let m=0;m<e.length;m+=1){let d=e[m];for(let h of d.objects){if(h.type==="table"&&u.add(h.id),h.type!=="section"||!h.outline||h.outline.length<3)continue;let f=zt(h.outline,ge);c.set(h.id,{section:h,unit:d,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:h.id,floorIndex:m,box:ct(f),section:h,unit:d,outline:f})}}let p=new Map;for(let m of l){let d=p.get(m.floorIndex);d?d.push(m):p.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let d=t[m],h=n?p.get(n[m])??[]:l,f=d.sectionId?h.find(y=>y.id===d.sectionId)??h.find(y=>y.section.logicalSectionId===d.sectionId&&kn({x:d.x,y:d.y},y.outline,y.section.holes)):void 0,b=f?[f]:h;for(let y of b){if(n&&y.floorIndex!==n[m]||!f&&(d.x<y.box.minX||d.x>y.box.maxX||d.y<y.box.minY||d.y>y.box.maxY||!kn({x:d.x,y:d.y},y.outline,y.section.holes)))continue;o[m]=y.id;let g=c.get(y.id);g.hasSeats=!0;let x=d.focalPoint??y.unit.focal,S=Math.hypot(d.x-x.x,d.y-x.y);S<g.frontU&&(g.frontU=S),g.seatIndices.push(m);let I=d.rowId||`__seat-${m}`,M=g.rows.get(I);M?M.push({x:d.x,y:d.y}):g.rows.set(I,[{x:d.x,y:d.y}]);break}}for(let[m,d]of c){let h=Co(d.section,{floorBaseHeightM:d.unit.baseHeightM}),f=d.unit.baseHeightM,b=h.rake>0?Math.tan(h.rake*Math.PI/180):0,y=h.rake<=.01&&h.height<=f+.001,g=d.section.surfaceKind,x=g==="flat"?!0:g==="rakedRows"&&h.rake>.01?!1:y,S=d.hasSeats?Go(m,t,d.seatIndices,d.unit.focal):{sectionId:m,rows:[],blockCount:0},M=S.rows.length<2?Ho([...d.rows.values()].map(C=>({points:C})),d.unit.focal):null,k=1/0;if(M){if(d.hasSeats)for(let C of d.rows.values())for(let A of C){let B=M.depthAt(A.x,A.y);B<k&&(k=B)}if(!d.hasSeats||!Number.isFinite(k)){k=1/0;for(let C of d.section.outline){let A=M.depthAt(C.x,C.y);A<k&&(k=A)}}}let O=f+Ja,N=Math.max(O,h.height),j=C=>{let A=Math.max(0,C-k)*Ae,B=Math.min(A*b,On);return Math.max(O,h.height+B)},G=C=>{let A=Math.max(0,C)*Ae,B=Math.min(A*b,On);return Math.max(O,h.height+B)},P=x?[]:S.rows.map(C=>({pts:C.pts,y:G(C.blockDepth),depth:C.blockDepth,blockId:C.blockId,...u.has(C.id)?{patch:Wo(C.pts,ge)}:{}})),v=P.length?P[0].y:N,w=P.map(C=>{let A=C.patch&&C.patch.length>=3?C.patch:C.pts,B=0,E=0;for(let V of A)B+=V.x,E+=V.y;let D=A.length||1;B/=D,E/=D;let z=0;for(let V of A){let F=Math.hypot(V.x-B,V.y-E);F>z&&(z=F)}return{cx:B,cy:E,rad:z}}),R=x?()=>N:P.length>=2?(C,A)=>{let B=1/0,E=v;for(let D=0;D<P.length;D++){let z=w[D];if(Math.hypot(C-z.cx,A-z.cy)-z.rad>=B)continue;let V=P[D].patch,F=V&&V.length>=3?xt(V,C,A)?0:at(V,C,A):at(P[D].pts,C,A);F<B&&(B=F,E=P[D].y)}return E}:(C,A)=>M?j(M.depthAt(C,A)):N,T=[0,1,0],H=P.length>=2||x?()=>T:(C,A)=>{if(!M)return T;let B=M.depthAt(C,A);if(B<=k)return T;let E=(B-k)*Ae;if(E*b>=On||h.height+E*b<=O)return T;let[D,z]=M.gradientAt(C,A);if(D===0&&z===0)return T;let V=1/Math.hypot(b,1);return[-D*b*V,V,-z*b*V]};if(!x)for(let C of S.rows){let A=G(C.blockDepth);for(let B of C.seatIndices)a[B]=A}for(let C of S.rows){let A=[];for(let V=1;V<C.pts.length;V++){let F=Math.hypot(C.pts[V].x-C.pts[V-1].x,C.pts[V].y-C.pts[V-1].y);F>1e-6&&A.push(F)}A.sort((V,F)=>V-F);let B=A.length?A[Math.floor(A.length/2)]:1/0,E=1/0,D=C.pts[Math.floor(C.pts.length/2)];if(D)for(let V of S.rows){if(V===C||V.blockId!==C.blockId)continue;let F=at(V.pts,D.x,D.y);F>1e-6&&F<E&&(E=F)}let z=Math.min(B,Math.max(E,B*.5));if(Number.isFinite(z)&&z>0)for(let V of C.seatIndices)s[V]=z}r.set(m,{sectionId:m,deckAt:R,normalAt:H,flat:x,bottomY:f,rowLevels:P,landingY:v})}for(let m=0;m<t.length;m++){let d=o[m],h=t[m];if(d){let b=a[m];i[m]=(b??r.get(d).deckAt(h.x,h.y))+es;continue}let f=h.eyeHeightM;i[m]=Number.isFinite(f)?Math.max(0,f-Bt):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var ae={top:1,wallBottom:.5,bottomCap:.4};function ke(e,t){if(!e)return t;let n=ye(ft(e,.4),.62);return pe(t,n,.72)}function sr(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,l=0,u=0;for(let[p,m]of a){let d=te(n.get(p));d&&(s+=d[0]*m,c+=d[1]*m,l+=d[2]*m,u+=m)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function cr(e,t){return te(e.color)??t.get(e.logicalSectionId??e.id)??null}var Gl=Math.PI*2;function lr(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var ur=tt(require("polygon-clipping"),1);function ts(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Wt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=ct(t),i=this.rings.filter((c,l)=>Xt(o,this.boxes[l])&&ts(n,this.levels[l])),a=[[r]];if(i.length)try{a=ur.default.difference([r],...i).map(l=>l.map(u=>u.map(([p,m])=>[p,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,p])=>({x:u,y:p}));if(l.length>1){let u=l[0],p=l[l.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function ns(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let p of e)n=Math.min(n,p.x),r=Math.max(r,p.x),o=Math.min(o,p.y),i=Math.max(i,p.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,l=Math.cos(c),u=Math.sin(c);return e.map(p=>{let m=p.x-a,d=p.y-s;return{x:a+m*l-d*u,y:s+m*u+d*l}})}function wt(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=St(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=Ht(n,r,e.width/2,e.height/2)}return t?ns(t,e.rotation):null}function Pt(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=t==="stage"&&lr(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var os=.08;function dr(e,t){let n=wt(e),r=Pt(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let u of n)i=Math.min(i,u.x),a=Math.min(a,u.y),s=Math.max(s,u.x),c=Math.max(c,u.y);let l=o;for(let u of t)s>u.minX&&i<u.maxX&&c>u.minY&&a<u.maxY&&l<=u.topOffsetM+1e-6&&(l=u.topOffsetM+os);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function Ge(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function mr(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function Ct(e,t,n){return[Ge(e[0],e[1],t),Ge(e[0],e[1],n),Ge(e[3],e[2],n),Ge(e[3],e[2],t)]}function hr(e,t,n){return[Ge(e[0],e[3],t),Ge(e[1],e[2],t),Ge(e[1],e[2],n),Ge(e[0],e[3],n)]}function Le(e,t,n,r,o,i){se(e,t,void 0,()=>n,r,o,i,ae)}var Bn=2.4,rs=.75,is=.15;function At(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=r/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,p])=>({x:t.x+u*a-p*s,y:t.y+u*s+p*a}))}function pr(e,t,n,r,o){let i=At(t);i&&se(e,i,void 0,()=>n+Bn,n,ke(r,o.boothTop),o.boothWall,ae)}function Nn(e){if(e.shape==="round"){let u=e.radius;return u?Ht(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,p])=>({x:o.x+u*a-p*s,y:o.y+u*s+p*a}))}function fr(e,t,n,r,o){let i=Nn(t);i&&se(e,i,void 0,()=>n+rs,n,ke(r,o.tableTop),o.tableWall,ae)}function br(e,t,n,r,o,i,a){let s=wt(t);if(!s)return;let c=t.role==="stage",l=Pt(t),u=n+r;if(c&&a){let f=1/0,b=-1/0,y=1/0,g=-1/0;for(let x of s)x.x<f&&(f=x.x),x.x>b&&(b=x.x),x.y<y&&(y=x.y),x.y>g&&(g=x.y);a.push({cx:(f+b)/2*_,cz:(y+g)/2*_,y:u,halfX:Math.max((b-f)/2*_,.5),halfZ:Math.max((g-y)/2*_,.5)})}let p=te(t.fill),m=c&&p?pe(o.stageTop,ye(ft(p,.18),.9),.9):ke(p,c?o.stageTop:o.decorTop),d=t.role==="screen"?p:null,h=c?p?pe(o.stageWall,ye(p,.58),.82):o.stageWall:t.role==="screen"?d?pe(ye(d,1.42),[.24,.46,.82],.08):[.24,.46,.82]:ke(te(t.fill),o.decorWall);if(l.kind==="portal"&&s.length===4){let f=mr(s);Le(e,Ct(f,0,.16),u,n,m,h),Le(e,Ct(f,.84,1),u,n,m,h),Le(e,f,u,Math.max(n,u-.35),m,h);return}if(l.kind==="suite"&&s.length===4){let f=s.map((g,x)=>{let S=s[(x+1)%4],I=(g.x+S.x)/2,M=(g.y+S.y)/2;return Math.hypot(I-i.x,M-i.y)}),b=f.indexOf(Math.min(...f)),y=[0,1,2,3].map(g=>s[(b+g)%4]);Le(e,Ct(y,0,.08),u,n,m,h),Le(e,Ct(y,.92,1),u,n,m,h),Le(e,hr(y,.88,1),u,n,m,h),Le(e,y,u,Math.max(n,u-.18),m,h);return}Le(e,s,u,n,m,h)}function Gn(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=r/2,p=o/2;return[[-u,-p],[u,-p],[u,p],[-u,p]].map(([m,d])=>({x:i+m*c-d*l,y:a+m*l+d*c}))}function as(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return te(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=te(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>pe(s,c,1/(l+1)),a[0]):null}function yr(e,t,n,r){if(t.layer==="foreground")return;let o=Gn(t);if(!o)return;let i=n+is,a=ke(as(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=pe(r.ground,a,s)),se(e,o,void 0,()=>i,n,a,pe(a,r.decorWall,.5),ae)}function gr(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=ke(r,o.gaTop);se(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ae)}var ss=Math.PI/180,$=96,cs=6,ls=60,us=150,xr=.2,ds=.35;function ms(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/ss;return n<0?n+360:n}function Kt(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function Qt(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%r+r)%r;else if(l<0||l>=r)continue;a+=e[l],s++}o[i]=a/s}return o}function vr(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let d of m.rows){for(let h of d.pts)o+=h.x,i+=h.y,a++;if(d.pts.length>=4){let h=Tn(d.pts);h&&Number.isFinite(h.cx)&&Number.isFinite(h.cy)&&r.push({x:h.cx,y:h.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=Kt(r.map(y=>y.x)),d=Kt(r.map(y=>y.y)),h=0;for(let y of n)for(let g of y.rows)for(let x of g.pts){let S=Math.hypot(x.x-s.x,x.y-s.y);S>h&&(h=S)}let f=0,b=h*.2;for(let y of n)for(let g of y.rows)for(let x of g.pts)Math.hypot(x.x-m,x.y-d)<b&&f++;Math.hypot(m-s.x,d-s.y)<=h&&f/a<.01&&(c={x:m,y:d})}let l=[];for(let m of n){let d={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let h of m.rows)for(let f of h.pts){let b=Math.hypot(f.x-c.x,f.y-c.y),y=Math.min($-1,Math.floor(ms(c,f)/(360/$)));d.samples.push({r:b,bin:y,levelM:h.levelM}),b<d.rMin&&(d.rMin=b),b>d.rMax&&(d.rMax=b)}d.samples.length&&l.push(d)}if(!l.length)return null;l.sort((m,d)=>m.rMin+m.rMax-(d.rMin+d.rMax));let u=[];for(let m of l){let d=!1;for(let h of u){let f=Math.min(m.rMax,h.rMax)-Math.max(m.rMin,h.rMin),b=Math.min(m.rMax-m.rMin,h.rMax-h.rMin);if(b>1e-9&&f>=ds*b){h.members.push(m),h.rMin=Math.min(h.rMin,m.rMin),h.rMax=Math.max(h.rMax,m.rMax),d=!0;break}}d||u.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let p=[];for(let m of u){let d=new Array($).fill(null);for(let v of m.members)for(let w of v.samples){let R=d[w.bin];R||(R={samples:[]},d[w.bin]=R),R.samples.push({r:w.r,levelM:w.levelM})}let h=d.map(v=>!!v);if(!h.filter(Boolean).length)continue;let b=[],y=[];for(let v of d){if(!v)continue;let w=1/0,R=-1/0;for(let T of v.samples)T.r<w&&(w=T.r),T.r>R&&(R=T.r);b.push(w),y.push(R)}let g=Kt(b),x=Kt(y);if(!(g>=xr*x)||!(x>0))continue;let S=[...b].sort((v,w)=>v-w);if(!(S[Math.floor(S.length*.1)]>=xr*x))continue;let M=d.map(v=>{if(!v)return null;let w=[...v.samples].sort((D,z)=>D.r-z.r),R=w[0].r,T=w[w.length-1].r,H=w[0].levelM,C=-1/0;for(let D of w)D.levelM>C&&(C=D.levelM);let A=[];for(let D of w){let z={r:D.r,l:D.levelM};for(;A.length&&Math.abs(A[A.length-1].r-z.r)<1e-9;){if(A[A.length-1].l<=z.l){z.skip=!0;break}A.pop()}if(!z.skip){for(;A.length>=2;){let V=A[A.length-2],F=A[A.length-1];if((F.r-V.r)*(z.l-V.l)-(F.l-V.l)*(z.r-V.r)<=0)A.pop();else break}A.push(z)}}let B=A.map(D=>D.r),E=A.map(D=>D.l);return{inner:R,outer:T,front:H,top:C,profile:{rs:B,ls:E}}}),k=h.slice();for(let v=0;v<$;v++){if(k[v])continue;let w=-1,R=-1,T=0;for(let L=1;L<=$;L++){let X=(v-L+$*2)%$;if(k[X]){w=X;break}}for(let L=1;L<=$;L++){let X=(v+L)%$;if(k[X]){R=X,T=L;break}}if(w<0||R<0)continue;let H=0;for(let L=1;L<=$;L++){let X=(v-L+$*2)%$;if(h[X]){H=L;break}}if(H-1+T>cs)continue;let A=M[w],B=M[R],E=H/(H+T),D=A.inner+(B.inner-A.inner)*E,z=A.outer+(B.outer-A.outer)*E,V=A.front+(B.front-A.front)*E,F=A.top+(B.top-A.top)*E;M[v]={inner:D,outer:z,front:V,top:F,profile:{rs:[D,z],ls:[V,F]}}}for(let v=0;v<$;v++)M[v]&&(k[v]=!0);let O=360/$,N=[],j=k.filter(Boolean).length,G=[];if(j===$)G.push({start:0,len:$});else{let v=0;for(;k[v];)v=(v+1)%$;let w=-1;for(let R=0;R<=$;R++){let T=(v+R)%$,H=R<$&&k[T];if(H&&w<0)w=T;else if(!H&&w>=0){let C=(T-w+$)%$||$;G.push({start:w,len:C}),w=-1}}}for(let v of G){if(v.len*O<ls&&v.len<$)continue;let w=v.len===$,R=new Float64Array(v.len),T=new Float64Array(v.len),H=new Float64Array(v.len),C=new Float64Array(v.len),A=[];for(let L=0;L<v.len;L++){let X=M[(v.start+L)%$];R[L]=X.inner,T[L]=X.outer,H[L]=X.front,C[L]=X.top,A.push(X.profile??{rs:[X.inner,X.outer],ls:[X.front,X.top]})}let B=Qt(R,w),E=Qt(T,w),D=Qt(H,w),z=Qt(C,w);for(let L=0;L<v.len;L++)B[L]>R[L]&&(B[L]=R[L]),E[L]<T[L]&&(E[L]=T[L]),B[L]>E[L]-1e-6&&(B[L]=Math.max(0,E[L]-1e-6)),z[L]<D[L]&&(z[L]=D[L]);let V={startBin:v.start,binCount:v.len,closed:w,innerR:B,outerR:E,frontLevelM:D,topLevelM:z,profiles:A},F=(L,X,K)=>{let J=A[L],Z=J.rs,q=J.ls;if(X<=Z[0]){q[0]>K&&(q[0]=K);return}if(X>=Z[Z.length-1]){q[q.length-1]>K&&(q[q.length-1]=K);return}for(let ne=0;ne+1<Z.length;ne++)if(X<=Z[ne+1]){q[ne]>K&&(q[ne]=K),q[ne+1]>K&&(q[ne+1]=K);return}};for(let L=0;L<v.len;L++){let X=d[(v.start+L)%$];if(X)for(let K of X.samples){F(L,K.r,K.levelM);let J=w?(L-1+v.len)%v.len:L-1,Z=w?(L+1)%v.len:L+1;J>=0&&F(J,K.r,K.levelM),Z<v.len&&F(Z,K.r,K.levelM)}}N.push(V)}N.reduce((v,w)=>v+w.binCount*O,0)<us||p.push({arcs:N,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:g,outerRMedian:x})}if(!p.length)return null;if(p.sort((m,d)=>m.innerRMedian-d.innerRMedian),t){let m=p[p.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:$,binStepDeg:360/$,rings:p}}function Mr(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,l=u=>{let p=t.profiles[u],m=p.rs,d=p.ls;if(r<=m[0])return d[0];if(r>=m[m.length-1])return d[d.length-1];for(let h=0;h+1<m.length;h++)if(r<=m[h+1]){let f=m[h+1]-m[h],b=f>1e-9?(r-m[h])/f:0;return d[h]+(d[h+1]-d[h])*b}return d[d.length-1]};return l(a)*(1-c)+l(s)*c}var hs=.25,ps=1.2,fs=.6,bs=.45,ys=2.3,gs=Math.PI/180;function Ze(e,t,n){let r=n*gs;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function xs(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let a=0;for(let s of i)Math.hypot(s.x-t.centre.x,s.y-t.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var vs=24;function Ms(e,t,n,r,o,i,a,s){let c=n.binCount,l=vs,u=Ae,p=i+.02,m=[];for(let P=0;P<c;P++){let v=(n.startBin+P+.5)*t.binStepDeg,w=new Float64Array(l+1);for(let R=0;R<=l;R++){let T=r[P]+(o[P]-r[P])*R/l;w[R]=Math.max(p,Mr(t,n,v,T)-hs)}m.push(w)}let d=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],h=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],f=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],b=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(P,v)=>{let w=(n.startBin+P+.5)*t.binStepDeg,R=r[P]+(o[P]-r[P])*v/l,T=Ze(t.centre,R,w);return[T.x*u,m[P][v],T.y*u]};{let P=Math.tan(12*Math.PI/180);for(let v=0;v<6;v++){let w=!1;for(let T=0;T<c;T++)for(let H=l-1;H>=0;H--)m[T][H]>m[T][H+1]&&(m[T][H]=m[T][H+1],w=!0);let R=n.closed?c:c-1;for(let T=0;T<R;T++){let H=(T+1)%c;for(let C=0;C<=l;C++){let A=m[H][C]-m[T][C];if(Math.abs(A)>1)continue;let B=r[T]+(o[T]-r[T])*C/l,E=r[H]+(o[H]-r[H])*C/l,D=Ze(t.centre,B,(n.startBin+T+.5)*t.binStepDeg),z=Ze(t.centre,E,(n.startBin+H+.5)*t.binStepDeg),V=P*Math.hypot(z.x-D.x,z.y-D.y)*u;A>V?(m[H][C]=m[T][C]+V,w=!0):-A>V&&(m[T][C]=m[H][C]+V,w=!0)}}if(!w)break}}let g=1,x=(P,v)=>{for(let w=0;w<=l;w+=4)if(Math.abs(m[P][w]-m[v][w])>g)return!0;return Math.abs(m[P][l]-m[v][l])>g},S=Math.tan(38*Math.PI/180),I=P=>(o[P]-r[P])/l*u,M=(P,v)=>m[P][v+1]-m[P][v]>S*Math.max(1e-6,I(P)),k=(P,v)=>{let w=n.closed?(P-1+c)%c:Math.max(0,P-1),R=n.closed?(P+1)%c:Math.min(c-1,P+1);Math.abs(m[w][v]-m[P][v])>g&&(w=P),Math.abs(m[R][v]-m[P][v])>g&&(R=P);let T=Math.max(0,v-1),H=Math.min(l,v+1);T<v&&M(P,T)&&(T=v),H>v&&M(P,v)&&(H=v);let C=y(w,v),A=y(R,v),B=y(P,T),E=y(P,H),D=A[0]-C[0],z=A[1]-C[1],V=A[2]-C[2],F=E[0]-B[0],L=E[1]-B[1],X=E[2]-B[2],K=z*X-V*L,J=V*F-D*X,Z=D*L-z*F,q=Math.hypot(K,J,Z);return q>1e-12?(K/=q,J/=q,Z/=q,J<0&&(K=-K,J=-J,Z=-Z),[K,J,Z]):[0,1,0]},O=(P,v)=>{let w=[P[0],i,P[2]],R=[v[0],i,v[2]],T=v[0]-P[0],H=v[2]-P[2],C=Math.hypot(T,H);if(!(C>1e-12))return;let A=[H/C,0,-T/C];e.tri(P,v,R,A,f,f,b),e.tri(P,R,w,A,f,b,b)},N=.05*Ne,j=P=>o[P]-r[P]<N,G=n.closed?c:c-1;for(let P=0;P<G;P++){let v=(P+1)%c;if(j(P)||j(v))continue;if(x(P,v)){let A=(n.startBin+P+1)*t.binStepDeg,B=(L,X)=>{let K=(r[P]+r[v])/2,J=(o[P]+o[v])/2,Z=K+(J-K)*X/l,q=Ze(t.centre,Z,A);return[q.x*u,m[L][X],q.y*u]};for(let L=0;L<l;L++){let X=y(P,L),K=y(P,L+1),J=B(P,L),Z=B(P,L+1),q=k(P,L),ne=k(P,L+1);e.triN(X,J,Z,q,q,ne,d),e.triN(X,Z,K,q,ne,ne,d);let je=y(v,L),Ye=y(v,L+1),ve=B(v,L),Fe=B(v,L+1),De=k(v,L),Me=k(v,L+1);e.triN(ve,je,Ye,De,De,Me,d),e.triN(ve,Ye,Fe,De,Me,Me,d);let be=B(P,L),ce=B(P,L+1),Je=B(v,L+1),Se=B(v,L),et=ce[0]-be[0],we=ce[2]-be[2],_e=Math.hypot(et,we);if(_e>1e-12){let It=[we/_e,0,-et/_e];e.tri(be,ce,Je,It,f),e.tri(be,Je,Se,It,f)}}let E=y(P,0),D=y(v,0),z=y(v,l),V=y(P,l),F=L=>[L[0],i,L[2]];e.tri(F(E),F(z),F(D),[0,-1,0],h),e.tri(F(E),F(V),F(z),[0,-1,0],h),O(E,D),O(V,z);continue}for(let A=0;A<l;A++){let B=k(P,A),E=k(v,A),D=k(v,A+1),z=k(P,A+1);if(M(P,A)||M(v,A)){let K=(ce,Je)=>{let Se=(n.startBin+ce+.5)*t.binStepDeg,et=r[ce]+(o[ce]-r[ce])*(A+.5)/l,we=Ze(t.centre,et,Se);return[we.x*u,Je,we.y*u]},J=y(P,A),Z=y(v,A),q=K(P,m[P][A]),ne=K(v,m[v][A]);e.triN(J,Z,ne,B,E,E,d),e.triN(J,ne,q,B,E,B,d);let je=y(v,A+1),Ye=y(P,A+1),ve=K(P,m[P][A+1]),Fe=K(v,m[v][A+1]);e.triN(ve,Fe,je,z,D,D,d),e.triN(ve,je,Ye,z,D,z,d);let De=ne[0]-q[0],Me=ne[2]-q[2],be=Math.hypot(De,Me);if(be>1e-12){let ce=[-Me/be,0,De/be];e.tri(q,ne,Fe,ce,f),e.tri(q,Fe,ve,ce,f)}continue}let V=y(P,A),F=y(v,A),L=y(v,A+1),X=y(P,A+1);e.triN(V,F,L,B,E,D,d),e.triN(V,L,X,B,D,z,d)}let w=y(P,0),R=y(v,0),T=y(v,l),H=y(P,l),C=A=>[A[0],i,A[2]];e.tri(C(w),C(T),C(R),[0,-1,0],h),e.tri(C(w),C(H),C(T),[0,-1,0],h),O(w,R),O(H,T)}if(!n.closed)for(let P of[0,c-1])for(let v=0;v<l;v++)O(y(P,v),y(P,v+1))}function Sr(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let p of u.arcs){let m=new Float64Array(p.binCount),d=new Float64Array(p.binCount);for(let f=0;f<p.binCount;f++){let b=(p.startBin+f)%t.binCount,y=Math.max(0,p.innerR[f]-ge);m[f]=Math.max(y,a[b]+.001),d[f]=Math.max(m[f]+.001,p.outerR[f]+ge)}let h=0;for(let f=0;f<p.binCount;f++){let b=p.topLevelM[f]-r;b>h&&(h=b)}h>=ps&&Ms(e,t,p,m,d,r,o,i);for(let f=0;f<p.binCount;f++){let b=(p.startBin+f)%t.binCount;d[f]>a[b]&&(a[b]=d[f])}}if(xs(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=fs*Ne,l=bs*Ne;for(let u of s.arcs){let p=[],m=[];for(let f=0;f<u.binCount;f++){let b=(u.startBin+f+.5)*t.binStepDeg,y=u.outerR[f]+ge+c;p.push(Ze(t.centre,y,b)),m.push(Ze(t.centre,y+l,b))}let d=-1/0;for(let f=0;f<u.binCount;f++)u.topLevelM[f]>d&&(d=u.topLevelM[f]);let h=()=>d+ys;u.closed?se(e,m,[p.slice().reverse()],h,r,o.shellTop,o.shellWall,i):se(e,[...m,...p.slice().reverse()],void 0,h,r,o.shellTop,o.shellWall,i)}}function wr(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=ke(r,s.tierTop);if(!o)return;let u=b=>o.deckAt(b.x,b.y),p=or(t,a),m=p[0]??t.outline;if(o.rowLevels.length>=2){let b=Yt(o.rowLevels),y=rr(Zo(o.rowLevels,n.focal,b),p),g=()=>[0,1,0];for(let S of y){let I=Math.max(c,S.topY-.02);for(let M of i.subtract(S.outline,I))se(e,M,S.holes,()=>I,c,l,s.tierWall,ae,void 0,g)}y.length||se(e,m,t.holes,()=>o.landingY,c,l,s.tierWall,ae);let x={tread:[l[0]*ae.top,l[1]*ae.top,l[2]*ae.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let S of p.length?p:[m])Jo(e,o.rowLevels,n.focal,o.landingY,x,S,b);return}let d=o.flat?1/0:ir,h=b=>o.normalAt(b.x,b.y),f=o.flat?o.landingY:void 0;for(let b of i.subtract(m,f))se(e,b,t.holes,u,c,l,s.tierWall,ae,d,h)}function Ss(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a],u=o.get(s);u||(u=new Map,o.set(s,u));let p=l.rowId||`__seat-${a}`,m=u.get(p);m||(m={pts:[],levelM:0,n:0},u.set(p,m)),m.pts.push({x:l.x,y:l.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function Pr(e,t,n,r,o){let i=Ss(t,n,r);if(!i.length)return;let a=vr(i,t.focal);a&&(e.setMaterial(0),Sr(e,a,{bottomY:t.baseHeightM,colors:{bandTop:ye(o.tierTop,.8),bandWall:o.tierWall,shellTop:ye(o.tierWall,1.15),shellWall:o.tierWall},ao:ae,shapes:t.objects.filter(s=>s.type==="shape")}))}function Cr(e,t,n){return n<0?t>1?e.filter(r=>r.kind==="floor"):[...e]:e.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function Ar(e,t){let n=[...e].sort((o,i)=>o.screen.y-i.screen.y),r=[];for(let o of n){let i=r.find(a=>a.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));i?i.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var ws=1.15,Ps=3.25,Cs=4.5,As=.85,Rs=.5,Is=.26;function Rr(e,t,n){let r=Math.max(1e-6,t),o=e/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=ws&&a.add("zone"),o<=(i?Ps:Cs)&&(a.add("section"),a.add("ga")),o<=As&&(a.add("annotation"),a.add("booth")),o<=Rs&&a.add("row"),o<=Is&&a.add("seat"),a}function Ve(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],l=o[1]*i+o[5]*a+o[9]*s+o[13],u=o[2]*i+o[6]*a+o[10]*s+o[14],p=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(p>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/p,d=l/p,h=u/p,f=m>=-1.05&&m<=1.05&&d>=-1.05&&d<=1.05&&h<=1;return{x:(m*.5+.5)*n,y:(1-(d*.5+.5))*r,depth:h,visible:f}}function Ir(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if(Vn(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var Es=6;function Vn(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+Es):n;return o<a&&i<r}function Er(e,t,n){return e.length*t*.58+(n?14:0)}var zn={row:8,seat:14};function Tr(e,t,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-r/2)/o);return t*(1+1.5*i)}function Hn(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let l of o)if(Vn(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(Vn(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var Ts=6,ks=2.2,kr=.1,Ls=.3,Fs=1.8,Ds=.9,_s=.55,Os=6e3;function Lr(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let u of n)for(let p of u.objects)p.type==="section"&&p.zone&&c.set(p.id,p.zone);let l=new Map;for(let u=0;u<r.length;u++){let p=r[u],m=o.seatOwner[u],d=p.zoneId??(m?c.get(m):void 0);if(!d)continue;let h=l.get(d);h||(h={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(d,h)),h.n++,p.x<h.minX&&(h.minX=p.x),p.y<h.minY&&(h.minY=p.y),p.x>h.maxX&&(h.maxX=p.x),p.y>h.maxY&&(h.maxY=p.y),h.sumY+=o.seatDeckY(u)}for(let u of a){let p=l.get(u.id),m=[];for(let[d,h]of c)h===u.id&&m.push(d);if(!p||p.n===0){s.push({id:u.id,label:u.label,color:te(u.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*_,1.5,(u.focalPoint??i).y*_]});continue}s.push({id:u.id,label:u.label,color:te(u.color),sectionIds:m,seatCount:p.n,center:[(p.minX+p.maxX)/2*_,p.sumY/p.n,(p.minY+p.maxY)/2*_],radius:.5*Math.hypot((p.maxX-p.minX)*_,(p.maxY-p.minY)*_)||1,focalWorld:[(u.focalPoint??i).x*_,1.5,(u.focalPoint??i).y*_]})}}return s}function Fr(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],p=[];for(let m of s)m.seatCount!==0&&l.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+Ts,m.center[2]],color:t.zones?.find(d=>d.id===m.id)?.color});{let m=new Map,d=new Map;for(let h=0;h<r.length;h++){let f=o.seatOwner[h];if(!f)continue;let b=m.get(f);b||(b={n:0,x:0,y:0,deck:0},m.set(f,b)),b.n++,b.x+=r[h].x,b.y+=r[h].y,b.deck+=o.seatDeckY(h);let y=d.get(f);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},d.set(f,y)),r[h].x<y.minX&&(y.minX=r[h].x),r[h].x>y.maxX&&(y.maxX=r[h].x),r[h].y<y.minY&&(y.minY=r[h].y),r[h].y>y.maxY&&(y.maxY=r[h].y)}for(let h of n)for(let f of h.objects){if(f.type!=="section")continue;let b=m.get(f.id);if(!b||b.n===0)continue;let y=d.get(f.id),g=[b.x/b.n*_,b.deck/b.n,b.y/b.n*_],x=f.displayLabel||f.label||f.id;u.push({id:f.id,floorIndex:h.index,label:x,seatCount:b.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*_),focalWorld:[h.focal.x*_,h.baseHeightM+1.5,h.focal.y*_]});let S=t.floors?.[h.index]?.name?.trim().toLocaleLowerCase();n.length>1&&S===x.trim().toLocaleLowerCase()||l.push({id:`section:${f.id}`,kind:"section",text:x,anchor:[g[0],g[1]+ks,g[2]],floorIndex:h.index})}}{for(let h of n)for(let f of h.objects){if(f.type!=="gaArea")continue;let b=gt(f.points);if(!b)continue;let y=f.displayLabel||f.label||f.id;l.push({id:`ga:${f.id}`,kind:"ga",text:f.capacity>0?`${y} \xB7 ${f.capacity.toLocaleString()}`:y,anchor:[b.x*_,h.baseHeightM+Fs,b.y*_],floorIndex:h.index})}let m=new Map;for(let h=0;h<r.length;h++){let f=r[h],b=Math.hypot(f.x-c.x,f.y-c.y),y=m.get(f.rowId);(!y||b>y.far)&&m.set(f.rowId,{seat:f,index:h,far:b})}for(let[h,f]of m){let b=f.seat.label?f.seat.label.lastIndexOf("-"):-1,y=b>0?f.seat.label.slice(0,b):h;y&&l.push({id:`row:${h}`,kind:"row",text:y,anchor:[f.seat.x*_,o.seatDeckY(f.index)+Ds,f.seat.y*_],floorIndex:a[f.index]})}let d=new Map;for(let h=0;h<r.length;h++){let f=r[h],b=f.label?f.label.lastIndexOf("-"):-1,y=d.get(f.rowId);y||(y={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:b>0?f.label.slice(0,b):f.rowId,sectionId:f.sectionId},d.set(f.rowId,y));let g=h*3,x=i.iPosition[g],S=i.iPosition[g+1],I=i.iPosition[g+2];y.n++,y.x+=x,y.y+=S,y.z+=I,y.minX=Math.min(y.minX,x),y.maxX=Math.max(y.maxX,x),y.minZ=Math.min(y.minZ,I),y.maxZ=Math.max(y.maxZ,I)}for(let[h,f]of d)p.push({id:h,label:f.label,sectionId:f.sectionId,seatCount:f.n,center:[f.x/f.n,f.y/f.n,f.z/f.n],radius:Math.max(.8,Math.hypot(f.maxX-f.minX,f.maxZ-f.minZ)*.5)});if(r.length<=Os)for(let h=0;h<r.length;h++){let f=r[h],b=f.displayLabel||f.label;b&&l.push({id:`seat:${f.id}`,kind:"seat",text:b,anchor:[f.x*_,o.seatDeckY(h)+_s,f.y*_],floorIndex:a[h]})}}for(let m of n)for(let d of m.objects)if(d.type==="shape"&&d.role&&["entrance","exit","screen","suite","obstruction"].includes(d.role)){let h=wt(d),f=h?gt(h):null;if(!f||!d.label)continue;l.push({id:`architecture:${d.id}`,kind:"annotation",text:d.label,anchor:[f.x*_,m.baseHeightM+Pt(d).heightM+kr,f.y*_],color:d.fill,floorIndex:m.index})}else if(d.type==="text"){if(!d.text)continue;l.push({id:`text:${d.id}`,kind:"annotation",text:d.text,anchor:[d.position.x*_,m.baseHeightM+kr,d.position.y*_],color:d.color,rotation:d.rotation,floorIndex:m.index})}else if(d.type==="booth"){let h=At(d);if(!h)continue;let f=gt(h);if(!f)continue;l.push({id:`booth:${d.id}`,kind:"booth",text:d.displayLabel||d.label||d.id,anchor:[f.x*_,m.baseHeightM+Bn+Ls,f.y*_],floorIndex:m.index})}return{labels:l,sections:u,rows:p}}function Dr(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function _r(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let d=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),h=m*3,f=l[d];f.minX=Math.min(f.minX,i.position[h]),f.minY=Math.min(f.minY,i.position[h+1]),f.minZ=Math.min(f.minZ,i.position[h+2]),f.maxX=Math.max(f.maxX,i.position[h]),f.maxY=Math.max(f.maxY,i.position[h+1]),f.maxZ=Math.max(f.maxZ,i.position[h+2])}let u=new Map;for(let m=0;m<n.length;m++)for(let d of n[m].objects)d.type==="section"&&u.set(d.id,m);let p=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let d=o.seatOwner[m],h=(d!==null?u.get(d):void 0)??a[m];if(h===void 0)continue;let f=p[h],b=r[m];f.n++,b.x<f.minX&&(f.minX=b.x),b.y<f.minY&&(f.minY=b.y),b.x>f.maxX&&(f.maxX=b.x),b.y>f.maxY&&(f.maxY=b.y);let y=o.seatDeckY(m);f.sumX+=b.x*_,f.sumDeck+=y,f.sumZ+=b.y*_,f.minDeck=Math.min(f.minDeck,y),f.maxDeck=Math.max(f.maxDeck,y+1.6),s[m]=h}for(let m=0;m<n.length;m++){let d=p[m],h=t.floors?.[m],f=l[m],b=Math.min(d.n?d.minX*_:n[m].focal.x*_-1,Number.isFinite(f.minX)?f.minX:1/0),y=Math.max(d.n?d.maxX*_:n[m].focal.x*_+1,Number.isFinite(f.maxX)?f.maxX:-1/0),g=Math.min(d.n?d.minY*_:n[m].focal.y*_-1,Number.isFinite(f.minZ)?f.minZ:1/0),x=Math.max(d.n?d.maxY*_:n[m].focal.y*_+1,Number.isFinite(f.maxZ)?f.maxZ:-1/0),S=Math.min(d.n?Math.min(n[m].baseHeightM,d.minDeck):n[m].baseHeightM,Number.isFinite(f.minY)?f.minY:1/0),I=Math.max(d.n?Math.max(d.maxDeck,S+.5):S+.5,Number.isFinite(f.maxY)?f.maxY:-1/0),M=[d.n?d.sumX/d.n:(b+y)/2,d.n?d.sumDeck/d.n:(S+I)/2,d.n?d.sumZ/d.n:(g+x)/2],k=Math.max(1,.5*Math.hypot(y-b,I-S,x-g));c.push({index:m,id:h?.id??`floor-${m}`,label:h?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:d.n,center:M,radius:k,box:{min:[b,S,g],max:[y,I,x]},focalWorld:[n[m].focal.x*_,n[m].baseHeightM+1.5,n[m].focal.y*_]})}}return c}function Un(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)a(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)a(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)a(l.x,l.y);else if(c.type==="booth"){let l=At(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=Nn(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=Gn(c);if(l)for(let u of l)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Or(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=St(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);se(e,s,void 0,()=>0,-.4,i.ground,i.ground,ae)}else{let a=t.reduce((d,h)=>h.baseHeightM<d.baseHeightM?h:d);e.setFloor(a.index);let s=n.filter((d,h)=>r[h]===a.index),c=Un([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,l*.04)),p=St(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),m=a.baseHeightM-.03;se(e,p,void 0,()=>m,m-.22,i.ground,i.ground,ae)}}function Br(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,p=-1/0,m=(f,b,y)=>{a=Math.min(a,f),l=Math.max(l,f),s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,y),p=Math.max(p,y)};for(let f=0;f<e.position.length;f+=3)m(e.position[f],e.position[f+1],e.position[f+2]);for(let f=0;f<t.count;f++){let b=f*3,y=t.iPosition[b],g=t.iPosition[b+1],x=t.iPosition[b+2],S=Math.max(.35,t.iMaxRadius[f]??.35);m(y-S,g,x-S),m(y+S,g+1.6,x+S)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,p=o+i);let d=[(a+l)/2,(s+u)/2,(c+p)/2],h=Math.max(1,.5*Math.hypot(l-a,u-s,p-c));return{center:d,radius:h,minY:s,maxY:u}}function Nr(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let S=0;S<e.count;S++){let I=S*3,M=e.iPosition[I],k=e.iPosition[I+2];M<a&&(a=M),M>c&&(c=M),k<s&&(s=k),k>l&&(l=k)}for(let S of t)a=Math.min(a,S.cx-S.halfX),c=Math.max(c,S.cx+S.halfX),s=Math.min(s,S.cz-S.halfZ),l=Math.max(l,S.cz+S.halfZ);let u=n.minX*_,p=n.maxX*_,m=n.minY*_,d=n.maxY*_,h=u,f=p,b=m,y=d;if(Number.isFinite(a)){let S=Math.max(2,.06*Math.hypot(c-a,l-s));h=Math.max(u,a-S),f=Math.min(p,c+S),b=Math.max(m,s-S),y=Math.min(d,l+S)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[h,g,b],max:[f,x,y]}}function lt(e){let{doc:t}=e,n=_o(t.theme),r=n.structure,o=nr(t,e.eventConfigurationId??t.eventConfigurationId),i=e.seats,a=new Vt,s=new Map;for(let v of o)for(let w of v.objects)s.set(w.id,v.index),w.type==="section"&&s.set(w.logicalSectionId??w.id,v.index);let c=i.map(v=>s.get(v.sectionId??"")??s.get(v.rowId??"")??0),l=Un(o,i);Or(a,o,i,c,l,r);let u=sr(t,i),p=new Map,m=new Map;for(let v of t.categories??[])p.set(v.key,v.color),v.seatGlyph&&m.set(v.key,v.seatGlyph);let d=[],h=ar(o,i,c),f=new Float32Array(i.length);for(let v=0;v<o.length;v++){let w=o[v];a.setFloor(v);let R=new Wt,T=[],H=w.objects.filter(C=>C.type==="section"&&!!C.outline&&C.outline.length>=3);for(let C of w.objects)C.type==="section"?wr(a,C,w,cr(C,u),h.bySection.get(C.id),R,H,r):C.type==="shape"?(a.setMaterial(C.role==="screen"?1:0),br(a,C,w.baseHeightM,dr(C,T),r,w.focal,d),a.setMaterial(0)):C.type==="gaArea"?gr(a,C,w.baseHeightM,te(p.get(C.categoryKey)),r):C.type==="booth"?pr(a,C,w.baseHeightM,te(p.get(C.categoryKey)),r):C.type==="table"?fr(a,C,w.baseHeightM,te(p.get(C.categoryKey)),r):C.type==="decorImage"&&yr(a,C,w.baseHeightM,r);Pr(a,w,i,h,r)}let b=o.length>1?{x:o.reduce((v,w)=>v+w.focal.x,0)/o.length,y:o.reduce((v,w)=>v+w.focal.y,0)/o.length}:t.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},y=Eo([a.build()]),g=Do(i,e.initialState,h,f,p,m),x=Lr({doc:t,units:o,seats:i,surfaces:h,focal:b}),{labels:S,sections:I,rows:M}=Fr({doc:t,units:o,seats:i,surfaces:h,seatData:g,hintedSeatFloor:c,zones:x,focal:b}),k=_r({doc:t,units:o,seats:i,surfaces:h,solids:y,hintedSeatFloor:c,seatFloor:f});Dr(S,k),g.iYaw=Lo(g.iPosition,i.length,v=>i[v].rowId,v=>{let w=o[f[v]]?.focal??b;return[w.x*_,w.y*_]});let O=(l.minX+l.maxX)/2*_,N=(l.minY+l.maxY)/2*_,j=.5*Math.hypot((l.maxX-l.minX)*_,(l.maxY-l.minY)*_)||10,G=Br(y,g,{cx:O,cz:N,radius:j}),P=Nr(g,d,l,G.minY,G.maxY,j);return{solids:y,seats:g,bounds:{center:[(P.min[0]+P.max[0])/2,(P.min[1]+P.max[1])/2,(P.min[2]+P.max[2])/2],radius:j,groundY:0,box:P},renderBounds:{center:G.center,radius:G.radius},stateColorLUT:Oo(n,xe),theme:n,seatCount:i.length,focalWorld:[b.x*_,1.5,b.y*_],zones:x,stages:d,sections:I,rows:M,labels:S,floors:k}}var Bs=88,Ns=20,Gr={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},qt=new Set(["row","seat"]),Vr={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Zt={row:{x:62,y:16},seat:{x:46,y:18}},zr=te,jn=e=>io(e);function Hr(e,t){let n=jn(e),r=jn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Yn(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*r+t[o-1]*(1-r))}function Gs(e,t=[.04,.06,.1],n=!0){let r=jn(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Yn(i,t):t,s=zr(e),c=n?7:4.5,l=s&&Hr(s,a)>=c?e:o;return r?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}var $t=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",n.fontFamily&&(r.fontFamily=n.fontFamily),t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;let s=Rr(o,i,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let g of this.labels){if(!s.has(g.kind))continue;let x=Ve(t,g.anchor,n,r);if(!x.visible)continue;let S=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:x,focus:Tr(x,S,n,r),halfWidth:Er(g.text,Gr[g.kind].size,!qt.has(g.kind))/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let l=Ar(c.filter(g=>g.label.kind==="floor"),n),u=[...c.filter(g=>!qt.has(g.label.kind)&&g.label.kind!=="floor"),...l],p=Ir(u,Bs,Ns),m=Hn(c.filter(g=>g.label.kind==="row"),Zt.row.x,Zt.row.y,zn.row,p),d=Hn(c.filter(g=>g.label.kind==="seat"),Zt.seat.x,Zt.seat.y,zn.seat,[...p,...m]),h=[...p,...m,...d],f=new Set(h.map(g=>g.label.id));for(let{label:g,screen:x}of h){let I=this.nodeFor(g).style;I.display="",I.transform=`translate(-50%, -50%) translate(${x.x.toFixed(1)}px, ${x.y.toFixed(1)}px)`}let b=h.filter(({label:g})=>!qt.has(g.kind)).sort((g,x)=>Vr[x.label.kind]-Vr[g.label.kind]||g.screen.depth-x.screen.depth||g.focus-x.focus),y=[];for(let{label:g}of b){let x=this.nodes.get(g.id);if(!x||x.style.display==="none")continue;let S=x.getBoundingClientRect();y.some(M=>S.left<M.right+3&&S.right+3>M.left&&S.top<M.bottom+3&&S.bottom+3>M.top)?x.style.display="none":y.push(S)}for(let[g,x]of this.nodes)f.has(g)||(x.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let p=n.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=Gr[t.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=!qt.has(t.kind),s=Gs(t.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],l=zr(r?"#ecf8ff":s.ink)??[1,1,1],u=r?Yn("rgba(10,28,45,.9)",c):a?Yn(s.backing,c):c;return n.dataset.qualityContrast=Hr(l,u).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var jr=1;var Vs=new Set(["floor","zone","section","ga","booth","annotation"]);function zs(e){return e.every(t=>Number.isFinite(t))}function Hs(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Ur(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function $e(e){return Math.round(e*1e4)/1e4}function Us(e){if(e)return{box:{x:$e(e.box.x),y:$e(e.box.y),width:$e(e.box.width),height:$e(e.box.height)},horizontalFillRatio:$e(e.horizontalFillRatio),verticalFillRatio:$e(e.verticalFillRatio),visibleAreaRatio:$e(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Re(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function Jt(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Vs.has(s.kind)),r=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,o=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)Hs(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[Re("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Re("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Re("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Re("viewport-empty","The 3D viewport must have visible dimensions",e.viewport.width>1&&e.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${e.viewport.width}\xD7${e.viewport.height}`}]),Re("camera-invalid","The capture camera must have a finite physical pose",zs(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Re("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!e.scene.authoredRelief||e.scene.renderedVerticalSpanM>.05&&e.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:e.scene.projectedReliefPx,minimum:2}]),Re("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Re("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Re("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Re("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:l})=>({id:s,kind:c,text:l})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:Us(e.framing)},metrics:{minimumHierarchyFontPx:Ur(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Ur(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var fe=require("ogl");var ze=require("ogl");var en=`
20
+ }`});async function Ei(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Re,Math.min(Re,t?.initialPitchDeg??0)),s=un,c=!1,u=new AbortController,l=()=>u.abort();r.signal?.addEventListener("abort",l,{once:!0});let h=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let E=n.camera.position,F=n.focalWorld[0]-E.x,z=n.focalWorld[1]-E.y,G=n.focalWorld[2]-E.z,_=Math.hypot(F,G);_>.001&&(i=Math.atan2(F,-G)*180/Math.PI,a=Math.max(-Re,Math.min(Re,Math.atan2(z,_)*180/Math.PI)))}let d=null;if(t){let E=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),F=sn(t,an(E)),z;try{let G=t.resolveUrl?await t.resolveUrl(F.initialUrl):F.initialUrl;if(!G)throw new Error("panorama_asset_unavailable");z=await Rt(G,u.signal)}catch{return r.signal?.removeEventListener("abort",l),null}try{d=Ci(n.gl,z)}catch{return u.abort(),r.signal?.removeEventListener("abort",l),null}d.mesh.renderOrder=999,d.mesh.setParent(n.scene),F.upgradeUrl&&(h=cn(()=>{(t.resolveUrl?t.resolveUrl(F.upgradeUrl):Promise.resolve(F.upgradeUrl)).then(_=>!_||u.signal.aborted?null:Rt(_,u.signal)).then(_=>{_&&(c||u.signal.aborted||(d?.setImage(_),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),y=()=>{let E=n.camera.position;d?.mesh.position.set(E.x,E.y,E.z);let[F,z,G]=Pi(i,a);n.camera.lookAt([E.x+F,E.y+z,E.z+G]),n.requestRender()};y();let b=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),b.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),b.tabIndex=-1,Object.assign(b.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),b.appendChild(x),r.disclosure){let E=document.createElement("div");E.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(E.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),b.appendChild(E)}let S=document.createElement("div");S.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(S.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),b.appendChild(S),e.appendChild(b),x.focus({preventScroll:!0});let I=!1,v=0,R=0,O=0,V=new Map,U=()=>{let[E,F]=[...V.values()];return E&&F?Math.hypot(E.x-F.x,E.y-F.y):0},N=E=>{let F=to(E);F!==s&&(s=F,n.camera.perspective({fov:s,aspect:n.camera.aspect}),y())},A=E=>{E.target!==x&&(V.set(E.pointerId,{x:E.clientX,y:E.clientY}),I=V.size===1,v=E.clientX,R=E.clientY,V.size===2&&(O=U()),b.setPointerCapture?.(E.pointerId),b.style.cursor="grabbing")},M=E=>{if(V.has(E.pointerId)){if(V.set(E.pointerId,{x:E.clientX,y:E.clientY}),V.size>=2){let F=U();O>0&&F>0&&N(s*(O/F)),O=F,I=!1;return}I&&(i+=(E.clientX-v)*Ai,a=Math.max(-Re,Math.min(Re,a+(E.clientY-R)*Ai)),v=E.clientX,R=E.clientY,y())}},P=E=>{V.delete(E.pointerId),O=V.size===2?U():0;let F=V.values().next().value;I=V.size===1,F?(v=F.x,R=F.y):b.style.cursor="grab";try{b.releasePointerCapture?.(E.pointerId)}catch{}},C=E=>{E.preventDefault(),N(s+E.deltaY*.04)};b.addEventListener("pointerdown",A),b.addEventListener("pointermove",M),b.addEventListener("pointerup",P),b.addEventListener("pointercancel",P),b.addEventListener("wheel",C,{passive:!1});let T=E=>{if(!c){if(E.key==="Tab"){E.preventDefault(),x.focus({preventScroll:!0});return}if(E.key==="Escape"){E.stopPropagation(),B.close();return}if(E.key==="ArrowLeft"||E.key==="ArrowRight")i+=E.key==="ArrowLeft"?-4:4;else if(E.key==="ArrowUp"||E.key==="ArrowDown")a=Math.max(-Re,Math.min(Re,a+(E.key==="ArrowUp"?4:-4)));else if(E.key==="+"||E.key==="="){N(s-5),E.preventDefault();return}else if(E.key==="-"){N(s+5),E.preventDefault();return}else return;E.preventDefault(),y()}};window.addEventListener("keydown",T);let H=0,k=(E,F)=>{if(!d){F?.();return}let z=E===1?0:1,G=performance.now(),_=()=>{if(c)return;let L=o<=0?1:Math.min(1,(performance.now()-G)/o);d?.setOpacity(z+(E-z)*L),n.requestRender(),L<1?H=requestAnimationFrame(_):F?.()};H=requestAnimationFrame(_)};k(1);let w=()=>{c||(c=!0,h(),u.abort(),r.signal?.removeEventListener("abort",l),cancelAnimationFrame(H),b.removeEventListener("pointerdown",A),b.removeEventListener("pointermove",M),b.removeEventListener("pointerup",P),b.removeEventListener("pointercancel",P),b.removeEventListener("wheel",C),window.removeEventListener("keydown",T),b.remove(),g?.isConnected&&g.focus({preventScroll:!0}),d?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},B={close(){if(c)return;let E=()=>{w(),r.onClose?.()};cancelAnimationFrame(H),k(0,E)},dispose:w};return x.addEventListener("click",()=>B.close()),B}var Ai,Ri=bt(()=>{"use strict";Ii();no();eo();Ai=.15});var Ti={};so(Ti,{createOpenPanorama:()=>Vc});function Vc(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:u,gpu:l,gl:h,isContextLost:m,isDisposed:d,flightGen:f,setPanorama:p,getLoadAbort:y,setLoadAbort:b,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:S,restorePanoramaLayer:I,getOverviewChip:v,labelOverlay:R,reducedMotion:O,removeArriveChip:V,showArriveChip:U}=e;return async(N,A,M)=>{y()?.abort();let P=new AbortController;b(P);let C=n.seats.idToIndex.get(N);if(C===void 0){i.syncFromCamera();return}let T=s.get(N)?.label??N,H=u(N,C),k=c(N);if(!k){P.abort(),y()===P&&b(null),i.syncFromCamera();return}x(!0),a.stop();let w;try{w=await k}catch{if(y()===P&&b(null),o.panoramaFailed(N,"source"),!d()&&M===f()){x(!1),i.resumeAfterFlight(H.focal),a.requestRender();let Y=U(N,M,!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())}return}if(d()||M!==f()){P.abort(),y()===P&&b(null);return}V();let B=v(),E=()=>{P.abort(),y()===P&&b(null),p(null),g(!1),I(),B.style.display="",R.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(H.focal),a.requestRender();let Y=U(N,f());requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())},F=w.generated===!0,z=Si(w);S(),g(!F),B.style.display="none";let G=O()?0:A,_=l(),L=_&&!m()?await Ei(t,F?null:w,{gl:h,scene:_.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:F?H.eye:void 0,focalWorld:H.focal},{fadeMs:G,seatLabel:T,disclosure:z,disclosurePrefix:F?"Live seat-eye view":"360\xB0 panorama",onClose:E,signal:P.signal}):null;if(d()||M!==f()){P.abort(),g(!1),y()===P&&b(null),L?.dispose(),B.style.display="",I();return}if(L)i.syncFromCamera(),R.setVisible(!1),x(!1),a.requestRender(),p(L);else if(F){I(),B.style.display="",x(!1),i.resumeAfterFlight(H.focal),a.requestRender(),p(null),g(!1),o.panoramaFailed(N,"mount");let Y=U(N,f(),!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus()),y()===P&&b(null);return}else g(!1),o.panoramaFallback(N),p(wi(t,w,{fadeMs:G,seatLabel:T,disclosure:z,onClose:E,signal:P.signal}));o.panoramaOpened()}}var ki=bt(()=>{"use strict";no();Ri()});var Uc={};so(Uc,{VENUE3D_QUALITY_REPORT_VERSION:()=>Zr,buildSceneModel:()=>dt,inspectVenue3DQualityEvidence:()=>tn,mountVenue3D:()=>jc,prepareVenue3D:()=>Gi});module.exports=qi(Uc);var fo=require("ogl");var Zi=/^#?([\da-f]{3}|[\da-f]{6})$/i;function $i(e){let t=Zi.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function te(e){let t=$i(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function gn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Ji(e){return .2126*gn(e[0])+.7152*gn(e[1])+.0722*gn(e[2])}function lo(e){return Ji([e[0]*255,e[1]*255,e[2]*255])}function ea(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function he(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function yt(e,t){let n=ea(e);return he(e,[n,n,n],t)}var xe=["available","held","sold","selected","dimmed"];function gt(e){let t=xe.indexOf(e);return t<0?0:t}var uo={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function mo(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.42,r=.62;return[(t+(e[0]-t)*n)*r,(t+(e[1]-t)*n)*r,(t+(e[2]-t)*n)*r]}var xn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Ke={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ye(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function ta(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var Dt=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new fo.Renderer({canvas:this.canvas,dpr:ta(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ke.top[0],Ke.top[1],Ke.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var it=require("ogl"),de=Math.PI/180,vn=15*de,Mn=80*de,rt=.12,ho=35,po=1.25,Ot=class{constructor(t,n,r,o){this.fovY=ho;this.target=new it.Vec3;this.azimuth=-30*de;this.polar=55*de;this.distance=10;this.azT=-30*de;this.polT=55*de;this.distT=10;this.minDist=1;this.maxDist=100;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new it.Vec3;this.panAnchor=new it.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new it.Camera(t,{fov:ho,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;let u=this.pinchCentroid();this.panBy(u.x-this.pinchCx,u.y-this.pinchCy),this.pinchCx=u.x,this.pinchCy=u.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(vn,Math.min(Mn,this.polT-s*.006)),this.requestRender())},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*de;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(vn,Math.min(Mn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*de/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,u=Math.cos(this.polar),l=Math.sin(this.polar),h=-i*u,m=-a*u;this.targetT.x+=(-t*s+n*h)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*l*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*de/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*c);this.azT=r??-30*de,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*de;let l=this.fitDistance(t,s,u,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,i?.margin??po)),this.minDist=Math.max(2,a*.12),this.maxDist=l*4,n?(this.azimuth=this.azT,this.polar=12*de,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*de/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*de;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??po))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let u=Math.sin(i),l=-u*Math.sin(o),h=-Math.cos(i),m=-u*Math.cos(o);if(Math.abs(h)>.999)return s;let d=-m,f=l,p=Math.hypot(d,f);d/=p,f/=p;let y=-f*h,b=f*l-d*m,g=d*h,x=Math.tan(r),S=Math.tan(n),I=1;for(let v=0;v<8;v++){let R=(v&1?c.max[0]:c.min[0])-t.center[0],O=(v&2?c.max[1]:c.min[1])-t.center[1],V=(v&4?c.max[2]:c.min[2])-t.center[2],U=R*l+O*h+V*m,N=Math.abs(R*d+V*f),A=Math.abs(R*y+O*b+V*g);I=Math.max(I,N/x-U,A/S-U)}return Math.min(s,Math.max(I,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*rt,this.polar+=n*rt,this.distance+=r*rt,this.target.x+=o*rt,this.target.y+=i*rt,this.target.z+=a*rt,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,o=Math.hypot(t,n,r)||1,i=Math.max(vn,Math.min(Mn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Bt=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};var at=2.5,na=1.15,xt=6,st=10,bo=6,yo=9.5,go=.9,xo=2.2,Sn=30,wn=4,Vt=8192;var Jc=st+wn;function vo(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:at};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:at+o*(na-at)}}function Mo(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function So(e,t,n,r,o){if(!(e>0)||!(t>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(o/2);return Math.PI*a*a/e>=64}var oa=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],tl=new Map(oa.map(e=>[e.key,e]));var ra={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function wo(e){let t=e?.[0];return t&&ra[t]||"#3b82f6"}var ia=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],nl=new Map(ia.map(e=>[e.key,e]));var aa=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],ol=new Set(aa);var Co=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],Io=Co.map(e=>e.key),sa=new Map(Co.map(e=>[e.key,e]));function Po(e){return typeof e=="string"&&sa.has(e)}function Ao(e,t){return Po(e)?e:Po(t?.seatGlyph)?t.seatGlyph:"circle"}var Ie=.02291666666666667,Ve=1/Ie,ca=58,la=ca*Ie;var ua=3,Eo=0,Pn=120,da=0,ma=45,fa=7,Nt=1.2;function Cn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function ha(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=fa?e:ua}function Ro(e,t={}){let n=Cn(t.floorBaseHeightM,Eo,Pn,0),r=Math.min(Pn,n+ha(e.elevation)*la),o=e.height===void 0?r:Cn(e.height,Eo,Pn,r),i=Cn(e.rake,da,ma,0);return{height:o,rake:i}}var ko=ot(require("earcut"),1),Lo=ot(require("polygon-clipping"),1);var ll=Math.PI/180;function In(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function vt(e){return e.length?In(e):null}function Qe(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function Mt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var D=Ie,pa=.002;function ba(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.max(r,o,i);if(a<1e-9)return!0;let s=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-i)))/a<pa}var qe=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Ht=class{constructor(){this.pos=new qe;this.nor=new qe;this.col=new qe;this.flr=new qe;this.mat=new qe;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){ba(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,r,o,i,a,s,c=s,u=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(u[0],u[1],u[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function ya(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],u=o*c-i*s,l=i*a-r*c,h=r*s-o*a,m=Math.hypot(u,l,h)||1;return u/=m,l/=m,h/=m,[u,l,h]}function ga(e,t){let n=[...e],r=[];for(let a of e)r.push(a.x,a.y);let o=[];if(t){for(let a of t)if(!(a.length<3)){o.push(n.length);for(let s of a)n.push(s),r.push(s.x,s.y)}}let i=(0,ko.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function An(e){return Qe(e)<0?[...e].reverse():e}var xa=3;function va(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(d,f,p,y)=>Math.abs(r({x:(d.x+f.x)/2,y:(d.y+f.y)/2})-(p+y)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,l=(o+i+a)/3,h=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:u})-l)),m=(d,f,p)=>{let y=Math.abs(r({x:(d+c)/2,y:(f+u)/2})-(p+l)/2);y>h&&(h=y)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),h}function St(e,t,n,r,o){if(o<=0)return va(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},s={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(St(e,i,s,r,o-1),St(i,t,a,r,o-1),St(s,a,n,r,o-1),St(i,a,s,r,o-1))}function wt(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},d={x:(n.x+r.x)/2,y:(n.y+r.y)/2},f={x:(r.x+t.x)/2,y:(r.y+t.y)/2};wt(e,t,m,f,o,i,a-1,s),wt(e,m,n,d,o,i,a-1,s),wt(e,f,d,r,o,i,a-1,s),wt(e,m,d,f,o,i,a-1,s);return}let c=[t.x*D,o(t),t.y*D],u=[n.x*D,o(n),n.y*D],l=[r.x*D,o(r),r.y*D];if(s){e.triN(c,u,l,s(t),s(n),s(r),i);return}let h=ya(c,u,l);h[1]<0&&(h=[-h[0],-h[1],-h[2]]),e.tri(c,u,l,h,i)}var Ma=8;function To(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,u)=>{if(u>0){let l={x:(i.x+a.x)/2,y:(i.y+a.y)/2},h=t(l);if(Math.abs(h-(s+c)/2)>n){o(i,l,s,h,u-1),o(l,a,h,c,u-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),Ma)}return r}function Gt(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,u=s.y-i.y,l=Math.hypot(c,u);l>t&&Math.abs((a.x-i.x)*u-(a.y-i.y)*c)/l<t||r.push(a)}return r.length>=3?r:n}var zt=.001*Ve*.1;function se(e,t,n,r,o,i,a,s,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Qe(t))<1e-4))return;let l=Gt(To(Gt(An(t),zt),r,c),zt),h=n?.map(v=>Gt(To(Gt(An(v),zt),r,c),zt)).filter(v=>v.length>=3&&Math.abs(Qe(v))>=1e-4),{pts:m,tris:d}=ga(l,h),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],p=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],y=[a[0]*s.top,a[1]*s.top,a[2]*s.top],b=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<xa;g++){let v=0;for(let R=0;R<d.length;R+=3){let O=St(m[d[R]],m[d[R+1]],m[d[R+2]],r,g);O>v&&(v=O)}if(v<=c)break}for(let v=0;v<d.length;v+=3){let R=m[d[v]],O=m[d[v+1]],V=m[d[v+2]];wt(e,R,O,V,r,f,g,u);let U=[R.x*D,o,R.y*D],N=[O.x*D,o,O.y*D],A=[V.x*D,o,V.y*D];e.tri(U,A,N,[0,-1,0],p)}let x=v=>{if(g<=0)return v;let R=1<<g,O=[];for(let V=0;V<v.length;V++){let U=v[V],N=v[(V+1)%v.length];for(let A=0;A<R;A++){let M=A/R;O.push({x:U.x+(N.x-U.x)*M,y:U.y+(N.y-U.y)*M})}}return O},S=In(l),I=[{ring:x(l),flip:!1}];if(h)for(let v of h)v.length>=3&&I.push({ring:x(v),flip:!0});for(let{ring:v,flip:R}of I)for(let O=0;O<v.length;O++){let V=v[O],U=v[(O+1)%v.length],N=(U.x-V.x)*D,M=(U.y-V.y)*D,P=-N,C=Math.hypot(M,P)||1;M/=C,P/=C;let T=(V.x+U.x)/2-S.x,H=(V.y+U.y)/2-S.y,k=M*T+P*H;R&&(k=-k),k<0&&(M=-M,P=-P);let w=[M,0,P],B=[V.x*D,r(V),V.y*D],E=[U.x*D,r(U),U.y*D],F=[V.x*D,o,V.y*D],z=[U.x*D,o,U.y*D];e.tri(B,E,z,w,y,y,b),e.tri(B,z,F,w,y,b,b)}}function _o(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:t}}function jt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=An(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],u=r[(s+1)%o],l=u.x-c.x,h=u.y-c.y,m=Math.hypot(l,h)||1;i.push({x:h/m,y:-l/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],u=i[(s-1+o)%o],l=i[s],h=u.x+l.x,m=u.y+l.y,d=Math.hypot(h,m),f=()=>{a.push([c.x+u.x*t,c.y+u.y*t]),a.push([c.x+l.x*t,c.y+l.y*t])};if(d<1e-9){f();continue}h/=d,m/=d;let p=h*u.x+m*u.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>n){f();continue}a.push([c.x+h*t*y,c.y+m*t*y])}if(a.length<3)return e;try{let s=Lo.default.union([[...a,a[0]]]),c=null,u=-1/0;for(let h of s){let m=Math.abs(Qe(h[0].map(([d,f])=>({x:d,y:f}))));m>u&&(u=m,c=h[0])}if(!c)return e;let l=c.map(([h,m])=>({x:h,y:m}));if(l.length>1){let h=l[0],m=l[l.length-1];Math.abs(h.x-m.x)<1e-9&&Math.abs(h.y-m.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function Ut(e,t,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+r*Math.sin(s)})}return i}function Pt(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ie={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Sa=.44,wa=.15,Pa=.3,Ca=.24;function Fo(e){return e===void 0||!Number.isFinite(e)||e<=0?Ca:Math.min(Pa,Math.max(wa,e*Sa))}var En=.21,Ia=.05,Rn=.45,Xt=Rn+Ia,Aa=[{part:ie.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ie.pad,min:[-1,.36,-.95],max:[1,Rn,1]},{part:ie.back,min:[-1,Xt,-1],max:[1,.92,-.72]},{part:ie.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ie.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ie.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ie.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ie.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ie.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ie.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Ea=[{part:ie.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ie.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ie.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ie.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ie.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Ra=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function Do(){let e=[],t=[],n=[],r=[],o=(C,T,H)=>{let k=n.length,[w,B,E]=C,F=[B[0]-w[0],B[1]-w[1],B[2]-w[2]],z=[E[0]-w[0],E[1]-w[1],E[2]-w[2]],G=F[1]*z[2]-F[2]*z[1],_=F[2]*z[0]-F[0]*z[2],L=F[0]*z[1]-F[1]*z[0],Y=Math.hypot(G,_,L);Y>1e-9?(G/=Y,_/=Y,L/=Y):[G,_,L]=T,G*T[0]+_*T[1]+L*T[2]<0&&(G=-G,_=-_,L=-L);for(let K of C)e.push(...K),t.push(G,_,L),n.push(H);r.push(k,k+1,k+2,k,k+2,k+3)},i=C=>{for(let T of Ra){let H=T.c.map(k=>k.map((w,B)=>w?C.max[B]:C.min[B]));o(H,T.n,C.part)}};for(let C of Aa)i(C);for(let C of Ea)i(C);let a=Rn,s=1.08,c=.47,u=.69,l=-.55,h=.08,m=-.48,d=.01,f=[-c,a,l],p=[c,a,l],y=[-c,a,h],b=[c,a,h],g=[-u,s,m],x=[u,s,m],S=[-u,s,d],I=[u,s,d];o([p,x,I,b],[1,0,0],ie.body),o([y,S,g,f],[-1,0,0],ie.body),o([S,I,x,g],[0,1,0],ie.body),o([f,p,b,y],[0,-1,0],ie.body),o([b,I,S,y],[0,0,1],ie.body),o([f,g,x,p],[0,0,-1],ie.body);let v=10,R=8,O=[0,1.205,-.23],V=[.42,.115,.38],U=n.length;for(let C=0;C<=R;C++){let T=Math.PI*C/R,H=Math.cos(T),k=Math.sin(T);for(let w=0;w<=v;w++){let B=Math.PI*2*w/v,E=k*Math.cos(B),F=k*Math.sin(B);e.push(O[0]+V[0]*E,O[1]+V[1]*H,O[2]+V[2]*F);let z=E/V[0],G=H/V[1],_=F/V[2],L=Math.hypot(z,G,_)||1;z/=L,G/=L,_/=L,t.push(z,G,_),n.push(ie.head)}}for(let C=0;C<R;C++)for(let T=0;T<v;T++){let H=U+C*(v+1)+T,k=H+v+1;r.push(H,k,H+1,H+1,k,k+1)}let N=new Float32Array(e),A=new Float32Array(t),M=new Float32Array(n),P=new Uint16Array(r);return{position:N,normal:A,part:M,index:P,vertexCount:n.length,indexCount:r.length}}function Oo(e,t,n,r){let o=new Float32Array(t),i=u=>e[u*3],a=u=>e[u*3+2],s=0,c=(u,l)=>{let h=l-u;for(let m=u;m<l;m++){let[d,f]=r(m),p=d-i(m),y=f-a(m);if(h>=2){let b=Math.max(u,m-1),g=Math.min(l-1,m+1),x=i(g)-i(b),S=a(g)-a(b),I=Math.hypot(x,S);if(I>1e-6){let v=-S/I,R=x/I;v*p+R*y<0&&(v=-v,R=-R),p=v,y=R}}o[m]=p===0&&y===0?0:Math.atan2(p,y)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(s))&&(c(s,u),s=u);return o}var Te=.22;function Bo(e,t){let n=xe[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Ta=.42;function ka(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let f of e)f.x<r&&(r=f.x),f.y<o&&(o=f.y),f.x>i&&(i=f.x),f.y>a&&(a=f.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),u=Math.max(Math.sqrt(s*c/t),1e-6),l=Math.max(1,Math.ceil(s/u)+1),h=Math.max(1,Math.ceil(c/u)+1),m=new Map,d=(f,p)=>{let y=Math.min(l-1,Math.max(0,Math.floor((f-r)/u)));return Math.min(h-1,Math.max(0,Math.floor((p-o)/u)))*l+y};for(let f=0;f<t;f++){let p=d(e[f].x,e[f].y),y=m.get(p);y?y.push(f):m.set(p,[f])}for(let f=0;f<t;f++){let p=e[f],y=Math.min(l-1,Math.max(0,Math.floor((p.x-r)/u))),b=Math.min(h-1,Math.max(0,Math.floor((p.y-o)/u))),g=1/0;for(let x=1;x<=4;x++){for(let S=b-x;S<=b+x;S++)if(!(S<0||S>=h))for(let I=y-x;I<=y+x;I++){if(I<0||I>=l||x>1&&Math.abs(S-b)<x&&Math.abs(I-y)<x)continue;let v=m.get(S*l+I);if(v)for(let R of v){if(R===f)continue;let O=Math.hypot(e[R].x-p.x,e[R].y-p.y);O<g&&(g=O)}}if(Number.isFinite(g)&&g<=x*u)break}n[f]=g}return n}function La(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Nt):0}function Vo(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),u=new Float32Array(a*3),l=new Float32Array(a),h=new Float32Array(a),m=new Float32Array(a),d=new Float32Array(a),f=new Float32Array(a*3),p=new Map,y=ka(e);for(let b=0;b<a;b++){let g=e[b],S=(n?.seatPitchU(b)??y[b])*D;l[b]=Number.isFinite(S)?Math.max(.06,Math.min(Te,S*Ta)):Te,h[b]=Fo(Number.isFinite(S)?S:void 0);let I=Ao(g.glyph,{seatGlyph:i?.get(g.categoryKey)});m[b]=Io.indexOf(I),d[b]=g.wheelchairSpaceType==="no-seat"?0:1,s[b*3]=g.x*D,s[b*3+1]=n?n.seatDeckY(b):La(g),s[b*3+2]=g.y*D,c[b]=gt(t?t(g):"available");let v=te(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[b*3]=v[0],u[b*3+1]=v[1],u[b*3+2]=v[2],g.accessibility?.length){let R=te(wo(g.accessibility));R&&(f[b*3]=R[0],f[b*3+1]=R[1],f[b*3+2]=R[2])}p.set(g.id,b)}return{count:a,iPosition:s,iState:c,iCategory:u,iMaxRadius:l,iRing:f,idToIndex:p,iChairWidth:h,iGlyph:m,iPhysicalSeat:d,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var _a=64;function Tn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=gt(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+_a){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var Fa=.15,Da=.9,Oa=1.76,Ba=.7,Va=1.6;function Na(){return{background:{top:[...Ke.top],bottom:[...Ke.bottom]},structure:xn,seatStates:{...uo},seatScale:1}}function No(e){let t=Na();if(!e)return t;let n=te(e.background);if(n){t.background={top:ye(n,Da),bottom:ye(n,Oa)};let i={};for(let[a,s]of Object.entries(xn))i[a]=he(s,n,Fa);t.structure=i}let r=te(e.selectionColor)??te(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(Va,Math.max(Ba,o))),t}function Go(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function zo(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function ct(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,l=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let h=Math.hypot(t-(i.x+l*s),n-(i.y+l*c));h<r&&(r=h)}return r}function Ga(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function Ho(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function kn(e,t){let n=1/0;for(let r of zo(e)){let o=ct(t,r.x,r.y);o<n&&(n=o)}for(let r of zo(t)){let o=ct(e,r.x,r.y);o<n&&(n=o)}return n}function za(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let l of e)n+=l.x,r+=l.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let l of e){let h=Math.hypot(l.x-n,l.y-r);h>o&&(o=h,i=l)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let u=e.map((l,h)=>({p:l,i:h,t:(l.x-n)*a+(l.y-r)*s})).sort((l,h)=>l.t-h.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function Ln(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let g of e)n+=g.x,r+=g.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,u=0,l=0;for(let g of e){let x=g.x-n,S=g.y-r;o+=x*x,a+=S*S,i+=x*S,s+=x*x*x,c+=S*S*S,u+=x*S*S,l+=S*x*x}let h=o*a-i*i;if(Math.abs(h)<1e-9)return null;let m=(s+u)/2,d=(c+l)/2,f=(m*a-d*i)/h,p=(d*o-m*i)/h,y=f+n,b=p+r;return!Number.isFinite(y)||!Number.isFinite(b)?null:{cx:y,cy:b}}var Ha=.15;function ja(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,S=0;for(let I of g.pts)x+=I.x,S+=I.y;return{x:x/g.pts.length,y:S/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let g of t){let x=g.x-n,S=g.y-r;o+=x*x,i+=x*S,a+=S*S}let s=o+a,c=o*a-i*i,u=s/2+Math.sqrt(Math.max(0,s*s/4-c)),l,h;Math.abs(i)>1e-12?(l=u-a,h=i):o>=a?(l=1,h=0):(l=0,h=1);let m=Math.hypot(l,h);if(!(m>1e-12))return null;l/=m,h/=m;let d=1/0,f=-1/0,p=[];for(let g of e){let x=1/0,S=-1/0;for(let I of g.pts){let v=I.x*l+I.y*h;v<x&&(x=v),v>S&&(S=v),v<d&&(d=v),v>f&&(f=v)}p.push(S-x)}let y=f-d;return y>1e-9?(p.sort((g,x)=>g-x),p[Math.min(p.length-1,Math.floor(p.length*.9))]/y<=Ua?{x:l,y:h}:null):null}var Ua=.35;function jo(e,t,n,r){let o=new Map;for(let y of n){let b=t[y],g=b.rowId||`__seat-${y}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:b.x,y:b.y}),x.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[y,b]of o){let g=za(b.pts,b.idx),x=0;for(let S of g.pts)x+=Math.hypot(S.x-r.x,S.y-r.y);i.push({id:y,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(y=>Ga(y.pts)),s=[];for(let y=0;y<i.length;y++){let b=1/0;for(let g=0;g<i.length;g++){if(y===g||Ho(a[y],a[g])>=b)continue;let x=kn(i[y].pts,i[g].pts);x<b&&(b=x)}Number.isFinite(b)&&s.push(b)}s.sort((y,b)=>y-b);let c=s.length?s[Math.floor(s.length/2)]:1,u=Math.max(c*1.8,1e-6),l=i.map(()=>[]);for(let y=0;y<i.length;y++)for(let b=y+1;b<i.length;b++)Ho(a[y],a[b])>u||kn(i[y].pts,i[b].pts)<=u&&(l[y].push(b),l[b].push(y));let h=0;for(let y=0;y<i.length;y++){if(i[y].blockId!==-1)continue;let b=h++,g=[y];for(i[y].blockId=b;g.length;){let x=g.pop();for(let S of l[x])i[S].blockId===-1&&(i[S].blockId=b,g.push(S))}}let m=new Map;for(let y of i){let b=m.get(y.blockId)??[];b.push(y),m.set(y.blockId,b)}let d=[];for(let y of i){if(y.pts.length<4)continue;let b=Ln(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||d.push({x:b.cx,y:b.cy}))}let f=d.length>=2?(()=>{let y=d.map(x=>x.x).sort((x,S)=>x-S),b=d.map(x=>x.y).sort((x,S)=>x-S),g=Math.floor(d.length/2);return{cx:y[g],cy:b[g]}})():null;if(f){let y=v=>Math.hypot(v.x-f.cx,v.y-f.cy),b=1/0,g=-1/0,x=[];for(let v of i){let R=1/0,O=-1/0;for(let V of v.pts){let U=y(V);U<R&&(R=U),U>O&&(O=U)}x.push(O-R),R<b&&(b=R),O>g&&(g=O)}let S=g-b;x.sort((v,R)=>v-R);let I=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(S>1e-9&&I/S<=Ha){let v=i.map(T=>{let H=0;for(let k of T.pts)H+=y(k);return{row:T,radius:H/T.pts.length}}),R=0,O=0;for(let T of v)R+=T.radius,O+=T.row.focalDistance;R/=v.length,O/=v.length;let V=0;for(let T of v)V+=(T.radius-R)*(T.row.focalDistance-O);if(V<0)for(let T of v)T.radius=-T.radius;let N=1/0;for(let T of v)T.radius<N&&(N=T.radius);v.sort((T,H)=>T.radius-H.radius);let A=-1,M=-1/0,P=S/Math.max(1,v.length)*.5,C=[];for(let T of v)T.radius-M>P&&(A++,M=T.radius),T.row.ordinal=A,T.row.blockDepth=T.radius-N,C.push(T.row);return{sectionId:e,rows:C,blockCount:h}}}let p=[];for(let[,y]of m){let b=ja(y);if(b){let g=S=>{let I=0;for(let v of S.pts)I+=v.x*b.x+v.y*b.y;return I/S.pts.length};y.sort((S,I)=>g(S)-g(I)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let x=0;for(let S=0;S<y.length;S++)S>0&&(x+=kn(y[S-1].pts,y[S].pts)),y[S].ordinal=S,y[S].blockDepth=x,p.push(y[S])}else{let g=1/0;for(let x of y)x.focalDistance<g&&(g=x.focalDistance);y.sort((x,S)=>x.focalDistance-S.focalDistance);for(let x=0;x<y.length;x++)y[x].ordinal=x,y[x].blockDepth=Math.max(0,y[x].focalDistance-g),p.push(y[x])}}return{sectionId:e,rows:p,blockCount:h}}var El=Math.PI/180;function Uo(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function Xa(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function _n(e,t,n){return Uo(e,t)&&!(n??[]).some(r=>Uo(e,r)||Xa(e,r))}function Ya(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function Wa(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let d of e)n+=d.x,r+=d.y,o+=Math.hypot(d.x-t.x,d.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let d of e){let f=Math.hypot(d.x-n,d.y-r);f>s&&(s=f,a=d)}let c=a.x-n,u=a.y-r,l=Math.hypot(c,u);l>1e-9?(c/=l,u/=l):(c=1,u=0);let h=[...e].sort((d,f)=>(d.x-n)*c+(d.y-r)*u-((f.x-n)*c+(f.y-r)*u)),m=0;for(let d of h){let f=Math.hypot(d.x-n,d.y-r);f>m&&(m=f)}return{pts:h,cx:n,cy:r,radius:m,depth:o}}function Xo(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,u=s.y-a.y,l=c*c+u*u,h=l>1e-12?((t-a.x)*c+(n-a.y)*u)/l:0;h<0?h=0:h>1&&(h=1);let m=Math.hypot(t-(a.x+h*c),n-(a.y+h*u));m<o&&(o=m)}return o}var Yt=8;function Ka(e,t,n){let r=new Array(Yt).fill(1/0),o=new Array(Yt).fill(-1);for(let l=0;l<e.length;l++){let h=e[l],m=Math.hypot(t-h.cx,n-h.cy)-h.radius;for(let d=0;d<Yt;d++)if(m<r[d]){for(let f=Yt-1;f>d;f--)r[f]=r[f-1],o[f]=o[f-1];r[d]=m,o[d]=l;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let l of o){if(l<0)continue;let h=Xo(e[l],t,n);for(let m=0;m<3;m++)if(h<i[m]){for(let d=2;d>m;d--)i[d]=i[d-1],a[d]=a[d-1];i[m]=h,a[m]=l;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,u=0;for(let l=0;l<3;l++){let h=a[l];if(h<0||i[l]>s)continue;let m=1/(i[l]*i[l]);c+=m*e[h].depth,u+=m}return u>0?c/u:e[a[0]].depth}function Qa(e){let t=(r,o)=>Ka(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let u=Xo(c,r,o);u<i&&(i=u,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function Yo(e,t){let n=[];for(let r of e){let o=Wa(r.points,t);o&&n.push(o)}return n.length<2?Ya(t):(n.sort((r,o)=>r.depth-o.depth),Qa(n))}var On=ot(require("polygon-clipping"),1);var qo=ot(require("earcut"),1);var qa=.58,Wo=.01,ge=Te*1.5*Ve,Za=.5,$a=.6;function Ja(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],u=c.x-s.x,l=c.y-s.y,h=Math.hypot(u,l);if(h<1e-9){r.push([0,0]);continue}u/=h,l/=h,r.push([-l,u])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function es(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,u=s.y-a.y,l=Math.hypot(c,u)||1;return{x:c/l,y:u/l}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Ko=Math.PI/12;function ts(e){if(e.length<3)return[...e];let t=[...e].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function Zo(e,t){if(!e.length||!(t>0))return[];let n=ts(e),r=(s,c,u,l)=>{let h=u-c;for(;h<0;)h+=Math.PI*2;for(;h>Math.PI*2;)h-=Math.PI*2;let m=Math.max(1,Math.ceil(h/Ko)),d=t/Math.cos(h/m/2);for(let f=0;f<=m;f++){let p=c+h*f/m;l.push({x:s.x+Math.cos(p)*d,y:s.y+Math.sin(p)*d})}};if(n.length<3){let s=0,c=0;for(let d of n)s+=d.x,c+=d.y;s/=n.length||1,c/=n.length||1;let u=0;for(let d of n)u=Math.max(u,Math.hypot(d.x-s,d.y-c));let l=[],h=Math.max(3,Math.ceil(Math.PI*2/Ko)),m=(u+t)/Math.cos(Math.PI/h);for(let d=0;d<h;d++){let f=d/h*Math.PI*2;l.push({x:s+Math.cos(f)*m,y:c+Math.sin(f)*m})}return l}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],u=n[(s+1)%o];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return nr(a)}function ns(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,l=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let h=Math.hypot(t-(i.x+l*s),n-(i.y+l*c));h<r&&(r=h)}return r}function Wt(e){let t=e.map(o=>{let i=0,a=0;for(let u of o.pts)i+=u.x,a+=u.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let u of o.pts){let l=Math.hypot(u.x-i,u.y-a);l>c&&(c=l)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let l of i){let h=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let d=t[m],f=Math.hypot(l.x-d.cx,l.y-d.cy)-d.rad;if(f>=h&&f>=s)continue;let p=ns(e[m].pts,l.x,l.y);p<h&&(h=p),e[m].depth<e[o].depth&&p<s&&(s=p,c=e[m].y)}Number.isFinite(h)&&h>0&&a.push(h)}a.sort((l,h)=>l-h);let u=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:u,belowY:c})}return r}function $o(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let l=o.pts[0],h=l.x-r.x,m=l.y-r.y,d=Math.hypot(h,m)||1;h/=d,m/=d;let f=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+m*f,y:l.y-h*f},{x:l.x-m*f,y:l.y+h*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let l=1;l<i.length;l++){let h=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);h>1e-6&&(a+=h,s++)}let c=s>0?a/s:0,u=es(i,Math.max(c*$a,ge));return{pts:u,nrm:Ja(u,r),front:Math.max(n[t].pitch*qa,ge),back:Math.max(n[t].pitch*Za,ge)}}var lt=1.5,Jo=.3;function Fn(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let h=1;h<e.length-1;h++){let m=e[h],d=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);d>s&&(s=d,c=h)}if(s<=t||c<0)return[n,r];let u=Fn(e.slice(0,c+1),t),l=Fn(e.slice(c),t);return[...u.slice(0,-1),...l]}function er(e,t){if(e.length<4)return e;let n=Fn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function tr(e,t,n){if(e.length<2)return[];let r=n??Wt(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let g of a){let x=e[g].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,x)=>e[g].depth-e[x].depth);let u=s.map(g=>$o(e,g,r,t)).filter(g=>g!==null);if(!u.length)continue;let l=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+lt),y:g.pts[x].y-g.nrm[x][1]*(g.front+lt)}),h=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+lt),y:g.pts[x].y+g.nrm[x][1]*(g.back+lt)}),m=u[0],d=u[u.length-1],f=[];for(let g=0;g<m.pts.length;g++)f.push(l(m,g));for(let g of u)f.push(h(g,g.pts.length-1));for(let g=d.pts.length-1;g>=0;g--)f.push(h(d,g));for(let g=u.length-1;g>=0;g--)f.push(l(u[g],0));let p=nr(f),y=1/0;for(let g of s)e[g].y<y&&(y=e[g].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(Qe(p))>1e-6&&u.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return Mt(p,x.x,x.y)})){i.push({outline:er(p,Jo),holes:[],topY:y});continue}for(let g of os(u))i.push({outline:g,holes:[],topY:y})}return i}function os(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+lt,a=n.back+lt;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],l=n.nrm[c];r.push([u.x-l[0]*i,u.y-l[1]*i]),o.push([u.x+l[0]*a,u.y+l[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=On.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,u])=>({x:c,y:u})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(er(i,Jo))}return r}catch{return[]}}function nr(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var Dn=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!Mt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Qo(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let u=[0,1,0],l=r[0];for(let h=1;h+1<r.length;h++){let m=r[h],d=r[h+1];e.tri([l.x*D,o,l.y*D],[m.x*D,o,m.y*D],[d.x*D,o,d.y*D],u,i)}return}let a=r.map(u=>[u.x,u.y]);a.push(a[0]);let s;try{s=On.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let u of s){if(!u.length||u[0].length<4)continue;let l=u[0],h=[],m=[];for(let f=0;f<l.length-1;f++)h.push(l[f][0],l[f][1]),m.push([l[f][0],l[f][1]]);if(m.length<3)continue;let d=(0,qo.default)(h,void 0,2);for(let f=0;f<d.length;f+=3){let p=m[d[f]],y=m[d[f+1]],b=m[d[f+2]];e.tri([p[0]*D,o,p[1]*D],[y[0]*D,o,y[1]*D],[b[0]*D,o,b[1]*D],c,i)}}}function or(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??Wt(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(d=>[d.x,d.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new Dn([[...i]]):null,h=d=>{e.setMaterial(2),d(),e.setMaterial(0)},m=d=>{e.setMaterial(3),d(),e.setMaterial(0)};for(let d=0;d<t.length;d++){let f=t[d];if(f.patch&&f.patch.length>=3){let I=[...f.patch],v=s[d].belowY??r;if(m(()=>{if(u&&l)Qo(e,u,l,I,f.y,o.tread);else{let R=I[0];for(let O=1;O+1<I.length;O++){let V=I[O],U=I[O+1];e.tri([R.x*D,f.y,R.y*D],[V.x*D,f.y,V.y*D],[U.x*D,f.y,U.y*D],c,o.tread)}}}),f.y>v+Wo){let R=0,O=0;for(let V of I)R+=V.x,O+=V.y;R/=I.length,O/=I.length,h(()=>{for(let V=0;V<I.length;V++){let U=I[V],N=I[(V+1)%I.length],A=N.x-U.x,M=N.y-U.y,P=Math.hypot(A,M);if(P<1e-6)continue;let C=M/P,T=-A/P;(U.x-R)*C+(U.y-O)*T<0&&(C=-C,T=-T);let H=[C,0,T],k=[U.x*D,f.y,U.y*D],w=[N.x*D,f.y,N.y*D],B=[U.x*D,v,U.y*D],E=[N.x*D,v,N.y*D];e.tri(k,w,E,H,o.riser),e.tri(k,E,B,H,o.riser)}})}continue}let p=$o(t,d,s,n);if(!p)continue;let{pts:y,nrm:b,front:g,back:x}=p,S=s[d].belowY??r;for(let I=0;I+1<y.length;I++){let v=y[I],R=y[I+1],O=b[I],V=b[I+1];if(Math.hypot(R.x-v.x,R.y-v.y)<1e-6||O[0]===0&&O[1]===0||V[0]===0&&V[1]===0)continue;let U=[(v.x-O[0]*g)*D,f.y,(v.y-O[1]*g)*D],N=[(R.x-V[0]*g)*D,f.y,(R.y-V[1]*g)*D],A=[(v.x+O[0]*x)*D,f.y,(v.y+O[1]*x)*D],M=[(R.x+V[0]*x)*D,f.y,(R.y+V[1]*x)*D];if(m(()=>{u&&l?Qo(e,u,l,[{x:v.x-O[0]*g,y:v.y-O[1]*g},{x:R.x-V[0]*g,y:R.y-V[1]*g},{x:R.x+V[0]*x,y:R.y+V[1]*x},{x:v.x+O[0]*x,y:v.y+O[1]*x}],f.y,o.tread):(e.tri(U,N,M,c,o.tread),e.tri(U,M,A,c,o.tread))}),f.y>S+Wo){let P=[U[0],S,U[2]],C=[N[0],S,N[2]],T=[-O[0],0,-O[1]];h(()=>{e.tri(U,N,C,T,o.riser),e.tri(U,C,P,T,o.riser)})}}}}function rr(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function Kt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Bn=ot(require("polygon-clipping"),1);function rs(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function ir(e,t){return e.filter(n=>n.type!=="shape"||rs(n,t))}function ar(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:ir(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:ir(e.objects,t),focal:n,baseHeightM:0,index:0}]}var is={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function ut(e){return rr(e)??is}function sr(e,t){let n=jt(e.outline,ge),r=ut(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&Kt(r,ut(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=Bn.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([l,h])=>({x:l,y:h}));if(u.length>1){let l=u[0],h=u[u.length-1];Math.abs(l.x-h.x)<1e-9&&Math.abs(l.y-h.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[n]}catch{return[n]}}function cr(e,t){if(!t.length)return e;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=t.map(i=>[n(i)]),o=[];for(let i of e){let a;try{a=Bn.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([u,l])=>({x:u,y:l}));if(c.length>1){let u=c[0],l=c[c.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var as=.05,lr=.05,ss=.15,Vn=25;function ur(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,u=[],l=new Set;for(let m=0;m<e.length;m+=1){let d=e[m];for(let f of d.objects){if(f.type==="table"&&l.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let p=jt(f.outline,ge);c.set(f.id,{section:f,unit:d,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:f.id,floorIndex:m,box:ut(p),section:f,unit:d,outline:p})}}let h=new Map;for(let m of u){let d=h.get(m.floorIndex);d?d.push(m):h.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let d=t[m],f=n?h.get(n[m])??[]:u,p=d.sectionId?f.find(b=>b.id===d.sectionId)??f.find(b=>b.section.logicalSectionId===d.sectionId&&_n({x:d.x,y:d.y},b.outline,b.section.holes)):void 0,y=p?[p]:f;for(let b of y){if(n&&b.floorIndex!==n[m]||!p&&(d.x<b.box.minX||d.x>b.box.maxX||d.y<b.box.minY||d.y>b.box.maxY||!_n({x:d.x,y:d.y},b.outline,b.section.holes)))continue;o[m]=b.id;let g=c.get(b.id);g.hasSeats=!0;let x=d.focalPoint??b.unit.focal,S=Math.hypot(d.x-x.x,d.y-x.y);S<g.frontU&&(g.frontU=S),g.seatIndices.push(m);let I=d.rowId||`__seat-${m}`,v=g.rows.get(I);v?v.push({x:d.x,y:d.y}):g.rows.set(I,[{x:d.x,y:d.y}]);break}}for(let[m,d]of c){let f=Ro(d.section,{floorBaseHeightM:d.unit.baseHeightM}),p=d.unit.baseHeightM,y=f.rake>0?Math.tan(f.rake*Math.PI/180):0,b=f.rake<=.01&&f.height<=p+.001,g=d.section.surfaceKind,x=g==="flat"?!0:g==="rakedRows"&&f.rake>.01?!1:b,S=d.hasSeats?jo(m,t,d.seatIndices,d.unit.focal):{sectionId:m,rows:[],blockCount:0},v=S.rows.length<2?Yo([...d.rows.values()].map(k=>({points:k})),d.unit.focal):null,R=1/0;if(v){if(d.hasSeats)for(let k of d.rows.values())for(let w of k){let B=v.depthAt(w.x,w.y);B<R&&(R=B)}if(!d.hasSeats||!Number.isFinite(R)){R=1/0;for(let k of d.section.outline){let w=v.depthAt(k.x,k.y);w<R&&(R=w)}}}let O=p+as,V=Math.max(O,f.height),U=k=>{let w=Math.max(0,k-R)*Ie,B=Math.min(w*y,Vn);return Math.max(O,f.height+B)},N=k=>{let w=Math.max(0,k)*Ie,B=Math.min(w*y,Vn);return Math.max(O,f.height+B)},A=x?[]:S.rows.map(k=>({pts:k.pts,y:N(k.blockDepth),depth:k.blockDepth,blockId:k.blockId,...l.has(k.id)?{patch:Zo(k.pts,ge)}:{}})),M=A.length?A[0].y:V,P=A.map(k=>{let w=k.patch&&k.patch.length>=3?k.patch:k.pts,B=0,E=0;for(let G of w)B+=G.x,E+=G.y;let F=w.length||1;B/=F,E/=F;let z=0;for(let G of w){let _=Math.hypot(G.x-B,G.y-E);_>z&&(z=_)}return{cx:B,cy:E,rad:z}}),C=x?()=>V:A.length>=2?(k,w)=>{let B=1/0,E=M;for(let F=0;F<A.length;F++){let z=P[F];if(Math.hypot(k-z.cx,w-z.cy)-z.rad>=B)continue;let G=A[F].patch,_=G&&G.length>=3?Mt(G,k,w)?0:ct(G,k,w):ct(A[F].pts,k,w);_<B&&(B=_,E=A[F].y)}return E}:(k,w)=>v?U(v.depthAt(k,w)):V,T=[0,1,0],H=A.length>=2||x?()=>T:(k,w)=>{if(!v)return T;let B=v.depthAt(k,w);if(B<=R)return T;let E=(B-R)*Ie;if(E*y>=Vn||f.height+E*y<=O)return T;let[F,z]=v.gradientAt(k,w);if(F===0&&z===0)return T;let G=1/Math.hypot(y,1);return[-F*y*G,G,-z*y*G]};if(!x)for(let k of S.rows){let w=N(k.blockDepth);for(let B of k.seatIndices)a[B]=w}for(let k of S.rows){let w=[];for(let G=1;G<k.pts.length;G++){let _=Math.hypot(k.pts[G].x-k.pts[G-1].x,k.pts[G].y-k.pts[G-1].y);_>1e-6&&w.push(_)}w.sort((G,_)=>G-_);let B=w.length?w[Math.floor(w.length/2)]:1/0,E=1/0,F=k.pts[Math.floor(k.pts.length/2)];if(F)for(let G of S.rows){if(G===k||G.blockId!==k.blockId)continue;let _=ct(G.pts,F.x,F.y);_>1e-6&&_<E&&(E=_)}let z=Math.min(B,Math.max(E,B*.5));if(Number.isFinite(z)&&z>0)for(let G of k.seatIndices)s[G]=z}r.set(m,{sectionId:m,deckAt:C,normalAt:H,flat:x,bottomY:p,rowLevels:A,landingY:M})}for(let m=0;m<t.length;m++){let d=o[m],f=t[m];if(d){let y=a[m];i[m]=(y??r.get(d).deckAt(f.x,f.y))+ss;continue}let p=f.eyeHeightM;i[m]=Number.isFinite(p)?Math.max(0,p-Nt):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var ae={top:1,wallBottom:.5,bottomCap:.4};function ke(e,t){if(!e)return t;let n=ye(yt(e,.4),.62);return he(t,n,.72)}function dr(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,u=0,l=0;for(let[h,m]of a){let d=te(n.get(h));d&&(s+=d[0]*m,c+=d[1]*m,u+=d[2]*m,l+=m)}l>0&&o.set(i,[s/l,c/l,u/l])}return o}function mr(e,t){return te(e.color)??t.get(e.logicalSectionId??e.id)??null}var Jl=Math.PI*2;function fr(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var hr=ot(require("polygon-clipping"),1);function cs(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Qt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=ut(t),i=this.rings.filter((c,u)=>Kt(o,this.boxes[u])&&cs(n,this.levels[u])),a=[[r]];if(i.length)try{a=hr.default.difference([r],...i).map(u=>u.map(l=>l.map(([h,m])=>[h,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([l,h])=>({x:l,y:h}));if(u.length>1){let l=u[0],h=u[u.length-1];Math.abs(l.x-h.x)<1e-9&&Math.abs(l.y-h.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function ls(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let h of e)n=Math.min(n,h.x),r=Math.max(r,h.x),o=Math.min(o,h.y),i=Math.max(i,h.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,u=Math.cos(c),l=Math.sin(c);return e.map(h=>{let m=h.x-a,d=h.y-s;return{x:a+m*u-d*l,y:s+m*l+d*u}})}function Ze(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=Pt(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=Ut(n,r,e.width/2,e.height/2)}return t?ls(t,e.rotation):null}function Ct(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=t==="stage"&&fr(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var us=.08;function pr(e,t){let n=Ze(e),r=Ct(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let l of n)i=Math.min(i,l.x),a=Math.min(a,l.y),s=Math.max(s,l.x),c=Math.max(c,l.y);let u=o;for(let l of t)s>l.minX&&i<l.maxX&&c>l.minY&&a<l.maxY&&u<=l.topOffsetM+1e-6&&(u=l.topOffsetM+us);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:u}),u}function Ne(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function br(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function It(e,t,n){return[Ne(e[0],e[1],t),Ne(e[0],e[1],n),Ne(e[3],e[2],n),Ne(e[3],e[2],t)]}function yr(e,t,n){return[Ne(e[0],e[3],t),Ne(e[1],e[2],t),Ne(e[1],e[2],n),Ne(e[0],e[3],n)]}function Le(e,t,n,r,o,i){se(e,t,void 0,()=>n,r,o,i,ae)}var Nn=2.4,ds=.75,ms=.15;function At(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,u=r/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,h])=>({x:t.x+l*a-h*s,y:t.y+l*s+h*a}))}function gr(e,t,n,r,o){let i=At(t);i&&se(e,i,void 0,()=>n+Nn,n,ke(r,o.boothTop),o.boothWall,ae)}function Gn(e){if(e.shape==="round"){let l=e.radius;return l?Ut(e.center.x,e.center.y,l,l,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,h])=>({x:o.x+l*a-h*s,y:o.y+l*s+h*a}))}function xr(e,t,n,r,o){let i=Gn(t);i&&se(e,i,void 0,()=>n+ds,n,ke(r,o.tableTop),o.tableWall,ae)}function vr(e,t,n,r,o,i,a,s){let c=Ze(t);if(!c)return;let u=s?s.kind==="stage":t.role==="stage",l=s?s.kind==="screen":t.role==="screen",h=s?{kind:u?"stage":"solid",heightM:s.topY-s.baseY}:Ct(t),m=s?.baseY??n,d=s?.topY??n+r;if(u&&a){let g=1/0,x=-1/0,S=1/0,I=-1/0;for(let v of c)v.x<g&&(g=v.x),v.x>x&&(x=v.x),v.y<S&&(S=v.y),v.y>I&&(I=v.y);a.push({cx:(g+x)/2*D,cz:(S+I)/2*D,y:d,halfX:Math.max((x-g)/2*D,.5),halfZ:Math.max((I-S)/2*D,.5)})}let f=te(t.fill),p=u&&f?he(o.stageTop,ye(yt(f,.18),.9),.9):ke(f,u?o.stageTop:o.decorTop),y=l?f:null,b=u?f?he(o.stageWall,ye(f,.58),.82):o.stageWall:l?y?he(ye(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:ke(te(t.fill),o.decorWall);if(h.kind==="portal"&&c.length===4){let g=br(c);Le(e,It(g,0,.16),d,m,p,b),Le(e,It(g,.84,1),d,m,p,b),Le(e,g,d,Math.max(m,d-.35),p,b);return}if(h.kind==="suite"&&c.length===4){let g=c.map((I,v)=>{let R=c[(v+1)%4],O=(I.x+R.x)/2,V=(I.y+R.y)/2;return Math.hypot(O-i.x,V-i.y)}),x=g.indexOf(Math.min(...g)),S=[0,1,2,3].map(I=>c[(x+I)%4]);Le(e,It(S,0,.08),d,m,p,b),Le(e,It(S,.92,1),d,m,p,b),Le(e,yr(S,.88,1),d,m,p,b),Le(e,S,d,Math.max(m,d-.18),p,b);return}Le(e,c,d,m,p,b)}function zn(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),u=Math.sin(s),l=r/2,h=o/2;return[[-l,-h],[l,-h],[l,h],[-l,h]].map(([m,d])=>({x:i+m*c-d*u,y:a+m*u+d*c}))}function fs(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return te(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=te(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,u)=>he(s,c,1/(u+1)),a[0]):null}function Mr(e,t,n,r){if(t.layer==="foreground")return;let o=zn(t);if(!o)return;let i=n+ms,a=ke(fs(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=he(r.ground,a,s)),se(e,o,void 0,()=>i,n,a,he(a,r.decorWall,.5),ae)}function Sr(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=ke(r,o.gaTop);se(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ae)}var hs=Math.PI/180,$=96,ps=6,bs=60,ys=150,wr=.2,gs=.35;function xs(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/hs;return n<0?n+360:n}function qt(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function Zt(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let u=i+c;if(t)u=(u%r+r)%r;else if(u<0||u>=r)continue;a+=e[u],s++}o[i]=a/s}return o}function Pr(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let d of m.rows){for(let f of d.pts)o+=f.x,i+=f.y,a++;if(d.pts.length>=4){let f=Ln(d.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&r.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=qt(r.map(b=>b.x)),d=qt(r.map(b=>b.y)),f=0;for(let b of n)for(let g of b.rows)for(let x of g.pts){let S=Math.hypot(x.x-s.x,x.y-s.y);S>f&&(f=S)}let p=0,y=f*.2;for(let b of n)for(let g of b.rows)for(let x of g.pts)Math.hypot(x.x-m,x.y-d)<y&&p++;Math.hypot(m-s.x,d-s.y)<=f&&p/a<.01&&(c={x:m,y:d})}let u=[];for(let m of n){let d={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of m.rows)for(let p of f.pts){let y=Math.hypot(p.x-c.x,p.y-c.y),b=Math.min($-1,Math.floor(xs(c,p)/(360/$)));d.samples.push({r:y,bin:b,levelM:f.levelM}),y<d.rMin&&(d.rMin=y),y>d.rMax&&(d.rMax=y)}d.samples.length&&u.push(d)}if(!u.length)return null;u.sort((m,d)=>m.rMin+m.rMax-(d.rMin+d.rMax));let l=[];for(let m of u){let d=!1;for(let f of l){let p=Math.min(m.rMax,f.rMax)-Math.max(m.rMin,f.rMin),y=Math.min(m.rMax-m.rMin,f.rMax-f.rMin);if(y>1e-9&&p>=gs*y){f.members.push(m),f.rMin=Math.min(f.rMin,m.rMin),f.rMax=Math.max(f.rMax,m.rMax),d=!0;break}}d||l.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let h=[];for(let m of l){let d=new Array($).fill(null);for(let M of m.members)for(let P of M.samples){let C=d[P.bin];C||(C={samples:[]},d[P.bin]=C),C.samples.push({r:P.r,levelM:P.levelM})}let f=d.map(M=>!!M);if(!f.filter(Boolean).length)continue;let y=[],b=[];for(let M of d){if(!M)continue;let P=1/0,C=-1/0;for(let T of M.samples)T.r<P&&(P=T.r),T.r>C&&(C=T.r);y.push(P),b.push(C)}let g=qt(y),x=qt(b);if(!(g>=wr*x)||!(x>0))continue;let S=[...y].sort((M,P)=>M-P);if(!(S[Math.floor(S.length*.1)]>=wr*x))continue;let v=d.map(M=>{if(!M)return null;let P=[...M.samples].sort((F,z)=>F.r-z.r),C=P[0].r,T=P[P.length-1].r,H=P[0].levelM,k=-1/0;for(let F of P)F.levelM>k&&(k=F.levelM);let w=[];for(let F of P){let z={r:F.r,l:F.levelM};for(;w.length&&Math.abs(w[w.length-1].r-z.r)<1e-9;){if(w[w.length-1].l<=z.l){z.skip=!0;break}w.pop()}if(!z.skip){for(;w.length>=2;){let G=w[w.length-2],_=w[w.length-1];if((_.r-G.r)*(z.l-G.l)-(_.l-G.l)*(z.r-G.r)<=0)w.pop();else break}w.push(z)}}let B=w.map(F=>F.r),E=w.map(F=>F.l);return{inner:C,outer:T,front:H,top:k,profile:{rs:B,ls:E}}}),R=f.slice();for(let M=0;M<$;M++){if(R[M])continue;let P=-1,C=-1,T=0;for(let L=1;L<=$;L++){let Y=(M-L+$*2)%$;if(R[Y]){P=Y;break}}for(let L=1;L<=$;L++){let Y=(M+L)%$;if(R[Y]){C=Y,T=L;break}}if(P<0||C<0)continue;let H=0;for(let L=1;L<=$;L++){let Y=(M-L+$*2)%$;if(f[Y]){H=L;break}}if(H-1+T>ps)continue;let w=v[P],B=v[C],E=H/(H+T),F=w.inner+(B.inner-w.inner)*E,z=w.outer+(B.outer-w.outer)*E,G=w.front+(B.front-w.front)*E,_=w.top+(B.top-w.top)*E;v[M]={inner:F,outer:z,front:G,top:_,profile:{rs:[F,z],ls:[G,_]}}}for(let M=0;M<$;M++)v[M]&&(R[M]=!0);let O=360/$,V=[],U=R.filter(Boolean).length,N=[];if(U===$)N.push({start:0,len:$});else{let M=0;for(;R[M];)M=(M+1)%$;let P=-1;for(let C=0;C<=$;C++){let T=(M+C)%$,H=C<$&&R[T];if(H&&P<0)P=T;else if(!H&&P>=0){let k=(T-P+$)%$||$;N.push({start:P,len:k}),P=-1}}}for(let M of N){if(M.len*O<bs&&M.len<$)continue;let P=M.len===$,C=new Float64Array(M.len),T=new Float64Array(M.len),H=new Float64Array(M.len),k=new Float64Array(M.len),w=[];for(let L=0;L<M.len;L++){let Y=v[(M.start+L)%$];C[L]=Y.inner,T[L]=Y.outer,H[L]=Y.front,k[L]=Y.top,w.push(Y.profile??{rs:[Y.inner,Y.outer],ls:[Y.front,Y.top]})}let B=Zt(C,P),E=Zt(T,P),F=Zt(H,P),z=Zt(k,P);for(let L=0;L<M.len;L++)B[L]>C[L]&&(B[L]=C[L]),E[L]<T[L]&&(E[L]=T[L]),B[L]>E[L]-1e-6&&(B[L]=Math.max(0,E[L]-1e-6)),z[L]<F[L]&&(z[L]=F[L]);let G={startBin:M.start,binCount:M.len,closed:P,innerR:B,outerR:E,frontLevelM:F,topLevelM:z,profiles:w},_=(L,Y,K)=>{let J=w[L],Z=J.rs,q=J.ls;if(Y<=Z[0]){q[0]>K&&(q[0]=K);return}if(Y>=Z[Z.length-1]){q[q.length-1]>K&&(q[q.length-1]=K);return}for(let ne=0;ne+1<Z.length;ne++)if(Y<=Z[ne+1]){q[ne]>K&&(q[ne]=K),q[ne+1]>K&&(q[ne+1]=K);return}};for(let L=0;L<M.len;L++){let Y=d[(M.start+L)%$];if(Y)for(let K of Y.samples){_(L,K.r,K.levelM);let J=P?(L-1+M.len)%M.len:L-1,Z=P?(L+1)%M.len:L+1;J>=0&&_(J,K.r,K.levelM),Z<M.len&&_(Z,K.r,K.levelM)}}V.push(G)}V.reduce((M,P)=>M+P.binCount*O,0)<ys||h.push({arcs:V,sectionIds:m.members.map(M=>M.sectionId),innerRMedian:g,outerRMedian:x})}if(!h.length)return null;if(h.sort((m,d)=>m.innerRMedian-d.innerRMedian),t){let m=h[h.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:$,binStepDeg:360/$,rings:h}}function Cr(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,u=l=>{let h=t.profiles[l],m=h.rs,d=h.ls;if(r<=m[0])return d[0];if(r>=m[m.length-1])return d[d.length-1];for(let f=0;f+1<m.length;f++)if(r<=m[f+1]){let p=m[f+1]-m[f],y=p>1e-9?(r-m[f])/p:0;return d[f]+(d[f+1]-d[f])*y}return d[d.length-1]};return u(a)*(1-c)+u(s)*c}var vs=.25,Ms=1.2,Ss=.6,ws=.45,Ps=2.3,Cs=Math.PI/180;function $e(e,t,n){let r=n*Cs;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function Is(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let a=0;for(let s of i)Math.hypot(s.x-t.centre.x,s.y-t.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var As=24;function Es(e,t,n,r,o,i,a,s){let c=n.binCount,u=As,l=Ie,h=i+.02,m=[];for(let A=0;A<c;A++){let M=(n.startBin+A+.5)*t.binStepDeg,P=new Float64Array(u+1);for(let C=0;C<=u;C++){let T=r[A]+(o[A]-r[A])*C/u;P[C]=Math.max(h,Cr(t,n,M,T)-vs)}m.push(P)}let d=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],f=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],p=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],y=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],b=(A,M)=>{let P=(n.startBin+A+.5)*t.binStepDeg,C=r[A]+(o[A]-r[A])*M/u,T=$e(t.centre,C,P);return[T.x*l,m[A][M],T.y*l]};{let A=Math.tan(12*Math.PI/180);for(let M=0;M<6;M++){let P=!1;for(let T=0;T<c;T++)for(let H=u-1;H>=0;H--)m[T][H]>m[T][H+1]&&(m[T][H]=m[T][H+1],P=!0);let C=n.closed?c:c-1;for(let T=0;T<C;T++){let H=(T+1)%c;for(let k=0;k<=u;k++){let w=m[H][k]-m[T][k];if(Math.abs(w)>1)continue;let B=r[T]+(o[T]-r[T])*k/u,E=r[H]+(o[H]-r[H])*k/u,F=$e(t.centre,B,(n.startBin+T+.5)*t.binStepDeg),z=$e(t.centre,E,(n.startBin+H+.5)*t.binStepDeg),G=A*Math.hypot(z.x-F.x,z.y-F.y)*l;w>G?(m[H][k]=m[T][k]+G,P=!0):-w>G&&(m[T][k]=m[H][k]+G,P=!0)}}if(!P)break}}let g=1,x=(A,M)=>{for(let P=0;P<=u;P+=4)if(Math.abs(m[A][P]-m[M][P])>g)return!0;return Math.abs(m[A][u]-m[M][u])>g},S=Math.tan(38*Math.PI/180),I=A=>(o[A]-r[A])/u*l,v=(A,M)=>m[A][M+1]-m[A][M]>S*Math.max(1e-6,I(A)),R=(A,M)=>{let P=n.closed?(A-1+c)%c:Math.max(0,A-1),C=n.closed?(A+1)%c:Math.min(c-1,A+1);Math.abs(m[P][M]-m[A][M])>g&&(P=A),Math.abs(m[C][M]-m[A][M])>g&&(C=A);let T=Math.max(0,M-1),H=Math.min(u,M+1);T<M&&v(A,T)&&(T=M),H>M&&v(A,M)&&(H=M);let k=b(P,M),w=b(C,M),B=b(A,T),E=b(A,H),F=w[0]-k[0],z=w[1]-k[1],G=w[2]-k[2],_=E[0]-B[0],L=E[1]-B[1],Y=E[2]-B[2],K=z*Y-G*L,J=G*_-F*Y,Z=F*L-z*_,q=Math.hypot(K,J,Z);return q>1e-12?(K/=q,J/=q,Z/=q,J<0&&(K=-K,J=-J,Z=-Z),[K,J,Z]):[0,1,0]},O=(A,M)=>{let P=[A[0],i,A[2]],C=[M[0],i,M[2]],T=M[0]-A[0],H=M[2]-A[2],k=Math.hypot(T,H);if(!(k>1e-12))return;let w=[H/k,0,-T/k];e.tri(A,M,C,w,p,p,y),e.tri(A,C,P,w,p,y,y)},V=.05*Ve,U=A=>o[A]-r[A]<V,N=n.closed?c:c-1;for(let A=0;A<N;A++){let M=(A+1)%c;if(U(A)||U(M))continue;if(x(A,M)){let w=(n.startBin+A+1)*t.binStepDeg,B=(L,Y)=>{let K=(r[A]+r[M])/2,J=(o[A]+o[M])/2,Z=K+(J-K)*Y/u,q=$e(t.centre,Z,w);return[q.x*l,m[L][Y],q.y*l]};for(let L=0;L<u;L++){let Y=b(A,L),K=b(A,L+1),J=B(A,L),Z=B(A,L+1),q=R(A,L),ne=R(A,L+1);e.triN(Y,J,Z,q,q,ne,d),e.triN(Y,Z,K,q,ne,ne,d);let Ue=b(M,L),Xe=b(M,L+1),ve=B(M,L),_e=B(M,L+1),Fe=R(M,L),Me=R(M,L+1);e.triN(ve,Ue,Xe,Fe,Fe,Me,d),e.triN(ve,Xe,_e,Fe,Me,Me,d);let be=B(A,L),ce=B(A,L+1),tt=B(M,L+1),Se=B(M,L),nt=ce[0]-be[0],we=ce[2]-be[2],De=Math.hypot(nt,we);if(De>1e-12){let Tt=[we/De,0,-nt/De];e.tri(be,ce,tt,Tt,p),e.tri(be,tt,Se,Tt,p)}}let E=b(A,0),F=b(M,0),z=b(M,u),G=b(A,u),_=L=>[L[0],i,L[2]];e.tri(_(E),_(z),_(F),[0,-1,0],f),e.tri(_(E),_(G),_(z),[0,-1,0],f),O(E,F),O(G,z);continue}for(let w=0;w<u;w++){let B=R(A,w),E=R(M,w),F=R(M,w+1),z=R(A,w+1);if(v(A,w)||v(M,w)){let K=(ce,tt)=>{let Se=(n.startBin+ce+.5)*t.binStepDeg,nt=r[ce]+(o[ce]-r[ce])*(w+.5)/u,we=$e(t.centre,nt,Se);return[we.x*l,tt,we.y*l]},J=b(A,w),Z=b(M,w),q=K(A,m[A][w]),ne=K(M,m[M][w]);e.triN(J,Z,ne,B,E,E,d),e.triN(J,ne,q,B,E,B,d);let Ue=b(M,w+1),Xe=b(A,w+1),ve=K(A,m[A][w+1]),_e=K(M,m[M][w+1]);e.triN(ve,_e,Ue,z,F,F,d),e.triN(ve,Ue,Xe,z,F,z,d);let Fe=ne[0]-q[0],Me=ne[2]-q[2],be=Math.hypot(Fe,Me);if(be>1e-12){let ce=[-Me/be,0,Fe/be];e.tri(q,ne,_e,ce,p),e.tri(q,_e,ve,ce,p)}continue}let G=b(A,w),_=b(M,w),L=b(M,w+1),Y=b(A,w+1);e.triN(G,_,L,B,E,F,d),e.triN(G,L,Y,B,F,z,d)}let P=b(A,0),C=b(M,0),T=b(M,u),H=b(A,u),k=w=>[w[0],i,w[2]];e.tri(k(P),k(T),k(C),[0,-1,0],f),e.tri(k(P),k(H),k(T),[0,-1,0],f),O(P,C),O(H,T)}if(!n.closed)for(let A of[0,c-1])for(let M=0;M<u;M++)O(b(A,M),b(A,M+1))}function Ir(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let h of l.arcs){let m=new Float64Array(h.binCount),d=new Float64Array(h.binCount);for(let p=0;p<h.binCount;p++){let y=(h.startBin+p)%t.binCount,b=Math.max(0,h.innerR[p]-ge);m[p]=Math.max(b,a[y]+.001),d[p]=Math.max(m[p]+.001,h.outerR[p]+ge)}let f=0;for(let p=0;p<h.binCount;p++){let y=h.topLevelM[p]-r;y>f&&(f=y)}f>=Ms&&Es(e,t,h,m,d,r,o,i);for(let p=0;p<h.binCount;p++){let y=(h.startBin+p)%t.binCount;d[p]>a[y]&&(a[y]=d[p])}}if(Is(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Ss*Ve,u=ws*Ve;for(let l of s.arcs){let h=[],m=[];for(let p=0;p<l.binCount;p++){let y=(l.startBin+p+.5)*t.binStepDeg,b=l.outerR[p]+ge+c;h.push($e(t.centre,b,y)),m.push($e(t.centre,b+u,y))}let d=-1/0;for(let p=0;p<l.binCount;p++)l.topLevelM[p]>d&&(d=l.topLevelM[p]);let f=()=>d+Ps;l.closed?se(e,m,[h.slice().reverse()],f,r,o.shellTop,o.shellWall,i):se(e,[...m,...h.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function Ar(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,u=ke(r,s.tierTop);if(!o)return;let l=y=>o.deckAt(y.x,y.y),h=sr(t,a),m=h[0]??t.outline;if(o.rowLevels.length>=2){let y=Wt(o.rowLevels),b=cr(tr(o.rowLevels,n.focal,y),h),g=()=>[0,1,0];for(let S of b){let I=Math.max(c,S.topY-.02);for(let v of i.subtract(S.outline,I))se(e,v,S.holes,()=>I,c,u,s.tierWall,ae,void 0,g)}b.length||se(e,m,t.holes,()=>o.landingY,c,u,s.tierWall,ae);let x={tread:[u[0]*ae.top,u[1]*ae.top,u[2]*ae.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let S of h.length?h:[m])or(e,o.rowLevels,n.focal,o.landingY,x,S,y);return}let d=o.flat?1/0:lr,f=y=>o.normalAt(y.x,y.y),p=o.flat?o.landingY:void 0;for(let y of i.subtract(m,p))se(e,y,t.holes,l,c,u,s.tierWall,ae,d,f)}function Rs(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let u=t[a],l=o.get(s);l||(l=new Map,o.set(s,l));let h=u.rowId||`__seat-${a}`,m=l.get(h);m||(m={pts:[],levelM:0,n:0},l.set(h,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let u=s.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&i.push({sectionId:a.id,rows:u});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function Er(e,t,n,r,o){let i=Rs(t,n,r);if(!i.length)return;let a=Pr(i,t.focal);a&&(e.setMaterial(0),Ir(e,a,{bottomY:t.baseHeightM,colors:{bandTop:ye(o.tierTop,.8),bandWall:o.tierWall,shellTop:ye(o.tierWall,1.15),shellWall:o.tierWall},ao:ae,shapes:t.objects.filter(s=>s.type==="shape")}))}function Rr(e,t,n){return n<0?t>1?e.filter(r=>r.kind==="floor"):[...e]:e.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function Tr(e,t){let n=[...e].sort((o,i)=>o.screen.y-i.screen.y),r=[];for(let o of n){let i=r.find(a=>a.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));i?i.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var Ts=1.15,ks=3.25,Ls=4.5,_s=.85,Fs=.5,Ds=.26;function kr(e,t,n){let r=Math.max(1e-6,t),o=e/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=Ts&&a.add("zone"),o<=(i?ks:Ls)&&(a.add("section"),a.add("ga")),o<=_s&&(a.add("annotation"),a.add("booth")),o<=Fs&&a.add("row"),o<=Ds&&a.add("seat"),a}function Ge(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],u=o[1]*i+o[5]*a+o[9]*s+o[13],l=o[2]*i+o[6]*a+o[10]*s+o[14],h=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(h>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/h,d=u/h,f=l/h,p=m>=-1.05&&m<=1.05&&d>=-1.05&&d<=1.05&&f<=1;return{x:(m*.5+.5)*n,y:(1-(d*.5+.5))*r,depth:f,visible:p}}function Lr(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if(Hn(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var Os=6;function Hn(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+Os):n;return o<a&&i<r}function _r(e,t,n){return e.length*t*.58+(n?14:0)}var jn={row:8,seat:14};function Fr(e,t,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-r/2)/o);return t*(1+1.5*i)}function Un(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let u of o)if(Hn(s,u,t,n)){c=!0;break}if(!c){for(let u of a)if(Hn(s,u,t,n)){c=!0;break}}c||a.push(s)}return a}var Bs=6,Vs=2.2,Dr=.1,Ns=.3,Gs=1.8,zs=.9,Hs=.55,js=6e3;function Or(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let l of n)for(let h of l.objects)h.type==="section"&&h.zone&&c.set(h.id,h.zone);let u=new Map;for(let l=0;l<r.length;l++){let h=r[l],m=o.seatOwner[l],d=h.zoneId??(m?c.get(m):void 0);if(!d)continue;let f=u.get(d);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(d,f)),f.n++,h.x<f.minX&&(f.minX=h.x),h.y<f.minY&&(f.minY=h.y),h.x>f.maxX&&(f.maxX=h.x),h.y>f.maxY&&(f.maxY=h.y),f.sumY+=o.seatDeckY(l)}for(let l of a){let h=u.get(l.id),m=[];for(let[d,f]of c)f===l.id&&m.push(d);if(!h||h.n===0){s.push({id:l.id,label:l.label,color:te(l.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(l.focalPoint??i).x*D,1.5,(l.focalPoint??i).y*D]});continue}s.push({id:l.id,label:l.label,color:te(l.color),sectionIds:m,seatCount:h.n,center:[(h.minX+h.maxX)/2*D,h.sumY/h.n,(h.minY+h.maxY)/2*D],radius:.5*Math.hypot((h.maxX-h.minX)*D,(h.maxY-h.minY)*D)||1,focalWorld:[(l.focalPoint??i).x*D,1.5,(l.focalPoint??i).y*D]})}}return s}function Br(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,u=[],l=[],h=[];for(let m of s)m.seatCount!==0&&u.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+Bs,m.center[2]],color:t.zones?.find(d=>d.id===m.id)?.color});{let m=new Map,d=new Map;for(let f=0;f<r.length;f++){let p=o.seatOwner[f];if(!p)continue;let y=m.get(p);y||(y={n:0,x:0,y:0,deck:0},m.set(p,y)),y.n++,y.x+=r[f].x,y.y+=r[f].y,y.deck+=o.seatDeckY(f);let b=d.get(p);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},d.set(p,b)),r[f].x<b.minX&&(b.minX=r[f].x),r[f].x>b.maxX&&(b.maxX=r[f].x),r[f].y<b.minY&&(b.minY=r[f].y),r[f].y>b.maxY&&(b.maxY=r[f].y)}for(let f of n)for(let p of f.objects){if(p.type!=="section")continue;let y=m.get(p.id);if(!y||y.n===0)continue;let b=d.get(p.id),g=[y.x/y.n*D,y.deck/y.n,y.y/y.n*D],x=p.displayLabel||p.label||p.id;l.push({id:p.id,floorIndex:f.index,label:x,seatCount:y.n,center:g,radius:Math.max(1,Math.hypot(b.maxX-b.minX,b.maxY-b.minY)*.5*D),focalWorld:[f.focal.x*D,f.baseHeightM+1.5,f.focal.y*D]});let S=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&S===x.trim().toLocaleLowerCase()||u.push({id:`section:${p.id}`,kind:"section",text:x,anchor:[g[0],g[1]+Vs,g[2]],floorIndex:f.index})}}{for(let f of n)for(let p of f.objects){if(p.type!=="gaArea")continue;let y=vt(p.points);if(!y)continue;let b=p.displayLabel||p.label||p.id;u.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${b} \xB7 ${p.capacity.toLocaleString()}`:b,anchor:[y.x*D,f.baseHeightM+Gs,y.y*D],floorIndex:f.index})}let m=new Map;for(let f=0;f<r.length;f++){let p=r[f],y=Math.hypot(p.x-c.x,p.y-c.y),b=m.get(p.rowId);(!b||y>b.far)&&m.set(p.rowId,{seat:p,index:f,far:y})}for(let[f,p]of m){let y=p.seat.label?p.seat.label.lastIndexOf("-"):-1,b=y>0?p.seat.label.slice(0,y):f;b&&u.push({id:`row:${f}`,kind:"row",text:b,anchor:[p.seat.x*D,o.seatDeckY(p.index)+zs,p.seat.y*D],floorIndex:a[p.index]})}let d=new Map;for(let f=0;f<r.length;f++){let p=r[f],y=p.label?p.label.lastIndexOf("-"):-1,b=d.get(p.rowId);b||(b={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?p.label.slice(0,y):p.rowId,sectionId:p.sectionId},d.set(p.rowId,b));let g=f*3,x=i.iPosition[g],S=i.iPosition[g+1],I=i.iPosition[g+2];b.n++,b.x+=x,b.y+=S,b.z+=I,b.minX=Math.min(b.minX,x),b.maxX=Math.max(b.maxX,x),b.minZ=Math.min(b.minZ,I),b.maxZ=Math.max(b.maxZ,I)}for(let[f,p]of d)h.push({id:f,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(r.length<=js)for(let f=0;f<r.length;f++){let p=r[f],y=p.displayLabel||p.label;y&&u.push({id:`seat:${p.id}`,kind:"seat",text:y,anchor:[p.x*D,o.seatDeckY(f)+Hs,p.y*D],floorIndex:a[f]})}}for(let m of n)for(let d of m.objects)if(d.type==="shape"&&d.role&&["entrance","exit","screen","suite","obstruction"].includes(d.role)){let f=Ze(d),p=f?vt(f):null;if(!p||!d.label)continue;u.push({id:`architecture:${d.id}`,kind:"annotation",text:d.label,anchor:[p.x*D,m.baseHeightM+Ct(d).heightM+Dr,p.y*D],color:d.fill,floorIndex:m.index})}else if(d.type==="text"){if(!d.text)continue;u.push({id:`text:${d.id}`,kind:"annotation",text:d.text,anchor:[d.position.x*D,m.baseHeightM+Dr,d.position.y*D],color:d.color,rotation:d.rotation,floorIndex:m.index})}else if(d.type==="booth"){let f=At(d);if(!f)continue;let p=vt(f);if(!p)continue;u.push({id:`booth:${d.id}`,kind:"booth",text:d.displayLabel||d.label||d.id,anchor:[p.x*D,m.baseHeightM+Nn+Ns,p.y*D],floorIndex:m.index})}return{labels:u,sections:l,rows:h}}function Vr(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function Nr(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let u=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let d=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),f=m*3,p=u[d];p.minX=Math.min(p.minX,i.position[f]),p.minY=Math.min(p.minY,i.position[f+1]),p.minZ=Math.min(p.minZ,i.position[f+2]),p.maxX=Math.max(p.maxX,i.position[f]),p.maxY=Math.max(p.maxY,i.position[f+1]),p.maxZ=Math.max(p.maxZ,i.position[f+2])}let l=new Map;for(let m=0;m<n.length;m++)for(let d of n[m].objects)d.type==="section"&&l.set(d.id,m);let h=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let d=o.seatOwner[m],f=(d!==null?l.get(d):void 0)??a[m];if(f===void 0)continue;let p=h[f],y=r[m];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let b=o.seatDeckY(m);p.sumX+=y.x*D,p.sumDeck+=b,p.sumZ+=y.y*D,p.minDeck=Math.min(p.minDeck,b),p.maxDeck=Math.max(p.maxDeck,b+1.6),s[m]=f}for(let m=0;m<n.length;m++){let d=h[m],f=t.floors?.[m],p=u[m],y=Math.min(d.n?d.minX*D:n[m].focal.x*D-1,Number.isFinite(p.minX)?p.minX:1/0),b=Math.max(d.n?d.maxX*D:n[m].focal.x*D+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(d.n?d.minY*D:n[m].focal.y*D-1,Number.isFinite(p.minZ)?p.minZ:1/0),x=Math.max(d.n?d.maxY*D:n[m].focal.y*D+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),S=Math.min(d.n?Math.min(n[m].baseHeightM,d.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),I=Math.max(d.n?Math.max(d.maxDeck,S+.5):S+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),v=[d.n?d.sumX/d.n:(y+b)/2,d.n?d.sumDeck/d.n:(S+I)/2,d.n?d.sumZ/d.n:(g+x)/2],R=Math.max(1,.5*Math.hypot(b-y,I-S,x-g));c.push({index:m,id:f?.id??`floor-${m}`,label:f?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:d.n,center:v,radius:R,box:{min:[y,S,g],max:[b,I,x]},focalWorld:[n[m].focal.x*D,n[m].baseHeightM+1.5,n[m].focal.y*D]})}}return c}function Xn(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let u of c.outline)a(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)a(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)a(u.x,u.y);else if(c.type==="booth"){let u=At(c);if(u)for(let l of u)a(l.x,l.y)}else if(c.type==="table"){let u=Gn(c);if(u)for(let l of u)a(l.x,l.y)}else if(c.type==="decorImage"){let u=zn(c);if(u)for(let l of u)a(l.x,l.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Gr(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Pt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);se(e,s,void 0,()=>0,-.4,i.ground,i.ground,ae)}else{let a=t.reduce((d,f)=>f.baseHeightM<d.baseHeightM?f:d);e.setFloor(a.index);let s=n.filter((d,f)=>r[f]===a.index),c=Xn([a],s),u=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),l=Math.max(28,Math.min(80,u*.04)),h=Pt(c.minX-l,c.minY-l,c.maxX-c.minX+l*2,c.maxY-c.minY+l*2),m=a.baseHeightM-.03;se(e,h,void 0,()=>m,m-.22,i.ground,i.ground,ae)}}function zr(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,u=-1/0,l=-1/0,h=-1/0,m=(p,y,b)=>{a=Math.min(a,p),u=Math.max(u,p),s=Math.min(s,y),l=Math.max(l,y),c=Math.min(c,b),h=Math.max(h,b)};for(let p=0;p<e.position.length;p+=3)m(e.position[p],e.position[p+1],e.position[p+2]);for(let p=0;p<t.count;p++){let y=p*3,b=t.iPosition[y],g=t.iPosition[y+1],x=t.iPosition[y+2],S=Math.max(.35,t.iMaxRadius[p]??.35);m(b-S,g,x-S),m(b+S,g+1.6,x+S)}Number.isFinite(a)||(a=r-i,u=r+i,s=0,l=i*.16,c=o-i,h=o+i);let d=[(a+u)/2,(s+l)/2,(c+h)/2],f=Math.max(1,.5*Math.hypot(u-a,l-s,h-c));return{center:d,radius:f,minY:s,maxY:l}}function Hr(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let S=0;S<e.count;S++){let I=S*3,v=e.iPosition[I],R=e.iPosition[I+2];v<a&&(a=v),v>c&&(c=v),R<s&&(s=R),R>u&&(u=R)}for(let S of t)a=Math.min(a,S.cx-S.halfX),c=Math.max(c,S.cx+S.halfX),s=Math.min(s,S.cz-S.halfZ),u=Math.max(u,S.cz+S.halfZ);let l=n.minX*D,h=n.maxX*D,m=n.minY*D,d=n.maxY*D,f=l,p=h,y=m,b=d;if(Number.isFinite(a)){let S=Math.max(2,.06*Math.hypot(c-a,u-s));f=Math.max(l,a-S),p=Math.min(h,c+S),y=Math.max(m,s-S),b=Math.min(d,u+S)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[f,g,y],max:[p,x,b]}}var Yn="seatlayer.event-configuration/1";var Us=/^[a-f0-9]{64}$/,Xs=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Et(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Je(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Ys(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function jr(e){return!Array.isArray(e)||e.length>1e5||!e.every(t=>Je(t,100))?null:[...new Set(e)].sort()}function Ws(e){return!Et(e)||!Je(e.chartId,100)||!Je(e.version,100)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Us.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function Wn(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Ks(e){return Et(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&Wn(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Qs(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>1e4)return null;let n=new Set(t),r=new Set,o=new Set,i=[];for(let a of e){if(!Et(a)||!Je(a.id,100)||!Je(a.objectId,100)||!n.has(a.objectId)||!Xs.has(String(a.kind))||!Wn(a.heightM,.05,50)||a.baseElevationM!==void 0&&!Wn(a.baseElevationM,-10,100))return null;let s=Ks(a.occlusion);if(!s||r.has(a.id)||o.has(a.objectId))return null;r.add(a.id),o.add(a.objectId),i.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:s})}return i.sort((a,s)=>a.id.localeCompare(s.id))}function qs(e){let t=[];if(!Et(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Yn&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Yn}`}),Je(e.id,100)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),Je(e.label,120)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Ys(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Ws(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=Et(e.overlay)?e.overlay:null,o=jr(r?.objectIds),i=jr(r?.productionKillSeatIds),a=o?Qs(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||a===null?{issues:t}:{issues:t,value:{schema:Yn,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Ur(e){let t=qs(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Xr(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Ur(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let l of n)for(let h of l.objects)h.type==="shape"&&i.set(h.id,{shape:h,unit:l});let a=new Set,s=new Set,c=[];for(let l of o.value.overlay.productionElements??[]){let h=i.get(l.objectId),m=h?Ze(h.shape):null,d=l.baseElevationM??0;if(!h||!m||m.length<3||!l.id||a.has(l.id)||s.has(l.objectId)||!Number.isFinite(l.heightM)||l.heightM<.05||l.heightM>50||!Number.isFinite(d)||d<-10||d>100)return r();a.add(l.id),s.add(l.objectId);let f=m.map(b=>b.x*D),p=m.map(b=>b.y*D),y=h.unit.baseHeightM+d;c.push({id:l.id,objectId:l.objectId,kind:l.kind,floorIndex:h.unit.index,baseY:y,topY:y+l.heightM,bounds:{min:[Math.min(...f),y,Math.min(...p)],max:[Math.max(...f),y+l.heightM,Math.max(...p)]},occlusion:l.occlusion})}let u=c.sort((l,h)=>l.id.localeCompare(h.id));return{byObjectId:new Map(u.map(l=>[l.objectId,l])),elements:u}}function dt(e){let{doc:t}=e,n=No(t.theme),r=n.structure,o=ar(t,e.eventConfigurationId??t.eventConfigurationId),i=Xr(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new Ht,c=new Map;for(let P of o)for(let C of P.objects)c.set(C.id,P.index),C.type==="section"&&c.set(C.logicalSectionId??C.id,P.index);let u=a.map(P=>c.get(P.sectionId??"")??c.get(P.rowId??"")??0),l=Xn(o,a);Gr(s,o,a,u,l,r);let h=dr(t,a),m=new Map,d=new Map;for(let P of t.categories??[])m.set(P.key,P.color),P.seatGlyph&&d.set(P.key,P.seatGlyph);let f=[],p=ur(o,a,u),y=new Float32Array(a.length);for(let P=0;P<o.length;P++){let C=o[P];s.setFloor(P);let T=new Qt,H=[],k=C.objects.filter(w=>w.type==="section"&&!!w.outline&&w.outline.length>=3);for(let w of C.objects)if(w.type==="section")Ar(s,w,C,mr(w,h),p.bySection.get(w.id),T,k,r);else if(w.type==="shape"){let B=i.byObjectId.get(w.id);s.setMaterial((B?.kind??w.role)==="screen"?1:0),vr(s,w,C.baseHeightM,pr(w,H),r,C.focal,f,B),s.setMaterial(0)}else w.type==="gaArea"?Sr(s,w,C.baseHeightM,te(m.get(w.categoryKey)),r):w.type==="booth"?gr(s,w,C.baseHeightM,te(m.get(w.categoryKey)),r):w.type==="table"?xr(s,w,C.baseHeightM,te(m.get(w.categoryKey)),r):w.type==="decorImage"&&Mr(s,w,C.baseHeightM,r);Er(s,C,a,p,r)}let b=o.length>1?{x:o.reduce((P,C)=>P+C.focal.x,0)/o.length,y:o.reduce((P,C)=>P+C.focal.y,0)/o.length}:t.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},g=_o([s.build()]),x=Vo(a,e.initialState,p,y,m,d),S=Or({doc:t,units:o,seats:a,surfaces:p,focal:b}),{labels:I,sections:v,rows:R}=Br({doc:t,units:o,seats:a,surfaces:p,seatData:x,hintedSeatFloor:u,zones:S,focal:b}),O=Nr({doc:t,units:o,seats:a,surfaces:p,solids:g,hintedSeatFloor:u,seatFloor:y});Vr(I,O),x.iYaw=Oo(x.iPosition,a.length,P=>a[P].rowId,P=>{let C=o[y[P]]?.focal??b;return[C.x*D,C.y*D]});let V=(l.minX+l.maxX)/2*D,U=(l.minY+l.maxY)/2*D,N=.5*Math.hypot((l.maxX-l.minX)*D,(l.maxY-l.minY)*D)||10,A=zr(g,x,{cx:V,cz:U,radius:N}),M=Hr(x,f,l,A.minY,A.maxY,N);return{solids:g,seats:x,bounds:{center:[(M.min[0]+M.max[0])/2,(M.min[1]+M.max[1])/2,(M.min[2]+M.max[2])/2],radius:N,groundY:0,box:M},renderBounds:{center:A.center,radius:A.radius},stateColorLUT:Go(n,xe),theme:n,seatCount:a.length,focalWorld:[b.x*D,1.5,b.y*D],zones:S,stages:f,productionElements:i.elements,sections:v,rows:R,labels:I,floors:O}}var Zs=88,$s=20,Yr={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},$t=new Set(["row","seat"]),Wr={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Jt={row:{x:62,y:16},seat:{x:46,y:18}},Kr=te,Kn=e=>lo(e);function Qr(e,t){let n=Kn(e),r=Kn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Qn(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*r+t[o-1]*(1-r))}function Js(e,t=[.04,.06,.1],n=!0){let r=Kn(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Qn(i,t):t,s=Kr(e),c=n?7:4.5,u=s&&Qr(s,a)>=c?e:o;return r?{ink:u,backing:i,border:"rgba(210,222,245,.24)"}:{ink:u,backing:i,border:"rgba(11,18,32,.22)"}}var en=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",n.fontFamily&&(r.fontFamily=n.fontFamily),t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;let s=kr(o,i,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let g of this.labels){if(!s.has(g.kind))continue;let x=Ge(t,g.anchor,n,r);if(!x.visible)continue;let S=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:x,focus:Fr(x,S,n,r),halfWidth:_r(g.text,Yr[g.kind].size,!$t.has(g.kind))/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let u=Tr(c.filter(g=>g.label.kind==="floor"),n),l=[...c.filter(g=>!$t.has(g.label.kind)&&g.label.kind!=="floor"),...u],h=Lr(l,Zs,$s),m=Un(c.filter(g=>g.label.kind==="row"),Jt.row.x,Jt.row.y,jn.row,h),d=Un(c.filter(g=>g.label.kind==="seat"),Jt.seat.x,Jt.seat.y,jn.seat,[...h,...m]),f=[...h,...m,...d],p=new Set(f.map(g=>g.label.id));for(let{label:g,screen:x}of f){let I=this.nodeFor(g).style;I.display="",I.transform=`translate(-50%, -50%) translate(${x.x.toFixed(1)}px, ${x.y.toFixed(1)}px)`}let y=f.filter(({label:g})=>!$t.has(g.kind)).sort((g,x)=>Wr[x.label.kind]-Wr[g.label.kind]||g.screen.depth-x.screen.depth||g.focus-x.focus),b=[];for(let{label:g}of y){let x=this.nodes.get(g.id);if(!x||x.style.display==="none")continue;let S=x.getBoundingClientRect();b.some(v=>S.left<v.right+3&&S.right+3>v.left&&S.top<v.bottom+3&&S.bottom+3>v.top)?x.style.display="none":b.push(S)}for(let[g,x]of this.nodes)p.has(g)||(x.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let h=n.style;h.position="absolute",h.left="0",h.top="0",h.whiteSpace="nowrap",h.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",h.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=Yr[t.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=!$t.has(t.kind),s=Js(t.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],u=Kr(r?"#ecf8ff":s.ink)??[1,1,1],l=r?Qn("rgba(10,28,45,.9)",c):a?Qn(s.backing,c):c;return n.dataset.qualityContrast=Qr(u,l).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Zr=1;var ec=new Set(["floor","zone","section","ga","booth","annotation"]);function tc(e){return e.every(t=>Number.isFinite(t))}function nc(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function qr(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function et(e){return Math.round(e*1e4)/1e4}function oc(e){if(e)return{box:{x:et(e.box.x),y:et(e.box.y),width:et(e.box.width),height:et(e.box.height)},horizontalFillRatio:et(e.horizontalFillRatio),verticalFillRatio:et(e.verticalFillRatio),visibleAreaRatio:et(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Ae(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function tn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>ec.has(s.kind)),r=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,o=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)nc(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[Ae("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Ae("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Ae("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Ae("viewport-empty","The 3D viewport must have visible dimensions",e.viewport.width>1&&e.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${e.viewport.width}\xD7${e.viewport.height}`}]),Ae("camera-invalid","The capture camera must have a finite physical pose",tc(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Ae("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!e.scene.authoredRelief||e.scene.renderedVerticalSpanM>.05&&e.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:e.scene.projectedReliefPx,minimum:2}]),Ae("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Ae("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Ae("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Ae("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:u})=>({id:s,kind:c,text:u})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:oc(e.framing)},metrics:{minimumHierarchyFontPx:qr(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:qr(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var pe=require("ogl");var ze=require("ogl");var nn=`
21
21
  float chairWeight(float depth) {
22
22
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
23
- }`,Yr=`
23
+ }`,$r=`
24
24
  float occupantWeight(float depth) {
25
- float nearWeight = smoothstep(${po.toFixed(1)}, ${fo.toFixed(1)}, depth);
26
- float farWeight = 1.0 - smoothstep(${mo.toFixed(1)}, ${ho.toFixed(1)}, depth);
25
+ float nearWeight = smoothstep(${go.toFixed(1)}, ${xo.toFixed(1)}, depth);
26
+ float farWeight = 1.0 - smoothstep(${bo.toFixed(1)}, ${yo.toFixed(1)}, depth);
27
27
  return nearWeight * farWeight;
28
- }`,Xr=`
28
+ }`,Jr=`
29
29
  float glyphEq(float glyph, float expected) {
30
30
  return 1.0 - step(0.25, abs(glyph - expected));
31
31
  }
@@ -74,7 +74,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
74
74
  p.y += 0.16;
75
75
  }
76
76
  return p;
77
- }`,js=`#version 300 es
77
+ }`,rc=`#version 300 es
78
78
  precision highp float;
79
79
  in vec3 position;
80
80
  in vec3 normal;
@@ -110,7 +110,7 @@ void main() {
110
110
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
111
111
  vColor = color;
112
112
  gl_Position = projectionMatrix * mv;
113
- }`,Ys=`#version 300 es
113
+ }`,ic=`#version 300 es
114
114
  precision highp float;
115
115
  in vec3 vColor;
116
116
  in vec3 vNormalWorld;
@@ -177,7 +177,7 @@ void main() {
177
177
  + vec3(0.20, 0.10, 0.34) * focalHalo;
178
178
  base = mix(base, display, poweredDisplay * verticalFace * 0.92);
179
179
  fragColor = vec4(base, 1.0);
180
- }`,Xs=`#version 300 es
180
+ }`,ac=`#version 300 es
181
181
  precision highp float;
182
182
  in vec2 position; // quad corner in [-1,1]
183
183
  in vec3 iOffset; // per-instance world position
@@ -203,7 +203,7 @@ out float vDim;
203
203
  out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
204
204
  out float vPhysicalSeat;
205
205
  out float vPixelRadius;
206
- ${en}
206
+ ${nn}
207
207
  void main() {
208
208
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
209
209
  float depth = max(-mv.z, 0.001);
@@ -236,7 +236,7 @@ void main() {
236
236
  vPhysicalSeat = iPhysicalSeat;
237
237
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
238
238
  gl_Position = projectionMatrix * mv;
239
- }`,Ws=`#version 300 es
239
+ }`,sc=`#version 300 es
240
240
  precision highp float;
241
241
  in vec2 vUv;
242
242
  in vec3 vColor;
@@ -294,7 +294,7 @@ void main() {
294
294
  alpha *= vDotWeight;
295
295
  if (alpha <= 0.0) discard;
296
296
  fragColor = vec4(c, alpha);
297
- }`,Ks=`#version 300 es
297
+ }`,cc=`#version 300 es
298
298
  precision highp float;
299
299
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
300
300
  in vec3 normal;
@@ -325,9 +325,9 @@ out vec3 vRing;
325
325
  out float vDim;
326
326
  out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
327
327
  out vec3 vOccupantTint;
328
- ${en}
329
- ${Yr}
330
- ${Xr}
328
+ ${nn}
329
+ ${$r}
330
+ ${Jr}
331
331
  void main() {
332
332
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
333
333
  float viewDepth = -anchor.z;
@@ -413,7 +413,7 @@ void main() {
413
413
  vRing = iRing;
414
414
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
415
415
  gl_Position = projectionMatrix * mv;
416
- }`,Qs=`#version 300 es
416
+ }`,lc=`#version 300 es
417
417
  precision highp float;
418
418
  in vec3 vColor;
419
419
  in vec3 vNormalWorld;
@@ -468,14 +468,14 @@ void main() {
468
468
  // which is what stops a block of them merging into one mass up close.
469
469
  base += vec3(0.26, 0.31, 0.38) * fres * 0.55;
470
470
  fragColor = vec4(base, 1.0);
471
- }`,qs=`#version 300 es
471
+ }`,uc=`#version 300 es
472
472
  precision highp float;
473
473
  in vec2 position;
474
474
  out vec2 vUv;
475
475
  void main() {
476
476
  vUv = position * 0.5 + 0.5;
477
477
  gl_Position = vec4(position, 0.999, 1.0);
478
- }`,Zs=`#version 300 es
478
+ }`,dc=`#version 300 es
479
479
  precision highp float;
480
480
  in vec2 vUv;
481
481
  uniform vec3 uTop;
@@ -486,7 +486,7 @@ void main() {
486
486
  vec2 c = vUv - 0.5;
487
487
  float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
488
488
  fragColor = vec4(col * vig, 1.0);
489
- }`,$s=`#version 300 es
489
+ }`,mc=`#version 300 es
490
490
  precision highp float;
491
491
  in vec2 position;
492
492
  in vec3 iOffset;
@@ -507,7 +507,7 @@ out float vPhysicalSeat;
507
507
  out float vDotWeight;
508
508
  out float vHidden;
509
509
  flat out vec3 vPick;
510
- ${en}
510
+ ${nn}
511
511
  void main() {
512
512
  int id = gl_InstanceID + 1; // 0 reserved for no-hit
513
513
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -523,7 +523,7 @@ void main() {
523
523
  vPhysicalSeat = iPhysicalSeat;
524
524
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
525
525
  gl_Position = projectionMatrix * mv;
526
- }`,Js=`#version 300 es
526
+ }`,fc=`#version 300 es
527
527
  precision highp float;
528
528
  in vec2 vUv;
529
529
  in float vPhysicalSeat;
@@ -537,7 +537,7 @@ void main() {
537
537
  float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
538
538
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
539
539
  fragColor = vec4(vPick, 1.0);
540
- }`,ec=`#version 300 es
540
+ }`,hc=`#version 300 es
541
541
  precision highp float;
542
542
  in vec3 position;
543
543
  in float part;
@@ -558,9 +558,9 @@ uniform float uBackBase;
558
558
  uniform float uFocusFloor;
559
559
  flat out vec3 vPick;
560
560
  out float vHidden;
561
- ${en}
562
- ${Yr}
563
- ${Xr}
561
+ ${nn}
562
+ ${$r}
563
+ ${Jr}
564
564
  void main() {
565
565
  int id = int(iPickIndex + 0.5); // already global index + 1
566
566
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -593,7 +593,7 @@ void main() {
593
593
  float c = cos(iYaw), s = sin(iYaw);
594
594
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
595
595
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
596
- }`,tc=`#version 300 es
596
+ }`,pc=`#version 300 es
597
597
  precision highp float;
598
598
  flat in vec3 vPick;
599
599
  in float vHidden;
@@ -601,7 +601,7 @@ out vec4 fragColor;
601
601
  void main() {
602
602
  if (vHidden > 0.5) discard;
603
603
  fragColor = vec4(vPick, 1.0);
604
- }`,nc=`#version 300 es
604
+ }`,bc=`#version 300 es
605
605
  precision highp float;
606
606
  in vec3 position;
607
607
  in float floorIndex;
@@ -612,11 +612,11 @@ out float vHidden;
612
612
  void main() {
613
613
  vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
614
614
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
615
- }`,oc=`#version 300 es
615
+ }`,yc=`#version 300 es
616
616
  precision highp float;
617
617
  in float vHidden;
618
618
  out vec4 fragColor;
619
619
  void main() {
620
620
  if (vHidden > 0.5) discard;
621
621
  fragColor = vec4(0.0, 0.0, 0.0, 1.0);
622
- }`;function Wr(e){return new ze.Program(e,{vertex:$s,fragment:Js,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Te},uSeatScale:{value:1},uMinPixels:{value:rt},uPixelToWorld:{value:.002},uChairFull:{value:yt},uChairNone:{value:it},uFocusFloor:{value:-1}}})}function Kr(e){return new ze.Program(e,{vertex:ec,fragment:tc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:yt},uChairNone:{value:it},uBackRake:{value:An},uBackBase:{value:Ut},uFocusFloor:{value:-1}}})}function Qr(e){return new ze.Program(e,{vertex:nc,fragment:oc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function qr(e){return new ze.Program(e,{vertex:js,fragment:Ys,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function Zr(e){return new ze.Program(e,{vertex:Xs,fragment:Ws,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Te},uSeatScale:{value:1},uMinPixels:{value:rt},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:yt},uChairNone:{value:it}}})}function $r(e){return new ze.Program(e,{vertex:Ks,fragment:Qs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:yt},uChairNone:{value:it},uBackRake:{value:An},uBackBase:{value:Ut},uFocusFloor:{value:-1}}})}function Jr(e,t,n){return new ze.Program(e,{vertex:qs,fragment:Zs,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function ei(e,t,n,r,o,i){for(let a=n;a<n+r;a++){let c=i&&t[a]===0?null:o[t[a]]??o[0];e[a*3]=c?c[0]:i[a*3],e[a*3+1]=c?c[1]:i[a*3+1],e[a*3+2]=c?c[2]:i[a*3+2]}}var rc=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),ic=new Float32Array([-1,-1,3,-1,-1,3]);function ti(e,t){let n=new fe.Transform,r=new fe.Transform,o=new fe.Geometry(e,{position:{size:2,data:ic}}),i=Jr(e,t.theme.background.top,t.theme.background.bottom),a=new fe.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new fe.Geometry(e,{position:{size:3,data:t.solids.position},normal:{size:3,data:t.solids.normal},color:{size:3,data:t.solids.color},floorIndex:{size:1,data:t.solids.floor},materialIndex:{size:1,data:t.solids.material}}),c=qr(e),l=new fe.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let u=Zr(e),p=new Float32Array(t.seats.count*3),m=xe.map(A=>t.theme.seatStates[A]);ei(p,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let d=new fe.Geometry(e,{position:{size:2,data:rc},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:p,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),h=new fe.Mesh(e,{geometry:d,program:u});h.frustumCulled=!1,t.seats.count>0&&h.setParent(n);let f=d.attributes.iColor,b=ko(),y=$r(e),g=Ot,x=new Float32Array(g*3),S=new Float32Array(g*3),I=new Float32Array(g),M=new Float32Array(g),k=new Float32Array(g),O=new Float32Array(g*3),N=new Float32Array(g),j=new Float32Array(g),G=new Float32Array(g),P=new Float32Array(g),v=new fe.Geometry(e,{position:{size:3,data:b.position},normal:{size:3,data:b.normal},part:{size:1,data:b.part},index:{data:b.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:S,instanced:1},iRadius:{size:1,data:I,instanced:1},iYaw:{size:1,data:M,instanced:1},iGlyph:{size:1,data:k,instanced:1},iRing:{size:3,data:O,instanced:1},iFloor:{size:1,data:N,instanced:1},iPhysicalSeat:{size:1,data:j,instanced:1},iSeed:{size:1,data:P,instanced:1},iPickIndex:{size:1,data:G,instanced:1}}),w=new fe.Mesh(e,{geometry:v,program:y});w.frustumCulled=!1;let R=0,T=new Int32Array(0),H=()=>{let A=t.seats;for(let B=0;B<R;B++){let E=T[B];P[B]=Fo(A.iState[E],E);let z=A.iCategory&&A.iState[E]===0?null:m[A.iState[E]]??m[0];if(z)S[B*3]=z[0],S[B*3+1]=z[1],S[B*3+2]=z[2];else{let V=so([A.iCategory[E*3],A.iCategory[E*3+1],A.iCategory[E*3+2]]);S[B*3]=V[0],S[B*3+1]=V[1],S[B*3+2]=V[2]}}v.attributes.iColor.needsUpdate=!0,v.attributes.iSeed.needsUpdate=!0},C={main:n,background:r,seatProgram:u,solidProgram:c,chairProgram:y,seatGeometry:d,chairGeometry:v,solidGeometry:s,drawCalls:3,setNearSeats(A,B){let E=Math.min(B,g);if(T=A,R=E,E===0){w.parent&&w.setParent(null),v.instancedCount=0,C.drawCalls=3;return}let D=t.seats;for(let z=0;z<E;z++){let V=A[z];x[z*3]=D.iPosition[V*3],x[z*3+1]=D.iPosition[V*3+1],x[z*3+2]=D.iPosition[V*3+2],I[z]=D.iChairWidth[V],M[z]=D.iYaw[V],k[z]=D.iGlyph[V],O[z*3]=D.iRing[V*3],O[z*3+1]=D.iRing[V*3+1],O[z*3+2]=D.iRing[V*3+2],N[z]=D.iFloor[V],j[z]=D.iPhysicalSeat[V],G[z]=V+1}H(),v.attributes.iOffset.needsUpdate=!0,v.attributes.iRadius.needsUpdate=!0,v.attributes.iYaw.needsUpdate=!0,v.attributes.iGlyph.needsUpdate=!0,v.attributes.iRing.needsUpdate=!0,v.attributes.iFloor.needsUpdate=!0,v.attributes.iPhysicalSeat.needsUpdate=!0,v.attributes.iSeed.needsUpdate=!0,v.attributes.iPickIndex.needsUpdate=!0,v.instancedCount=E,w.parent||w.setParent(n),C.drawCalls=4},nearSeatCount(){return R},uploadSeatStateRuns(A){if(!A.length)return;R&&H();for(let E of A)ei(p,t.seats.iState,E.start,E.length,m,t.seats.iCategory);let B=f.buffer;if(!B){f.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,B);for(let E of A){let D=p.subarray(E.start*3,(E.start+E.length)*3);e.bufferSubData(e.ARRAY_BUFFER,E.start*3*Float32Array.BYTES_PER_ELEMENT,D)}},dispose(){o.remove(),i.remove(),s.remove(),c.remove(),d.remove(),u.remove(),v.remove(),y.remove()}};return C}var Ie=require("ogl");function ac(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function ni(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let l=0;l<t;l++){let u=(c*t+l)*4,p=ac(e[u],e[u+1],e[u+2]);if(p<0||p>=i)continue;let m=l-r,d=c-o,h=m*m+d*d;h<s&&(s=h,a=p)}return a}function oi(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,l))}}var sc=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],tn=class{constructor(t,n,r,o,i){this.seatScene=new Ie.Transform;this.chairScene=new Ie.Transform;this.solidScene=new Ie.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=Wr(this.gl),this.chairProg=Kr(this.gl),this.depthProg=Qr(this.gl);let a=new Ie.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Ie.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Ie.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of sc)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new Ie.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-o),u=Math.max(0,r-o),p=Math.max(1,Math.min(s,n+o+1)-l),m=Math.max(1,Math.min(c,r+o+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(l,u,p,m);let[d,h,f]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(d,h,f,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(p*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,u,p,m,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),ni(b,p,m,n-l,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function ri(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,bt(r.state)):n.push(r);return n}function ii(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:xe[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var He=require("ogl");function cc(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function ai(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function lc(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function si(e){let t=Math.hypot(e[0],e[1],e[2]);return t>1e-6?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function Xn(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Wn(e,t){return Math.max(0,Math.min(1,e+t))}function ci(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],l=e[i+1],u=e[Math.min(n-1,i+2)],p=a*a,m=p*a,d=[0,0,0];for(let h=0;h<3;h++)d[h]=.5*(2*c[h]+(-s[h]+l[h])*a+(2*s[h]-5*c[h]+4*l[h]-u[h])*p+(-s[h]+3*c[h]-3*l[h]+u[h])*m);return d}function Kn(e,t,n,r,o){let i=si(cc(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=ai(ai(t,lc(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=si(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,o),u=[r[0]+c[0]*l*1.3,r[1]+l*.75,r[2]+c[2]*l*1.3];return{waypoints:[e,u,a],finalPos:a}}function Qn(e,t,n=35,r=28){let o=Xn(t),i=ci(e,o),a=Xn(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function di(e,t,n){let r=e.position.clone(),o=new He.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new He.Vec3(n[0],n[1],n[2]));let i=new He.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var nn=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new He.Quat;this.endQuat=new He.Quat;this.outQuat=new He.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Qn(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Wn(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let t=this.resolveFn;this.resolveFn=null,t&&t()}};var uc=1.02,dc=1.5;function mi(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+uc;return{eye:[e[0],o,e[2]],focal:[t.x*_,n+dc,t.y*_]}}var Jn=null;function Ci(){return Jn??=Promise.resolve().then(()=>(Pi(),wi)).catch(e=>{throw Jn=null,e}),Jn}var Ai=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),ln=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=Ai(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(Ai()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:t})}panoramaFailed(t,n){this.emit("3d_panorama_failed",{seatId:t,phase:n})}panoramaFallback(t){this.emit("3d_panorama_fallback",{seatId:t})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function Ri(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function Ii(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let p=a();Object.assign(s.style,p?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},l=()=>{s?.remove(),s=null};return{show:(p,m,d=!1)=>{if(l(),e.isDisposed())return null;let h=document.createElement("div");h.setAttribute("role","group"),Object.assign(h.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let f=o.get(p),b=f?.sectionId?n.sections.find(O=>O.id===f.sectionId):void 0,y=f?.label??p;h.setAttribute("aria-label",`Explore views near ${b?.label?`${b.label}, `:""}seat ${y}`);let g=document.createElement("span");g.textContent=["Live 3D seat view",b?.label,y].filter(Boolean).join(" \xB7 "),Object.assign(g.style,{maxWidth:"min(320px, calc(100vw - 32px))",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),h.appendChild(g);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),h.appendChild(x);let S=f?.rowId?i.get(f.rowId):void 0,I=S?.indexOf(p)??-1,M=I>=0?[S?.[I-1],S?.[I+1]]:[void 0,void 0],k=(O,N,j,G=!1)=>{let P=document.createElement("button");P.type="button",P.textContent=O,P.setAttribute("aria-label",N),Object.assign(P.style,{minHeight:"44px",padding:G?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),G||(P.style.minWidth="44px"),G&&(P.dataset.panoramaTrigger=""),P.addEventListener("click",j),x.appendChild(P)};if(M[0]){let O=o.get(M[0])?.label??M[0];k("\u2039",`View previous seat ${O}`,()=>{e.flyToSeat(M[0])})}if(r.getSeatView){let O=r.seatViewActionLabel?.(p)??"Open 360\xB0 panorama";k(d?`\u21BB Retry ${O}`:`\u25C9 ${O}`,`${d?"Retry":O} from seat ${y}`,()=>{if(e.isDisposed()||m!==e.flightGen()){l();return}l(),e.openPanorama(p,400,m)},!0)}if(M[1]){let O=o.get(M[1])?.label??M[1];k("\u203A",`View next seat ${O}`,()=>{e.flyToSeat(M[1])})}return x.childElementCount?(t.appendChild(h),s=h,c(),h):null},remove:l,layout:c}}function Ei(e){let{container:t,orbit:n,isNarrow:r}=e,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.dataset.tooltip="Rotate venue";let l=document.createElement("button");l.type="button",l.textContent="\u2725",l.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),l.dataset.tooltip="Move venue";let u=document.createElement("button");u.type="button",u.textContent="\u2212",u.setAttribute("aria-label","Zoom out of the 3D venue"),u.dataset.tooltip="Zoom out";let p=document.createElement("button");p.type="button",p.textContent="+",p.setAttribute("aria-label","Zoom into the 3D venue"),p.dataset.tooltip="Zoom in";for(let f of[c,l,u,p])f.className="sl-3d-icon-control",Object.assign(f.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,l),s.append(p,u);let m=f=>{n.setPrimaryDragMode(f);let b=f==="orbit";c.setAttribute("aria-pressed",String(b)),l.setAttribute("aria-pressed",String(!b)),c.style.background=b?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=b?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=b?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>m("orbit")),l.addEventListener("click",()=>m("pan")),u.addEventListener("click",()=>n.zoomBy(1.22)),p.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),t.appendChild(o);let d=()=>{let f=r();o.style.display=i?"none":"flex",o.style.right=f?"12px":"14px",o.style.bottom=f?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=f?"none":"flex",p.style.display=f?"none":"",u.style.display=f?"none":""};return d(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:f=>{i=f,n.setInteractionEnabled(!f),d()},seatViewLocked:()=>i,layout:d}}function Ti(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:p,cancelFlight:m,focusSectionCamera:d,setSelection:h,ensureSeatView:f}=e,b=0,y=0,g=0,x=-1,S=!1,I=!1,M=G=>{e.seatViewLocked()||x===-1&&(x=G.pointerId,b=G.clientX,y=G.clientY,g=performance.now(),S=!1,I=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},k=G=>{G.pointerId===x&&Math.hypot(G.clientX-b,G.clientY-y)>u&&(S=!0)},O=(G,P,v,w,R)=>{let T=t.canvas.getBoundingClientRect(),H=t.canvas.clientWidth||T.width||1,C=t.canvas.clientHeight||T.height||1,A=G-T.left,B=P-T.top,E=w*w,D=-1,z=E,V=1/0;for(let F of o){if(v&&F.sectionId!==v)continue;let L=r.seats.idToIndex.get(F.id);if(L===void 0)continue;if(R){let ne=Math.round(r.seats.iState[L]??0);if(ne!==0&&ne!==3)continue}let X=L*3,K=Ve(n.camera.projectionViewMatrix,[r.seats.iPosition[X],r.seats.iPosition[X+1]+.55,r.seats.iPosition[X+2]],H,C);if(!K.visible)continue;let J=K.x-A,Z=K.y-B,q=J*J+Z*Z;(q<z||Math.abs(q-z)<1&&K.depth<V)&&(D=L,z=q,V=K.depth)}return D},N=(G,P)=>{let v=e.gpu(),w=e.pick();if(!v||!w)return-1;w.syncFromSeatProgram(v.seatProgram);let R=t.canvas.getBoundingClientRect(),T=t.renderer.dpr,{x:H,y:C}=oi(G,P,R,T,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),A=Math.max(2,Math.round(8*T));return w.pick(n.camera,H,C,A)};return{onDown:M,onMove:k,onUp:G=>{if(G.pointerId!==x)return;let P=!S&&performance.now()-g<p;if(x=-1,I){I=!1;return}let v=e.gpu(),w=e.pick();if(!P||!v||!w)return;let R=N(G.clientX,G.clientY);if(e.focusedSectionId()&&R>=0){let C=c[R],A=C?l.get(C):void 0;if(A&&A!==e.focusedSectionId()&&d(A))return}if(e.focusedSectionId()&&R<0&&(R=O(G.clientX,G.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&R<0){let C=O(G.clientX,G.clientY,null,72,!1),A=C>=0?c[C]:void 0,B=A?l.get(A):void 0;if(B&&B!==e.focusedSectionId()&&d(B))return}if(!e.focusedSectionId()){R<0&&(R=O(G.clientX,G.clientY,null,42,!1));let C=R>=0?c[R]:void 0,A=C?l.get(C):void 0;if(A&&d(A))return}if(R<0||R>=c.length){e.selection().size&&(h([]),i.onViewTargetChange?.(null));return}let T=c[R],H=xe[Math.round(r.seats.iState[R]??0)]??"available";if(H!=="available"&&H!=="selected"){i.onSeatInspect?.(T,H);return}if(e.selection().has(T)&&e.selection().size===1){h([]),i.onViewTargetChange?.(null);return}h([T]),f(T),s.seatPicked(T,l.get(T)),i.onSeatPick?.(T)}}}var un=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let d=0;d<this.count;d++){let h=t[d*3],f=t[d*3+2];h<n&&(n=h),h>o&&(o=h),f<r&&(r=f),f>i&&(i=f)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,l=new Int32Array(c+1),u=d=>{let h=Math.min(this.cols-1,Math.max(0,Math.floor((t[d*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[d*3+2]-r)/this.cell)))*this.cols+h};for(let d=0;d<this.count;d++)l[u(d)+1]++;for(let d=0;d<c;d++)l[d+1]+=l[d];let p=new Int32Array(this.count),m=l.slice(0,c);for(let d=0;d<this.count;d++)p[m[u(d)]++]=d;this.cellStart=l,this.cellItems=p}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,l=Math.floor((t-this.minX)/this.cell),u=Math.floor((n-this.minZ)/this.cell),p=Math.ceil(r/this.cell)+1,m=this.iPosition,d=0;for(let h=0;h<=p&&d<s;h++){let f=u-h,b=u+h,y=l-h,g=l+h;for(let x=f;x<=b&&d<s;x++){if(x<0||x>=this.rows)continue;let S=x===f||x===b;for(let I=y;I<=g&&d<s;I++){if(!S&&I!==y&&I!==g){I=g-1;continue}if(I<0||I>=this.cols)continue;let M=x*this.cols+I;for(let k=i[M],O=i[M+1];k<O&&d<s;k++){let N=a[k],j=m[N*3]-t,G=m[N*3+2]-n;j*j+G*G<=c&&(o[d++]=N)}}}}return d}};var dn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Ot);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new un(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<Mn)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>vn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,vn,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(t,n,r){let o=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?o:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};var mn=require("ogl");function ki(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=e,p=0,m=-1,d=(I,M,k=28)=>{o.camera.position.set(I[0],I[1],I[2]),o.camera.lookAt(new mn.Vec3(M[0],M[1],M[2])),o.camera.fov=k,o.camera.updateProjectionMatrix()},h=document.createElement("button");h.className="sl-3d-overview-control sl-3d-icon-control",h.type="button",h.textContent="\u2302",h.setAttribute("aria-label","Fit the active level or whole venue in view"),h.dataset.tooltip="Fit view",Object.assign(h.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let f=()=>{h.textContent="\u2302"};f();let b=I=>{m=I;let M=e.gpu();M&&(M.seatProgram.uniforms.uFocusFloor.value=I,M.solidProgram.uniforms.uFocusFloor.value=I,M.chairProgram.uniforms.uFocusFloor.value=I),e.showSectionSeatLabels(null)},y=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),h.style.display="",c.setVisible(!0),e.setFrozen(!1);let I=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!I),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),I){let M=I.focalWorld[0]-I.center[0],k=I.focalWorld[2]-I.center[2],O=Math.hypot(M,k)>I.radius*.12?Math.atan2(M,k):l,N={center:I.center,radius:I.radius,box:I.box},j={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(N,!1,O,!1,j):o.frameSoft(N,O,!1,j)}else e.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,u):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,u);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{p++,e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=I=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let M=n.seats.idToIndex.get(I);if(M===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(I),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),h.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1),e.setSeatViewLocked(!1);let k=++p;e.removeArriveChip();let{eye:O,focal:N}=e.resolvedSeatViewPose(I,M),j=[o.camera.position.x,o.camera.position.y,o.camera.position.z],G=Kn(j,O,N,n.bounds.center,n.bounds.radius),P=r.arriveAtSeatEye?O:G.finalPos,v=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,w=[G.waypoints[0],G.waypoints[1],P];if(c.setVisible(!1),e.reducedMotion())return d(P,N,v),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(I,k),Promise.resolve();let R=new mn.Quat().copy(o.camera.quaternion),T=di(o.camera,P,N);return s.requestRender(),i.start(w,R,T,2500,v).then(()=>{e.isDisposed()||k!==p||(a.cinematicPlayed(2500),o.resumeAfterFlight(N),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(I,k))})},S=I=>{let M=n.sections.find(j=>j.id===I);if(!M||M.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==M.floorIndex&&b(M.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(I);let k=M.focalWorld[0]-M.center[0],O=M.focalWorld[2]-M.center[2],N=Math.hypot(k,O)>M.radius*.12?Math.atan2(k,O):void 0;return o.frame({center:M.center,radius:Math.max(5,M.radius*.5)},!1,N),r.onSectionFocusChange?.(I),s.requestRender(),!0};return h.addEventListener("click",y),{overviewChip:h,layoutOverviewChip:f,flightGen:()=>p,focusedFloor:()=>m,applyFloorFocus:b,placeCameraFinal:d,cancelFlight:g,focusOverview:y,flyToSeat:x,focusSectionCamera:S}}var Cc={};function Li(e){let t=performance.now();return{model:lt(e),buildMs:performance.now()-t,source:"main"}}function Fi(e){return typeof Worker>"u"?Promise.resolve(Li(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",Cc.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(Li(e)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(e)})}var Ac=Math.PI/180,Rc=6,Ic=500;function Ec(e,t,n={}){let r=performance.now(),o=t.prepared?.model??lt(t),i=new ln(n.onAnalytics),a=new Array(o.seats.count);for(let[U,Y]of o.seats.idToIndex)a[Y]=U;let s=new Map(t.seats.map(U=>[U.id,U])),c=new Map;for(let U of t.seats){if(!U.rowId)continue;let Y=c.get(U.rowId);Y?Y.push(U.id):c.set(U.rowId,[U.id])}let l=new Map;for(let U of t.seats)l.set(U.id,U.sectionId);let u=t.doc.floors?.some(Y=>(Y.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&((Y.height??0)>0||(Y.rake??0)>0)),p=null,m=null,d=!1,h=!1,f=!1,b=new Map,y=null,g=null,x=null,S=new Map,I=null,M=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},k=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},O=!1,N=()=>O?me.focusedFloor():-1,j=()=>{p=ti(w.gl,o),m=new tn(w.renderer,p.seatGeometry,p.chairGeometry,p.solidGeometry,o.seats.count),w.setClearColor(o.theme.background.top),m.setRestoreClear(o.theme.background.top),p.seatProgram.uniforms.uSeatRadius.value=Te*o.theme.seatScale,p.seatProgram.uniforms.uFocusFloor.value=N(),p.solidProgram.uniforms.uFocusFloor.value=N(),p.chairProgram.uniforms.uFocusFloor.value=N(),P.forceRegather()},G=!1,P=new dn({model:o,orbit:()=>R,gpu:()=>p}),v=U=>P.setDetailEnabled(U),w=new Ft(e,{onContextLost:()=>{f||i.contextLost(),d=!0,X.stop(),p=null,m=null},onContextRestored:()=>{j(),d=!1,f||i.contextRestored(),X.requestRender()}}),R=new Dt(w.gl,w.canvas,()=>X.requestRender(),()=>i.orbitEngaged());R.setAspect(w.aspect);let T=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),H=(()=>{if(T&&o.stages.length===0)return;let U=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(U,Y)>o.bounds.radius*.12?Math.atan2(U,Y):void 0})(),C=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,A=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;R.frame(o.bounds,!A&&n.skipInitialOverviewAnimation!==!0,H,n.portraitOverviewCrop===!0,C);let B=new nn(R.camera),E=Ri(e),D=new $t(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),z=o.labels,V=()=>Cr(z,o.floors.length,N());D.setLabels(V());let F=null,L=U=>{if(F=U,D.setForcedDense(!!U),!U){D.setLabels(V());return}let Y=t.seats.filter(Q=>Q.sectionId===U),W=new Set(Y.map(Q=>Q.id)),ee=new Set(Y.map(Q=>Q.rowId)),oe=new Set(b.keys()),re=new Set(Y.filter(Q=>oe.has(Q.id)).map(Q=>Q.id)),le=V().filter(Q=>Q.kind!=="row"&&Q.kind!=="seat"||(Q.kind==="row"?ee.has(Q.id.slice(4)):W.has(Q.id.slice(5))&&(re.size===0||re.has(Q.id.slice(5)))));if(o.seatCount<=6e3&&re.size===0){D.setLabels(le);return}let ue=re.size?Y.filter(Q=>re.has(Q.id)):Y,Xe=new Set(ue.map(Q=>`seat:${Q.id}`)),Be=ue.flatMap(Q=>{let he=o.seats.idToIndex.get(Q.id);if(he===void 0)return[];let Pe=he*3;return[{id:`seat:${Q.id}`,kind:"seat",text:Q.displayLabel||Q.label,anchor:[o.seats.iPosition[Pe],o.seats.iPosition[Pe+1]+(oe.has(Q.id)?1.05:.55),o.seats.iPosition[Pe+2]]}]});D.setLabels([...le.filter(Q=>!Xe.has(Q.id)),...Be])};j();let X=new _t(U=>{if(d||!p||h)return!1;let W=B.active?B.update(performance.now()):R.update(),ee=N()>=0?o.floors[N()]:null,oe=ee?.radius??o.bounds.radius,re=bo(R.currentDistance,oe),le=G?{center:[R.camera.position.x,R.camera.position.y,R.camera.position.z],radius:520}:o.renderBounds;R.updateClipping(le);let ue=ee?.center??o.renderBounds.center,Xe=ee?.radius??o.renderBounds.radius,Be=(Ce,ht)=>Math.hypot(R.camera.position.x-Ce[0],R.camera.position.y-Ce[1],R.camera.position.z-Ce[2])<=ht*(P.detailVisible?1.8:1.55),Q=Be(ue,Xe);if(!Q&&F){let Ce=o.sections.find(ht=>ht.id===F);Ce&&(Q=Be(Ce.center,Math.max(12,Ce.radius*2)))}P.detailVisible=Q;let he=p.seatProgram.uniforms;he.uSeatScale.value=re.scale,he.uSeatFade.value=re.fade;let Pe=!!ee&&yo(ee.seatCount,w.canvas.clientWidth||1,w.canvas.clientHeight||1),Et=go(o.seats.count,oe,R.currentDistance,R.camera.fov,w.canvas.clientHeight||1),mt=P.detailVisible||Pe||Et?1:0,Tt=P.detailVisible||N()>=0||o.floors.length>1?1:0;return P.ease(U,mt,Tt),he.uSeatDetail.value=P.seatDetailMix,p.solidProgram.uniforms.uStructureDetail.value=P.structureDetailMix,he.uMinPixels.value=re.minPixels,he.uPixelToWorld.value=2*Math.tan(R.camera.fov*Ac/2)/Math.max(1,w.pixelHeight),P.update(P.detailVisible),w.renderer.render({scene:p.background,clear:!0}),w.renderer.render({scene:p.main,camera:R.camera,clear:!1}),D.update(R.camera.projectionViewMatrix,w.canvas.clientWidth||1,w.canvas.clientHeight||1,R.currentDistance,oe,[R.camera.position.x,R.camera.position.y,R.camera.position.z]),W||P.seatDetailMix!==mt||P.structureDetailMix!==Tt}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>pn.resize()):null;K?.observe(e);let J=U=>{let Y=oe=>{let re=o.seats.idToIndex.get(oe);return re===void 0?void 0:o.seats.iState[re]},{updates:W,next:ee}=ii(b,U,Y);if(b=ee,D.setSelectedSeatIds(b.keys()),F&&L(F),W.length){let oe=In(o.seats,W);p&&p.uploadSeatStateRuns(oe),X.requestRender()}},Z=()=>I!==null?I:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=8,ne=U=>{if(!n.getSeatView)return null;let Y=S.get(U);if(!Y)for(Y=Promise.resolve(n.getSeatView(U)),S.set(U,Y),Y.catch(()=>{S.get(U)===Y&&S.delete(U)});S.size>q;){let W=S.keys().next().value;if(W===void 0)break;S.delete(W)}return Y},je=(U,Y)=>{let W=s.get(U),ee=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),oe=t.doc.floors?.[ee],re=o.floors[ee],le=oe?.focalPoint??t.doc.focalPoint,ue=re?{x:re.focalWorld[0]/_,y:re.focalWorld[2]/_}:le,Xe=W?.focalPoint?{x:W.focalPoint.x+ue.x-le.x,y:W.focalPoint.y+ue.y-le.y}:ue,Be=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return mi(Be,Xe,oe?.baseHeightM??0,W?.eyeHeightM)},Ye=()=>(e.clientWidth||w.canvas.clientWidth)<=520,ve=null,Fe=null,De=async(U,Y,W)=>{if(!n.getSeatView||f||W!==me.flightGen())return;let ee;try{ee=await Ci()}catch{if(i.panoramaFailed(U,"mount"),!f&&W===me.flightGen()){let oe=be(U,W,!0);requestAnimationFrame(()=>oe?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(f||W!==me.flightGen()||!ve))return Fe??=ee.createOpenPanorama(ve),Fe(U,Y,W)},Me=Ii({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:Ye,isDisposed:()=>f,flightGen:()=>me.flightGen(),flyToSeat:U=>to(U),openPanorama:(U,Y,W)=>De(U,Y,W)}),be=Me.show,ce=Me.remove,Je=Me.layout,Se=Ei({container:e,orbit:R,isNarrow:Ye}),et=Se.element,we=Se.setNavigationMode,_e=Se.setSeatViewLocked,It=Se.layout,Di=Se.utilityControls,me=ki({container:e,model:o,opts:n,orbit:R,cinematic:B,analytics:i,loop:X,labelOverlay:D,stageAzimuth:H,overviewFraming:C,gpu:()=>p,isDisposed:()=>f,panorama:()=>y,setPanorama:U=>{y=U},setPanoramaSphereVisible:U=>{G=U},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:U=>{g=U},setFrozen:U=>{h=U},restorePanoramaLayer:k,reducedMotion:Z,resolvedSeatViewPose:je,showSectionSeatLabels:L,setNearFieldDetailEnabled:v,setSeatViewLocked:_e,setNavigationMode:we,showArriveChip:be,removeArriveChip:ce});O=!0;let hn=me.overviewChip,_i=me.layoutOverviewChip,Oi=me.applyFloorFocus,Bi=me.focusOverview,eo=me.cancelFlight,to=me.flyToSeat,no=me.focusSectionCamera;Di.appendChild(hn),ve={container:e,model:o,opts:n,analytics:i,orbit:R,loop:X,seatsById:s,ensureSeatView:ne,resolvedSeatViewPose:je,gpu:()=>p,gl:w.gl,isContextLost:()=>d,isDisposed:()=>f,flightGen:()=>me.flightGen(),setPanorama:U=>{y=U},getLoadAbort:()=>g,setLoadAbort:U=>{g=U},setPanoramaSphereVisible:U=>{G=U},setFrozen:U=>{h=U},raisePanoramaLayer:M,restorePanoramaLayer:k,getOverviewChip:()=>hn,labelOverlay:D,reducedMotion:Z,removeArriveChip:ce,showArriveChip:be};let Oe=Ti({glctx:w,orbit:R,model:o,seats:t.seats,opts:n,cinematic:B,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:Rc,tapMs:Ic,gpu:()=>p,pick:()=>m,seatViewLocked:()=>Se.seatViewLocked(),focusedSectionId:()=>F,selection:()=>b,cancelFlight:eo,focusSectionCamera:no,setSelection:J,ensureSeatView:ne});w.canvas.addEventListener("pointerdown",Oe.onDown),w.canvas.addEventListener("pointermove",Oe.onMove),w.canvas.addEventListener("pointerup",Oe.onUp),w.canvas.addEventListener("pointercancel",Oe.onUp),X.requestRender();let pn={setAvailability(U){let Y=ri(b,U),W=In(o.seats,Y);W.length&&p&&p.uploadSeatStateRuns(W),X.requestRender()},setSelection:J,flyToSeat:to,focusOverview:Bi,resize(){let{width:U,height:Y}=w.resize();R.setAspect(U/Math.max(1,Y)),Je(),It(),_i(),X.requestRender()},stats(){return{...X.stats(),drawCalls:p?p.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let U=X.stats(),Y=w.canvas.clientWidth||1,W=w.canvas.clientHeight||1,ee=o.bounds.center,oe=Ve(R.camera.projectionViewMatrix,[ee[0],o.bounds.box.min[1],ee[2]],Y,W),re=Ve(R.camera.projectionViewMatrix,[ee[0],o.bounds.box.max[1],ee[2]],Y,W),le=o.bounds.box,ue=[le.min[0],le.max[0]].flatMap(Q=>[le.min[1],le.max[1]].flatMap(he=>[le.min[2],le.max[2]].map(Pe=>Ve(R.camera.projectionViewMatrix,[Q,he,Pe],Y,W)))).filter(Q=>Number.isFinite(Q.x)&&Number.isFinite(Q.y)&&Number.isFinite(Q.depth)),Xe=ue.length?(()=>{let Q=Math.min(...ue.map(We=>We.x)),he=Math.max(...ue.map(We=>We.x)),Pe=Math.min(...ue.map(We=>We.y)),Et=Math.max(...ue.map(We=>We.y)),mt=Math.max(0,Q),Tt=Math.min(Y,he),Ce=Math.max(0,Pe),ht=Math.min(W,Et),kt=Math.max(0,Tt-mt),fn=Math.max(0,ht-Ce);return{box:{x:mt,y:Ce,width:kt,height:fn},horizontalFillRatio:kt/Y,verticalFillRatio:fn/W,visibleAreaRatio:kt*fn/(Y*W),clippedEdges:[...Pe<0?["top"]:[],...he>Y?["right"]:[],...Et>W?["bottom"]:[],...Q<0?["left"]:[]]}})():void 0,Be=String(w.gl.getParameter(w.gl.VERSION)??"");return{viewport:{width:Y,height:W},context:{webgl2:/webgl\s*2/i.test(Be),lost:d},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[R.camera.position.x,R.camera.position.y,R.camera.position.z],distance:R.currentDistance,verticalFovDeg:R.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:u,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:oe.visible&&re.visible?Math.abs(oe.y-re.y):0},labels:D.qualityEvidence(),framing:Xe}},getQualityReport(){return Jt(pn.getQualityEvidence())},loseContextForTest(){w.simulateContextLossCycle()},floors(){return o.floors},focusFloor(U){if(U!==null&&!o.floors.some(W=>W.index===U))return!1;let Y=U??-1;if(v(U!==null),_e(!1),Oi(Y),we("orbit"),U===null)B.cancel(),Z()?R.frame(o.bounds,!1,H,n.portraitOverviewCrop===!0,C):R.frameSoft(o.bounds,H,n.portraitOverviewCrop===!0,C);else{let W=o.floors[U];if(W.seatCount>0){B.cancel();let ee=W.focalWorld[0]-W.center[0],oe=W.focalWorld[2]-W.center[2],re=Math.hypot(ee,oe)>W.radius*.12?Math.atan2(ee,oe):H;R.frame({center:W.center,radius:W.radius,box:W.box},!1,re,!1,{polarDeg:58,margin:1.12})}}return X.requestRender(),!0},zones(){return o.zones},focusZone(U){let Y=o.zones.find(re=>re.id===U);if(!Y||Y.seatCount===0)return!1;v(!1),_e(!1),B.cancel(),we("orbit"),L(null),n.onSectionFocusChange?.(null);let W=Y.focalWorld[0]-Y.center[0],ee=Y.focalWorld[2]-Y.center[2],oe=Math.hypot(W,ee)>Y.radius*.12?Math.atan2(W,ee):void 0;return R.frame({center:Y.center,radius:Y.radius*1.25},!1,oe),X.requestRender(),!0},sections(){return o.sections},focusSection(U){return no(U)},rows(U){return U?o.rows.filter(Y=>Y.sectionId===U):o.rows},seatsInRow(U){return t.seats.filter(Y=>Y.rowId===U).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(U){let Y=o.rows.find(W=>W.id===U);return!Y||Y.seatCount===0?!1:(v(!0),_e(!1),B.cancel(),we("pan"),Y.sectionId&&(L(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),R.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),X.requestRender(),!0)},setReducedMotionForTest(U){I=U},dispose(){f=!0,ce(),hn.remove(),et.remove(),eo(),X.stop(),D.dispose(),K?.disconnect(),y&&(y.dispose(),y=null),k(),E(),w.canvas.removeEventListener("pointerdown",Oe.onDown),w.canvas.removeEventListener("pointermove",Oe.onMove),w.canvas.removeEventListener("pointerup",Oe.onUp),w.canvas.removeEventListener("pointercancel",Oe.onUp),R.dispose(),m&&m.dispose(),p&&p.dispose(),p=null,m=null,w.dispose()}};return i.opened(o.seatCount,u,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),pn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});
622
+ }`;function ei(e){return new ze.Program(e,{vertex:mc,fragment:fc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Te},uSeatScale:{value:1},uMinPixels:{value:at},uPixelToWorld:{value:.002},uChairFull:{value:xt},uChairNone:{value:st},uFocusFloor:{value:-1}}})}function ti(e){return new ze.Program(e,{vertex:hc,fragment:pc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:xt},uChairNone:{value:st},uBackRake:{value:En},uBackBase:{value:Xt},uFocusFloor:{value:-1}}})}function ni(e){return new ze.Program(e,{vertex:bc,fragment:yc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function oi(e){return new ze.Program(e,{vertex:rc,fragment:ic,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function ri(e){return new ze.Program(e,{vertex:ac,fragment:sc,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Te},uSeatScale:{value:1},uMinPixels:{value:at},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:xt},uChairNone:{value:st}}})}function ii(e){return new ze.Program(e,{vertex:cc,fragment:lc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:xt},uChairNone:{value:st},uBackRake:{value:En},uBackBase:{value:Xt},uFocusFloor:{value:-1}}})}function ai(e,t,n){return new ze.Program(e,{vertex:uc,fragment:dc,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function si(e,t,n,r,o,i){for(let a=n;a<n+r;a++){let c=i&&t[a]===0?null:o[t[a]]??o[0];e[a*3]=c?c[0]:i[a*3],e[a*3+1]=c?c[1]:i[a*3+1],e[a*3+2]=c?c[2]:i[a*3+2]}}var gc=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),xc=new Float32Array([-1,-1,3,-1,-1,3]);function ci(e,t){let n=new pe.Transform,r=new pe.Transform,o=new pe.Geometry(e,{position:{size:2,data:xc}}),i=ai(e,t.theme.background.top,t.theme.background.bottom),a=new pe.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new pe.Geometry(e,{position:{size:3,data:t.solids.position},normal:{size:3,data:t.solids.normal},color:{size:3,data:t.solids.color},floorIndex:{size:1,data:t.solids.floor},materialIndex:{size:1,data:t.solids.material}}),c=oi(e),u=new pe.Mesh(e,{geometry:s,program:c});u.frustumCulled=!1,u.setParent(n);let l=ri(e),h=new Float32Array(t.seats.count*3),m=xe.map(w=>t.theme.seatStates[w]);si(h,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let d=new pe.Geometry(e,{position:{size:2,data:gc},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:h,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),f=new pe.Mesh(e,{geometry:d,program:l});f.frustumCulled=!1,t.seats.count>0&&f.setParent(n);let p=d.attributes.iColor,y=Do(),b=ii(e),g=Vt,x=new Float32Array(g*3),S=new Float32Array(g*3),I=new Float32Array(g),v=new Float32Array(g),R=new Float32Array(g),O=new Float32Array(g*3),V=new Float32Array(g),U=new Float32Array(g),N=new Float32Array(g),A=new Float32Array(g),M=new pe.Geometry(e,{position:{size:3,data:y.position},normal:{size:3,data:y.normal},part:{size:1,data:y.part},index:{data:y.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:S,instanced:1},iRadius:{size:1,data:I,instanced:1},iYaw:{size:1,data:v,instanced:1},iGlyph:{size:1,data:R,instanced:1},iRing:{size:3,data:O,instanced:1},iFloor:{size:1,data:V,instanced:1},iPhysicalSeat:{size:1,data:U,instanced:1},iSeed:{size:1,data:A,instanced:1},iPickIndex:{size:1,data:N,instanced:1}}),P=new pe.Mesh(e,{geometry:M,program:b});P.frustumCulled=!1;let C=0,T=new Int32Array(0),H=()=>{let w=t.seats;for(let B=0;B<C;B++){let E=T[B];A[B]=Bo(w.iState[E],E);let z=w.iCategory&&w.iState[E]===0?null:m[w.iState[E]]??m[0];if(z)S[B*3]=z[0],S[B*3+1]=z[1],S[B*3+2]=z[2];else{let G=mo([w.iCategory[E*3],w.iCategory[E*3+1],w.iCategory[E*3+2]]);S[B*3]=G[0],S[B*3+1]=G[1],S[B*3+2]=G[2]}}M.attributes.iColor.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0},k={main:n,background:r,seatProgram:l,solidProgram:c,chairProgram:b,seatGeometry:d,chairGeometry:M,solidGeometry:s,drawCalls:3,setNearSeats(w,B){let E=Math.min(B,g);if(T=w,C=E,E===0){P.parent&&P.setParent(null),M.instancedCount=0,k.drawCalls=3;return}let F=t.seats;for(let z=0;z<E;z++){let G=w[z];x[z*3]=F.iPosition[G*3],x[z*3+1]=F.iPosition[G*3+1],x[z*3+2]=F.iPosition[G*3+2],I[z]=F.iChairWidth[G],v[z]=F.iYaw[G],R[z]=F.iGlyph[G],O[z*3]=F.iRing[G*3],O[z*3+1]=F.iRing[G*3+1],O[z*3+2]=F.iRing[G*3+2],V[z]=F.iFloor[G],U[z]=F.iPhysicalSeat[G],N[z]=G+1}H(),M.attributes.iOffset.needsUpdate=!0,M.attributes.iRadius.needsUpdate=!0,M.attributes.iYaw.needsUpdate=!0,M.attributes.iGlyph.needsUpdate=!0,M.attributes.iRing.needsUpdate=!0,M.attributes.iFloor.needsUpdate=!0,M.attributes.iPhysicalSeat.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0,M.attributes.iPickIndex.needsUpdate=!0,M.instancedCount=E,P.parent||P.setParent(n),k.drawCalls=4},nearSeatCount(){return C},uploadSeatStateRuns(w){if(!w.length)return;C&&H();for(let E of w)si(h,t.seats.iState,E.start,E.length,m,t.seats.iCategory);let B=p.buffer;if(!B){p.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,B);for(let E of w){let F=h.subarray(E.start*3,(E.start+E.length)*3);e.bufferSubData(e.ARRAY_BUFFER,E.start*3*Float32Array.BYTES_PER_ELEMENT,F)}},dispose(){o.remove(),i.remove(),s.remove(),c.remove(),d.remove(),l.remove(),M.remove(),b.remove()}};return k}var Ee=require("ogl");function vc(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function li(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let u=0;u<t;u++){let l=(c*t+u)*4,h=vc(e[l],e[l+1],e[l+2]);if(h<0||h>=i)continue;let m=u-r,d=c-o,f=m*m+d*d;f<s&&(s=f,a=h)}return a}function ui(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),u=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,u))}}var Mc=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],on=class{constructor(t,n,r,o,i){this.seatScene=new Ee.Transform;this.chairScene=new Ee.Transform;this.solidScene=new Ee.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=ei(this.gl),this.chairProg=ti(this.gl),this.depthProg=ni(this.gl);let a=new Ee.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Ee.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Ee.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of Mc)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new Ee.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,u=Math.max(0,n-o),l=Math.max(0,r-o),h=Math.max(1,Math.min(s,n+o+1)-u),m=Math.max(1,Math.min(c,r+o+1)-l);i.enable(i.SCISSOR_TEST),i.scissor(u,l,h,m);let[d,f,p]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(d,f,p,1),i.disable(i.SCISSOR_TEST);let y=new Uint8Array(h*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(u,l,h,m,i.RGBA,i.UNSIGNED_BYTE,y),this.renderer.bindFramebuffer(),li(y,h,m,n-u,r-l,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function di(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,gt(r.state)):n.push(r);return n}function mi(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:xe[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var He=require("ogl");function Sc(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function fi(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function wc(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function hi(e){let t=Math.hypot(e[0],e[1],e[2]);return t>1e-6?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function qn(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Zn(e,t){return Math.max(0,Math.min(1,e+t))}function pi(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],u=e[i+1],l=e[Math.min(n-1,i+2)],h=a*a,m=h*a,d=[0,0,0];for(let f=0;f<3;f++)d[f]=.5*(2*c[f]+(-s[f]+u[f])*a+(2*s[f]-5*c[f]+4*u[f]-l[f])*h+(-s[f]+3*c[f]-3*u[f]+l[f])*m);return d}function $n(e,t,n,r,o){let i=hi(Sc(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=fi(fi(t,wc(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=hi(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let u=Math.max(1,o),l=[r[0]+c[0]*u*1.3,r[1]+u*.75,r[2]+c[2]*u*1.3];return{waypoints:[e,l,a],finalPos:a}}function Jn(e,t,n=35,r=28){let o=qn(t),i=pi(e,o),a=qn(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function gi(e,t,n){let r=e.position.clone(),o=new He.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new He.Vec3(n[0],n[1],n[2]));let i=new He.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var rn=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new He.Quat;this.endQuat=new He.Quat;this.outQuat=new He.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Jn(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Zn(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let t=this.resolveFn;this.resolveFn=null,t&&t()}};var Pc=1.02,Cc=1.5;function xi(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+Pc;return{eye:[e[0],o,e[2]],focal:[t.x*D,n+Cc,t.y*D]}}var oo=null;function Li(){return oo??=Promise.resolve().then(()=>(ki(),Ti)).catch(e=>{throw oo=null,e}),oo}var _i=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),dn=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=_i(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(_i()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:t})}panoramaFailed(t,n){this.emit("3d_panorama_failed",{seatId:t,phase:n})}panoramaFallback(t){this.emit("3d_panorama_fallback",{seatId:t})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function Fi(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function Di(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let h=a();Object.assign(s.style,h?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{s?.remove(),s=null};return{show:(h,m,d=!1)=>{if(u(),e.isDisposed())return null;let f=document.createElement("div");f.setAttribute("role","group"),Object.assign(f.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.get(h),y=p?.sectionId?n.sections.find(O=>O.id===p.sectionId):void 0,b=p?.label??h;f.setAttribute("aria-label",`Explore views near ${y?.label?`${y.label}, `:""}seat ${b}`);let g=document.createElement("span");g.textContent=["Live 3D seat view",y?.label,b].filter(Boolean).join(" \xB7 "),Object.assign(g.style,{maxWidth:"min(320px, calc(100vw - 32px))",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),f.appendChild(g);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(x);let S=p?.rowId?i.get(p.rowId):void 0,I=S?.indexOf(h)??-1,v=I>=0?[S?.[I-1],S?.[I+1]]:[void 0,void 0],R=(O,V,U,N=!1)=>{let A=document.createElement("button");A.type="button",A.textContent=O,A.setAttribute("aria-label",V),Object.assign(A.style,{minHeight:"44px",padding:N?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),N||(A.style.minWidth="44px"),N&&(A.dataset.panoramaTrigger=""),A.addEventListener("click",U),x.appendChild(A)};if(v[0]){let O=o.get(v[0])?.label??v[0];R("\u2039",`View previous seat ${O}`,()=>{e.flyToSeat(v[0])})}if(r.getSeatView){let O=r.seatViewActionLabel?.(h)??"Open 360\xB0 panorama";R(d?`\u21BB Retry ${O}`:`\u25C9 ${O}`,`${d?"Retry":O} from seat ${b}`,()=>{if(e.isDisposed()||m!==e.flightGen()){u();return}u(),e.openPanorama(h,400,m)},!0)}if(v[1]){let O=o.get(v[1])?.label??v[1];R("\u203A",`View next seat ${O}`,()=>{e.flyToSeat(v[1])})}return x.childElementCount?(t.appendChild(f),s=f,c(),f):null},remove:u,layout:c}}function Oi(e){let{container:t,orbit:n,isNarrow:r}=e,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.dataset.tooltip="Rotate venue";let u=document.createElement("button");u.type="button",u.textContent="\u2725",u.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),u.dataset.tooltip="Move venue";let l=document.createElement("button");l.type="button",l.textContent="\u2212",l.setAttribute("aria-label","Zoom out of the 3D venue"),l.dataset.tooltip="Zoom out";let h=document.createElement("button");h.type="button",h.textContent="+",h.setAttribute("aria-label","Zoom into the 3D venue"),h.dataset.tooltip="Zoom in";for(let p of[c,u,l,h])p.className="sl-3d-icon-control",Object.assign(p.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,u),s.append(h,l);let m=p=>{n.setPrimaryDragMode(p);let y=p==="orbit";c.setAttribute("aria-pressed",String(y)),u.setAttribute("aria-pressed",String(!y)),c.style.background=y?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",u.style.background=y?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=y?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>m("orbit")),u.addEventListener("click",()=>m("pan")),l.addEventListener("click",()=>n.zoomBy(1.22)),h.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),t.appendChild(o);let d=()=>{let p=r();o.style.display=i?"none":"flex",o.style.right=p?"12px":"14px",o.style.bottom=p?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=p?"none":"flex",h.style.display=p?"none":"",l.style.display=p?"none":""};return d(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:p=>{i=p,n.setInteractionEnabled(!p),d()},seatViewLocked:()=>i,layout:d}}function Bi(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:u,tapSlop:l,tapMs:h,cancelFlight:m,focusSectionCamera:d,setSelection:f,ensureSeatView:p}=e,y=0,b=0,g=0,x=-1,S=!1,I=!1,v=N=>{e.seatViewLocked()||x===-1&&(x=N.pointerId,y=N.clientX,b=N.clientY,g=performance.now(),S=!1,I=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},R=N=>{N.pointerId===x&&Math.hypot(N.clientX-y,N.clientY-b)>l&&(S=!0)},O=(N,A,M,P,C)=>{let T=t.canvas.getBoundingClientRect(),H=t.canvas.clientWidth||T.width||1,k=t.canvas.clientHeight||T.height||1,w=N-T.left,B=A-T.top,E=P*P,F=-1,z=E,G=1/0;for(let _ of o){if(M&&_.sectionId!==M)continue;let L=r.seats.idToIndex.get(_.id);if(L===void 0)continue;if(C){let ne=Math.round(r.seats.iState[L]??0);if(ne!==0&&ne!==3)continue}let Y=L*3,K=Ge(n.camera.projectionViewMatrix,[r.seats.iPosition[Y],r.seats.iPosition[Y+1]+.55,r.seats.iPosition[Y+2]],H,k);if(!K.visible)continue;let J=K.x-w,Z=K.y-B,q=J*J+Z*Z;(q<z||Math.abs(q-z)<1&&K.depth<G)&&(F=L,z=q,G=K.depth)}return F},V=(N,A)=>{let M=e.gpu(),P=e.pick();if(!M||!P)return-1;P.syncFromSeatProgram(M.seatProgram);let C=t.canvas.getBoundingClientRect(),T=t.renderer.dpr,{x:H,y:k}=ui(N,A,C,T,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),w=Math.max(2,Math.round(8*T));return P.pick(n.camera,H,k,w)};return{onDown:v,onMove:R,onUp:N=>{if(N.pointerId!==x)return;let A=!S&&performance.now()-g<h;if(x=-1,I){I=!1;return}let M=e.gpu(),P=e.pick();if(!A||!M||!P)return;let C=V(N.clientX,N.clientY);if(e.focusedSectionId()&&C>=0){let k=c[C],w=k?u.get(k):void 0;if(w&&w!==e.focusedSectionId()&&d(w))return}if(e.focusedSectionId()&&C<0&&(C=O(N.clientX,N.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&C<0){let k=O(N.clientX,N.clientY,null,72,!1),w=k>=0?c[k]:void 0,B=w?u.get(w):void 0;if(B&&B!==e.focusedSectionId()&&d(B))return}if(!e.focusedSectionId()){C<0&&(C=O(N.clientX,N.clientY,null,42,!1));let k=C>=0?c[C]:void 0,w=k?u.get(k):void 0;if(w&&d(w))return}if(C<0||C>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let T=c[C],H=xe[Math.round(r.seats.iState[C]??0)]??"available";if(H!=="available"&&H!=="selected"){i.onSeatInspect?.(T,H);return}if(e.selection().has(T)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null);return}f([T]),p(T),s.seatPicked(T,u.get(T)),i.onSeatPick?.(T)}}}var mn=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let d=0;d<this.count;d++){let f=t[d*3],p=t[d*3+2];f<n&&(n=f),f>o&&(o=f),p<r&&(r=p),p>i&&(i=p)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,u=new Int32Array(c+1),l=d=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((t[d*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[d*3+2]-r)/this.cell)))*this.cols+f};for(let d=0;d<this.count;d++)u[l(d)+1]++;for(let d=0;d<c;d++)u[d+1]+=u[d];let h=new Int32Array(this.count),m=u.slice(0,c);for(let d=0;d<this.count;d++)h[m[l(d)]++]=d;this.cellStart=u,this.cellItems=h}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,u=Math.floor((t-this.minX)/this.cell),l=Math.floor((n-this.minZ)/this.cell),h=Math.ceil(r/this.cell)+1,m=this.iPosition,d=0;for(let f=0;f<=h&&d<s;f++){let p=l-f,y=l+f,b=u-f,g=u+f;for(let x=p;x<=y&&d<s;x++){if(x<0||x>=this.rows)continue;let S=x===p||x===y;for(let I=b;I<=g&&d<s;I++){if(!S&&I!==b&&I!==g){I=g-1;continue}if(I<0||I>=this.cols)continue;let v=x*this.cols+I;for(let R=i[v],O=i[v+1];R<O&&d<s;R++){let V=a[R],U=m[V*3]-t,N=m[V*3+2]-n;U*U+N*N<=c&&(o[d++]=V)}}}}return d}};var fn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Vt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new mn(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<wn)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>Sn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Sn,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(t,n,r){let o=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?o:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};var hn=require("ogl");function Vi(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:u,overviewFraming:l}=e,h=0,m=-1,d=(I,v,R=28)=>{o.camera.position.set(I[0],I[1],I[2]),o.camera.lookAt(new hn.Vec3(v[0],v[1],v[2])),o.camera.fov=R,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.textContent="\u2302",f.setAttribute("aria-label","Fit the active level or whole venue in view"),f.dataset.tooltip="Fit view",Object.assign(f.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let p=()=>{f.textContent="\u2302"};p();let y=I=>{m=I;let v=e.gpu();v&&(v.seatProgram.uniforms.uFocusFloor.value=I,v.solidProgram.uniforms.uFocusFloor.value=I,v.chairProgram.uniforms.uFocusFloor.value=I),e.showSectionSeatLabels(null)},b=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),f.style.display="",c.setVisible(!0),e.setFrozen(!1);let I=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!I),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),I){let v=I.focalWorld[0]-I.center[0],R=I.focalWorld[2]-I.center[2],O=Math.hypot(v,R)>I.radius*.12?Math.atan2(v,R):u,V={center:I.center,radius:I.radius,box:I.box},U={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(V,!1,O,!1,U):o.frameSoft(V,O,!1,U)}else e.reducedMotion()?o.frame(n.bounds,!1,u,r.portraitOverviewCrop===!0,l):o.frameSoft(n.bounds,u,r.portraitOverviewCrop===!0,l);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{h++,e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=I=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let v=n.seats.idToIndex.get(I);if(v===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(I),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),f.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1),e.setSeatViewLocked(!1);let R=++h;e.removeArriveChip();let{eye:O,focal:V}=e.resolvedSeatViewPose(I,v),U=[o.camera.position.x,o.camera.position.y,o.camera.position.z],N=$n(U,O,V,n.bounds.center,n.bounds.radius),A=r.arriveAtSeatEye?O:N.finalPos,M=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,P=[N.waypoints[0],N.waypoints[1],A];if(c.setVisible(!1),e.reducedMotion())return d(A,V,M),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(I,R),Promise.resolve();let C=new hn.Quat().copy(o.camera.quaternion),T=gi(o.camera,A,V);return s.requestRender(),i.start(P,C,T,2500,M).then(()=>{e.isDisposed()||R!==h||(a.cinematicPlayed(2500),o.resumeAfterFlight(V),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(I,R))})},S=I=>{let v=n.sections.find(U=>U.id===I);if(!v||v.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==v.floorIndex&&y(v.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(I);let R=v.focalWorld[0]-v.center[0],O=v.focalWorld[2]-v.center[2],V=Math.hypot(R,O)>v.radius*.12?Math.atan2(R,O):void 0;return o.frame({center:v.center,radius:Math.max(5,v.radius*.5)},!1,V),r.onSectionFocusChange?.(I),s.requestRender(),!0};return f.addEventListener("click",b),{overviewChip:f,layoutOverviewChip:p,flightGen:()=>h,focusedFloor:()=>m,applyFloorFocus:y,placeCameraFinal:d,cancelFlight:g,focusOverview:b,flyToSeat:x,focusSectionCamera:S}}var Nc={};function Ni(e){let t=performance.now();return{model:dt(e),buildMs:performance.now()-t,source:"main"}}function Gi(e){return typeof Worker>"u"?Promise.resolve(Ni(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",Nc.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(Ni(e)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(e)})}var Gc=Math.PI/180,zc=6,Hc=500;function jc(e,t,n={}){let r=performance.now(),o=t.prepared?.model??dt(t),i=new dn(n.onAnalytics),a=new Array(o.seats.count);for(let[j,X]of o.seats.idToIndex)a[X]=j;let s=new Map(t.seats.map(j=>[j.id,j])),c=new Map;for(let j of t.seats){if(!j.rowId)continue;let X=c.get(j.rowId);X?X.push(j.id):c.set(j.rowId,[j.id])}let u=new Map;for(let j of t.seats)u.set(j.id,j.sectionId);let l=t.doc.floors?.some(X=>(X.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(X=>X.objects)??t.doc.objects).some(X=>X.type==="section"&&((X.height??0)>0||(X.rake??0)>0)),h=null,m=null,d=!1,f=!1,p=!1,y=new Map,b=null,g=null,x=null,S=new Map,I=null,v=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},R=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},O=!1,V=()=>O?me.focusedFloor():-1,U=()=>{h=ci(P.gl,o),m=new on(P.renderer,h.seatGeometry,h.chairGeometry,h.solidGeometry,o.seats.count),P.setClearColor(o.theme.background.top),m.setRestoreClear(o.theme.background.top),h.seatProgram.uniforms.uSeatRadius.value=Te*o.theme.seatScale,h.seatProgram.uniforms.uFocusFloor.value=V(),h.solidProgram.uniforms.uFocusFloor.value=V(),h.chairProgram.uniforms.uFocusFloor.value=V(),A.forceRegather()},N=!1,A=new fn({model:o,orbit:()=>C,gpu:()=>h}),M=j=>A.setDetailEnabled(j),P=new Dt(e,{onContextLost:()=>{p||i.contextLost(),d=!0,Y.stop(),h=null,m=null},onContextRestored:()=>{U(),d=!1,p||i.contextRestored(),Y.requestRender()}}),C=new Ot(P.gl,P.canvas,()=>Y.requestRender(),()=>i.orbitEngaged());C.setAspect(P.aspect);let T=(t.doc.floors?.flatMap(j=>j.objects)??t.doc.objects).some(j=>j.type==="section"&&j.physical3dProvenance?.surfaceKind?.status==="inferred"),H=(()=>{if(T&&o.stages.length===0)return;let j=o.focalWorld[0]-o.bounds.center[0],X=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(j,X)>o.bounds.radius*.12?Math.atan2(j,X):void 0})(),k=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,w=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;C.frame(o.bounds,!w&&n.skipInitialOverviewAnimation!==!0,H,n.portraitOverviewCrop===!0,k);let B=new rn(C.camera),E=Fi(e),F=new en(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),z=o.labels,G=()=>Rr(z,o.floors.length,V());F.setLabels(G());let _=null,L=j=>{if(_=j,F.setForcedDense(!!j),!j){F.setLabels(G());return}let X=t.seats.filter(Q=>Q.sectionId===j),W=new Set(X.map(Q=>Q.id)),ee=new Set(X.map(Q=>Q.rowId)),oe=new Set(y.keys()),re=new Set(X.filter(Q=>oe.has(Q.id)).map(Q=>Q.id)),le=G().filter(Q=>Q.kind!=="row"&&Q.kind!=="seat"||(Q.kind==="row"?ee.has(Q.id.slice(4)):W.has(Q.id.slice(5))&&(re.size===0||re.has(Q.id.slice(5)))));if(o.seatCount<=6e3&&re.size===0){F.setLabels(le);return}let ue=re.size?X.filter(Q=>re.has(Q.id)):X,Ye=new Set(ue.map(Q=>`seat:${Q.id}`)),Be=ue.flatMap(Q=>{let fe=o.seats.idToIndex.get(Q.id);if(fe===void 0)return[];let Pe=fe*3;return[{id:`seat:${Q.id}`,kind:"seat",text:Q.displayLabel||Q.label,anchor:[o.seats.iPosition[Pe],o.seats.iPosition[Pe+1]+(oe.has(Q.id)?1.05:.55),o.seats.iPosition[Pe+2]]}]});F.setLabels([...le.filter(Q=>!Ye.has(Q.id)),...Be])};U();let Y=new Bt(j=>{if(d||!h||f)return!1;let W=B.active?B.update(performance.now()):C.update(),ee=V()>=0?o.floors[V()]:null,oe=ee?.radius??o.bounds.radius,re=vo(C.currentDistance,oe),le=N?{center:[C.camera.position.x,C.camera.position.y,C.camera.position.z],radius:520}:o.renderBounds;C.updateClipping(le);let ue=ee?.center??o.renderBounds.center,Ye=ee?.radius??o.renderBounds.radius,Be=(Ce,pt)=>Math.hypot(C.camera.position.x-Ce[0],C.camera.position.y-Ce[1],C.camera.position.z-Ce[2])<=pt*(A.detailVisible?1.8:1.55),Q=Be(ue,Ye);if(!Q&&_){let Ce=o.sections.find(pt=>pt.id===_);Ce&&(Q=Be(Ce.center,Math.max(12,Ce.radius*2)))}A.detailVisible=Q;let fe=h.seatProgram.uniforms;fe.uSeatScale.value=re.scale,fe.uSeatFade.value=re.fade;let Pe=!!ee&&Mo(ee.seatCount,P.canvas.clientWidth||1,P.canvas.clientHeight||1),kt=So(o.seats.count,oe,C.currentDistance,C.camera.fov,P.canvas.clientHeight||1),ht=A.detailVisible||Pe||kt?1:0,Lt=A.detailVisible||V()>=0||o.floors.length>1?1:0;return A.ease(j,ht,Lt),fe.uSeatDetail.value=A.seatDetailMix,h.solidProgram.uniforms.uStructureDetail.value=A.structureDetailMix,fe.uMinPixels.value=re.minPixels,fe.uPixelToWorld.value=2*Math.tan(C.camera.fov*Gc/2)/Math.max(1,P.pixelHeight),A.update(A.detailVisible),P.renderer.render({scene:h.background,clear:!0}),P.renderer.render({scene:h.main,camera:C.camera,clear:!1}),F.update(C.camera.projectionViewMatrix,P.canvas.clientWidth||1,P.canvas.clientHeight||1,C.currentDistance,oe,[C.camera.position.x,C.camera.position.y,C.camera.position.z]),W||A.seatDetailMix!==ht||A.structureDetailMix!==Lt}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>bn.resize()):null;K?.observe(e);let J=j=>{let X=oe=>{let re=o.seats.idToIndex.get(oe);return re===void 0?void 0:o.seats.iState[re]},{updates:W,next:ee}=mi(y,j,X);if(y=ee,F.setSelectedSeatIds(y.keys()),_&&L(_),W.length){let oe=Tn(o.seats,W);h&&h.uploadSeatStateRuns(oe),Y.requestRender()}},Z=()=>I!==null?I:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=8,ne=j=>{if(!n.getSeatView)return null;let X=S.get(j);if(!X)for(X=Promise.resolve(n.getSeatView(j)),S.set(j,X),X.catch(()=>{S.get(j)===X&&S.delete(j)});S.size>q;){let W=S.keys().next().value;if(W===void 0)break;S.delete(W)}return X},Ue=(j,X)=>{let W=s.get(j),ee=Math.max(0,Math.round(o.seats.iFloor[X]??0)),oe=t.doc.floors?.[ee],re=o.floors[ee],le=oe?.focalPoint??t.doc.focalPoint,ue=re?{x:re.focalWorld[0]/D,y:re.focalWorld[2]/D}:le,Ye=W?.focalPoint?{x:W.focalPoint.x+ue.x-le.x,y:W.focalPoint.y+ue.y-le.y}:ue,Be=[o.seats.iPosition[X*3],o.seats.iPosition[X*3+1],o.seats.iPosition[X*3+2]];return xi(Be,Ye,oe?.baseHeightM??0,W?.eyeHeightM)},Xe=()=>(e.clientWidth||P.canvas.clientWidth)<=520,ve=null,_e=null,Fe=async(j,X,W)=>{if(!n.getSeatView||p||W!==me.flightGen())return;let ee;try{ee=await Li()}catch{if(i.panoramaFailed(j,"mount"),!p&&W===me.flightGen()){let oe=be(j,W,!0);requestAnimationFrame(()=>oe?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(p||W!==me.flightGen()||!ve))return _e??=ee.createOpenPanorama(ve),_e(j,X,W)},Me=Di({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:Xe,isDisposed:()=>p,flightGen:()=>me.flightGen(),flyToSeat:j=>io(j),openPanorama:(j,X,W)=>Fe(j,X,W)}),be=Me.show,ce=Me.remove,tt=Me.layout,Se=Oi({container:e,orbit:C,isNarrow:Xe}),nt=Se.element,we=Se.setNavigationMode,De=Se.setSeatViewLocked,Tt=Se.layout,zi=Se.utilityControls,me=Vi({container:e,model:o,opts:n,orbit:C,cinematic:B,analytics:i,loop:Y,labelOverlay:F,stageAzimuth:H,overviewFraming:k,gpu:()=>h,isDisposed:()=>p,panorama:()=>b,setPanorama:j=>{b=j},setPanoramaSphereVisible:j=>{N=j},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:j=>{g=j},setFrozen:j=>{f=j},restorePanoramaLayer:R,reducedMotion:Z,resolvedSeatViewPose:Ue,showSectionSeatLabels:L,setNearFieldDetailEnabled:M,setSeatViewLocked:De,setNavigationMode:we,showArriveChip:be,removeArriveChip:ce});O=!0;let pn=me.overviewChip,Hi=me.layoutOverviewChip,ji=me.applyFloorFocus,Ui=me.focusOverview,ro=me.cancelFlight,io=me.flyToSeat,ao=me.focusSectionCamera;zi.appendChild(pn),ve={container:e,model:o,opts:n,analytics:i,orbit:C,loop:Y,seatsById:s,ensureSeatView:ne,resolvedSeatViewPose:Ue,gpu:()=>h,gl:P.gl,isContextLost:()=>d,isDisposed:()=>p,flightGen:()=>me.flightGen(),setPanorama:j=>{b=j},getLoadAbort:()=>g,setLoadAbort:j=>{g=j},setPanoramaSphereVisible:j=>{N=j},setFrozen:j=>{f=j},raisePanoramaLayer:v,restorePanoramaLayer:R,getOverviewChip:()=>pn,labelOverlay:F,reducedMotion:Z,removeArriveChip:ce,showArriveChip:be};let Oe=Bi({glctx:P,orbit:C,model:o,seats:t.seats,opts:n,cinematic:B,analytics:i,seatIdByIndex:a,sectionIdBySeatId:u,tapSlop:zc,tapMs:Hc,gpu:()=>h,pick:()=>m,seatViewLocked:()=>Se.seatViewLocked(),focusedSectionId:()=>_,selection:()=>y,cancelFlight:ro,focusSectionCamera:ao,setSelection:J,ensureSeatView:ne});P.canvas.addEventListener("pointerdown",Oe.onDown),P.canvas.addEventListener("pointermove",Oe.onMove),P.canvas.addEventListener("pointerup",Oe.onUp),P.canvas.addEventListener("pointercancel",Oe.onUp),Y.requestRender();let bn={setAvailability(j){let X=di(y,j),W=Tn(o.seats,X);W.length&&h&&h.uploadSeatStateRuns(W),Y.requestRender()},setSelection:J,flyToSeat:io,focusOverview:Ui,resize(){let{width:j,height:X}=P.resize();C.setAspect(j/Math.max(1,X)),tt(),Tt(),Hi(),Y.requestRender()},stats(){return{...Y.stats(),drawCalls:h?h.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let j=Y.stats(),X=P.canvas.clientWidth||1,W=P.canvas.clientHeight||1,ee=o.bounds.center,oe=Ge(C.camera.projectionViewMatrix,[ee[0],o.bounds.box.min[1],ee[2]],X,W),re=Ge(C.camera.projectionViewMatrix,[ee[0],o.bounds.box.max[1],ee[2]],X,W),le=o.bounds.box,ue=[le.min[0],le.max[0]].flatMap(Q=>[le.min[1],le.max[1]].flatMap(fe=>[le.min[2],le.max[2]].map(Pe=>Ge(C.camera.projectionViewMatrix,[Q,fe,Pe],X,W)))).filter(Q=>Number.isFinite(Q.x)&&Number.isFinite(Q.y)&&Number.isFinite(Q.depth)),Ye=ue.length?(()=>{let Q=Math.min(...ue.map(We=>We.x)),fe=Math.max(...ue.map(We=>We.x)),Pe=Math.min(...ue.map(We=>We.y)),kt=Math.max(...ue.map(We=>We.y)),ht=Math.max(0,Q),Lt=Math.min(X,fe),Ce=Math.max(0,Pe),pt=Math.min(W,kt),_t=Math.max(0,Lt-ht),yn=Math.max(0,pt-Ce);return{box:{x:ht,y:Ce,width:_t,height:yn},horizontalFillRatio:_t/X,verticalFillRatio:yn/W,visibleAreaRatio:_t*yn/(X*W),clippedEdges:[...Pe<0?["top"]:[],...fe>X?["right"]:[],...kt>W?["bottom"]:[],...Q<0?["left"]:[]]}})():void 0,Be=String(P.gl.getParameter(P.gl.VERSION)??"");return{viewport:{width:X,height:W},context:{webgl2:/webgl\s*2/i.test(Be),lost:d},frame:{rendered:j.rendered,idle:j.idle},camera:{position:[C.camera.position.x,C.camera.position.y,C.camera.position.z],distance:C.currentDistance,verticalFovDeg:C.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:l,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:oe.visible&&re.visible?Math.abs(oe.y-re.y):0},labels:F.qualityEvidence(),framing:Ye}},getQualityReport(){return tn(bn.getQualityEvidence())},loseContextForTest(){P.simulateContextLossCycle()},floors(){return o.floors},focusFloor(j){if(j!==null&&!o.floors.some(W=>W.index===j))return!1;let X=j??-1;if(M(j!==null),De(!1),ji(X),we("orbit"),j===null)B.cancel(),Z()?C.frame(o.bounds,!1,H,n.portraitOverviewCrop===!0,k):C.frameSoft(o.bounds,H,n.portraitOverviewCrop===!0,k);else{let W=o.floors[j];if(W.seatCount>0){B.cancel();let ee=W.focalWorld[0]-W.center[0],oe=W.focalWorld[2]-W.center[2],re=Math.hypot(ee,oe)>W.radius*.12?Math.atan2(ee,oe):H;C.frame({center:W.center,radius:W.radius,box:W.box},!1,re,!1,{polarDeg:58,margin:1.12})}}return Y.requestRender(),!0},zones(){return o.zones},focusZone(j){let X=o.zones.find(re=>re.id===j);if(!X||X.seatCount===0)return!1;M(!1),De(!1),B.cancel(),we("orbit"),L(null),n.onSectionFocusChange?.(null);let W=X.focalWorld[0]-X.center[0],ee=X.focalWorld[2]-X.center[2],oe=Math.hypot(W,ee)>X.radius*.12?Math.atan2(W,ee):void 0;return C.frame({center:X.center,radius:X.radius*1.25},!1,oe),Y.requestRender(),!0},sections(){return o.sections},focusSection(j){return ao(j)},rows(j){return j?o.rows.filter(X=>X.sectionId===j):o.rows},seatsInRow(j){return t.seats.filter(X=>X.rowId===j).map(X=>({id:X.id,label:X.displayLabel||X.label}))},focusRow(j){let X=o.rows.find(W=>W.id===j);return!X||X.seatCount===0?!1:(M(!0),De(!1),B.cancel(),we("pan"),X.sectionId&&(L(X.sectionId),n.onSectionFocusChange?.(X.sectionId)),C.frame({center:X.center,radius:Math.max(2.5,X.radius*.65)}),Y.requestRender(),!0)},setReducedMotionForTest(j){I=j},dispose(){p=!0,ce(),pn.remove(),nt.remove(),ro(),Y.stop(),F.dispose(),K?.disconnect(),b&&(b.dispose(),b=null),R(),E(),P.canvas.removeEventListener("pointerdown",Oe.onDown),P.canvas.removeEventListener("pointermove",Oe.onMove),P.canvas.removeEventListener("pointerup",Oe.onUp),P.canvas.removeEventListener("pointercancel",Oe.onUp),C.dispose(),m&&m.dispose(),h&&h.dispose(),h=null,m=null,P.dispose()}};return i.opened(o.seatCount,l,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),bn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});