@seatlayer/core 0.110.1 → 0.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/ar-IOQUWTKM.js +1 -0
  2. package/dist/be-XLR5WTXS.js +1 -0
  3. package/dist/bg-AVCWLASZ.js +1 -0
  4. package/dist/ca-TKG35ICB.js +1 -0
  5. package/dist/{chunk-5IADCFUU.js → chunk-5FIX35HN.js} +1 -1
  6. package/dist/{chunk-6CBJBESS.js → chunk-5GHPGPWE.js} +1 -1
  7. package/dist/{chunk-GWGWNBGU.js → chunk-AZWAP4OE.js} +1 -1
  8. package/dist/chunk-BXQQKDIX.js +1 -0
  9. package/dist/{chunk-NVAF2E7Q.js → chunk-FZ74MVKY.js} +1 -1
  10. package/dist/{chunk-GVVZR3YS.js → chunk-MN4M5QZ4.js} +1 -1
  11. package/dist/chunk-N6K5NQYG.js +1 -0
  12. package/dist/{chunk-2VYFNNYC.js → chunk-NQLQNJV2.js} +1 -1
  13. package/dist/{chunk-ZY6WTPTI.js → chunk-NXS6JFBI.js} +1 -1
  14. package/dist/{chunk-DLHW3UDD.js → chunk-XWTAFHYQ.js} +1 -1
  15. package/dist/{chunk-YRDOE3N7.js → chunk-Z6YGWTT3.js} +1 -1
  16. package/dist/core/chart-ops/index.cjs +1 -1
  17. package/dist/core/chart-ops/index.d.cts +1 -1
  18. package/dist/core/chart-ops/index.d.ts +1 -1
  19. package/dist/core/chart-ops/index.js +1 -1
  20. package/dist/core/inventory/index.cjs +1 -1
  21. package/dist/core/inventory/index.js +1 -1
  22. package/dist/core/layout/index.cjs +1 -1
  23. package/dist/core/layout/index.js +1 -1
  24. package/dist/core/sections/index.js +1 -1
  25. package/dist/cs-JRLKXXM5.js +1 -0
  26. package/dist/cy-W3CYXTOV.js +1 -0
  27. package/dist/da-HG4PFYWH.js +1 -0
  28. package/dist/de-KOM2AXXJ.js +1 -0
  29. package/dist/el-NBRQ66EQ.js +1 -0
  30. package/dist/es-AVEG4ZNM.js +1 -0
  31. package/dist/et-33PIOTI4.js +1 -0
  32. package/dist/fa-CDV2VTXV.js +1 -0
  33. package/dist/fi-TKATIOE6.js +1 -0
  34. package/dist/fr-TMDNSR5N.js +1 -0
  35. package/dist/he-4G7OVLJX.js +1 -0
  36. package/dist/hi-XKXNYPYF.js +1 -0
  37. package/dist/hr-BX444QNM.js +1 -0
  38. package/dist/hu-FM46JMDP.js +1 -0
  39. package/dist/id-CBVTYGFP.js +1 -0
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.d.cts +33 -25
  42. package/dist/index.d.ts +33 -25
  43. package/dist/index.js +1 -1
  44. package/dist/it-ZOFOAG6E.js +1 -0
  45. package/dist/ja-NKEBMXTO.js +1 -0
  46. package/dist/ko-RUCELYV7.js +1 -0
  47. package/dist/ku-KKYBDVSA.js +1 -0
  48. package/dist/localeLoaders-YQXZZVNH.js +1 -0
  49. package/dist/lt-3CJ37W7A.js +1 -0
  50. package/dist/lv-H37RDMRX.js +1 -0
  51. package/dist/ms-E5RVBRE6.js +1 -0
  52. package/dist/nl-QHEOTQ7U.js +1 -0
  53. package/dist/no-43HJQ5MK.js +1 -0
  54. package/dist/pl-4LKJHMFJ.js +1 -0
  55. package/dist/pt-LSSE5QHE.js +1 -0
  56. package/dist/ro-U2QASPIY.js +1 -0
  57. package/dist/ru-PTMWREXY.js +1 -0
  58. package/dist/sk-AY2N2ORA.js +1 -0
  59. package/dist/sl-5MQJVNB7.js +1 -0
  60. package/dist/sr-25FTJPUA.js +1 -0
  61. package/dist/{stage-CKb7aNoH.d.cts → stage-BtqKu5aX.d.cts} +1 -1
  62. package/dist/{stage-CKb7aNoH.d.ts → stage-BtqKu5aX.d.ts} +1 -1
  63. package/dist/sv-7VQX4BFH.js +1 -0
  64. package/dist/th-E53HQMDC.js +1 -0
  65. package/dist/tr-IIR6E7OD.js +1 -0
  66. package/dist/uk-HBINQ4XE.js +1 -0
  67. package/dist/vi-TX6I5RWN.js +1 -0
  68. package/dist/view3d/index.cjs +195 -77
  69. package/dist/view3d/index.d.cts +259 -78
  70. package/dist/view3d/index.d.ts +259 -78
  71. package/dist/view3d/index.js +193 -75
  72. package/dist/view3d/scene/scene.worker.cjs +1 -1
  73. package/dist/view3d/scene/scene.worker.js +1 -1
  74. package/dist/zh-Hans-7QNBTEYC.js +1 -0
  75. package/dist/zh-Hant-6KK3D42X.js +1 -0
  76. package/package.json +1 -1
  77. package/dist/ar-C5PA2DVE.js +0 -1
  78. package/dist/be-TMKSMYPN.js +0 -1
  79. package/dist/bg-V6HTEDUB.js +0 -1
  80. package/dist/ca-CTZMHWW4.js +0 -1
  81. package/dist/chunk-3V32MDJI.js +0 -1
  82. package/dist/chunk-4AGC7B64.js +0 -1
  83. package/dist/cs-FUDGOUFL.js +0 -1
  84. package/dist/cy-5RRARIAP.js +0 -1
  85. package/dist/da-PONPPWKY.js +0 -1
  86. package/dist/de-PKG7AAB5.js +0 -1
  87. package/dist/el-H7OFU4QQ.js +0 -1
  88. package/dist/es-QSW5IZ6U.js +0 -1
  89. package/dist/et-GTMPSS72.js +0 -1
  90. package/dist/fa-SGLTFGJF.js +0 -1
  91. package/dist/fi-7YTEAVDM.js +0 -1
  92. package/dist/fr-ECCQ24MZ.js +0 -1
  93. package/dist/he-YHMMDOX7.js +0 -1
  94. package/dist/hi-GRAQX2E6.js +0 -1
  95. package/dist/hr-MN33LRIJ.js +0 -1
  96. package/dist/hu-NW3SMQVM.js +0 -1
  97. package/dist/id-3OPRAUF7.js +0 -1
  98. package/dist/it-RYM74YWO.js +0 -1
  99. package/dist/ja-4NI6DG5D.js +0 -1
  100. package/dist/ko-C4F6UEMK.js +0 -1
  101. package/dist/ku-DMSBMWTC.js +0 -1
  102. package/dist/localeLoaders-G3GCGLPW.js +0 -1
  103. package/dist/lt-3EXKKZFG.js +0 -1
  104. package/dist/lv-4EWNRDCG.js +0 -1
  105. package/dist/ms-7LJBSAEJ.js +0 -1
  106. package/dist/nl-GWTIWXRW.js +0 -1
  107. package/dist/no-T3FW2WLX.js +0 -1
  108. package/dist/pl-OG5OBRHR.js +0 -1
  109. package/dist/pt-YQ6VES5R.js +0 -1
  110. package/dist/ro-VK5MASYF.js +0 -1
  111. package/dist/ru-YU5CYR6T.js +0 -1
  112. package/dist/sk-CE7PXAYL.js +0 -1
  113. package/dist/sl-EYUPV4BG.js +0 -1
  114. package/dist/sr-PPXCN4IK.js +0 -1
  115. package/dist/sv-WR2BJBCJ.js +0 -1
  116. package/dist/th-JUB2DODR.js +0 -1
  117. package/dist/tr-GFHA7FT6.js +0 -1
  118. package/dist/uk-3FTS2SRK.js +0 -1
  119. package/dist/vi-7OTXPOQV.js +0 -1
  120. package/dist/zh-Hans-FD4XNYUA.js +0 -1
  121. package/dist/zh-Hant-7TXVJKJQ.js +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";var _d=Object.create;var nr=Object.defineProperty;var Cd=Object.getOwnPropertyDescriptor;var Td=Object.getOwnPropertyNames;var Ld=Object.getPrototypeOf,kd=Object.prototype.hasOwnProperty;var uo=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var Ws=(e,t)=>{for(var n in t)nr(e,n,{get:t[n],enumerable:!0})},Xs=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Td(t))!kd.call(e,r)&&r!==n&&nr(e,r,{get:()=>t[r],enumerable:!(o=Cd(t,r))||o.enumerable});return e};var Et=(e,t,n)=>(n=e!=null?_d(Ld(e)):{},Xs(t||!e||!e.__esModule?nr(n,"default",{value:e,enumerable:!0}):n,e)),Od=e=>Xs(nr({},"__esModule",{value:!0}),e);function u2(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function m2(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function ui(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:m2(t?.deviceMemory)}}function mi(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 o={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...o,reason:"save-data"};let r=[...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,l)=>c.width*c.height-l.width*l.height);if(!r.length)return{...o,upgradeUrl:e.url,reason:"progressive"};let i=r.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...o,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||u2(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...o,reason:"memory-limit"};let s=a[a.length-1];return{...o,upgradeUrl:s.url,reason:"progressive"}}function Uh(){return new DOMException("Panorama image load aborted","AbortError")}function qo(e,t){return new Promise((n,o)=>{if(t?.aborted){o(Uh());return}let r=new Image;r.crossOrigin="anonymous";let i=!1,a=()=>{r.onload=null,r.onerror=null,t?.removeEventListener("abort",c)},s=l=>{i||(i=!0,a(),l?o(l):n(r))},c=()=>{r.src="",s(Uh())};r.onload=()=>{(typeof r.decode=="function"?r.decode():Promise.resolve()).then(()=>s(),()=>s())},r.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),r.src=e})}function fi(e){let t=globalThis;if(t.requestIdleCallback){let o=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(o)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var ws=uo(()=>{"use strict"});function Wh(e){if(e.generated||e.mediaKind==="model")return"built from the chart";let t=e.mediaKind==="demo-render",n=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",o=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,o?`${t?"created":"captured"} ${o}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function Ps(e){return Math.max(f2,Math.min(h2,e))}function d2(e,t,n){let o=(.5+e/360)*n;return t/2-o}function p2(e,t=di){return e*(180/t)}function jh(e,t,n){return(e-t)/2+hi(n,t)}function hi(e,t){let n=Nt/180*t;return Math.max(-n,Math.min(n,e))}function b2(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function As(e){return e||(b2()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function Xh(e,t,n={}){let o=n.fadeMs??400,r=t.initialBearingDeg??0,i=mi(t,ui()),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 ${o}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 m=document.createElement("button");if(m.type="button",m.setAttribute("aria-label","Close"),m.textContent="\u2715",Object.assign(m.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(m),n.disclosure){let H=document.createElement("div");H.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(H.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",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(H)}let f=document.createElement("div");f.textContent=As(n.lookAroundHint),Object.assign(f.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(f),e.appendChild(c),m.focus({preventScroll:!0});let h=0,d=0,p=0,b=0,x=di,y=()=>{let H=c.clientHeight||1,j=c.clientWidth||1,Z=w.naturalWidth||j*2,X=w.naturalHeight||H,ee=h>0?(j/2-p)/h:0,ne=d>0?b/d:0;d=p2(H,x),h=d*(Z/X),u.style.backgroundSize=`${h}px ${d}px`,M?p=j/2-ee*h:(p=d2(r,j,h),b=hi((t.initialPitchDeg??0)/180*d,d),M=!0),b=hi(ne*d,d),u.style.backgroundPosition=`${p}px ${jh(H,d,b)}px`},M=!1,A=()=>{let H=c.clientHeight||1;b=hi(b,d),u.style.backgroundPosition=`${p}px ${jh(H,d,b)}px`},w=new Image;w.onload=y,w.src=i.initialUrl;let g=()=>{};i.upgradeUrl&&(g=fi(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(j=>!j||a.signal.aborted?null:qo(j,a.signal).then(Z=>({full:Z,url:j}))).then(j=>{j&&(V||a.signal.aborted||(w=j.full,u.style.backgroundImage=`url("${j.url}")`,y()))}).catch(()=>{})})),requestAnimationFrame(y);let S=!1,v=0,P=0,E=0,k=new Map,L=()=>{let[H,j]=[...k.values()];return H&&j?Math.hypot(H.x-j.x,H.y-j.y):0},I=H=>{let j=Ps(H);j!==x&&(x=j,y())},R=H=>{k.set(H.pointerId,{x:H.clientX,y:H.clientY}),S=k.size===1,v=H.clientX,P=H.clientY,k.size===2&&(E=L()),u.style.cursor="grabbing";try{u.setPointerCapture?.(H.pointerId)}catch{}},_=H=>{if(k.has(H.pointerId)){if(k.set(H.pointerId,{x:H.clientX,y:H.clientY}),k.size>=2){let j=L();E>0&&j>0&&I(x*(E/j)),E=j,S=!1;return}S&&(p+=H.clientX-v,b+=H.clientY-P,v=H.clientX,P=H.clientY,A())}},F=H=>{k.delete(H.pointerId),E=k.size===2?L():0;let j=k.values().next().value;S=k.size===1,j?(v=j.x,P=j.y):u.style.cursor="grab";try{u.releasePointerCapture?.(H.pointerId)}catch{}},N=H=>{H.preventDefault(),I(x+H.deltaY*.04)};u.addEventListener("pointerdown",R),u.addEventListener("pointermove",_),u.addEventListener("pointerup",F),u.addEventListener("pointercancel",F),u.addEventListener("wheel",N,{passive:!1});let O=!1,V=!1,z=0,G=()=>{u.removeEventListener("pointerdown",R),u.removeEventListener("pointermove",_),u.removeEventListener("pointerup",F),u.removeEventListener("pointercancel",F),u.removeEventListener("wheel",N),window.removeEventListener("keydown",W)},T=()=>{g(),a.abort(),n.signal?.removeEventListener("abort",s),z&&(window.clearTimeout(z),z=0),G(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},D=()=>{if(O)return;O=!0,c.style.opacity="0";let H=()=>{z=0,!V&&(T(),n.onClose?.())};z=window.setTimeout(H,o)},W=H=>{if(H.key==="Tab"){H.preventDefault(),m.focus({preventScroll:!0});return}if(H.key==="Escape"){H.stopPropagation(),D();return}if(H.key==="ArrowLeft"||H.key==="ArrowRight")p+=H.key==="ArrowLeft"?-32:32;else if(H.key==="ArrowUp"||H.key==="ArrowDown")b+=(H.key==="ArrowUp"?4:-4)*(d/180);else if(H.key==="+"||H.key==="="){I(x-5),H.preventDefault();return}else if(H.key==="-"){I(x+5),H.preventDefault();return}else return;H.preventDefault(),A()};return window.addEventListener("keydown",W),m.addEventListener("click",D),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:D,dispose(){O=!0,V=!0,T()}}}var di,f2,h2,Nt,pi=uo(()=>{"use strict";ws();di=70,f2=35,h2=90;Nt=35});function M2(e=y2,t=g2,n=x2){let o=e+1,r=t+1,i=o*r,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<r;u++){let m=u/t,f=m*Math.PI,h=Math.sin(f),d=Math.cos(f);for(let p=0;p<o;p++){let b=p/e,x=(b-.5)*Math.PI*2,y=u*o+p;a[y*3]=n*h*Math.sin(x),a[y*3+1]=n*d,a[y*3+2]=-n*h*Math.cos(x),s[y*2]=b,s[y*2+1]=m}}let c=new Uint16Array(e*t*6),l=0;for(let u=0;u<t;u++)for(let m=0;m<e;m++){let f=u*o+m,h=f+o;c[l++]=f,c[l++]=h,c[l++]=f+1,c[l++]=f+1,c[l++]=h,c[l++]=h+1}return{position:a,uv:s,index:c}}function Kh(e,t){let n=e*Math.PI/180,o=t*Math.PI/180,r=Math.cos(o);return[r*Math.sin(n),Math.sin(o),-r*Math.cos(n)]}function Yh(e,t){let{position:n,uv:o,index:r}=M2(),i=new sn.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:o},index:{data:r}}),a=new sn.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new sn.Program(e,{vertex:v2,fragment:S2,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new sn.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 sn,y2,g2,x2,v2,S2,$h=uo(()=>{"use strict";sn=require("ogl"),y2=64,g2=32,x2=500;v2=`#version 300 es
1
+ "use strict";var y0=Object.create;var zr=Object.defineProperty;var x0=Object.getOwnPropertyDescriptor;var M0=Object.getOwnPropertyNames;var v0=Object.getPrototypeOf,S0=Object.prototype.hasOwnProperty;var Xo=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var Xc=(e,t)=>{for(var n in t)zr(e,n,{get:t[n],enumerable:!0})},Kc=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of M0(t))!S0.call(e,r)&&r!==n&&zr(e,r,{get:()=>t[r],enumerable:!(o=x0(t,r))||o.enumerable});return e};var jt=(e,t,n)=>(n=e!=null?y0(v0(e)):{},Kc(t||!e||!e.__esModule?zr(n,"default",{value:e,enumerable:!0}):n,e)),w0=e=>Kc(zr({},"__esModule",{value:!0}),e);function Gw(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Vw(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function ca(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Vw(t?.deviceMemory)}}function la(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 o={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...o,reason:"save-data"};let r=[...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,l)=>c.width*c.height-l.width*l.height);if(!r.length)return{...o,upgradeUrl:e.url,reason:"progressive"};let i=r.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...o,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||Gw(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...o,reason:"memory-limit"};let s=a[a.length-1];return{...o,upgradeUrl:s.url,reason:"progressive"}}function _p(){return new DOMException("Panorama image load aborted","AbortError")}function Nr(e,t){return new Promise((n,o)=>{if(t?.aborted){o(_p());return}let r=new Image;r.crossOrigin="anonymous";let i=!1,a=()=>{r.onload=null,r.onerror=null,t?.removeEventListener("abort",c)},s=l=>{i||(i=!0,a(),l?o(l):n(r))},c=()=>{r.src="",s(_p())};r.onload=()=>{(typeof r.decode=="function"?r.decode():Promise.resolve()).then(()=>s(),()=>s())},r.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),r.src=e})}function ua(e){let t=globalThis;if(t.requestIdleCallback){let o=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(o)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var Tc=Xo(()=>{"use strict"});function Tp(e){if(e.generated||e.mediaKind==="model")return"built from the chart";let t=e.mediaKind==="demo-render",n=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",o=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,o?`${t?"created":"captured"} ${o}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function kc(e){return Math.max(zw,Math.min(Uw,e))}function Ww(e,t,n){let o=(.5+e/360)*n;return t/2-o}function jw(e,t=ha){return e*(180/t)}function Cp(e,t,n){return(e-t)/2+ma(n,t)}function ma(e,t){let n=rn/180*t;return Math.max(-n,Math.min(n,e))}function Xw(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function Lc(e){return e||(Xw()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function kp(e,t,n={}){let o=n.fadeMs??400,r=t.initialBearingDeg??0,i=la(t,ca()),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 ${o}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 m=document.createElement("button");if(m.type="button",m.setAttribute("aria-label","Close"),m.textContent="\u2715",Object.assign(m.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(m),n.disclosure){let D=document.createElement("div");D.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(D.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",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(D)}let h=document.createElement("div");h.textContent=Lc(n.lookAroundHint),Object.assign(h.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(h),e.appendChild(c),m.focus({preventScroll:!0});let f=0,d=0,p=0,b=0,y=ha,g=()=>{let D=c.clientHeight||1,U=c.clientWidth||1,$=w.naturalWidth||U*2,Z=w.naturalHeight||D,te=f>0?(U/2-p)/f:0,X=d>0?b/d:0;d=jw(D,y),f=d*($/Z),u.style.backgroundSize=`${f}px ${d}px`,v?p=U/2-te*f:(p=Ww(r,U,f),b=ma((t.initialPitchDeg??0)/180*d,d),v=!0),b=ma(X*d,d),u.style.backgroundPosition=`${p}px ${Cp(D,d,b)}px`},v=!1,P=()=>{let D=c.clientHeight||1;b=ma(b,d),u.style.backgroundPosition=`${p}px ${Cp(D,d,b)}px`},w=new Image;w.onload=g,w.src=i.initialUrl;let x=()=>{};i.upgradeUrl&&(x=ua(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(U=>!U||a.signal.aborted?null:Nr(U,a.signal).then($=>({full:$,url:U}))).then(U=>{U&&(N||a.signal.aborted||(w=U.full,u.style.backgroundImage=`url("${U.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let S=!1,A=0,M=0,E=0,T=new Map,k=()=>{let[D,U]=[...T.values()];return D&&U?Math.hypot(D.x-U.x,D.y-U.y):0},_=D=>{let U=kc(D);U!==y&&(y=U,g())},R=D=>{T.set(D.pointerId,{x:D.clientX,y:D.clientY}),S=T.size===1,A=D.clientX,M=D.clientY,T.size===2&&(E=k()),u.style.cursor="grabbing";try{u.setPointerCapture?.(D.pointerId)}catch{}},C=D=>{if(T.has(D.pointerId)){if(T.set(D.pointerId,{x:D.clientX,y:D.clientY}),T.size>=2){let U=k();E>0&&U>0&&_(y*(E/U)),E=U,S=!1;return}S&&(p+=D.clientX-A,b+=D.clientY-M,A=D.clientX,M=D.clientY,P())}},O=D=>{T.delete(D.pointerId),E=T.size===2?k():0;let U=T.values().next().value;S=T.size===1,U?(A=U.x,M=U.y):u.style.cursor="grab";try{u.releasePointerCapture?.(D.pointerId)}catch{}},B=D=>{D.preventDefault(),_(y+D.deltaY*.04)};u.addEventListener("pointerdown",R),u.addEventListener("pointermove",C),u.addEventListener("pointerup",O),u.addEventListener("pointercancel",O),u.addEventListener("wheel",B,{passive:!1});let F=!1,N=!1,V=0,H=()=>{u.removeEventListener("pointerdown",R),u.removeEventListener("pointermove",C),u.removeEventListener("pointerup",O),u.removeEventListener("pointercancel",O),u.removeEventListener("wheel",B),window.removeEventListener("keydown",j)},L=()=>{x(),a.abort(),n.signal?.removeEventListener("abort",s),V&&(window.clearTimeout(V),V=0),H(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},G=()=>{if(F)return;F=!0,c.style.opacity="0";let D=()=>{V=0,!N&&(L(),n.onClose?.())};V=window.setTimeout(D,o)},j=D=>{if(D.key==="Tab"){D.preventDefault(),m.focus({preventScroll:!0});return}if(D.key==="Escape"){D.stopPropagation(),G();return}if(D.key==="ArrowLeft"||D.key==="ArrowRight")p+=D.key==="ArrowLeft"?-32:32;else if(D.key==="ArrowUp"||D.key==="ArrowDown")b+=(D.key==="ArrowUp"?4:-4)*(d/180);else if(D.key==="+"||D.key==="="){_(y-5),D.preventDefault();return}else if(D.key==="-"){_(y+5),D.preventDefault();return}else return;D.preventDefault(),P()};return window.addEventListener("keydown",j),m.addEventListener("click",G),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:G,dispose(){F=!0,N=!0,L()}}}var ha,zw,Uw,rn,fa=Xo(()=>{"use strict";Tc();ha=70,zw=35,Uw=90;rn=35});function Zw(e=Kw,t=Yw,n=$w){let o=e+1,r=t+1,i=o*r,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<r;u++){let m=u/t,h=m*Math.PI,f=Math.sin(h),d=Math.cos(h);for(let p=0;p<o;p++){let b=p/e,y=(b-.5)*Math.PI*2,g=u*o+p;a[g*3]=n*f*Math.sin(y),a[g*3+1]=n*d,a[g*3+2]=-n*f*Math.cos(y),s[g*2]=b,s[g*2+1]=m}}let c=new Uint16Array(e*t*6),l=0;for(let u=0;u<t;u++)for(let m=0;m<e;m++){let h=u*o+m,f=h+o;c[l++]=h,c[l++]=f,c[l++]=h+1,c[l++]=h+1,c[l++]=f,c[l++]=f+1}return{position:a,uv:s,index:c}}function Lp(e,t){let n=e*Math.PI/180,o=t*Math.PI/180,r=Math.cos(o);return[r*Math.sin(n),Math.sin(o),-r*Math.cos(n)]}function Op(e,t){let{position:n,uv:o,index:r}=Zw(),i=new In.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:o},index:{data:r}}),a=new In.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new In.Program(e,{vertex:qw,fragment:Qw,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new In.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 In,Kw,Yw,$w,qw,Qw,Fp=Xo(()=>{"use strict";In=require("ogl"),Kw=64,Yw=32,$w=500;qw=`#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
- }`,S2=`#version 300 es
11
+ }`,Qw=`#version 300 es
12
12
  precision highp float;
13
13
  in vec2 vUv;
14
14
  uniform sampler2D uPano;
@@ -17,21 +17,21 @@ out vec4 fragColor;
17
17
  void main() {
18
18
  vec3 rgb = texture(uPano, vUv).rgb;
19
19
  fragColor = vec4(rgb, uOpacity);
20
- }`});async function qh(e,t,n,o={}){let r=o.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Nt,Math.min(Nt,t?.initialPitchDeg??0)),s=di,c=!1,l=new AbortController,u=()=>l.abort();o.signal?.addEventListener("abort",u,{once:!0});let m=()=>{},f=[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 G=n.camera.position,T=n.focalWorld[0]-G.x,D=n.focalWorld[1]-G.y,W=n.focalWorld[2]-G.z,H=Math.hypot(T,W);H>.001&&(i=Math.atan2(T,-W)*180/Math.PI,a=Math.max(-Nt,Math.min(Nt,Math.atan2(D,H)*180/Math.PI)))}let h=null;if(t){let G=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),T=mi(t,ui(G)),D;try{let W=t.resolveUrl?await t.resolveUrl(T.initialUrl):T.initialUrl;if(!W)throw new Error("panorama_asset_unavailable");D=await qo(W,l.signal)}catch{return o.signal?.removeEventListener("abort",u),null}try{h=Yh(n.gl,D)}catch{return l.abort(),o.signal?.removeEventListener("abort",u),null}h.mesh.renderOrder=999,h.mesh.setParent(n.scene),T.upgradeUrl&&(m=fi(()=>{(t.resolveUrl?t.resolveUrl(T.upgradeUrl):Promise.resolve(T.upgradeUrl)).then(H=>!H||l.signal.aborted?null:qo(H,l.signal)).then(H=>{H&&(c||l.signal.aborted||(h?.setImage(H),n.requestRender()))}).catch(()=>{})}))}let d=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),b=()=>{let G=n.camera.position;h?.mesh.position.set(G.x,G.y,G.z);let[T,D,W]=Kh(i,a);n.camera.lookAt([G.x+T,G.y+D,G.z+W]),n.requestRender()};b();let x=document.createElement("div"),y=document.activeElement instanceof HTMLElement?document.activeElement:null;x.setAttribute("role","dialog"),x.setAttribute("aria-modal","true"),x.setAttribute("aria-label",o.seatLabel?`View from ${o.seatLabel}`:"View from seat"),x.tabIndex=-1,Object.assign(x.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let M=document.createElement("button");if(M.type="button",M.setAttribute("aria-label","Close"),M.textContent="\u2715",Object.assign(M.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"}),x.appendChild(M),o.disclosure){let G=document.createElement("div");G.textContent=`${o.disclosurePrefix??"360\xB0 panorama"} \xB7 ${o.disclosure}`,Object.assign(G.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",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)"}),x.appendChild(G)}let A=document.createElement("div");A.textContent=As(o.lookAroundHint),Object.assign(A.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"}),x.appendChild(A),e.appendChild(x),M.focus({preventScroll:!0});let w=!1,g=0,S=0,v=0,P=new Map,E=()=>{let[G,T]=[...P.values()];return G&&T?Math.hypot(G.x-T.x,G.y-T.y):0},k=G=>{let T=Ps(G);T!==s&&(s=T,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},L=G=>{G.target!==M&&(P.set(G.pointerId,{x:G.clientX,y:G.clientY}),w=P.size===1,g=G.clientX,S=G.clientY,P.size===2&&(v=E()),x.setPointerCapture?.(G.pointerId),x.style.cursor="grabbing")},I=G=>{if(P.has(G.pointerId)){if(P.set(G.pointerId,{x:G.clientX,y:G.clientY}),P.size>=2){let T=E();v>0&&T>0&&k(s*(v/T)),v=T,w=!1;return}w&&(i+=(G.clientX-g)*Zh,a=Math.max(-Nt,Math.min(Nt,a+(G.clientY-S)*Zh)),g=G.clientX,S=G.clientY,b())}},R=G=>{P.delete(G.pointerId),v=P.size===2?E():0;let T=P.values().next().value;w=P.size===1,T?(g=T.x,S=T.y):x.style.cursor="grab";try{x.releasePointerCapture?.(G.pointerId)}catch{}},_=G=>{G.preventDefault(),k(s+G.deltaY*.04)};x.addEventListener("pointerdown",L),x.addEventListener("pointermove",I),x.addEventListener("pointerup",R),x.addEventListener("pointercancel",R),x.addEventListener("wheel",_,{passive:!1});let F=G=>{if(!c){if(G.key==="Tab"){G.preventDefault(),M.focus({preventScroll:!0});return}if(G.key==="Escape"){G.stopPropagation(),z.close();return}if(G.key==="ArrowLeft"||G.key==="ArrowRight")i+=G.key==="ArrowLeft"?-4:4;else if(G.key==="ArrowUp"||G.key==="ArrowDown")a=Math.max(-Nt,Math.min(Nt,a+(G.key==="ArrowUp"?4:-4)));else if(G.key==="+"||G.key==="="){k(s-5),G.preventDefault();return}else if(G.key==="-"){k(s+5),G.preventDefault();return}else return;G.preventDefault(),b()}};window.addEventListener("keydown",F);let N=0,O=(G,T)=>{if(!h){T?.();return}let D=G===1?0:1,W=performance.now(),H=()=>{if(c)return;let j=r<=0?1:Math.min(1,(performance.now()-W)/r);h?.setOpacity(D+(G-D)*j),n.requestRender(),j<1?N=requestAnimationFrame(H):T?.()};N=requestAnimationFrame(H)};O(1);let V=()=>{c||(c=!0,m(),l.abort(),o.signal?.removeEventListener("abort",u),cancelAnimationFrame(N),x.removeEventListener("pointerdown",L),x.removeEventListener("pointermove",I),x.removeEventListener("pointerup",R),x.removeEventListener("pointercancel",R),x.removeEventListener("wheel",_),window.removeEventListener("keydown",F),x.remove(),y?.isConnected&&y.focus({preventScroll:!0}),h?.dispose(),n.camera.position.set(f[0],f[1],f[2]),n.camera.perspective({fov:d,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},z={close(){if(c)return;let G=()=>{V(),o.onClose?.()};cancelAnimationFrame(N),O(0,G)},dispose:V};return M.addEventListener("click",()=>z.close()),z}var Zh,Qh=uo(()=>{"use strict";$h();pi();pi();ws();Zh=.15});var Jh={};Ws(Jh,{createOpenPanorama:()=>w2});function w2(e){let{container:t,model:n,opts:o,analytics:r,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:m,isContextLost:f,isDisposed:h,flightGen:d,setPanorama:p,getLoadAbort:b,setLoadAbort:x,setPanoramaSphereVisible:y,setFrozen:M,raisePanoramaLayer:A,restorePanoramaLayer:w,getOverviewChip:g,labelOverlay:S,reducedMotion:v,removeArriveChip:P,showArriveChip:E}=e;return async(k,L,I)=>{b()?.abort();let R=new AbortController;x(R);let _=n.seats.idToIndex.get(k);if(_===void 0){i.syncFromCamera();return}let F=s.get(k)?.label??k,N=l(k,_),O=c(k);if(!O){R.abort(),b()===R&&x(null),i.syncFromCamera();return}M(!0),a.stop();let V;try{V=await O}catch{if(b()===R&&x(null),r.panoramaFailed(k,"source"),!h()&&I===d()){M(!1),i.resumeAfterFlight(N.focal),a.requestRender();let Z=E(k,I,!0);requestAnimationFrame(()=>Z?.querySelector("[data-panorama-trigger]")?.focus())}return}if(h()||I!==d()){R.abort(),b()===R&&x(null);return}P();let z=g(),G=()=>{R.abort(),b()===R&&x(null),p(null),y(!1),w(),z.style.display="",S.setVisible(!o.arriveAtSeatEye),M(!1),r.panoramaClosed(),i.resumeAfterFlight(N.focal),a.requestRender();let Z=E(k,d());requestAnimationFrame(()=>Z?.querySelector("[data-panorama-trigger]")?.focus())},T=V.generated===!0,D=Wh(V);A(),y(!T),z.style.display="none";let W=v()?0:L,H=u(),j=H&&!f()?await qh(t,T?null:V,{gl:m,scene:H.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:T?N.eye:void 0,focalWorld:N.focal},{fadeMs:W,seatLabel:F,disclosure:D,disclosurePrefix:T?"Live 3D view":"360\xB0 panorama",lookAroundHint:o.lookAroundHint,onClose:G,signal:R.signal}):null;if(h()||I!==d()){R.abort(),y(!1),b()===R&&x(null),j?.dispose(),z.style.display="",w();return}if(j)i.syncFromCamera(),S.setVisible(!1),M(!1),a.requestRender(),p(j);else if(T){w(),z.style.display="",M(!1),i.resumeAfterFlight(N.focal),a.requestRender(),p(null),y(!1),r.panoramaFailed(k,"mount");let Z=E(k,d(),!0);requestAnimationFrame(()=>Z?.querySelector("[data-panorama-trigger]")?.focus()),b()===R&&x(null);return}else y(!1),r.panoramaFallback(k),p(Xh(t,V,{fadeMs:W,seatLabel:F,disclosure:D,onClose:G,signal:R.signal,lookAroundHint:o.lookAroundHint}));r.panoramaOpened()}}var ed=uo(()=>{"use strict";pi();Qh()});var G2={};Ws(G2,{VENUE3D_QUALITY_REPORT_VERSION:()=>Uf,autoVenue3d:()=>Jr,buildSceneModel:()=>no,estimateVenue3D:()=>Qo,inspectVenue3DQualityEvidence:()=>oi,mountVenue3D:()=>V2,prepareVenue3D:()=>bd,prepareVenue3DFromChart:()=>yd});module.exports=Od(G2);function Ks(e,t,n){let o=Math.floor(t.length/3),r=n.center[0],i=n.center[2];if(o>0){let c=Math.max(1,Math.floor(o/4e3)),l=0,u=0,m=0;for(let f=0;f<o;f+=c)l+=t[f*3],u+=t[f*3+2],m++;r=l/m,i=u/m}let a=e[0]-r,s=e[2]-i;return Math.hypot(a,s)>n.radius*.12?Math.atan2(a,s):void 0}var gd=require("ogl");function Ys(e,t,n="#ffffff"){let{iPosition:o,count:r}=t.seats;if(r<2||typeof document>"u")return null;let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let w=0;w<r;w++){let g=o[w*3],S=o[w*3+2];g<i&&(i=g),g>a&&(a=g),S<s&&(s=S),S>c&&(c=S)}for(let w of t.stages)i=Math.min(i,w.cx-w.halfX),a=Math.max(a,w.cx+w.halfX),s=Math.min(s,w.cz-w.halfZ),c=Math.max(c,w.cz+w.halfZ);let l=Math.min(130/Math.max(.001,a-i),86/Math.max(.001,c-s)),u=(148-(a-i)*l)/2,m=(104-(c-s)*l)/2,f=w=>u+(w-i)*l,h=w=>m+(w-s)*l,d=Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),p=document.createElement("canvas");p.width=Math.round(148*d),p.height=Math.round(104*d),p.setAttribute("aria-hidden","true"),p.setAttribute("data-seat-locator","");let b=p.style;b.position="absolute",b.left="12px",b.bottom="12px",b.width="148px",b.height="104px",b.borderRadius="10px",b.background="rgba(10,14,22,.72)",b.border="1px solid rgba(255,255,255,.14)",b.boxShadow="0 4px 14px rgba(0,0,0,.35)",b.pointerEvents="none",b.zIndex="3",b.display="none",e.appendChild(p);let x=document.createElement("canvas");x.width=p.width,x.height=p.height;let y=x.getContext("2d");if(y){y.scale(d,d),y.fillStyle="rgba(214,222,234,.28)";let w=Math.max(1,Math.ceil(r/6e3));for(let g=0;g<r;g+=w)y.fillRect(f(o[g*3])-.6,h(o[g*3+2])-.6,1.2,1.2);y.fillStyle="rgba(236,240,246,.16)",y.strokeStyle="rgba(236,240,246,.55)",y.lineWidth=1;for(let g of t.stages){let S=f(g.cx-g.halfX),v=h(g.cz-g.halfZ),P=g.halfX*2*l,E=g.halfZ*2*l;y.fillRect(S,v,P,E),y.strokeRect(S+.5,v+.5,Math.max(0,P-1),Math.max(0,E-1))}}let M=p.getContext("2d"),A="";return{el:p,update(w,g){if(!w||!M||e.clientWidth>0&&e.clientWidth<560){b.display!=="none"&&(b.display="none"),A="";return}let S=f(w[0]),v=h(w[2]),P=g?Math.atan2(g[2],g[0]):0,E=`${S.toFixed(1)},${v.toFixed(1)},${P.toFixed(2)}`;if(E!==A){if(A=E,b.display="block",M.setTransform(1,0,0,1,0,0),M.clearRect(0,0,p.width,p.height),M.drawImage(x,0,0),M.setTransform(d,0,0,d,0,0),g){let k=M.createRadialGradient(S,v,0,S,v,26);k.addColorStop(0,"rgba(255,255,255,.55)"),k.addColorStop(1,"rgba(255,255,255,0)"),M.fillStyle=k,M.beginPath(),M.moveTo(S,v),M.arc(S,v,26,P-.5,P+.5),M.closePath(),M.fill()}M.fillStyle=n,M.strokeStyle="rgba(10,14,22,.9)",M.lineWidth=1.5,M.beginPath(),M.arc(S,v,3.6,0,Math.PI*2),M.fill(),M.stroke()}},dispose(){p.remove()}}}var Je={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,spine:6,armrest:7},Fd=.44,Dd=.15,$s=.3,Nd=.24;function Zs(e){return e===void 0||!Number.isFinite(e)||e<=0?Nd:Math.min($s,Math.max(Dd,e*Fd))}var mo=.21,Bd=.05,qs=.45,Bt=qs+Bd,Kt=.92,or=.66,Qs=1.205;var rr=.6,Js=.56,ec=.5,tc=-.9,nc=.76,oc=.66;var Ti=.38,rc=-.84,ic=.06,Li=78;var Vd=.28,mn=.15,Gd=[{part:Je.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:Je.pad,min:[-1,.36,-.95],max:[1,qs,1]},{part:Je.back,min:[-1,Bt,-1],max:[1,Kt,-.72]},{part:Je.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:Je.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:Je.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:Je.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:Je.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:Je.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:Je.leg,min:[.62,0,.48],max:[.82,.37,.7]},{part:Je.spine,min:[-.8,.3,-1],max:[.8,.6,-.9]},...[1,-1].flatMap(e=>{let t=a=>{let s=e*(mn-a),c=e*(mn+a);return[Math.min(s,c),Math.max(s,c)]},[n,o]=t(.09),[r,i]=t(Vd/2);return[{part:Je.armrest,min:[n,0,-.5],max:[o,.6,.05],skip:[2,3]},{part:Je.armrest,min:[r,.6,-.74],max:[i,.655,.58],skip:[3]}]})],Hd=[{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 ac(){let e=[],t=[],n=[],o=[],r=(h,d,p)=>{let b=n.length,[x,y,M]=h,A=[y[0]-x[0],y[1]-x[1],y[2]-x[2]],w=[M[0]-x[0],M[1]-x[1],M[2]-x[2]],g=A[1]*w[2]-A[2]*w[1],S=A[2]*w[0]-A[0]*w[2],v=A[0]*w[1]-A[1]*w[0],P=Math.hypot(g,S,v);P>1e-9?(g/=P,S/=P,v/=P):[g,S,v]=d,g*d[0]+S*d[1]+v*d[2]<0&&(g=-g,S=-S,v=-v);for(let E of h)e.push(...E),t.push(g,S,v),n.push(p);o.push(b,b+1,b+2,b,b+2,b+3)},i=h=>{for(let[d,p]of Hd.entries()){if(h.skip?.includes(d))continue;let b=p.c.map(x=>x.map((y,M)=>y?h.max[M]:h.min[M]));r(b,p.n,h.part)}},a=h=>{let{part:d,vertical:p,across:b,along:x,alongCoord:y,halfWidth:M,swell:A,base:w}=h,g=(T,D,W)=>p?[T*M(D),y(D),W]:[T*M(D),W,y(D)],S=(T,D)=>g(T,D,A(T,D)),v=p?2:1,P=(T,D)=>{let H=Math.max(-1,T-.001),j=Math.min(1,T+.001),Z=Math.max(0,D-.001),X=Math.min(1,D+.001),ee=S(H,D),ne=S(j,D),ue=S(T,Z),de=S(T,X),me=[ne[0]-ee[0],ne[1]-ee[1],ne[2]-ee[2]],pe=[de[0]-ue[0],de[1]-ue[1],de[2]-ue[2]],Pe=[me[1]*pe[2]-me[2]*pe[1],me[2]*pe[0]-me[0]*pe[2],me[0]*pe[1]-me[1]*pe[0]];Pe[v]<0&&(Pe=[-Pe[0],-Pe[1],-Pe[2]]);let _e=Math.hypot(...Pe)||1;return[Pe[0]/_e,Pe[1]/_e,Pe[2]/_e]},E=(T,D)=>(e.push(...T),t.push(...D),n.push(d),n.length-1),k=x.map(T=>b.map(D=>E(S(D,T),P(D,T))));for(let T=0;T<x.length-1;T++)for(let D=0;D<b.length-1;D++)o.push(k[T][D],k[T][D+1],k[T+1][D+1],k[T][D],k[T+1][D+1],k[T+1][D]);let L=[];for(let T=0;T<b.length-1;T++)L.push([b[T],x[0]]);for(let T=0;T<x.length-1;T++)L.push([b[b.length-1],x[T]]);for(let T=b.length-1;T>0;T--)L.push([b[T],x[x.length-1]]);for(let T=x.length-1;T>0;T--)L.push([b[0],x[T]]);let I=L.map(([T,D])=>g(T,D,w)),R=T=>p?[T[0],T[1]]:[T[0],T[2]],_=T=>{let[D,W]=R(I[T]),[H,j]=R(I[(T+1)%I.length]),Z=Math.hypot(H-D,j-W)||1;return[(j-W)/Z,-(H-D)/Z]},F=I.reduce((T,D)=>{let[W,H]=R(D);return[T[0]+W/I.length,T[1]+H/I.length]},[0,0]),N=T=>{let D=_((T+I.length-1)%I.length),W=_(T),H=D[0]+W[0],j=D[1]+W[1],[Z,X]=R(I[T]);H*(Z-F[0])+j*(X-F[1])<0&&(H=-H,j=-j);let ee=Math.hypot(H,j)||1;return p?[H/ee,j/ee,0]:[H/ee,0,j/ee]},O=L.map(([T,D],W)=>E(S(T,D),N(W))),V=I.map((T,D)=>E(T,N(D)));for(let T=0;T<L.length;T++){let D=(T+1)%L.length;o.push(O[T],O[D],V[D],O[T],V[D],V[T])}let z=p?[0,0,-1]:[0,-1,0],G=I.map(T=>E(T,z));for(let T=1;T<G.length-1;T++)o.push(G[0],G[T],G[T+1])},s=h=>1-h*h*h*h,c=h=>d=>{for(let p=1;p<h.length;p++)if(d<=h[p][0]){let[b,x]=h[p-1],[y,M]=h[p];return x+(M-x)*(d-b)/(y-b)}return h[h.length-1][1]};for(let h of Gd)if(h.part===Je.back){let d=[[0,.8],[.04,.9],[.1,.97],[.25,1],[.77,.94],[.88,.88],[.95,.79],[1,or]],p=h.min[1],b=h.max[1];a({part:h.part,vertical:!0,across:[-1,-.6,0,.6,1],along:d.map(([x])=>x),alongCoord:x=>p+(b-p)*x,halfWidth:c(d),swell:(x,y)=>h.max[2]-.12+.12*s(x)*s(2*y-1),base:h.min[2]})}else if(h.part===Je.pad){let d=[[0,.84],[.1,.92],[.78,.92],[.9,.89],[.97,.82],[1,.72]],p=h.min[2],b=h.max[2],x=h.min[1],y=h.max[1];a({part:h.part,vertical:!1,across:[-1,-.6,0,.6,1],along:d.map(([M])=>M),alongCoord:M=>p+(b-p)*M,halfWidth:c(d),swell:(M,A)=>x+(y-x)*(.45+.55*s(M)*s(2*A-1)),base:x})}else i(h);let l=new Float32Array(e),u=new Float32Array(t),m=new Float32Array(n),f=new Uint16Array(o);return{position:l,normal:u,part:m,index:f,vertexCount:n.length,indexCount:o.length}}var ki=20*Math.PI/180;function sc(e,t,n,o,r){let i=new Float32Array(t),a=m=>e[m*3],s=m=>e[m*3+2],c=Math.cos(ki),l=0,u=(m,f)=>{let h=f-m,d=r?.(m),p=d!==void 0;for(let M=m+1;!p&&M<f-1;M++){let A=a(M)-a(M-1),w=s(M)-s(M-1),g=a(M+1)-a(M),S=s(M+1)-s(M),v=Math.hypot(A,w)*Math.hypot(g,S);v>1e-9&&(A*g+w*S)/v<c&&(p=!0)}let b=0,x=0,y=!1;if(p){if(d)[b,x]=d;else{for(let A=m;A<f;A++)b+=a(A),x+=s(A);b/=h,x/=h}let M=0;for(let A=m+1;A<f;A++)M=Math.max(M,Math.hypot(a(A)-a(A-1),s(A)-s(A-1)));y=h>=3&&Math.hypot(a(f-1)-a(m),s(f-1)-s(m))<=M*1.6}for(let M=m;M<f;M++){let[A,w]=p?[b,x]:o(M),g=A-a(M),S=w-s(M);if(h>=2&&!(d&&h<3)){let v=y?m+(M-1-m+h)%h:Math.max(m,M-1),P=y?m+(M+1-m)%h:Math.min(f-1,M+1),E=a(P)-a(v),k=s(P)-s(v),L=Math.hypot(E,k);if(L>1e-6){let I=-k/L,R=E/L;I*g+R*S<0&&(I=-I,R=-R),g=I,S=R}}i[M]=g===0&&S===0?0:Math.atan2(g,S)}};for(let m=1;m<=t;m++)(m===t||n(m)!==n(l))&&(u(l,m),l=m);return i}var Oi=78,cc=18;function lc(){let e=[],t=[],n=[],o=[],r=[],i=[{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]]}];for(let s of[{part:1,min:[-1,.36,-.95],max:[1,.45,1]},{part:2,min:[-1,Bt,-1],max:[1,Kt,-.72]}])for(let c of i){let l=e.length/3,u=c.n[1]+(s.part===2?Math.abs(c.n[0])*(1-or)/(Kt-Bt):0),m=Math.hypot(c.n[0],u,c.n[2]),f=[c.n[0]/m,u/m,c.n[2]/m];for(let[h,d]of c.c.entries()){let p=d.map((b,x)=>s.min[x]+b*(s.max[x]-s.min[x]));s.part===2&&(p[0]*=1-d[1]*(1-or)),e.push(...p),t.push(...f),n.push(s.part),o.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][h])}r.push(l,l+1,l+2,l,l+2,l+3)}let a=e.length/3;for(let[s,c]of[[-1,-1],[1,-1],[1,1],[-1,1]])e.push(s,c,0),t.push(0,1,0),n.push(0),o.push(s,c);return r.push(a,a+1,a+2,a,a+2,a+3),r.push(...r.slice(12,18),...r.slice(60,66),...r.slice(72,78)),{position:new Float32Array(e),normal:new Float32Array(t),surface:new Float32Array(n),uv:new Float32Array(o),index:new Uint16Array(r)}}var yc=require("ogl");var zd=/^#?([\da-f]{3}|[\da-f]{6})$/i;function uc(e){let t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function Ud(e){let t=zd.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(r=>r+r).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function ve(e){let t=Ud(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Fi(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function jd(e){return .2126*Fi(e[0])+.7152*Fi(e[1])+.0722*Fi(e[2])}function mc(e){return jd([e[0]*255,e[1]*255,e[2]*255])}function Wd(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function Se(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 It(e,t){let n=Wd(e);return Se(e,[n,n,n],t)}function fc({r:e,g:t,b:n}){let o=e/255,r=t/255,i=n/255,a=Math.max(o,r,i),s=Math.min(o,r,i),c=(a+s)/2;if(a===s)return{h:0,s:0,l:c};let l=a-s,u=c>.5?l/(2-a-s):l/(a+s),m;return a===o?m=((r-i)/l+(r<i?6:0))/6:a===r?m=((i-o)/l+2)/6:m=((o-r)/l+4)/6,{h:m,s:u,l:c}}var Di=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,Ni=e=>e<=.0031308?12.92*e:1.055*Math.max(0,e)**.4166666666666667-.055,Bi=e=>Math.min(1,Math.max(0,e));function ar(e){let t=Di(e[0]),n=Di(e[1]),o=Di(e[2]),r=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*o),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*o),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*o);return[.2104542553*r+.793617785*i-.0040720468*a,1.9779984951*r-2.428592205*i+.4505937099*a,.0259040371*r+.7827717662*i-.808675766*a]}function ir([e,t,n]){let o=(e+.3963377774*t+.2158037573*n)**3,r=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[Bi(Ni(4.0767416621*o-3.3077115913*r+.2309699292*i)),Bi(Ni(-1.2684380046*o+2.6097574011*r-.3413193965*i)),Bi(Ni(-.0041960863*o-.7034186147*r+1.707614701*i))]}var sr=e=>ar(e)[0];function fo(e){let[,t,n]=ar(e);return Math.hypot(t,n)}function fn(e,t,n){let[,o,r]=ar(e);if(n===void 0)return ir([t,o,r]);let i=Math.hypot(o,r),a=i===0?0:n/i;return ir([t,o*a,r*a])}function hc(e,t,n){let[o,r,i]=ar(e);return o>=t&&o<=n?e:ir([Math.min(n,Math.max(t,o)),r,i])}function cr(e){return ir([e,-.004,-.008])}var je=["available","held","sold","selected","dimmed"];function ho(e){let t=je.indexOf(e);return t<0?0:t}var pc={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Xd(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.78,o=.86;return[(t+(e[0]-t)*n)*o,(t+(e[1]-t)*n)*o,(t+(e[2]-t)*n)*o]}var dc={day:{ground:.9,deck:.84,fascia:.77,shell:.79,seatMin:.45,seatMax:.58,unavailable:.58,dimmed:.62,sectionDeck:.66,sectionDeckChromaShare:.8,sectionDeckChromaCap:.11,stageTop:.52,stageWall:.42},night:{ground:.26,deck:.34,fascia:.28,shell:.32,seatMin:.64,seatMax:.8,unavailable:.42,dimmed:.39,sectionDeck:.34,sectionDeckChromaShare:.45,sectionDeckChromaCap:.05,stageTop:0,stageWall:0}},lr=.012;function Vt(e){return sr(e.tierTop)>.6}function hn(e){return e?dc.day:dc.night}function bc(e,t){let n=hn(t);return hc(Xd(e),n.seatMin,n.seatMax)}var Vi={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]},dn={top:[.05,.06,.08],bottom:[.1,.12,.15]};function re(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Kd(){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 gc=1e4;function Yd(e){if(typeof navigator<"u"){let t=navigator.deviceMemory;if(typeof t=="number"&&t<=4)return 0}return e>=1.5?2:4}var ur=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.");let o=Kd();this.smoothingSamples=Yd(o),this.renderer=new yc.Renderer({canvas:this.canvas,dpr:o,alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[dn.top[0],dn.top[1],dn.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 Yt=require("ogl"),$d=`#version 300 es
20
+ }`});async function Np(e,t,n,o={}){let r=o.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-rn,Math.min(rn,t?.initialPitchDeg??0)),s=ha,c=!1,l=new AbortController,u=()=>l.abort();o.signal?.addEventListener("abort",u,{once:!0});let m=()=>{},h=[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 H=n.camera.position,L=n.focalWorld[0]-H.x,G=n.focalWorld[1]-H.y,j=n.focalWorld[2]-H.z,D=Math.hypot(L,j);D>.001&&(i=Math.atan2(L,-j)*180/Math.PI,a=Math.max(-rn,Math.min(rn,Math.atan2(G,D)*180/Math.PI)))}let f=null;if(t){let H=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),L=la(t,ca(H)),G;try{let j=t.resolveUrl?await t.resolveUrl(L.initialUrl):L.initialUrl;if(!j)throw new Error("panorama_asset_unavailable");G=await Nr(j,l.signal)}catch{return o.signal?.removeEventListener("abort",u),null}try{f=Op(n.gl,G)}catch{return l.abort(),o.signal?.removeEventListener("abort",u),null}f.mesh.renderOrder=999,f.mesh.setParent(n.scene),L.upgradeUrl&&(m=ua(()=>{(t.resolveUrl?t.resolveUrl(L.upgradeUrl):Promise.resolve(L.upgradeUrl)).then(D=>!D||l.signal.aborted?null:Nr(D,l.signal)).then(D=>{D&&(c||l.signal.aborted||(f?.setImage(D),n.requestRender()))}).catch(()=>{})}))}let d=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),b=()=>{let H=n.camera.position;f?.mesh.position.set(H.x,H.y,H.z);let[L,G,j]=Lp(i,a);n.camera.lookAt([H.x+L,H.y+G,H.z+j]),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",o.seatLabel?`View from ${o.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let v=document.createElement("button");if(v.type="button",v.setAttribute("aria-label","Close"),v.textContent="\u2715",Object.assign(v.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(v),o.disclosure){let H=document.createElement("div");H.textContent=`${o.disclosurePrefix??"360\xB0 panorama"} \xB7 ${o.disclosure}`,Object.assign(H.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",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(H)}let P=document.createElement("div");P.textContent=Lc(o.lookAroundHint),Object.assign(P.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(P),e.appendChild(y),v.focus({preventScroll:!0});let w=!1,x=0,S=0,A=0,M=new Map,E=()=>{let[H,L]=[...M.values()];return H&&L?Math.hypot(H.x-L.x,H.y-L.y):0},T=H=>{let L=kc(H);L!==s&&(s=L,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},k=H=>{H.target!==v&&(M.set(H.pointerId,{x:H.clientX,y:H.clientY}),w=M.size===1,x=H.clientX,S=H.clientY,M.size===2&&(A=E()),y.setPointerCapture?.(H.pointerId),y.style.cursor="grabbing")},_=H=>{if(M.has(H.pointerId)){if(M.set(H.pointerId,{x:H.clientX,y:H.clientY}),M.size>=2){let L=E();A>0&&L>0&&T(s*(A/L)),A=L,w=!1;return}w&&(i+=(H.clientX-x)*Dp,a=Math.max(-rn,Math.min(rn,a+(H.clientY-S)*Dp)),x=H.clientX,S=H.clientY,b())}},R=H=>{M.delete(H.pointerId),A=M.size===2?E():0;let L=M.values().next().value;w=M.size===1,L?(x=L.x,S=L.y):y.style.cursor="grab";try{y.releasePointerCapture?.(H.pointerId)}catch{}},C=H=>{H.preventDefault(),T(s+H.deltaY*.04)};y.addEventListener("pointerdown",k),y.addEventListener("pointermove",_),y.addEventListener("pointerup",R),y.addEventListener("pointercancel",R),y.addEventListener("wheel",C,{passive:!1});let O=H=>{if(!c){if(H.key==="Tab"){H.preventDefault(),v.focus({preventScroll:!0});return}if(H.key==="Escape"){H.stopPropagation(),V.close();return}if(H.key==="ArrowLeft"||H.key==="ArrowRight")i+=H.key==="ArrowLeft"?-4:4;else if(H.key==="ArrowUp"||H.key==="ArrowDown")a=Math.max(-rn,Math.min(rn,a+(H.key==="ArrowUp"?4:-4)));else if(H.key==="+"||H.key==="="){T(s-5),H.preventDefault();return}else if(H.key==="-"){T(s+5),H.preventDefault();return}else return;H.preventDefault(),b()}};window.addEventListener("keydown",O);let B=0,F=(H,L)=>{if(!f){L?.();return}let G=H===1?0:1,j=performance.now(),D=()=>{if(c)return;let U=r<=0?1:Math.min(1,(performance.now()-j)/r);f?.setOpacity(G+(H-G)*U),n.requestRender(),U<1?B=requestAnimationFrame(D):L?.()};B=requestAnimationFrame(D)};F(1);let N=()=>{c||(c=!0,m(),l.abort(),o.signal?.removeEventListener("abort",u),cancelAnimationFrame(B),y.removeEventListener("pointerdown",k),y.removeEventListener("pointermove",_),y.removeEventListener("pointerup",R),y.removeEventListener("pointercancel",R),y.removeEventListener("wheel",C),window.removeEventListener("keydown",O),y.remove(),g?.isConnected&&g.focus({preventScroll:!0}),f?.dispose(),n.camera.position.set(h[0],h[1],h[2]),n.camera.perspective({fov:d,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},V={close(){if(c)return;let H=()=>{N(),o.onClose?.()};cancelAnimationFrame(B),F(0,H)},dispose:N};return v.addEventListener("click",()=>V.close()),V}var Dp,Bp=Xo(()=>{"use strict";Fp();fa();fa();Tc();Dp=.15});var Hp={};Xc(Hp,{createOpenPanorama:()=>Jw});function Jw(e){let{container:t,model:n,opts:o,analytics:r,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:m,isContextLost:h,isDisposed:f,flightGen:d,setPanorama:p,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:v,raisePanoramaLayer:P,restorePanoramaLayer:w,getOverviewChip:x,labelOverlay:S,reducedMotion:A,removeArriveChip:M,showArriveChip:E}=e;return async(T,k,_)=>{b()?.abort();let R=new AbortController;y(R);let C=n.seats.idToIndex.get(T);if(C===void 0){i.syncFromCamera();return}let O=s.get(T)?.label??T,B=l(T,C),F=c(T);if(!F){R.abort(),b()===R&&y(null),i.syncFromCamera();return}v(!0),a.stop();let N;try{N=await F}catch{if(b()===R&&y(null),r.panoramaFailed(T,"source"),!f()&&_===d()){v(!1),i.resumeAfterFlight(B.focal),a.requestRender();let $=E(T,_,!0);requestAnimationFrame(()=>$?.querySelector("[data-panorama-trigger]")?.focus())}return}if(f()||_!==d()){R.abort(),b()===R&&y(null);return}M();let V=x(),H=()=>{R.abort(),b()===R&&y(null),p(null),g(!1),w(),V.style.display="",S.setVisible(!o.arriveAtSeatEye),v(!1),r.panoramaClosed(),i.resumeAfterFlight(B.focal),a.requestRender();let $=E(T,d());requestAnimationFrame(()=>$?.querySelector("[data-panorama-trigger]")?.focus())},L=N.generated===!0,G=Tp(N);P(),g(!L),V.style.display="none";let j=A()?0:k,D=u(),U=D&&!h()?await Np(t,L?null:N,{gl:m,scene:D.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:L?B.eye:void 0,focalWorld:B.focal},{fadeMs:j,seatLabel:O,disclosure:G,disclosurePrefix:L?"Live 3D view":"360\xB0 panorama",lookAroundHint:o.lookAroundHint,onClose:H,signal:R.signal}):null;if(f()||_!==d()){R.abort(),g(!1),b()===R&&y(null),U?.dispose(),V.style.display="",w();return}if(U)i.syncFromCamera(),S.setVisible(!1),v(!1),a.requestRender(),p(U);else if(L){w(),V.style.display="",v(!1),i.resumeAfterFlight(B.focal),a.requestRender(),p(null),g(!1),r.panoramaFailed(T,"mount");let $=E(T,d(),!0);requestAnimationFrame(()=>$?.querySelector("[data-panorama-trigger]")?.focus()),b()===R&&y(null);return}else g(!1),r.panoramaFallback(T),p(kp(t,N,{fadeMs:j,seatLabel:O,disclosure:G,onClose:H,signal:R.signal,lookAroundHint:o.lookAroundHint}));r.panoramaOpened()}}var Gp=Xo(()=>{"use strict";fa();Bp()});var SP={};Xc(SP,{VENUE3D_QUALITY_REPORT_VERSION:()=>gd,autoVenue3d:()=>Zi,buildSceneModel:()=>Oo,estimateVenue3D:()=>Br,inspectVenue3DQualityEvidence:()=>ea,mountVenue3D:()=>vP,prepareVenue3D:()=>c0,prepareVenue3DFromChart:()=>l0});module.exports=w0(SP);function Yc(e,t,n){let o=Math.floor(t.length/3),r=n.center[0],i=n.center[2];if(o>0){let c=Math.max(1,Math.floor(o/4e3)),l=0,u=0,m=0;for(let h=0;h<o;h+=c)l+=t[h*3],u+=t[h*3+2],m++;r=l/m,i=u/m}let a=e[0]-r,s=e[2]-i;return Math.hypot(a,s)>n.radius*.12?Math.atan2(a,s):void 0}var u0=require("ogl");function $c(e,t,n="#ffffff"){let{iPosition:o,count:r}=t.seats;if(r<2||typeof document>"u")return null;let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let w=0;w<r;w++){let x=o[w*3],S=o[w*3+2];x<i&&(i=x),x>a&&(a=x),S<s&&(s=S),S>c&&(c=S)}for(let w of t.stages)i=Math.min(i,w.cx-w.halfX),a=Math.max(a,w.cx+w.halfX),s=Math.min(s,w.cz-w.halfZ),c=Math.max(c,w.cz+w.halfZ);let l=Math.min(130/Math.max(.001,a-i),86/Math.max(.001,c-s)),u=(148-(a-i)*l)/2,m=(104-(c-s)*l)/2,h=w=>u+(w-i)*l,f=w=>m+(w-s)*l,d=Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),p=document.createElement("canvas");p.width=Math.round(148*d),p.height=Math.round(104*d),p.setAttribute("aria-hidden","true"),p.setAttribute("data-seat-locator","");let b=p.style;b.position="absolute",b.left="12px",b.bottom="12px",b.width="148px",b.height="104px",b.borderRadius="10px",b.background="rgba(10,14,22,.72)",b.border="1px solid rgba(255,255,255,.14)",b.boxShadow="0 4px 14px rgba(0,0,0,.35)",b.pointerEvents="none",b.zIndex="3",b.display="none",e.appendChild(p);let y=document.createElement("canvas");y.width=p.width,y.height=p.height;let g=y.getContext("2d");if(g){g.scale(d,d),g.fillStyle="rgba(214,222,234,.28)";let w=Math.max(1,Math.ceil(r/6e3));for(let x=0;x<r;x+=w)g.fillRect(h(o[x*3])-.6,f(o[x*3+2])-.6,1.2,1.2);g.fillStyle="rgba(236,240,246,.16)",g.strokeStyle="rgba(236,240,246,.55)",g.lineWidth=1;for(let x of t.stages){let S=h(x.cx-x.halfX),A=f(x.cz-x.halfZ),M=x.halfX*2*l,E=x.halfZ*2*l;g.fillRect(S,A,M,E),g.strokeRect(S+.5,A+.5,Math.max(0,M-1),Math.max(0,E-1))}}let v=p.getContext("2d"),P="";return{el:p,update(w,x){if(!w||!v||e.clientWidth>0&&e.clientWidth<560){b.display!=="none"&&(b.display="none"),P="";return}let S=h(w[0]),A=f(w[2]),M=x?Math.atan2(x[2],x[0]):0,E=`${S.toFixed(1)},${A.toFixed(1)},${M.toFixed(2)}`;if(E!==P){if(P=E,b.display="block",v.setTransform(1,0,0,1,0,0),v.clearRect(0,0,p.width,p.height),v.drawImage(y,0,0),v.setTransform(d,0,0,d,0,0),x){let T=v.createRadialGradient(S,A,0,S,A,26);T.addColorStop(0,"rgba(255,255,255,.55)"),T.addColorStop(1,"rgba(255,255,255,0)"),v.fillStyle=T,v.beginPath(),v.moveTo(S,A),v.arc(S,A,26,M-.5,M+.5),v.closePath(),v.fill()}v.fillStyle=n,v.strokeStyle="rgba(10,14,22,.9)",v.lineWidth=1.5,v.beginPath(),v.arc(S,A,3.6,0,Math.PI*2),v.fill(),v.stroke()}},dispose(){p.remove()}}}var dt={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,spine:6,armrest:7},P0=.44,A0=.15,Zc=.3,R0=.24;function qc(e){return e===void 0||!Number.isFinite(e)||e<=0?R0:Math.min(Zc,Math.max(A0,e*P0))}var Ko=.21,E0=.05,Qc=.45,sn=Qc+E0,dn=.92,Ur=.66,Jc=1.205;var Wr=.6,el=.56,tl=.5,nl=-.9,ol=.76,rl=.66;var Aa=.38,il=-.84,al=.06,Ra=78;var I0=.28,Tn=.15,_0=[{part:dt.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:dt.pad,min:[-1,.36,-.95],max:[1,Qc,1]},{part:dt.back,min:[-1,sn,-1],max:[1,dn,-.72]},{part:dt.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:dt.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:dt.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:dt.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:dt.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:dt.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:dt.leg,min:[.62,0,.48],max:[.82,.37,.7]},{part:dt.spine,min:[-.8,.3,-1],max:[.8,.6,-.9]},...[1,-1].flatMap(e=>{let t=a=>{let s=e*(Tn-a),c=e*(Tn+a);return[Math.min(s,c),Math.max(s,c)]},[n,o]=t(.09),[r,i]=t(I0/2);return[{part:dt.armrest,min:[n,0,-.5],max:[o,.6,.05],skip:[2,3]},{part:dt.armrest,min:[r,.6,-.74],max:[i,.655,.58],skip:[3]}]})],C0=[{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 sl(){let e=[],t=[],n=[],o=[],r=(f,d,p)=>{let b=n.length,[y,g,v]=f,P=[g[0]-y[0],g[1]-y[1],g[2]-y[2]],w=[v[0]-y[0],v[1]-y[1],v[2]-y[2]],x=P[1]*w[2]-P[2]*w[1],S=P[2]*w[0]-P[0]*w[2],A=P[0]*w[1]-P[1]*w[0],M=Math.hypot(x,S,A);M>1e-9?(x/=M,S/=M,A/=M):[x,S,A]=d,x*d[0]+S*d[1]+A*d[2]<0&&(x=-x,S=-S,A=-A);for(let E of f)e.push(...E),t.push(x,S,A),n.push(p);o.push(b,b+1,b+2,b,b+2,b+3)},i=f=>{for(let[d,p]of C0.entries()){if(f.skip?.includes(d))continue;let b=p.c.map(y=>y.map((g,v)=>g?f.max[v]:f.min[v]));r(b,p.n,f.part)}},a=f=>{let{part:d,vertical:p,across:b,along:y,alongCoord:g,halfWidth:v,swell:P,base:w}=f,x=(L,G,j)=>p?[L*v(G),g(G),j]:[L*v(G),j,g(G)],S=(L,G)=>x(L,G,P(L,G)),A=p?2:1,M=(L,G)=>{let D=Math.max(-1,L-.001),U=Math.min(1,L+.001),$=Math.max(0,G-.001),Z=Math.min(1,G+.001),te=S(D,G),X=S(U,G),me=S(L,$),re=S(L,Z),ce=[X[0]-te[0],X[1]-te[1],X[2]-te[2]],J=[re[0]-me[0],re[1]-me[1],re[2]-me[2]],ae=[ce[1]*J[2]-ce[2]*J[1],ce[2]*J[0]-ce[0]*J[2],ce[0]*J[1]-ce[1]*J[0]];ae[A]<0&&(ae=[-ae[0],-ae[1],-ae[2]]);let ie=Math.hypot(...ae)||1;return[ae[0]/ie,ae[1]/ie,ae[2]/ie]},E=(L,G)=>(e.push(...L),t.push(...G),n.push(d),n.length-1),T=y.map(L=>b.map(G=>E(S(G,L),M(G,L))));for(let L=0;L<y.length-1;L++)for(let G=0;G<b.length-1;G++)o.push(T[L][G],T[L][G+1],T[L+1][G+1],T[L][G],T[L+1][G+1],T[L+1][G]);let k=[];for(let L=0;L<b.length-1;L++)k.push([b[L],y[0]]);for(let L=0;L<y.length-1;L++)k.push([b[b.length-1],y[L]]);for(let L=b.length-1;L>0;L--)k.push([b[L],y[y.length-1]]);for(let L=y.length-1;L>0;L--)k.push([b[0],y[L]]);let _=k.map(([L,G])=>x(L,G,w)),R=L=>p?[L[0],L[1]]:[L[0],L[2]],C=L=>{let[G,j]=R(_[L]),[D,U]=R(_[(L+1)%_.length]),$=Math.hypot(D-G,U-j)||1;return[(U-j)/$,-(D-G)/$]},O=_.reduce((L,G)=>{let[j,D]=R(G);return[L[0]+j/_.length,L[1]+D/_.length]},[0,0]),B=L=>{let G=C((L+_.length-1)%_.length),j=C(L),D=G[0]+j[0],U=G[1]+j[1],[$,Z]=R(_[L]);D*($-O[0])+U*(Z-O[1])<0&&(D=-D,U=-U);let te=Math.hypot(D,U)||1;return p?[D/te,U/te,0]:[D/te,0,U/te]},F=k.map(([L,G],j)=>E(S(L,G),B(j))),N=_.map((L,G)=>E(L,B(G)));for(let L=0;L<k.length;L++){let G=(L+1)%k.length;o.push(F[L],F[G],N[G],F[L],N[G],N[L])}let V=p?[0,0,-1]:[0,-1,0],H=_.map(L=>E(L,V));for(let L=1;L<H.length-1;L++)o.push(H[0],H[L],H[L+1])},s=f=>1-f*f*f*f,c=f=>d=>{for(let p=1;p<f.length;p++)if(d<=f[p][0]){let[b,y]=f[p-1],[g,v]=f[p];return y+(v-y)*(d-b)/(g-b)}return f[f.length-1][1]};for(let f of _0)if(f.part===dt.back){let d=[[0,.8],[.04,.9],[.1,.97],[.25,1],[.77,.94],[.88,.88],[.95,.79],[1,Ur]],p=f.min[1],b=f.max[1];a({part:f.part,vertical:!0,across:[-1,-.6,0,.6,1],along:d.map(([y])=>y),alongCoord:y=>p+(b-p)*y,halfWidth:c(d),swell:(y,g)=>f.max[2]-.12+.12*s(y)*s(2*g-1),base:f.min[2]})}else if(f.part===dt.pad){let d=[[0,.84],[.1,.92],[.78,.92],[.9,.89],[.97,.82],[1,.72]],p=f.min[2],b=f.max[2],y=f.min[1],g=f.max[1];a({part:f.part,vertical:!1,across:[-1,-.6,0,.6,1],along:d.map(([v])=>v),alongCoord:v=>p+(b-p)*v,halfWidth:c(d),swell:(v,P)=>y+(g-y)*(.45+.55*s(v)*s(2*P-1)),base:y})}else i(f);let l=new Float32Array(e),u=new Float32Array(t),m=new Float32Array(n),h=new Uint16Array(o);return{position:l,normal:u,part:m,index:h,vertexCount:n.length,indexCount:o.length}}var Ea=20*Math.PI/180;function cl(e,t,n,o,r){let i=new Float32Array(t),a=m=>e[m*3],s=m=>e[m*3+2],c=Math.cos(Ea),l=0,u=(m,h)=>{let f=h-m,d=r?.(m),p=d!==void 0;for(let v=m+1;!p&&v<h-1;v++){let P=a(v)-a(v-1),w=s(v)-s(v-1),x=a(v+1)-a(v),S=s(v+1)-s(v),A=Math.hypot(P,w)*Math.hypot(x,S);A>1e-9&&(P*x+w*S)/A<c&&(p=!0)}let b=0,y=0,g=!1;if(p){if(d)[b,y]=d;else{for(let P=m;P<h;P++)b+=a(P),y+=s(P);b/=f,y/=f}let v=0;for(let P=m+1;P<h;P++)v=Math.max(v,Math.hypot(a(P)-a(P-1),s(P)-s(P-1)));g=f>=3&&Math.hypot(a(h-1)-a(m),s(h-1)-s(m))<=v*1.6}for(let v=m;v<h;v++){let[P,w]=p?[b,y]:o(v),x=P-a(v),S=w-s(v);if(f>=2&&!(d&&f<3)){let A=g?m+(v-1-m+f)%f:Math.max(m,v-1),M=g?m+(v+1-m)%f:Math.min(h-1,v+1),E=a(M)-a(A),T=s(M)-s(A),k=Math.hypot(E,T);if(k>1e-6){let _=-T/k,R=E/k;_*x+R*S<0&&(_=-_,R=-R),x=_,S=R}}i[v]=x===0&&S===0?0:Math.atan2(x,S)}};for(let m=1;m<=t;m++)(m===t||n(m)!==n(l))&&(u(l,m),l=m);return i}var Ia=78,ll=18;function ul(){let e=[],t=[],n=[],o=[],r=[],i=[{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]]}];for(let s of[{part:1,min:[-1,.36,-.95],max:[1,.45,1]},{part:2,min:[-1,sn,-1],max:[1,dn,-.72]}])for(let c of i){let l=e.length/3,u=c.n[1]+(s.part===2?Math.abs(c.n[0])*(1-Ur)/(dn-sn):0),m=Math.hypot(c.n[0],u,c.n[2]),h=[c.n[0]/m,u/m,c.n[2]/m];for(let[f,d]of c.c.entries()){let p=d.map((b,y)=>s.min[y]+b*(s.max[y]-s.min[y]));s.part===2&&(p[0]*=1-d[1]*(1-Ur)),e.push(...p),t.push(...h),n.push(s.part),o.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][f])}r.push(l,l+1,l+2,l,l+2,l+3)}let a=e.length/3;for(let[s,c]of[[-1,-1],[1,-1],[1,1],[-1,1]])e.push(s,c,0),t.push(0,1,0),n.push(0),o.push(s,c);return r.push(a,a+1,a+2,a,a+2,a+3),r.push(...r.slice(12,18),...r.slice(60,66),...r.slice(72,78)),{position:new Float32Array(e),normal:new Float32Array(t),surface:new Float32Array(n),uv:new Float32Array(o),index:new Uint16Array(r)}}var yl=require("ogl");var T0=/^#?([\da-f]{3}|[\da-f]{6})$/i;function ml(e){let t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function k0(e){let t=T0.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(r=>r+r).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function Ie(e){let t=k0(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function _a(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function L0(e){return .2126*_a(e[0])+.7152*_a(e[1])+.0722*_a(e[2])}function hl(e){return L0([e[0]*255,e[1]*255,e[2]*255])}function O0(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function we(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 Xt(e,t){let n=O0(e);return we(e,[n,n,n],t)}function fl({r:e,g:t,b:n}){let o=e/255,r=t/255,i=n/255,a=Math.max(o,r,i),s=Math.min(o,r,i),c=(a+s)/2;if(a===s)return{h:0,s:0,l:c};let l=a-s,u=c>.5?l/(2-a-s):l/(a+s),m;return a===o?m=((r-i)/l+(r<i?6:0))/6:a===r?m=((i-o)/l+2)/6:m=((o-r)/l+4)/6,{h:m,s:u,l:c}}var Ca=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,Ta=e=>e<=.0031308?12.92*e:1.055*Math.max(0,e)**.4166666666666667-.055,ka=e=>Math.min(1,Math.max(0,e));function Xr(e){let t=Ca(e[0]),n=Ca(e[1]),o=Ca(e[2]),r=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*o),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*o),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*o);return[.2104542553*r+.793617785*i-.0040720468*a,1.9779984951*r-2.428592205*i+.4505937099*a,.0259040371*r+.7827717662*i-.808675766*a]}function jr([e,t,n]){let o=(e+.3963377774*t+.2158037573*n)**3,r=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[ka(Ta(4.0767416621*o-3.3077115913*r+.2309699292*i)),ka(Ta(-1.2684380046*o+2.6097574011*r-.3413193965*i)),ka(Ta(-.0041960863*o-.7034186147*r+1.707614701*i))]}var Kr=e=>Xr(e)[0];function Yo(e){let[,t,n]=Xr(e);return Math.hypot(t,n)}function kn(e,t,n){let[,o,r]=Xr(e);if(n===void 0)return jr([t,o,r]);let i=Math.hypot(o,r),a=i===0?0:n/i;return jr([t,o*a,r*a])}function dl(e,t,n){let[o,r,i]=Xr(e);return o>=t&&o<=n?e:jr([Math.min(n,Math.max(t,o)),r,i])}function Yr(e){return jr([e,-.004,-.008])}var ct=["available","held","sold","selected","dimmed"];function $o(e){let t=ct.indexOf(e);return t<0?0:t}var bl={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function F0(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.78,o=.86;return[(t+(e[0]-t)*n)*o,(t+(e[1]-t)*n)*o,(t+(e[2]-t)*n)*o]}var pl={day:{ground:.9,deck:.84,fascia:.77,shell:.79,seatMin:.45,seatMax:.58,unavailable:.58,dimmed:.62,sectionDeck:.66,sectionDeckChromaShare:.8,sectionDeckChromaCap:.11,stageTop:.52,stageWall:.42},night:{ground:.26,deck:.34,fascia:.28,shell:.32,seatMin:.64,seatMax:.8,unavailable:.42,dimmed:.39,sectionDeck:.34,sectionDeckChromaShare:.45,sectionDeckChromaCap:.05,stageTop:0,stageWall:0}},$r=.012;function Kt(e){return Kr(e.tierTop)>.6}function Ln(e){return e?pl.day:pl.night}function gl(e,t){let n=Ln(t);return dl(F0(e),n.seatMin,n.seatMax)}var La={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]},On={top:[.05,.06,.08],bottom:[.1,.12,.15]};function oe(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function D0(){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 xl=1e4;function N0(e){if(typeof navigator<"u"){let t=navigator.deviceMemory;if(typeof t=="number"&&t<=4)return 0}return e>=1.5?2:4}var Zr=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.");let o=D0();this.smoothingSamples=N0(o),this.renderer=new yl.Renderer({canvas:this.canvas,dpr:o,alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[On.top[0],On.top[1],On.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 pn=require("ogl"),B0=`#version 300 es
21
21
  in vec2 position;
22
22
  in vec2 uv;
23
23
  out vec2 vUv;
24
24
  void main() {
25
25
  vUv = uv;
26
26
  gl_Position = vec4(position, 0.0, 1.0);
27
- }`,Zd=`#version 300 es
27
+ }`,H0=`#version 300 es
28
28
  precision highp float;
29
29
  uniform sampler2D tFrame;
30
30
  in vec2 vUv;
31
31
  out vec4 fragColor;
32
32
  void main() {
33
33
  fragColor = vec4(texture(tFrame, vUv).rgb, 1.0);
34
- }`,mr=class{constructor(t,n,o){this.gl=t;this.renderer=n;this.samples=o;this.fbo=null;this.colour=null;this.depth=null;this.resolved=null;this.copy=null;this.width=0;this.height=0;this.active=null;this.unavailable=!1}begin(t){if(this.active=null,!t||this.unavailable||this.samples<2)return null;let n=this.gl,o=n.drawingBufferWidth,r=n.drawingBufferHeight;return o<1||r<1?null:(!this.fbo||o!==this.width||r!==this.height)&&(this.release(),!this.allocate(o,r))?(this.unavailable=!0,this.release(),null):(this.active={target:n.FRAMEBUFFER,buffer:this.fbo,width:o,height:r,depth:!0,stencil:!1},this.active)}end(){if(!this.active||!this.resolved||!this.copy)return;let t=this.gl,{width:n,height:o}=this.active;this.active=null,t.bindFramebuffer(t.READ_FRAMEBUFFER,this.fbo),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.resolved.buffer),t.blitFramebuffer(0,0,n,o,0,0,n,o,t.COLOR_BUFFER_BIT,t.NEAREST),this.unbind(),this.renderer.render({scene:this.copy,clear:!1})}reset(){this.fbo=null,this.colour=null,this.depth=null,this.resolved=null,this.copy=null,this.active=null,this.width=0,this.height=0}dispose(){this.release()}allocate(t,n){let o=this.gl,r=Math.min(this.samples,o.getParameter(o.MAX_SAMPLES));if(r<2)return!1;this.fbo=o.createFramebuffer(),this.colour=o.createRenderbuffer(),this.depth=o.createRenderbuffer(),o.bindRenderbuffer(o.RENDERBUFFER,this.colour),o.renderbufferStorageMultisample(o.RENDERBUFFER,r,o.RGBA8,t,n),o.bindRenderbuffer(o.RENDERBUFFER,this.depth),o.renderbufferStorageMultisample(o.RENDERBUFFER,r,o.DEPTH_COMPONENT24,t,n),o.bindRenderbuffer(o.RENDERBUFFER,null),o.bindFramebuffer(o.FRAMEBUFFER,this.fbo),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.RENDERBUFFER,this.colour),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,this.depth);let i=o.checkFramebufferStatus(o.FRAMEBUFFER)===o.FRAMEBUFFER_COMPLETE;if(this.unbind(),!i)return!1;this.resolved=new Yt.RenderTarget(this.gl,{width:t,height:n,depth:!1,minFilter:o.NEAREST,magFilter:o.NEAREST});let a=new Yt.Program(this.gl,{vertex:$d,fragment:Zd,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{tFrame:{value:this.resolved.texture}}});return this.copy=new Yt.Mesh(this.gl,{geometry:new Yt.Triangle(this.gl),program:a}),this.copy.frustumCulled=!1,this.width=t,this.height=n,!0}unbind(){let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,null),this.renderer.state.framebuffer=null}release(){let t=this.gl;if(this.fbo&&t.deleteFramebuffer(this.fbo),this.colour&&t.deleteRenderbuffer(this.colour),this.depth&&t.deleteRenderbuffer(this.depth),this.resolved){for(let n of this.resolved.textures)t.deleteTexture(n.texture);t.deleteFramebuffer(this.resolved.buffer)}this.copy&&(this.copy.geometry.remove(),this.copy.program.remove()),this.reset()}};var fr=class{constructor(){this.limit=1/0;this.recent=[];this.slow=0;this.last=null}allows(t){return t<this.limit}frame(t,n,o){if(!t){this.last=null;return}let r=this.last===null?null:o-this.last;if(this.last=o,r===null||r>250)return;let i=r>25;this.recent.push(i),i&&(this.slow+=1),this.recent.length>30&&this.recent.shift()&&(this.slow-=1),this.slow>=8&&(this.limit=Math.min(this.limit,n*.8),this.recent=[],this.slow=0)}};var Tn=require("ogl"),We=Math.PI/180,Gi=15*We,Hi=80*We,Cn=.12,xc=35,zi=1.25,Mc=.006,qd=4,Ln=.82,po=1/Ln,Qd=.12,Jd=2;function ep(e,t){return{azimuth:0-e*Mc,polar:-t*Mc}}function vc(e,t,n){let o=Math.max(Jd,Math.max(1,t)*Qd),r=n*qd;return{minDist:e?Math.min(e.minDist,o):o,maxDist:e?Math.max(e.maxDist,r):r}}var tp=1.5;function np(e,t,n){let o=Math.max(1,n)*tp;if(!e)return{anchor:[t[0],t[1],t[2]],limit:o};let[r,i,a]=e.anchor,s=t[1]-i,c=Math.max(Math.abs(t[0]-r),Math.abs(t[2]-a),s>=0?s:-s*2);return{anchor:e.anchor,limit:Math.max(e.limit,c+o)}}function op(e,t,n,o,r,i,a,s){let c=Math.sin(n),l=[c*Math.sin(t),Math.cos(n),c*Math.cos(t)],u=[e[0]+o*l[0],e[1]+o*l[1],e[2]+o*l[2]],m=[-l[0],-l[1],-l[2]],f=[-m[2],0,m[0]],h=Math.hypot(f[0],f[2])||1;f=[f[0]/h,0,f[2]/h];let d=[f[1]*m[2]-f[2]*m[1],f[2]*m[0]-f[0]*m[2],f[0]*m[1]-f[1]*m[0]],p=Math.tan(r*We/2),b=p*(i>0?i:1),x=[0,1,2].map(A=>m[A]+a*b*f[A]+s*p*d[A]);if(x[1]>=-1e-6)return null;let y=(e[1]-u[1])/x[1],M=Math.hypot(x[0],x[1],x[2]);return!(y>0)||y*M>o*rp?null:[u[0]+x[0]*y,e[1],u[2]+x[2]*y]}var Sc=3,rp=4,wc=.72,ip=.6;function ap(e,t,n){return e!=="auto"?e:n!==null&&t<n*ip?"pan":"orbit"}function Pc(e,t){let n=Math.sin(t),o=-n*Math.sin(e),r=-Math.cos(t),i=-n*Math.cos(e);if(Math.abs(r)>.999)return null;let a=-i,s=o,c=Math.hypot(a,s);return a/=c,s/=c,{fx:o,fy:r,fz:i,rx:a,rz:s,ux:-s*r,uy:s*o-a*i,uz:a*r}}var sp=.4;function cp(e,t,n,o,r,i){let a=[e.center[0],e.center[1],e.center[2]],s=i(a),c=e.fitPoints,l=Pc(o,r);if(!c||c.length<9||!l)return{center:a,distance:s};let{fx:u,fy:m,fz:f,rx:h,rz:d,ux:p,uy:b,uz:x}=l,y=Math.hypot(u,f),M=u/y,A=f/y,w=M*p+A*x,g=sp*Math.max(1,e.radius);for(let S=0;S<3;S++){let v=1/0,P=-1/0,E=1/0,k=-1/0;for(let N=0;N+2<c.length;N+=3){let O=c[N]-a[0],V=c[N+1]-a[1],z=c[N+2]-a[2],G=s+O*u+V*m+z*f;if(!(G>.001))continue;let T=(O*h+z*d)/(G*t),D=(O*p+V*b+z*x)/(G*n);T<v&&(v=T),T>P&&(P=T),D<E&&(E=D),D>k&&(k=D)}if(!Number.isFinite(v))break;let L=(v+P)/2*s*t,I=Math.abs(w)>.1?(E+k)/2*s*n/w:0,R=L*h+I*M,_=L*d+I*A;if(Math.hypot(a[0]+R-e.center[0],a[2]+_-e.center[2])>g){let N=a[0]-e.center[0],O=a[2]-e.center[2],V=N+R,z=O+_,G=g/Math.hypot(V,z);R=V*G-N,_=z*G-O}a=[a[0]+R,a[1],a[2]+_],s=i(a)}return{center:a,distance:s}}var hr=class{constructor(t,n,o,r){this.fovY=xc;this.target=new Tn.Vec3;this.azimuth=-30*We;this.polar=55*We;this.distance=10;this.azT=-30*We;this.polT=55*We;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;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 Tn.Vec3;this.panAnchor=new Tn.Vec3;this.panLimit=0;this.panBox=null;this.zoomPointResolver=null;this.primaryDragMode="auto";this.overviewDist=null;this.pinchAngle=0;this.camera=new Tn.Camera(t,{fov:xc,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=o,this.onGesture=r,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=this.dragAction(),s=a==="orbit"?"pan":"orbit",c=i.button===2||i.button===1||i.shiftKey?s:a;this.panning=c==="pan",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(),this.pinchAngle=this.currentPinchAngle();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 l=this.currentPinchDistance(),u=this.pinchCentroid();this.pinchDist>0&&(this.dollyAt(Math.exp((this.pinchDist-l)*.005),u.x,u.y),this.fireGesture()),this.pinchDist=l;let m=this.currentPinchAngle(),f=m-this.pinchAngle;f>Math.PI&&(f-=2*Math.PI),f<-Math.PI&&(f+=2*Math.PI),this.pinchAngle=m,Math.abs(f)>1e-4&&Math.abs(f)<.5&&(this.azT+=f,this.fireGesture()),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}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture();let c=ep(a,s);this.azT+=c.azimuth,this.polT=Math.max(Gi,Math.min(Hi,this.polT+c.polar)),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.dollyAt(Math.exp(s*.22),i.clientX,i.clientY),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*We;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(Gi,Math.min(Hi,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(Ln);else if(i.key==="-"||i.key==="_")this.dollyBy(po);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,o=0;for(let r of t)n+=r.x,o+=r.y;return{x:n/t.length,y:o/t.length}}panBy(t,n){let o=this.canvas.clientHeight||1,r=2*this.distance*Math.tan(this.fovY*We/2)/o,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),u=Math.sin(this.polar),m=-i*l,f=-a*l;this.targetT.x+=(-t*s+n*m)*r,this.targetT.z+=(-t*c+n*f)*r,this.targetT.y+=n*u*r,this.clampPan(),this.requestRender()}widenPanBox(t){this.panBox=np(this.panBox,t.center,t.radius),this.panAnchor.set(this.panBox.anchor[0],this.panBox.anchor[1],this.panBox.anchor[2]),this.panLimit=this.panBox.limit}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,o=this.panAnchor.y,r=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(r-t,Math.min(r+t,this.targetT.z)),this.targetT.y=Math.max(o-t*.5,Math.min(o+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchAngle(){let[t,n]=[...this.activePointers.values()];return t&&n?Math.atan2(n.y-t.y,n.x-t.x):0}dragAction(){return ap(this.primaryDragMode,this.distT,this.overviewDist)}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()}dollyAt(t,n,o){let r=this.distT,i=this.canvas.getBoundingClientRect?.(),a=this.zoomPointResolver?.(n,o)??null;if(a){this.distT=Math.max(Sc,Math.min(this.maxDist,this.distT*t)),this.minDist=Math.min(this.minDist,Math.max(Sc,this.distT)),this.requestRender(),this.scaleTargetAbout(a,this.distT/r);return}let s=i&&i.width>0&&i.height>0?op([this.targetT.x,this.targetT.y,this.targetT.z],this.azT,this.polT,this.distT,this.fovY,this.camera.aspect||i.width/i.height,(n-i.left)/i.width*2-1,1-(o-i.top)/i.height*2):null;this.dollyBy(t),s&&this.scaleTargetAbout(s,this.distT/r)}scaleTargetAbout(t,n){!Number.isFinite(n)||n===1||(this.targetT.x=t[0]+(this.targetT.x-t[0])*n,this.targetT.y=t[1]+(this.targetT.y-t[1])*n,this.targetT.z=t[2]+(this.targetT.z-t[2])*n,this.clampPan())}setZoomPointResolver(t){this.zoomPointResolver=t}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}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,o,r=!1,i){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t);let a=Math.max(1,t.radius),s=this.fovY*We/2,c=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=o??-30*We,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*We;let u=this.framedOn(t,s,l),m=u.distance;this.target.set(u.center[0],u.center[1],u.center[2]),this.targetT.copy(this.target),this.distT=m*Math.max(1.05,Math.min(2,i?.margin??zi)),this.envelope=vc(this.envelope,a,m),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.overviewDist===null&&(this.overviewDist=this.distT),n?(this.azimuth=this.azT,this.polar=12*We,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){if(!(t>0)||!Number.isFinite(t))return;let n=this.camera.aspect;if(this.interactionEnabled&&n>0){let o=Math.min(n,1)/Math.min(t,1);this.distance*=o,this.distT*=o,this.overviewDist!==null&&(this.overviewDist*=o),this.maxDist=Math.max(this.maxDist,this.distance,this.distT),this.applyPosition()}this.camera.perspective({aspect:t})}glideTo(t,n){this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.widenPanBox(t),this.targetT.set(t.center[0],t.center[1],t.center[2]);let o=this.fovY*We/2,r=Math.atan(Math.tan(o)*(this.camera.aspect||1));this.azT=this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*We;let i=this.framedOn(t,o,r),a=i.distance;this.targetT.set(i.center[0],i.center[1],i.center[2]),this.distT=a*Math.max(1.05,Math.min(2,n?.margin??zi)),this.envelope=vc(this.envelope,Math.max(1,t.radius),a),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.requestRender()}frameSoft(t,n,o=!1,r){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t),this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*We/2,a=o?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,r?.polarDeg??55))*We;let c=this.framedOn(t,i,s);this.targetT.set(c.center[0],c.center[1],c.center[2]),this.distT=c.distance*Math.max(1.05,Math.min(2,r?.margin??zi))}framedOn(t,n,o){return cp(t,Math.tan(o),Math.tan(n),this.azT,this.polT,r=>this.fitDistance({...t,center:r},n,o,this.azT,this.polT))}fitDistance(t,n,o,r,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(o)),c=t.box;if(!c)return s;let l=Pc(r,i);if(!l)return s;let{fx:u,fy:m,fz:f,rx:h,rz:d,ux:p,uy:b,uz:x}=l,y=Math.tan(o),M=Math.tan(n),A=1;for(let E=0;E<8;E++){let k=(E&1?c.max[0]:c.min[0])-t.center[0],L=(E&2?c.max[1]:c.min[1])-t.center[1],I=(E&4?c.max[2]:c.min[2])-t.center[2],R=k*u+L*m+I*f,_=Math.abs(k*h+I*d),F=Math.abs(k*p+L*b+I*x);A=Math.max(A,_/y-R,F/M-R)}let w=Math.min(s,Math.max(A,a*.35)),g=t.fitPoints;if(!g||g.length<9)return w;let S=0,v=1/(y*wc),P=1/(M*wc);for(let E=0;E+2<g.length;E+=3){let k=g[E]-t.center[0],L=g[E+1]-t.center[1],I=g[E+2]-t.center[2],R=k*u+L*m+I*f,_=Math.abs(k*h+I*d),F=Math.abs(k*p+L*b+I*x);S=Math.max(S,_*v-R,F*P-R)}return Math.min(w*1.5,Math.max(w*.55,S))}updateClipping(t){let n=this.camera.position.x-t.center[0],o=this.camera.position.y-t.center[1],r=this.camera.position.z-t.center[2],i=Math.hypot(this.camera.position.x-this.target.x,this.camera.position.y-this.target.y,this.camera.position.z-this.target.z),a=this.interactionEnabled&&Math.abs(i-this.distance)<=this.distance*.01,{near:s,far:c}=mp(Math.hypot(n,o,r),t.radius,a?this.distance:null);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,o=this.distT-this.distance,r=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(o)>1e-4||Math.abs(r)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*Cn,this.polar+=n*Cn,this.distance+=o*Cn,this.target.x+=r*Cn,this.target.y+=i*Cn,this.target.z+=a*Cn,c&&this.applyPosition(),c}get currentAzimuth(){return this.azimuth}get currentDistance(){return this.distance}get targetDistance(){return this.distT}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,o=this.camera.position.z-this.target.z,r=Math.hypot(t,n,o)||1,i=Math.max(Gi,Math.min(Hi,Math.acos(Math.max(-1,Math.min(1,n/r)))));this.distance=this.distT=r,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,o)}snapshot(){let t=this.target.clone(),n=this.targetT.clone(),{azimuth:o,azT:r,polar:i,polT:a,distance:s,distT:c}=this,l=this.camera.position.clone(),u=[...this.camera.quaternion],m=this.camera.fov;return()=>{this.target.copy(t),this.targetT.copy(n),Object.assign(this,{azimuth:o,azT:r,polar:i,polT:a,distance:s,distT:c}),this.camera.position.copy(l),this.camera.quaternion.set(u[0],u[1],u[2],u[3]),this.camera.perspective({fov:m,aspect:this.camera.aspect}),this.camera.updateMatrixWorld()}}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),o=this.target.y+this.distance*Math.cos(this.polar),r=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,o,r),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()}},lp=.1,up=.25;function mp(e,t,n){let o=Math.max(1,t)*1.18,r=n==null?up:Math.max(.05,n*lp),i=Math.max(r,e-o),a=Math.max(i+10,e+o);return{near:i,far:a}}var dr=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 r=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+r*.1:r}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}};function Ac(e){let t=!1;return n=>{n!==t&&(t=n,n?e.dataset.slReady="1":delete e.dataset.slReady)}}function Ui(e,t,n){return Math.max(t,Math.min(n,e))}function fp(e){return Ui(e,0,1)}function Rc(e){let t=fp(e);return t*t*(3-2*t)}var kn=2.5,hp=1.15,bo=12,On=22,ji=30,Wi=4,pr=8192;var sS=On+Wi;function Ec(e,t){let n=t*1.4,o=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:kn};let r=Math.min(1,(e-n)/Math.max(.001,o-n));return{scale:1-r*.4,fade:r*.55,minPixels:kn+r*(hp-kn)}}function Ic(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}var dp=12;function _c(e,t,n,o,r){if(!(e>0)||!(t>0)||!(n>0)||!(o>0)||!(r>0))return!1;let i=Math.tan(o/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(r/2);return Math.PI*a*a/e>=dp}var Xi=[{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"}],lS=new Map(Xi.map(e=>[e.key,e]));var pp={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 br(e){let t=e?.[0];return t&&pp[t]||"#3b82f6"}var bp=[{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"}],uS=new Map(bp.map(e=>[e.key,e]));var yp=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],mS=new Set(yp);var Tc=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark: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},mark:{x:12,y:10,radius:6}},{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},mark:{x:12,y:10,radius:4.5}},{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 L18 12 L18.5 23 L16 23 L15.5 13 L8.5 13 L8 23 L5.5 23 Z",bounds:{x:4,y:2,width:16,height:21},mark:{x:12,y:5,radius:3}},{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},mark:{x:12,y:7.5,radius:5.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},mark:{x:12,y:8,radius: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},mark:{x:12,y:9.25,radius:6.5}},{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},mark:{x:12,y:12.25,radius:4.75}}],Lc=Tc.map(e=>e.key),gp=new Map(Tc.map(e=>[e.key,e]));function Cc(e){return typeof e=="string"&&gp.has(e)}function kc(e,t){return Cc(e)?e:Cc(t?.seatGlyph)?t.seatGlyph:"circle"}var he=.02291666666666667,pt=1/he,xp=58,Mp=xp*he;var vp=3,Oc=0,Ki=120,Sp=0,wp=45,Pp=7,_t=1.2;function Yi(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function Ap(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Pp?e:vp}function $t(e,t={}){let n=Yi(t.floorBaseHeightM,Oc,Ki,0),o=Math.min(Ki,n+Ap(e.elevation)*Mp),r=e.height===void 0?o:Yi(e.height,Oc,Ki,o),i=Yi(e.rake,Sp,wp,0);return{height:r,rake:i}}var Dc=Et(require("earcut"),1),qi=Et(require("polygon-clipping"),1);var yS=Math.PI/180;function Xe(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function $i(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Zi(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function Fn(e){return e.length?Zi(e):null}function mt(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let r=e[n],i=e[(n+1)%o];t+=r.x*i.y-i.x*r.y}return t/2}function Ze(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let a=e[r],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(o=!o)}return o}var C=he,Rp=.002;function Ep(e,t,n){let o=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=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(o,r,i);if(a<1e-9)return!0;let s=(o+r+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-o)*(s-r)*(s-i)))/a<Rp}var pn=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){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++]=o}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 o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},xr=class{constructor(){this.pos=new pn;this.nor=new pn;this.col=new pn;this.flr=new pn;this.mat=new pn;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,a=i,s=i,c){if(Ep(t,n,o))return;this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[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);let l=this.currentMaterial;this.mat.push1(c?.[0]??l),this.mat.push1(c?.[1]??l),this.mat.push1(c?.[2]??l)}triN(t,n,o,r,i,a,s,c=s,l=s){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[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 Ip(e,t,n){let o=t[0]-e[0],r=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=r*c-i*s,u=i*a-o*c,m=o*s-r*a,f=Math.hypot(l,u,m)||1;return l/=f,u/=f,m/=f,[l,u,m]}function _p(e,t){let n=[...e],o=[];for(let a of e)o.push(a.x,a.y);let r=[];if(t){for(let a of t)if(!(a.length<3)){r.push(n.length);for(let s of a)n.push(s),o.push(s.x,s.y)}}let i=(0,Dc.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function Ct(e){return mt(e)<0?[...e].reverse():e}var Cp=3;function Tp(e,t,n,o){let r=o(e),i=o(t),a=o(n),s=(h,d,p,b)=>Math.abs(o({x:(h.x+d.x)/2,y:(h.y+d.y)/2})-(p+b)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(r+i+a)/3,m=Math.max(s(e,t,r,i),s(t,n,i,a),s(n,e,a,r),Math.abs(o({x:c,y:l})-u)),f=(h,d,p)=>{let b=Math.abs(o({x:(h+c)/2,y:(d+l)/2})-(p+u)/2);b>m&&(m=b)};return f((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),f((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),f((n.x+e.x)/2,(n.y+e.y)/2,(a+r)/2),m}function yo(e,t,n,o,r){if(r<=0)return Tp(e,t,n,o);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(yo(e,i,s,o,r-1),yo(i,t,a,o,r-1),yo(s,a,n,o,r-1),yo(i,a,s,o,r-1))}function go(e,t,n,o,r,i,a,s){if(a>0){let f={x:(t.x+n.x)/2,y:(t.y+n.y)/2},h={x:(n.x+o.x)/2,y:(n.y+o.y)/2},d={x:(o.x+t.x)/2,y:(o.y+t.y)/2};go(e,t,f,d,r,i,a-1,s),go(e,f,n,h,r,i,a-1,s),go(e,d,h,o,r,i,a-1,s),go(e,f,h,d,r,i,a-1,s);return}let c=[t.x*C,r(t),t.y*C],l=[n.x*C,r(n),n.y*C],u=[o.x*C,r(o),o.y*C];if(s){e.triN(c,l,u,s(t),s(n),s(o),i);return}let m=Ip(c,l,u);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),e.tri(c,l,u,m,i)}var Lp=8;function Fc(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,a,s,c,l)=>{if(l>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=t(u);if(Math.abs(m-(s+c)/2)>n){r(i,u,s,m,l-1),r(u,a,m,c,l-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];r(a,s,t(a),t(s),Lp)}return o}function yr(e,t){if(e.length<3)return e;let n=[];for(let r of e){let i=n[n.length-1];i&&Math.hypot(r.x-i.x,r.y-i.y)<t||n.push(r)}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 o=[];for(let r=0;r<n.length;r++){let i=o.length?o[o.length-1]:n[(r-1+n.length)%n.length],a=n[r],s=n[(r+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||o.push(a)}return o.length>=3?o:n}var gr=.001*pt*.1;function ie(e,t,n,o,r,i,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(mt(t))<1e-4))return;let u=yr(Fc(yr(Ct(t),gr),o,c),gr),m=n?.map(g=>yr(Fc(yr(Ct(g),gr),o,c),gr)).filter(g=>g.length>=3&&Math.abs(mt(g))>=1e-4),{pts:f,tris:h}=_p(u,m),d=[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],b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],x=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],y=0;if(Number.isFinite(c))for(;y<Cp;y++){let g=0;for(let S=0;S<h.length;S+=3){let v=yo(f[h[S]],f[h[S+1]],f[h[S+2]],o,y);v>g&&(g=v)}if(g<=c)break}for(let g=0;g<h.length;g+=3){let S=f[h[g]],v=f[h[g+1]],P=f[h[g+2]];go(e,S,v,P,o,d,y,l);let E=[S.x*C,r,S.y*C],k=[v.x*C,r,v.y*C],L=[P.x*C,r,P.y*C];e.tri(E,L,k,[0,-1,0],p)}let M=g=>{if(y<=0)return g;let S=1<<y,v=[];for(let P=0;P<g.length;P++){let E=g[P],k=g[(P+1)%g.length];for(let L=0;L<S;L++){let I=L/S;v.push({x:E.x+(k.x-E.x)*I,y:E.y+(k.y-E.y)*I})}}return v},A=Zi(u),w=[{ring:M(u),flip:!1}];if(m)for(let g of m)g.length>=3&&w.push({ring:M(g),flip:!0});for(let{ring:g,flip:S}of w)for(let v=0;v<g.length;v++){let P=g[v],E=g[(v+1)%g.length],k=(E.x-P.x)*C,I=(E.y-P.y)*C,R=-k,_=Math.hypot(I,R)||1;I/=_,R/=_;let F=(P.x+E.x)/2-A.x,N=(P.y+E.y)/2-A.y,O=I*F+R*N;S&&(O=-O),O<0&&(I=-I,R=-R);let V=[I,0,R],z=[P.x*C,o(P),P.y*C],G=[E.x*C,o(E),E.y*C],T=[P.x*C,r,P.y*C],D=[E.x*C,r,E.y*C];e.tri(z,G,D,V,b,b,x),e.tri(z,D,T,V,b,x,x)}}function Nc(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),r=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),o.set(c.normal,s*3),r.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:o,color:r,floor:i,material:a,count:t}}function Tt(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=Ct(e),r=o.length,i=[];for(let s=0;s<r;s++){let c=o[s],l=o[(s+1)%r],u=l.x-c.x,m=l.y-c.y,f=Math.hypot(u,m)||1;i.push({x:m/f,y:-u/f})}let a=[];for(let s=0;s<r;s++){let c=o[s],l=i[(s-1+r)%r],u=i[s],m=l.x+u.x,f=l.y+u.y,h=Math.hypot(m,f),d=()=>{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(h<1e-9){d();continue}m/=h,f/=h;let p=m*l.x+f*l.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){d();continue}a.push([c.x+m*t*b,c.y+f*t*b])}if(a.length<3)return e;try{let s=qi.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let m of s){let f=Math.abs(mt(m[0].map(([h,d])=>({x:h,y:d}))));f>l&&(l=f,c=m[0])}if(!c)return e;let u=c.map(([m,f])=>({x:m,y:f}));if(u.length>1){let m=u[0],f=u[u.length-1];Math.abs(m.x-f.x)<1e-9&&Math.abs(m.y-f.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function bt(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=Ct(e),r=o.length,i=[];for(let c=0;c<r;c++){let l=o[c],u=o[(c+1)%r],m=Math.hypot(u.x-l.x,u.y-l.y)||1;i.push({x:-(u.y-l.y)/m,y:(u.x-l.x)/m})}let a=[],s=[];for(let c=0;c<r;c++){let l=o[c],u=i[(c-1+r)%r],m=i[c],f=u.x+m.x,h=u.y+m.y,d=Math.hypot(f,h),p=d<1e-9?1/0:1/Math.max(f/d*u.x+h/d*u.y,1e-6);if(!Number.isFinite(p)||p>n){a.push({x:l.x+u.x*t,y:l.y+u.y*t},{x:l.x+m.x*t,y:l.y+m.y*t}),s.push(c,c);continue}f/=d,h/=d,a.push({x:l.x+f*t*p,y:l.y+h*t*p}),s.push(c)}for(let c=0;c<a.length;c++){let l=(c+1)%a.length,u=s[c],m=s[l];if(m!==(u+1)%r)continue;let f=o[u],h=o[m];if((a[l].x-a[c].x)*(h.x-f.x)+(a[l].y-a[c].y)*(h.y-f.y)<=0)return[]}try{let c=qi.default.intersection([[...a.map(d=>[d.x,d.y]),[a[0].x,a[0].y]]],[[...o.map(d=>[d.x,d.y]),[o[0].x,o[0].y]]]),l=null,u=0;for(let d of c){let p=Math.abs(mt(d[0].map(([b,x])=>({x:b,y:x}))));p>u&&(u=p,l=d[0])}if(!l)return[];let m=l.map(([d,p])=>({x:d,y:p})),f=m[0],h=m[m.length-1];return m.length>1&&Math.abs(f.x-h.x)<1e-9&&Math.abs(f.y-h.y)<1e-9&&m.pop(),m.length>=3?Ct(m):[]}catch{return[]}}function Mr(e,t,n,o,r=28){let i=[];for(let a=0;a<r;a++){let s=a/r*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return i}function xo(e,t,n,o){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+o},{x:e,y:t+o}]}var Gt=.22;function Vc(e){let t=je[e];return t==="sold"||t==="held"?1:0}var kp=.42,Bc=1.6;function Op(e,t){let n=new Float32Array(e.length*4),o=Math.cos(ki),r=0;for(let i=1;i<=e.length;i++){if(i<e.length&&e[i].rowId===e[r].rowId)continue;let a=i-r>=2&&!t?.has(e[r].rowId);for(let l=r;a&&l<i;l++)e[l].kind==="booth"&&(a=!1);for(let l=r+1;a&&l<i-1;l++){let u=e[l].x-e[l-1].x,m=e[l].y-e[l-1].y,f=e[l+1].x-e[l].x,h=e[l+1].y-e[l].y,d=Math.hypot(u,m)*Math.hypot(f,h);d>1e-9&&(u*f+m*h)/d<o&&(a=!1)}let s=[];for(let l=r+1;a&&l<i;l++){let u=Math.hypot(e[l].x-e[l-1].x,e[l].y-e[l-1].y);u>1e-6&&s.push(u)}s.sort((l,u)=>l-u);let c=s.length?s[Math.floor(s.length/2)]:0;for(let l=r;c>0&&l<i;l++){let u=b=>{let x=l+b;if(x<r||x>=i)return null;let y=e[x].x-e[l].x,M=e[x].y-e[l].y,A=Math.hypot(y,M);return A>1e-6?{x:y/A,y:M/A,gap:A}:null},m=u(1),f=u(-1),h=c/2,d=m??(f?{x:-f.x,y:-f.y,gap:1/0}:null);if(!d)continue;let p=m&&m.gap<c*Bc?m.gap/2:h;if(n[l*4]=d.x*p*C,n[l*4+1]=d.y*p*C,!f||f.gap>=c*Bc){let b=f??{x:-d.x,y:-d.y};n[l*4+2]=b.x*h*C,n[l*4+3]=b.y*h*C}}r=i}return n}function Fp(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,r=1/0,i=-1/0,a=-1/0;for(let d of e)d.x<o&&(o=d.x),d.y<r&&(r=d.y),d.x>i&&(i=d.x),d.y>a&&(a=d.y);let s=Math.max(i-o,1e-6),c=Math.max(a-r,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/l)+1),m=Math.max(1,Math.ceil(c/l)+1),f=new Map,h=(d,p)=>{let b=Math.min(u-1,Math.max(0,Math.floor((d-o)/l)));return Math.min(m-1,Math.max(0,Math.floor((p-r)/l)))*u+b};for(let d=0;d<t;d++){let p=h(e[d].x,e[d].y),b=f.get(p);b?b.push(d):f.set(p,[d])}for(let d=0;d<t;d++){let p=e[d],b=Math.min(u-1,Math.max(0,Math.floor((p.x-o)/l))),x=Math.min(m-1,Math.max(0,Math.floor((p.y-r)/l))),y=1/0;for(let M=1;M<=4;M++){for(let A=x-M;A<=x+M;A++)if(!(A<0||A>=m))for(let w=b-M;w<=b+M;w++){if(w<0||w>=u||M>1&&Math.abs(A-x)<M&&Math.abs(w-b)<M)continue;let g=f.get(A*u+w);if(g)for(let S of g){if(S===d)continue;let v=Math.hypot(e[S].x-p.x,e[S].y-p.y);v<y&&(y=v)}}if(Number.isFinite(y)&&y<=M*l)break}n[d]=y}return n}function Dp(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-_t):0}function Gc(e,t,n,o,r,i,a){let s=e.length,c=new Float32Array(s*3),l=new Float32Array(s),u=new Float32Array(s*3),m=new Float32Array(s),f=new Float32Array(s),h=new Float32Array(s),d=new Float32Array(s),p=new Float32Array(s*3),b=new Map,x=Fp(e);for(let y=0;y<s;y++){let M=e[y],w=(n?.seatPitchU(y)??x[y])*C;m[y]=Number.isFinite(w)?Math.max(.06,Math.min(Gt,w*kp)):Gt,f[y]=Zs(Number.isFinite(w)?w:void 0);let g=kc(M.glyph,{seatGlyph:i?.get(M.categoryKey)}),S=M.glyph!==void 0||i?.has(M.categoryKey);h[y]=Lc.indexOf(!S&&a?.has(M.rowId)?"dining":g),d[y]=M.wheelchairSpaceType==="no-seat"?0:1,c[y*3]=M.x*C,c[y*3+1]=n?n.seatDeckY(y):Dp(M),c[y*3+2]=M.y*C,l[y]=ho(t?t(M):"available");let v=ve(r?.get(M.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[y*3]=v[0],u[y*3+1]=v[1],u[y*3+2]=v[2],M.accessibility?.length){let P=ve(br(M.accessibility));P&&(p[y*3]=P[0],p[y*3+1]=P[1],p[y*3+2]=P[2])}b.set(M.id,y)}return{count:s,iPosition:c,iState:l,iCategory:u,iMaxRadius:m,iRing:p,idToIndex:b,iChairWidth:f,iGlyph:h,iPhysicalSeat:d,iArmrests:Op(e,a),iFloor:o??new Float32Array(s),iSection:new Float32Array(s).fill(-1),iYaw:new Float32Array(s)}}var Np=64;function Qi(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=ho(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let o=[],r=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+Np){i=s;continue}o.push({start:r,length:i-r+1}),r=s,i=s}}return o.push({start:r,length:i-r+1}),o}var Mo=3,bn=.38,vo=.24;function Bp(e){if(e.length<3)return null;let t=e[0],n=e[Math.floor(e.length/2)],o=e[e.length-1],r=(n.x-t.x)*C,i=(n.y-t.y)*C,a=(o.x-t.x)*C,s=(o.y-t.y)*C,c=2*(r*s-i*a);if(Math.abs(c)<1e-7)return null;let l=r*r+i*i,u=a*a+s*s,m=(l*s-u*i)/c+t.x*C,f=(r*u-a*l)/c+t.y*C,h=Math.hypot(t.x*C-m,t.y*C-f);return h<1||h>200||!Number.isFinite(h)||e.some(d=>Math.abs(Math.hypot(d.x*C-m,d.y*C-f)-h)>.03)?null:{x:m,z:f,radius:h}}function Hc(e){let t=[],n=new Map,o=(c,l)=>`${Math.floor(c/Mo)},${Math.floor(l/Mo)}`;for(let c of e)for(let l of c.rows){for(let m of l.pts){let f=m.x*C,h=m.y*C,d=o(f,h),p=n.get(d)??[];p.push({x:f,z:h,y:l.y,floor:c.floorIndex}),n.set(d,p)}if(l.patch||l.pts.length<2)continue;let u=Bp(l.pts);for(let m of[0,l.pts.length-1]){let f=l.pts[m],h=l.pts[m===0?1:m-1],d=f.x-h.x,p=f.y-h.y,b=Math.hypot(d,p);b<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:u,row:l,point:f,x:f.x*C,z:f.y*C,dx:d/b,dz:p/b})}}let r=new Map;t.forEach((c,l)=>{let u=o(c.x,c.z),m=r.get(u)??[];m.push(l),r.set(u,m)});let i=(c,l)=>{let u=Math.floor(c/Mo),m=Math.floor(l/Mo);return[-1,0,1].flatMap(f=>[-1,0,1].map(h=>`${u+f},${m+h}`))},a=new Map;t.forEach((c,l)=>{let u=-1,m=1/0,f=!1;for(let h of i(c.x,c.z))for(let d of r.get(h)??[]){let p=t[d];if(c.sectionId===p.sectionId&&c.row.blockId===p.row.blockId||c.floorIndex!==p.floorIndex||Math.abs(c.row.y-p.row.y)>.05)continue;let b=p.x-c.x,x=p.z-c.z,y=Math.hypot(b,x);if(y<bn*2+.45||y>Mo)continue;let M=c.curve&&p.curve&&Math.hypot(c.curve.x-p.curve.x,c.curve.z-p.curve.z)<=.05&&Math.abs(c.curve.radius-p.curve.radius)<=.05,A=Math.min((b*c.dx+x*c.dz)/y,(-b*p.dx-x*p.dz)/y);(M?A<.8:A<.98)||!M&&(Math.abs(b*c.dz-x*c.dx)>.15||Math.abs(b*p.dz-x*p.dx)>.15)||(y<m-.02?(u=d,m=y,f=!1):Math.abs(y-m)<=.02&&(f=!0))}u>=0&&!f&&a.set(l,u)});let s=[];for(let[c,l]of a){if(c>=l||a.get(l)!==c)continue;let u=t[c],m=t[l],f=Math.hypot(m.x-u.x,m.z-u.z),h=(m.x-u.x)/f,d=(m.z-u.z)/f,p=!1;for(let x of i((u.x+m.x)/2,(u.z+m.z)/2))for(let y of n.get(x)??[]){if(y.floor!==u.floorIndex||Math.abs(y.y-u.row.y)>.75)continue;let M=(y.x-u.x)*h+(y.z-u.z)*d,A=Math.abs((y.x-u.x)*d-(y.z-u.z)*h);M>.01&&M<f-.01&&A<vo+bn&&(p=!0)}if(p)continue;let b=(x,y)=>({x:(u.x+h*x-d*y)/C,y:(u.z+d*x+h*y)/C});s.push({sections:[u.sectionId,m.sectionId],blocks:[u.row.blockId,m.row.blockId],floorIndex:u.floorIndex,ends:[u.point,m.point],clearWidthM:f-2*bn,heightM:(u.row.y+m.row.y)/2,outline:[b(bn,-vo),b(f-bn,-vo),b(f-bn,vo),b(bn,vo)]})}return s}var Vp=.15,Gp=1.6;function zc(e){return Ui(e??1,Vp,Gp)}var Ji={key:[1,1,1],ambient:[1,1,1]},Uc=.5,Hp=[{id:"daylight",label:"Daylight",description:"Open air by day: pale concrete under a warm sun and a blue sky.",background:"#dce3e8",materials:{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87},light:{key:[1.05,1,.93],ambient:[.95,.99,1.06]},indoor:!1},{id:"floodlit",label:"Floodlit night",description:"A night match: dark sky, hard cool-white floodlights.",background:"#0c1420",materials:{deck:"#66727c",fascia:"#3a4a58",shell:"#4c6072",roughness:.84},light:{key:[1.08,1.08,1.12],ambient:[.8,.88,1.1]},indoor:!1},{id:"evening",label:"Evening",description:"A quiet dark hall: slate structure in a cool, even light.",background:"#17232e",materials:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87},light:{key:[1,.99,.96],ambient:[.94,.98,1.06]},indoor:!1},{id:"arena-show",label:"Arena show",description:"House lights down for a show: deep blue room, warm light on the floor.",background:"#10121c",materials:{deck:"#626a7a",fascia:"#383f52",shell:"#484f66",roughness:.82},light:{key:[1.08,.98,.88],ambient:[.8,.84,1.16]},indoor:!0},{id:"theatre",label:"Theatre house lights",description:"A warm auditorium before curtain-up: amber light, dark warm room.",background:"#1c1512",materials:{deck:"#74685c",fascia:"#4c4038",shell:"#5c4e44",roughness:.9},light:{key:[1.14,.98,.78],ambient:[1.04,.94,.84]},indoor:!0},{id:"concert-hall",label:"Concert hall",description:"A bright hall in pale wood and cream, softly warm.",background:"#e9e2d6",materials:{deck:"#d2c8b8",fascia:"#bcb0a0",shell:"#c8beae",roughness:.8},light:{key:[1.06,1,.9],ambient:[1.02,1,.95]},indoor:!0}],zp=new Map(Hp.map(e=>[e.id,e])),jc="plain",Wc=3e3;function Xc(e,t){return e.openField?t?"daylight":"floodlit":e.court||e.inTheRound||e.stage&&e.seatCount>Wc?t?"daylight":"arena-show":e.stage?t?"concert-hall":"theatre":t?"daylight":"evening"}function Kc(e){return e.openField?!1:e.indoorCourt?!0:e.stage&&!e.inTheRound&&!e.court&&e.standing<e.seatCount&&e.seatCount<=Wc}function ea(e){return e&&zp.get(e)||null}var Up=.15,jp=.9,Wp=1.76;function Xp(e,t,n){let o=e??Kp,r=(i,a,s)=>[Math.min(1,i[0]*a*s[0]),Math.min(1,i[1]*a*s[1]),Math.min(1,i[2]*a*s[2])];return So(e)?{indoor:n,ceiling:r(o,1.02,t.light.ambient),wall:r(o,.9,t.light.ambient),lamp:r([.1,.1,.1],1,t.light.key)}:{indoor:n,ceiling:r(o,.7,t.light.ambient),wall:r(o,1.55,t.light.ambient),lamp:r([.92,.86,.74],1,t.light.key)}}var Kp=[.075,.09,.115];function Yc(e){return So(e)?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function So(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55}function Yp(){return{background:{top:[...dn.top],bottom:[...dn.bottom]},sky:Yc(null),structure:Vi,seatStates:{...pc},seatScale:1,materials:{seat:null,shell:null,roughness:.78},light:{key:[...Ji.key],ambient:[...Ji.ambient]},house:null}}function $p(e){return So(e)?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function $c(e,t){let n=e?.venue3d?.look;if(n===jc)return{look:null,chosen:!0};let o=ea(n);return o?{look:o,chosen:!0}:t?{look:ea(Xc(t,So(ve(e?.background)))),chosen:!1}:{look:null,chosen:!1}}function Zp(e,t){let{look:n,chosen:o}=$c(e,t);return ve(e?.background)??(o?ve(n?.background):null)}function Zc(e,t){let n=Yp();e??={};let{look:o,chosen:r}=$c(e,t);o&&(n.light={key:[...o.light.key],ambient:[...o.light.ambient]});let i=Zp(e,t);if(o&&(n.house=Xp(i,o,r?o.indoor:!!t&&Kc(t))),i){n.background={top:re(i,jp),bottom:re(i,Wp)},n.sky=Yc(i);let u={};for(let[f,h]of Object.entries(Vi))u[f]=Se(h,i,Up);i[0]*.2126+i[1]*.7152+i[2]*.0722>.55&&(u.ground=re(i,.86)),n.structure=u}let a=ve(e.selectionColor)??ve(e.accent);a&&(n.seatStates={...n.seatStates,selected:a});let s=e.seatScale;typeof s=="number"&&Number.isFinite(s)&&(n.seatScale=zc(s));let c=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([u,m])=>m!=null&&u!=="look")),l={...$p(i),...o?.materials,...c};if(l){let u=ve(l.deck),m=ve(l.fascia);u&&(n.structure={...n.structure,tierTop:u,gaTop:u}),m&&(n.structure={...n.structure,tierWall:m,gaWall:m}),n.materials.seat=ve(l.seat),n.materials.shell=ve(l.shell),typeof l.roughness=="number"&&Number.isFinite(l.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,l.roughness)))}return qp(n,So(i)),n}function qp(e,t){let n=hn(t);e.seatStates={...e.seatStates,held:cr(n.unavailable),sold:cr(n.unavailable),dimmed:cr(n.dimmed)};let o=(i,a)=>fn(i,a,Math.min(fo(i),lr)),r=e.structure;e.structure={...r,ground:o(r.ground,n.ground),tierTop:o(r.tierTop,n.deck),tierWall:o(r.tierWall,n.fascia)},e.materials.shell&&(e.materials.shell=o(e.materials.shell,n.shell))}function qc(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}var Qp=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Jp=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function vt(e){return!!e&&Qp.has(e)}function yn(e){return!!e&&Jp.has(e)}var eb=new Set(["court-basketball","rink-hockey","ring-boxing"]);function el(e){return!!e&&eb.has(e)}var ta=1.1;function tl(e){return Sr(e)?e==="ring-boxing"?ta:.06:1}var tb={round:{width:6,height:6},"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8}},nb={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f"};var ob=Math.PI*2;function rb(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function Qc(e,t){let n=Math.max(0,e-t),o=[],r=20;for(let i=0;i<=r;i++){let a=-Math.PI/2+i/r*Math.PI;o.push({x:n+t*Math.cos(a),y:t*Math.sin(a)})}for(let i=0;i<=r;i++){let a=Math.PI/2+i/r*Math.PI;o.push({x:-n+t*Math.cos(a),y:t*Math.sin(a)})}return o}var Jc=(()=>{let t={x:0,y:52},n=25,o={x:70,y:t.y-70},r=(o.x*o.x+o.y*o.y-4900)/(2*(o.y+70)),i=r+70,a=[],s=Math.atan2(o.y-r,o.x),c=Math.atan2(o.y-r,-o.x);for(let l=0;l<=24;l++){let u=s+(c-s)*l/24;a.push({x:i*Math.cos(u),y:r+i*Math.sin(u)})}return{half:70,home:t,backstop:n,fence:a}})();var vr="#f1f5f9";function Sr(e){return vt(e)}function Zt(e,t,n,o,r=32){let i=[];for(let a=0;a<r;a++){let s=a/r*ob;i.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return i}function Ht(e,t,n,o){return[{x:e-n,y:t-o},{x:e+n,y:t-o},{x:e+n,y:t+o},{x:e-n,y:t+o}]}function ib(e){let{kind:t,cx:n,cy:o,width:r,height:i}=e,a=(e.rotation??0)*Math.PI/180,s=Math.cos(a),c=Math.sin(a),l=r/2,u=i/2,m=[],f=tb[t],h=p=>f?p/f.width*r:0,d=p=>f?p/f.height*i:0;switch(t){case"pitch-football":{m.push({points:[{x:0,y:-u},{x:0,y:u}],closed:!1}),m.push({points:Zt(0,0,h(9.15),d(9.15)),closed:!0});for(let p of[-1,1])m.push({points:Ht(p*(l-h(16.5)/2),0,h(16.5)/2,d(40.32)/2),closed:!0}),m.push({points:Ht(p*(l-h(5.5)/2),0,h(5.5)/2,d(18.32)/2),closed:!0});break}case"rink-hockey":{m.push({points:[{x:0,y:-u},{x:0,y:u}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){m.push({points:[{x:p*h(7.5),y:-u},{x:p*h(7.5),y:u}],closed:!1,ink:"#2f6ecb"}),m.push({points:[{x:p*(l-h(4)),y:-d(11)},{x:p*(l-h(4)),y:d(11)}],closed:!1,ink:"#d63b3b"});for(let b of[-1,1])m.push({points:Zt(p*h(20.5),b*d(7),h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"})}m.push({points:Zt(0,0,h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let b=u-d(1.22)*8;b>0&&m.push({points:Qc(l-h(1.22)*8,b),closed:!0,fill:"#2f7d4f"});for(let x=1;x<8;x++){let y=d(1.22)*x,M=u-y;if(M<=0)break;m.push({points:Qc(l-h(1.22)*x,M),closed:!0})}break}case"oval-cricket":{m.push({points:Zt(0,0,h(27.4),d(27.4+20.12/2),40),closed:!0}),m.push({points:Ht(0,0,h(3.05)/2,d(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=b=>({points:[{x:h(b),y:-u},{x:h(b),y:u}],closed:!1});m.push(p(0));for(let b of[-1,1]){m.push(p(b*50),p(b*28));for(let x=-35;x<35;x+=4)m.push({points:[{x:h(b*10),y:d(x)},{x:h(b*10),y:d(Math.min(35,x+2))}],closed:!1})}break}case"diamond-baseball":{let p=(F,N)=>({x:h(F),y:d(N)}),{home:b}=Jc,x=27.43,y=x/Math.SQRT2,M={x:b.x+y,y:b.y-y},A={x:b.x,y:b.y-2*y},w={x:b.x-y,y:b.y-y},g={x:b.x,y:b.y-18.44},S="#b98a59",v=nb["diamond-baseball"],P=38.94,E=[p(b.x,b.y)],k=Math.atan2(b.y-P/Math.SQRT2-g.y,P/Math.SQRT2),L=Math.PI-k;for(let F=0;F<=16;F++){let N=k-(k+Math.PI*2-L)%(Math.PI*2)*(F/16);E.push(p(g.x+29*Math.cos(N),g.y+29*Math.sin(N)))}m.push({points:E,closed:!0,fill:S,ink:S});let I={x:b.x,y:b.y-y},R=[{x:b.x,y:b.y},M,A,w].map(F=>p(I.x+(F.x-I.x)*.84,I.y+(F.y-I.y)*.84));m.push({points:R,closed:!0,fill:v,ink:v}),m.push({points:Zt(h(g.x),d(g.y),h(2.74),d(2.74),20),closed:!0,fill:S,ink:S}),m.push({points:Zt(h(b.x),d(b.y),h(3.96),d(3.96),20),closed:!0,fill:S,ink:S});let _=Jc.fence;m.push({points:[p(b.x,b.y),p(_[0].x,_[0].y)],closed:!1}),m.push({points:[p(b.x,b.y),p(_[_.length-1].x,_[_.length-1].y)],closed:!1});for(let F of[M,A,w])m.push({points:Ht(h(F.x),d(F.y),h(.3),d(.3)),closed:!0,fill:vr});break}case"court-basketball":{m.push({points:Ht(0,0,h(14),d(7.5)),closed:!0}),m.push({points:[{x:0,y:-d(7.5)},{x:0,y:d(7.5)}],closed:!1}),m.push({points:Zt(0,0,h(1.8),d(1.8),24),closed:!0});for(let p of[-1,1]){let b=p*14,x=p*(14-5.8),y=p*(14-1.575);m.push({points:Ht(h((b+x)/2),0,h(2.9),d(2.45)),closed:!0,fill:"#2f5d8a"}),m.push({points:Zt(h(x),0,h(1.8),d(1.8),24),closed:!0});let M=Math.sqrt(6.75*6.75-6.6*6.6),A=[{x:h(b),y:-d(6.6)}],w=Math.atan2(-6.6,-p*M),g=2*Math.atan2(6.6,M);for(let S=0;S<=16;S++){let v=w-p*g*(S/16);A.push({x:h(y+6.75*Math.cos(v)),y:d(6.75*Math.sin(v))})}A.push({x:h(b),y:d(6.6)}),m.push({points:A,closed:!1})}break}case"court-tennis":{m.push({points:Ht(0,0,h(11.885),d(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])m.push({points:[{x:-h(11.885),y:p*d(4.115)},{x:h(11.885),y:p*d(4.115)}],closed:!1}),m.push({points:[{x:p*h(6.4),y:-d(4.115)},{x:p*h(6.4),y:d(4.115)}],closed:!1});m.push({points:[{x:-h(6.4),y:0},{x:h(6.4),y:0}],closed:!1}),m.push({points:[{x:0,y:-d(6.4)},{x:0,y:d(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{m.push({points:Ht(0,0,h(3.05),d(3.05)),closed:!0});let x=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[y,M,A]of x)m.push({points:Ht(y*h(3.05),M*d(3.05),h(.3),d(.3)),closed:!0,fill:A,ink:A});break}default:return[]}return m.map(p=>({...p,points:p.points.map(b=>rb(b.x,b.y,s,c,n,o))}))}function na(e){if(e.role!=="stage"||!Sr(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(u=>u.x),o=e.points.map(u=>u.y),r=Math.min(...n),i=Math.max(...n),a=Math.min(...o),s=Math.max(...o),c=Math.max(1,i-r),l=Math.max(1,s-a);t={cx:r+c/2,cy:a+l/2,width:c,height:l}}return t?ib({kind:e.stageKind,...t}):[]}var Dn=Math.PI*2;function Nn(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function ab(e,t,n){let o=t-e;if(n){for(;o<0;)o+=Dn;for(;o>=Dn;)o-=Dn}else{for(;o>0;)o-=Dn;for(;o<=-Dn;)o+=Dn}return o}function rl(e){if(e.version!==1||e.closed!==!0||!Nn(e.start)||!Array.isArray(e.segments)||e.segments.length<2||e.segments.length>512)return!1;let t=e.start;for(let n of e.segments){if(!n||!Nn(n.end))return!1;if(n.kind==="line"){if(Xe(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!Nn(n.control1)||!Nn(n.control2)||Xe(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!Nn(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(Xe(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(Xe(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Xe(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return Xe(t,e.start)<=1e-4}function sb(e,t,n){let o=1-n;return{x:o**3*e.x+3*o**2*n*t.control1.x+3*o*n**2*t.control2.x+n**3*t.end.x,y:o**3*e.y+3*o**2*n*t.control1.y+3*o*n**2*t.control2.y+n**3*t.end.y}}function il(e,t=2){if(!rl(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),o=[{...e.start}],r=e.start;for(let i of e.segments){if(i.kind==="line")o.push({...i.end});else if(i.kind==="arc"){let a=Math.atan2(r.y-i.center.y,r.x-i.center.x),s=Math.atan2(i.end.y-i.center.y,i.end.x-i.center.x),c=ab(a,s,i.clockwise),l=Math.max(2,Math.ceil(Math.abs(c)*i.radius/n));for(let u=1;u<=l;u+=1){let m=a+c*u/l;o.push({x:i.center.x+Math.cos(m)*i.radius,y:i.center.y+Math.sin(m)*i.radius})}}else{let a=Xe(r,i.control1)+Xe(i.control1,i.control2)+Xe(i.control2,i.end),s=Math.max(2,Math.ceil(a/n));for(let c=1;c<=s;c+=1)o.push(sb(r,i,c/s))}r=i.end}return Xe(o[o.length-1],o[0])<=1e-4&&o.pop(),o}var cb=45,oa=150,lb=60;function ub(e){let t=cb/100;if(e<=t)return oa;let n=Math.min(1,(e-t)/(1-t));return oa-n*(oa-lb)}var nl=.5523;function ol(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function mb(e){let t=[],n=[];for(e.forEach((o,r)=>{Nn(o)&&(t.length&&ol(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&ol(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}var fb=.5,hb=4/3;function db(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<=1e-9)return{kind:"line",end:{...t}};let a=-r/i,s=o/i,c=n*hb;return{kind:"bezier",control1:{x:e.x+o/3+a*c,y:e.y+r/3+s*c},control2:{x:e.x+o*2/3+a*c,y:e.y+r*2/3+s*c},end:{...t}}}function al(e,t){let{points:n,sourceIndex:o}=mb(e),r=n.length;if(r<3)return null;let i=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,a=t.edgeCurvature,s=new Array(r).fill(0);if(a?.length)for(let A=0;A<r;A+=1){let w=a[o[A]];s[A]=Number.isFinite(w)?Math.min(100,Math.max(-100,w))/100:0}let c=s.some(A=>Math.abs(A)>1e-6);if(i<=0&&!c)return null;let l=t.wideAngleThresholdDeg??ub(i),u=[];for(let A=0;A<r;A+=1)u[A]=Xe(n[A],n[(A+1)%r]);let m=new Array(r).fill(0);for(let A=0;A<r;A+=1){let w=n[(A-1+r)%r],g=n[A],S=n[(A+1)%r],v={x:w.x-g.x,y:w.y-g.y},P={x:S.x-g.x,y:S.y-g.y},E=Math.hypot(v.x,v.y),k=Math.hypot(P.x,P.y);if(E<=1e-9||k<=1e-9)continue;let L=Math.min(1,Math.max(-1,(v.x*P.x+v.y*P.y)/(E*k))),I=Math.acos(L)*180/Math.PI;if(I<l)continue;let R=Rc((I-l)/(180-l));m[A]=i*R*.5*Math.min(E,k)}for(let A=0;A<r;A+=1){let w=(A+1)%r,g=m[A]+m[w];if(g>u[A]&&g>1e-9){let S=u[A]/g;m[A]*=S,m[w]*=S}}let f=new Array(r),h=new Array(r);for(let A=0;A<r;A+=1){let w=n[(A-1+r)%r],g=n[A],S=n[(A+1)%r];if(m[A]<=1e-6){f[A]={...g},h[A]={...g};continue}let v=Xe(g,w)||1,P=Xe(g,S)||1;f[A]={x:g.x+(w.x-g.x)/v*m[A],y:g.y+(w.y-g.y)/v*m[A]},h[A]={x:g.x+(S.x-g.x)/P*m[A],y:g.y+(S.y-g.y)/P*m[A]}}if(m.every(A=>A<=1e-6)&&!c)return null;let d=[],p={...h[0]},b=p,x=(A,w)=>{if(Xe(b,A)<=1e-9)return;let g=s[w];Math.abs(g)>1e-6?d.push(db(b,A,g*fb*u[w])):d.push({kind:"line",end:{...A}}),b=A};for(let A=1;A<=r;A+=1){let w=A%r,g=n[w];x(f[w],(A-1)%r),m[w]>1e-6&&Xe(f[w],h[w])>1e-9&&(d.push({kind:"bezier",control1:$i(f[w],g,nl),control2:$i(h[w],g,nl),end:{...h[w]}}),b=h[w])}if(!d.length)return null;let y=d[d.length-1];Xe(y.end,p)>1e-9&&(y.kind==="line"?y.end={...p}:d.push({kind:"line",end:{...p}}));let M={version:1,closed:!0,start:p,segments:d};return rl(M)?M:null}function sl(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+a*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+a*e.end.y}}function cl(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[sl(e,.5)];let o=Array.from({length:n+1},(c,l)=>sl(e,l/n)),r=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let l=o[c].x-o[c-1].x,u=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(l,u)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let l=i*c/(t-1);for(;s<r.length-1&&r[s]<l;)s+=1;let u=r[s-1],m=r[s],f=m===u?0:(l-u)/(m-u);a.push({x:o[s-1].x+(o[s].x-o[s-1].x)*f,y:o[s-1].y+(o[s].y-o[s-1].y)*f})}return a}function ll(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((f,h)=>f.segmentedRow.componentIndex-h.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((f,h)=>f.segmentedRow?.kind==="segmented-row-v1"&&f.segmentedRow.groupId===o&&f.segmentedRow.componentCount===a&&f.segmentedRow.componentIndex===h&&f.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(h===0?f.segmentedRow.boundaryBefore==="start":f.segmentedRow.boundaryBefore!=="start")&&f.segmentedRow.displayLabel===s.displayLabel)))continue;let l=i.reduce((f,h)=>f+h.seatCount,0),u=0,m=0;for(let f of i)f.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(f.id,{groupId:o,adjacencyOffset:u,displayOffset:m,displayLabel:s.displayLabel,totalSeats:l,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),u+=f.seatCount,m+=f.seatCount}return t}var pb="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var bb="abcdefghijklmnopqrstuvwxyz";function yb(e,t){let n=t.length,o=e+1,r="";for(;o>0;){o-=1;let i=o%n;r=t[i]+r,o=Math.floor(o/n)}return r}function wo(e,t=!1){let n=t?bb:pb;return yb(Math.max(0,Math.floor(e)-1),n)}var gb=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function ul(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of gb)for(;t>=o;)n+=r,t-=o;return n}function xb(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function ra(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let h=Math.ceil(c/2),d=i==="updown"?t<h?n+2*t:n-1+2*(c-t):t<h?n+2*(h-1-t):n+1+2*(t-h);return`${a}${d}`}let l=i==="odd"||i==="even"?2:r,u=s!=null&&Number.isFinite(s)?s-(c-1)*l:n,m=o==="center"?xb(c)[t]:o==="rtl"?c-1-t:t,f;switch(i){case"odd":{let h=u%2===1?u:u+1;f=String(h+m*2);break}case"even":{let h=u%2===0?u:u+1;f=String(h+m*2);break}case"roman":f=ul(u+m*r);break;case"letters-upper":f=wo(u+m*r,!1);break;case"letters-lower":f=wo(u+m*r,!0);break;default:f=String(u+m*r);break}return`${a}${f}`}function Mb(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function ml(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${ra(e,t)}`}function vb(e,t,n,o){if(o?.displayLabel)return null;if(e.seatDisplayLabelMode==="number"||!n)return{row:e.displayLabel||e.label,seat:ra(e,t)};let r=Mb(n);return{row:n.displayLabel,seat:ra(r,n.displayOffset+t)}}function ia(e,t,n,o){let r=vb(e,t,n,o);return r?e.seatDisplayLabelMode==="number"?r.seat:`${r.row}-${r.seat}`:o.displayLabel}function fl(e,t){return`${e.label}-${t+1}`}function Sb(e,t,n){return e?.direction==="anticlockwise"?Math.max(0,t-1-n):n}function wb(e,t){let n=e.chairNumbering,o=n?.start??1,r=Sb(n,Math.max(0,Math.round(e.seatCount)),t);return n?.format==="letter"?wo(Math.max(1,o)+r):String(o+r)}function hl(e,t){let n=wb(e,t);return(e.chairNumbering?.format??"table-number")==="table-number"?`${e.displayLabel??e.label}-${n}`:n}function dl(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 Bn(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 o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],a=e[r+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 m=t-(i.x+u*s),f=n-(i.y+u*c);if(Math.abs(m)>=o||Math.abs(f)>=o)continue;let h=Math.hypot(m,f);h<o&&(o=h)}return o}function Pb(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;t/=o,n/=o;let r=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>r&&(r=a)}return{cx:t,cy:n,r}}function pl(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function aa(e,t){let n=1/0;for(let o of dl(e)){let r=Bn(t,o.x,o.y);r<n&&(n=r)}for(let o of dl(t)){let r=Bn(e,o.x,o.y);r<n&&(n=r)}return n}function Ab(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let u of e)n+=u.x,o+=u.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let u of e){let m=Math.hypot(u.x-n,u.y-o);m>r&&(r=m,i=u)}let a=i.x-n,s=i.y-o,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((u,m)=>({p:u,i:m,t:(u.x-n)*a+(u.y-o)*s})).sort((u,m)=>u.t-m.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function sa(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let y of e)n+=y.x,o+=y.y;n/=t,o/=t;let r=0,i=0,a=0,s=0,c=0,l=0,u=0;for(let y of e){let M=y.x-n,A=y.y-o;r+=M*M,a+=A*A,i+=M*A,s+=M*M*M,c+=A*A*A,l+=M*A*A,u+=A*M*M}let m=r*a-i*i;if(Math.abs(m)<1e-9)return null;let f=(s+l)/2,h=(c+u)/2,d=(f*a-h*i)/m,p=(h*r-f*i)/m,b=d+n,x=p+o;return!Number.isFinite(b)||!Number.isFinite(x)?null:{cx:b,cy:x}}var Rb=.15,Eb=.001;function Ib(e){let t=e[0],n=e[e.length-1],o=n.x-t.x,r=n.y-t.y,i=Math.hypot(o,r);if(!(i>1e-9))return 0;let a=0;for(let s of e){let c=Math.abs((s.x-t.x)*r-(s.y-t.y)*o)/i;c>a&&(a=c)}return a/i}function _b(e){if(e.length<2)return null;let t=e.map(w=>{let g=0,S=0;for(let v of w.pts)g+=v.x,S+=v.y;return{x:g/w.pts.length,y:S/w.pts.length}}),n=0,o=0;for(let w of t)n+=w.x,o+=w.y;n/=t.length,o/=t.length;let r=0,i=0,a=0;for(let w of t){let g=w.x-n,S=w.y-o;r+=g*g,i+=g*S,a+=S*S}let s=r+a,c=r*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,m;Math.abs(i)>1e-12?(u=l-a,m=i):r>=a?(u=1,m=0):(u=0,m=1);let f=Math.hypot(u,m);if(!(f>1e-12))return null;u/=f,m/=f;let h=0,d=0,p=0;for(let w of e){if(w.pts.length<2)continue;let g=w.pts[0],S=w.pts[w.pts.length-1],v=S.x-g.x,P=S.y-g.y,E=Math.hypot(v,P);if(!(E>1e-9))continue;let k=v/E,L=P/E;h+=(k*k-L*L)*E,d+=2*k*L*E,p+=E}if(p>0&&Math.hypot(h,d)>=Tb*p){let w=Math.atan2(d,h)/2;u=-Math.sin(w),m=Math.cos(w)}let b=1/0,x=-1/0,y=[];for(let w of e){let g=1/0,S=-1/0;for(let v of w.pts){let P=v.x*u+v.y*m;P<g&&(g=P),P>S&&(S=P),P<b&&(b=P),P>x&&(x=P)}y.push(S-g)}let M=x-b;return M>1e-9?(y.sort((w,g)=>w-g),y[Math.min(y.length-1,Math.floor(y.length*.9))]/M<=Cb?{x:u,y:m}:null):null}var Cb=.35,Tb=.8;function wr(e,t,n,o){let r=new Map;for(let g of n){let S=t[g],v=S.rowId||`__seat-${g}`,P=r.get(v);P||(P={pts:[],idx:[]},r.set(v,P)),P.pts.push({x:S.x,y:S.y}),P.idx.push(g)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[g,S]of r){let v=Ab(S.pts,S.idx),P=0;for(let E of v.pts)P+=Math.hypot(E.x-o.x,E.y-o.y);i.push({id:g,pts:v.pts,seatIndices:v.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:P/v.pts.length})}let a=i.map(g=>Pb(g.pts)),s=i.length<=256?i.length*(i.length-1)/2:0,c=s?new Float64Array(s):null;c?.fill(Number.NaN);let l=c?new Map(i.map((g,S)=>[g,S])):null,u=(g,S)=>(g>S&&([g,S]=[S,g]),g*(2*i.length-g-1)/2+(S-g-1)),m=(g,S)=>{if(!c)return aa(i[g].pts,i[S].pts);let v=u(g,S),P=c[v];if(!Number.isNaN(P))return P;let E=aa(i[g].pts,i[S].pts);return c[v]=E,E},f=(g,S)=>l?m(l.get(g),l.get(S)):aa(g.pts,S.pts),h=[];for(let g=0;g<i.length;g++){let S=1/0;for(let v=0;v<i.length;v++){if(g===v||pl(a[g],a[v])>=S)continue;let P=m(g,v);P<S&&(S=P)}Number.isFinite(S)&&h.push(S)}h.sort((g,S)=>g-S);let d=h.length?h[Math.floor(h.length/2)]:1,p=Math.max(d*1.8,1e-6),b=i.map(()=>[]);for(let g=0;g<i.length;g++)for(let S=g+1;S<i.length;S++)pl(a[g],a[S])>p||m(g,S)<=p&&(b[g].push(S),b[S].push(g));let x=0;for(let g=0;g<i.length;g++){if(i[g].blockId!==-1)continue;let S=x++,v=[g];for(i[g].blockId=S;v.length;){let P=v.pop();for(let E of b[P])i[E].blockId===-1&&(i[E].blockId=S,v.push(E))}}let y=new Map;for(let g of i){let S=y.get(g.blockId)??[];S.push(g),y.set(g.blockId,S)}let M=[];for(let g of i){if(g.pts.length<4||Ib(g.pts)<Eb)continue;let S=sa(g.pts);S&&(!Number.isFinite(S.cx)||!Number.isFinite(S.cy)||M.push({x:S.cx,y:S.cy}))}let A=M.length>=2?(()=>{let g=M.map(P=>P.x).sort((P,E)=>P-E),S=M.map(P=>P.y).sort((P,E)=>P-E),v=Math.floor(M.length/2);return{cx:g[v],cy:S[v]}})():null;if(A){let g=L=>Math.hypot(L.x-A.cx,L.y-A.cy),S=1/0,v=-1/0,P=[];for(let L of i){let I=1/0,R=-1/0;for(let _ of L.pts){let F=g(_);F<I&&(I=F),F>R&&(R=F)}P.push(R-I),I<S&&(S=I),R>v&&(v=R)}let E=v-S;P.sort((L,I)=>L-I);let k=P[Math.min(P.length-1,Math.floor(P.length*.9))];if(E>1e-9&&k/E<=Rb){let L=i.map(T=>{let D=0;for(let W of T.pts)D+=g(W);return{row:T,radius:D/T.pts.length}}),I=0,R=0;for(let T of L)I+=T.radius,R+=T.row.focalDistance;I/=L.length,R/=L.length;let _=0;for(let T of L)_+=(T.radius-I)*(T.row.focalDistance-R);if(_<0)for(let T of L)T.radius=-T.radius;let N=1/0;for(let T of L)T.radius<N&&(N=T.radius);L.sort((T,D)=>T.radius-D.radius);let O=-1,V=-1/0,z=E/Math.max(1,L.length)*.5,G=[];for(let T of L)T.radius-V>z&&(O++,V=T.radius),T.row.ordinal=O,T.row.blockDepth=T.radius-N,G.push(T.row);return{sectionId:e,rows:G,blockCount:x}}}let w=[];for(let[,g]of y){let S=_b(g);if(S){let v=L=>{let I=0;for(let R of L.pts)I+=R.x*S.x+R.y*S.y;return I/L.pts.length};g.sort((L,I)=>v(L)-v(I)),g.length>=2&&g[0].focalDistance>g[g.length-1].focalDistance&&g.reverse();let P=[],E=d*.5;for(let L of g){let I=P[P.length-1];I&&Math.abs(v(L)-v(I[0]))<E?I.push(L):P.push([L])}let k=0;for(let L=0;L<P.length;L++){if(L>0){let I=1/0;for(let R of P[L-1])for(let _ of P[L])I=Math.min(I,f(R,_));I=Math.min(I,Math.abs(v(P[L][0])-v(P[L-1][0]))),k+=I}for(let I of P[L])I.ordinal=L,I.blockDepth=k,w.push(I)}}else{let v=1/0;for(let P of g)P.focalDistance<v&&(v=P.focalDistance);g.sort((P,E)=>P.focalDistance-E.focalDistance);for(let P=0;P<g.length;P++)g[P].ordinal=P,g[P].blockDepth=Math.max(0,g[P].focalDistance-v),w.push(g[P])}}return{sectionId:e,rows:w,blockCount:x}}var Lb=/^\d{4}-\d{2}-\d{2}$/;function kb(e){let t=Date.parse(e);return Number.isFinite(t)?Lb.test(e)?t+864e5:t:null}function Ob(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let o=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(o)&&(t instanceof Date?t.getTime():t)<=o+366*864e5}let n=kb(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Fb(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Db(e){return e.status!=="draft"&&e.status!=="retracted"}function Nb(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function bl(e,t={}){return!!e&&Db(e)&&Fb(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Nb(e,t.activeBasisSha256)&&Ob(e,t.now)}var Bb=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Vb=/[\s"'<>`\\]/;function Gb(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Bb.test(e);if(Vb.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function yl(e){let t=e.trim();return Gb(t)?t:null}var ca="seatlayer.event-configuration/1";var Vn=100,Hb=120,zb=2e5,Ub=1e4,jb=/^[a-f0-9]{64}$/,Wb=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Po(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function gn(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Xb(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function gl(e){return!Array.isArray(e)||e.length>zb||!e.every(t=>gn(t,Vn))?null:[...new Set(e)].sort()}function Kb(e){return!Po(e)||!gn(e.chartId,Vn)||!gn(e.version,Vn)||e.sha256!==void 0&&(typeof e.sha256!="string"||!jb.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function la(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Yb(e){return Po(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&la(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function $b(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Ub)return null;let n=new Set(t),o=new Set,r=new Set,i=0,a=[];for(let s of e){if(!Po(s)||!gn(s.id,Vn)||!gn(s.objectId,Vn)||!n.has(s.objectId)||!Wb.has(String(s.kind))||!la(s.heightM,.05,50)||s.baseElevationM!==void 0&&!la(s.baseElevationM,-10,100))return null;let c=Yb(s.occlusion);if(!c||o.has(s.id)||r.has(s.objectId))return null;let l=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?yl(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!l||s.kind!=="screen"||++i>1))return null;o.add(s.id),r.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function Zb(e){let t=[];if(!Po(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==ca&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${ca}`}),gn(e.id,Vn)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),gn(e.label,Hb)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Xb(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Kb(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 o=Po(e.overlay)?e.overlay:null,r=gl(o?.objectIds),i=gl(o?.productionKillSeatIds),a=r?$b(o?.productionElements,r):null;return(!o||!r||!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||!r||!i||a===null?{issues:t}:{issues:t,value:{schema:ca,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function xl(e){let t=Zb(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function qb(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?Pr(e,6):e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,o=e.width,r=e.height;return[{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+r},{x:t,y:n+r}]}function Qb(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),i=Math.sin(o),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*r-s*i,y:t.y+a*i+s*r}}function Ml(e){let t=qb(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>Qb(c,{x:t.reduce((l,u)=>l+u.x,0)/t.length,y:t.reduce((l,u)=>l+u.y,0)/t.length},n)),r=1/0,i=1/0,a=-1/0,s=-1/0;for(let c of o)r=Math.min(r,c.x),i=Math.min(i,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(r)||a-r<1e-6||s-i<1e-6?null:{minX:r,minY:i,maxX:a,maxY:s}}var Jb=5,e0=3,t0=.92,n0=1.9,o0=2,r0=.6,i0=1,a0=.06;function s0(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?ta:Sr(e.stageKind)?a0:i0}function vl(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let a of Pl(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let l=Ml(c);l&&(t=Math.min(t,l.minX),n=Math.min(n,l.minY),o=Math.max(o,l.maxX),r=Math.max(r,l.maxY),i=Math.max(i,s+s0(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function c0(e,t,n,o){let r=1/0,i=1/0,a=-1/0,s=-1/0;for(let h of e)Number.isFinite(h.eyeHeightM)&&(r=Math.min(r,h.x),a=Math.max(a,h.x),i=Math.min(i,h.y),s=Math.max(s,h.y));if(!Number.isFinite(r))return null;let c=r*t,l=i*t,u=Math.max(1,Math.ceil((a-r)*t/n)+1),m=Math.max(1,Math.ceil((s-i)*t/n)+1),f=new Float64Array(u*m).fill(-1/0);for(let h of e){if(!Number.isFinite(h.eyeHeightM))continue;let d=h.eyeHeightM-_t,p=Math.min(u-1,Math.max(0,Math.floor((h.x*t-c)/n))),x=Math.min(m-1,Math.max(0,Math.floor((h.y*t-l)/n)))*u+p,y=d+o;y>f[x]&&(f[x]=y)}return{cellM:n,minX:c,minY:l,cols:u,rows:m,top:f}}function l0(e,t,n){let o=Math.floor((t-e.minX)/e.cellM),r=Math.floor((n-e.minY)/e.cellM);return o<0||r<0||o>=e.cols||r>=e.rows?-1/0:e.top[r*e.cols+o]}function Sl(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??he,i=n.cellM??r0,a=n.chairBackM??t0,s=n.selfRowSkipM??o0,c=n.clearThreshold??.9,l=n.partialThreshold??.25,u=Math.max(1,n.columns??Jb),m=Math.max(1,n.rows??e0),f=c0(e,r,i,a);if(!f)return o;let h=(t.maxX-t.minX)*r,d=(t.maxY-t.minY)*r,p=h>=d,b=(t.minX+t.maxX)/2*r,x=(t.minY+t.maxY)/2*r,y=[];for(let A=0;A<u;A++){let w=(A+.5)/u-.5,g=p?b+w*h:b,S=p?x:x+w*d;for(let v=0;v<m;v++){let P=t.deckTopM+(m===1?0:v/(m-1)*n0);y.push({x:g,y:S,z:P})}}let M=i/2;for(let A of e){if(!Number.isFinite(A.eyeHeightM))continue;let w=A.x*r,g=A.y*r,S=A.eyeHeightM,v=0,P=1/0;for(let k of y){let L=k.x-w,I=k.y-g,R=Math.hypot(L,I);if(!(R>s)){v++;continue}let _=L/R,F=I/R,N=0;for(let O=s;O<R;O+=M){let V=l0(f,w+_*O,g+F*O);if(!(!Number.isFinite(V)||V>=S)&&V>S+(k.z-S)*O/R){N=O;break}}N?P=Math.min(P,N):v++}let E=v/y.length;E>=c||o.set(A.id,{seatId:A.id,mark:E<l?"obstructedView":"restrictedView",visibleFraction:E,totalRays:y.length,atDistanceM:Number.isFinite(P)?P:0})}return o}function wl(e,t){if(!t.size)return 0;let n=0;for(let o of e){let r=t.get(o.id);if(!r)continue;let i=o.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(o.commercial={...i,[r.mark]:!0},n++)}return n}function ua(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var Rr=Math.PI/180;var Ao=16;function ma(e,t,n,o){let r=n*Rr,i=Math.cos(r),a=Math.sin(r);return{x:o.x+e*i-t*a,y:o.y+e*a+t*i}}function ha(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,a=[];if(e.path)return cl(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(o===0){for(let l=0;l<t;l++)a.push(ma(l*n,0,r,i));return a}let s=o/(t-1)*Rr,c=n/(2*Math.sin(Math.abs(s)/2));for(let l=0;l<t;l++){let u=l*s,m=c*Math.sin(u),f=-c+c*Math.cos(u);a.push(ma(m,f,r,i))}return a}function da(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function u0(e,t){let n=da(e);return ha(e).map((o,r)=>{let i=n.get(r),a=ua(i),s=ml(e,r,i),c={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:s,displayLabel:ia(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(l=>l!==void 0&&l!==!1&&l!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function m0(e){let t=[];for(let n of u0(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function f0(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let r=Math.max(0,Math.round(e.seatCount));for(let i=0;i<r;i++)o[n[i%n.length]]+=1;return o}function h0(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(u=>[u.index,u])),r=(u,m,f,h)=>{let d=o.get(u),p=ua(d),b=d?.label??fl(e,u);return{index:u,label:b,displayLabel:d?.displayLabel??hl(e,u),x:m+(d?.dx??0),y:f+(d?.dy??0),categoryKey:d?.categoryKey??e.categoryKey,skipped:!!d?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:d?.wheelchairSpaceType,commercial:d?.commercial,glyph:d?.glyph,viewUrl:d?.viewFromSeatUrl,viewMeta:d?.viewFromSeatUrl?d.viewFromSeatMeta:void 0,labelStyle:d?.labelStyle,...h?{side:h}:{}}};if(e.shape==="round"){let u=(e.radius??40)+Ao,m=e.rotation*Rr,f=Math.max(0,Math.min(360,e.seatArc??360));if(f>=360||n===1){for(let b=0;b<n;b++){let x=m+b/n*2*Math.PI;t.push(r(b,e.center.x+u*Math.cos(x),e.center.y+u*Math.sin(x)))}return t}let h=f*Rr,d=(2*Math.PI-h)/2,p=m+d;for(let b=0;b<n;b++){let x=p+b/(n-1)*h;t.push(r(b,e.center.x+u*Math.cos(x),e.center.y+u*Math.sin(x)))}return t}let i=e.width??80,a=e.height??50,s=f0(e),c=["top","bottom","left","right"],l=0;for(let u of c){let m=s[u];for(let f=0;f<m;f++){let h,d;u==="top"?(h=-i/2+(f+.5)*i/m,d=-a/2-Ao):u==="bottom"?(h=-i/2+(f+.5)*i/m,d=a/2+Ao):u==="left"?(h=-i/2-Ao,d=-a/2+(f+.5)*a/m):(h=i/2+Ao,d=-a/2+(f+.5)*a/m);let p=ma(h,d,e.rotation,e.center);t.push(r(l++,p.x,p.y,u))}}return t}function d0(e){return h0(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function p0(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth",...e.commercial?.note?{commercial:{note:e.commercial.note}}:{}}]}function fa(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,a=t[o].y,s=t[r].x,c=t[r].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function Il(e,t){return t.some((n,o)=>{let r=t[(o+1)%t.length],i=(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),s=(r.x-n.x)**2+(r.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function Ro(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Ke(e,t,n){return fa(e,t)&&!Ro(n).some(o=>fa(e,o)||Il(e,o))}function Ar(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function _l(e){switch(e.type){case"row":{let t=ha(e),n=da(e),o=0,r=0,i=0;for(let a=0;a<t.length;a++){let s=n.get(a);s?.skip||(o+=t[a].x+(s?.dx??0),r+=t[a].y+(s?.dy??0),i++)}return i?{x:o/i,y:r/i}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return Ar(e.points);case"section":return Ar(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?Ar(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function Al(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function b0(e,t){if(e.type!=="gaArea"||!Al(e.points,t.outline))return!1;let n=Ro(e.holes),o=Ro(t.holes);return n.length===o.length&&n.every((r,i)=>Al(r,o[i]))}function y0(e,t,n=e.filter(r=>r.type==="section"),o=_l(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(b0(t,a)||Ke(o,a.outline,a.holes))):void 0)??n.find(a=>Ke(o,a.outline,a.holes))??(t.type==="row"&&g0(t)?x0(t,n):void 0)}function g0(e){return(e.overrides??[]).some(t=>t.skip===!0)}function x0(e,t){let n=ha(e),o=da(e),r,i=0;for(let a of t){let s=0;for(let c=0;c<n.length;c++){let l=o.get(c);if(l?.skip)continue;let u={x:n[c].x+(l?.dx??0),y:n[c].y+(l?.dy??0)};Ke(u,a.outline,a.holes)&&s++}s>i&&(r=a,i=s)}return r}function Pl(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function Rl(e,t,n,o,r,i,a,s,c){let l=[],u=e.filter(p=>p.type==="section"),m=ll(e),f=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),h=p=>bl(p,{activeConfigurationId:o,activeConfigurationVersion:c,activeBasisSha256:r,now:s}),d=(p,b)=>h(p)?{...p,coverage:b}:void 0;for(let p of e){let b=[];if(p.type==="row"?b=m0(p):p.type==="table"?b=d0(p):p.type==="booth"&&(b=p0(p)),!b.length)continue;for(let w of b)w.viewUrl&&!f(w.viewMeta)&&(w.viewUrl=void 0,w.viewMeta=void 0);if(p.type==="row"){let w=m.get(p.id);if(w){let g=new Map((p.overrides??[]).map(S=>[S.index,S]));for(let S of b){let v=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(v))continue;S.logicalRowId=w.groupId,S.logicalSeatIndex=w.adjacencyOffset+v,g.get(v)?.displayLabel||(S.displayLabel=ia(p,v,w)),!S.viewUrl&&w.viewFromSeatUrl&&f(w.viewFromSeatMeta)&&(S.viewUrl=w.viewFromSeatUrl,S.viewMeta=w.viewFromSeatMeta);let P=g.get(v)?.confidenceEvidence;S.confidenceEvidence=d(P,"exact-seat")??d(p.confidenceEvidence,"row-representative")??d(w.confidenceEvidence,"row-representative")}}}let x=y0(e,p,u,p.type==="row"?Ar(b):_l(p)),y=x?.viewFromSeatUrl,A=(x?.zone?t?.find(w=>w.id===x.zone):void 0)?.focalPoint??n;for(let w of b){if(!w.confidenceEvidence){let g=Number(w.id.slice(w.id.lastIndexOf(":")+1)),S=(p.type==="row"||p.type==="table")&&Number.isInteger(g)?p.overrides?.find(v=>v.index===g)?.confidenceEvidence:void 0;w.confidenceEvidence=d(S,"exact-seat")??(p.type==="row"?d(p.confidenceEvidence,"row-representative"):void 0)}w.confidenceEvidence??=d(x?.confidenceEvidence,"section-representative")??(a?d(a.evidence,a.coverage):void 0),!w.viewUrl&&y&&f(x?.viewFromSeatMeta)&&(w.viewUrl=y,w.viewMeta=x?.viewFromSeatMeta),!w.viewUrl&&i&&f(i.meta)&&(w.viewUrl=i.url,w.viewMeta=i.meta),x&&(w.sectionId=x.logicalSectionId??x.id),x?.zone&&(w.zoneId=x.zone),A&&(w.focalPoint={...A})}l.push(...b)}return l}function Gn(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,a=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=Rl(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&El(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,c);for(let l of c)l.floorId=r.id;for(let l of c)o.push(l)}return o}let n=Rl(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&El(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),M0(e,n,t)}function M0(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||wl(t,Sl(t,vl(e))),t}function El(e,t,n,o){let r=e.filter(m=>m.type==="section"),i=n>0||r.some(m=>m.height!==void 0||m.rake!==void 0||(m.elevation??0)>0);if(!r.length||!i||!t){for(let m of o)m.eyeHeightM=n+_t;return}let a=new Array(o.length),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,m);let c=new Map,l=new Map;for(let m=0;m<o.length;m++){let f=o[m],d=(f.sectionId?s.get(f.sectionId)??r.find(b=>b.logicalSectionId===f.sectionId&&Ke({x:f.x,y:f.y},b.outline,b.holes)):void 0)??r.find(b=>Ke({x:f.x,y:f.y},b.outline,b.holes))??null;if(a[m]=d,!d)continue;c.has(d.id)||c.set(d.id,$t(d,{floorBaseHeightM:n}));let p=l.get(d.id);p?p.push(m):l.set(d.id,[m])}let u=new Array(o.length).fill(void 0);for(let[m,f]of l){let h=c.get(m);if(!h)continue;let d=h.rake>0?Math.tan(h.rake*Math.PI/180):0,p=wr(m,o,f,t);for(let b of p.rows){let x=b.blockDepth*he*d,y=h.height+x;for(let M of b.seatIndices)u[M]=y}}for(let m=0;m<o.length;m++){let f=o[m],h=a[m];if(!h){f.eyeHeightM=n+_t;continue}let d=c.get(h.id);f.eyeHeightM=(u[m]??d.height)+_t}}function v0(e){let t=e.points??[];if(e.kind!=="polygon"||t.length<3||!Array.isArray(e.edgeCurvature))return[];let n=t.map((o,r)=>{let i=e.edgeCurvature[r];return Number.isFinite(i)?Math.min(100,Math.max(-100,i)):0});return n.some(o=>Math.abs(o)>.5)?n:[]}function S0(e){let t=v0(e);return t.length?al(e.points,{edgeCurvature:t}):null}function Pr(e,t=2){let n=S0(e);return n?il(n,t):e.points??[]}function Cl(e){return e.kind==="polygon"?Ro(e.holes):[]}function Tl(e){let t=1/0,n=1/0,o=-1/0,r=-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>o&&(o=a.x),a.y>r&&(r=a.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function Hn(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Ql=Et(require("polygon-clipping"),1);var oe={top:1,wallBottom:.58,bottomCap:.4};function xn(e,t){if(!e)return t;let n=re(It(e,.4),.62);return Se(t,n,.22)}function Ll(e,t){return e?Se(t,re(It(e,.25),.74),.62):t}function kl(e,t){let n=hn(Vt({tierTop:t}));return e?fn(e,n.sectionDeck,Math.min(n.sectionDeckChromaShare*fo(e),n.sectionDeckChromaCap)):fn(t,n.deck,Math.min(fo(t),lr))}function Ol(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let o=new Map;for(let i of t){if(!i.sectionId)continue;let a=o.get(i.sectionId);a||(a=new Map,o.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,a]of o){let s=0,c=0,l=0,u=0;for(let[m,f]of a){let h=ve(n.get(m));h&&(s+=h[0]*f,c+=h[1]*f,l+=h[2]*f,u+=f)}u>0&&r.set(i,[s/u,c/u,l/u])}return r}function Fl(e,t){return ve(e.color)??t.get(e.logicalSectionId??e.id)??null}var ga=Et(require("polygon-clipping"),1);var ya=Et(require("polygon-clipping"),1);var Dl=e=>Math.round(e*1e6)/1e6+0;function zn(e){let t=e.map(r=>({x:Dl(r.x),y:Dl(r.y)})).sort((r,i)=>r.x-i.x||r.y-i.y).filter((r,i,a)=>i===0||r.x!==a[i-1].x||r.y!==a[i-1].y);if(t.length<3)return t;let n=(r,i,a)=>{let s=i.x-r.x,c=i.y-r.y,l=a.x-r.x,u=a.y-r.y;return s*u-c*l>1e-6*Math.hypot(s,c)*Math.hypot(l,u)},o=r=>{let i=[];for(let a of r){for(;i.length>=2&&!n(i[i.length-2],i[i.length-1],a);)i.pop();i.push(a)}return i.pop(),i};return[...o(t),...o([...t].reverse())]}var Gl=Et(require("earcut"),1);var w0=.58,Nl=.01,yt=Gt*1.5*pt,P0=.5,A0=.6;function R0(e,t){let n=e.length,o=[];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,m=Math.hypot(l,u);if(m<1e-9){o.push([0,0]);continue}l/=m,u/=m,o.push([-u,l])}let r=0;for(let a=0;a<n;a++)r+=(e[a].x-t.x)*o[a][0]+(e[a].y-t.y)*o[a][1];return r<0?o.map(([a,s])=>[-a,-s]):o}function E0(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(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}},r=o(n[1],n[0]),i=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+r.x*t,y:n[0].y+r.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Bl=Math.PI/12;function I0(e){if(e.length<3)return[...e];let t=zn(e);return t.length>=3?t:[...e]}function Hl(e,t){if(!e.length||!(t>0))return[];let n=I0(e),o=(s,c,l,u)=>{let m=l-c;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let f=Math.max(1,Math.ceil(m/Bl)),h=t/Math.cos(m/f/2);for(let d=0;d<=f;d++){let p=c+m*d/f;u.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(n.length<3){let s=0,c=0;for(let h of n)s+=h.x,c+=h.y;s/=n.length||1,c/=n.length||1;let l=0;for(let h of n)l=Math.max(l,Math.hypot(h.x-s,h.y-c));let u=[],m=Math.max(3,Math.ceil(Math.PI*2/Bl)),f=(l+t)/Math.cos(Math.PI/m);for(let h=0;h<m;h++){let d=h/m*Math.PI*2;u.push({x:s+Math.cos(d)*f,y:c+Math.sin(d)*f})}return u}let r=n.length,i=[];for(let s=0;s<r;s++){let c=n[s],l=n[(s+1)%r];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<r;s++)o(n[s],i[(s+r-1)%r],i[s],a);return Xl(a)}function _0(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],a=e[r+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 m=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));m<o&&(o=m)}return o}function Er(e){let t=e.map(r=>{let i=0,a=0;for(let l of r.pts)i+=l.x,a+=l.y;let s=r.pts.length||1;i/=s,a/=s;let c=0;for(let l of r.pts){let u=Math.hypot(l.x-i,l.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),n=r=>{let i=r.length;return i<=2?[...r]:[r[Math.floor(i*.25)],r[Math.floor(i*.5)],r[Math.floor(i*.75)]]},o=[];for(let r=0;r<e.length;r++){let i=n(e[r].pts),a=[],s=1/0,c=null;for(let u of i){let m=1/0;for(let f=0;f<e.length;f++){if(f===r||Math.abs(e[f].y-e[r].y)<.001)continue;let h=t[f],d=Math.hypot(u.x-h.cx,u.y-h.cy)-h.rad;if(d>=m&&d>=s)continue;let p=_0(e[f].pts,u.x,u.y);p<m&&(m=p),e[f].depth<e[r].depth&&p<s&&(s=p,c=e[f].y)}Number.isFinite(m)&&m>0&&a.push(m)}a.sort((u,m)=>u-m);let l=a.length?a[Math.floor(a.length/2)]:1;o.push({pitch:l,belowY:c})}return o}function zl(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let u=r.pts[0],m=u.x-o.x,f=u.y-o.y,h=Math.hypot(m,f)||1;m/=h,f/=h;let d=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+f*d,y:u.y-m*d},{x:u.x-f*d,y:u.y+m*d}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let m=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);m>1e-6&&(a+=m,s++)}let c=s>0?a/s:0,l=E0(i,Math.max(c*A0,yt));return{pts:l,nrm:R0(l,o),front:Math.max(n[t].pitch*w0,yt),back:Math.max(n[t].pitch*P0,yt)}}var Un=1.5,Ul=.3;function pa(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],r=o.x-n.x,i=o.y-n.y,a=Math.hypot(r,i),s=-1,c=-1;for(let m=1;m<e.length-1;m++){let f=e[m],h=a>1e-12?Math.abs((f.x-n.x)*i-(f.y-n.y)*r)/a:Math.hypot(f.x-n.x,f.y-n.y);h>s&&(s=h,c=m)}if(s<=t||c<0)return[n,o];let l=pa(e.slice(0,c+1),t),u=pa(e.slice(c),t);return[...l.slice(0,-1),...u]}function jl(e,t){if(e.length<4)return e;let n=pa([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function C0(e){let t=e.map((o,r)=>{let i=e[(r+1)%e.length];return{a:o,b:i,i:r,minX:Math.min(o.x,i.x),maxX:Math.max(o.x,i.x),minY:Math.min(o.y,i.y),maxY:Math.max(o.y,i.y)}}).sort((o,r)=>o.minX-r.minX),n=(o,r,i)=>(r.x-o.x)*(i.y-o.y)-(r.y-o.y)*(i.x-o.x);for(let o=0;o<t.length;o++){let r=t[o];for(let i=o+1;i<t.length&&t[i].minX<=r.maxX;i++){let a=t[i];if(!(Math.abs(r.i-a.i)===1||Math.abs(r.i-a.i)===e.length-1||r.maxY<a.minY||a.maxY<r.minY)&&n(r.a,r.b,a.a)*n(r.a,r.b,a.b)<=0&&n(a.a,a.b,r.a)*n(a.a,a.b,r.b)<=0)return!0}}return!1}function Wl(e,t,n){if(e.length<2)return[];let o=n??Er(e),r=new Map;for(let a=0;a<e.length;a++){let s=r.get(e[a].blockId);s?s.push(a):r.set(e[a].blockId,[a])}let i=[];for(let[,a]of r){let s=[];for(let y of a){let M=e[y].patch;M&&M.length>=3?i.push({outline:[...M],holes:[],topY:e[y].y}):s.push(y)}if(!s.length)continue;s.sort((y,M)=>e[y].depth-e[M].depth);let l=s.map(y=>zl(e,y,o,t)).filter(y=>y!==null);if(!l.length)continue;let u=(y,M)=>({x:y.pts[M].x-y.nrm[M][0]*(y.front+Un),y:y.pts[M].y-y.nrm[M][1]*(y.front+Un)}),m=(y,M)=>({x:y.pts[M].x+y.nrm[M][0]*(y.back+Un),y:y.pts[M].y+y.nrm[M][1]*(y.back+Un)}),f=l[0],h=l[l.length-1],d=[];for(let y=0;y<f.pts.length;y++)d.push(u(f,y));for(let y of l)d.push(m(y,y.pts.length-1));for(let y=h.pts.length-1;y>=0;y--)d.push(m(h,y));for(let y=l.length-1;y>=0;y--)d.push(u(l[y],0));let p=Xl(d),b=1/0;for(let y of s)e[y].y<b&&(b=e[y].y);if(!Number.isFinite(b))continue;if(p.length>=3&&Math.abs(mt(p))>1e-6&&l.every(y=>{let M=y.pts[Math.floor(y.pts.length/2)];return Ze(p,M.x,M.y)})&&!C0(p)){i.push({outline:jl(p,Ul),holes:[],topY:b});continue}for(let y of T0(l))i.push({outline:y,holes:[],topY:b})}return i}function T0(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+Un,a=n.back+Un;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];o.push([l.x-u[0]*i,l.y-u[1]*i]),r.push([l.x+u[0]*a,l.y+u[1]*a])}let s=[...o,...r.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=ya.default.union(t[0],...t.slice(1)),o=[];for(let r of n){if(!r.length||r[0].length<4)continue;let i=r[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&&o.push(jl(i,Ul))}return o}catch{return[]}}function Xl(e){let t=[];for(let n of e){let o=t[t.length-1];o&&Math.hypot(n.x-o.x,n.y-o.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 ba=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 o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.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 o=!0;for(let r of t)if(!Ze(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function Vl(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let l=[0,1,0],u=o[0];for(let m=1;m+1<o.length;m++){let f=o[m],h=o[m+1];e.tri([u.x*C,r,u.y*C],[f.x*C,r,f.y*C],[h.x*C,r,h.y*C],l,i)}return}let a=o.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=ya.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],m=[],f=[];for(let d=0;d<u.length-1;d++)m.push(u[d][0],u[d][1]),f.push([u[d][0],u[d][1]]);if(f.length<3)continue;let h=(0,Gl.default)(m,void 0,2);for(let d=0;d<h.length;d+=3){let p=f[h[d]],b=f[h[d+1]],x=f[h[d+2]];e.tri([p[0]*C,r,p[1]*C],[b[0]*C,r,b[1]*C],[x[0]*C,r,x[1]*C],c,i)}}}function Kl(e,t,n,o,r,i,a){if(t.length<2)return;let s=a??Er(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(h=>[h.x,h.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new ba([[...i]]):null,m=h=>{e.setMaterial(2),h(),e.setMaterial(0)},f=h=>{e.setMaterial(3),h(),e.setMaterial(0)};for(let h=0;h<t.length;h++){let d=t[h];if(d.patch&&d.patch.length>=3){let w=[...d.patch],g=s[h].belowY??o;if(f(()=>{if(l&&u)Vl(e,l,u,w,d.y,r.tread);else{let S=w[0];for(let v=1;v+1<w.length;v++){let P=w[v],E=w[v+1];e.tri([S.x*C,d.y,S.y*C],[P.x*C,d.y,P.y*C],[E.x*C,d.y,E.y*C],c,r.tread)}}}),d.y>g+Nl){let S=0,v=0;for(let P of w)S+=P.x,v+=P.y;S/=w.length,v/=w.length,m(()=>{for(let P=0;P<w.length;P++){let E=w[P],k=w[(P+1)%w.length],L=k.x-E.x,I=k.y-E.y,R=Math.hypot(L,I);if(R<1e-6)continue;let _=I/R,F=-L/R;(E.x-S)*_+(E.y-v)*F<0&&(_=-_,F=-F);let N=[_,0,F],O=[E.x*C,d.y,E.y*C],V=[k.x*C,d.y,k.y*C],z=[E.x*C,g,E.y*C],G=[k.x*C,g,k.y*C];e.tri(O,V,G,N,r.riser),e.tri(O,G,z,N,r.riser)}})}continue}let p=zl(t,h,s,n);if(!p)continue;let{pts:b,nrm:x,front:y,back:M}=p,A=s[h].belowY??o;for(let w=0;w+1<b.length;w++){let g=b[w],S=b[w+1],v=x[w],P=x[w+1];if(Math.hypot(S.x-g.x,S.y-g.y)<1e-6||v[0]===0&&v[1]===0||P[0]===0&&P[1]===0)continue;let E=[(g.x-v[0]*y)*C,d.y,(g.y-v[1]*y)*C],k=[(S.x-P[0]*y)*C,d.y,(S.y-P[1]*y)*C],L=[(g.x+v[0]*M)*C,d.y,(g.y+v[1]*M)*C],I=[(S.x+P[0]*M)*C,d.y,(S.y+P[1]*M)*C];if(f(()=>{l&&u?Vl(e,l,u,[{x:g.x-v[0]*y,y:g.y-v[1]*y},{x:S.x-P[0]*y,y:S.y-P[1]*y},{x:S.x+P[0]*M,y:S.y+P[1]*M},{x:g.x+v[0]*M,y:g.y+v[1]*M}],d.y,r.tread):(e.tri(E,k,I,c,r.tread),e.tri(E,I,L,c,r.tread))}),d.y>A+Nl){let R=[E[0],A,E[2]],_=[k[0],A,k[2]],F=[-v[0],0,-v[1]];m(()=>{e.tri(E,k,_,F,r.riser),e.tri(E,_,R,F,r.riser)})}}}}function L0(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Yl(e,t){return e.filter(n=>n.type!=="shape"||L0(n,t))}function $l(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:Yl(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:Yl(e.objects,t),focal:n,baseHeightM:0,index:0}]}var k0={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function zt(e){return Tl(e)??k0}function Zl(e,t){let n=Tt(e.outline,yt),o=zt(n),r=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&Hn(o,zt(a.outline)));if(!r.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=ga.default.difference([i(n)],...r.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,m])=>({x:u,y:m}));if(l.length>1){let u=l[0],m=l[l.length-1];Math.abs(u.x-m.x)<1e-9&&Math.abs(u.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function ql(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},o=t.map(i=>[n(i)]),r=[];for(let i of e){let a;try{a=ga.default.intersection([n(i.outline)],o.flat())}catch{r.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&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}function O0(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Ir=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(c=>[c.x,c.y]);if(o.length<3)return[];o.push(o[0]);let r=zt(t),i=this.rings.filter((c,l)=>Hn(r,this.boxes[l])&&O0(n,this.levels[l])),a=[[o]];if(i.length)try{a=Ql.default.difference([o],...i).map(l=>l.map(u=>u.map(([m,f])=>[m,f])))}catch{a=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,m])=>({x:u,y:m}));if(l.length>1){let u=l[0],m=l[l.length-1];Math.abs(u.x-m.x)<1e-9&&Math.abs(u.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function jn(e,t,n=e){if(!t)return e;let o=1/0,r=-1/0,i=1/0,a=-1/0;for(let f of n)o=Math.min(o,f.x),r=Math.max(r,f.x),i=Math.min(i,f.y),a=Math.max(a,f.y);let s=(o+r)/2,c=(i+a)/2,l=t*Math.PI/180,u=Math.cos(l),m=Math.sin(l);return e.map(f=>{let h=f.x-s,d=f.y-c;return{x:s+h*u-d*m,y:c+h*m+d*u}})}function Jl(e){let t=Cl(e);return!t.length||!e.points?.length?[]:t.map(n=>jn(n,e.rotation,e.points))}function Me(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3)return jn(Pr(e,4),e.rotation,e.points);if(e.kind==="rect"&&e.width&&e.height&&(t=xo(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,o=(e.y??0)+e.height/2;t=Mr(n,o,e.width/2,e.height/2)}return t?jn(t,e.rotation):null}function St(e){let t=e.role??"",o=t==="stage"?{kind:"stage",heightM:tl(e.stageKind)}:{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}}[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var F0=.08,D0=30,N0=.015;function B0(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function eu(e,t){let n=Me(e)??(e.points?.length?jn(e.points,e.rotation):null),o=St(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(mt(n))*he**2>=D0?N0:o.heightM;if(!n)return{topOffsetM:i,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:i,supportOffsetM:0};let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let h of n)a=Math.min(a,h.x),s=Math.min(s,h.y),c=Math.max(c,h.x),l=Math.max(l,h.y);let u=i,m=0,f=1e-6*Math.max(1,c-a,l-s);for(let h of t)c>h.minX&&a<h.maxX&&l>h.minY&&s<h.maxY&&u<=h.topOffsetM+1e-6&&(u=h.topOffsetM+F0),a>=h.minX-f&&c<=h.maxX+f&&s>=h.minY-f&&l<=h.maxY+f&&(!h.poly||n.every(b=>B0(b,h.poly)||V0(b,h.poly,f)))&&(m=Math.max(m,h.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:a,minY:s,maxX:c,maxY:l,topOffsetM:u,poly:n}),{topOffsetM:u,supportOffsetM:Math.min(m,u)}}function V0(e,t,n){for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],a=t[o],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/l)):0;if(Math.hypot(e.x-(i.x+u*s),e.y-(i.y+u*c))<=n)return!0}return!1}function qt(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function ft(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 nt(e,t,n){return[qt(e[0],e[1],t),qt(e[0],e[1],n),qt(e[3],e[2],n),qt(e[3],e[2],t)]}function Eo(e,t,n){return[qt(e[0],e[3],t),qt(e[1],e[2],t),qt(e[1],e[2],n),qt(e[0],e[3],n)]}function we(e,t,n,o,r,i,a){ie(e,t,a?.length?a:void 0,()=>n,o,r,i,oe)}var tu=[.13,.14,.17],Wn=[.4,.43,.47],G0=.18,H0=.02,z0=2.4,U0=1500,j0=240,W0=.25,X0=12,K0=[.055,.06,.075],Y0=[.46,.33,.22],$0=[1,.96,.84],Z0=[.98,.66,.28],q0=[.5,.31,.15],Q0=[1,.87,.64],Ye={lampEvery:1.8,lampsMin:3,lampsMax:14,lampDrop:.45,lampRadius:[.11,.2],poolShare:.44,poolEdge:.9,poolStrength:.5,washByDay:.35,drapeClear:.12,glowClear:.06,coreClear:.12,poolLift:.02};function J0(e,t,n,o){let r=1/0,i=0;for(let a=0;a<e.length;a++){let s=e[a],c=e[(a+1)%e.length],l=c.x-s.x,u=c.y-s.y,m=n*u-o*l;if(Math.abs(m)<1e-12)continue;let f=((s.x-t.x)*u-(s.y-t.y)*l)/m,h=((s.x-t.x)*o-(s.y-t.y)*n)/m;f>0&&h>=0&&h<1&&(i+=1,r=Math.min(r,f))}return i%2===1?r:0}function xa(e,t){if(!t.length)return!1;let n=0,o=0,r=0,i=new Set;for(let s of t)n+=s.x,o+=s.y,r+=Math.hypot(s.x-e.x,s.y-e.y),i.add(Math.floor(Math.atan2(s.y-e.y,s.x-e.x)*180/Math.PI/10));let a=Math.hypot(e.x-n/t.length,e.y-o/t.length);return i.size*10>j0&&a<W0*(r/t.length)}function nu(e,t,n,o,r={}){let i=t.stageKind??"";if(vt(i)||i==="round"||!o.length)return;let a=Me(t);if(!a||a.length<3)return;let s={x:a.reduce((B,Y)=>B+Y.x,0)/a.length,y:a.reduce((B,Y)=>B+Y.y,0)/a.length},c=0,l=0;for(let B of o)c+=B.x,l+=B.y;let u=s.x-c/o.length,m=s.y-l/o.length,f=Math.hypot(u,m);if(f<1e-6||xa(s,o))return;let h=u/f,d=m/f,p=-d,b=h,x=-1/0,y=1/0,M=1/0,A=-1/0;for(let B of a){let Y=(B.x-s.x)*h+(B.y-s.y)*d,q=(B.x-s.x)*p+(B.y-s.y)*b;x=Math.max(x,Y),y=Math.min(y,Y),M=Math.min(M,q),A=Math.max(A,q)}let w=(A-M)*C,g=(x-y)*C;if(w<3||g<1.5||w*g>U0)return;let S=G0/C,v=(B,Y)=>({x:s.x+h*B+p*Y,y:s.y+d*B+b*Y}),P=(B,Y,q,J)=>[v(B,q),v(B,J),v(Y,J),v(Y,q)],E=n+Math.max(3.5,Math.min(8,w*.35)),k=n+Math.min(z0,E-n-1),L=.2/C,I=y+Math.min(g*.25,1.5)/C,R=H0/C;ie(e,P(x-2*S+R,x-S-R,M+S+L,A-S-L),void 0,()=>k,n,tu,tu,oe);for(let[B,Y]of[[M+S,M+S+L],[A-S-L,A-S]])ie(e,P(x-2*S,x-S,B,Y),void 0,()=>E+.3,n,Wn,Wn,oe),ie(e,P(I+L,x-2*S,B,Y),void 0,()=>E+.3,E,Wn,Wn,oe);ie(e,P(I,I+L,M+S,A-S),void 0,()=>E+.3,E,Wn,Wn,oe);let _=(B,Y)=>[B.x*C,Y,B.y*C],F=[-h,0,-d],N=M+S+L,O=A-S-L,V=x-2*S-Ye.drapeClear/C,z=E-n,G=r.night===!1?Ye.washByDay:1,T=(B,Y)=>Se(K0,Y0,G*(1-B*B)*Math.pow(1-Y,1.6)),D=(B,Y,q=0)=>_(v(V-q/C,(N+O)/2+B*(O-N)/2),n+z*Y);e.setMaterial(X0);let W=8,H=5;for(let B=0;B<W;B++)for(let Y=0;Y<H;Y++){let q=B/W*2-1,J=(B+1)/W*2-1,te=Y/H,ae=(Y+1)/H;e.tri(D(q,te),D(J,te),D(J,ae),F,T(q,te),T(J,te),T(J,ae)),e.tri(D(q,te),D(J,ae),D(q,ae),F,T(q,te),T(J,ae),T(q,ae))}let j=Math.max(Ye.lampsMin,Math.min(Ye.lampsMax,Math.round(w/Ye.lampEvery))),Z=Math.max(Ye.lampRadius[0],Math.min(Ye.lampRadius[1],w*.012)),X=(O-N)*C,ee=1-Ye.lampDrop/z,ne=(B,Y,q,J,te)=>{let fe=Y/X*2,Ue=Y/z;for(let se=0;se<10;se++){let Te=2*Math.PI*se/10,ht=2*Math.PI*(se+1)/10,Ee=[Math.cos(Te)*fe,Math.sin(Te)*Ue],qe=[Math.cos(ht)*fe,Math.sin(ht)*Ue];e.tri(D(B,ee,q),D(B+Ee[0],ee+Ee[1],q),D(B+qe[0],ee+qe[1],q),F,J,te(Ee[0],Ee[1]),te(qe[0],qe[1]))}};for(let B=0;B<j;B++){let Y=(B+.5)/j*2-1;ne(Y,Z*3,Ye.glowClear,Se(T(Y,ee),q0,.85),(q,J)=>T(Y+q,ee+J)),ne(Y,Z,Ye.coreClear,$0,()=>Z0)}if(e.setMaterial(0),!r.night||!r.deck)return;let ue=r.deck,de=v((y+x-2*S)/2,(M+A)/2),me=n+Ye.poolLift,pe=[0,1,0],Pe=[{r:.4,k:.72},{r:.72,k:.28},{r:1,k:0}],_e=28,xe=[];for(let B=0;B<_e;B++){let Y=2*Math.PI*B/_e,q=Math.cos(Y)*(x-2*S-y)*Ye.poolShare,J=Math.sin(Y)*(A-M)*Ye.poolShare,te=Math.hypot(q,J),ae=(h*q+p*J)/te,fe=(d*q+b*J)/te;xe.push(Math.min(te,J0(a,de,ae,fe)*Ye.poolEdge))}if(xe.some(B=>!(B>0)))return;let Ce=(B,Y)=>{let q=2*Math.PI*(B%_e)/_e,J=Math.cos(q)*(x-2*S-y)*Ye.poolShare,te=Math.sin(q)*(A-M)*Ye.poolShare,ae=Math.hypot(J,te),fe=xe[B%_e]*Y/ae;return _({x:de.x+(h*J+p*te)*fe,y:de.y+(d*J+b*te)*fe},me)},$=B=>Se(ue,Q0,Ye.poolStrength*B);for(let B=0;B<_e;B++){e.tri(_(de,me),Ce(B,Pe[0].r),Ce(B+1,Pe[0].r),pe,$(1),$(Pe[0].k),$(Pe[0].k));for(let Y=0;Y+1<Pe.length;Y++){let q=Pe[Y],J=Pe[Y+1];e.tri(Ce(B,q.r),Ce(B,J.r),Ce(B+1,J.r),pe,$(q.k),$(J.k),$(J.k)),e.tri(Ce(B,q.r),Ce(B+1,J.r),Ce(B+1,q.r),pe,$(q.k),$(J.k),$(q.k))}}}function ou(e,t){let n={openField:!1,court:!1,indoorCourt:!1,inTheRound:!1,stage:!1,standing:0,seatCount:t.length};for(let o of e)for(let r of o.objects){if(r.type==="gaArea"&&(n.standing+=r.capacity),r.type!=="shape")continue;let i=r.stageKind;if(yn(i)){n.openField=!0;continue}if(vt(i)){n.court=!0,el(i)&&(n.indoorCourt=!0);continue}if(r.role!=="stage")continue;if(n.stage=!0,i==="round"){n.inTheRound=!0;continue}let a=Me(r);if(!a||a.length<3)continue;let s={x:a.reduce((c,l)=>c+l.x,0)/a.length,y:a.reduce((c,l)=>c+l.y,0)/a.length};xa(s,t)&&(n.inTheRound=!0)}return n}var cu=10,Mn=11,Xn=[.93,.94,.95],ey=[.93,.8,.22],ty=[.82,.14,.16],ny=[.78,.1,.12],Ma=[.74,.77,.8],va={width:7.32,height:2.44,depth:2},_r={width:1.83,height:1.22,depth:1,fromEndBoards:3.35},oy=1.5,ry=1.8,Sa=2.4,ot=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],_o=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],Ut=e=>{let t=Math.hypot(e[0],e[1],e[2])||1;return[e[0]/t,e[1]/t,e[2]/t]};function gt(e,t,n,o,r){let i=Ut(ot(n,t)),a=Ut(_o(i,Math.abs(i[1])<.9?[0,1,0]:[1,0,0])),s=_o(a,i),c=(l,u)=>{let m=u===0||u===3?-o:o,f=u<2?-o:o;return[l[0]+a[0]*m+s[0]*f,l[1]+a[1]*m+s[1]*f,l[2]+a[2]*m+s[2]*f]};for(let l=0;l<4;l++){let u=(l+1)%4,m=c(t,l),f=c(t,u),h=c(n,l),d=c(n,u),p=Ut(_o(ot(f,m),ot(h,m))),b=ot([(m[0]+f[0])/2,(m[1]+f[1])/2,(m[2]+f[2])/2],t);p[0]*b[0]+p[1]*b[1]+p[2]*b[2]<0&&(p=[-p[0],-p[1],-p[2]]);let x=re(r,.86+.14*Math.max(0,p[1]));e.tri(m,f,d,p,x),e.tri(m,d,h,p,x)}}function Io(e,t,n,o,r){let i=Math.hypot(...ot(n,t)),a=Math.hypot(...ot(r,t)),s=Ut(_o(ot(n,t),ot(r,t)));e.tri(t,n,o,s,[0,0,0],[i,0,0],[i,a,0]),e.tri(t,o,r,s,[0,0,0],[i,a,0],[0,a,0])}function Pa(e,t,n,o,r,i,a,s,c){let l=(y,M)=>[y[0],y[1]+M,y[2]],u=y=>[y[0]+o[0]*i,y[1],y[2]+o[2]*i],m=l(t,r),f=l(n,r),h=u(t),d=u(n),p=u(m),b=u(f);e.setMaterial(c),gt(e,t,m,a,s),gt(e,n,f,a,s),gt(e,m,f,a,s),e.setMaterial(Mn);let x=Math.min(a,.03);for(let[y,M]of[[h,p],[d,b],[m,p],[f,b],[p,b],[t,h],[n,d],[h,d]])gt(e,y,M,x,re(s,.92));e.setMaterial(cu),Io(e,h,d,b,p),Io(e,m,f,b,p),Io(e,t,h,p,m),Io(e,n,d,b,f),e.setMaterial(0)}var wa={height:.711,width:.2286,pitchLength:20.12},iy=[.88,.8,.6];function lu(e,t,n){if(t.length!==4)return;let o=a=>Math.hypot(t[(a+1)%4].x-t[a].x,t[(a+1)%4].y-t[a].y),r=o(0)<=o(1)?0:1,i=Math.max(o(0),o(1))*C/wa.pitchLength;if(i>.2){e.setMaterial(Mn);for(let a of[r,r+2]){let s=t[a%4],c=t[(a+1)%4],l=o(a%4)||1,u={x:(s.x+c.x)/2,y:(s.y+c.y)/2},m=(c.x-s.x)/l,f=(c.y-s.y)/l;for(let h of[-1,0,1]){let d=h*wa.width*i/2/C,p=Oe({x:u.x+m*d,y:u.y+f*d},n);gt(e,p,[p[0],p[1]+wa.height*i,p[2]],.019*i,iy)}}e.setMaterial(0)}}var Oe=(e,t)=>[e.x*C,t,e.y*C];function uu(e){if(e.length<3)return null;let t=0,n=0;for(let x of e)t+=x.x,n+=x.y;t/=e.length,n/=e.length;let o=0,r=0,i=0;for(let x of e){let y=x.x-t,M=x.y-n;o+=y*y,r+=M*M,i+=y*M}let a=.5*Math.atan2(2*i,o-r),s=Math.cos(a),c=Math.sin(a),l=1/0,u=-1/0,m=1/0,f=-1/0;for(let x of e){let y=(x.x-t)*s+(x.y-n)*c,M=-(x.x-t)*c+(x.y-n)*s;l=Math.min(l,y),u=Math.max(u,y),m=Math.min(m,M),f=Math.max(f,M)}let h=(u-l)*C,d=(f-m)*C;if(!(h>4)||!(d>2))return null;let p={a:(l+u)/2,b:(m+f)/2};return{at:(x,y)=>{let M=p.a+x/C,A=p.b+y/C;return{x:t+s*M-c*A,y:n+c*M+s*A}},lengthM:h,widthM:d}}function mu(e,t,n,o,r,i){let a=t.map(c=>Oe(c,n)),s=t.map(c=>Oe(c,n+o));e.setMaterial(0);for(let c=0;c<t.length;c++)gt(e,a[c],s[c],r,i);e.setMaterial(Mn);for(let c=0;c+1<t.length;c++)gt(e,s[c],s[c+1],.025,i);e.setMaterial(cu);for(let c=0;c+1<t.length;c++)Io(e,a[c],a[c+1],s[c+1],s[c]);e.setMaterial(0)}var ru=[.66,.29,.22],ay=[.87,.79,.58],iu=[.17,.36,.63],fu=[.56,.59,.63],sy=[.7,.7,.68],cy={length:176.9,trackWidth:9.76,longJump:{runway:40,runwayWidth:1.22,pit:9,pitWidth:2.75,fromKerb:3,start:-25},highJump:{matLength:3,matWidth:5,matHeight:.7,apron:15,intoBend:3.5,bar:2},cage:{radius:3.5,height:7,intoBend:10,pad:1.07,sectorDeg:34.92,sector:60,openDeg:120}};function hu(e,t,n){let o=uu(t);if(!o)return;let{at:r,lengthM:i,widthM:a}=o,s=cy,c=Math.min(1.2,Math.max(.5,i/s.length)),l=a/2,u=i/2-l,m=l-s.trackWidth;if(!(u>30*c)||!(m>22*c))return;let f=n+.03,h=(L,I,R=0)=>{ie(e,L,void 0,()=>f+R,f+R-.004,I,I,oe)},d=(L,I,R,_)=>[r(L,R),r(I,R),r(I,_),r(L,_)];e.setMaterial(0),h(d(u-.08,u+.08,-l+.2,-m-.2),Xn);let p=s.longJump,b=m-p.fromKerb*c,x=(p.start+p.runway)*c;h(d(p.start*c,x,b-p.runwayWidth*c/2,b+p.runwayWidth*c/2),ru),h(d(x,x+p.pit*c,b-p.pitWidth*c/2,b+p.pitWidth*c/2),ay);let y=s.highJump,M=-(u+y.intoBend*c),A=[];for(let L=0;L<=16;L++){let I=-Math.PI/2+Math.PI*L/16;A.push(r(M-.3*c+Math.cos(I)*y.apron*c,Math.sin(I)*y.apron*c))}h(A,ru),ie(e,d(M-y.matLength*c,M,-(y.matWidth*c)/2,y.matWidth*c/2),void 0,()=>n+y.matHeight*c,n,iu,re(iu,.82),oe),e.setMaterial(Mn);let w=[-1,1].map(L=>r(M+.25*c,L*(y.bar+.1)*c));for(let L of w)gt(e,Oe(L,n),Oe(L,n+(y.bar+.3)*c),.02,Xn);gt(e,Oe(w[0],n+y.bar*c),Oe(w[1],n+y.bar*c),.015,Xn),e.setMaterial(0);let g=s.cage,S=u+g.intoBend*c;h(((L,I)=>Array.from({length:I},(R,_)=>{let F=2*Math.PI*_/I;return r(S+Math.cos(F)*L,Math.sin(F)*L)}))(g.pad*c,16),sy);let P=g.sectorDeg/2*Math.PI/180;for(let L of[-1,1]){let I=g.sector*c,R=-Math.cos(P),_=L*Math.sin(P);h([r(S+_*.15,-R*.15),r(S+R*I+_*.15,_*I-R*.15),r(S+R*I-_*.15,_*I+R*.15),r(S-_*.15,R*.15)],Xn,.006)}let E=g.openDeg/2*Math.PI/180,k=[];for(let L=0;L<=6;L++){let I=E+(2*Math.PI-2*E)*L/6;k.push(r(S-Math.cos(I)*g.radius*c,Math.sin(I)*g.radius*c))}mu(e,k,n,g.height*c,.05,fu)}var ly=[.95,.8,.16],au=[.13,.17,.2],su=[.78,.8,.83],uy={backY:70,backHalf:25,pole:{x:70,y:-18},net:{height:9,inset:.5,wing:15},poleHeight:12,dugout:{length:18,depth:2.4,height:1,along:.32,inset:1.9}};function du(e,t,n,o,r,i){let a=uy,s={x:a.pole.x-a.backHalf,y:a.pole.y-a.backY},c=Math.hypot(s.x,s.y),l=s.x/c,u=s.y/c,m=(M,A,w)=>t(M*(a.backHalf+l*A+u*w),a.backY+u*A-l*w),f=a.net,h=a.backY-f.inset,d=a.backHalf-f.inset,p=[m(-1,f.wing,f.inset)];for(let M of[-d,-d/2,d/2,d])p.push(t(M,h));p.push(m(1,f.wing,f.inset)),mu(e,p,n,f.height*o,.05,fu),e.setMaterial(0);for(let M of[-1,1]){let A=Oe(t(M*(a.pole.x-.4),a.pole.y+.4),n);gt(e,A,[A[0],A[1]+a.poleHeight*o,A[2]],.09,ly)}if(!i)return;let b=a.dugout,x=b.along*c-b.length/2,y=x+b.length;for(let M of[-1,1]){let A=[m(M,x,b.inset-b.depth/2),m(M,y,b.inset-b.depth/2)],w=[m(M,x,b.inset+b.depth/2),m(M,y,b.inset+b.depth/2)],g=Math.ceil(b.length),S=!0;for(let k=0;S&&k<=g;k++){let L=k/g;S=r({x:A[0].x+(A[1].x-A[0].x)*L,y:A[0].y+(A[1].y-A[0].y)*L})}if(!S)continue;let v=[A[0],A[1],w[1],w[0]];ie(e,v,void 0,()=>n+(b.height-.1)*o,n,au,re(au,.85),oe);let P=(k,L)=>({x:k.x+(k.x-L.x)*.04,y:k.y+(k.y-L.y)*.04}),E=[P(A[0],w[1]),P(A[1],w[0]),P(w[1],A[0]),P(w[0],A[1])];ie(e,E,void 0,()=>n+b.height*o,n+(b.height-.14)*o,su,re(su,.9),oe)}}function pu(e,t,n,o,r,i){let a=t.lengthM/2,s=t.widthM/2;if(i){let c=va.width/2*o,l=va.depth*o;for(let u of[-1,1]){let m=t.at(u*(a+l),-c),f=t.at(u*(a+l),c);if(!r(m)||!r(f))continue;let h=Oe(t.at(u*a,-c),n),d=Oe(t.at(u*a,c),n),p=Oe(t.at(u*(a+1),0),n),b=Oe(t.at(u*a,0),n);Pa(e,h,d,Ut(ot(p,b)),va.height*o,l,.06,Xn,0)}}e.setMaterial(Mn);for(let c of[-1,1])for(let l of[-1,1]){if(!r(t.at(c*a,l*s)))continue;let u=Oe(t.at(c*a,l*s),n),m=[u[0],u[1]+oy*o,u[2]];gt(e,u,m,.02,ey);let f=Ut(ot(Oe(t.at(c*(a+1),l*(s+1)),n),u)),h=[m[0]+f[0]*.4*o,m[1]-.14*o,m[2]+f[2]*.4*o],d=[m[0],m[1]-.28*o,m[2]];e.tri(m,h,d,Ut(_o(ot(h,m),ot(d,m))),ty)}e.setMaterial(0)}function bu(e,t,n,o,r){let i=uu(t);if(!i)return;let{at:a,lengthM:s}=i,c=Math.min(1.2,Math.max(.5,s/60)),l=s/2-_r.fromEndBoards*c,u=_r.width/2*c;for(let b of[-1,1]){let x=Oe(a(b*l,-u),n),y=Oe(a(b*l,u),n),M=Oe(a(b*(l+1),0),n),A=Oe(a(b*l,0),n);Pa(e,x,y,Ut(ot(M,A)),_r.height*c,_r.depth*c,.03,ny,Mn)}let m=bt(t,r/2/C);if(m.length<3)return;let f=o+ry;e.setMaterial(Mn);let h=Sa;for(let b=0;b<m.length;b++){let x=m[b],y=m[(b+1)%m.length],M=Math.hypot(y.x-x.x,y.y-x.y)*C,A=0;for(;h+(M-A)>=Sa;){A+=Sa-h,h=0;let w=M>0?A/M:0,g={x:x.x+(y.x-x.x)*w,y:x.y+(y.y-x.y)*w};gt(e,Oe(g,o),Oe(g,f),.025,Ma)}h+=M-A}let d=bt(t,(r/2-.03)/C),p=bt(t,(r/2+.03)/C);d.length>=3&&p.length>=3&&ie(e,d,[p.slice().reverse()],()=>f,f-.05,Ma,re(Ma,.9),oe),e.setMaterial(0)}function yu(e,t,n,o,r){if(t.length!==4||!(r-o>.2))return;let i=(d,p)=>({x:(d.x+p.x)/2,y:(d.y+p.y)/2}),a=d=>Math.hypot(d.x-n.x,d.y-n.y),s=a(i(t[0],t[1]))<=a(i(t[3],t[2])),[c,l,u]=s?[t[0],t[1],t[3]]:[t[3],t[2],t[0]],m=Math.hypot(u.x-c.x,u.y-c.y)*C;if(!(m>.05))return;let f=Oe(c,o),h=Oe(l,o);Pa(e,f,h,Ut(ot(Oe(u,o),f)),r-o,m,.06,Xn,0)}var my=[.12,.38,.16],fy=[.72,.62,.45],hy=[.88,.93,.96],gu=[.95,.95,.94],dy=[.66,.29,.22],Aa={length:20.12,width:3.05},py=.14,by=9.76,wt=[.93,.94,.95],Cr=[.1,.11,.13],yy=[.45,.85,1.25],gy=1.45,xu=.012,Mu=.004,vu=1.07,Tr=.15,Su=[.93,.76,.18],Ra={height:.2,proud:.02,buried:.03};function vn(e,t,n,o,r,i){e.setMaterial(i),ie(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,oe)}var Kn=(e,t)=>bt(e,t/C);function Pu(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<1e-9)return null;let a=-r/i*n,s=o/i*n;return[{x:e.x+a,y:e.y+s},{x:t.x+a,y:t.y+s},{x:t.x-a,y:t.y-s},{x:e.x-a,y:e.y-s}]}function xy(e,t,n,o){let r=t.map(i=>[i.x*C,n,i.y*C]);e.tri(r[0],r[1],r[2],[0,1,0],o),e.tri(r[0],r[2],r[3],[0,1,0],o)}function Yn(e,t,n,o,r,i){let a=n/C,s=[{x:t.x-a,y:t.y-a},{x:t.x+a,y:t.y-a},{x:t.x+a,y:t.y+a},{x:t.x-a,y:t.y+a}];ie(e,s,void 0,()=>r,o,i,re(i,.85),oe)}function rt(e,t,n,o,r,i,a){let s=Pu(t,n,o/C);s&&ie(e,s,void 0,()=>i,r,a,re(a,.85),oe)}function ko(e){let t=ft(e),n={x:(t[0].x+t[2].x)/2,y:(t[0].y+t[2].y)/2},o=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y)||1,r=Math.hypot(t[3].x-t[0].x,t[3].y-t[0].y)||1,i={x:(t[1].x-t[0].x)/o,y:(t[1].y-t[0].y)/o},a={x:(t[3].x-t[0].x)/r,y:(t[3].y-t[0].y)/r};return{at:(c,l)=>({x:n.x+(i.x*c+a.x*l)/C,y:n.y+(i.y*c+a.y*l)/C}),lengthM:o*C,widthM:r*C}}function Ea(e){let t=1/0,n=-1/0,o=1/0,r=-1/0;for(let f of e.points??[])t=Math.min(t,f.x),n=Math.max(n,f.x),o=Math.min(o,f.y),r=Math.max(r,f.y);let i=(e.rotation??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=(t+n)/2,l=(o+r)/2,u=f=>i?{x:c+(f.x-c)*a-(f.y-l)*s,y:l+(f.x-c)*s+(f.y-l)*a}:f,m=(f,h,d,p)=>u({x:c+f/d*(n-t),y:l+h/p*(r-o)});return{turn:u,shortSideM:Math.min(n-t,r-o)*C,local:m,widthU:n-t}}function My(e){let t=na(e).find(n=>n.closed&&!n.fill&&n.points.length===4);return t?t.points.map(Ea(e).turn):null}function Au(e,t,n){let o=na(t);if(!o.length)return;let{turn:r,shortSideM:i}=Ea(t),a=Math.max(.04,Math.min(.3,i*.004))/C,s=0;e.setMaterial(0);for(let u of o){if(!u.fill)continue;let m=u.points.map(r);vn(e,m,null,n+xu+s*Mu,ve(u.fill)??wt,0),s++}let c=o.filter(u=>!(u.fill&&u.ink===u.fill)),l=[...new Set(c.map(u=>u.ink??vr))];for(let u of l){let m=n+xu+s++*Mu,f=ve(u)??wt;for(let h of c){if((h.ink??vr)!==u)continue;let d=h.points.map(r),p=h.closed?d.length:d.length-1;for(let b=0;b<p;b++){let x=Pu(d[b],d[(b+1)%d.length],a);x&&xy(e,x,m,f)}}}}function Ru(e,t,n,o,r,i){if(t.length<3)return!1;let a=o+.006,s=r??my;if(n==="oval-cricket"){let c=t.reduce((g,S)=>g+S.x,0)/t.length,l=t.reduce((g,S)=>g+S.y,0)/t.length,u=g=>t.map(S=>({x:c+(S.x-c)*g,y:l+(S.y-l)*g})),m=8;for(let g=0;g<m;g++){let S=u(1-g/m),v=g===m-1?null:u(1-(g+1)/m);vn(e,S,v,a,re(s,g%2?1.04:.96),4)}let f=t[0];for(let g of t)Math.hypot(g.x-c,g.y-l)>Math.hypot(f.x-c,f.y-l)&&(f=g);let h=Math.hypot(f.x-c,f.y-l)||1,d=(f.x-c)/h,p=(f.y-l)/h,b=-p,x=d,y=Math.min(1,2*h*C*py/Aa.length),M=Aa.length*y/2/C,A=Aa.width*y/2/C,w=(i&&My(i))??[[-M,-A],[M,-A],[M,A],[-M,A]].map(([g,S])=>({x:c+d*g+b*S,y:l+p*g+x*S}));return vn(e,w,null,a+.004,fy,0),lu(e,w,a+.004),e.setMaterial(0),!0}if(n==="rink-hockey"){let c=Kn(t,Tr);vn(e,c,null,a,hy,0),e.setMaterial(0),ie(e,t,[c.slice().reverse()],()=>o+vu,o,gu,re(gu,.9),oe);let l=Kn(t,Tr-Ra.buried),u=Kn(t,Tr+Ra.proud);return l.length>=3&&u.length>=3&&ie(e,l,[u.slice().reverse()],()=>o+Ra.height,o,Su,re(Su,.92),oe),bu(e,t,a,o+vu,Tr),!0}if(n==="ring-boxing"&&t.length===4){let{at:c}=ko(t),l=[c(-3.05,-3.05),c(3.05,-3.05),c(3.05,3.05),c(-3.05,3.05)],u=[[.77,.19,.19],wt,[.17,.42,.69],wt];e.setMaterial(0),l.forEach((m,f)=>Yn(e,m,.07,o,o+gy,u[f]));for(let m of yy)for(let f=0;f<4;f++)rt(e,l[f],l[(f+1)%4],.025,o+m-.025,o+m+.025,wt);return!0}if(n==="court-tennis"&&t.length===4){let{at:c}=ko(t);e.setMaterial(0),rt(e,c(0,-6.4),c(0,6.4),.015,o,o+.95,Cr),rt(e,c(0,-6.4),c(0,6.4),.03,o+.95,o+1,wt);for(let l of[-1,1])Yn(e,c(0,l*6.4),.05,o,o+1.07,Cr);return!0}if(n==="court-basketball"&&t.length===4){let{at:c,lengthM:l}=ko(t),u=Math.min(14,l/2-.5);e.setMaterial(0);for(let m of[-1,1]){let f=c(m*(u+1.2),0),h=c(m*(u-1.2),0);Yn(e,f,.12,o,o+3.4,Cr),rt(e,f,h,.06,o+3.25,o+3.4,Cr),rt(e,c(m*(u-1.2),-.9),c(m*(u-1.2),.9),.03,o+2.9,o+3.95,wt)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:c,lengthM:l}=ko(t),u=l*(50/120);e.setMaterial(0);for(let m of[-1,1]){for(let f of[-2.8,2.8])Yn(e,c(m*u,f),.07,o,o+12,wt);rt(e,c(m*u,-2.8),c(m*u,2.8),.06,o+2.94,o+3.06,wt)}return!0}if(n==="track-athletics"){let c=Kn(t,by);return c.length<3?!1:(vn(e,t,c,a,dy,0),vn(e,c,null,a,s,4),e.setMaterial(0),hu(e,t,o),!0)}return!1}var Co=140,wu=1.6,To=[.9,.91,.93],Lr=[.15,.19,.3],Lo=[.14,.15,.18],vy=[.1,.24,.18],kr=.9,Sy=6,wy={"pitch-football":105,"pitch-rugby":120,"court-tennis":23.77,"court-basketball":32},Py={sidelineShare:15/19,fromSideline:1.35,tableHalfLength:4.5,tableHalfDepth:.38,tableHeight:.76,benchFrom:6,benchTo:12.5,benchHalfDepth:.25,benchHeight:.45,benchBackHeight:.85},Ay=[.13,.15,.2],Ry=[.82,.84,.87];function Eu(e,t,n,o,r,i=!1,a=!1){let s=t.stageKind;if(!s||n.length<3)return;if(e.setMaterial(0),s==="diamond-baseball"){let{local:P,widthU:E}=Ea(t);if(!(E>0))return;let k=P(0,0,Co,Co),L=r.filter(R=>Math.hypot(R.x-k.x,R.y-k.y)<=E),I=Math.min(1.2,Math.max(.5,E*C/Co));du(e,(R,_)=>P(R,_,Co,Co),o,I,R=>L.every(_=>Math.hypot(_.x-R.x,_.y-R.y)*C>=wu),!a),e.setMaterial(0);return}if(s==="oval-cricket"){let P=Kn(n,2.85),E=Kn(n,3.1);P.length>=3&&E.length>=3&&vn(e,P,E,o+.03,wt,0),e.setMaterial(0);return}let c=wy[s];if(!c||n.length!==4)return;let{at:l,lengthM:u,widthM:m}=ko(n),f=Math.min(1.2,Math.max(.5,u/c)),h=u/2,d=m/2,p=Math.max(h,d)+14,b=l(0,0),x=r.filter(P=>Math.hypot(P.x-b.x,P.y-b.y)*C<p),y=P=>x.every(E=>Math.hypot(E.x-P.x,E.y-P.y)*C>=wu),M=(P,E)=>{let k=Math.max(1,Math.ceil(Math.hypot(E.x-P.x,E.y-P.y)*C));for(let L=0;L<=k;L++)if(!y({x:P.x+(E.x-P.x)*(L/k),y:P.y+(E.y-P.y)*(L/k)}))return!1;return!0},A=(P,E,k,L,I)=>{let R=Math.hypot(E[0]-P[0],E[1]-P[1]),_=Math.max(1,Math.round(R/Sy));for(let F=0;F<_;F++){let N=F/_+.012,O=(F+1)/_-.012,V=l(P[0]+(E[0]-P[0])*N,P[1]+(E[1]-P[1])*N),z=l(P[0]+(E[0]-P[0])*O,P[1]+(E[1]-P[1])*O);M(V,z)&&rt(e,V,z,.06,o,o+I,L&&F%2?L:k)}};if(s==="court-basketball"){let P=Py;for(let E of[-1,1]){let k=E*(d*P.sidelineShare+P.fromSideline*f),L=k+E*P.tableHalfDepth*f,I=(N,O)=>M(l(N,k),l(O,k))&&M(l(N,L),l(O,L)),R=P.tableHalfLength*f;if(!I(-R,R))continue;let _=l(-R,k),F=l(R,k);rt(e,_,F,P.tableHalfDepth*f,o,o+P.tableHeight-.04,Ay),rt(e,_,F,P.tableHalfDepth*f+.04,o+P.tableHeight-.06,o+P.tableHeight,Ry);for(let N of[-1,1]){let O=N*P.benchFrom*f,V=N*P.benchTo*f;if(!I(O,V))continue;rt(e,l(O,k),l(V,k),P.benchHalfDepth,o,o+P.benchHeight,Lo);let z=k+E*(P.benchHalfDepth+.04);rt(e,l(O,z),l(V,z),.03,o,o+P.benchBackHeight,Lo)}break}return}if(s==="court-tennis"){let P=h+6.4*f,E=d+3.66*f;for(let L of[-1,1])A([L*P,-E],[L*P,E],vy,null,1);let k=l(0,d+1.2*f);y(k)&&(Yn(e,k,.3,o,o+1.5,Lo),Yn(e,k,.36,o+1.5,o+1.62,wt));return}pu(e,{at:l,lengthM:u,widthM:m},o,f,y,s==="pitch-football"&&!i);let w=d+3.2*f,g=h+4*f,S=3*f,v=15*f;A([-h+S,w],[h-S,w],To,Lr,kr),A([-h+S,-w],[-v,-w],To,Lr,kr),A([v,-w],[h-S,-w],To,Lr,kr);for(let P of[-1,1])A([P*g,-d+S],[P*g,d-S],To,Lr,kr);for(let P of a?[]:[-1,1]){let E=P*2.5*f,k=P*10.5*f,L=-(d+4.4*f),I=l(E,L),R=l(k,L);!M(I,R)||!M(l(E,L-.75*f),l(k,L-.75*f))||(rt(e,I,R,.35,o,o+.45,Lo),rt(e,l(E,L-.75*f),l(k,L-.75*f),.05,o,o+1.9,Lo),rt(e,l(E,L-.2*f),l(k,L-.2*f),.62,o+1.9,o+1.98,To))}}var Qt=72,Ey=1.2,Iy=5,_y=30,Cy=4;function Ty(e,t,n,o){let r=0;for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length],c=s.x-a.x,l=s.y-a.y,u=n*l-o*c;if(Math.abs(u)<1e-12)continue;let m=((a.x-t.x)*l-(a.y-t.y)*c)/u,f=((a.x-t.x)*o-(a.y-t.y)*n)/u;m>r&&f>=-1e-9&&f<=1+1e-9&&(r=m)}return r}function Ly(e,t){if(e.length<3)return null;let n={x:e.reduce((s,c)=>s+c.x,0)/e.length,y:e.reduce((s,c)=>s+c.y,0)/e.length},o=2*Math.PI/Qt,r=new Float64Array(Qt);for(let s=0;s<Qt;s++)if(r[s]=Ty(e,n,Math.cos(s*o),Math.sin(s*o)),!(r[s]>0))return null;let i=new Float64Array(Qt).fill(1/0);for(let s of t){let c=s.x-n.x,l=s.y-n.y,u=Math.hypot(c,l),m=(Math.round(Math.atan2(l,c)/o)%Qt+Qt)%Qt;u>r[m]&&u<i[m]&&(i[m]=u)}let a=[];for(let s=0;s<Qt;s++){let l=Number.isFinite(i[s])&&i[s]-r[s]<=_y/C?i[s]+Ey/C:r[s]+Iy/C;a.push({x:n.x+Math.cos(s*o)*l,y:n.y+Math.sin(s*o)*l})}return a}function ky(e){return Se(re(e,.84),[.33,.36,.31],.22)}function Iu(e,t,n,o,r){let i=Ly(t,o);if(!i)return;let a=n-.015;e.setMaterial(Cy);let s=ky(r);ie(e,i,void 0,()=>a,a-.004,s,s,oe),e.setMaterial(0)}function _u(e){let t=1/0,n=1/0,o=-1/0,r=-1/0;for(let i of e)t=Math.min(t,i.x),o=Math.max(o,i.x),n=Math.min(n,i.y),r=Math.max(r,i.y);return{x:(t+o)/2,y:(n+r)/2}}function Oy(e,t){let n=_u(e),o=_u(t);return Ze(t,n.x,n.y)||Ze(e,o.x,o.y)}function Or(e){let t=new Set;if(e.length<2)return t;let n=[...e].sort((r,i)=>r.baseHeightM-i.baseHeightM||r.index-i.index),o=[];for(let r of n){let i=[];for(let a of r.objects){if(a.type!=="shape"||a.role!=="stage")continue;let s=Me(a);!s||s.length<3||(o.some(c=>Oy(s,c))?t.add(a):i.push(s))}o.push(...i)}return t}var Cu="#ffffff";var Fy={wheelchair:"M7.8 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM8 7L10.5 7L10.5 15L8 15ZM8 12.5L18 12.5L18 15L8 15ZM16 15L18 15L18 18L16 18ZM5.5 16a5.5 5.5 0 1 0 11 0a5.5 5.5 0 1 0 -11 0zM8 16a3 3 0 1 1 6 0a3 3 0 1 1 -6 0z",companion:"M5.5 6.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM4.5 18.5L6 11.5L11 11.5L12.5 18.5ZM12.5 7.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM11.5 19L13 12.5L18 12.5L19.5 19Z","semi-ambulatory":"M8.3 3.8a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM9 6.2L12 6.6L11 13.5L8.6 13L9 6.2ZM8.6 13L11 13L9.5 21L7 21ZM10.4 13L12.6 13L13.6 21L11.2 21ZM11.2 7.2L14 8L14.6 9.6L11.9 8.9ZM14.4 6.8L15.9 6.8L16.4 21L14.8 21Z","designated-aisle":"M3 5L6 5L6 14L3 14ZM3 12L13 12L13 15L3 15ZM5 15L7 15L7 20L5 20ZM11 15L13 15L13 20L11 20ZM13 7L20 7L17 4L19 4L23 8.5L19 13L17 13L20 10L13 10Z","step-free":"M4 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM4.4 7L7.5 7L7.5 13L11 15L9.5 17L5 14L4.4 7ZM2 19L8 19L17 10L22 10L22 13L18 13L10 21L2 21Z",hearing:"M15.5 3.5C9 2.2 5.5 6 5.5 11.5C5.5 16 8 19.5 10.5 21C13.2 22.6 16.4 20.8 15.4 18C14.8 16.4 12.9 16.1 13 14C13.1 11.9 15.8 11.4 15.8 8.5C15.8 5.4 13 4 15.5 3.5Z",cart:"M5.5 6L18.5 6a2.5 2.5 0 0 1 2.5 2.5L21 15.5a2.5 2.5 0 0 1 -2.5 2.5L11 18L7 20.5L7.5 18L5.5 18a2.5 2.5 0 0 1 -2.5 -2.5L3 8.5a2.5 2.5 0 0 1 2.5 -2.5zM6.5 11L17.5 11L17.5 12.6L6.5 12.6zM6.5 14L17.5 14L17.5 15.6L6.5 15.6z","sign-language":"M7 11L17 11L17 18a2 2 0 0 1 -2 2L9 20a2 2 0 0 1 -2 -2zM7.6 5L9.4 5L9.4 12L7.6 12zM9.9 3.5L11.7 3.5L11.7 12L9.9 12zM12.3 3.5L14.1 3.5L14.1 12L12.3 12zM14.6 5L16.4 5L16.4 12L14.6 12zM7.2 12.5L5 10.2L6.4 8.9L8.6 11.2Z","low-vision":"M2.5 12C6 6 18 6 21.5 12C18 18 6 18 2.5 12ZM9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM17.5 3L19 3L19 6L17.5 6ZM19 4L22 4L22 5.5L19 5.5Z","sensory-friendly":"M4 11C4 5 7 2.5 12 2.5S20 5 20 11L17 11C17 7 15.5 5.5 12 5.5S7 7 7 11ZM3 10L8 10L8 19L5 19a2 2 0 0 1 -2 -2ZM16 10L21 10L21 17a2 2 0 0 1 -2 2L16 19ZM9 12L15 12L15 14L9 14ZM10 16L14 16L14 18L10 18Z","plus-size":"M9.4 4.3a2.6 2.6 0 1 0 5.2 0a2.6 2.6 0 1 0 -5.2 0zM5 20L4 13C4 10.5 7 9.5 12 9.5C17 9.5 20 10.5 20 13L19 20Z","lift-armrest":"M5 6L8 6L8 19L5 19zM5 16L18 16L18 19L5 19zM8 12L17 12L17 14.5L8 14.5zM14 7L16 7L16 12L14 12zM12 7L18 7L15 3Z"},EP=Fy.wheelchair;var Fr=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7"],Tu="#a4508b";var Ia={facilities:Tu,"food-drink":Fr[5],navigation:Fr[2],accessibility:Fr[4]},Br=Cu,_a={minDiameterPx:12,glyphScale:.66,ringRatio:1/14,largeFromPx:24};var Fe=e=>{let t=Math.round(e*100)/100;return Object.is(t,-0)?"0":String(t)},Qn=e=>`${Fe(e[0])} ${Fe(e[1])}`,qn=(e,t,n,o)=>[e+n*Math.cos(o*Math.PI/180),t+n*Math.sin(o*Math.PI/180)];function ju(e){let t=`M${Qn(e.from)}`;for(let n of e.segs)t+=n.arc?`A${Fe(n.arc.r)} ${Fe(n.arc.r)} 0 ${n.arc.large} ${n.arc.sweep} ${Qn(n.to)}`:`L${Qn(n.to)}`;return`${t}Z`}function De(e){let t=[e.from,...e.segs.map(o=>o.to)],n=[];for(let o=e.segs.length-1;o>=0;o--){let r=e.segs[o].arc;n.push({to:t[o],arc:r&&{...r,sweep:r.sweep?0:1}})}return{from:t[t.length-1],segs:n}}function Ne(e,t,n){let o={r:n,large:0,sweep:1};return{from:[e-n,t],segs:[{to:[e+n,t],arc:o},{to:[e-n,t],arc:o}]}}function ye(e,t,n,o,r){let i=Math.min(r,n/2,o/2),a={r:i,large:0,sweep:1};return i<=0?Ge([[e,t],[e+n,t],[e+n,t+o],[e,t+o]]):{from:[e+i,t],segs:[{to:[e+n-i,t]},{to:[e+n,t+i],arc:a},{to:[e+n,t+o-i]},{to:[e+n-i,t+o],arc:a},{to:[e+i,t+o]},{to:[e,t+o-i],arc:a},{to:[e,t+i]},{to:[e+i,t],arc:a}]}}function Ge(e){let t=0;for(let o=0;o<e.length;o++){let[r,i]=e[o],[a,s]=e[(o+1)%e.length];t+=r*s-a*i}let n=t>0?e:[...e].reverse();return{from:n[0],segs:[...n.slice(1).map(o=>({to:o})),{to:n[0]}]}}function Le(e,t,n){let o=n/2,r=t[0]-e[0],i=t[1]-e[1],a=Math.hypot(r,i);if(a<1e-6)return Ne(e[0],e[1],o);let s=[i/a*o,-r/a*o],c={r:o,large:0,sweep:1},l=[e[0]+s[0],e[1]+s[1]];return{from:l,segs:[{to:[t[0]+s[0],t[1]+s[1]]},{to:[t[0]-s[0],t[1]-s[1]],arc:c},{to:[e[0]-s[0],e[1]-s[1]]},{to:l,arc:c}]}}function Ve(e,t,n=!1){let o=[],r=n?e.length:e.length-1;for(let i=0;i<r;i++)o.push(Le(e[i],e[(i+1)%e.length],t));return o}function Pt(e,t,n,o,r,i){let a=i/2,s=r-o>180?1:0,c={r:a,large:0,sweep:1},l=qn(e,t,n+a,o);return{from:l,segs:[{to:qn(e,t,n+a,r),arc:{r:n+a,large:s,sweep:1}},{to:qn(e,t,n-a,r),arc:c},{to:qn(e,t,n-a,o),arc:{r:n-a,large:s,sweep:0}},{to:l,arc:c}]}}var ge=(...e)=>e.flat().map(ju).join(" "),it=(e,t,n)=>`M${Fe(e-n)} ${Fe(t)}a${Fe(n)} ${Fe(n)} 0 1 0 ${Fe(2*n)} 0a${Fe(n)} ${Fe(n)} 0 1 0 ${Fe(-2*n)} 0`,Lt=(e,t,n,o,r)=>ju(ye(e,t,n,o,r)),Nr=e=>`M${e.map(Qn).join("L")}`,Dr=(e,t,n,o,r)=>`M${Qn(qn(e,t,n,o))}A${Fe(n)} ${Fe(n)} 0 ${r-o>180?1:0} 1 ${Qn(qn(e,t,n,r))}`;function $n(e,t,n,o=1){let r=i=>[i[0]*o+t,i[1]*o+n];return{head:[e.head[0]*o+t,e.head[1]*o+n,e.head[2]*o],limbs:e.limbs.map(i=>i.map(r)),arcs:e.arcs?.map(([i,a,s,c,l])=>[i*o+t,a*o+n,s*o,c,l])}}function Oo(e){return[it(e.head[0],e.head[1],e.head[2]),...e.limbs.map(Nr),...(e.arcs??[]).map(([t,n,o,r,i])=>Dr(t,n,o,r,i))].join(" ")}function Zn(e,t=2.6){return[Ne(e.head[0],e.head[1],e.head[2]+1),...e.limbs.flatMap(n=>Ve(n,t)),...(e.arcs??[]).map(([n,o,r,i,a])=>Pt(n,o,r,i,a,t-.2))]}var Sn={head:[10,4,2],limbs:[[[10,8.2],[10,14],[15.5,14],[18,19.5],[20.5,19.5]],[[10,10.6],[14.5,10.6]]],arcs:[[9.5,16,5.5,35,235]]},Lu={head:[10.6,3.9,1.9],limbs:[[[9.6,7.8],[7.6,12]],[[5.4,8.2],[9.4,8.4],[12.8,10]],[[4,15.6],[7.6,12],[11,13.6],[10.6,16.4]]]},ku={cx:12,hr:1.9,arm:5,leg:3,r:2},Ou={cx:12,hr:1.9,sh:2.2,hem:6,leg:3},Fu={cx:6.2,hr:1.8,arm:3.6,leg:2.2,r:1.4},Du={cx:17.8,hr:1.8,sh:1.4,hem:4.1,leg:2.2};function Nu({cx:e,hr:t,arm:n,leg:o,r}){return[it(e,2+t,t),`M${Fe(e-n+r)} 8.5H${Fe(e+n-r)}a${r} ${r} 0 0 1 ${r} ${r}V15H${Fe(e+o)}V22H${Fe(e-o)}V15H${Fe(e-n)}V${Fe(8.5+r)}a${r} ${r} 0 0 1 ${r} ${-r}Z`,`M${Fe(e)} 15V22`].join(" ")}function Bu({cx:e,hr:t,arm:n,leg:o,r}){return[Ne(e,2+t,t+1),ye(e-n-.5,7.8,2*n+1,7.7,r+.5),ye(e-o-.5,13,o,9.5,1),ye(e+.5,13,o,9.5,1)]}function Vu({cx:e,hr:t,sh:n,hem:o,leg:r}){return[it(e,2+t,t),Nr([[e-n,8.5],[e+n,8.5],[e+o,16],[e+r,16],[e+r,22],[e-r,22],[e-r,16],[e-o,16]])+"Z",`M${Fe(e)} 16V22`].join(" ")}function Gu({cx:e,hr:t,sh:n,hem:o,leg:r}){return[Ne(e,2+t,t+1),Ge([[e-n-.6,7.8],[e+n+.6,7.8],[e+o+.9,16.8],[e-o-.9,16.8]]),ye(e-r-.1,15,r-.4,7.5,.9),ye(e+.5,15,r-.4,7.5,.9)]}var Dy=[[14.6,1.5],[5.2,13.6],[11,13.6],[9.4,22.5],[18.8,10.4],[13,10.4]],Ny="M8.5 3.5 4 5.5l-1.5 5 3 1 1-2v11h11v-11l1 2 3-1-1.5-5-4.5-2c-.5 1.5-1.8 2.5-3.5 2.5s-3-1-3.5-2.5Z",By="M12 2.5S5 9.5 5 14.5a7 7 0 0 0 14 0c0-5-7-12-7-12Z",Vy="M2.5 21.5h19V3h-6v6.2H9.2v6.2H2.5Z",Hu=[[9,3],[15,3],[15,9],[21,9],[21,15],[15,15],[15,21],[9,21],[9,15],[3,15],[3,9],[9,9]],Gy={from:[3.8,5.2],segs:[{to:[20.2,5.2]},{to:[22,7],arc:{r:1.8,large:0,sweep:1}},{to:[22,9.7]},{to:[22,14.3],arc:{r:2.3,large:0,sweep:0}},{to:[22,17]},{to:[20.2,18.8],arc:{r:1.8,large:0,sweep:1}},{to:[3.8,18.8]},{to:[2,17],arc:{r:1.8,large:0,sweep:1}},{to:[2,14.3]},{to:[2,9.7],arc:{r:2.3,large:0,sweep:0}},{to:[2,7]},{to:[3.8,5.2],arc:{r:1.8,large:0,sweep:1}}]},Hy={from:[12,1.6],segs:[{to:[20.4,4.9]},{to:[20.4,11.2]},{to:[12,22.4],arc:{r:13,large:0,sweep:1}},{to:[3.6,11.2],arc:{r:13,large:0,sweep:1}},{to:[3.6,4.9]},{to:[12,1.6]}]};function zu(e,t,n){return{from:[e-n,t],segs:[{to:[e+n,t],arc:{r:n,large:0,sweep:1}},{to:[e-n,t]}]}}var Uu={head:[13.2,4.3,2.2],limbs:[[[12.6,8.6],[11.2,15],[17.8,18.4],[9.4,18.4]],[[12.4,9.8],[16,14.4]]]},zy=[[6,10.5],[15,10.5],[16.5,7],[18.5,5.5],[20,6.5],[21.5,8.5],[19.5,10],[18,12],[18,19],[16.5,19],[15.5,14],[9.5,14],[8.5,19],[7,19],[6.5,13]],Uy=[[5.4,9.8],[14.6,9.8],[16.1,6.4],[18.4,4.6],[20.5,5.9],[22.4,8.6],[19.9,10.6],[18.8,12.3],[18.8,19.8],[15.8,19.8],[15,14.8],[10.1,14.8],[9.2,19.8],[6.2,19.8],[5.6,13.2]],Ca=[{key:"restroom-men",label:"Men's restroom",group:"facilities",path:Nu(ku),solid:ge(Bu(ku))},{key:"restroom-women",label:"Women's restroom",group:"facilities",path:Vu(Ou),solid:ge(Gu(Ou))},{key:"restroom-accessible",label:"Accessible restroom",group:"facilities",path:[Lt(2.5,2.5,19,19,3.5),Oo($n(Sn,4.6,4.3,.66))].join(" "),solid:ge(Zn(Sn)),solidLarge:ge(ye(1.5,1.5,21,21,4.5),De(ye(3.9,3.9,16.2,16.2,2.6)),Zn($n(Sn,4.9,4.7,.62),2.2))},{key:"first-aid",label:"First aid",group:"facilities",path:Nr(Hu)+"Z",solid:ge(Ge(Hu.map(([e,t])=>[e+(e-12)*.08,t+(t-12)*.08])))},{key:"coat-check",label:"Coat check",group:"facilities",path:"M10 6.5a2 2 0 1 1 2 2V10 M12 10 3.4 16.9a1.4 1.4 0 0 0 .9 2.6h15.4a1.4 1.4 0 0 0 .9-2.6Z",solid:ge(Pt(12,6.2,2.2,180,450,2.3),Le([12,8.4],[12,10.5],2.3),Ve([[12,10.2],[3.2,18.8],[20.8,18.8]],2.8,!0))},{key:"atm",label:"ATM / cash",group:"facilities",path:[Lt(2,6,20,12,2),it(12,12,2.75),"M6 12h.01 M18 12h.01"].join(" "),solid:ge(ye(1.5,5.5,21,13,2.4),De(Ne(12,12,3.2)))},{key:"info",label:"Info point",group:"facilities",path:[it(12,12,9.5),"M10.8 11H12v5.8 M12 7.6h.01"].join(" "),solid:ge(Ne(12,4.9,2.4),ye(10.3,9.2,3.4,12.3,1),ye(8.2,9.2,4,3,1),ye(8.2,18.5,7.6,3,1))},{key:"lost-found",label:"Lost & found",group:"facilities",path:[it(10.5,10.5,7.5),"M16 16l5.5 5.5","M8.4 8.4a2.1 2.1 0 1 1 3 1.9c-.6.4-.9.8-.9 1.6 M10.5 14.6h.01"].join(" "),solid:ge(Pt(12,7.6,4.2,180,405,3.4),Ve([[14.97,10.57],[12,13],[12,15]],3.4),Ne(12,20,2.1))},{key:"restrooms",label:"Toilets",group:"facilities",path:[Nu(Fu),Vu(Du)].join(" "),solid:ge(Bu(Fu),Gu(Du))},{key:"charging",label:"Charging point",group:"facilities",path:[Lt(6,2,12,20,2.5),"M13.2 6.2 9.6 12h4.8l-3.6 5.8"].join(" "),solid:ge(Ge(Dy))},{key:"smoking",label:"Smoking area",group:"facilities",path:[Lt(2,14.5,14.5,4,1),"M6.5 14.5v4","M15.5 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4 M19 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4"].join(" "),solid:ge(ye(1.5,14,4.2,5,1.2),ye(6.8,14,10.4,5,1.2),Ve([[15.9,11.4],[17.3,8.9],[15.9,6.4],[17.1,3.9]],2.2),Ve([[19.6,11.4],[21,8.9],[19.6,6.4],[20.8,3.9]],2.2))},{key:"no-smoking",label:"No smoking",group:"facilities",path:[it(12,12,9.5),"M5.3 5.3l13.4 13.4","M5.5 10.5h13v3h-13Z"].join(" "),solid:ge(Ne(12,12,10.6),De(Ne(12,12,8)),Le([6,6],[18,18],2.8),ye(5,10.4,3,3.2,.6),ye(16,10.4,3,3.2,.6))},{key:"food",label:"Food",group:"food-drink",path:"M5 2.5V8a2.5 2.5 0 0 0 5 0V2.5 M7.5 2.5v19 M18.5 13.5h-2c-1.3 0-2-1-2-2.5 0-4 1.5-7 4-8.5v19",solid:ge(Ve([[4.9,2.6],[4.9,8]],2.2),Ve([[10.1,2.6],[10.1,8]],2.2),Ve([[7.5,2.6],[7.5,8]],2.2),Pt(7.5,8,2.6,0,180,2.2),Le([7.5,10],[7.5,21.4],3),Ge([[19.4,2.2],[19.4,14.2],[16.2,14.2],[14.1,12],[14.1,9.4],[15.2,5.8],[17.3,3.3]]),Le([18,13],[18,21.4],3))},{key:"bar",label:"Bar",group:"food-drink",path:"M3.5 3.5h17L12 13Z M6.2 6.5h11.6 M12 13v7.5 M8 20.5h8",solid:ge(Ge([[2.8,3],[21.2,3],[12,13.6]]),Le([12,12],[12,20.6],2.8),Le([7.4,21],[16.6,21],2.8))},{key:"coffee",label:"Caf\xE9 / coffee",group:"food-drink",path:"M4 9h12v4.5a5.5 5.5 0 0 1-5.5 5.5h-1A5.5 5.5 0 0 1 4 13.5Z M16 10.5h1.2a2.75 2.75 0 0 1 0 5.5H16 M8 3v3 M12 3v3 M3 21.5h14",solid:ge({from:[3.4,8.4],segs:[{to:[16.6,8.4]},{to:[16.6,13.4]},{to:[11,19.4],arc:{r:5.8,large:0,sweep:1}},{to:[9,19.4]},{to:[3.4,13.4],arc:{r:5.8,large:0,sweep:1}},{to:[3.4,8.4]}]},Pt(17.2,13.25,2.5,270,450,2.4),Le([7.8,2.6],[7.8,5.6],2.4),Le([12.2,2.6],[12.2,5.6],2.4),Le([2.6,21.6],[17.4,21.6],2.6))},{key:"water",label:"Water / drinks",group:"food-drink",path:By,solid:"M12 1.2S4 8.9 4 14.5a8 8 0 0 0 16 0c0-5.6-8-13.3-8-13.3Z"},{key:"merch",label:"Merch / shop",group:"food-drink",path:Ny,solid:"M8.4 2.8 3.5 5l-1.9 6 4.2 1.4.4-.8v9.4h11.6v-9.4l.4.8 4.2-1.4-1.9-6-4.9-2.2c-.4 1.5-1.8 2.6-3.6 2.6s-3.2-1.1-3.6-2.6Z"},{key:"screen",label:"Screen",group:"facilities",path:[Lt(2,3.5,20,13.5,2),"M12 17v3.5 M8 20.5h8","M10 7.8v5.9l5-2.95Z"].join(" "),solid:ge(ye(1.5,3,21,14.4,2.4),De(Ge([[9.6,6.7],[16,10.2],[9.6,13.7]])),ye(10.6,16.5,2.8,4,0),Le([7.4,21],[16.6,21],2.8))},{key:"sound-booth",label:"Sound booth",group:"facilities",path:["M6 3v9 M6 16v5 M12 3v3 M12 10v11 M18 3v10 M18 17v4",it(6,14,2),it(12,8,2),it(18,15,2)].join(" "),solid:ge(Le([6,2.8],[6,21.2],1.8),Le([12,2.8],[12,21.2],1.8),Le([18,2.8],[18,21.2],1.8),ye(3.2,11.6,5.6,4.8,1.4),ye(9.2,5.6,5.6,4.8,1.4),ye(15.2,12.6,5.6,4.8,1.4))},{key:"entrance",label:"Entrance",group:"navigation",path:"M11 7V3.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v17a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V17 M2.5 12h13.5 M12.5 8.5 16 12l-3.5 3.5",solid:ge(Ve([[11,6.5],[11,2.6],[21,2.6],[21,21.4],[11,21.4],[11,17.5]],2.6),Le([2.8,12],[13.5,12],3.2),Ge([[12.6,7.8],[18,12],[12.6,16.2]]))},{key:"exit",label:"Exit",group:"navigation",path:"M13 7V3.5a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v17a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V17 M8 12h13.5 M18 8.5l3.5 3.5-3.5 3.5",solid:ge(Ve([[13,6.5],[13,2.6],[3,2.6],[3,21.4],[13,21.4],[13,17.5]],2.6),Le([7.2,12],[17,12],3.2),Ge([[16.2,7.8],[21.6,12],[16.2,16.2]]))},{key:"emergency-exit",label:"Emergency exit",group:"navigation",path:[Oo($n(Lu,-2,1.4,1.15)),"M15.5 13h6 M19 10.5l2.5 2.5-2.5 2.5"].join(" "),solid:ge(Zn($n(Lu,-2,1.4,1.15),2.7),Le([15.6,13],[19.5,13],2.8),Ge([[18.4,9.4],[22.4,13],[18.4,16.6]]))},{key:"stairs",label:"Stairs",group:"navigation",path:Vy,solid:"M1.5 22.5h21V2h-7.8v6.4H8.4v6.4H1.5Z"},{key:"elevator",label:"Elevator",group:"navigation",path:[Lt(3.5,2.5,17,19,2.5),"M8.5 9.5 12 5.5l3.5 4Z M8.5 14.5l3.5 4 3.5-4Z"].join(" "),solid:ge(Ge([[12,1.6],[19.6,10.2],[4.4,10.2]]),Ge([[4.4,13.8],[19.6,13.8],[12,22.4]]))},{key:"parking",label:"Parking",group:"navigation",path:[Lt(3,3,18,18,3),"M9.5 17V7h3.75a3 3 0 0 1 0 6H9.5"].join(" "),solid:"M6.5 21V3H12a5.5 5.5 0 0 1 0 11h-1.9v7Z M10.1 6.6v3.8H12a1.9 1.9 0 0 0 0-3.8Z"},{key:"wheelchair",label:"Wheelchair access",group:"accessibility",path:Oo(Sn),solid:ge(Zn(Sn))},{key:"hearing",label:"Hearing assistance",group:"accessibility",path:["M4 9a6 6 0 1 1 12 0c0 3-1.8 4.3-3 5.2-1.1.8-1.6 1.7-1.6 3.1a3.6 3.6 0 0 1-6.2 2.1","M7.5 9a2.5 2.5 0 0 1 5 0c0 1.2-.7 1.9-1.6 2.5","M18.5 5.5a6.5 6.5 0 0 1 0 8"].join(" "),solid:ge(Pt(10,9,6,180,380,3),Ve([[15.64,11.05],[12.8,14.3],[11.5,17.2]],3),Pt(8.2,17.2,3.3,0,150,3),Pt(10,9,2.2,180,400,2.4),Pt(13.38,9.5,6.5,322,398,2.6))},{key:"box-office",label:"Box office / tickets",group:"navigation",path:"M3 7.5A1.5 1.5 0 0 1 4.5 6h15A1.5 1.5 0 0 1 21 7.5V10a2 2 0 0 0 0 4v2.5a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 16.5V14a2 2 0 0 0 0-4Z M15 6v2 M15 11v2 M15 16v2",solid:ge(Gy,De(ye(14.1,7,1.8,2.2,.9)),De(ye(14.1,10.9,1.8,2.2,.9)),De(ye(14.1,14.8,1.8,2.2,.9)))},{key:"escalator",label:"Escalator",group:"navigation",path:"M2.5 17H7l9-9h5.5v4h-4l-9 9h-6Z M11 4.5h.01 M11 8.2v3.3",solid:ge(Ge([[2,16.4],[6.8,16.4],[15.8,7.4],[22,7.4],[22,12.6],[17.8,12.6],[8.8,21.6],[2,21.6]]),Ne(11,4.3,2.3),Le([11,8],[11,11],2.6))},{key:"ramp",label:"Ramp",group:"navigation",path:"M2.5 19.5h19v-10Z M4.5 13.2 14 8.2 M10.53 7.76 14 8.2l-1.6 3.11",solid:ge(Ge([[1.6,20.4],[22.4,20.4],[22.4,8.6]]),Le([4.2,13.4],[13.2,8.6],2.6),Ge([[15.4,7.5],[13.16,11.84],[10.56,6.88]]))},{key:"taxi",label:"Taxi / rideshare",group:"navigation",path:["M9.5 2.5h5V5h-5Z M6.5 11 8 7h8l1.5 4",Lt(3.5,11,17,6,2),"M6.5 17v2.5 M17.5 17v2.5 M7 14h.01 M17 14h.01"].join(" "),solid:ge(ye(9,1.8,6,3.4,.8),Ge([[6,11.4],[7.6,6.4],[16.4,6.4],[18,11.4]]),ye(2.8,10.6,18.4,7,2.2),De(Ne(6.8,14,1.3)),De(Ne(17.2,14,1.3)),ye(4.8,16,3.6,5.2,1.2),ye(15.6,16,3.6,5.2,1.2))},{key:"transit",label:"Bus / transit",group:"navigation",path:[Lt(4.5,2.5,15,16,3),"M4.5 10.5h15 M9 5.5h6 M7.5 18.5V21 M16.5 18.5V21 M8 14.5h.01 M16 14.5h.01"].join(" "),solid:ge(ye(4,2,16,17,3.2),De(ye(6.2,5.8,11.6,5,1)),De(Ne(8,14.5,1.3)),De(Ne(16,14.5,1.3)),ye(6,17,3.4,5,1.2),ye(14.6,17,3.4,5,1.2))},{key:"bike-parking",label:"Bike parking",group:"navigation",path:[it(6,14.5,4),it(18,14.5,4),"M6 14.5 9 7.5h6.5L18 14.5 M9 7.5l2.5 7H6 M11.5 14.5l4-7 M7.5 6h3 M15.5 7.5 15 5.5h2"].join(" "),solid:ge(Ne(6,14.5,4.9),De(Ne(6,14.5,2.7)),Ne(18,14.5,4.9),De(Ne(18,14.5,2.7)),Ve([[6,14.5],[9,7.5],[15.5,7.5],[18,14.5]],2.2),Ve([[9,7.5],[11.5,14.5],[15.5,7.5]],2.2),Le([6,14.5],[11.5,14.5],2.2),Le([7.2,5.8],[10.6,5.8],2.2),Ve([[15.4,7.3],[15,5.4],[17.2,5.4]],2.2))},{key:"meeting-point",label:"Meeting point",group:"navigation",path:["M9.5 2.5 12 5l2.5-2.5 M9.5 21.5 12 19l2.5 2.5 M2.5 9.5 5 12l-2.5 2.5 M21.5 9.5 19 12l2.5 2.5",it(10,9.6,1.5),it(14,9.6,1.5),"M7.5 15.5a2.5 2.5 0 0 1 5 0 M11.5 15.5a2.5 2.5 0 0 1 5 0"].join(" "),solid:ge(Ve([[9.4,2.4],[12,5],[14.6,2.4]],2.6),Ve([[9.4,21.6],[12,19],[14.6,21.6]],2.6),Ve([[2.4,9.4],[5,12],[2.4,14.6]],2.6),Ve([[21.6,9.4],[19,12],[21.6,14.6]],2.6),Ne(9.7,9.3,2.2),Ne(14.3,9.3,2.2),zu(9.7,16,3),zu(14.3,16,3))},{key:"security",label:"Security / bag check",group:"facilities",path:"M12 2.5 19.5 5.5v6c0 4.6-3.2 8.4-7.5 10-4.3-1.6-7.5-5.4-7.5-10v-6Z M8.5 12l2.5 2.5 4.5-5",solid:ge(Hy,De(Ge([[7.4,12.2],[9,10.6],[10.9,12.5],[15,8.4],[16.6,10],[10.9,15.7]])))},{key:"lockers",label:"Lockers",group:"facilities",path:[Lt(3.5,2.5,17,19,1.5),"M12 2.5v19 M6 6h3 M15 6h3 M9.5 11.5v2.5 M14.5 11.5v2.5"].join(" "),solid:ge(ye(3,2,8.4,20,1.4),De(ye(5,5,4.4,1.7,.8)),De(ye(8.6,10.8,1.5,3.8,.7)),ye(12.6,2,8.4,20,1.4),De(ye(14.6,5,4.4,1.7,.8)),De(ye(13.9,10.8,1.5,3.8,.7)))},{key:"baby-change",label:"Baby change",group:"facilities",path:"M10 6.5l.8-3.3a1.2 1.2 0 0 1 2.4 0l.8 3.3 M8.5 6.5h7 M9.5 6.5l-.9 2.2a3 3 0 0 0-.1.9V19a2.5 2.5 0 0 0 2.5 2.5h2a2.5 2.5 0 0 0 2.5-2.5V9.6a3 3 0 0 0-.1-.9l-.9-2.2 M8.5 12.5h3 M8.5 16h3",solid:ge(Ge([[9.6,6.2],[10.6,1.8],[13.4,1.8],[14.4,6.2]]),ye(7.6,5.4,8.8,2.6,1),ye(7.8,7.4,8.4,15,2.6),De(ye(7.8,11.8,3.4,1.5,0)),De(ye(7.8,15.4,3.4,1.5,0)))},{key:"prayer-room",label:"Prayer room",group:"facilities",path:[Oo(Uu),"M3 21.5h18"].join(" "),solid:ge(Zn(Uu),ye(2.4,20.2,19.2,2.6,1.3))},{key:"quiet-room",label:"Quiet room",group:"facilities",path:"M4 9h3.5l5-4v14l-5-4H4Z M15.5 9.5l5 5 M20.5 9.5l-5 5",solid:ge(Ge([[2.6,8.4],[7.2,8.4],[13,3.6],[13,20.4],[7.2,15.6],[2.6,15.6]]),Le([15.4,9.2],[20.8,14.8],2.8),Le([20.8,9.2],[15.4,14.8],2.8))},{key:"wifi",label:"Wi-Fi",group:"facilities",path:[Dr(12,19,11.5,218,322),Dr(12,19,7.5,218,322),Dr(12,19,3.5,218,322),"M12 19h.01"].join(" "),solid:ge(Pt(12,19.2,11,218,322,2.8),Pt(12,19.2,6.9,218,322,2.8),Ne(12,19.2,2.2))},{key:"vip-lounge",label:"VIP lounge",group:"facilities",path:["M6.5 11V7a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v4","M3.5 11.5a1.5 1.5 0 0 1 3 0V14h11v-2.5a1.5 1.5 0 0 1 3 0v6h-17Z","M5.5 17.5V20 M18.5 17.5V20"].join(" "),solid:ge(ye(6,4,12,8.5,2.2),ye(2.4,9.6,4.6,9,2.2),ye(17,9.6,4.6,9,2.2),ye(6,13.2,12,5.4,.6),Le([5,18],[5,20.6],2.4),Le([19,18],[19,20.6],2.4))},{key:"accessible-entrance",label:"Accessible entrance",group:"accessibility",path:[Oo($n(Sn,.3,5,.62)),"M12.5 3.5H20a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1h-7.5"].join(" "),solid:ge(Zn($n(Sn,.3,5,.62),2.2),Ve([[13,2.8],[21.2,2.8],[21.2,21.2],[13,21.2]],2.6))},{key:"assistance-dog",label:"Assistance-dog area",group:"accessibility",path:[Nr(zy)+"Z","M6 10.8 3.5 7.5","M10.5 10.5V6h4.5l1 2.5"].join(" "),solid:ge(Ge(Uy),Le([6.2,11],[3.2,7.2],2.4),Ve([[10.5,11],[10.5,5.6],[15.2,5.6],[16.2,8.2]],2.2))}],LP=new Map(Ca.map(e=>[e.key,e]));var Wu=Ca;var jy=new Map(Wu.map(e=>[e.key,e]));function Fo(e){return e?jy.get(e):void 0}var DP=Wu.map(e=>e.key);function Do(e){if(e.length<3)return e.map(n=>({...n}));let t=zn(e);return t.length>=3?t:[...e].sort((n,o)=>n.x-o.x||n.y-o.y).map(n=>({...n}))}var Wy=.8,Xy=.6,Ky=2;function Jt(e,t){if(!t.length)return null;let n=[],o=0;for(let a of e.objects){if(a.type!=="shape"||a.role!=="wall")continue;let s=Me(a)??[],c=Xu(s)/2;!(c>0)||Zy(s)/c*C>Ky||(n.push(...s),o+=c)}if(n.length<3)return null;let r=Do(n);if(r.length<3||o<Xu(r)*Xy)return null;let i=0;for(let a of t)qy(a,r)&&(i+=1);return i>=t.length*Wy?r:null}var Vr=6,Yy=5,$y=8;function Ku(e){return Math.max($y,(Number.isFinite(e)?e:0)+Yy)}function Jn(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r++){let i=e[r],a=e[(r+1)%e.length],s=i.x*a.y-a.x*i.y;t+=s,n+=(i.x+a.x)*s,o+=(i.y+a.y)*s}if(Math.abs(t)<1e-9){let r=0,i=0;for(let a of e)r+=a.x,i+=a.y;return{x:r/Math.max(1,e.length),y:i/Math.max(1,e.length)}}return{x:n/(3*t),y:o/(3*t)}}function Zy(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2}function Xu(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=Math.hypot(r.x-o.x,r.y-o.y)}return t}function qy(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function Yu(e,t,n,o=[],r){if(t<1)return null;let i=1/0,a=-1/0,s=1/0,c=-1/0,l=-1/0,u=(M,A)=>{M<i&&(i=M),M>a&&(a=M),A<s&&(s=A),A>c&&(c=A)};for(let M=0;M<t;M++)u(e[M*3],e[M*3+2]),e[M*3+1]>l&&(l=e[M*3+1]);for(let[M,A]of o)u(M,A);if(!Number.isFinite(i)||!Number.isFinite(l))return null;let m=(i+a)/2,f=(s+c)/2,h=Math.max(4,(a-i)/2),d=Math.max(4,(c-s)/2),p=1,b=(M,A)=>{let w=Math.hypot((M-m)/h,(A-f)/d);w>p&&(p=w)};for(let M=0;M<t;M++)b(e[M*3],e[M*3+2]);for(let[M,A]of o)b(M,A);let x=Math.min(9,Math.max(5,2*Math.max(h,d)*.1)),y=Math.max(n+8,l+x);return{centre:[m,f],radii:[h*p+6,d*p+6],floorY:n,ceilingY:r===void 0?y:Math.max(r,l+5)}}function Qy(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let o=t-e.x,r=n-e.y,i=Math.hypot(o,r);return i<1e-9?[0,0]:[o/i,r/i]}}}function Jy(e,t){if(!e.length)return null;let n=0,o=0,r=0;for(let h of e)n+=h.x,o+=h.y,r+=Math.hypot(h.x-t.x,h.y-t.y);let i=e.length;n/=i,o/=i,r/=i;let a=e[0],s=-1;for(let h of e){let d=Math.hypot(h.x-n,h.y-o);d>s&&(s=d,a=h)}let c=a.x-n,l=a.y-o,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let m=[...e].sort((h,d)=>(h.x-n)*c+(h.y-o)*l-((d.x-n)*c+(d.y-o)*l)),f=0;for(let h of m){let d=Math.hypot(h.x-n,h.y-o);d>f&&(f=d)}return{pts:m,cx:n,cy:o,radius:f,depth:r}}function $u(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let r=1/0;for(let i=0;i+1<o.length;i++){let a=o[i],s=o[i+1],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,m=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;m<0?m=0:m>1&&(m=1);let f=Math.hypot(t-(a.x+m*c),n-(a.y+m*l));f<r&&(r=f)}return r}var Gr=8;function eg(e,t,n){let o=new Array(Gr).fill(1/0),r=new Array(Gr).fill(-1);for(let u=0;u<e.length;u++){let m=e[u],f=Math.hypot(t-m.cx,n-m.cy)-m.radius;for(let h=0;h<Gr;h++)if(f<o[h]){for(let d=Gr-1;d>h;d--)o[d]=o[d-1],r[d]=r[d-1];o[h]=f,r[h]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of r){if(u<0)continue;let m=$u(e[u],t,n);for(let f=0;f<3;f++)if(m<i[f]){for(let h=2;h>f;h--)i[h]=i[h-1],a[h]=a[h-1];i[f]=m,a[f]=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 m=a[u];if(m<0||i[u]>s)continue;let f=1/(i[u]*i[u]);c+=f*e[m].depth,l+=f}return l>0?c/l:e[a[0]].depth}function tg(e){let t=(o,r)=>eg(e,o,r),n=(o,r)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(o-c.cx,r-c.cy)-c.radius>=i)continue;let l=$u(c,o,r);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,r)=>{let i=(t(o+.5,r)-t(o-.5,r))/1,a=(t(o,r+.5)-t(o,r-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function Zu(e,t){let n=[];for(let o of e){let r=Jy(o.points,t);r&&n.push(r)}return n.length<2?Qy(t):(n.sort((o,r)=>o.depth-r.depth),tg(n))}var en=.06,ng=.05,Qu=.05,qu=.15,Ta=25;function Ju(e,t,n){let o=new Map,r=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 f=0;f<e.length;f+=1){let h=e[f];for(let d of h.objects){if(d.type==="table"&&u.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let p=Tt(d.outline,yt);c.set(d.id,{section:d,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:d.id,floorIndex:f,box:zt(p),section:d,unit:h,outline:p})}}let m=new Map;for(let f of l){let h=m.get(f.floorIndex);h?h.push(f):m.set(f.floorIndex,[f])}for(let f=0;f<t.length;f++){let h=t[f],d=n?m.get(n[f])??[]:l,p=h.sectionId?d.find(x=>x.id===h.sectionId)??d.find(x=>x.section.logicalSectionId===h.sectionId&&Ke({x:h.x,y:h.y},x.outline,x.section.holes)):void 0,b=p?[p]:d;for(let x of b){if(n&&x.floorIndex!==n[f]||!p&&(h.x<x.box.minX||h.x>x.box.maxX||h.y<x.box.minY||h.y>x.box.maxY||!Ke({x:h.x,y:h.y},x.outline,x.section.holes)))continue;r[f]=x.id;let y=c.get(x.id);y.hasSeats=!0;let M=h.focalPoint??x.unit.focal,A=Math.hypot(h.x-M.x,h.y-M.y);A<y.frontU&&(y.frontU=A),y.seatIndices.push(f);let w=h.rowId||`__seat-${f}`,g=y.rows.get(w);g?g.push({x:h.x,y:h.y}):y.rows.set(w,[{x:h.x,y:h.y}]);break}}for(let[f,h]of c){let d=$t(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,b=d.rake>0?Math.tan(d.rake*Math.PI/180):0,x=d.rake<=.01&&d.height<=p+.001,y=h.section.surfaceKind,M=y==="flat"?!0:y==="rakedRows"&&d.rake>.01?!1:x,A=h.hasSeats?wr(f,t,h.seatIndices,h.unit.focal):{sectionId:f,rows:[],blockCount:0},g=A.rows.length<2?Zu([...h.rows.values()].map(O=>({points:O})),h.unit.focal):null,S=1/0;if(g){if(h.hasSeats)for(let O of h.rows.values())for(let V of O){let z=g.depthAt(V.x,V.y);z<S&&(S=z)}if(!h.hasSeats||!Number.isFinite(S)){S=1/0;for(let O of h.section.outline){let V=g.depthAt(O.x,O.y);V<S&&(S=V)}}}let v=p+ng,P=Math.max(v,d.height),E=O=>{let V=Math.max(0,O-S)*he,z=Math.min(V*b,Ta);return Math.max(v,d.height+z)},k=O=>{let V=Math.max(0,O)*he,z=Math.min(V*b,Ta);return Math.max(v,d.height+z)},L=M?[]:A.rows.map(O=>({pts:O.pts,y:k(O.blockDepth),depth:O.blockDepth,blockId:O.blockId,...u.has(O.id)?{patch:Hl(O.pts,yt)}:{}})),I=L.length?L[0].y:P,R=L.map(O=>{let V=O.patch&&O.patch.length>=3?O.patch:O.pts,z=0,G=0;for(let W of V)z+=W.x,G+=W.y;let T=V.length||1;z/=T,G/=T;let D=0;for(let W of V){let H=Math.hypot(W.x-z,W.y-G);H>D&&(D=H)}return{cx:z,cy:G,rad:D}}),_=M?()=>P:L.length>=2?(O,V)=>{let z=1/0,G=I;for(let T=0;T<L.length;T++){let D=R[T];if(Math.hypot(O-D.cx,V-D.cy)-D.rad>=z)continue;let W=L[T].patch,H=W&&W.length>=3?Ze(W,O,V)?0:Bn(W,O,V):Bn(L[T].pts,O,V);H<z&&(z=H,G=L[T].y)}return G}:(O,V)=>g?E(g.depthAt(O,V)):P,F=[0,1,0],N=L.length>=2||M?()=>F:(O,V)=>{if(!g)return F;let z=g.depthAt(O,V);if(z<=S)return F;let G=(z-S)*he;if(G*b>=Ta||d.height+G*b<=v)return F;let[T,D]=g.gradientAt(O,V);if(T===0&&D===0)return F;let W=1/Math.hypot(b,1);return[-T*b*W,W,-D*b*W]};if(!M)for(let O of A.rows){let V=k(O.blockDepth);for(let z of O.seatIndices)a[z]=V}for(let O of A.rows){let V=[];for(let W=1;W<O.pts.length;W++){let H=Math.hypot(O.pts[W].x-O.pts[W-1].x,O.pts[W].y-O.pts[W-1].y);H>1e-6&&V.push(H)}V.sort((W,H)=>W-H);let z=V.length?V[Math.floor(V.length/2)]:1/0,G=1/0,T=O.pts[Math.floor(O.pts.length/2)];if(T)for(let W of A.rows){if(W===O||W.blockId!==O.blockId)continue;let H=Bn(W.pts,T.x,T.y);H>1e-6&&H<G&&(G=H)}let D=Math.min(z,Math.max(G,z*.5));if(Number.isFinite(D)&&D>0)for(let W of O.seatIndices)s[W]=D}o.set(f,{sectionId:f,deckAt:_,normalAt:N,flat:M,bottomY:p,rowLevels:L,landingY:I})}for(let f=0;f<t.length;f++){let h=r[f],d=t[f];if(h){let x=a[f];i[f]=(x??o.get(h).deckAt(d.x,d.y))+qu;continue}let p=d.eyeHeightM,b=Number.isFinite(p)?Math.max(0,p-_t):0;i[f]=d.kind==="booth"?b+en+qu:b}return{bySection:o,seatOwner:r,seatDeckY:f=>i[f],seatPitchU:f=>s[f]}}function eo(e,t,n){if(e.length!==4||n<=t)return null;let o=ft(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*C,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*C;if(r<1e-6||i<1e-6)return null;let a=Math.min(.22/r,.16),s=Math.min(.28,(n-t)*.13),c=Math.min(.065/i,.2);return{quad:o,side:a,face:c,opening:nt(o,a,1-a),openingTop:n-s}}function La(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=ft(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*C;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),a=i/r,s=nt(o,a,1-a);return{quad:o,side:a,trim:i,inner:s,panel:Eo(s,.15,.85),bottom:t+i,top:n-i}}function em(e,t,n,o){let r=La(e,t,n);if(!r)return;let{panel:i}=r,a=(y,M)=>({x:(y.x+M.x)/2,y:(y.y+M.y)/2}),s=a(i[0],i[1]),c=a(i[3],i[2]),l=Math.hypot(s.x-o.x,s.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[u,m]=l?[i[0],i[1]]:[i[3],i[2]],f=l?{x:s.x-c.x,y:s.y-c.y}:{x:c.x-s.x,y:c.y-s.y},h=Math.hypot(f.x,f.y);if(h<1e-6)return;-(m.y-u.y)*f.x+(m.x-u.x)*f.y<0&&([u,m]=[m,u]);let d=Math.min(.006,h*C*.05),p=f.x/h*d,b=f.y/h*d,x=(y,M)=>[y.x*C+p,M,y.y*C+b];return[x(u,r.bottom),x(m,r.bottom),x(u,r.top),x(m,r.top)]}var nm=Et(require("polygon-clipping"),1);var tm=Et(require("polygon-clipping"),1);function jt(e,t,n,o,r,i,a,s={}){let c=zt(t),l=s.ao??oe,u=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let b=Me(p);if(!b||b.length!==4||!Hn(c,zt(b)))return[];let x=s.portalBase??n,y=eo(b,x,x+St(p).heightM);if(!y)return[];let M=Math.min(o,y.openingTop);return M<=n?[]:[{poly:y.opening,height:M}]});if(!u.length)return!1;let m=p=>p.map(b=>[b.x,b.y]),f=[m(t),...(s.holes??[]).map(m)],h=[n,...new Set(u.map(p=>p.height)),o].sort((p,b)=>p-b),d=[];try{for(let p=1;p<h.length;p++){let b=h[p-1],x=h[p];if(x-b<1e-6)continue;let y=u.filter(A=>A.height>b+1e-6).map(A=>[m(A.poly)]),M=y.length?tm.default.difference(f,...y):[f];d.push({low:b,high:x,polys:M})}}catch{return!1}for(let p of d)for(let b of p.polys){let[x,...y]=b.map(A=>A.map(([w,g])=>({x:w,y:g}))),M=A=>l.wallBottom+(l.top-l.wallBottom)*(A-n)/(o-n);ie(e,x,y,()=>p.high,p.low,i,a,{...l,top:M(p.high),wallBottom:M(p.low)})}return!0}var ka={depthM:1.6,thicknessM:.35,minWallM:6};function Hr(e,t,n,o,r,i,a,s,c){let l=o-n;if(l<=0)return;let u=s&&(c??l)>=ka.minWallM?og(t,s):null,m=u?o-ka.thicknessM:o,f=m-n,h=f<1.5?[[n,m,1]]:u?[[n,n+Math.min(.9,f*.18),.82],[n+Math.min(.9,f*.18),m,1]]:[[n,n+Math.min(.9,f*.18),.82],[n+Math.min(.9,f*.18),m-.1,1],[m-.1,m,1.1]],d=p=>oe.wallBottom+(oe.top-oe.wallBottom)*(p-n)/l;for(let[p,b,x]of h){let y={...oe,top:d(b),wallBottom:d(p)},M=re(i,x),A=re(a,x);jt(e,t,p,b,r,M,A,{portalBase:n,ao:y})||ie(e,t,void 0,()=>b,p,M,A,y)}for(let[p,...b]of u??[])ie(e,p,b.length?b:void 0,()=>o,m,re(i,1.12),re(a,.78),oe)}function og(e,t){let n=ka.depthM/C,o=e.map(a=>{let s=t.x-a.x,c=t.y-a.y,l=Math.hypot(s,c)||1;return{x:a.x+s/l*n,y:a.y+c/l*n}}),r=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s},i=[[r(e)],[r(o)]];for(let a=0;a<e.length;a++){let s=(a+1)%e.length;i.push([r([e[a],e[s],o[s],o[a]])])}try{let[a,...s]=i,c=nm.default.union(a,...s);return c.length?c.map(l=>l.map(u=>u.slice(0,-1).map(([m,f])=>({x:m,y:f})))):null}catch{return null}}function om(e){return e.route?.stepFree===!0&&(e.kind==="line"||e.kind==="polyline")}function rm(e){let t=Number.isFinite(e)&&e>0?e:4;return[Math.max(6,t*2.6),Math.max(4,t*1.7)]}function im(e,t,n){let o=[];if(e.length<2||!(t>0)||!(n>=0))return o;let r=!0,i=t;for(let a=0;a<e.length-1;a+=1){let s=e[a],c=e[a+1],l=Math.hypot(c.x-s.x,c.y-s.y);if(l<1e-9)continue;let u=(c.x-s.x)/l,m=(c.y-s.y)/l,f=0;for(;f<l-1e-9;){let h=Math.min(i,l-f);r&&o.push([{x:s.x+u*f,y:s.y+m*f},{x:s.x+u*(f+h),y:s.y+m*(f+h)}]),f+=h,i-=h,i<=1e-9&&(r=!r,i=r?t:n)}}return o}function No(e,t,n){let o=ve(t.stroke?.color),r=t.stroke?.width??0;if(!o||!Number.isFinite(r)||r<=0)return;let i=t.kind==="line"||t.kind==="polyline",a=i?jn(t.points??[],t.rotation):Me(t);if(!a||a.length<2)return;let s=r*.5,c=om(t)?im(a,...rm(r)):Array.from({length:i?a.length-1:a.length},(l,u)=>[a[u],a[(u+1)%a.length]]);for(let[l,u]of c){let m=Math.hypot(u.x-l.x,u.y-l.y);if(m<1e-6)continue;let f=-(u.y-l.y)/m*s,h=(u.x-l.x)/m*s,d=[(l.x+f)*C,n,(l.y+h)*C],p=[(u.x+f)*C,n,(u.y+h)*C],b=[(u.x-f)*C,n,(u.y-h)*C],x=[(l.x-f)*C,n,(l.y-h)*C];e.tri(d,p,b,[0,1,0],o),e.tri(d,b,x,[0,1,0],o)}}function am(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var to=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function zr(e,t,n,o){let[r,i,a,s]=t?e:[e[3],e[2],e[1],e[0]];return[to(r,s,n),to(i,a,n),to(i,a,o),to(r,s,o)]}function sm(e,t,n,o,r,i,a,s,c=!1){if(n.length!==4||r-o<.4)return!1;let l=v=>c?Math.min(v,r):v,u=ft(n),m=Math.hypot(u[3].x-u[0].x,u[3].y-u[0].y)*C;if(m<.4)return!1;let f=to(u[0],u[1],.5),h=to(u[3],u[2],.5),d=Math.hypot(f.x-s.x,f.y-s.y)<=Math.hypot(h.x-s.x,h.y-s.y),p=Se(a,[.92,.9,.86],.35),b=re(i,.72),x=r-o;if(t==="restroom"){let v=Math.min(.18,x*.08);return we(e,u,r-v,o,a,i),we(e,u,r,r-v,p,p),!0}let y=o+Math.min(1.1,x),M=t==="coat"?1:Math.min(.5,.75/m),A=zr(u,d,0,M);if(we(e,A,y-.05,o,b,i),we(e,A,y,y-.05,p,p),t==="coat"||m<1.2)return!0;if(t==="bar"){let v=zr(u,d,Math.max(M+.2,1-.45/m),1),P=l(o+Math.max(Math.min(2.2,x*2),y-o+.6));return we(e,v,P,o,a,b),!0}let w=zr(u,d,Math.max(M+.25,.55),1),g=l(o+Math.max(2.6,y-o+1.4));if(g-.14<=y)return!0;we(e,w,g-.14,o,a,i),we(e,u,g,g-.14,p,b);let S=Math.min(.08,.1/Math.max(.1,Math.hypot(u[1].x-u[0].x,u[1].y-u[0].y)*C));for(let[v,P]of[[0,S],[1-S,1]])we(e,zr(nt(u,v,P),d,0,Math.min(.08,.1/m)),g-.14,y,b,b);return!0}var Wr=[.19,.4,.15],rg=.012,Kr=2.4,ig=1,ag=.75,sg=.15;function At(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:r}=e;if(!n||!o)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=o/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,m])=>({x:t.x+u*a-m*s,y:t.y+u*s+m*a}))}function hm(e,t,n,o,r,i,a=!1){let s=At(t);if(s){if(a){let c=xn(o,r.boothTop),l=Ct([...s]);ie(e,Tt(l,cg/C),[l.slice().reverse()],()=>n+.03,n,c,re(c,.8),oe);return}if(!(!t.points&&i&&ug(e,s,n,o,i))){if(!t.points&&i&&s.length===4){lg(e,s,n,o,i);return}ie(e,s,void 0,()=>n+Kr,n,xn(o,r.boothTop),r.boothWall,oe)}}}var Oa=1.1,cm=[.9,.9,.88],cg=.1,Ur=[.87,.87,.85],lm=.08;function dm(e,t){let n=c=>({x:(e[c].x+e[(c+1)%4].x)/2,y:(e[c].y+e[(c+1)%4].y)/2}),o=0,r=1/0;for(let c=0;c<4;c++){let l=n(c),u=Math.hypot(l.x-t.x,l.y-t.y);u<r&&(r=u,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),a=(c,l,u)=>({x:c.x+(l.x-c.x)*u,y:c.y+(l.y-c.y)*u});return{q:i,part:(c,l,u,m)=>{let f=a(i[0],i[1],c),h=a(i[0],i[1],l),d=a(i[3],i[2],c),p=a(i[3],i[2],l);return[a(f,d,u),a(h,p,u),a(h,p,m),a(f,d,m)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*C,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*C}}function lg(e,t,n,o,r){let{q:i,part:a}=dm(t,r),s=o??[.35,.42,.55],c=Se(s,[.78,.78,.77],.62),l=Se(s,[.95,.95,.94],.45);we(e,i,n+en,n,c,re(c,.8)),we(e,a(.05,.95,.72,.98),n+Oa-.05,n+en,l,re(l,.8)),we(e,a(.03,.97,.7,1),n+Oa,n+Oa-.05,cm,re(cm,.9))}function ug(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:a,depthM:s,widthM:c}=dm(t,r);if(s<1||c<1)return!1;let l=o??[.35,.42,.55],u=Se(l,[.78,.78,.77],.62),m=n+Kr,f=lm/c,h=lm/s;we(e,i,n+en,n,u,re(u,.8)),we(e,a(0,1,1-h,1),m,n+en,Ur,re(Ur,.9));for(let[b,x]of[[0,f],[1-f,1]])we(e,a(b,x,0,1-h),m,n+en,Ur,re(Ur,.9));we(e,a(f,1-f,0,Math.min(.5,.06/s)),m,m-.3,l,re(l,.85));let d=Math.min(.4,.6/c),p=Math.min(.12,.3/s);return we(e,a(.5-d,.5+d,.72-p,.72+p),n+ig,n+en,Se(l,[.95,.95,.94],.7),re(l,.75)),!0}function Yr(e){if(e.shape==="round"){let u=e.radius;return u?Mr(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:o,center:r}=e;if(!t||!n)return null;let i=(o??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,m])=>({x:r.x+u*a-m*s,y:r.y+u*s+m*a}))}function pm(e,t,n,o,r,i=!0){let a=Yr(t);if(!a)return;let s=a.reduce((d,p)=>d+p.x,0)/a.length,c=a.reduce((d,p)=>d+p.y,0)/a.length,l=d=>a.map(p=>({x:s+(p.x-s)*d,y:c+(p.y-c)*d})),u=Vt(r)?1:hg,m=i&&o?xn(o,r.tableTop):re(mg,u),f=re(fg,u),h=n+ag;ie(e,a,void 0,()=>h,n+dg,m,re(m,.86),oe),ie(e,l(.12),void 0,()=>h+.12,h,f,re(f,.8),oe)}var mg=[.93,.92,.89],fg=[.78,.66,.42],hg=.62,dg=.25,Bo={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function pg(e,t,n){let o=e.reduce((x,y)=>x+y.x,0)/4,r=e.reduce((x,y)=>x+y.y,0)/4,i=e[3].x-e[0].x,a=e[3].y-e[0].y,s=Math.hypot(i,a)||1;i/=s,a/=s,i*(t.x-o)+a*(t.y-r)<0&&(i=-i,a=-a);let c=-a,l=i,u=Bo.armM/C,m=Bo.widthM/C,f=s/2+Bo.insideM/C,h=n?-1:1,d=o+i*(f+(n?0:u)),p=r+a*(f+(n?0:u)),b=(x,y)=>({x:d+i*x*h+c*y,y:p+a*x*h+l*y});return[b(0,0),b(-u,u),b(-u-m,u),b(-m,0),b(-u-m,-u),b(-u,-u)]}function bg(e,t,n,o,r){let i=[.94,.95,.96];ie(e,pg(t,o,r),void 0,()=>n+Bo.high,n+Bo.low,i,i,oe)}function Xr(e,t){let n=ve(e);return n?{top:re(It(n,.12),.95),wall:re(It(n,.12),.85)}:{top:t.tierTop,wall:t.tierWall}}function bm(e,t,n,o,r,i,a,s,c=[]){let l=Me(t),u=Jl(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!l){No(e,t,n+o+rg);return}let f=s?s.kind==="stage":t.role==="stage",h=s?s.kind==="screen":t.role==="screen",d=s?{kind:f?"stage":"solid",heightM:s.topY-s.baseY}:St(t),p=s?.baseY??n,b=s?.topY??n+o,x=null;if(f&&a){let I=1/0,R=-1/0,_=1/0,F=-1/0;for(let N of l)N.x<I&&(I=N.x),N.x>R&&(R=N.x),N.y<_&&(_=N.y),N.y>F&&(F=N.y);x={cx:(I+R)/2*C,cz:(_+F)/2*C,y:b,halfX:Math.max((R-I)/2*C,.5),halfZ:Math.max((F-_)/2*C,.5)},a.push(x)}let y=ve(t.fill),M=t.role==="wall"||t.role==="entrance"||t.role==="exit",A=M?Xr(t.fill,r).top:f&&y?Se(r.stageTop,re(It(y,.18),.9),.9):!t.role&&y?y:xn(y,f?r.stageTop:r.decorTop),w=h?y:null,g=M?Xr(t.fill,r).wall:f?y?Se(r.stageWall,re(y,.58),.82):r.stageWall:h?w?Se(re(w,1.42),[.24,.46,.82],.08):[.24,.46,.82]:xn(ve(t.fill),r.decorWall),S=f&&Vt(r)?hn(!0):null,v=S?fm(A,S.stageTop):A,P=S?fm(g,S.stageWall):g;if(x&&(x.top=v),t.role==="wall"&&!s){Hr(e,l,p,b,c,v,P,i),No(e,t,b+.012);return}if(h&&l.length===4&&b-p>.2){let I=La(l,p,b);if(!I)return;let{quad:R,side:_,trim:F,inner:N,panel:O}=I,V=[.12,.15,.18];for(let[z,G]of[[0,_],[1-_,1]])we(e,nt(R,z,G),b,p,V,V);we(e,N,p+F,p,V,V),we(e,N,b,b-F,V,V),we(e,O,b-F,p+F,P,P),No(e,t,b+.012);return}let E=y?re(It(y,.15),.82):P,k=y?re(It(y,.1),1.02):v;if(am(t.role)&&!s&&sm(e,t.role,l,p,b,E,k,i,t.heightM!==void 0))return;if((t.role==="sound"||s?.kind==="sound_desk")&&l.length===4&&b-p>.3){let I=ft(l),R=Math.hypot(I[1].x-I[0].x,I[1].y-I[0].y)*C,_=Math.min(.12,.09/Math.max(R,.001)),F=[.18,.21,.24],N=b-Math.min(.12,(b-p)*.15);for(let[O,V]of[[0,_],[1-_,1]])we(e,nt(I,O,V),N,p,F,F);we(e,I,b,N,v,F);return}if(t.role==="rail"&&l.length===4&&b>p){let I=ft(l),R=Math.hypot(I[1].x-I[0].x,I[1].y-I[0].y)*C,_=Math.max(1,Math.min(128,Math.ceil(R/1.4))),F=Math.min(.08,.055/Math.max(.055,R)),N=[.58,.64,.66];for(let O=0;O<=_;O++){let V=O/_,z=Math.min(1-F,Math.max(0,V-F/2));we(e,nt(I,z,z+F),b,p,N,re(N,.8))}for(let O of[.52,1]){let V=p+(b-p)*O;we(e,I,V,Math.max(p,V-.055),N,re(N,.8))}return}if(t.role==="goal"&&l.length===4){yu(e,ft(l),i,p,b),e.setMaterial(0);return}if(d.kind==="portal"&&l.length===4){let I=eo(l,p,b);if(!I)return;let{quad:R,side:_,face:F,openingTop:N}=I;for(let[O,V,z]of[[0,F,1],[F,1-F,.67],[1-F,1,1]]){let G=Eo(R,O,V),T=re(v,z),D=re(P,z);for(let[W,H]of[[0,_],[1-_,1]])we(e,nt(G,W,H),N,p,T,D);we(e,G,b,N,T,D)}(t.role==="entrance"||t.role==="exit")&&bg(e,R,p,i,t.role==="exit");return}if(d.kind==="suite"&&l.length===4){let I=l.map((F,N)=>{let O=l[(N+1)%4],V=(F.x+O.x)/2,z=(F.y+O.y)/2;return Math.hypot(V-i.x,z-i.y)}),R=I.indexOf(Math.min(...I)),_=[0,1,2,3].map(F=>l[(R+F)%4]);we(e,nt(_,0,.08),b,p,v,P),we(e,nt(_,.92,1),b,p,v,P),we(e,Eo(_,.88,1),b,p,v,P),we(e,_,b,Math.max(p,b-.18),v,P);return}if(f&&!t.stageKind?.startsWith("pitch-")&&b-p>.12){let I=b-Math.min(.06,(b-p)*.15);we(e,l,I,p,v,P,u),we(e,l,b,I,v,Se(v,P,.2),u)}else we(e,l,b,p,v,P,u);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&l.length===4){e.setMaterial(4);let I=ft(l),R=Se(y??Wr,Wr,y?.45:0);for(let _=0;_<12;_++){let F=nt(I,_/12,(_+1)/12),N=re(R,_%2?1.09:.91),O=F.map(V=>[V.x*C,b+.006,V.y*C]);e.tri(O[0],O[1],O[2],[0,1,0],N),e.tri(O[0],O[2],O[3],[0,1,0],N)}}t.stageKind&&t.stageKind!=="pitch-football"&&Ru(e,l,t.stageKind,b,y,t),f&&vt(t.stageKind)&&Au(e,t,b),e.setMaterial(h?1:0),No(e,t,b+.012)}function $r(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,a=n+r/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=o/2,m=r/2;return[[-u,-m],[u,-m],[u,m],[-u,m]].map(([f,h])=>({x:i+f*c-h*l,y:a+f*l+h*c}))}function yg(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 o=n[1].trim();if(o==="none"||o==="transparent")return null;let r=o.match(/^url\(#([^)]+)\)$/);if(!r)return ve(o);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${r[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=ve(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>Se(s,c,1/(l+1)),a[0]):null}function ym(e,t,n,o){if(t.layer==="foreground")return;let r=$r(t);if(!r)return;let i=n+sg,a=xn(yg(t.href),o.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=Se(o.ground,a,s)),ie(e,r,void 0,()=>i,n,a,Se(a,o.decorWall,.5),oe)}function gm(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=Ll(o,r.gaTop);ie(e,t.points,t.holes,()=>n+um,n,i,r.gaWall,oe),Mg(e,t.points,n+um)}var um=.15,jr=[.72,.74,.76],Fa=1.1,mm=.12,Da=.05,gg=.06,xg=2.4;function Mg(e,t,n){let o=Ct([...t]),r=bt(o,mm/C),i=bt(o,(mm+Da)/C);if(r.length<3||i.length<3)return;for(let s of[n+Fa,n+Fa*.5])ie(e,r,[i.slice().reverse()],()=>s,s-Da,jr,re(jr,.85),oe);let a=gg/2/C;for(let s=0;s<r.length;s++){let c=r[s],l=r[(s+1)%r.length],u=Math.hypot(l.x-c.x,l.y-c.y)*C,m=Math.max(1,Math.round(u/xg));for(let f=0;f<m;f++){let h=f/m,d=c.x+(l.x-c.x)*h,p=c.y+(l.y-c.y)*h,b=[{x:d-a,y:p-a},{x:d+a,y:p-a},{x:d+a,y:p+a},{x:d-a,y:p+a}];ie(e,b,void 0,()=>n+Fa-Da,n,jr,re(jr,.8),oe)}}}function fm(e,t){return sr(e)<t?fn(e,t):e}var Na=.6,xm=3,vg=.25;function Sg(e,t){if(Ze(t,e.x,e.y))return 0;let n=1/0;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],a=t[o],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c||1,u=Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/l));n=Math.min(n,Math.hypot(e.x-(i.x+u*s),e.y-(i.y+u*c)))}return n}function Mm(e,t){let n=e.map(a=>({booth:a,ring:At(a)})).filter(a=>!!a.ring&&a.ring.length===4&&!a.booth.points),o=n.map(({ring:a})=>({minX:Math.min(...a.map(s=>s.x)),maxX:Math.max(...a.map(s=>s.x)),minY:Math.min(...a.map(s=>s.y)),maxY:Math.max(...a.map(s=>s.y))})),r=(xm+Na)/C,i=new Map;return n.forEach(({booth:a,ring:s},c)=>{let l={x:s.reduce((h,d)=>h+d.x,0)/4,y:s.reduce((h,d)=>h+d.y,0)/4},u=[0,1,2,3].map(h=>{let d=s[h],p=s[(h+1)%4],b={x:(d.x+p.x)/2,y:(d.y+p.y)/2},x=b.x-l.x,y=b.y-l.y,M=Math.hypot(x,y)||1,A={x:b.x+x/M*Na/C,y:b.y+y/M*Na/C},w=xm/C;return o.forEach((g,S)=>{S===c||A.x<g.minX-r||A.x>g.maxX+r||A.y<g.minY-r||A.y>g.maxY+r||(w=Math.min(w,Sg(A,n[S].ring)))}),{open:w*C,toward:{x:b.x+x/M*10/C,y:b.y+y/M*10/C},focal:Math.hypot(b.x-t.x,b.y-t.y)}}),m=Math.max(...u.map(h=>h.open)),f=u.filter(h=>h.open>=m-vg).sort((h,d)=>h.focal-d.focal)[0];i.set(a.id,f.toward)}),i}var vm=Et(require("polygon-clipping"),1);var wg=.45,Pg=1500,Ag=200;function Sm(e,t){if(e.role!=="stage"||vt(e.stageKind))return e;let n=Me(e);if(!n||n.length<3||Math.abs(mt(n))*C*C>Pg)return e;let o=t.filter(a=>Ze(n,a.x,a.y));if(!o.length||o.length>Ag)return e;let r=wg/C,i=o.map(a=>[[[a.x-r,a.y-r],[a.x+r,a.y-r],[a.x+r,a.y+r],[a.x-r,a.y+r],[a.x-r,a.y-r]]]);try{let a=vm.default.difference([[...n.map(l=>[l.x,l.y]),[n[0].x,n[0].y]]],...i),s=null,c=0;for(let l of a){let u=l[0].slice(0,-1).map(([f,h])=>({x:f,y:h})),m=Math.abs(mt(u));m>c&&(c=m,s=u)}return!s||s.length<3?e:{...e,kind:"polygon",points:s,rotation:0}}catch{return e}}var Rg=Math.PI/180,Ie=96,Eg=6,Ig=60,_g=150,wm=.2,Cg=.35;function Tg(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Rg;return n<0?n+360:n}function Zr(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function qr(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%o+o)%o;else if(l<0||l>=o)continue;a+=e[l],s++}r[i]=a/s}return r}function Pm(e,t){let n=e.filter(f=>f.rows.length>=1);if(n.length<1)return null;let o=[],r=0,i=0,a=0;for(let f of n)for(let h of f.rows){for(let d of h.pts)r+=d.x,i+=d.y,a++;if(h.pts.length>=4){let d=sa(h.pts);d&&Number.isFinite(d.cx)&&Number.isFinite(d.cy)&&o.push({x:d.cx,y:d.cy})}}if(!a)return null;let s={x:r/a,y:i/a},c=s;if(o.length>=8){let f=Zr(o.map(x=>x.x)),h=Zr(o.map(x=>x.y)),d=0;for(let x of n)for(let y of x.rows)for(let M of y.pts){let A=Math.hypot(M.x-s.x,M.y-s.y);A>d&&(d=A)}let p=0,b=d*.2;for(let x of n)for(let y of x.rows)for(let M of y.pts)Math.hypot(M.x-f,M.y-h)<b&&p++;Math.hypot(f-s.x,h-s.y)<=d&&p/a<.01&&(c={x:f,y:h})}let l=[];for(let f of n){let h={sectionId:f.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of f.rows)for(let p of d.pts){let b=Math.hypot(p.x-c.x,p.y-c.y),x=Math.min(Ie-1,Math.floor(Tg(c,p)/(360/Ie)));h.samples.push({r:b,bin:x,levelM:d.levelM}),b<h.rMin&&(h.rMin=b),b>h.rMax&&(h.rMax=b)}h.samples.length&&l.push(h)}if(!l.length)return null;l.sort((f,h)=>f.rMin+f.rMax-(h.rMin+h.rMax));let u=[];for(let f of l){let h=!1;for(let d of u){let p=Math.min(f.rMax,d.rMax)-Math.max(f.rMin,d.rMin),b=Math.min(f.rMax-f.rMin,d.rMax-d.rMin);if(b>1e-9&&p>=Cg*b){d.members.push(f),d.rMin=Math.min(d.rMin,f.rMin),d.rMax=Math.max(d.rMax,f.rMax),h=!0;break}}h||u.push({members:[f],rMin:f.rMin,rMax:f.rMax})}let m=[];for(let f of u){let h=new Array(Ie).fill(null);for(let I of f.members)for(let R of I.samples){let _=h[R.bin];_||(_={samples:[]},h[R.bin]=_),_.samples.push({r:R.r,levelM:R.levelM})}let d=h.map(I=>!!I);if(!d.filter(Boolean).length)continue;let b=[],x=[];for(let I of h){if(!I)continue;let R=1/0,_=-1/0;for(let F of I.samples)F.r<R&&(R=F.r),F.r>_&&(_=F.r);b.push(R),x.push(_)}let y=Zr(b),M=Zr(x);if(!(y>=wm*M)||!(M>0))continue;let A=[...b].sort((I,R)=>I-R);if(!(A[Math.floor(A.length*.1)]>=wm*M))continue;let g=h.map(I=>{if(!I)return null;let R=[...I.samples].sort((T,D)=>T.r-D.r),_=R[0].r,F=R[R.length-1].r,N=R[0].levelM,O=-1/0;for(let T of R)T.levelM>O&&(O=T.levelM);let V=[];for(let T of R){let D={r:T.r,l:T.levelM};for(;V.length&&Math.abs(V[V.length-1].r-D.r)<1e-9;){if(V[V.length-1].l<=D.l){D.skip=!0;break}V.pop()}if(!D.skip){for(;V.length>=2;){let W=V[V.length-2],H=V[V.length-1];if((H.r-W.r)*(D.l-W.l)-(H.l-W.l)*(D.r-W.r)<=0)V.pop();else break}V.push(D)}}let z=V.map(T=>T.r),G=V.map(T=>T.l);return{inner:_,outer:F,front:N,top:O,profile:{rs:z,ls:G}}}),S=d.slice();for(let I=0;I<Ie;I++){if(S[I])continue;let R=-1,_=-1,F=0;for(let j=1;j<=Ie;j++){let Z=(I-j+Ie*2)%Ie;if(S[Z]){R=Z;break}}for(let j=1;j<=Ie;j++){let Z=(I+j)%Ie;if(S[Z]){_=Z,F=j;break}}if(R<0||_<0)continue;let N=0;for(let j=1;j<=Ie;j++){let Z=(I-j+Ie*2)%Ie;if(d[Z]){N=j;break}}if(N-1+F>Eg)continue;let V=g[R],z=g[_],G=N/(N+F),T=V.inner+(z.inner-V.inner)*G,D=V.outer+(z.outer-V.outer)*G,W=V.front+(z.front-V.front)*G,H=V.top+(z.top-V.top)*G;g[I]={inner:T,outer:D,front:W,top:H,profile:{rs:[T,D],ls:[W,H]}}}for(let I=0;I<Ie;I++)g[I]&&(S[I]=!0);let v=360/Ie,P=[],E=S.filter(Boolean).length,k=[];if(E===Ie)k.push({start:0,len:Ie});else{let I=0;for(;S[I];)I=(I+1)%Ie;let R=-1;for(let _=0;_<=Ie;_++){let F=(I+_)%Ie,N=_<Ie&&S[F];if(N&&R<0)R=F;else if(!N&&R>=0){let O=(F-R+Ie)%Ie||Ie;k.push({start:R,len:O}),R=-1}}}for(let I of k){if(I.len*v<Ig&&I.len<Ie)continue;let R=I.len===Ie,_=new Float64Array(I.len),F=new Float64Array(I.len),N=new Float64Array(I.len),O=new Float64Array(I.len),V=[];for(let j=0;j<I.len;j++){let Z=g[(I.start+j)%Ie];_[j]=Z.inner,F[j]=Z.outer,N[j]=Z.front,O[j]=Z.top,V.push(Z.profile??{rs:[Z.inner,Z.outer],ls:[Z.front,Z.top]})}let z=qr(_,R),G=qr(F,R),T=qr(N,R),D=qr(O,R);for(let j=0;j<I.len;j++)z[j]>_[j]&&(z[j]=_[j]),G[j]<F[j]&&(G[j]=F[j]),z[j]>G[j]-1e-6&&(z[j]=Math.max(0,G[j]-1e-6)),D[j]<T[j]&&(D[j]=T[j]);let W={startBin:I.start,binCount:I.len,closed:R,innerR:z,outerR:G,frontLevelM:T,topLevelM:D,profiles:V},H=(j,Z,X)=>{let ee=V[j],ne=ee.rs,ue=ee.ls;if(Z<=ne[0]){ue[0]>X&&(ue[0]=X);return}if(Z>=ne[ne.length-1]){ue[ue.length-1]>X&&(ue[ue.length-1]=X);return}for(let de=0;de+1<ne.length;de++)if(Z<=ne[de+1]){ue[de]>X&&(ue[de]=X),ue[de+1]>X&&(ue[de+1]=X);return}};for(let j=0;j<I.len;j++){let Z=h[(I.start+j)%Ie];if(Z)for(let X of Z.samples){H(j,X.r,X.levelM);let ee=R?(j-1+I.len)%I.len:j-1,ne=R?(j+1)%I.len:j+1;ee>=0&&H(ee,X.r,X.levelM),ne<I.len&&H(ne,X.r,X.levelM)}}P.push(W)}P.reduce((I,R)=>I+R.binCount*v,0)<_g||m.push({arcs:P,sectionIds:f.members.map(I=>I.sectionId),innerRMedian:y,outerRMedian:M})}if(!m.length)return null;if(m.sort((f,h)=>f.innerRMedian-h.innerRMedian),t){let f=m[m.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*f)return null}return{centre:c,binCount:Ie,binStepDeg:360/Ie,rings:m}}function Am(e,t,n,o){let r=e.binStepDeg,i=n/r-.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 m=t.profiles[u],f=m.rs,h=m.ls;if(o<=f[0])return h[0];if(o>=f[f.length-1])return h[h.length-1];for(let d=0;d+1<f.length;d++)if(o<=f[d+1]){let p=f[d+1]-f[d],b=p>1e-9?(o-f[d])/p:0;return h[d]+(h[d+1]-h[d])*b}return h[h.length-1]};return l(a)*(1-c)+l(s)*c}function Ba(e,t,n,o,r,i,a,s,c,l=[],u=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let m=(p,b,x)=>{jt(e,p,b,x,l,a,s,{portalBase:u,ao:c})||ie(e,p,void 0,()=>x,b,a,s,c)},f=(p,b,x)=>({x:p.x+(b.x-p.x)*x,y:p.y+(b.y-p.y)*x}),h=o?t.length:t.length-1,d=0;for(let p=0;p<h;p++){let b=(p+1)%t.length,x=Math.hypot(n[b].x-n[p].x,n[b].y-n[p].y)*he;if(x<1e-5)continue;let y=(g,S)=>[f(t[p],t[b],g),f(t[p],t[b],S),f(n[p],n[b],S),f(n[p],n[b],g)];m(y(0,1),r,r+.95),m(y(0,1),i-.22,i);let M=Math.ceil((d-.32)/6)*6,A=!1,w=!1;for(let g=M;g<d+x;g+=6){let S=Math.max(0,(g-d)/x),v=Math.min(1,(g+.32-d)/x);v<=S||(m(y(S,v),r+.95,i-.22),A||=S<1e-6,w||=v>1-1e-6)}if(!o&&(p===0&&!A||p===h-1&&!w)){let g=Math.min(1,.32/x);m(y(p===0?0:1-g,p===0?g:1),r+.95,i-.22)}d+=x}}var tn=Et(require("polygon-clipping"),1),Go=.65;function Va(e,t){let n=1/0;for(let o of t)for(let r=0;r<o.length;r++){let i=o[r],a=o[(r+1)%o.length],s=a.x-i.x,c=a.y-i.y,l=Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/(s*s+c*c||1)));n=Math.min(n,Math.hypot(e.x-i.x-l*s,e.y-i.y-l*c))}return n}var Ga=.01;function Rm(e,t,n,o,r,i,a,s=[],c=!0,l={bays:[],walls:[]}){if(o-r<=1e-5)return;let u=o-r>=3,m=u?o-Go:r;e.setMaterial(5);let f=u?[]:s.filter(g=>{if(g.role!=="entrance"&&g.role!=="exit")return!1;let S=Me(g);if(!S)return!1;let v=eo(S,r,r+St(g).heightM);return v!==null&&v.openingTop<=o-.12});if((!f.length||!jt(e,t,m,o,f,i,a,{holes:n,portalBase:r}))&&ie(e,t,n,()=>o,m,i,a,oe,void 0,()=>[0,1,0]),!u){e.setMaterial(0);return}let h=c&&l.bays.length?Lg(t,n,bt(t,Vo/C),l):null,d=6/C,p=.22/C,b=s.flatMap(g=>{if(g.role!=="entrance"&&g.role!=="exit")return[];let S=Me(g);return S?.length?[{minX:Math.min(...S.map(v=>v.x)),maxX:Math.max(...S.map(v=>v.x)),minY:Math.min(...S.map(v=>v.y)),maxY:Math.max(...S.map(v=>v.y))}]:[]}),x=Math.min(...t.map(g=>g.x)),y=Math.max(...t.map(g=>g.x)),M=Math.min(...t.map(g=>g.y)),A=Math.max(...t.map(g=>g.y));for(let g=x+d/2;g<y;g+=d)for(let S=M+d/2;S<A;S+=d){if(b.some(P=>g+p>=P.minX&&g-p<=P.maxX&&S+p>=P.minY&&S-p<=P.maxY))continue;let v=[{x:g-p,y:S-p},{x:g+p,y:S-p},{x:g+p,y:S+p},{x:g-p,y:S+p}];!Ke({x:g,y:S},t,n)||Va({x:g,y:S},[t,...n??[]])<p*Math.SQRT2+(c?Vo/C:0)||h&&Va({x:g,y:S},h.flat())<p*Math.SQRT2+Vo/C||ie(e,v,void 0,()=>m,r,i,a,oe)}if(h){for(let[g,...S]of h)ie(e,g,S,()=>m,r-Ga,i,a,oe);e.setMaterial(0);return}let w=bt(t,Vo/C);if(c&&w.length>=3){let g=s.filter(P=>{if(P.role!=="entrance"&&P.role!=="exit")return!1;let E=Me(P);return!!E&&E.some(k=>!Ke(k,t,void 0)||Va(k,[t])<=Vo/C)}),S=[w.slice().reverse()],v=r-Ga;(!g.length||!jt(e,t,v,m,g,i,a,{holes:S,portalBase:r+Ga}))&&ie(e,t,S,()=>m,v,i,a,oe)}e.setMaterial(0)}var Ha=.25,Vo=Ha;function Lg(e,t,n,o){if(n.length<3)return null;let r=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s},i=a=>{let[s,...c]=a.map(l=>[r(l)]);return tn.default.union(s,...c)};try{let a=[r(e),...(t??[]).map(r)],s=tn.default.difference(a,[r(n)]),c=tn.default.intersection(a,i(o.bays));if(!c.length)return null;let l=tn.default.difference(tn.default.intersection(a,i(o.walls)),c);return tn.default.union(tn.default.difference(s,c),l).map(m=>m.map(f=>f.slice(0,-1).map(([h,d])=>({x:h,y:d}))))}catch{return null}}var kg=.02,Og=.25,Fg=1.2,Dg=.6,Ng=.45,Bg=2.3,Vg=Math.PI/180,Em=.005;function kt(e,t,n){let o=n*Vg;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function Gg(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let o=n.outerRMedian*.85;for(let r of e){if(r.role!=="wall")continue;let i=r.points&&r.points.length>=2?r.points:r.x!==void 0&&r.y!==void 0&&r.width!==void 0&&r.height!==void 0?[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height},{x:r.x,y:r.y+r.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)>=o&&a++;if(a>=i.length/2)return!0}return!1}var Hg=24,zg=.01;function Ug(e,t,n,o,r,i,a,s,c){let l=n.binCount,u=Hg,m=he,f=i+.02,h=i-zg,d=[];for(let R=0;R<l;R++){let _=(n.startBin+R+.5)*t.binStepDeg,F=new Float64Array(u+1);for(let N=0;N<=u;N++){let O=o[R]+(r[R]-o[R])*N/u;F[N]=Math.max(f,Am(t,n,_,O)-Og)}d.push(F)}if(c){let R=0;for(let _=0;_+1<l;_++)for(let F=0;F<u;F++){let N=kt(t.centre,o[_]+(r[_]-o[_])*F/u,(n.startBin+_+.5)*t.binStepDeg),O=kt(t.centre,o[_+1]+(r[_+1]-o[_+1])*(F+1)/u,(n.startBin+_+1.5)*t.binStepDeg);R=Math.max(R,Math.hypot(O.x-N.x,O.y-N.y))}for(let _=0;_<l;_++){let F=(n.startBin+_+.5)*t.binStepDeg;for(let N=0;N<=u;N++){let O=kt(t.centre,o[_]+(r[_]-o[_])*N/u,F),V=c(O.x,O.y,R*1.01);V!==null&&(d[_][N]=Math.min(d[_][N],Math.max(h+Em,V-Em)))}}}let p=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],b=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],x=[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],M=(R,_)=>{let F=(n.startBin+R+.5)*t.binStepDeg,N=o[R]+(r[R]-o[R])*_/u,O=kt(t.centre,N,F);return[O.x*m,d[R][_],O.y*m]};{let R=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let F=!1;for(let O=0;O<l;O++)for(let V=u-1;V>=0;V--)d[O][V]>d[O][V+1]&&(d[O][V]=d[O][V+1],F=!0);let N=n.closed?l:l-1;for(let O=0;O<N;O++){let V=(O+1)%l;for(let z=0;z<=u;z++){let G=d[V][z]-d[O][z];if(Math.abs(G)>1)continue;let T=o[O]+(r[O]-o[O])*z/u,D=o[V]+(r[V]-o[V])*z/u,W=kt(t.centre,T,(n.startBin+O+.5)*t.binStepDeg),H=kt(t.centre,D,(n.startBin+V+.5)*t.binStepDeg),j=R*Math.hypot(H.x-W.x,H.y-W.y)*m;G>j?(d[V][z]=d[O][z]+j,F=!0):-G>j&&(d[O][z]=d[V][z]+j,F=!0)}}if(!F)break}}let A=1,w=(R,_)=>{for(let F=0;F<=u;F+=4)if(Math.abs(d[R][F]-d[_][F])>A)return!0;return Math.abs(d[R][u]-d[_][u])>A},g=Math.tan(38*Math.PI/180),S=R=>(r[R]-o[R])/u*m,v=(R,_)=>d[R][_+1]-d[R][_]>g*Math.max(1e-6,S(R)),P=(R,_)=>{let F=n.closed?(R-1+l)%l:Math.max(0,R-1),N=n.closed?(R+1)%l:Math.min(l-1,R+1);Math.abs(d[F][_]-d[R][_])>A&&(F=R),Math.abs(d[N][_]-d[R][_])>A&&(N=R);let O=Math.max(0,_-1),V=Math.min(u,_+1);O<_&&v(R,O)&&(O=_),V>_&&v(R,_)&&(V=_);let z=M(F,_),G=M(N,_),T=M(R,O),D=M(R,V),W=G[0]-z[0],H=G[1]-z[1],j=G[2]-z[2],Z=D[0]-T[0],X=D[1]-T[1],ee=D[2]-T[2],ne=H*ee-j*X,ue=j*Z-W*ee,de=W*X-H*Z,me=Math.hypot(ne,ue,de);return me>1e-12?(ne/=me,ue/=me,de/=me,ue<0&&(ne=-ne,ue=-ue,de=-de),[ne,ue,de]):[0,1,0]},E=(R,_,F=!1)=>{let N=F&&Math.min(R[1],_[1])-i>=3,O=[R[0],N?R[1]-Go:h,R[2]],V=[_[0],N?_[1]-Go:h,_[2]],z=_[0]-R[0],G=_[2]-R[2],T=Math.hypot(z,G);if(!(T>1e-12))return;let D=[G/T,0,-z/T];e.tri(R,_,V,D,x,x,y),e.tri(R,V,O,D,x,y,y)},k=.05*pt,L=R=>r[R]-o[R]<k,I=n.closed?l:l-1;for(let R=0;R<I;R++){let _=(R+1)%l;if(L(R)||L(_))continue;if(w(R,_)){let G=(n.startBin+R+1)*t.binStepDeg,T=(X,ee)=>{let ne=(o[R]+o[_])/2,ue=(r[R]+r[_])/2,de=ne+(ue-ne)*ee/u,me=kt(t.centre,de,G);return[me.x*m,d[X][ee],me.y*m]};for(let X=0;X<u;X++){let ee=M(R,X),ne=M(R,X+1),ue=T(R,X),de=T(R,X+1),me=P(R,X),pe=P(R,X+1);e.triN(ee,ue,de,me,me,pe,p),e.triN(ee,de,ne,me,pe,pe,p);let Pe=M(_,X),_e=M(_,X+1),xe=T(_,X),Ce=T(_,X+1),$=P(_,X),B=P(_,X+1);e.triN(xe,Pe,_e,$,$,B,p),e.triN(xe,_e,Ce,$,B,B,p);let Y=T(R,X),q=T(R,X+1),J=T(_,X+1),te=T(_,X),ae=q[0]-Y[0],fe=q[2]-Y[2],Ue=Math.hypot(ae,fe);if(Ue>1e-12){let se=[fe/Ue,0,-ae/Ue];e.tri(Y,q,J,se,x),e.tri(Y,J,te,se,x)}}let D=M(R,0),W=M(_,0),H=M(_,u),j=M(R,u),Z=X=>[X[0],h,X[2]];Math.min(D[1],W[1])-i<3&&(e.tri(Z(D),Z(H),Z(W),[0,-1,0],b),e.tri(Z(D),Z(j),Z(H),[0,-1,0],b)),E(D,W,!0),E(j,H,!0);continue}for(let G=0;G<u;G++){let T=P(R,G),D=P(_,G),W=P(_,G+1),H=P(R,G+1);if(v(R,G)||v(_,G)){let ne=(q,J)=>{let te=(n.startBin+q+.5)*t.binStepDeg,ae=o[q]+(r[q]-o[q])*(G+.5)/u,fe=kt(t.centre,ae,te);return[fe.x*m,J,fe.y*m]},ue=M(R,G),de=M(_,G),me=ne(R,d[R][G]),pe=ne(_,d[_][G]);e.triN(ue,de,pe,T,D,D,p),e.triN(ue,pe,me,T,D,T,p);let Pe=M(_,G+1),_e=M(R,G+1),xe=ne(R,d[R][G+1]),Ce=ne(_,d[_][G+1]);e.triN(xe,Ce,Pe,H,W,W,p),e.triN(xe,Pe,_e,H,W,H,p);let $=pe[0]-me[0],B=pe[2]-me[2],Y=Math.hypot($,B);if(Y>1e-12){let q=[-B/Y,0,$/Y];e.tri(me,pe,Ce,q,x),e.tri(me,Ce,xe,q,x)}continue}let j=M(R,G),Z=M(_,G),X=M(_,G+1),ee=M(R,G+1);e.triN(j,Z,X,T,D,W,p),e.triN(j,X,ee,T,W,H,p)}let F=M(R,0),N=M(_,0),O=M(_,u),V=M(R,u),z=G=>[G[0],h,G[2]];Math.min(F[1],N[1])-i<3&&(e.tri(z(F),z(O),z(N),[0,-1,0],b),e.tri(z(F),z(V),z(O),[0,-1,0],b)),E(F,N,!0),E(V,O,!0)}if(!n.closed)for(let R of[0,l-1])for(let _=0;_<u;_++)E(M(R,_),M(R,_+1))}function Im(e,t,n){let{bottomY:o,colors:r,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let m of u.arcs){let f=new Float64Array(m.binCount),h=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let b=(m.startBin+p)%t.binCount,x=Math.max(0,m.innerR[p]-yt);f[p]=Math.max(x,a[b]+.001),h[p]=Math.max(f[p]+.001,m.outerR[p]+yt)}let d=0;for(let p=0;p<m.binCount;p++){let b=m.topLevelM[p]-o;b>d&&(d=b)}d>=Fg&&Ug(e,t,m,f,h,o,r,i,n.standTopNear);for(let p=0;p<m.binCount;p++){let b=(m.startBin+p)%t.binCount;h[p]>a[b]&&(a[b]=h[p])}}if(n.deriveShell===!1||Gg(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Dg*pt,l=Ng*pt;for(let u of s.arcs){let m=[],f=[];for(let P=0;P<u.binCount;P++){let E=(u.startBin+P+.5)*t.binStepDeg,k=u.outerR[P]+yt+c;m.push(kt(t.centre,k,E)),f.push(kt(t.centre,k+l,E))}let h=-1/0;for(let P=0;P<u.binCount;P++)u.topLevelM[P]>h&&(h=u.topLevelM[P]);let d=h+Bg,p=u.closed?f:[...f,...m.slice().reverse()],b=u.closed?[m.slice().reverse()]:void 0,x=Se(r.shellWall,[.66,.71,.72],.62),y=(P,E,k,L,I)=>{let R=Math.abs(L-h)<1e-6?L-kg:L;jt(e,P,k,R,n.shapes,r.shellTop,I,{holes:E,portalBase:o,ao:i})||ie(e,P,E,()=>R,k,r.shellTop,I,i)},M=Math.max(1,Math.ceil((h-o)/4.5)),A=(h-o)/M,w=new Set,g=n.tierFrontLevels??t.rings.map(P=>{let E=P.arcs.flatMap(k=>Array.from(k.frontLevelM)).filter(Number.isFinite).sort((k,L)=>k-L);return E[Math.floor(E.length/2)]});for(let P of g)Number.isFinite(P)&&P-o>=3&&P<h&&w.add(Math.max(0,Math.min(M-1,Math.floor((P-o)/A))));let S=Math.min(...g.filter(P=>Number.isFinite(P)&&P-o>=3&&P<h));for(let P=0;P<M;P++)o+(P+1)*A<=S-Go&&Number.isFinite(S)&&w.add(P);for(let P=0;P<M;P++){let E=o+(h-o)*P/M,k=o+(h-o)*(P+1)/M;w.has(P)&&k-E>=3.2?(y(p,b,E,E+.45,x),Ba(e,m,f,u.closed,E+.45,k-.16,r.shellTop,x,i,n.shapes,o)):y(p,b,E,k-.16,x),y(p,b,k-.16,k,re(x,.62))}Ba(e,m,f,u.closed,h,d,r.shellTop,x,i,n.shapes,o);let v=8;for(let P=1;P<f.length;P++){if(v+=Math.hypot(f[P].x-f[P-1].x,f[P].y-f[P-1].y)*he,v<8)continue;v=0;let E=f[P],k=f[P-1],L=E.x-k.x,I=E.y-k.y,R=Math.max(1,Math.hypot(L,I)),_=L/R*.16*pt,F=I/R*.16*pt,N=Math.max(1,Math.hypot(E.x-t.centre.x,E.y-t.centre.y)),O=(E.x-t.centre.x)/N*.24*pt,V=(E.y-t.centre.y)/N*.24*pt,z=[{x:E.x-_,y:E.y-F},{x:E.x+_,y:E.y+F},{x:E.x+_+O,y:E.y+F+V},{x:E.x-_+O,y:E.y-F+V}];y(z,void 0,o,h,re(x,1.12))}}}var jg=2.5,_m=.65,Wg=2,Xg=.03;function Kg(e,t){let n=()=>{let o=t;for(;e.length>2;){let r=e[0],i=e[1],a=Math.hypot(i.x-r.x,i.y-r.y);if(a>o){e[0]={x:r.x+(i.x-r.x)/a*o,y:r.y+(i.y-r.y)/a*o};return}o-=a,e.shift()}};n(),e.reverse(),n(),e.reverse()}function ja(e,t,n){let o=new Map;for(let i of e){let a=o.get(i.blockId);(!a||i.depth<a.depth)&&o.set(i.blockId,i)}let r=[];for(let[i,a]of o){if(a.y-n<jg||a.pts.length<2)continue;let s=a.pts.map(u=>{let m=u.x-t.x,f=u.y-t.y,h=Math.max(1,Math.hypot(m,f));return{x:u.x-m/h*_m/C,y:u.y-f/h*_m/C}}),c=[],l=[s[0]];for(let u=1;u<s.length;u++){let m=s[u-1],f=s[u];Math.hypot(f.x-m.x,f.y-m.y)*C>Wg?(l.length>=2&&c.push(l),l=[f]):l.push(f)}l.length>=2&&c.push(l);for(let u of c)Kg(u,Xg/C);c.length&&r.push({blockId:i,y:a.y,runs:c})}return r}var Cm=.1,Yg=1.1,$g=.22,za=.95,Ua=.05,Tm=1.8;function Lm(e,t,n,o){let r=[.72,.72,.69],i=[.48,.55,.57];for(let a of ja(t,n,o)){let s=a.y;for(let c of a.runs){let l=Tm;for(let u=1;u<c.length;u++){let m=c[u-1],f=c[u],h=f.x-m.x,d=f.y-m.y,p=Math.hypot(h,d);if(p<1e-5)continue;let b=x=>{let y=-d/p*x/C/2,M=h/p*x/C/2;return[{x:m.x+y,y:m.y+M},{x:f.x+y,y:f.y+M},{x:f.x-y,y:f.y-M},{x:m.x-y,y:m.y-M}]};if(ie(e,b($g),void 0,()=>s+Cm,s-Yg,r,r,oe),ie(e,b(Ua),void 0,()=>s+za,s+za-Ua,i,i,oe),l+=p*C,l>=Tm||u===c.length-1){l=0;let x=.028/C,y=[{x:m.x-x,y:m.y-x},{x:m.x+x,y:m.y-x},{x:m.x+x,y:m.y+x},{x:m.x-x,y:m.y+x}];ie(e,y,void 0,()=>s+za-Ua,s+Cm,i,i,oe)}}}}}var Zg=.9,qg=1.5,Qg=.3;function km(e,t,n){let o=[],r=[],i=Zg/C,a=qg/C,s=Qg/C;for(let c of e)for(let l of c.runs){if(l.length<2)continue;let u=l.slice(),m=(b,x)=>{let y=u[b],M=u[x],A=Math.hypot(y.x-M.x,y.y-M.y)||1;u[b]={x:y.x+(y.x-M.x)/A*s,y:y.y+(y.y-M.y)/A*s}};m(0,1),m(u.length-1,u.length-2);let f=u.map((b,x)=>{let y=u[Math.max(0,x-1)],M=u[Math.min(u.length-1,x+1)],A=M.x-y.x,w=M.y-y.y,g=Math.hypot(A,w)||1,S=-w/g,v=A/g;return S*(b.x-t.x)+v*(b.y-t.y)<0&&(S=-S,v=-v),{nx:S,ny:v}}),h=u.map((b,x)=>({x:b.x-f[x].nx*a,y:b.y-f[x].ny*a})),d=u.map((b,x)=>({x:b.x+f[x].nx*i,y:b.y+f[x].ny*i})),p=u.map((b,x)=>({x:b.x+f[x].nx*(i+n/C),y:b.y+f[x].ny*(i+n/C)}));o.push([...h,...d.slice().reverse()]),r.push([...d,...p.reverse()])}return{bays:o,walls:r}}var Wa=.88,Qr=.27,Jg=1.2,e1=.01,t1=7,n1=.05,o1=.25;function Om(e,t,n,o,r){let i=[.67,.71,.68],a=[i[0]*Wa,i[1]*Wa,i[2]*Wa],s=c=>!!r&&r.some((l,u)=>u!==c&&l?.belowY!=null&&Math.abs(l.belowY-t[c].y)<1e-6&&t[u].blockId===t[c].blockId);for(let c=0;c<t.length;c++){let l=t[c];if(!(l.pts.length<2))for(let u of[0,l.pts.length-1]){let m=l.pts[u],f=l.pts[u===0?1:u-1],h=m.x-f.x,d=m.y-f.y,p=Math.hypot(h,d);if(p<1e-5)continue;h/=p,d/=p;let b=1/0;for(let _=0;_<n.length;_++){let F=n[_],N=n[(_+1)%n.length],O=N.x-F.x,V=N.y-F.y,z=h*V-d*O;if(Math.abs(z)<1e-8)continue;let G=F.x-m.x,T=F.y-m.y,D=(G*V-T*O)/z,W=(G*d-T*h)/z;D>0&&W>=0&&W<=1&&(b=Math.min(b,D))}let x=.3/C,y=b-.04/C;if(!Number.isFinite(b)||b*C>2||y-x<.12/C)continue;let M=!!o&&s(c),A=r?.[c]?.pitch,w=M&&A&&Number.isFinite(A)?Math.min(Jg/C,Math.max(Qr/C,A-Qr/C-e1/C)):Qr/C,g=-d,S=h;o&&g*(o.x-m.x)+S*(o.y-m.y)<0&&(g=-g,S=-S);let v=Qr/C,P=[{x:m.x+h*x+g*v,y:m.y+d*x+S*v},{x:m.x+h*y+g*v,y:m.y+d*y+S*v},{x:m.x+h*y-g*w,y:m.y+d*y-S*w},{x:m.x+h*x-g*w,y:m.y+d*x-S*w}];if(!P.every(_=>Ze(n,_.x,_.y)))continue;let E=r?.[c]?.belowY,k=E==null?0:l.y-E,L=!!o&&k>.03&&k<=.65;if(L&&o){let _=(F,N)=>Math.hypot((F.x+N.x)/2-o.x,(F.y+N.y)/2-o.y);_(P[0],P[1])>_(P[3],P[2])&&(P=[P[3],P[2],P[1],P[0]])}let I=L?Math.ceil((k-1e-8)/.2):1,R=(_,F,N)=>({x:_.x+(F.x-_.x)*N,y:_.y+(F.y-_.y)*N});for(let _=0;_<I;_++){let F=_/I,N=(_+1)/I,O=[R(P[0],P[3],F),R(P[1],P[2],F),R(P[1],P[2],N),R(P[0],P[3],N)],V=l.y+.008-(L?k*(1-N):0);if(ie(e,O,void 0,()=>V,V-(L?k/I+.1:.16),i,a,oe),!L)continue;let z=Math.hypot(O[3].x-O[0].x,O[3].y-O[0].y)*C;if(z<1e-4)continue;let G=Math.min(n1/z,o1),T=R(O[0],O[3],G),D=R(O[1],O[2],G),W=j=>[j.x*C,V+.004,j.y*C],H=[.8,.67,.3];e.setMaterial(t1),e.tri(W(O[0]),W(O[1]),W(D),[0,1,0],H),e.tri(W(O[0]),W(D),W(T),[0,1,0],H),e.setMaterial(0)}}}}var r1=.02,i1=.012,a1=.01,s1=.3,c1=.5;function l1(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],a=e[r+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=Math.max(0,Math.min(1,u)),o=Math.min(o,Math.hypot(t-(i.x+u*s),n-(i.y+u*c)))}return o}function u1(e,t,n,o){let r=1/0,i=Number.NaN;for(let a=0;a<e.length;a++){let s=t[a];if(Math.hypot(n-s.cx,o-s.cy)-s.rad>=r)continue;let c=l1(e[a].pts,n,o);c<r&&(r=c,i=e[a].y)}return i}function Fm(e,t,n,o,r,i,a){let s=o.filter(f=>f.pts.length>0);if(s.length<2||t.length<3)return;let c=s.map(f=>{let h=0,d=0;for(let b of f.pts)h+=b.x,d+=b.y;h/=f.pts.length,d/=f.pts.length;let p=0;for(let b of f.pts)p=Math.max(p,Math.hypot(b.x-h,b.y-d));return{cx:h,cy:d,rad:p}}),l=[...t],u=n.map(f=>[...f]),m=r1/C;for(let f of[l,...u])for(let h=0;h<f.length;h++){let d=f[h],p=f[(h+1)%f.length],b=p.x-d.x,x=p.y-d.y,y=Math.hypot(b,x);if(y*C<.05)continue;let M=(d.x+p.x)/2,A=(d.y+p.y)/2,w=x/y,g=-b/y;Ke({x:M+w*m,y:A+g*m},l,u)&&(w=-w,g=-g);let S=r.x-M,v=r.y-A,P=Math.hypot(S,v)||1;if((w*S+g*v)/P>c1)continue;let E=1/0;for(let O of[.2,.5,.8]){let V=u1(s,c,d.x+b*O-w*m*2,d.y+x*O-g*m*2);Number.isFinite(V)&&(E=Math.min(E,V))}if(!Number.isFinite(E)||E-i<s1)continue;let k=i-a1,L=E-i1,I={x:(d.x-w*m)*C,z:(d.y-g*m)*C},R={x:(p.x-w*m)*C,z:(p.y-g*m)*C},_=[w,0,g],F=re(a,oe.wallBottom),N=re(a,oe.top);e.tri([I.x,L,I.z],[R.x,L,R.z],[R.x,k,R.z],_,N,N,F),e.tri([I.x,L,I.z],[R.x,k,R.z],[I.x,k,I.z],_,N,F,F)}}function Dm(e,t,n,o,r,i,a,s,c=!1){if(!t.outline||t.outline.length<3)return;let l=n.baseHeightM,u=n.objects.filter(y=>y.type==="shape"&&(y.role==="entrance"||y.role==="exit")),m=kl(o,s.tierTop);if(!r)return;let f=y=>r.deckAt(y.x,y.y),h=Zl(t,a),d=h[0]??t.outline;if(r.rowLevels.length>=2){let y=Er(r.rowLevels),M=ql(Wl(r.rowLevels,n.focal,y),h),A=km(ja(r.rowLevels,n.focal,l),n.focal,Ha);for(let g of M){let S=Math.max(l,g.topY-Nm);for(let v of i.subtract(g.outline,S))Rm(e,v,g.holes,S,l,s.tierTop,s.tierWall,u,!c,A);e.setMaterial(5),Fm(e,g.outline,g.holes,r.rowLevels,n.focal,S,s.tierWall),e.setMaterial(0)}M.length||ie(e,d,t.holes,()=>r.landingY,l,m,s.tierWall,oe);let w={tread:[m[0]*oe.top,m[1]*oe.top,m[2]*oe.top],riser:[m[0]*.72,m[1]*.72,m[2]*.72]};for(let g of h.length?h:[d])Kl(e,r.rowLevels,n.focal,r.landingY,w,g,y);Lm(e,r.rowLevels,n.focal,l),Om(e,r.rowLevels,t.outline,n.focal,y);return}let p=r.flat?1/0:Qu,b=y=>r.normalAt(y.x,y.y),x=r.flat?r.landingY:void 0;for(let y of i.subtract(d,x))ie(e,y,t.holes,f,l,m,s.tierWall,oe,p,b)}function m1(e,t,n){let o=new Set;for(let a of e.objects)a.type==="section"&&o.add(a.id);let r=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!o.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a];if(l.kind==="booth")continue;let u=r.get(s);u||(u=new Map,r.set(s,u));let m=l.rowId||`__seat-${a}`,f=u.get(m);f||(f={pts:[],levelM:0,n:0},u.set(m,f)),f.pts.push({x:l.x,y:l.y}),f.levelM+=n.seatDeckY(a),f.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=r.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 f1(e,t){let n=1/0;for(let o=0;o<t.length;o++){let r=t[o],i=t[(o+1)%t.length],a=i.x-r.x,s=i.y-r.y,c=Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/(a*a+s*s||1)));n=Math.min(n,Math.hypot(e.x-r.x-c*a,e.y-r.y-c*s))}return n}var Nm=.02;function h1(e,t){let n=e.objects.filter(o=>o.type==="section"&&!!o.outline&&o.outline.length>=3).flatMap(o=>{let r=t.bySection.get(o.id);if(!r)return[];let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let u of o.outline)u.x<i&&(i=u.x),u.x>a&&(a=u.x),u.y<s&&(s=u.y),u.y>c&&(c=u.y);let l=r.landingY;for(let u of r.rowLevels)l=Math.min(l,u.y-Nm);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:l,minX:i,maxX:a,minY:s,maxY:c}]});return(o,r,i)=>{let a=null;for(let s of n){if(o<s.minX-i||o>s.maxX+i||r<s.minY-i||r>s.maxY+i)continue;let c={x:o,y:r};if(!Ke(c,s.outline,s.holes)&&f1(c,s.outline)>i)continue;let l=Math.min(s.surface.deckAt(o,r),s.floorTop);(a===null||l<a)&&(a=l)}return a}}var d1=3,p1=.4;function Bm(e,t,n,o,r,i,a=!0){let s=m1(t,n,o);if(s.length<d1)return;let c=Pm(s,t.focal);if(!c)return;let l=Math.max(0,...c.rings.map(u=>u.arcs.reduce((m,f)=>m+f.binCount,0)))/c.binCount;e.setMaterial(5),Im(e,c,{bottomY:t.baseHeightM,tierFrontLevels:s.map(u=>Math.min(...u.rows.map(m=>m.levelM))),colors:{bandTop:re(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??re(r.tierWall,1.15),shellWall:i??r.tierWall},ao:oe,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:a&&l>=p1,standTopNear:h1(t,o)}),e.setMaterial(0)}var Vm=4;var b1=[[/\b(wc|toilets?|restrooms?|washrooms?|lavatory|loo)\b/i,"restroom"],[/\b(bar|drinks|pub|cocktails?)\b/i,"bar"],[/\b(food|concessions?|snacks?|kiosk|caf[eé]|kitchen|catering)\b/i,"concession"],[/\b(coat ?check|cloak ?room|cloakroom|coats)\b/i,"coat"],[/\b(screen|led wall|projection|video wall)\b/i,"screen"],[/\b(sound|foh|mixing desk|control booth)\b/i,"sound"],[/\b(entrance|entry|way in|gate)\b/i,"entrance"],[/\b(exit|way out)\b/i,"exit"],[/\b(pillar|column|obstruction)\b/i,"obstruction"],[/\b(walls?|outline|boundary|perimeter)\b/i,"wall"]],y1=1.2,g1=12;function Gm(e){if(e.heightM!==void 0)return!1;let t=Me(e);if(!t||t.length<3)return!1;let n=0;for(let r=0;r<t.length;r++){let i=t[r],a=t[(r+1)%t.length];n+=Math.hypot(a.x-i.x,a.y-i.y)}return n*he<g1*2?!1:2*Ho(t)/n*he<=y1}function Xa(e){if(!e)return null;for(let[t,n]of b1)if(t.test(e))return n;return null}var zm="auto-rows-";function Um(e){return e.id.startsWith(zm)&&!e.label}var x1=1.15,M1=.09,jm=6,v1=34,S1=.35,w1=6,P1=.35,A1=.75,R1=12,E1=2.5,I1=40,_1=[18,24],C1=[12,16],Hm=14,T1=.8,L1=.6,k1=5,O1=.3,Wm=.4,Xm=2,F1=400,D1=2.6,N1=.8,B1=4,V1=26,G1=.7,H1=.5,z1=.985,U1=1.5,j1=2.2,W1=3,X1=25,K1=.985,Y1=2,$1=6,Z1=3,q1=.1,Q1=1.5,J1=1.6,ex=6e3,tx=.6,nx="#c3c7cd",Ka=300,ox=240;function rx(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=$a([...t]),i=new Set;for(let u of o)i.add(Math.floor(Math.atan2(u.y-r.y,u.x-r.x)*180/Math.PI/10));if(i.size*10<ox)return null;let{h:a,s,l:c}=fc(uc(e.fill));return a<70/360||a>170/360||s<.2||c<.08||c>.75||n.some(u=>u!==e&&u.type==="shape"&&Me(u)?.some(m=>Qa(m,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var ix="Estimated from the drawing; confirm with the venue.",Za=e=>{if(!e.length)return null;let t=[...e].sort((o,r)=>o-r),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2},$a=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),Ho=e=>{let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2};function ax(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function qa(e){let t=new Map;for(let n of e){let o=t.get(n.rowId);o?o.push(n):t.set(n.rowId,[n])}return t}function Qa(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function Ja(e,t){let n=t[0],o=1/0;for(let r=0;r<t.length;r++){let i=t[r],a=t[(r+1)%t.length],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>0?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/l)):0,m={x:i.x+s*u,y:i.y+c*u},f=Math.hypot(e.x-m.x,e.y-m.y);f<o&&(o=f,n=m)}return n}function Km(e,t){let n=0,o=0;for(let r of e.values()){if(r.length<3)continue;let i=r[0],a=r[r.length-1],s=a.x-i.x,c=a.y-i.y,l=Math.hypot(s,c);if(l<1e-6)continue;let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=Ja(u,t),f=m.x-u.x,h=m.y-u.y,d=Math.hypot(f,h);d<1e-6||(o+=Math.abs((-c*f+s*h)/(l*d))*r.length,n+=r.length)}return n?o/n:0}function sx(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=Me(r);return p?{shape:r,centre:$a(p),outline:p,inferred:!1}:null}if(!n.length)return null;let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let p of n)i=Math.min(i,p.x),a=Math.max(a,p.x),s=Math.min(s,p.y),c=Math.max(c,p.y);let l=(a-i)*(c-s),u=[];for(let p of o){if(p.role)continue;let b=Me(p);if(!b)continue;let x=Ho(b);if(x*he*he<6||x>l)continue;let y=Math.min(...b.map(P=>P.x)),M=Math.max(...b.map(P=>P.x)),A=Math.min(...b.map(P=>P.y)),w=Math.max(...b.map(P=>P.y)),g=0;for(let P of n)P.x>y&&P.x<M&&P.y>A&&P.y<w&&Qa(P,b)&&g++;if(g>n.length*.05)continue;let S=$a(b),v=Km(t,b);v>=T1&&u.push({shape:p,centre:S,outline:b,score:v,area:x,box:[y,A,M,w]})}let m=(p,b)=>b!==p&&b.area>p.area&&p.box[0]>=b.box[0]-1e-6&&p.box[1]>=b.box[1]-1e-6&&p.box[2]<=b.box[2]+1e-6&&p.box[3]<=b.box[3]+1e-6,f=u.filter(p=>!u.some(b=>m(p,b))),h=Math.max(0,...f.map(p=>p.score)),d=f.filter(p=>p.score>=h-.03).sort((p,b)=>b.area-p.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function cx(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=Ja(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function Ym(e){return e.length<3?[...e].sort((t,n)=>t.x-n.x||t.y-n.y):zn(e)}function lx(e){if(!e.length||e.length>ex)return[];let t=[...qa(e).values()],n=t.map((s,c)=>c),o=s=>n[s]===s?s:n[s]=o(n[s]),r=J1/he,i=t.map(s=>({minX:Math.min(...s.map(c=>c.x))-r,maxX:Math.max(...s.map(c=>c.x))+r,minY:Math.min(...s.map(c=>c.y))-r,maxY:Math.max(...s.map(c=>c.y))+r}));for(let s=0;s<t.length;s++)for(let c=s+1;c<t.length;c++){let l=i[s],u=i[c];if(l.maxX<u.minX||u.maxX<l.minX||l.maxY<u.minY||u.maxY<l.minY)continue;t[s].some(f=>t[c].some(h=>Math.hypot(f.x-h.x,f.y-h.y)<=r))&&(n[o(s)]=o(c))}let a=new Map;return t.forEach((s,c)=>{let l=o(c),u=a.get(l);u?u.push(...s):a.set(l,[...s])}),[...a.values()].filter(s=>new Set(s.map(c=>c.rowId)).size>=2)}function ux(e,t,n){if(!t.length)return null;let o=t.filter(v=>n.tableIds.has(v.rowId)||v.kind==="booth").length>t.length/2,r=qa(t),i=!n.outline||Km(r,n.outline)>=L1,a=0,s=0;for(let v of r.values()){if(v.length<2)continue;let P=v[0],E=v[v.length-1],k=E.x-P.x,L=E.y-P.y,I=Math.hypot(k,L);if(I<1e-6)continue;let R={x:(P.x+E.x)/2,y:(P.y+E.y)/2},_=i?n.outline?Ja(R,n.outline):n.focal:n.middle,F=-L/I,N=k/I;F*(_.x-R.x)+N*(_.y-R.y)<0&&(F=-F,N=-N),a+=F*v.length,s+=N*v.length}let c={x:t.reduce((v,P)=>v+P.x,0)/t.length,y:t.reduce((v,P)=>v+P.y,0)/t.length};if(Math.hypot(a,s)<1e-9){let v=i?n.focal:n.middle;a=v.x-c.x,s=v.y-c.y}let l=Math.hypot(a,s)||1,u={x:a/l,y:s/l},m=v=>-(v.x*u.x+v.y*u.y),f=v=>-v.x*u.y+v.y*u.x,h=1/0,d=-1/0,p=1/0,b=-1/0,x=1/0,y=new Map;for(let v of t){let P=m(v),E=f(v);h=Math.min(h,P),d=Math.max(d,P),p=Math.min(p,E),b=Math.max(b,E),i&&(x=Math.min(x,cx(v,n.focal,n.outline)));let k=v.logicalRowId??v.rowId,L=y.get(k);L?L.push(P):y.set(k,[P])}i||(x=Math.max(0,h-m(n.middle)));let M=[...y.values()].map(v=>Za(v)).sort((v,P)=>v-P),A=[];if(!o)for(let v of M)A.length&&v-A[A.length-1]<P1/he||A.push(v);let w=ax(e),g=$t(e,{floorBaseHeightM:n.baseHeightM}),S={id:e.id,section:e,authored:w,plane:n,facing:u,facesAction:i,hull:Ym(t),sample:t.filter((v,P)=>P%Math.ceil(t.length/F1)===0),frontD:h,backD:d,latMin:p,latMax:b,frontDistance:x,rowDepths:A,rowCount:A.length,level:0,height:g.height,rake:w?g.rake:0,backHeight:0};return S.backHeight=S.height+(d-h)*he*Math.tan(S.rake*Math.PI/180),S}function mx(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*he),i=n+x1-o,a=0,s=0;for(let l=1;l<e.length;l++){let u=Math.max(A1,(e[l]-e[l-1])*he),m=(i+M1)*(r+u)/r;a+=m-i,s+=u,i=m,r+=u}let c=Math.atan(a/s)*180/Math.PI;return Math.round(Math.max(jm,Math.min(v1,c))*10)/10}function fx(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<O1)return null;let o=-1/0,r=1/0,i=-1/0;for(let f of t.hull){o=Math.max(o,-(f.x*e.facing.x+f.y*e.facing.y));let h=-f.x*e.facing.y+f.y*e.facing.x;r=Math.min(r,h),i=Math.max(i,h)}if(Math.min(e.latMax,i)-Math.max(e.latMin,r)<(n?1e-6:Wm*(e.latMax-e.latMin)))return null;let s=Xm/he,c=new Map,l=new Map;for(let f of e.sample){let h=Math.floor((-f.x*e.facing.y+f.y*e.facing.x)/s),d=-(f.x*e.facing.x+f.y*e.facing.y);c.set(h,Math.min(c.get(h)??1/0,d))}for(let f of t.sample){let h=Math.floor((-f.x*e.facing.y+f.y*e.facing.x)/s),d=-(f.x*e.facing.x+f.y*e.facing.y);l.set(h,Math.max(l.get(h)??-1/0,d))}let u=[];for(let[f,h]of c){let d=l.get(f);d!==void 0&&u.push(h-d)}let m=u.length?Za(u):e.frontD-o;return m<-1/he?null:m}function hx(e,t){if(t.plane.floorIndex>=e.plane.floorIndex)return!1;let n=-1/0,o=1/0,r=1/0,i=-1/0;for(let c of t.hull){let l=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,l),o=Math.min(o,l);let u=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,u),i=Math.max(i,u)}let a=Math.min(e.latMax,i)-Math.max(e.latMin,r),s=Math.min(e.backD,n)-Math.max(e.frontD,o);return a>Wm*(e.latMax-e.latMin)&&s>1/he}function dx(e,t){let n=new Set;for(let o of e){let r=(Math.atan2(o.y-t.y,o.x-t.x)*180/Math.PI+360)%360;n.add(Math.floor(r/10))}return n.size/36}function px(e,t){let n=1/0,o=-1/0;for(let i of t.hull){let a=-(i.x*e.facing.x+i.y*e.facing.y);n=Math.min(n,a),o=Math.max(o,a)}let r=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+r*he*Math.tan(t.rake*Math.PI/180)}function bx(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=Xm/he,r=Math.max(1,Math.ceil((e.backD-e.frontD)/o)),i={left:new Map,right:new Map};for(let s of t)if(!(s===e||s.plane.floorIndex!==e.plane.floorIndex)&&!(s.facing.x*e.facing.x+s.facing.y*e.facing.y>=z1))for(let c of s.sample){let l=-(c.x*e.facing.x+c.y*e.facing.y);if(l<e.frontD||l>e.backD)continue;let u=-c.x*e.facing.y+c.y*e.facing.x,m=u<e.latMin?"left":u>e.latMax?"right":null;if(!m)return!1;let f=Math.min(r-1,Math.floor((l-e.frontD)/o)),h=m==="left"?e.latMin-u:u-e.latMax;h<(i[m].get(f)?.gap??1/0)&&i[m].set(f,{gap:h,other:s})}let a=s=>{let c=s==="left"?e.latMin:e.latMax,l=0;for(let[u,{other:m}]of i[s]){if((m.facing.x*n.x+m.facing.y*n.y)*(s==="left"?1:-1)<G1)continue;let h=e.frontD+(u+.5)*o,d={x:-h*e.facing.x+c*n.x,y:-h*e.facing.y+c*n.y},p=-(d.x*m.facing.x+d.y*m.facing.y),b=-d.x*m.facing.y+d.y*m.facing.x;p<m.frontD&&b>=m.latMin&&b<=m.latMax&&l++}return l/r>=H1};return a("left")&&a("right")}function yx(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<K1)return!1;let n=1/0,o=-1/0,r=1/0;for(let s of t.hull){let c=-s.x*e.facing.y+s.y*e.facing.x;n=Math.min(n,c),o=Math.max(o,c),r=Math.min(r,-(s.x*e.facing.x+s.y*e.facing.y))}let i=(e.frontD-r)*he;if(i<-Y1||i>$1)return!1;let a=Math.max(n-e.latMax,e.latMin-o);return a*he<=Z1&&a*he>=-q1}function gx(e,t=!1,n=!1,o){let r=t?C1:_1,i=new Set(n?[]:e.filter(p=>!p.authored&&bx(p,e))),a=[...e].sort((p,b)=>p.plane.floorIndex-b.plane.floorIndex||Number(i.has(b))-Number(i.has(p))||p.frontDistance-b.frontDistance);for(let p of i)o?.add(p.id);let s=(p,b,x)=>{let y=new Map,M=[],A=new Map,w=g=>{if(g.plane.floorIndex===0||g.plane.baseHeightM>0)return g.plane.baseHeightM;let S=A.get(g.plane.floorIndex-1);return S===void 0?g.plane.baseHeightM:S+Vm};for(let g of a){if(i.has(g))g.height=w(g),g.level=0,g.rake=0,g.backHeight=g.height,y.set(g.id,void 0);else if(!g.authored){let v=w(g),P;for(let R of M){if(R.plane.floorIndex>g.plane.floorIndex)continue;if(hx(g,R)){let O=px(g,R)+D1;O>v&&(v=O,P=R);continue}let _=fx(g,R,i.has(R));if(_==null)continue;let F=n&&!!g.plane.stageDeck&&R.level===0&&R.plane.floorIndex===g.plane.floorIndex&&Math.max(0,_)*he<=B1,N=i.has(R)?R.height+U1:F?R.backHeight:R.backHeight+S1+Math.min(w1,Math.max(0,_)*he)*Math.tan(R.rake*Math.PI/180);N>v&&(v=N,P=R)}let E=p.get(g);E&&E.height>v+.01?(v=E.height,P=void 0):E=void 0,g.height=Math.round(Math.min(v,g.plane.baseHeightM+I1)*100)/100;let k=!P&&!E&&g.height>g.plane.baseHeightM;if(g.level=P?P.level+1:E?E.level:k?1:0,g.rake=mx(g.rowDepths,g.frontDistance,g.height,g.plane.focalHeightM),!g.facesAction&&g.rowCount<k1)g.rake=0;else if(g.level===0){let R=Math.max(1e-6,(g.backD-g.frontD)*he);g.rake=Math.min(g.rake,R1,Math.round(Math.atan(E1/R)*1800/Math.PI)/10)}else g.rowCount>=2&&(g.rake=Math.max(g.rake,r[Math.min(g.level,r.length)-1]));let L=(g.backD-g.frontD)*he,I=P&&i.has(P)||E&&x?.has(E.id);if(b!==void 0&&I&&g.rowCount>=2&&(g.rake=b),t&&L>0&&g.height+L*Math.tan(g.rake*Math.PI/180)>g.plane.baseHeightM+Hm){let R=Math.max(0,g.plane.baseHeightM+Hm-g.height);g.rake=Math.max(jm,Math.round(Math.atan(R/L)*1800/Math.PI)/10)}n&&g.plane.stageDeck&&g.level>0&&(g.rake=Math.min(g.rake,V1)),g.backHeight=g.height+L*Math.tan(g.rake*Math.PI/180),y.set(g.id,P?.id??(E?y.get(E.id):void 0))}let S=g.plane.floorIndex;A.set(S,Math.min(A.get(S)??1/0,g.height)),M.push(g)}return y},c=s(new Map),l=new Map,u=p=>l.get(p)?.height??p.height;for(let p=!0,b=0;p&&b<e.length;b++){p=!1;for(let x of e)if(!(x.authored||i.has(x)))for(let y of e){let M=l.get(y)??y;y===x||M.height-M.plane.baseHeightM<Q1||M.height<=u(x)+.01||yx(x,y)&&(l.set(x,M),p=!0)}}let m=new Map(e.map(p=>[p.id,p])),f=e.filter(p=>!p.authored&&p.rowCount>=2&&i.has(m.get(c.get(p.id)??""))),h=f.length?Za(f.map(p=>p.rake)):void 0;if(!l.size&&h===void 0)return c;let d=new Map([...new Set(l.values())].map(p=>[p,{...p}]));return s(new Map([...l].map(([p,b])=>[p,d.get(b)])),h,new Set(f.map(p=>p.id)))}var Ya=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function Jr(e,t={x:0,y:-40}){let n=Gn(e),o=new Map;for(let x of n){if(!x.sectionId)continue;let y=o.get(x.sectionId);y?y.push(x):o.set(x.sectionId,[x])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((x,y)=>({objects:x.objects,floorIndex:y,floorId:x.id,baseHeightM:x.baseHeightM??0,focal:x.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],a=new Set(i.flatMap(x=>x.objects.filter(y=>y.type==="table").map(y=>y.id))),s=[],c,l=new Set,u=i.map(x=>{let y=I=>!e.floors?.length||I.floorId===x.floorId,M=lx(n.filter(I=>!I.sectionId&&I.kind!=="booth"&&!a.has(I.rowId)&&y(I))),A=[];for(let I of M){let R=Tt(Ct(Ym(I)),tx/he);if(n.some(F=>!y(F)&&Qa(F,R)))continue;let _=`${zm}${x.floorIndex}-${A.length}`;l.add(_),o.set(_,I),A.push({type:"section",id:_,label:"",color:nx,outline:R})}let w=A.length?{...x,objects:[...x.objects,...A]}:x,g=new Set(w.objects.filter(I=>I.type==="section").map(I=>I.logicalSectionId??I.id)),S=[...o.entries()].filter(([I])=>g.has(I)).flatMap(([,I])=>I),v=sx(w.objects,qa(S),S),P=w.focal;(v||w.focal&&!Ya(w.focal,t))&&(r.confident=!0),v&&(r.stage??={id:v.shape.id,inferred:v.inferred,...w.floorId?{floorId:w.floorId}:{}},(v.inferred||Ya(w.focal,t))&&(P=v.centre,r.focalInferred=!0));let E=v&&(!v.inferred||Ho(v.outline)*he*he<=Ka),k=v?void 0:c,L={tableIds:a,floorIndex:w.floorIndex,floorId:w.floorId,baseHeightM:w.baseHeightM,focal:k?.focal??P,outline:v?.outline??k?.outline,focalHeightM:k?.focalHeightM??w.baseHeightM+(v&&E?St({...v.shape,role:"stage"}).heightM:0),stageDeck:k?.stageDeck??!!(v&&E&&Ho(v.outline)*he*he<=Ka),middle:S.length?{x:S.reduce((I,R)=>I+R.x,0)/S.length,y:S.reduce((I,R)=>I+R.y,0)/S.length}:P};for(let I of w.objects){if(I.type!=="section")continue;let R=ux(I,o.get(I.logicalSectionId??I.id)??[],L);R&&s.push(R)}return L.outline&&(c=L),Ya(w.focal,L.focal)||(r.focal??=[]).push({...w.floorId?{floorId:w.floorId}:{},point:{...L.focal}}),{unit:w,plane:L,stage:v,planeSeats:S}}),m=i.flatMap(x=>x.objects).map(x=>x.type==="shape"&&!x.role&&(Xa(x.label)==="wall"||!Xa(x.label)&&Gm(x))?{...x,role:"wall"}:x),f=Jt({objects:m},n)!==null;f&&(r.indoor=!0);let h=new Set,d=gx(s,f,dx(n,u[0]?.plane.focal??t)<N1,h),p=new Map(s.filter(x=>!x.authored).map(x=>[x.id,x])),b=u.map(({unit:x,plane:y,stage:M,planeSeats:A})=>x.objects.map(w=>{let g=w.type==="shape"&&!w.role&&w.id!==M?.shape.id?Xa(w.label):null;if(w.type==="shape"&&!w.role&&w.id!==M?.shape.id&&(g==="wall"||!g&&Gm(w))&&w.type==="shape"){(r.roles??=[]).push({id:w.id,...y.floorId?{floorId:y.floorId}:{},role:"wall"});let{fill:R,..._}=w;return{..._,role:"wall"}}if(g&&w.type==="shape")return(r.roles??=[]).push({id:w.id,...y.floorId?{floorId:y.floorId}:{},role:g}),{...w,role:g};let v=M?.inferred&&w.id===M.shape.id&&w.type==="shape"?rx(w,M.outline,x.objects,A):null;if(v&&w.type==="shape")return r.stage?.id===w.id&&(r.stage.field=v),{...w,role:"stage",stageKind:v};let P=w.type==="shape"&&w.id===M?.shape.id&&w.heightM===void 0&&!w.stageKind&&s.some(R=>R.plane===y&&(h.has(R.id)||R.level===0&&R.facesAction&&R.rake<=W1&&(R.frontDistance+R.backD-R.frontD)*he>=X1)),E=P?{heightM:j1}:{};if(M?.inferred&&w.id===M.shape.id&&w.type==="shape"&&Ho(M.outline)*he*he<=Ka)return r.stage?.id===w.id&&(r.stage.deck=!0),{...w,role:"stage",...E};if(P&&w.type==="shape"&&w.role==="stage")return{...w,...E};let k=w.type==="section"?p.get(w.id):void 0;if(!k||w.type!=="section")return w;let L=k.rowCount>=2&&k.rake>0;l.has(k.id)?r.looseRowBlocks=(r.looseRowBlocks??0)+1:r.sections.push({id:k.id,floorId:y.floorId,surfaceKind:L?"rakedRows":"flat",height:k.height,rake:k.rake,stackedOn:d.get(k.id)});let I={status:"inferred",source:"public-2d-topology",note:ix};return{...w,height:k.height,rake:k.rake,surfaceKind:L?"rakedRows":"flat",physical3dProvenance:{height:I,rake:I,surfaceKind:I}}}));if(e.floors?.length){let x=e.floors.map((y,M)=>({...y,objects:b[M],focalPoint:u[M].plane.focal}));return{doc:{...e,floors:x,objects:x[0].objects,focalPoint:x[0].focalPoint},report:r}}return{doc:{...e,objects:b[0],focalPoint:u[0].plane.focal},report:r}}var $m=/^[\p{L}\p{N}]{1,4}$/u,xx=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function Zm(e,t){let n=t?.trim();if(!n)return e;let o=e.toLocaleLowerCase("en-US"),r=n.toLocaleLowerCase("en-US");if(o.startsWith(`${r} `)){let a=e.slice(n.length).trim();if($m.test(a))return a}let i=xx.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((r.startsWith(a)||a.startsWith(r))&&$m.test(s))return s}return e}var qm={inline:"Inline booth \xB7 1 open side",corner:"Corner booth \xB7 2 open sides",peninsula:"Peninsula booth \xB7 3 open sides",island:"Island booth \xB7 4 open sides"},Mx=new Map(Xi.map(e=>[e.key,e.label]));function vx(e){return`picker.access.${e}`}function Qm(e){let t=[],n=e.boothType;n&&Object.prototype.hasOwnProperty.call(qm,n)&&t.push({key:`booth:${n}`,icon:"booth",titleKey:`picker.boothType.${n}`,titleFallback:qm[n],tone:"place"});let o=e.wheelchairSpaceType;for(let s of e.accessibility??[]){if(s==="wheelchair"&&o)continue;let c=Mx.get(s);c&&t.push({key:`access:${s}`,icon:s,titleKey:vx(s),titleFallback:c,tone:"access"})}o==="no-seat"?t.push({key:"wheelchair:no-seat",icon:"wheelchair",titleKey:"picker.emptyWheelchairSpace",titleFallback:"Empty wheelchair space",tone:"access"}):o==="seat-present"&&t.push({key:"wheelchair:seat-present",icon:"wheelchair",titleKey:"picker.accessiblePhysicalSeat",titleFallback:"Accessible physical seat",tone:"access"}),e.aisle===!0&&t.push({key:"place:aisle",icon:"aisle",titleKey:"picker.aisleSeat",titleFallback:"Aisle seat",tone:"place"});let r=e.commercial;r?.restrictedView&&t.push({key:"mark:restrictedView",icon:"restrictedView",titleKey:"picker.restrictedView",titleFallback:"Restricted view",tone:"warn"}),r?.obstructedView&&t.push({key:"mark:obstructedView",icon:"obstructedView",titleKey:"picker.obstructedView",titleFallback:"Obstructed view",tone:"warn"}),r?.premium&&t.push({key:"mark:premium",icon:"premium",titleKey:"picker.premiumSeat",titleFallback:"Premium seat",tone:"premium"});let i=r?.note?.trim();if(i){let s=t.find(c=>c.tone==="warn"||c.tone==="premium");s?s.note=i:t.push({key:"note",icon:"note",titleKey:"picker.organizerNote",titleFallback:"Organizer note",tone:"note",note:i})}let a=typeof e.entrance=="string"?e.entrance.trim():"";return a&&t.push({key:"place:entrance",icon:"entrance",titleKey:"picker.entrance",titleFallback:"Entrance",tone:"place",note:a}),t}function Jm(e,t,n){return n<0?t>1?e.filter(o=>o.kind==="floor"):[...e]:e.filter(o=>o.floorIndex===void 0||o.floorIndex===n)}function ef(e,t){let n=[...e].sort((r,i)=>r.screen.y-i.screen.y),o=[];for(let r of n){let i=o.find(a=>a.some(s=>Math.abs(s.screen.x-r.screen.x)<104&&Math.abs(s.screen.y-r.screen.y)<34));i?i.push(r):o.push([r])}return o.flatMap(r=>r.length<2?r:r.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(r.length-1)/2)*104))}})))}var Sx=1.15,wx=2.75,Px=4.5,Ax=.85,Rx=.5,Ex=.26;function tf(e,t,n){let o=Math.max(1e-6,t),r=e/o,i=n?.hasZoneLabels??!0,a=new Set(["stage","gate"]);return r>=.75&&a.add("floor"),r>=Sx&&a.add("zone"),r<=(i?wx:Px)&&(a.add("section"),a.add("ga")),r<=Ax&&(a.add("annotation"),a.add("booth")),r<=Rx&&a.add("row"),r<=Ex&&a.add("seat"),a}function nf(e,t,n,o,r,i=6){let a=i+t,s=o-i-t,c=i+n,l=r-i-n;return{...e,x:a>s?o/2:Math.max(a,Math.min(s,e.x)),y:c>l?r/2:Math.max(c,Math.min(l,e.y))}}function Ot(e,t,n,o){let r=e,i=t[0],a=t[1],s=t[2],c=r[0]*i+r[4]*a+r[8]*s+r[12],l=r[1]*i+r[5]*a+r[9]*s+r[13],u=r[2]*i+r[6]*a+r[10]*s+r[14],m=r[3]*i+r[7]*a+r[11]*s+r[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let f=c/m,h=l/m,d=u/m,p=f>=-1.05&&f<=1.05&&h>=-1.05&&h<=1.05&&d<=1;return{x:(f*.5+.5)*n,y:(1-(h*.5+.5))*o,depth:d,visible:p}}function of(e,t,n=t,o=()=>0){let r=[],i=[...e].sort((a,s)=>o(s)-o(a)||a.screen.depth-s.screen.depth);for(let a of i){let s=!1;for(let c of r)if(zo(a,c,t,n)){s=!0;break}s||r.push(a)}return r}var Ix=6;function zo(e,t,n,o){let r=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+Ix):n;return r<a&&i<o}function rf(e,t,n){return e.length*t*.58+(n?14:0)}var _x={row:8,seat:14};function af(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:_x}function sf(e,t,n,o){let r=Math.max(1,Math.min(n,o)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-o/2)/r);return t*(1+1.5*i)}function Uo(e,t,n,o,r=[]){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>=o)break;let c=!1;for(let l of r)if(zo(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(zo(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}function es(e,t,n,o){let r=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15];return r<=0||!(n>0)?0:n*Math.hypot(e[0],e[4],e[8])*o/(2*r)}var Cx=1.5,Tx=30,Lx=4,kx=3.6,Ox=6,ts=15,Fx=3,Dx=1;function Nx(e){return Math.max(kx,Math.min(Ox,2.4+.15*e))}var jo=Math.PI*2;function Bx(e,t){let n=0,o=0;for(let m of e)n+=m.x,o+=m.y;let r=Math.atan2(o/e.length-t.y,n/e.length-t.x),i=e.map(m=>{let f=Math.atan2(m.y-t.y,m.x-t.x)-r;for(;f>Math.PI;)f-=jo;for(;f<-Math.PI;)f+=jo;return f+r}),a=i.map((m,f)=>f).sort((m,f)=>i[m]-i[f]),s=i[a[0]],c=i[a[a.length-1]];if(c-s>Math.PI)return null;let l=m=>Math.hypot(m.x-t.x,m.y-t.y),u=m=>{let f=e[m],h=(m+e.length-1)%e.length,d=(m+1)%e.length,p=Math.abs(i[h]-i[m])<=Math.abs(i[d]-i[m])?h:d,b=e[p];return l(f)<=l(b)?[f,b]:[b,f]};return{start:s,end:c,startEdge:u(a[0]),endEdge:u(a[a.length-1])}}function cf(e){return e.type==="shape"&&e.role==="wall"&&e.heightM===void 0}function ns(e,t,n=()=>!0){let o=[];for(let c of e){if(!cf(c)||!n(c))continue;let l=Me(c);if(!l||l.length<3)continue;let u=Bx(l,t);if(!u)return[];o.push(u)}if(o.length<2)return[];let r=e.flatMap(c=>{if(c.type!=="shape"||c.role!=="entrance"&&c.role!=="exit")return[];let l=Me(c);if(!l?.length)return[];let u=0,m=0;for(let f of l)u+=f.x,m+=f.y;return[{x:u/l.length,y:m/l.length}]}),i=c=>(c%jo+jo)%jo;o.sort((c,l)=>i(c.start)-i(l.start));let a=c=>Math.hypot(c.x-t.x,c.y-t.y),s=[];for(let c=0;c<o.length;c++){let l=o[c],u=o[(c+1)%o.length],m=i(u.start-l.end);if(m<=0||m>=Math.PI/2)continue;let f=g=>i(g-l.end)<m;if(o.some(g=>g!==l&&g!==u&&(f(g.start)||f(g.end)||i(l.end-g.start)<g.end-g.start)))continue;let[d,p]=l.endEdge,[b,x]=u.startEdge,y={x:(d.x+p.x)/2,y:(d.y+p.y)/2},M={x:(b.x+x.x)/2,y:(b.y+x.y)/2},A=Math.hypot(M.x-y.x,M.y-y.y)*C;if(A<Cx||A>Tx||Math.abs(a(y)-a(M))*C>Lx+.2*A)continue;let w={x:(y.x+M.x)/2,y:(y.y+M.y)/2};r.some(g=>f(Math.atan2(g.y-t.y,g.x-t.x))&&Math.abs(a(g)-a(w))*C<=Fx)||s.push({quad:[d,p,x,b],mid:w,widthM:A,openingM:Nx(A)})}return s}function lf(e,t){let n=[];for(let i of t)if(i.text?.trim())for(let a of e){let s=Math.hypot(i.position.x-a.mid.x,i.position.y-a.mid.y)*C;s<=ts&&n.push({text:i,gate:a,d:s})}n.sort((i,a)=>i.d-a.d);let o=new Map,r=new Set;for(let{text:i,gate:a}of n)o.has(i.id)||r.has(a)||(o.set(i.id,a),r.add(a));return o}function uf(e,t,n,o,r,i,a,s=()=>!0){let c=ns(t,Jn(n),s);if(!c.length)return;let l=t.find(m=>cf(m)&&s(m)),u=Xr(l?.fill,a);e.setMaterial(Vr);for(let m of c)r-m.openingM<Dx||Hr(e,m.quad,o+m.openingM,o+r,[],u.top,u.wall,i,r);e.setMaterial(0)}var Vx=6,Gx=2.2,ei=.1,Hx=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,zx=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),Ux=.3,jx=1.8,Wx=.9,Xx=.55,Kx=1,mf=4e3,Yx=6,ff="#d8a425",$x="#e8c15a",os="#1c1608";function hf(e){let t=Zx(e);if(!t)return null;let n=Qm(e).find(o=>o.icon===t.icon);return{...t,name:n?.titleFallback??t.icon}}function Zx(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:br(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:ff,ink:os}:n?.restrictedView?{icon:"restrictedView",color:ff,ink:os}:n?.premium?{icon:"premium",color:$x,ink:os}:null}function qx(e,t){if(!e)return;let n,o=0;for(let[i,a]of e)a>o&&(o=a,n=i);let r=t.categories?.find(i=>i.key===n)?.color;return r&&/^#[0-9a-f]{6}$/i.test(r)?r:void 0}var Qx=6e3,Jx=.25,df=[-90,90,-135,135,-45,45];function eM(e,t,n,o){let r=e.flatMap(({id:a,a:s,members:c})=>{let l=(s.minX+s.maxX)/2,u=(s.minY+s.maxY)/2,m=.5*Math.hypot(s.maxX-s.minX,s.maxY-s.minY),f=1/0;for(let h of c)f=Math.min(f,Math.hypot(t[h].x-l,t[h].y-u));return c.length&&f>=m*Jx?[{id:a,cx:l,cy:u,half:m,members:c}]:[]}).sort((a,s)=>a.half-s.half),i=new Map;return r.forEach(({id:a,cx:s,cy:c,members:l},u)=>{let m=o.x-s,f=o.y-c,p=(Math.hypot(m,f)>1e-6?Math.atan2(f,m):0)+df[u%df.length]*Math.PI/180,b=Math.cos(p),x=Math.sin(p),y=-1,M=-1/0;for(let A of l){let w=(t[A].x-s)*b+(t[A].y-c)*x;w>M&&(M=w,y=A)}i.set(a,[t[y].x*C,n.seatDeckY(y),t[y].y*C])}),i}function bf(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let f of n)for(let h of f.objects)h.type==="section"&&h.zone&&c.set(h.id,h.zone);let l=new Map,u=new Map;for(let f=0;f<o.length;f++){let h=o[f],d=r.seatOwner[f],p=h.zoneId??(d?c.get(d):void 0);if(!p)continue;let b=l.get(p);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(p,b));let x=u.get(p);x||u.set(p,x=[]),x.push(f),b.n++,h.x<b.minX&&(b.minX=h.x),h.y<b.minY&&(b.minY=h.y),h.x>b.maxX&&(b.maxX=h.x),h.y>b.maxY&&(b.maxY=h.y),b.sumY+=r.seatDeckY(f)}let m=eM(a.flatMap(f=>{let h=l.get(f.id);return h?[{id:f.id,a:h,members:u.get(f.id)??[]}]:[]}),o,r,i);for(let f of a){let h=l.get(f.id),d=[];for(let[p,b]of c)b===f.id&&d.push(p);if(!h||h.n===0){s.push({id:f.id,label:f.label,color:ve(f.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??i).x*C,1.5,(f.focalPoint??i).y*C]});continue}s.push({id:f.id,label:f.label,color:ve(f.color),sectionIds:d,seatCount:h.n,...m.has(f.id)?{labelAt:m.get(f.id)}:{},center:[(h.minX+h.maxX)/2*C,h.sumY/h.n,(h.minY+h.maxY)/2*C],radius:.5*Math.hypot((h.maxX-h.minX)*C,(h.maxY-h.minY)*C)||1,focalWorld:[(f.focalPoint??i).x*C,1.5,(f.focalPoint??i).y*C]})}}return s}function yf(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],m=[],f=new Map;for(let d of n)for(let p of d.objects){if(p.type!=="section"||!p.zone)continue;let b=(p.displayLabel||p.label||"").trim().toLocaleLowerCase();if(!b)continue;let x=t.floors?.[d.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&x===b)continue;let y=f.get(p.zone);y||f.set(p.zone,y=new Set),y.add(b)}for(let d of s)d.seatCount!==0&&(f.get(d.id)?.has(d.label.trim().toLocaleLowerCase())||l.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[(d.labelAt??d.center)[0],(d.labelAt??d.center)[1]+Vx,(d.labelAt??d.center)[2]],color:t.zones?.find(p=>p.id===d.id)?.color}));{let d=new Map,p=new Map,b=new Map,x=new Map;for(let y=0;y<o.length;y++){let M=r.seatOwner[y];if(!M)continue;let A=d.get(M);A||(A={n:0,x:0,y:0,deck:0},d.set(M,A)),A.n++,A.x+=o[y].x,A.y+=o[y].y,A.deck+=r.seatDeckY(y);let w=o[y].categoryKey;if(w){let S=p.get(M);S||(S=new Map,p.set(M,S)),S.set(w,(S.get(w)??0)+1)}if(o[y].accessibility?.includes("wheelchair")){let S=b.get(M);S?S.push(y):b.set(M,[y])}let g=x.get(M);g||(g={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},x.set(M,g)),g.minDeck=Math.min(g.minDeck,r.seatDeckY(y)),g.maxDeck=Math.max(g.maxDeck,r.seatDeckY(y)),o[y].x<g.minX&&(g.minX=o[y].x),o[y].x>g.maxX&&(g.maxX=o[y].x),o[y].y<g.minY&&(g.minY=o[y].y),o[y].y>g.maxY&&(g.maxY=o[y].y)}for(let y of n)for(let M of y.objects){if(M.type!=="section"||Um(M))continue;let A=d.get(M.id);if(!A||A.n===0)continue;let w=x.get(M.id),g=[A.x/A.n*C,A.deck/A.n,A.y/A.n*C],S=M.displayLabel||M.label||M.id;u.push({id:M.id,floorIndex:y.index,label:S,seatCount:A.n,center:g,radius:Math.max(1,Math.hypot(w.maxX-w.minX,w.maxY-w.minY)*.5*C),box:{min:[w.minX*C-.4,w.minDeck,w.minY*C-.4],max:[w.maxX*C+.4,w.maxDeck+1,w.maxY*C+.4]},focalWorld:[y.focal.x*C,y.baseHeightM+1.5,y.focal.y*C]});let v=t.floors?.[y.index]?.name?.trim().toLocaleLowerCase();if(!(n.length>1&&v===S.trim().toLocaleLowerCase())){let P=qx(p.get(M.id),t),E=b.get(M.id);l.push({id:`section:${M.id}`,kind:"section",text:S,anchor:[g[0],g[1]+Gx,g[2]],floorIndex:y.index,...P?{tint:P}:{},...E?{wheelchairSeats:E}:{}})}}}{for(let g of n)for(let S of g.objects){if(S.type!=="gaArea")continue;let v=Fn(S.points);if(!v)continue;let P=S.labelPresentation?.visible===!1?"":S.displayLabel||S.label||S.id,E=S.capacity>0?[P,S.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):P;E&&l.push({id:`ga:${S.id}`,kind:"ga",text:E,anchor:[v.x*C,g.baseHeightM+jx,v.y*C],floorIndex:g.index})}let d=new Map,p=new Map;for(let g of n)for(let S of g.objects)if(S.type==="section"&&d.set(S.id,S.displayLabel||S.label||S.id),S.type==="row"){let v=S.displayLabel?.trim()||S.segmentedRow?.displayLabel?.trim();v&&p.set(S.id,v)}let b=new Map;for(let g=0;g<o.length;g++){let S=o[g],v=Math.hypot(S.x-c.x,S.y-c.y),P=b.get(S.rowId);(!P||v>P.far)&&b.set(S.rowId,{seat:S,index:g,far:v})}for(let[g,S]of b){let v=r.seatOwner[S.index]??S.seat.sectionId,P=pf(S.seat.label,g,d.get(v??""),p.get(g));P&&l.push({id:`row:${g}`,kind:"row",text:P,anchor:[S.seat.x*C,r.seatDeckY(S.index)+Wx,S.seat.y*C],floorIndex:a[S.index]})}let x=new Map;for(let g=0;g<o.length;g++){let S=o[g],v=x.get(S.rowId);v||(v={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:pf(S.label,S.rowId,d.get(r.seatOwner[g]??S.sectionId??""),p.get(S.rowId)),sectionId:r.seatOwner[g]??S.sectionId},x.set(S.rowId,v));let P=g*3,E=i.iPosition[P],k=i.iPosition[P+1],L=i.iPosition[P+2];v.n++,v.x+=E,v.y+=k,v.z+=L,v.minX=Math.min(v.minX,E),v.maxX=Math.max(v.maxX,E),v.minZ=Math.min(v.minZ,L),v.maxZ=Math.max(v.maxZ,L)}for(let[g,S]of x)m.push({id:g,label:S.label,sectionId:S.sectionId,seatCount:S.n,center:[S.x/S.n,S.y/S.n,S.z/S.n],radius:Math.max(.8,Math.hypot(S.maxX-S.minX,S.maxZ-S.minZ)*.5)});let y=0,M=(g,S)=>{y++,l.push({id:`access:${o[g].id}`,kind:"access",text:S.name,icon:S.icon,color:S.color,...S.ink?{ink:S.ink}:{},seatWidthM:i.iChairWidth[g]*2,anchor:[o[g].x*C,r.seatDeckY(g)+Kx,o[g].y*C],floorIndex:a[g],rowId:o[g].rowId})},A=null,w=()=>{if(A){let g=hf(o[A.seats[0]]),S=A.seats.length,v=Math.max(1,Math.round(S/Yx));for(let P=0;P<v&&y<mf;P++)M(A.seats[Math.min(S-1,Math.floor((P+.5)*S/v))],g)}A=null};for(let g=0;g<o.length&&y<mf;g++){let S=hf(o[g]);if(S&&o[g].accessibility?.length){w(),M(g,S);continue}if(!S){w();continue}A&&A.rowId===o[g].rowId&&A.icon===S.icon?A.seats.push(g):(w(),A={rowId:o[g].rowId,icon:S.icon,seats:[g]})}if(w(),o.length<=Qx)for(let g=0;g<o.length;g++){let S=o[g],v=rs(S.displayLabel||S.label);v&&l.push({id:`seat:${S.id}`,kind:"seat",seatWidthM:i.iChairWidth[g]*2,text:v,anchor:[S.x*C,r.seatDeckY(g)+Xx,S.y*C],floorIndex:a[g],rowId:S.rowId})}}let h=Or(n);for(let d of n){let p=Jt(d,n.length===1?o:o.filter((y,M)=>a[M]===d.index)),b=p?lf(ns(d.objects,Jn(p)),d.objects.filter(y=>y.type==="text")):new Map,x=[...b.values()];for(let y of d.objects){let M=y.type==="text"?b.get(y.id):void 0;if(y.type==="shape"&&(y.role==="entrance"||y.role==="exit")&&Hx.test(y.label?.trim()??"")){let A=Me(y),w=A?Fn(A):null;if(w&&x.some(g=>Math.hypot(w.x-g.mid.x,w.y-g.mid.y)*C<=ts+g.widthM))continue}if(M&&y.type==="text")l.push({id:`text:${y.id}`,kind:"gate",text:y.text,icon:"entrance",anchor:[M.mid.x*C,d.baseHeightM+M.openingM+ei,M.mid.y*C],color:y.color,floorIndex:d.index});else if(y.type==="shape"&&y.role&&zx.has(y.role)){if(h.has(y))continue;let A=Me(y),w=A?Fn(A):null;if(!w||!y.label||y.gate?.hideFromBuyers)continue;l.push({id:`architecture:${y.id}`,kind:y.role==="stage"?"stage":y.role==="entrance"||y.role==="exit"?"gate":"annotation",text:y.label,...y.role==="entrance"||y.role==="exit"?{icon:y.role}:{},...y.gate?.stepFree?{stepFree:!0}:{},anchor:[w.x*C,d.baseHeightM+St(y).heightM+ei,w.y*C],color:y.fill,floorIndex:d.index})}else if(y.type==="text"){let A=y.semanticKind==="icon"?Fo(y.iconKey)?.key:void 0,w=y.text||(A?Fo(A).label:"");if(!w)continue;l.push({id:`text:${y.id}`,kind:"annotation",text:w,...A?{venueIcon:A}:{},anchor:A?[(y.position.x+y.fontSize/2)*C,d.baseHeightM+ei,(y.position.y+y.fontSize/2)*C]:[y.position.x*C,d.baseHeightM+ei,y.position.y*C],color:y.color,rotation:y.rotation,floorIndex:d.index})}else if(y.type==="booth"){if(y.labelPresentation?.visible===!1)continue;let A=At(y);if(!A)continue;let w=Fn(A);if(!w)continue;l.push({id:`booth:${y.id}`,kind:"booth",text:y.displayLabel||y.label||y.id,anchor:[w.x*C,d.baseHeightM+Kr+Ux,w.y*C],floorIndex:d.index})}}}return{labels:l,sections:u,rows:m}}function gf(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 rs(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function pf(e,t,n,o){if(o?.trim())return o.trim();let r=e?e.lastIndexOf("-"):-1,i=r>0?e.slice(0,r):t;return i&&Zm(i,n)}function xf(e){let{doc:t,units:n,seats:o,surfaces:r,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 f=0;f<i.floor.length;f+=1){let h=Math.max(0,Math.min(n.length-1,Math.round(i.floor[f]))),d=f*3,p=l[h];p.minX=Math.min(p.minX,i.position[d]),p.minY=Math.min(p.minY,i.position[d+1]),p.minZ=Math.min(p.minZ,i.position[d+2]),p.maxX=Math.max(p.maxX,i.position[d]),p.maxY=Math.max(p.maxY,i.position[d+1]),p.maxZ=Math.max(p.maxZ,i.position[d+2])}let u=new Map;for(let f=0;f<n.length;f++)for(let h of n[f].objects)h.type==="section"&&u.set(h.id,f);let m=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 f=0;f<o.length;f++){let h=r.seatOwner[f],d=(h!==null?u.get(h):void 0)??a[f];if(d===void 0)continue;let p=m[d],b=o[f];p.n++,b.x<p.minX&&(p.minX=b.x),b.y<p.minY&&(p.minY=b.y),b.x>p.maxX&&(p.maxX=b.x),b.y>p.maxY&&(p.maxY=b.y);let x=r.seatDeckY(f);p.sumX+=b.x*C,p.sumDeck+=x,p.sumZ+=b.y*C,p.minDeck=Math.min(p.minDeck,x),p.maxDeck=Math.max(p.maxDeck,x+1.6),s[f]=d}for(let f=0;f<n.length;f++){let h=m[f],d=t.floors?.[f],p=l[f],b=Math.min(h.n?h.minX*C:n[f].focal.x*C-1,Number.isFinite(p.minX)?p.minX:1/0),x=Math.max(h.n?h.maxX*C:n[f].focal.x*C+1,Number.isFinite(p.maxX)?p.maxX:-1/0),y=Math.min(h.n?h.minY*C:n[f].focal.y*C-1,Number.isFinite(p.minZ)?p.minZ:1/0),M=Math.max(h.n?h.maxY*C:n[f].focal.y*C+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),A=Math.min(h.n?Math.min(n[f].baseHeightM,h.minDeck):n[f].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),w=Math.max(h.n?Math.max(h.maxDeck,A+.5):A+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),g=[h.n?h.sumX/h.n:(b+x)/2,h.n?h.sumDeck/h.n:(A+w)/2,h.n?h.sumZ/h.n:(y+M)/2],S=Math.max(1,.5*Math.hypot(x-b,w-A,M-y));c.push({index:f,id:d?.id??`floor-${f}`,label:d?.name??(n.length>1?`Floor ${f+1}`:"Venue"),seatCount:h.n,center:g,radius:S,box:{min:[b,A,y],max:[x,w,M]},focalWorld:[n[f].focal.x*C,n[f].baseHeightM+1.5,n[f].focal.y*C]})}}return c}function cs(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<o&&(o=c),s>r&&(r=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=Yr(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=$r(c);if(l)for(let u of l)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function Rf(e,t,n,o,r,i){if(t.length===1){let a=n.map(m=>({x:m.x,y:m.y}));for(let m of t[0].objects)m.type==="section"?a.push(...m.outline):m.type==="shape"?a.push(...Me(m)??m.points??[]):m.type==="gaArea"?a.push(...m.points):m.type==="booth"?a.push(...At(m)??[]):m.type==="table"?a.push(...Yr(m)??[]):m.type==="decorImage"&&a.push(...$r(m)??[]);if(wf(e,t[0],n,i)||Af(e,t[0],n,a,i))return!1;if(Sf(e,t[0].baseHeightM,a,i))return!0;let s=Do(a),c=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,u=s.length>=3?s.map(m=>{let f=m.x-c,h=m.y-l,d=Math.max(1,Math.hypot(f,h));return{x:m.x+f/d*80,y:m.y+h/d*80}}):xo(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return ie(e,u,void 0,()=>-.04,-.22,i.ground,i.ground,oe),!1}else{let a=t.reduce((p,b)=>b.baseHeightM<p.baseHeightM?b:p);e.setFloor(a.index);let s={...a,objects:t.flatMap(p=>p.objects)},c=n.map(p=>({x:p.x,y:p.y}));for(let p of s.objects)p.type==="section"&&c.push(...p.outline);if(wf(e,s,n,i)||Af(e,s,n,c,i))return!1;if(Sf(e,a.baseHeightM,c,i))return!0;let l=n.filter((p,b)=>o[b]===a.index),u=cs([a],l),m=Math.hypot(u.maxX-u.minX,u.maxY-u.minY),f=Math.max(28,Math.min(80,m*.04)),h=xo(u.minX-f,u.minY-f,u.maxX-u.minX+f*2,u.maxY-u.minY+f*2),d=a.baseHeightM-.03;return ie(e,h,void 0,()=>d,d-.22,i.ground,i.ground,oe),!1}}function ls(e,t,n,o){let{cx:r,cz:i,radius:a}=n,s=1/0,c=1/0,l=1/0,u=-1/0,m=-1/0,f=-1/0,h=(b,x,y)=>{s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,x),m=Math.max(m,x),l=Math.min(l,y),f=Math.max(f,y)};for(let b=0;b<e.position.length;b+=3){let x=b/3;o&&x>=o[0]&&x<o[1]||h(e.position[b],e.position[b+1],e.position[b+2])}for(let b=0;b<t.count;b++){let x=b*3,y=t.iPosition[x],M=t.iPosition[x+1],A=t.iPosition[x+2],w=Math.max(.35,t.iMaxRadius[b]??.35);h(y-w,M,A-w),h(y+w,M+1.6,A+w)}Number.isFinite(s)||(s=r-a,u=r+a,c=0,m=a*.16,l=i-a,f=i+a);let d=[(s+u)/2,(c+m)/2,(l+f)/2],p=Math.max(1,.5*Math.hypot(u-s,m-c,f-l));return{center:d,radius:p,minY:c,maxY:m}}var tM=4096;function Ef(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/tM)),r=Math.ceil(e.count/o),i=new Float32Array((r*2+t.length*4+n.length)*3),a=0;for(let s=0;s<e.count;s+=o){let c=e.iPosition[s*3],l=e.iPosition[s*3+1],u=e.iPosition[s*3+2];i[a++]=c,i[a++]=l,i[a++]=u,i[a++]=c,i[a++]=0,i[a++]=u}for(let[s,c,l]of n)i[a++]=s,i[a++]=c,i[a++]=l;for(let s of t)for(let[c,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])i[a++]=s.cx+c*s.halfX,i[a++]=s.y,i[a++]=s.cz+l*s.halfZ;return i.subarray(0,a)}function If(e,t,n,o,r,i,a=[]){let s=1/0,c=1/0,l=-1/0,u=-1/0;for(let w=0;w<e.count;w++){let g=w*3,S=e.iPosition[g],v=e.iPosition[g+2];S<s&&(s=S),S>l&&(l=S),v<c&&(c=v),v>u&&(u=v)}for(let[w,,g]of a)w<s&&(s=w),w>l&&(l=w),g<c&&(c=g),g>u&&(u=g);for(let w of t)s=Math.min(s,w.cx-w.halfX),l=Math.max(l,w.cx+w.halfX),c=Math.min(c,w.cz-w.halfZ),u=Math.max(u,w.cz+w.halfZ);let m=n.minX*C,f=n.maxX*C,h=n.minY*C,d=n.maxY*C,p=m,b=f,x=h,y=d;if(Number.isFinite(s)){let w=Math.max(2,.06*Math.hypot(l-s,u-c));p=Math.max(m,s-w),b=Math.min(f,l+w),x=Math.max(h,c-w),y=Math.min(d,u+w)}let M=Math.min(0,o),A=Math.max(r,i*.05);return{min:[p,M,x],max:[b,A,y]}}var is=12,nM=.5,oM=6,as=.8,Mf=5,rM=.6,iM=40,ss=0,vf=8;function Sf(e,t,n,o){let r=Do([...n]);if(r.length<3)return!1;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let w of r)i=Math.min(i,w.x),s=Math.max(s,w.x),a=Math.min(a,w.y),c=Math.max(c,w.y);let l=Math.hypot(s-i,c-a)*C,u=Math.max(iM,l*rM),m=w=>Tt(r,w/C,1.2),f=m(nM),h=[f,m(oM),m(is),m(is+Mf),m(is+Mf+u)];if(h.some(w=>w.length!==f.length))return!1;let d=Se(o.ground,[.78,.76,.72],.35),p=Se(o.ground,[.56,.62,.52],.3),b=[d[0]*as,d[1]*as,d[2]*as],x=t-.04;e.setMaterial(ss),ie(e,f,void 0,()=>x,t-.22,b,b,oe);let y=[0,1,0],M=(w,g,S,v,P)=>{let E=w.map(R=>[R.x*C,x,R.y*C]),k=g.map(R=>[R.x*C,x,R.y*C]),[L,I]=P;for(let R=0;R<E.length;R++){let _=(R+1)%E.length;e.tri(E[R],k[_],k[R],y,S,v,v,[L,I,I]),e.tri(E[R],E[_],k[_],y,S,S,v,[L,L,I])}},A=[ss,ss];return M(h[0],h[1],b,d,A),M(h[1],h[2],d,d,A),M(h[2],h[3],d,p,A),M(h[3],h[4],p,p,[vf,vf+1]),e.setMaterial(0),!0}function wf(e,t,n,o){let r=Jt(t,n);if(!r)return!1;let i=t.baseHeightM,a=Se(o.ground,[.62,.55,.47],.4);return ie(e,r,void 0,()=>i-.04,i-.22,a,a,oe),!0}var aM=3e3,sM=20,Pf=1.5,cM=1.2,lM=.25;function Af(e,t,n,o,r){if(!n.length||n.length>aM||o.length<3)return!1;for(let P of t.objects){if(P.type==="shape"&&yn(P.stageKind))return!1;if(P.type==="section"){let{height:E}=$t(P,{floorBaseHeightM:t.baseHeightM});if(E-t.baseHeightM>sM)return!1}}let i=0,a=0;for(let P of o)i+=P.x,a+=P.y;i/=o.length,a/=o.length;let s=0,c=0,l=0;for(let P of o){let E=P.x-i,k=P.y-a;s+=E*E,c+=k*k,l+=E*k}let u=.5*Math.atan2(2*l,s-c),m=Math.cos(u),f=Math.sin(u),h=-f,d=m,p=1/0,b=-1/0,x=1/0,y=-1/0;for(let P of o){let E=(P.x-i)*m+(P.y-a)*f,k=(P.x-i)*h+(P.y-a)*d;p=Math.min(p,E),b=Math.max(b,E),x=Math.min(x,k),y=Math.max(y,k)}let M=P=>[[p-P,x-P],[b+P,x-P],[b+P,y+P],[p-P,y+P]].map(([E,k])=>({x:i+m*E+h*k,y:a+f*E+d*k})),A=M(Pf/C),w=M((Pf+lM)/C),g=t.baseHeightM,S=Se(r.ground,[.62,.55,.47],.4),v=Se(r.ground,[.86,.86,.84],.55);return ie(e,w,void 0,()=>g-.04,g-.22,S,S,oe),ie(e,w,[A.slice().reverse()],()=>g+cM,g-.04,Se(v,[1,1,1],.2),v,oe),!0}function _f(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=xl(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let m of n)for(let f of m.objects)f.type==="shape"&&i.set(f.id,{shape:f,unit:m});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(m=>{let f=m.runtimeContentImageUrl;return[m.id,typeof f=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(f)?f:void 0]})),l=[];for(let m of r.value.overlay.productionElements??[]){let f=i.get(m.objectId),h=f?Me(f.shape):null,d=m.baseElevationM??0;if(!f||!h||h.length<3||!m.id||a.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();a.add(m.id),s.add(m.objectId);let p=h.map(v=>v.x*C),b=h.map(v=>v.y*C),x=f.unit.baseHeightM+d,y=Math.min(...p),M=Math.max(...p),A=Math.min(...b),w=Math.max(...b),g,S=c.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&S&&(g=em(h,x,x+m.heightM,f.unit.focal),!g))if(M-y>=w-A){let v=Math.abs(A-f.unit.focal.y*C)<=Math.abs(w-f.unit.focal.y*C)?A-.006:w+.006;g=[[y,x,v],[M,x,v],[y,x+m.heightM,v],[M,x+m.heightM,v]]}else{let v=Math.abs(y-f.unit.focal.x*C)<=Math.abs(M-f.unit.focal.x*C)?y-.006:M+.006;g=[[v,x,A],[v,x,w],[v,x+m.heightM,A],[v,x+m.heightM,w]]}l.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:f.unit.index,baseY:x,topY:x+m.heightM,bounds:{min:[y,x,A],max:[M,x+m.heightM,w]},occlusion:m.occlusion,...S?{contentImageUrl:S}:{},...g?{contentPlane:g}:{}})}let u=l.sort((m,f)=>m.id.localeCompare(f.id));return{byObjectId:new Map(u.map(m=>[m.objectId,m])),elements:u}}function uM(e){let t=Math.min(1,Math.max(0,e));return t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055}function et(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function at(e){return Array.isArray(e)?e:[]}function mM(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!et(n))continue;let o=et(n.extensions)?n.extensions:null;if(o&&Object.prototype.hasOwnProperty.call(o,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function Wo(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function fM(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function hM(e,t){let n=new Array(16).fill(0);for(let o=0;o<4;o++)for(let r=0;r<4;r++)for(let i=0;i<4;i++)n[o*4+r]+=e[i*4+r]*t[o*4+i];return n}function dM(e){let t=Wo(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:Wo(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:Wo(e.rotation,4),r=e.scale===void 0?[1,1,1]:Wo(e.scale,3);if(!n||!o||!r)return null;let[i,a,s,c]=o,l=Math.hypot(i,a,s,c);if(!(l>1e-8))return null;let u=i/l,m=a/l,f=s/l,h=c/l,d=u+u,p=m+m,b=f+f,x=u*d,y=u*p,M=u*b,A=m*p,w=m*b,g=f*b,S=h*d,v=h*p,P=h*b;return[(1-(A+g))*r[0],(y+P)*r[0],(M-v)*r[0],0,(y-P)*r[1],(1-(x+g))*r[1],(w+S)*r[1],0,(M+v)*r[2],(w-S)*r[2],(1-(x+A))*r[2],0,n[0],n[1],n[2],1]}function pM(e,t,n,o){return[e[0]*t+e[4]*n+e[8]*o+e[12],e[1]*t+e[5]*n+e[9]*o+e[13],e[2]*t+e[6]*n+e[10]*o+e[14]]}function bM(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],a=e[9],s=e[2],c=e[6],l=e[10],u=i*l-a*c,m=a*s-r*l,f=r*c-i*s,h=t*u+n*m+o*f;if(Math.abs(h)<1e-12)return null;let d=1/h;return[u*d,m*d,f*d,(o*c-n*l)*d,(t*l-o*s)*d,(n*s-t*c)*d,(n*a-o*i)*d,(o*r-t*a)*d,(t*i-n*r)*d]}function Cf(e,t,n,o){let r=e[0]*t+e[1]*n+e[2]*o,i=e[3]*t+e[4]*n+e[5]*o,a=e[6]*t+e[7]*n+e[8]*o,s=Math.hypot(r,i,a)||1;return r/=s,i/=s,a/=s,[r,i,a]}function yM(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,o=null,r=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!o)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!et(c))return null;o=c}catch{return null}else if(a===5130562&&!r)r=s;else return null;n+=i}return n===e.byteLength&&o&&r?{json:o,bin:r}:null}function gM(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function xM(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function MM(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function vM(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=yM(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!et(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=at(o.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||mM(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||at(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(at(o.images).length||at(o.textures).length)return{ok:!1,issue:"external_resource"};let a=at(o.buffers);if(a.length!==1||!et(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let s=at(o.accessors),c=at(o.bufferViews),l=at(o.meshes),u=at(o.nodes),m=at(o.scenes),f=typeof o.scene=="number"?o.scene:0;if(!et(m[f]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(r.buffer,r.byteOffset,r.byteLength),d=(v,P,E,k=!1)=>{if(typeof v!="number"||!Number.isInteger(v)||!et(s[v]))return null;let L=s[v],I=typeof P=="string"?L.type===P:P.includes(L.type),R=L.componentType!==5126,_=k&&R?L.normalized===!0:L.normalized!==!0;if(!I||L.sparse!==void 0||!_||typeof L.count!="number"||!Number.isInteger(L.count)||L.count<1||typeof L.componentType!="number"||!E.includes(L.componentType)||typeof L.bufferView!="number")return null;let F=c[L.bufferView];if(!et(F)||F.buffer!==0||typeof F.byteLength!="number"||!Number.isInteger(F.byteLength)||F.byteLength<0)return null;let N=xM(L.type),O=gM(L.componentType),V=typeof F.byteStride=="number"?F.byteStride:N*O,z=typeof F.byteOffset=="number"?F.byteOffset:0,G=typeof L.byteOffset=="number"?L.byteOffset:0,T=z+G,D=G+(L.count-1)*V+N*O;if(!Number.isInteger(V)||!Number.isInteger(z)||!Number.isInteger(G)||V<N*O||z<0||G<0||z+F.byteLength>r.byteLength||D>F.byteLength)return null;let W=[];for(let H=0;H<L.count;H++){let j=[];for(let Z=0;Z<N;Z++){let X=MM(h,T+H*V+Z*O,L.componentType);if(!Number.isFinite(X))return null;j.push(X)}W.push(j)}return W},p=[],b=[],x=[],y=!1,M=at(o.materials),A=v=>{if(v===void 0)return null;if(typeof v!="number"||!Number.isInteger(v)||!et(M[v]))return!1;let P=M[v].pbrMetallicRoughness;if(P===void 0)return null;if(!et(P))return!1;if(P.baseColorFactor===void 0)return null;let E=Wo(P.baseColorFactor,4);return!E||E.some(k=>k<0||k>1)?!1:[E[0],E[1],E[2]]},w=0,g=new Set,S=(v,P)=>{if(typeof v!="number"||!Number.isInteger(v)||!et(u[v])||g.has(v))return!1;g.add(v);let E=u[v],k=dM(E);if(!k)return!1;let L=hM(P,k),I=bM(L);if(!I)return!1;if(E.mesh!==void 0){if(typeof E.mesh!="number")return!1;let R=l[E.mesh];if(!et(R))return!1;for(let _ of at(R.primitives)){if(!et(_)||_.mode!==void 0&&_.mode!==4||!et(_.attributes))return!1;let F=d(_.attributes.POSITION,"VEC3",[5126]),N=_.attributes.NORMAL===void 0?null:d(_.attributes.NORMAL,"VEC3",[5126]);if(!F||_.attributes.NORMAL!==void 0&&!N)return!1;let O=A(_.material);if(O===!1)return!1;let V=_.attributes.COLOR_0===void 0?null:d(_.attributes.COLOR_0,["VEC3","VEC4"],[5126,5121,5123],!0);if(_.attributes.COLOR_0!==void 0&&(!V||V.length!==F.length))return!1;let z=V?s[_.attributes.COLOR_0]:null,G=!z||z.componentType===5126?1:z.componentType===5121?1/255:1/65535,T=O!==null||V!==null;T&&(y=!0);let D=F.length;if(_.indices!==void 0){let H=typeof _.indices=="number"?s[_.indices]:null;D=et(H)?H.count:void 0}if(typeof D!="number"||!Number.isInteger(D)||D%3!==0||(w+=D/3,w>1e5))return!1;let W=_.indices===void 0?F.map((H,j)=>[j]):d(_.indices,"SCALAR",[5121,5123,5125]);if(!W||W.length%3!==0||W.length!==D)return!1;for(let H=0;H<W.length;H+=3){let j=[W[H][0],W[H+1][0],W[H+2][0]];if(j.some(ee=>!Number.isInteger(ee)||ee<0||ee>=F.length))return!1;let Z=j.map(ee=>pM(L,...F[ee])),X=null;if(!N){let ee=Z[1][0]-Z[0][0],ne=Z[1][1]-Z[0][1],ue=Z[1][2]-Z[0][2],de=Z[2][0]-Z[0][0],me=Z[2][1]-Z[0][1],pe=Z[2][2]-Z[0][2];X=Cf([1,0,0,0,1,0,0,0,1],ne*pe-ue*me,ue*de-ee*pe,ee*me-ne*de)}for(let ee=0;ee<3;ee++){if(p.push(...Z[ee]),b.push(...N?Cf(I,...N[j[ee]]):X),!T){x.push(-1,-1,-1);continue}let ne=V?V[j[ee]]:null;for(let ue=0;ue<3;ue++)x.push(uM((O?O[ue]:1)*(ne?ne[ue]*G:1)))}}}}for(let R of at(E.children))if(!S(R,L))return!1;return g.delete(v),!0};for(let v of at(m[f].nodes))if(!S(v,fM()))return{ok:!1,issue:w>1e5?"triangle_limit":"unsupported_glb"};return!w||p.length!==w*9||b.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:w,position:new Float32Array(p),normal:new Float32Array(b),color:y?new Float32Array(x):null}}function Tf(e){try{return vM(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function no(e){let{doc:t}=e,n=$l(t,e.eventConfigurationId??t.eventConfigurationId),o=Zc(t.theme,ou(n,e.seats)),r=o.structure,i=_f(e.eventConfigurationId,e.eventConfiguration,n),a=e.seats,s=new xr,c=null;if(e.registeredShellGlb){let $=Tf(e.registeredShellGlb);if($.ok){let B=$.position.length/3,Y=new Float32Array($.position.length),q=o.materials.shell??r.tierWall,J=$.color;for(let te=0;te<B;te++){let ae=$.normal[te*3+1],fe=ae<-.25?.4:.62+.38*Math.max(0,ae),Ue=!!J&&J[te*3]!==-1;Y[te*3]=(Ue?J[te*3]:q[0])*fe,Y[te*3+1]=(Ue?J[te*3+1]:q[1])*fe,Y[te*3+2]=(Ue?J[te*3+2]:q[2])*fe}c={position:$.position,normal:$.normal,color:Y,floor:new Float32Array(B).fill(-2),material:new Float32Array(B),count:B}}}let l=new Map;for(let $ of n)for(let B of $.objects)l.set(B.id,$.index),B.type==="section"&&l.set(B.logicalSectionId??B.id,$.index);let u=a.map($=>l.get($.sectionId??"")??l.get($.rowId??"")??0),m=cs(n,a),f=s.vertexCount,d=Rf(s,n,a,u,m,r)?s.vertexCount:f,p=Ol(t,a),b=new Map,x=new Map;for(let $ of t.categories??[])b.set($.key,$.color),$.seatGlyph&&x.set($.key,$.seatGlyph);let y=[],M=Ju(n,a,u),A=new Map;a.forEach(($,B)=>{let Y=M.seatDeckY(B);Number.isFinite(Y)&&A.set($.rowId,Math.min(A.get($.rowId)??1/0,Y))});let w=new Float32Array(a.length),g=[],S=new Map((t.floors??[]).map(($,B)=>[$.id,B])),v=n.map(()=>[]);for(let $ of a){let B=$.floorId?S.get($.floorId)??0:0;v[Math.min(B,v.length-1)]?.push($)}let P=($,B)=>{if(!B||B.length<3)return!1;let Y=Math.min(...B.map(ae=>ae.x)),q=Math.max(...B.map(ae=>ae.x)),J=Math.min(...B.map(ae=>ae.y)),te=Math.max(...B.map(ae=>ae.y));for(let ae=0;ae<$;ae++)for(let fe of v[ae])if(!(fe.x<Y||fe.x>q||fe.y<J||fe.y>te)&&Ke(fe,B,void 0))return!0;return!1},E=Or(n),k=null,L=$=>n.length===1?a:a.filter((B,Y)=>u[Y]===$),I=($,B)=>{let Y=At($);if(!Y)return!1;let q=1/0,J=1/0,te=-1/0,ae=-1/0;for(let fe of Y)q=Math.min(q,fe.x),te=Math.max(te,fe.x),J=Math.min(J,fe.y),ae=Math.max(ae,fe.y);return a.some((fe,Ue)=>fe.kind!=="booth"&&(n.length===1||u[Ue]===B)&&fe.x>q&&fe.x<te&&fe.y>J&&fe.y<ae&&Ze(Y,fe.x,fe.y))},R,_=[],F;for(let $=0;$<n.length;$++){let B=n[$];s.setFloor($);let Y=Jt(B,L($)),q=0;if(Y){let se=0;for(let Te of B.objects)if(Te.type==="section")for(let ht of M.bySection.get(Te.id)?.rowLevels??[])se=Math.max(se,ht.y-B.baseHeightM);q=Ku(se);for(let Te of Y)_.push([Te.x*C,Te.y*C]);if(F=Math.max(F??-1/0,B.baseHeightM+q),!R){let Te=Jn(Y);R={centre:[Te.x*C,Te.y*C]}}}let J=new Ir,te=[],ae=B.objects.filter(se=>se.type==="shape"&&(se.role==="entrance"||se.role==="exit")),fe=B.objects.filter(se=>se.type==="section"&&!!se.outline&&se.outline.length>=3),Ue=Mm(B.objects.filter(se=>se.type==="booth"),B.focal);for(let se of B.objects)if(se.type==="section"){let Te=s.vertexCount;Dm(s,se,B,Fl(se,p),M.bySection.get(se.id),J,fe,r,$>0&&P($,se.outline));let ht=s.vertexCount-Te;ht>0&&g.push({sectionId:se.id,start:Te,count:ht})}else if(se.type==="shape"){let Te=i.byObjectId.get(se.id);if(E.has(se)&&!Te)continue;let ht=y.length,Ee=Y!==null&&se.role==="wall"&&!Te;s.setMaterial(Ee?Vr:(Te?.kind??se.role)==="screen"?1:0);let qe=se.role==="stage"&&!Te?Sm(se,L($)):Ee&&se.heightM===void 0?{...se,heightM:q}:se,cn=eu(qe,te);if(bm(s,qe,B.baseHeightM+cn.supportOffsetM,cn.topOffsetM-cn.supportOffsetM,r,B.focal,y,Te,ae),s.setMaterial(0),se.role==="stage"&&!Te&&y.length>ht&&(k??$)===$){k=$;let lt=t.floors?.[$]?.id,xt=n.length>1&&lt?a.filter(Rt=>Rt.floorId===lt):a;nu(s,qe,y[y.length-1].y,xt,{deck:y[y.length-1].top,night:!Vt(r)});let Wt=vt(qe.stageKind)?Me(qe):null;Wt&&Eu(s,qe,Wt,y[y.length-1].y,xt,B.objects.some(Rt=>Rt.type==="shape"&&Rt.role==="goal"),B.objects.some(Rt=>Rt.type==="shape"&&Rt.role==="dugout")),Wt&&yn(qe.stageKind)&&Iu(s,Wt,y[y.length-1].y,xt,Wr),s.setMaterial(0)}}else se.type==="gaArea"?gm(s,se,B.baseHeightM,ve(b.get(se.categoryKey)),r):se.type==="booth"?hm(s,se,B.baseHeightM,ve(b.get(se.categoryKey)),r,Ue.get(se.id)??B.focal,I(se,$)):se.type==="table"?pm(s,se,Math.max(B.baseHeightM,A.get(se.id)??B.baseHeightM),ve(se.fill??t.theme?.decorFill??"#232c40"),r,!!(se.fill??t.theme?.decorFill)):se.type==="decorImage"&&ym(s,se,B.baseHeightM,r);Y&&uf(s,B.objects,Y,B.baseHeightM,q,B.focal,r,se=>!i.byObjectId.has(se.id)),Bm(s,B,a,M,r,o.materials.shell,!c)}let N=n.length>1?{x:n.reduce(($,B)=>$+B.focal.x,0)/n.length,y:n.reduce(($,B)=>$+B.focal.y,0)/n.length}:t.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},O=Nc(c?[s.build(),c]:[s.build()]),V=new Map;for(let $ of n)for(let B of $.objects)B.type==="table"&&V.set(B.id,B.center);let z=Gc(a,e.initialState,M,w,b,x,new Set(V.keys())),G=bf({doc:t,units:n,seats:a,surfaces:M,focal:N}),{labels:T,sections:D,rows:W}=yf({doc:t,units:n,seats:a,surfaces:M,seatData:z,hintedSeatFloor:u,zones:G,focal:N}),H=new Map(D.map(($,B)=>[$.id,B]));M.seatOwner.forEach(($,B)=>{z.iSection[B]=$?H.get($)??-1:-1});let j=xf({doc:t,units:n,seats:a,surfaces:M,solids:O,hintedSeatFloor:u,seatFloor:w});gf(T,j),z.iYaw=sc(z.iPosition,a.length,$=>a[$].rowId,$=>{let B=n[w[$]]?.focal??N;return[B.x*C,B.y*C]},$=>{let B=V.get(a[$].rowId);return B?[B.x*C,B.y*C]:void 0});let Z=(m.minX+m.maxX)/2*C,X=(m.minY+m.maxY)/2*C,ee=.5*Math.hypot((m.maxX-m.minX)*C,(m.maxY-m.minY)*C)||10,ne=ls(O,z,{cx:Z,cz:X,radius:ee},[f,d]),ue=ls(O,z,{cx:Z,cz:X,radius:ee}),de=wM(n),me=If(z,y,m,ne.minY,ne.maxY,ee,de),pe=!R&&n.some($=>$.objects.some(B=>B.type==="shape"&&yn(B.stageKind))),Pe=!!o.house&&!pe&&!c&&(!!R||o.house.indoor),_e=y.flatMap($=>[[$.cx-$.halfX,$.cz-$.halfZ],[$.cx+$.halfX,$.cz-$.halfZ],[$.cx+$.halfX,$.cz+$.halfZ],[$.cx-$.halfX,$.cz+$.halfZ]]),xe=Pe?Yu(z.iPosition,a.length,n[0]?.baseHeightM??0,[..._e,..._],F):null;return{sharedAisles:Hc(n.flatMap($=>$.objects.flatMap(B=>{if(B.type!=="section")return[];let Y=M.bySection.get(B.id);return Y?[{sectionId:B.id,floorIndex:$.index,rows:Y.rowLevels}]:[]}))),solids:O,sectionSolidRanges:g,seats:z,seatSectionIds:M.seatOwner,bounds:{center:[(me.min[0]+me.max[0])/2,(me.min[1]+me.max[1])/2,(me.min[2]+me.max[2])/2],radius:ee,groundY:0,box:me,fitPoints:Ef(z,y,de)},...R?{room:R}:{},...pe?{outdoor:!0}:{},...xe?{house:xe}:{},renderBounds:{center:ne.center,radius:ne.radius},clipBounds:{center:ue.center,radius:ue.radius},stateColorLUT:qc(o,je),theme:o,seatCount:a.length,focalWorld:[N.x*C,1.5,N.y*C],zones:G,stages:y,productionElements:i.elements,sections:D,rows:W,labels:T,floors:j}}function wM(e){let t=[];for(let n of e)for(let o of n.objects){let r=o.type==="gaArea"?o.points:o.type==="booth"?At(o):null;for(let i of r??[])t.push([i.x*C,n.baseHeightM,i.y*C])}return t}var nn=require("ogl"),PM=.05,AM=.55,RM=12,EM=1.6,IM=1,_M=2.5,CM=650,wn={height:6,baseRadius:.16,topRadius:.3,fadeInFromM:16,fullByM:40,nearStrength:.6};function TM(e,t){if(t)return 0;let n=(e-wn.fadeInFromM)/(wn.fullByM-wn.fadeInFromM);return Math.max(wn.nearStrength,Math.min(1,n))}var Lf=24;function LM(e){let t=[],n=[],o=[],r=(m,f,h)=>{t.push(...m),n.push(...f),o.push(h)};for(let m=0;m<16;m++){let f=m/16*Math.PI*2,h=(m+1)/16*Math.PI*2,d=M=>[Math.cos(M),0,Math.sin(M)],p=[Math.cos(f)*.012,0,Math.sin(f)*.012],b=[Math.cos(h)*.012,0,Math.sin(h)*.012],x=[Math.cos(f)*.03,1,Math.sin(f)*.03],y=[Math.cos(h)*.03,1,Math.sin(h)*.03];r(p,d(f),0),r(x,d(f),0),r(y,d(h),0),r(p,d(f),0),r(y,d(h),0),r(b,d(h),0)}let c=.16,l=.24,u=.01;for(let m=0;m<48;m++){let f=m/48*Math.PI*2,h=(m+1)/48*Math.PI*2,d=[Math.cos(f)*c,u,Math.sin(f)*c],p=[Math.cos(f)*l,u,Math.sin(f)*l],b=[Math.cos(h)*l,u,Math.sin(h)*l],x=[Math.cos(h)*c,u,Math.sin(h)*c];for(let y of[d,p,b,d,b,x])r(y,[0,1,0],1)}for(let m=0;m<32;m++){let f=m/32*Math.PI*2,h=(m+1)/32*Math.PI*2,d=wn.baseRadius,p=wn.topRadius,b=[Math.cos(f)*d,0,Math.sin(f)*d],x=[Math.cos(h)*d,0,Math.sin(h)*d],y=[Math.cos(f)*p,1,Math.sin(f)*p],M=[Math.cos(h)*p,1,Math.sin(h)*p],A=[Math.cos(f),0,Math.sin(f)],w=[Math.cos(h),0,Math.sin(h)];r(b,A,2),r(y,A,2),r(M,w,2),r(b,A,2),r(M,w,2),r(x,w,2)}return new nn.Geometry(e,{position:{size:3,data:new Float32Array(t)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(o)}})}var kM=`#version 300 es
34
+ }`,qr=class{constructor(t,n,o){this.gl=t;this.renderer=n;this.samples=o;this.fbo=null;this.colour=null;this.depth=null;this.resolved=null;this.copy=null;this.width=0;this.height=0;this.active=null;this.unavailable=!1}begin(t){if(this.active=null,!t||this.unavailable||this.samples<2)return null;let n=this.gl,o=n.drawingBufferWidth,r=n.drawingBufferHeight;return o<1||r<1?null:(!this.fbo||o!==this.width||r!==this.height)&&(this.release(),!this.allocate(o,r))?(this.unavailable=!0,this.release(),null):(this.active={target:n.FRAMEBUFFER,buffer:this.fbo,width:o,height:r,depth:!0,stencil:!1},this.active)}end(){if(!this.active||!this.resolved||!this.copy)return;let t=this.gl,{width:n,height:o}=this.active;this.active=null,t.bindFramebuffer(t.READ_FRAMEBUFFER,this.fbo),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.resolved.buffer),t.blitFramebuffer(0,0,n,o,0,0,n,o,t.COLOR_BUFFER_BIT,t.NEAREST),this.unbind(),this.renderer.render({scene:this.copy,clear:!1})}reset(){this.fbo=null,this.colour=null,this.depth=null,this.resolved=null,this.copy=null,this.active=null,this.width=0,this.height=0}dispose(){this.release()}allocate(t,n){let o=this.gl,r=Math.min(this.samples,o.getParameter(o.MAX_SAMPLES));if(r<2)return!1;this.fbo=o.createFramebuffer(),this.colour=o.createRenderbuffer(),this.depth=o.createRenderbuffer(),o.bindRenderbuffer(o.RENDERBUFFER,this.colour),o.renderbufferStorageMultisample(o.RENDERBUFFER,r,o.RGBA8,t,n),o.bindRenderbuffer(o.RENDERBUFFER,this.depth),o.renderbufferStorageMultisample(o.RENDERBUFFER,r,o.DEPTH_COMPONENT24,t,n),o.bindRenderbuffer(o.RENDERBUFFER,null),o.bindFramebuffer(o.FRAMEBUFFER,this.fbo),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.RENDERBUFFER,this.colour),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,this.depth);let i=o.checkFramebufferStatus(o.FRAMEBUFFER)===o.FRAMEBUFFER_COMPLETE;if(this.unbind(),!i)return!1;this.resolved=new pn.RenderTarget(this.gl,{width:t,height:n,depth:!1,minFilter:o.NEAREST,magFilter:o.NEAREST});let a=new pn.Program(this.gl,{vertex:B0,fragment:H0,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{tFrame:{value:this.resolved.texture}}});return this.copy=new pn.Mesh(this.gl,{geometry:new pn.Triangle(this.gl),program:a}),this.copy.frustumCulled=!1,this.width=t,this.height=n,!0}unbind(){let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,null),this.renderer.state.framebuffer=null}release(){let t=this.gl;if(this.fbo&&t.deleteFramebuffer(this.fbo),this.colour&&t.deleteRenderbuffer(this.colour),this.depth&&t.deleteRenderbuffer(this.depth),this.resolved){for(let n of this.resolved.textures)t.deleteTexture(n.texture);t.deleteFramebuffer(this.resolved.buffer)}this.copy&&(this.copy.geometry.remove(),this.copy.program.remove()),this.reset()}};function Ml(e,t,n){return e<=n&&t<=500}var G0=25,V0=30,z0=8,U0=.8,W0=250,Qr=class{constructor(){this.limit=1/0;this.recent=[];this.slow=0;this.last=null}allows(t){return t<this.limit}frame(t,n,o){if(!t){this.last=null;return}let r=this.last===null?null:o-this.last;if(this.last=o,r===null||r>W0)return;let i=r>G0;this.recent.push(i),i&&(this.slow+=1),this.recent.length>V0&&this.recent.shift()&&(this.slow-=1),this.slow>=z0&&(this.limit=Math.min(this.limit,n*U0),this.recent=[],this.slow=0)}};var oo=require("ogl");var Oa=Math.PI/180,j0="map";function Sl(e){return e.touchNavigation??j0}var X0=3,Fa=6;function Jr(e,t,n=Fa){return Math.hypot(e,t)>n}var ei=10*Oa,K0=10,Y0=.35,$0=1e3/60;function Z0(e,t,n){let o=Math.sin(e.polar),r=o*Math.sin(e.azimuth),i=Math.cos(e.polar),a=o*Math.cos(e.azimuth),s=[e.target[0]+e.distance*r,e.target[1]+e.distance*i,e.target[2]+e.distance*a],c=-r,l=-i,u=-a,m=-u,h=c,f=Math.hypot(m,h)||1;m/=f,h/=f;let d=-h*l,p=h*c-m*u,b=m*l,y=Math.tan(e.fovYDeg*Oa/2),g=y*(e.aspect>0?e.aspect:1);return{eye:s,ray:[c+t*g*m+n*y*d,l+n*y*p,u+t*g*h+n*y*b]}}function Da(e,t,n,o,r=X0){let{eye:i,ray:a}=Z0(e,t,n);if(a[1]>=-1e-6)return null;let s=(o-i[1])/a[1];return!(s>0)||s*Math.hypot(a[0],a[1],a[2])>e.distance*r?null:[i[0]+a[0]*s,o,i[2]+a[2]*s]}function Na(e,t,n,o){let r=Da(e,n,o,t[1]);return r?[e.target[0]+t[0]-r[0],e.target[1],e.target[2]+t[2]-r[2]]:null}function wl(e,t){return!(e>0)||!(t>0)?1:Math.max(.5,Math.min(2,e/t))}function Pl(e,t,n){let o=e+n;if(t)return{soFar:o,turning:t,turn:n};let r=Math.abs(o)-ei;return r>0?{soFar:o,turning:!0,turn:Math.sign(o)*r}:{soFar:o,turning:!1,turn:0}}function Al(e,t,n){let o=e[0]-t[0],r=e[2]-t[2],i=Math.cos(n),a=Math.sin(n);return[t[0]+o*i+r*a,e[1],t[2]-o*a+r*i]}function Rl(e,t){let n=t[0].x-e[0].x,o=t[0].y-e[0].y,r=t[1].x-e[1].x,i=t[1].y-e[1].y;if(Math.max(Math.hypot(n,o),Math.hypot(r,i))<K0)return"undecided";let a=e[1].x-e[0].x,s=e[1].y-e[0].y,c=Math.hypot(a,s),l=c>0&&Math.abs(s)/c<.5,u=o*i>0&&Math.abs(o)>=4&&Math.abs(i)>=4&&Math.abs(o)>2*Math.abs(n)&&Math.abs(i)>2*Math.abs(r),m=Math.abs(Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y)-c);return l&&u&&m<Math.max(8,c*.1)?"tilt":"free"}function El(e){let t=Math.tan(e.fovYDeg*Oa/2);return e.distance*t*Math.min(1,e.aspect>0?e.aspect:1)}function vl(e,t,n,o,r){let i=2*Math.max(0,r),a=Math.min(Math.max(0,o-n),i*(1-Y0)),s=Math.min(n+a-r,t),c=Math.max(o-a+r,t);return Math.max(s,Math.min(c,e))}function Il(e,t,n,o){return[vl(e[0],t[0],n.minX,n.maxX,o),e[1],vl(e[2],t[2],n.minZ,n.maxZ,o)]}function _l(e,t,n){let o=n&&Number.isFinite(t)?Math.max(1,Math.min(4,t/$0)):1;return 1-Math.pow(1-e,o)}var lt=Math.PI/180,ti=15*lt,ni=80*lt,Cl=.12,Tl=35,Ba=1.25,kl=.006,q0=4,ro=.82,Zo=1/ro,Q0=.12,J0=2;function Ll(e,t){return{azimuth:0-e*kl,polar:-t*kl}}function Ol(e,t,n){let o=Math.max(J0,Math.max(1,t)*Q0),r=n*q0;return{minDist:e?Math.min(e.minDist,o):o,maxDist:e?Math.max(e.maxDist,r):r}}var eb=1.5;function tb(e,t,n){let o=Math.max(1,n)*eb;if(!e)return{anchor:[t[0],t[1],t[2]],limit:o};let[r,i,a]=e.anchor,s=t[1]-i,c=Math.max(Math.abs(t[0]-r),Math.abs(t[2]-a),s>=0?s:-s*2);return{anchor:e.anchor,limit:Math.max(e.limit,c+o)}}function nb(e,t,n,o,r,i,a,s){let c=Math.sin(n),l=[c*Math.sin(t),Math.cos(n),c*Math.cos(t)],u=[e[0]+o*l[0],e[1]+o*l[1],e[2]+o*l[2]],m=[-l[0],-l[1],-l[2]],h=[-m[2],0,m[0]],f=Math.hypot(h[0],h[2])||1;h=[h[0]/f,0,h[2]/f];let d=[h[1]*m[2]-h[2]*m[1],h[2]*m[0]-h[0]*m[2],h[0]*m[1]-h[1]*m[0]],p=Math.tan(r*lt/2),b=p*(i>0?i:1),y=[0,1,2].map(P=>m[P]+a*b*h[P]+s*p*d[P]);if(y[1]>=-1e-6)return null;let g=(e[1]-u[1])/y[1],v=Math.hypot(y[0],y[1],y[2]);return!(g>0)||g*v>o*ob?null:[u[0]+y[0]*g,e[1],u[2]+y[2]*g]}var oi=3,ob=4,Fl=.72,rb=.6;function ib(e,t,n){return e!=="auto"?e:n!==null&&t<n*rb?"pan":"orbit"}function Dl(e,t){let n=Math.sin(t),o=-n*Math.sin(e),r=-Math.cos(t),i=-n*Math.cos(e);if(Math.abs(r)>.999)return null;let a=-i,s=o,c=Math.hypot(a,s);return a/=c,s/=c,{fx:o,fy:r,fz:i,rx:a,rz:s,ux:-s*r,uy:s*o-a*i,uz:a*r}}var ab=.4;function sb(e,t,n,o,r,i){let a=[e.center[0],e.center[1],e.center[2]],s=i(a),c=e.fitPoints,l=Dl(o,r);if(!c||c.length<9||!l)return{center:a,distance:s};let{fx:u,fy:m,fz:h,rx:f,rz:d,ux:p,uy:b,uz:y}=l,g=Math.hypot(u,h),v=u/g,P=h/g,w=v*p+P*y,x=ab*Math.max(1,e.radius);for(let S=0;S<3;S++){let A=1/0,M=-1/0,E=1/0,T=-1/0;for(let B=0;B+2<c.length;B+=3){let F=c[B]-a[0],N=c[B+1]-a[1],V=c[B+2]-a[2],H=s+F*u+N*m+V*h;if(!(H>.001))continue;let L=(F*f+V*d)/(H*t),G=(F*p+N*b+V*y)/(H*n);L<A&&(A=L),L>M&&(M=L),G<E&&(E=G),G>T&&(T=G)}if(!Number.isFinite(A))break;let k=(A+M)/2*s*t,_=Math.abs(w)>.1?(E+T)/2*s*n/w:0,R=k*f+_*v,C=k*d+_*P;if(Math.hypot(a[0]+R-e.center[0],a[2]+C-e.center[2])>x){let B=a[0]-e.center[0],F=a[2]-e.center[2],N=B+R,V=F+C,H=x/Math.hypot(N,V);R=N*H-B,C=V*H-F}a=[a[0]+R,a[1],a[2]+C],s=i(a)}return{center:a,distance:s}}var ri=class{constructor(t,n,o,r){this.fovY=Tl;this.target=new oo.Vec3;this.azimuth=-30*lt;this.polar=55*lt;this.distance=10;this.azT=-30*lt;this.polT=55*lt;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;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 oo.Vec3;this.panAnchor=new oo.Vec3;this.panLimit=0;this.panBox=null;this.zoomPointResolver=null;this.primaryDragMode="auto";this.overviewDist=null;this.pinchAngle=0;this.touchNavigation="classic";this.mapGesture=!1;this.hold=null;this.holdY=0;this.holdOnSeat=!1;this.touchStart=null;this.touchMoving=!1;this.twoStart=null;this.twoIntent="undecided";this.twistSoFar=0;this.twistTurning=!1;this.pair=null;this.catchingUp=!1;this.eventRect=null;this.venueFootprint=null;this.lastUpdateMs=0;this.wasMoving=!1;this.camera=new oo.Camera(t,{fov:Tl,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=o,this.onGesture=r,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&&(this.mapGesture=this.touchNavigation==="map"&&(i.pointerType==="touch"||i.pointerType==="pen")),this.mapGesture){this.withEventRect(()=>this.mapTouchDown(i.clientX,i.clientY));return}if(this.activePointers.size===1){let a=this.dragAction(),s=a==="orbit"?"pan":"orbit",c=i.button===2||i.button===1||i.shiftKey?s:a;this.panning=c==="pan",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(),this.pinchAngle=this.currentPinchAngle();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;let a=this.activePointers.get(i.pointerId);if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.mapGesture){this.withEventRect(()=>this.mapTouchMove(i.clientX-a.x,i.clientY-a.y,i.pointerId));return}if(this.activePointers.size>=2){let u=this.currentPinchDistance(),m=this.pinchCentroid();this.pinchDist>0&&(this.dollyAt(Math.exp((this.pinchDist-u)*.005),m.x,m.y),this.fireGesture()),this.pinchDist=u;let h=this.currentPinchAngle(),f=h-this.pinchAngle;f>Math.PI&&(f-=2*Math.PI),f<-Math.PI&&(f+=2*Math.PI),this.pinchAngle=h,Math.abs(f)>1e-4&&Math.abs(f)<.5&&(this.azT+=f,this.fireGesture()),this.panBy(m.x-this.pinchCx,m.y-this.pinchCy),this.pinchCx=m.x,this.pinchCy=m.y;return}let s=i.clientX-this.lastX,c=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(s!==0||c!==0)&&(this.panBy(s,c),this.fireGesture());return}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(s!==0||c!==0)&&this.fireGesture();let l=Ll(s,c);this.azT+=l.azimuth,this.polT=Math.max(ti,Math.min(ni,this.polT+l.polar)),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.mapGesture&&this.withEventRect(()=>this.mapTouchUp())},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.dollyAt(Math.exp(s*.22),i.clientX,i.clientY),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*lt;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(ti,Math.min(ni,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(ro);else if(i.key==="-"||i.key==="_")this.dollyBy(Zo);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,o=0;for(let r of t)n+=r.x,o+=r.y;return{x:n/t.length,y:o/t.length}}panBy(t,n){let o=this.canvas.clientHeight||1,r=2*this.distance*Math.tan(this.fovY*lt/2)/o,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),u=Math.sin(this.polar),m=-i*l,h=-a*l;this.targetT.x+=(-t*s+n*m)*r,this.targetT.z+=(-t*c+n*h)*r,this.targetT.y+=n*u*r,this.clampPan(),this.requestRender()}widenPanBox(t){if(!this.panBox){let n=Math.max(1,t.radius);this.venueFootprint=t.box?{minX:t.box.min[0],maxX:t.box.max[0],minZ:t.box.min[2],maxZ:t.box.max[2]}:{minX:t.center[0]-n,maxX:t.center[0]+n,minZ:t.center[2]-n,maxZ:t.center[2]+n}}this.panBox=tb(this.panBox,t.center,t.radius),this.panAnchor.set(this.panBox.anchor[0],this.panBox.anchor[1],this.panBox.anchor[2]),this.panLimit=this.panBox.limit}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,o=this.panAnchor.y,r=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(r-t,Math.min(r+t,this.targetT.z)),this.targetT.y=Math.max(o-t*.5,Math.min(o+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchAngle(){let[t,n]=[...this.activePointers.values()];return t&&n?Math.atan2(n.y-t.y,n.x-t.x):0}dragAction(){return ib(this.primaryDragMode,this.distT,this.overviewDist)}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()}dollyAt(t,n,o){let r=this.distT,i=this.canvas.getBoundingClientRect?.(),a=this.zoomPointResolver?.(n,o)??null;if(a){this.distT=Math.max(oi,Math.min(this.maxDist,this.distT*t)),this.minDist=Math.min(this.minDist,Math.max(oi,this.distT)),this.requestRender(),this.scaleTargetAbout(a,this.distT/r);return}let s=i&&i.width>0&&i.height>0?nb([this.targetT.x,this.targetT.y,this.targetT.z],this.azT,this.polT,this.distT,this.fovY,this.camera.aspect||i.width/i.height,(n-i.left)/i.width*2-1,1-(o-i.top)/i.height*2):null;this.dollyBy(t),s&&this.scaleTargetAbout(s,this.distT/r)}scaleTargetAbout(t,n){!Number.isFinite(n)||n===1||(this.targetT.x=t[0]+(this.targetT.x-t[0])*n,this.targetT.y=t[1]+(this.targetT.y-t[1])*n,this.targetT.z=t[2]+(this.targetT.z-t[2])*n,this.clampPan())}setZoomPointResolver(t){this.zoomPointResolver=t}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0,this.endMapGesture())}setTouchNavigation(t){this.touchNavigation=t,t!=="map"&&this.endMapGesture()}get touchNavigationMode(){return this.touchNavigation}endMapGesture(){this.mapGesture=!1,this.hold=null,this.touchStart=null,this.touchMoving=!1,this.twoStart=null,this.pair=null,this.catchingUp=!1}withEventRect(t){this.eventRect=this.canvas.getBoundingClientRect?.()??null;try{t()}finally{this.eventRect=null}}steeredPose(){let t=this.eventRect??this.canvas.getBoundingClientRect?.();return{target:[this.targetT.x,this.targetT.y,this.targetT.z],azimuth:this.azT,polar:this.polT,distance:this.distT,fovYDeg:this.fovY,aspect:this.camera.aspect||(t&&t.height>0?t.width/t.height:1)}}ndc(t,n){let o=this.eventRect??this.canvas.getBoundingClientRect?.();return!o||!(o.width>0)||!(o.height>0)?null:{x:(t-o.left)/o.width*2-1,y:1-(n-o.top)/o.height*2}}takeHold(t,n){let o=this.ndc(t,n);this.hold=o?Da(this.steeredPose(),o.x,o.y,this.holdY):null}applySteered(){if(this.catchingUp){this.requestRender();return}this.target.copy(this.targetT),this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT,this.applyPosition(),this.requestRender()}steerTarget(t){let n=[this.targetT.x,this.targetT.y,this.targetT.z],o=this.venueFootprint?Il(t,n,this.venueFootprint,El(this.steeredPose())):t;this.targetT.set(o[0],o[1],o[2])}mapTouchDown(t,n){if(this.dragging=!1,this.panning=!1,this.activePointers.size===1){let o=this.zoomPointResolver?.(t,n)??null;this.holdY=o?o[1]:this.targetT.y,this.holdOnSeat=!!o,this.touchStart={x:t,y:n},this.touchMoving=!1,this.hold=null;return}if(this.activePointers.size===2){let[o,r]=[...this.activePointers.values()];this.twoStart=[{...o},{...r}],this.twoIntent="undecided",this.twistSoFar=0,this.twistTurning=!1,this.hold=null;let[i,a]=[...this.activePointers.keys()];this.pair=[i,a],this.touchMoving||(this.catchingUp=this.isSettling()),this.touchMoving=!0}}isSettling(){let t=Math.max(1e-4,this.distance*1e-4);return Math.abs(this.azT-this.azimuth)>1e-4||Math.abs(this.polT-this.polar)>1e-4||Math.abs(this.distT-this.distance)>1e-4||Math.abs(this.targetT.x-this.target.x)>t||Math.abs(this.targetT.y-this.target.y)>t||Math.abs(this.targetT.z-this.target.z)>t}rebasePair(){let t=[...this.activePointers.keys()],[n,o]=[...this.activePointers.values()];!n||!o||(this.pair=[t[0],t[1]],(this.twoIntent==="undecided"||!this.twoStart)&&(this.twoStart=[{...n},{...o}]),this.pinchDist=Math.hypot(o.x-n.x,o.y-n.y),this.pinchAngle=Math.atan2(o.y-n.y,o.x-n.x),this.pinchCy=(n.y+o.y)/2,this.hold=null,this.twoIntent==="free"&&this.takeHold((n.x+o.x)/2,(n.y+o.y)/2))}mapTouchMove(t,n,o){this.catchingUp&&!this.isSettling()&&(this.catchingUp=!1);let r=[...this.activePointers.values()];if(r.length>=2&&this.twoStart){let c=[...this.activePointers.keys()];if(o!==c[0]&&o!==c[1])return;this.mapTwoFingerMove(r[0],r[1]);return}let i=r[0];if(!i)return;if(!this.touchMoving){if(!this.touchStart||!Jr(i.x-this.touchStart.x,i.y-this.touchStart.y))return;this.touchMoving=!0,this.catchingUp=this.isSettling(),this.takeHold(i.x,i.y);return}let a=this.ndc(i.x,i.y),s=this.hold&&a?Na(this.steeredPose(),this.hold,a.x,a.y):null;if(s)this.steerTarget(s);else{let c=[this.targetT.x,this.targetT.y,this.targetT.z];this.panBy(t,n);let l=[this.targetT.x,this.targetT.y,this.targetT.z];this.targetT.set(c[0],c[1],c[2]),this.steerTarget(l),this.takeHold(i.x,i.y)}this.fireGesture(),this.applySteered()}mapTwoFingerMove(t,n){let o=(t.x+n.x)/2,r=(t.y+n.y)/2,i=Math.hypot(n.x-t.x,n.y-t.y),a=Math.atan2(n.y-t.y,n.x-t.x);if(this.twoIntent==="undecided"){if(this.twoIntent=Rl(this.twoStart,[t,n]),this.twoIntent==="undecided")return;this.pinchDist=i,this.pinchAngle=a;let[m,h]=this.twoStart,f=a-Math.atan2(h.y-m.y,h.x-m.x);f>Math.PI&&(f-=2*Math.PI),f<-Math.PI&&(f+=2*Math.PI),this.twistSoFar=Math.max(-ei,Math.min(ei,f)),this.pinchCy=r,this.twoIntent==="free"&&this.takeHold(o,r);return}if(this.twoIntent==="tilt"){this.polT=Math.max(ti,Math.min(ni,this.polT+Ll(0,r-this.pinchCy).polar)),this.pinchCy=r,this.fireGesture(),this.applySteered();return}let s=this.ndc(o,r);this.hold||this.takeHold(o,r);let c=this.hold&&s?Na(this.steeredPose(),this.hold,s.x,s.y):null;c&&this.steerTarget(c);let l=wl(this.pinchDist,i);if(this.pinchDist=i,l!==1){let m=this.distT,h=this.holdOnSeat?oi:this.minDist;this.distT=Math.max(Math.min(h,m),Math.min(this.maxDist,m*l)),this.holdOnSeat&&(this.minDist=Math.min(this.minDist,Math.max(oi,this.distT))),Number.isFinite(this.distT)||(this.distT=m);let f=this.distT/m;this.hold&&Number.isFinite(f)&&f!==1&&this.steerTarget([this.hold[0]+(this.targetT.x-this.hold[0])*f,this.hold[1]+(this.targetT.y-this.hold[1])*f,this.hold[2]+(this.targetT.z-this.hold[2])*f])}let u=a-this.pinchAngle;if(u>Math.PI&&(u-=2*Math.PI),u<-Math.PI&&(u+=2*Math.PI),this.pinchAngle=a,Math.abs(u)<.5){let m=Pl(this.twistSoFar,this.twistTurning,u);this.twistSoFar=m.soFar,this.twistTurning=m.turning,m.turn!==0&&(this.azT+=m.turn,this.hold&&this.steerTarget(Al([this.targetT.x,this.targetT.y,this.targetT.z],this.hold,m.turn)))}this.fireGesture(),this.applySteered()}mapTouchUp(){if(this.activePointers.size===0){this.endMapGesture();return}if(this.activePointers.size===1){let[n]=[...this.activePointers.values()];this.twoStart=null,this.pair=null,this.touchMoving=!0,this.takeHold(n.x,n.y);return}let t=[...this.activePointers.keys()];this.twoStart&&(!this.pair||this.pair[0]!==t[0]||this.pair[1]!==t[1])&&this.rebasePair()}frame(t,n=!1,o,r=!1,i){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t);let a=Math.max(1,t.radius),s=this.fovY*lt/2,c=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=o??-30*lt,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*lt;let u=this.framedOn(t,s,l),m=u.distance;this.target.set(u.center[0],u.center[1],u.center[2]),this.targetT.copy(this.target),this.distT=m*Math.max(1.05,Math.min(2,i?.margin??Ba)),this.envelope=Ol(this.envelope,a,m),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.overviewDist===null&&(this.overviewDist=this.distT),n?(this.azimuth=this.azT,this.polar=12*lt,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){if(!(t>0)||!Number.isFinite(t))return;let n=this.camera.aspect;if(this.interactionEnabled&&n>0){let o=Math.min(n,1)/Math.min(t,1);this.distance*=o,this.distT*=o,this.overviewDist!==null&&(this.overviewDist*=o),this.maxDist=Math.max(this.maxDist,this.distance,this.distT),this.applyPosition()}this.camera.perspective({aspect:t})}glideTo(t,n){this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.widenPanBox(t),this.targetT.set(t.center[0],t.center[1],t.center[2]);let o=this.fovY*lt/2,r=Math.atan(Math.tan(o)*(this.camera.aspect||1));this.azT=this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*lt;let i=this.framedOn(t,o,r),a=i.distance;this.targetT.set(i.center[0],i.center[1],i.center[2]),this.distT=a*Math.max(1.05,Math.min(2,n?.margin??Ba)),this.envelope=Ol(this.envelope,Math.max(1,t.radius),a),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.requestRender()}frameSoft(t,n,o=!1,r){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t),this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*lt/2,a=o?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,r?.polarDeg??55))*lt;let c=this.framedOn(t,i,s);this.targetT.set(c.center[0],c.center[1],c.center[2]),this.distT=c.distance*Math.max(1.05,Math.min(2,r?.margin??Ba))}framedOn(t,n,o){return sb(t,Math.tan(o),Math.tan(n),this.azT,this.polT,r=>this.fitDistance({...t,center:r},n,o,this.azT,this.polT))}fitDistance(t,n,o,r,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(o)),c=t.box;if(!c)return s;let l=Dl(r,i);if(!l)return s;let{fx:u,fy:m,fz:h,rx:f,rz:d,ux:p,uy:b,uz:y}=l,g=Math.tan(o),v=Math.tan(n),P=1;for(let E=0;E<8;E++){let T=(E&1?c.max[0]:c.min[0])-t.center[0],k=(E&2?c.max[1]:c.min[1])-t.center[1],_=(E&4?c.max[2]:c.min[2])-t.center[2],R=T*u+k*m+_*h,C=Math.abs(T*f+_*d),O=Math.abs(T*p+k*b+_*y);P=Math.max(P,C/g-R,O/v-R)}let w=Math.min(s,Math.max(P,a*.35)),x=t.fitPoints;if(!x||x.length<9)return w;let S=0,A=1/(g*Fl),M=1/(v*Fl);for(let E=0;E+2<x.length;E+=3){let T=x[E]-t.center[0],k=x[E+1]-t.center[1],_=x[E+2]-t.center[2],R=T*u+k*m+_*h,C=Math.abs(T*f+_*d),O=Math.abs(T*p+k*b+_*y);S=Math.max(S,C*A-R,O*M-R)}return Math.min(w*1.5,Math.max(w*.55,S))}updateClipping(t){let n=this.camera.position.x-t.center[0],o=this.camera.position.y-t.center[1],r=this.camera.position.z-t.center[2],i=Math.hypot(this.camera.position.x-this.target.x,this.camera.position.y-this.target.y,this.camera.position.z-this.target.z),a=this.interactionEnabled&&Math.abs(i-this.distance)<=this.distance*.01,{near:s,far:c}=ub(Math.hypot(n,o,r),t.radius,a?this.distance:null);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,o=this.distT-this.distance,r=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(o)>1e-4||Math.abs(r)>s||Math.abs(i)>s||Math.abs(a)>s,l=typeof performance<"u"?performance.now():0,u=this.touchNavigation==="map"?_l(Cl,l-this.lastUpdateMs,this.wasMoving):Cl;return this.lastUpdateMs=l,this.wasMoving=c,this.azimuth+=t*u,this.polar+=n*u,this.distance+=o*u,this.target.x+=r*u,this.target.y+=i*u,this.target.z+=a*u,c&&this.applyPosition(),c}get currentAzimuth(){return this.azimuth}get currentDistance(){return this.distance}get targetDistance(){return this.distT}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,o=this.camera.position.z-this.target.z,r=Math.hypot(t,n,o)||1,i=Math.max(ti,Math.min(ni,Math.acos(Math.max(-1,Math.min(1,n/r)))));this.distance=this.distT=r,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,o)}snapshot(){let t=this.target.clone(),n=this.targetT.clone(),{azimuth:o,azT:r,polar:i,polT:a,distance:s,distT:c}=this,l=this.camera.position.clone(),u=[...this.camera.quaternion],m=this.camera.fov;return()=>{this.target.copy(t),this.targetT.copy(n),Object.assign(this,{azimuth:o,azT:r,polar:i,polT:a,distance:s,distT:c}),this.camera.position.copy(l),this.camera.quaternion.set(u[0],u[1],u[2],u[3]),this.camera.perspective({fov:m,aspect:this.camera.aspect}),this.camera.updateMatrixWorld()}}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),o=this.target.y+this.distance*Math.cos(this.polar),r=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,o,r),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()}},cb=.1,lb=.25;function ub(e,t,n){let o=Math.max(1,t)*1.18,r=n==null?lb:Math.max(.05,n*cb),i=Math.max(r,e-o),a=Math.max(i+10,e+o);return{near:i,far:a}}var ii=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 r=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+r*.1:r}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}};function Nl(e){let t=!1;return n=>{n!==t&&(t=n,n?e.dataset.slReady="1":delete e.dataset.slReady)}}function Ha(e,t,n){return Math.max(t,Math.min(n,e))}function mb(e){return Ha(e,0,1)}function Bl(e){let t=mb(e);return t*t*(3-2*t)}var io=2.5,hb=1.15,qo=12,ao=22,Ga=30,Va=4,ai=8192;var jP=ao+Va;function Hl(e,t){let n=t*1.4,o=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:io};let r=Math.min(1,(e-n)/Math.max(.001,o-n));return{scale:1-r*.4,fade:r*.55,minPixels:io+r*(hb-io)}}function Gl(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}var fb=12;function Vl(e,t,n,o,r){if(!(e>0)||!(t>0)||!(n>0)||!(o>0)||!(r>0))return!1;let i=Math.tan(o/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(r/2);return Math.PI*a*a/e>=fb}var za=[{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"}],KP=new Map(za.map(e=>[e.key,e]));var db={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 si(e){let t=e?.[0];return t&&db[t]||"#3b82f6"}var pb=[{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"}],YP=new Map(pb.map(e=>[e.key,e]));var bb=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],$P=new Set(bb);var Ul=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark: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},mark:{x:12,y:10,radius:6}},{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},mark:{x:12,y:10,radius:4.5}},{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 L18 12 L18.5 23 L16 23 L15.5 13 L8.5 13 L8 23 L5.5 23 Z",bounds:{x:4,y:2,width:16,height:21},mark:{x:12,y:5,radius:3}},{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},mark:{x:12,y:7.5,radius:5.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},mark:{x:12,y:8,radius: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},mark:{x:12,y:9.25,radius:6.5}},{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},mark:{x:12,y:12.25,radius:4.75}}],Wl=Ul.map(e=>e.key),gb=new Map(Ul.map(e=>[e.key,e]));function zl(e){return typeof e=="string"&&gb.has(e)}function jl(e,t){return zl(e)?e:zl(t?.seatGlyph)?t.seatGlyph:"circle"}var Me=.02291666666666667,kt=1/Me,yb=58,xb=yb*Me;var Mb=3,Xl=0,Ua=120,vb=0,Sb=45,wb=7,Yt=1.2;function Wa(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function Pb(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=wb?e:Mb}function bn(e,t={}){let n=Wa(t.floorBaseHeightM,Xl,Ua,0),o=Math.min(Ua,n+Pb(e.elevation)*xb),r=e.height===void 0?o:Wa(e.height,Xl,Ua,o),i=Wa(e.rake,vb,Sb,0);return{height:r,rake:i}}var Yl=jt(require("earcut"),1),Ka=jt(require("polygon-clipping"),1);var tA=Math.PI/180;function ut(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function ja(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Xa(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function so(e){return e.length?Xa(e):null}function Rt(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let r=e[n],i=e[(n+1)%o];t+=r.x*i.y-i.x*r.y}return t/2}function Ye(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let a=e[r],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(o=!o)}return o}var I=Me,Ab=.002;function Rb(e,t,n){let o=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=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(o,r,i);if(a<1e-9)return!0;let s=(o+r+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-o)*(s-r)*(s-i)))/a<Ab}var er=-2,Fn=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){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++]=o}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 o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},ui=class{constructor(){this.pos=new Fn;this.nor=new Fn;this.col=new Fn;this.flr=new Fn;this.mat=new Fn;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,a=i,s=i,c){if(Rb(t,n,o))return;this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[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);let l=this.currentMaterial;this.mat.push1(c?.[0]??l),this.mat.push1(c?.[1]??l),this.mat.push1(c?.[2]??l)}triN(t,n,o,r,i,a,s,c=s,l=s){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[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 Eb(e,t,n){let o=t[0]-e[0],r=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=r*c-i*s,u=i*a-o*c,m=o*s-r*a,h=Math.hypot(l,u,m)||1;return l/=h,u/=h,m/=h,[l,u,m]}function Ib(e,t){let n=[...e],o=[];for(let a of e)o.push(a.x,a.y);let r=[];if(t){for(let a of t)if(!(a.length<3)){r.push(n.length);for(let s of a)n.push(s),o.push(s.x,s.y)}}let i=(0,Yl.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function $t(e){return Rt(e)<0?[...e].reverse():e}var _b=3;function Cb(e,t,n,o){let r=o(e),i=o(t),a=o(n),s=(f,d,p,b)=>Math.abs(o({x:(f.x+d.x)/2,y:(f.y+d.y)/2})-(p+b)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(r+i+a)/3,m=Math.max(s(e,t,r,i),s(t,n,i,a),s(n,e,a,r),Math.abs(o({x:c,y:l})-u)),h=(f,d,p)=>{let b=Math.abs(o({x:(f+c)/2,y:(d+l)/2})-(p+u)/2);b>m&&(m=b)};return h((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),h((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),h((n.x+e.x)/2,(n.y+e.y)/2,(a+r)/2),m}function Qo(e,t,n,o,r){if(r<=0)return Cb(e,t,n,o);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(Qo(e,i,s,o,r-1),Qo(i,t,a,o,r-1),Qo(s,a,n,o,r-1),Qo(i,a,s,o,r-1))}function Jo(e,t,n,o,r,i,a,s){if(a>0){let h={x:(t.x+n.x)/2,y:(t.y+n.y)/2},f={x:(n.x+o.x)/2,y:(n.y+o.y)/2},d={x:(o.x+t.x)/2,y:(o.y+t.y)/2};Jo(e,t,h,d,r,i,a-1,s),Jo(e,h,n,f,r,i,a-1,s),Jo(e,d,f,o,r,i,a-1,s),Jo(e,h,f,d,r,i,a-1,s);return}let c=[t.x*I,r(t),t.y*I],l=[n.x*I,r(n),n.y*I],u=[o.x*I,r(o),o.y*I];if(s){e.triN(c,l,u,s(t),s(n),s(o),i);return}let m=Eb(c,l,u);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),e.tri(c,l,u,m,i)}var Tb=8;function Kl(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,a,s,c,l)=>{if(l>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=t(u);if(Math.abs(m-(s+c)/2)>n){r(i,u,s,m,l-1),r(u,a,m,c,l-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];r(a,s,t(a),t(s),Tb)}return o}function ci(e,t){if(e.length<3)return e;let n=[];for(let r of e){let i=n[n.length-1];i&&Math.hypot(r.x-i.x,r.y-i.y)<t||n.push(r)}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 o=[];for(let r=0;r<n.length;r++){let i=o.length?o[o.length-1]:n[(r-1+n.length)%n.length],a=n[r],s=n[(r+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||o.push(a)}return o.length>=3?o:n}var li=.001*kt*.1;function ue(e,t,n,o,r,i,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Rt(t))<1e-4))return;let u=ci(Kl(ci($t(t),li),o,c),li),m=n?.map(x=>ci(Kl(ci($t(x),li),o,c),li)).filter(x=>x.length>=3&&Math.abs(Rt(x))>=1e-4),{pts:h,tris:f}=Ib(u,m),d=[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],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<_b;g++){let x=0;for(let S=0;S<f.length;S+=3){let A=Qo(h[f[S]],h[f[S+1]],h[f[S+2]],o,g);A>x&&(x=A)}if(x<=c)break}for(let x=0;x<f.length;x+=3){let S=h[f[x]],A=h[f[x+1]],M=h[f[x+2]];Jo(e,S,A,M,o,d,g,l);let E=[S.x*I,r,S.y*I],T=[A.x*I,r,A.y*I],k=[M.x*I,r,M.y*I];e.tri(E,k,T,[0,-1,0],p)}let v=x=>{if(g<=0)return x;let S=1<<g,A=[];for(let M=0;M<x.length;M++){let E=x[M],T=x[(M+1)%x.length];for(let k=0;k<S;k++){let _=k/S;A.push({x:E.x+(T.x-E.x)*_,y:E.y+(T.y-E.y)*_})}}return A},P=Xa(u),w=[{ring:v(u),flip:!1}];if(m)for(let x of m)x.length>=3&&w.push({ring:v(x),flip:!0});for(let{ring:x,flip:S}of w)for(let A=0;A<x.length;A++){let M=x[A],E=x[(A+1)%x.length],T=(E.x-M.x)*I,_=(E.y-M.y)*I,R=-T,C=Math.hypot(_,R)||1;_/=C,R/=C;let O=(M.x+E.x)/2-P.x,B=(M.y+E.y)/2-P.y,F=_*O+R*B;S&&(F=-F),F<0&&(_=-_,R=-R);let N=[_,0,R],V=[M.x*I,o(M),M.y*I],H=[E.x*I,o(E),E.y*I],L=[M.x*I,r,M.y*I],G=[E.x*I,r,E.y*I];e.tri(V,H,G,N,b,b,y),e.tri(V,G,L,N,b,y,y)}}function $l(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),r=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),o.set(c.normal,s*3),r.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:o,color:r,floor:i,material:a,count:t}}function Zt(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=$t(e),r=o.length,i=[];for(let s=0;s<r;s++){let c=o[s],l=o[(s+1)%r],u=l.x-c.x,m=l.y-c.y,h=Math.hypot(u,m)||1;i.push({x:m/h,y:-u/h})}let a=[];for(let s=0;s<r;s++){let c=o[s],l=i[(s-1+r)%r],u=i[s],m=l.x+u.x,h=l.y+u.y,f=Math.hypot(m,h),d=()=>{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(f<1e-9){d();continue}m/=f,h/=f;let p=m*l.x+h*l.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){d();continue}a.push([c.x+m*t*b,c.y+h*t*b])}if(a.length<3)return e;try{let s=Ka.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let m of s){let h=Math.abs(Rt(m[0].map(([f,d])=>({x:f,y:d}))));h>l&&(l=h,c=m[0])}if(!c)return e;let u=c.map(([m,h])=>({x:m,y:h}));if(u.length>1){let m=u[0],h=u[u.length-1];Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function Lt(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=$t(e),r=o.length,i=[];for(let c=0;c<r;c++){let l=o[c],u=o[(c+1)%r],m=Math.hypot(u.x-l.x,u.y-l.y)||1;i.push({x:-(u.y-l.y)/m,y:(u.x-l.x)/m})}let a=[],s=[];for(let c=0;c<r;c++){let l=o[c],u=i[(c-1+r)%r],m=i[c],h=u.x+m.x,f=u.y+m.y,d=Math.hypot(h,f),p=d<1e-9?1/0:1/Math.max(h/d*u.x+f/d*u.y,1e-6);if(!Number.isFinite(p)||p>n){a.push({x:l.x+u.x*t,y:l.y+u.y*t},{x:l.x+m.x*t,y:l.y+m.y*t}),s.push(c,c);continue}h/=d,f/=d,a.push({x:l.x+h*t*p,y:l.y+f*t*p}),s.push(c)}for(let c=0;c<a.length;c++){let l=(c+1)%a.length,u=s[c],m=s[l];if(m!==(u+1)%r)continue;let h=o[u],f=o[m];if((a[l].x-a[c].x)*(f.x-h.x)+(a[l].y-a[c].y)*(f.y-h.y)<=0)return[]}try{let c=Ka.default.intersection([[...a.map(d=>[d.x,d.y]),[a[0].x,a[0].y]]],[[...o.map(d=>[d.x,d.y]),[o[0].x,o[0].y]]]),l=null,u=0;for(let d of c){let p=Math.abs(Rt(d[0].map(([b,y])=>({x:b,y}))));p>u&&(u=p,l=d[0])}if(!l)return[];let m=l.map(([d,p])=>({x:d,y:p})),h=m[0],f=m[m.length-1];return m.length>1&&Math.abs(h.x-f.x)<1e-9&&Math.abs(h.y-f.y)<1e-9&&m.pop(),m.length>=3?$t(m):[]}catch{return[]}}function mi(e,t,n,o,r=28){let i=[];for(let a=0;a<r;a++){let s=a/r*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return i}function tr(e,t,n,o){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+o},{x:e,y:t+o}]}var cn=.22;function ql(e){let t=ct[e];return t==="sold"||t==="held"?1:0}var kb=.42,Zl=1.6;function Lb(e,t){let n=new Float32Array(e.length*4),o=Math.cos(Ea),r=0;for(let i=1;i<=e.length;i++){if(i<e.length&&e[i].rowId===e[r].rowId)continue;let a=i-r>=2&&!t?.has(e[r].rowId);for(let l=r;a&&l<i;l++)e[l].kind==="booth"&&(a=!1);for(let l=r+1;a&&l<i-1;l++){let u=e[l].x-e[l-1].x,m=e[l].y-e[l-1].y,h=e[l+1].x-e[l].x,f=e[l+1].y-e[l].y,d=Math.hypot(u,m)*Math.hypot(h,f);d>1e-9&&(u*h+m*f)/d<o&&(a=!1)}let s=[];for(let l=r+1;a&&l<i;l++){let u=Math.hypot(e[l].x-e[l-1].x,e[l].y-e[l-1].y);u>1e-6&&s.push(u)}s.sort((l,u)=>l-u);let c=s.length?s[Math.floor(s.length/2)]:0;for(let l=r;c>0&&l<i;l++){let u=b=>{let y=l+b;if(y<r||y>=i)return null;let g=e[y].x-e[l].x,v=e[y].y-e[l].y,P=Math.hypot(g,v);return P>1e-6?{x:g/P,y:v/P,gap:P}:null},m=u(1),h=u(-1),f=c/2,d=m??(h?{x:-h.x,y:-h.y,gap:1/0}:null);if(!d)continue;let p=m&&m.gap<c*Zl?m.gap/2:f;if(n[l*4]=d.x*p*I,n[l*4+1]=d.y*p*I,!h||h.gap>=c*Zl){let b=h??{x:-d.x,y:-d.y};n[l*4+2]=b.x*f*I,n[l*4+3]=b.y*f*I}}r=i}return n}function Ob(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,r=1/0,i=-1/0,a=-1/0;for(let d of e)d.x<o&&(o=d.x),d.y<r&&(r=d.y),d.x>i&&(i=d.x),d.y>a&&(a=d.y);let s=Math.max(i-o,1e-6),c=Math.max(a-r,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/l)+1),m=Math.max(1,Math.ceil(c/l)+1),h=new Map,f=(d,p)=>{let b=Math.min(u-1,Math.max(0,Math.floor((d-o)/l)));return Math.min(m-1,Math.max(0,Math.floor((p-r)/l)))*u+b};for(let d=0;d<t;d++){let p=f(e[d].x,e[d].y),b=h.get(p);b?b.push(d):h.set(p,[d])}for(let d=0;d<t;d++){let p=e[d],b=Math.min(u-1,Math.max(0,Math.floor((p.x-o)/l))),y=Math.min(m-1,Math.max(0,Math.floor((p.y-r)/l))),g=1/0;for(let v=1;v<=4;v++){for(let P=y-v;P<=y+v;P++)if(!(P<0||P>=m))for(let w=b-v;w<=b+v;w++){if(w<0||w>=u||v>1&&Math.abs(P-y)<v&&Math.abs(w-b)<v)continue;let x=h.get(P*u+w);if(x)for(let S of x){if(S===d)continue;let A=Math.hypot(e[S].x-p.x,e[S].y-p.y);A<g&&(g=A)}}if(Number.isFinite(g)&&g<=v*l)break}n[d]=g}return n}function Fb(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Yt):0}function Ql(e,t,n,o,r,i,a){let s=e.length,c=new Float32Array(s*3),l=new Float32Array(s),u=new Float32Array(s*3),m=new Float32Array(s),h=new Float32Array(s),f=new Float32Array(s),d=new Float32Array(s),p=new Float32Array(s*3),b=new Map,y=Ob(e);for(let g=0;g<s;g++){let v=e[g],w=(n?.seatPitchU(g)??y[g])*I;m[g]=Number.isFinite(w)?Math.max(.06,Math.min(cn,w*kb)):cn,h[g]=qc(Number.isFinite(w)?w:void 0);let x=jl(v.glyph,{seatGlyph:i?.get(v.categoryKey)}),S=v.glyph!==void 0||i?.has(v.categoryKey);f[g]=Wl.indexOf(!S&&a?.has(v.rowId)?"dining":x),d[g]=v.wheelchairSpaceType==="no-seat"?0:1,c[g*3]=v.x*I,c[g*3+1]=n?n.seatDeckY(g):Fb(v),c[g*3+2]=v.y*I,l[g]=$o(t?t(v):"available");let A=Ie(r?.get(v.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[g*3]=A[0],u[g*3+1]=A[1],u[g*3+2]=A[2],v.accessibility?.length){let M=Ie(si(v.accessibility));M&&(p[g*3]=M[0],p[g*3+1]=M[1],p[g*3+2]=M[2])}b.set(v.id,g)}return{count:s,iPosition:c,iState:l,iCategory:u,iMaxRadius:m,iRing:p,idToIndex:b,iChairWidth:h,iGlyph:f,iPhysicalSeat:d,iArmrests:Lb(e,a),iFloor:o??new Float32Array(s),iSection:new Float32Array(s).fill(-1),iYaw:new Float32Array(s)}}var Db=64;function Ya(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=$o(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let o=[],r=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+Db){i=s;continue}o.push({start:r,length:i-r+1}),r=s,i=s}}return o.push({start:r,length:i-r+1}),o}var nr=3,Dn=.38,or=.24;function Nb(e){if(e.length<3)return null;let t=e[0],n=e[Math.floor(e.length/2)],o=e[e.length-1],r=(n.x-t.x)*I,i=(n.y-t.y)*I,a=(o.x-t.x)*I,s=(o.y-t.y)*I,c=2*(r*s-i*a);if(Math.abs(c)<1e-7)return null;let l=r*r+i*i,u=a*a+s*s,m=(l*s-u*i)/c+t.x*I,h=(r*u-a*l)/c+t.y*I,f=Math.hypot(t.x*I-m,t.y*I-h);return f<1||f>200||!Number.isFinite(f)||e.some(d=>Math.abs(Math.hypot(d.x*I-m,d.y*I-h)-f)>.03)?null:{x:m,z:h,radius:f}}function Jl(e){let t=[],n=new Map,o=(c,l)=>`${Math.floor(c/nr)},${Math.floor(l/nr)}`;for(let c of e)for(let l of c.rows){for(let m of l.pts){let h=m.x*I,f=m.y*I,d=o(h,f),p=n.get(d)??[];p.push({x:h,z:f,y:l.y,floor:c.floorIndex}),n.set(d,p)}if(l.patch||l.pts.length<2)continue;let u=Nb(l.pts);for(let m of[0,l.pts.length-1]){let h=l.pts[m],f=l.pts[m===0?1:m-1],d=h.x-f.x,p=h.y-f.y,b=Math.hypot(d,p);b<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:u,row:l,point:h,x:h.x*I,z:h.y*I,dx:d/b,dz:p/b})}}let r=new Map;t.forEach((c,l)=>{let u=o(c.x,c.z),m=r.get(u)??[];m.push(l),r.set(u,m)});let i=(c,l)=>{let u=Math.floor(c/nr),m=Math.floor(l/nr);return[-1,0,1].flatMap(h=>[-1,0,1].map(f=>`${u+h},${m+f}`))},a=new Map;t.forEach((c,l)=>{let u=-1,m=1/0,h=!1;for(let f of i(c.x,c.z))for(let d of r.get(f)??[]){let p=t[d];if(c.sectionId===p.sectionId&&c.row.blockId===p.row.blockId||c.floorIndex!==p.floorIndex||Math.abs(c.row.y-p.row.y)>.05)continue;let b=p.x-c.x,y=p.z-c.z,g=Math.hypot(b,y);if(g<Dn*2+.45||g>nr)continue;let v=c.curve&&p.curve&&Math.hypot(c.curve.x-p.curve.x,c.curve.z-p.curve.z)<=.05&&Math.abs(c.curve.radius-p.curve.radius)<=.05,P=Math.min((b*c.dx+y*c.dz)/g,(-b*p.dx-y*p.dz)/g);(v?P<.8:P<.98)||!v&&(Math.abs(b*c.dz-y*c.dx)>.15||Math.abs(b*p.dz-y*p.dx)>.15)||(g<m-.02?(u=d,m=g,h=!1):Math.abs(g-m)<=.02&&(h=!0))}u>=0&&!h&&a.set(l,u)});let s=[];for(let[c,l]of a){if(c>=l||a.get(l)!==c)continue;let u=t[c],m=t[l],h=Math.hypot(m.x-u.x,m.z-u.z),f=(m.x-u.x)/h,d=(m.z-u.z)/h,p=!1;for(let y of i((u.x+m.x)/2,(u.z+m.z)/2))for(let g of n.get(y)??[]){if(g.floor!==u.floorIndex||Math.abs(g.y-u.row.y)>.75)continue;let v=(g.x-u.x)*f+(g.z-u.z)*d,P=Math.abs((g.x-u.x)*d-(g.z-u.z)*f);v>.01&&v<h-.01&&P<or+Dn&&(p=!0)}if(p)continue;let b=(y,g)=>({x:(u.x+f*y-d*g)/I,y:(u.z+d*y+f*g)/I});s.push({sections:[u.sectionId,m.sectionId],blocks:[u.row.blockId,m.row.blockId],floorIndex:u.floorIndex,ends:[u.point,m.point],clearWidthM:h-2*Dn,heightM:(u.row.y+m.row.y)/2,outline:[b(Dn,-or),b(h-Dn,-or),b(h-Dn,or),b(Dn,or)]})}return s}var Bb=.15,Hb=1.6;function eu(e){return Ha(e??1,Bb,Hb)}var $a={key:[1,1,1],ambient:[1,1,1]},tu=.5,Gb=[{id:"daylight",label:"Daylight",description:"Open air by day: pale concrete under a warm sun and a blue sky.",background:"#dce3e8",materials:{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87},light:{key:[1.05,1,.93],ambient:[.95,.99,1.06]},indoor:!1},{id:"floodlit",label:"Floodlit night",description:"A night match: dark sky, hard cool-white floodlights.",background:"#0c1420",materials:{deck:"#66727c",fascia:"#3a4a58",shell:"#4c6072",roughness:.84},light:{key:[1.08,1.08,1.12],ambient:[.8,.88,1.1]},indoor:!1},{id:"evening",label:"Evening",description:"A quiet dark hall: slate structure in a cool, even light.",background:"#17232e",materials:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87},light:{key:[1,.99,.96],ambient:[.94,.98,1.06]},indoor:!1},{id:"arena-show",label:"Arena show",description:"House lights down for a show: deep blue room, warm light on the floor.",background:"#10121c",materials:{deck:"#626a7a",fascia:"#383f52",shell:"#484f66",roughness:.82},light:{key:[1.08,.98,.88],ambient:[.8,.84,1.16]},indoor:!0},{id:"theatre",label:"Theatre house lights",description:"A warm auditorium before curtain-up: amber light, dark warm room.",background:"#1c1512",materials:{deck:"#74685c",fascia:"#4c4038",shell:"#5c4e44",roughness:.9},light:{key:[1.14,.98,.78],ambient:[1.04,.94,.84]},indoor:!0},{id:"concert-hall",label:"Concert hall",description:"A bright hall in pale wood and cream, softly warm.",background:"#e9e2d6",materials:{deck:"#d2c8b8",fascia:"#bcb0a0",shell:"#c8beae",roughness:.8},light:{key:[1.06,1,.9],ambient:[1.02,1,.95]},indoor:!0}],Vb=new Map(Gb.map(e=>[e.id,e])),nu="plain",ou=3e3;function ru(e,t){return e.openField?t?"daylight":"floodlit":e.openAir?t?"daylight":e.court?"floodlit":"evening":e.court||e.inTheRound||e.stage&&e.seatCount>ou?t?"daylight":"arena-show":e.stage?t?"concert-hall":"theatre":t?"daylight":"evening"}function iu(e){return e.openField||e.openAir?!1:e.indoorCourt?!0:e.stage&&!e.inTheRound&&!e.court&&e.standing<e.seatCount&&e.seatCount<=ou}function Za(e){return e&&Vb.get(e)||null}var zb=.15,Ub=.9,Wb=1.76;function jb(e,t,n){let o=e??Xb,r=(i,a,s)=>[Math.min(1,i[0]*a*s[0]),Math.min(1,i[1]*a*s[1]),Math.min(1,i[2]*a*s[2])];return rr(e)?{indoor:n,ceiling:r(o,1.02,t.light.ambient),wall:r(o,.9,t.light.ambient),lamp:r([.1,.1,.1],1,t.light.key)}:{indoor:n,ceiling:r(o,.7,t.light.ambient),wall:r(o,1.55,t.light.ambient),lamp:r([.92,.86,.74],1,t.light.key)}}var Xb=[.075,.09,.115];function au(e){return rr(e)?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function rr(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55}function Kb(){return{background:{top:[...On.top],bottom:[...On.bottom]},sky:au(null),structure:La,seatStates:{...bl},seatScale:1,materials:{seat:null,shell:null,roughness:.78},light:{key:[...$a.key],ambient:[...$a.ambient]},house:null}}function Yb(e){return rr(e)?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function su(e,t){let n=e?.venue3d?.look;if(n===nu)return{look:null,chosen:!0};let o=Za(n);return o?{look:o,chosen:!0}:t?{look:Za(ru(t,rr(Ie(e?.background)))),chosen:!1}:{look:null,chosen:!1}}function $b(e,t){let{look:n,chosen:o}=su(e,t);return Ie(e?.background)??(o?Ie(n?.background):null)}function cu(e,t){let n=Kb();e??={};let{look:o,chosen:r}=su(e,t);o&&(n.light={key:[...o.light.key],ambient:[...o.light.ambient]});let i=$b(e,t);if(o&&(n.house=jb(i,o,r?o.indoor:!!t&&iu(t))),i){n.background={top:oe(i,Ub),bottom:oe(i,Wb)},n.sky=au(i);let u={};for(let[h,f]of Object.entries(La))u[h]=we(f,i,zb);i[0]*.2126+i[1]*.7152+i[2]*.0722>.55&&(u.ground=oe(i,.86)),n.structure=u}let a=Ie(e.selectionColor)??Ie(e.accent);a&&(n.seatStates={...n.seatStates,selected:a});let s=e.seatScale;typeof s=="number"&&Number.isFinite(s)&&(n.seatScale=eu(s));let c=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([u,m])=>m!=null&&u!=="look")),l={...Yb(i),...o?.materials,...c};if(l){let u=Ie(l.deck),m=Ie(l.fascia);u&&(n.structure={...n.structure,tierTop:u,gaTop:u}),m&&(n.structure={...n.structure,tierWall:m,gaWall:m}),n.materials.seat=Ie(l.seat),n.materials.shell=Ie(l.shell),typeof l.roughness=="number"&&Number.isFinite(l.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,l.roughness)))}return Zb(n,rr(i)),n}function Zb(e,t){let n=Ln(t);e.seatStates={...e.seatStates,held:Yr(n.unavailable),sold:Yr(n.unavailable),dimmed:Yr(n.dimmed)};let o=(i,a)=>kn(i,a,Math.min(Yo(i),$r)),r=e.structure;e.structure={...r,ground:o(r.ground,n.ground),tierTop:o(r.tierTop,n.deck),tierWall:o(r.tierWall,n.fascia)},e.materials.shell&&(e.materials.shell=o(e.materials.shell,n.shell))}function lu(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}var qb=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing","track-motorsport"]),hu=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function Et(e){return!!e&&qb.has(e)}function hi(e){return!!e&&hu.has(e)}var Qb="open-air",Jb=new Set([...hu,"court-tennis","track-motorsport",Qb]);function co(e){return!!e&&Jb.has(e)}var eg=new Set(["court-basketball","rink-hockey","ring-boxing"]);function fu(e){return!!e&&eg.has(e)}var qa=1.1;function du(e){return di(e)?e==="ring-boxing"?qa:.06:1}var tg={round:{width:6,height:6},"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8},"track-motorsport":{width:300,height:15}},ng={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f","track-motorsport":"#3b4048"};var pu="proscenium";var og=Math.PI*2;function rg(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function uu(e,t){let n=Math.max(0,e-t),o=[],r=20;for(let i=0;i<=r;i++){let a=-Math.PI/2+i/r*Math.PI;o.push({x:n+t*Math.cos(a),y:t*Math.sin(a)})}for(let i=0;i<=r;i++){let a=Math.PI/2+i/r*Math.PI;o.push({x:-n+t*Math.cos(a),y:t*Math.sin(a)})}return o}var mu=(()=>{let t={x:0,y:52},n=25,o={x:70,y:t.y-70},r=(o.x*o.x+o.y*o.y-4900)/(2*(o.y+70)),i=r+70,a=[],s=Math.atan2(o.y-r,o.x),c=Math.atan2(o.y-r,-o.x);for(let l=0;l<=24;l++){let u=s+(c-s)*l/24;a.push({x:i*Math.cos(u),y:r+i*Math.sin(u)})}return{half:70,home:t,backstop:n,fence:a}})();var fi="#f1f5f9";function di(e){return Et(e)}function gn(e,t,n,o,r=32){let i=[];for(let a=0;a<r;a++){let s=a/r*og;i.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return i}function qt(e,t,n,o){return[{x:e-n,y:t-o},{x:e+n,y:t-o},{x:e+n,y:t+o},{x:e-n,y:t+o}]}function ig(e){let{kind:t,cx:n,cy:o,width:r,height:i}=e,a=(e.rotation??0)*Math.PI/180,s=Math.cos(a),c=Math.sin(a),l=r/2,u=i/2,m=[],h=tg[t],f=p=>h?p/h.width*r:0,d=p=>h?p/h.height*i:0;switch(t){case"pitch-football":{m.push({points:[{x:0,y:-u},{x:0,y:u}],closed:!1}),m.push({points:gn(0,0,f(9.15),d(9.15)),closed:!0});for(let p of[-1,1])m.push({points:qt(p*(l-f(16.5)/2),0,f(16.5)/2,d(40.32)/2),closed:!0}),m.push({points:qt(p*(l-f(5.5)/2),0,f(5.5)/2,d(18.32)/2),closed:!0});break}case"rink-hockey":{m.push({points:[{x:0,y:-u},{x:0,y:u}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){m.push({points:[{x:p*f(7.5),y:-u},{x:p*f(7.5),y:u}],closed:!1,ink:"#2f6ecb"}),m.push({points:[{x:p*(l-f(4)),y:-d(11)},{x:p*(l-f(4)),y:d(11)}],closed:!1,ink:"#d63b3b"});for(let b of[-1,1])m.push({points:gn(p*f(20.5),b*d(7),f(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"})}m.push({points:gn(0,0,f(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let b=u-d(1.22)*8;b>0&&m.push({points:uu(l-f(1.22)*8,b),closed:!0,fill:"#2f7d4f"});for(let y=1;y<8;y++){let g=d(1.22)*y,v=u-g;if(v<=0)break;m.push({points:uu(l-f(1.22)*y,v),closed:!0})}break}case"oval-cricket":{m.push({points:gn(0,0,f(27.4),d(27.4+20.12/2),40),closed:!0}),m.push({points:qt(0,0,f(3.05)/2,d(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=b=>({points:[{x:f(b),y:-u},{x:f(b),y:u}],closed:!1});m.push(p(0));for(let b of[-1,1]){m.push(p(b*50),p(b*28));for(let y=-35;y<35;y+=4)m.push({points:[{x:f(b*10),y:d(y)},{x:f(b*10),y:d(Math.min(35,y+2))}],closed:!1})}break}case"diamond-baseball":{let p=(O,B)=>({x:f(O),y:d(B)}),{home:b}=mu,y=27.43,g=y/Math.SQRT2,v={x:b.x+g,y:b.y-g},P={x:b.x,y:b.y-2*g},w={x:b.x-g,y:b.y-g},x={x:b.x,y:b.y-18.44},S="#b98a59",A=ng["diamond-baseball"],M=38.94,E=[p(b.x,b.y)],T=Math.atan2(b.y-M/Math.SQRT2-x.y,M/Math.SQRT2),k=Math.PI-T;for(let O=0;O<=16;O++){let B=T-(T+Math.PI*2-k)%(Math.PI*2)*(O/16);E.push(p(x.x+29*Math.cos(B),x.y+29*Math.sin(B)))}m.push({points:E,closed:!0,fill:S,ink:S});let _={x:b.x,y:b.y-g},R=[{x:b.x,y:b.y},v,P,w].map(O=>p(_.x+(O.x-_.x)*.84,_.y+(O.y-_.y)*.84));m.push({points:R,closed:!0,fill:A,ink:A}),m.push({points:gn(f(x.x),d(x.y),f(2.74),d(2.74),20),closed:!0,fill:S,ink:S}),m.push({points:gn(f(b.x),d(b.y),f(3.96),d(3.96),20),closed:!0,fill:S,ink:S});let C=mu.fence;m.push({points:[p(b.x,b.y),p(C[0].x,C[0].y)],closed:!1}),m.push({points:[p(b.x,b.y),p(C[C.length-1].x,C[C.length-1].y)],closed:!1});for(let O of[v,P,w])m.push({points:qt(f(O.x),d(O.y),f(.3),d(.3)),closed:!0,fill:fi});break}case"court-basketball":{m.push({points:qt(0,0,f(14),d(7.5)),closed:!0}),m.push({points:[{x:0,y:-d(7.5)},{x:0,y:d(7.5)}],closed:!1}),m.push({points:gn(0,0,f(1.8),d(1.8),24),closed:!0});for(let p of[-1,1]){let b=p*14,y=p*(14-5.8),g=p*(14-1.575);m.push({points:qt(f((b+y)/2),0,f(2.9),d(2.45)),closed:!0,fill:"#2f5d8a"}),m.push({points:gn(f(y),0,f(1.8),d(1.8),24),closed:!0});let v=Math.sqrt(6.75*6.75-6.6*6.6),P=[{x:f(b),y:-d(6.6)}],w=Math.atan2(-6.6,-p*v),x=2*Math.atan2(6.6,v);for(let S=0;S<=16;S++){let A=w-p*x*(S/16);P.push({x:f(g+6.75*Math.cos(A)),y:d(6.75*Math.sin(A))})}P.push({x:f(b),y:d(6.6)}),m.push({points:P,closed:!1})}break}case"court-tennis":{m.push({points:qt(0,0,f(11.885),d(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])m.push({points:[{x:-f(11.885),y:p*d(4.115)},{x:f(11.885),y:p*d(4.115)}],closed:!1}),m.push({points:[{x:p*f(6.4),y:-d(4.115)},{x:p*f(6.4),y:d(4.115)}],closed:!1});m.push({points:[{x:-f(6.4),y:0},{x:f(6.4),y:0}],closed:!1}),m.push({points:[{x:0,y:-d(6.4)},{x:0,y:d(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{m.push({points:qt(0,0,f(3.05),d(3.05)),closed:!0});let y=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[g,v,P]of y)m.push({points:qt(g*f(3.05),v*d(3.05),f(.3),d(.3)),closed:!0,fill:P,ink:P});break}case"track-motorsport":{for(let y of[-1,1])m.push({points:[{x:-l,y:y*d(7)},{x:l,y:y*d(7)}],closed:!1});let b=90;m.push({points:qt(f(b),0,f(.6),d(7)),closed:!0,fill:"#f1f5f9"});for(let y=0;y<10;y++){let g=b-8*(y+1),v=y%2?2.6:-2.6;m.push({points:[{x:f(g),y:d(v-1.3)},{x:f(g),y:d(v+1.3)}],closed:!1})}break}default:return[]}return m.map(p=>({...p,points:p.points.map(b=>rg(b.x,b.y,s,c,n,o))}))}function Qa(e){if(e.role!=="stage"||!di(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(u=>u.x),o=e.points.map(u=>u.y),r=Math.min(...n),i=Math.max(...n),a=Math.min(...o),s=Math.max(...o),c=Math.max(1,i-r),l=Math.max(1,s-a);t={cx:r+c/2,cy:a+l/2,width:c,height:l}}return t?ig({kind:e.stageKind,...t}):[]}var lo=Math.PI*2;function uo(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function ag(e,t,n){let o=t-e;if(n){for(;o<0;)o+=lo;for(;o>=lo;)o-=lo}else{for(;o>0;)o-=lo;for(;o<=-lo;)o+=lo}return o}function yu(e){if(e.version!==1||e.closed!==!0||!uo(e.start)||!Array.isArray(e.segments)||e.segments.length<2||e.segments.length>512)return!1;let t=e.start;for(let n of e.segments){if(!n||!uo(n.end))return!1;if(n.kind==="line"){if(ut(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!uo(n.control1)||!uo(n.control2)||ut(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!uo(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(ut(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(ut(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||ut(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return ut(t,e.start)<=1e-4}function sg(e,t,n){let o=1-n;return{x:o**3*e.x+3*o**2*n*t.control1.x+3*o*n**2*t.control2.x+n**3*t.end.x,y:o**3*e.y+3*o**2*n*t.control1.y+3*o*n**2*t.control2.y+n**3*t.end.y}}function xu(e,t=2){if(!yu(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),o=[{...e.start}],r=e.start;for(let i of e.segments){if(i.kind==="line")o.push({...i.end});else if(i.kind==="arc"){let a=Math.atan2(r.y-i.center.y,r.x-i.center.x),s=Math.atan2(i.end.y-i.center.y,i.end.x-i.center.x),c=ag(a,s,i.clockwise),l=Math.max(2,Math.ceil(Math.abs(c)*i.radius/n));for(let u=1;u<=l;u+=1){let m=a+c*u/l;o.push({x:i.center.x+Math.cos(m)*i.radius,y:i.center.y+Math.sin(m)*i.radius})}}else{let a=ut(r,i.control1)+ut(i.control1,i.control2)+ut(i.control2,i.end),s=Math.max(2,Math.ceil(a/n));for(let c=1;c<=s;c+=1)o.push(sg(r,i,c/s))}r=i.end}return ut(o[o.length-1],o[0])<=1e-4&&o.pop(),o}var cg=45,Ja=150,lg=60;function ug(e){let t=cg/100;if(e<=t)return Ja;let n=Math.min(1,(e-t)/(1-t));return Ja-n*(Ja-lg)}var bu=.5523;function gu(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function mg(e){let t=[],n=[];for(e.forEach((o,r)=>{uo(o)&&(t.length&&gu(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&gu(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}var hg=.5,fg=4/3;function dg(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<=1e-9)return{kind:"line",end:{...t}};let a=-r/i,s=o/i,c=n*fg;return{kind:"bezier",control1:{x:e.x+o/3+a*c,y:e.y+r/3+s*c},control2:{x:e.x+o*2/3+a*c,y:e.y+r*2/3+s*c},end:{...t}}}function Mu(e,t){let{points:n,sourceIndex:o}=mg(e),r=n.length;if(r<3)return null;let i=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,a=t.edgeCurvature,s=new Array(r).fill(0);if(a?.length)for(let P=0;P<r;P+=1){let w=a[o[P]];s[P]=Number.isFinite(w)?Math.min(100,Math.max(-100,w))/100:0}let c=s.some(P=>Math.abs(P)>1e-6);if(i<=0&&!c)return null;let l=t.wideAngleThresholdDeg??ug(i),u=[];for(let P=0;P<r;P+=1)u[P]=ut(n[P],n[(P+1)%r]);let m=new Array(r).fill(0);for(let P=0;P<r;P+=1){let w=n[(P-1+r)%r],x=n[P],S=n[(P+1)%r],A={x:w.x-x.x,y:w.y-x.y},M={x:S.x-x.x,y:S.y-x.y},E=Math.hypot(A.x,A.y),T=Math.hypot(M.x,M.y);if(E<=1e-9||T<=1e-9)continue;let k=Math.min(1,Math.max(-1,(A.x*M.x+A.y*M.y)/(E*T))),_=Math.acos(k)*180/Math.PI;if(_<l)continue;let R=Bl((_-l)/(180-l));m[P]=i*R*.5*Math.min(E,T)}for(let P=0;P<r;P+=1){let w=(P+1)%r,x=m[P]+m[w];if(x>u[P]&&x>1e-9){let S=u[P]/x;m[P]*=S,m[w]*=S}}let h=new Array(r),f=new Array(r);for(let P=0;P<r;P+=1){let w=n[(P-1+r)%r],x=n[P],S=n[(P+1)%r];if(m[P]<=1e-6){h[P]={...x},f[P]={...x};continue}let A=ut(x,w)||1,M=ut(x,S)||1;h[P]={x:x.x+(w.x-x.x)/A*m[P],y:x.y+(w.y-x.y)/A*m[P]},f[P]={x:x.x+(S.x-x.x)/M*m[P],y:x.y+(S.y-x.y)/M*m[P]}}if(m.every(P=>P<=1e-6)&&!c)return null;let d=[],p={...f[0]},b=p,y=(P,w)=>{if(ut(b,P)<=1e-9)return;let x=s[w];Math.abs(x)>1e-6?d.push(dg(b,P,x*hg*u[w])):d.push({kind:"line",end:{...P}}),b=P};for(let P=1;P<=r;P+=1){let w=P%r,x=n[w];y(h[w],(P-1)%r),m[w]>1e-6&&ut(h[w],f[w])>1e-9&&(d.push({kind:"bezier",control1:ja(h[w],x,bu),control2:ja(f[w],x,bu),end:{...f[w]}}),b=f[w])}if(!d.length)return null;let g=d[d.length-1];ut(g.end,p)>1e-9&&(g.kind==="line"?g.end={...p}:d.push({kind:"line",end:{...p}}));let v={version:1,closed:!0,start:p,segments:d};return yu(v)?v:null}function vu(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+a*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+a*e.end.y}}function Su(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[vu(e,.5)];let o=Array.from({length:n+1},(c,l)=>vu(e,l/n)),r=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let l=o[c].x-o[c-1].x,u=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(l,u)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let l=i*c/(t-1);for(;s<r.length-1&&r[s]<l;)s+=1;let u=r[s-1],m=r[s],h=m===u?0:(l-u)/(m-u);a.push({x:o[s-1].x+(o[s].x-o[s-1].x)*h,y:o[s-1].y+(o[s].y-o[s-1].y)*h})}return a}function wu(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((h,f)=>h.segmentedRow.componentIndex-f.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((h,f)=>h.segmentedRow?.kind==="segmented-row-v1"&&h.segmentedRow.groupId===o&&h.segmentedRow.componentCount===a&&h.segmentedRow.componentIndex===f&&h.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(f===0?h.segmentedRow.boundaryBefore==="start":h.segmentedRow.boundaryBefore!=="start")&&h.segmentedRow.displayLabel===s.displayLabel)))continue;let l=i.reduce((h,f)=>h+f.seatCount,0),u=0,m=0;for(let h of i)h.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(h.id,{groupId:o,adjacencyOffset:u,displayOffset:m,displayLabel:s.displayLabel,totalSeats:l,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),u+=h.seatCount,m+=h.seatCount}return t}var pg="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var bg="abcdefghijklmnopqrstuvwxyz";function gg(e,t){let n=t.length,o=e+1,r="";for(;o>0;){o-=1;let i=o%n;r=t[i]+r,o=Math.floor(o/n)}return r}function ir(e,t=!1){let n=t?bg:pg;return gg(Math.max(0,Math.floor(e)-1),n)}var yg=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Pu(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of yg)for(;t>=o;)n+=r,t-=o;return n}function xg(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function es(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let f=Math.ceil(c/2),d=i==="updown"?t<f?n+2*t:n-1+2*(c-t):t<f?n+2*(f-1-t):n+1+2*(t-f);return`${a}${d}`}let l=i==="odd"||i==="even"?2:r,u=s!=null&&Number.isFinite(s)?s-(c-1)*l:n,m=o==="center"?xg(c)[t]:o==="rtl"?c-1-t:t,h;switch(i){case"odd":{let f=u%2===1?u:u+1;h=String(f+m*2);break}case"even":{let f=u%2===0?u:u+1;h=String(f+m*2);break}case"roman":h=Pu(u+m*r);break;case"letters-upper":h=ir(u+m*r,!1);break;case"letters-lower":h=ir(u+m*r,!0);break;default:h=String(u+m*r);break}return`${a}${h}`}function Mg(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Au(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${es(e,t)}`}function vg(e,t,n,o){if(o?.displayLabel)return null;if(e.seatDisplayLabelMode==="number"||!n)return{row:e.displayLabel||e.label,seat:es(e,t)};let r=Mg(n);return{row:n.displayLabel,seat:es(r,n.displayOffset+t)}}function ts(e,t,n,o){let r=vg(e,t,n,o);return r?e.seatDisplayLabelMode==="number"?r.seat:`${r.row}-${r.seat}`:o.displayLabel}function Ru(e,t){return`${e.label}-${t+1}`}function Sg(e,t,n){return e?.direction==="anticlockwise"?Math.max(0,t-1-n):n}function wg(e,t){let n=e.chairNumbering,o=n?.start??1,r=Sg(n,Math.max(0,Math.round(e.seatCount)),t);return n?.format==="letter"?ir(Math.max(1,o)+r):String(o+r)}function Eu(e,t){let n=wg(e,t);return(e.chairNumbering?.format??"table-number")==="table-number"?`${e.displayLabel??e.label}-${n}`:n}function Iu(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 mo(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 o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],a=e[r+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 m=t-(i.x+u*s),h=n-(i.y+u*c);if(Math.abs(m)>=o||Math.abs(h)>=o)continue;let f=Math.hypot(m,h);f<o&&(o=f)}return o}function Pg(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;t/=o,n/=o;let r=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>r&&(r=a)}return{cx:t,cy:n,r}}function _u(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function ns(e,t){let n=1/0;for(let o of Iu(e)){let r=mo(t,o.x,o.y);r<n&&(n=r)}for(let o of Iu(t)){let r=mo(e,o.x,o.y);r<n&&(n=r)}return n}function Ag(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let u of e)n+=u.x,o+=u.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let u of e){let m=Math.hypot(u.x-n,u.y-o);m>r&&(r=m,i=u)}let a=i.x-n,s=i.y-o,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((u,m)=>({p:u,i:m,t:(u.x-n)*a+(u.y-o)*s})).sort((u,m)=>u.t-m.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function os(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let g of e)n+=g.x,o+=g.y;n/=t,o/=t;let r=0,i=0,a=0,s=0,c=0,l=0,u=0;for(let g of e){let v=g.x-n,P=g.y-o;r+=v*v,a+=P*P,i+=v*P,s+=v*v*v,c+=P*P*P,l+=v*P*P,u+=P*v*v}let m=r*a-i*i;if(Math.abs(m)<1e-9)return null;let h=(s+l)/2,f=(c+u)/2,d=(h*a-f*i)/m,p=(f*r-h*i)/m,b=d+n,y=p+o;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var Rg=.15,Eg=.001;function Ig(e){let t=e[0],n=e[e.length-1],o=n.x-t.x,r=n.y-t.y,i=Math.hypot(o,r);if(!(i>1e-9))return 0;let a=0;for(let s of e){let c=Math.abs((s.x-t.x)*r-(s.y-t.y)*o)/i;c>a&&(a=c)}return a/i}function _g(e){if(e.length<2)return null;let t=e.map(w=>{let x=0,S=0;for(let A of w.pts)x+=A.x,S+=A.y;return{x:x/w.pts.length,y:S/w.pts.length}}),n=0,o=0;for(let w of t)n+=w.x,o+=w.y;n/=t.length,o/=t.length;let r=0,i=0,a=0;for(let w of t){let x=w.x-n,S=w.y-o;r+=x*x,i+=x*S,a+=S*S}let s=r+a,c=r*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,m;Math.abs(i)>1e-12?(u=l-a,m=i):r>=a?(u=1,m=0):(u=0,m=1);let h=Math.hypot(u,m);if(!(h>1e-12))return null;u/=h,m/=h;let f=0,d=0,p=0;for(let w of e){if(w.pts.length<2)continue;let x=w.pts[0],S=w.pts[w.pts.length-1],A=S.x-x.x,M=S.y-x.y,E=Math.hypot(A,M);if(!(E>1e-9))continue;let T=A/E,k=M/E;f+=(T*T-k*k)*E,d+=2*T*k*E,p+=E}if(p>0&&Math.hypot(f,d)>=Tg*p){let w=Math.atan2(d,f)/2;u=-Math.sin(w),m=Math.cos(w)}let b=1/0,y=-1/0,g=[];for(let w of e){let x=1/0,S=-1/0;for(let A of w.pts){let M=A.x*u+A.y*m;M<x&&(x=M),M>S&&(S=M),M<b&&(b=M),M>y&&(y=M)}g.push(S-x)}let v=y-b;return v>1e-9?(g.sort((w,x)=>w-x),g[Math.min(g.length-1,Math.floor(g.length*.9))]/v<=Cg?{x:u,y:m}:null):null}var Cg=.35,Tg=.8;function pi(e,t,n,o){let r=new Map;for(let x of n){let S=t[x],A=S.rowId||`__seat-${x}`,M=r.get(A);M||(M={pts:[],idx:[]},r.set(A,M)),M.pts.push({x:S.x,y:S.y}),M.idx.push(x)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[x,S]of r){let A=Ag(S.pts,S.idx),M=0;for(let E of A.pts)M+=Math.hypot(E.x-o.x,E.y-o.y);i.push({id:x,pts:A.pts,seatIndices:A.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:M/A.pts.length})}let a=i.map(x=>Pg(x.pts)),s=i.length<=256?i.length*(i.length-1)/2:0,c=s?new Float64Array(s):null;c?.fill(Number.NaN);let l=c?new Map(i.map((x,S)=>[x,S])):null,u=(x,S)=>(x>S&&([x,S]=[S,x]),x*(2*i.length-x-1)/2+(S-x-1)),m=(x,S)=>{if(!c)return ns(i[x].pts,i[S].pts);let A=u(x,S),M=c[A];if(!Number.isNaN(M))return M;let E=ns(i[x].pts,i[S].pts);return c[A]=E,E},h=(x,S)=>l?m(l.get(x),l.get(S)):ns(x.pts,S.pts),f=[];for(let x=0;x<i.length;x++){let S=1/0;for(let A=0;A<i.length;A++){if(x===A||_u(a[x],a[A])>=S)continue;let M=m(x,A);M<S&&(S=M)}Number.isFinite(S)&&f.push(S)}f.sort((x,S)=>x-S);let d=f.length?f[Math.floor(f.length/2)]:1,p=Math.max(d*1.8,1e-6),b=i.map(()=>[]);for(let x=0;x<i.length;x++)for(let S=x+1;S<i.length;S++)_u(a[x],a[S])>p||m(x,S)<=p&&(b[x].push(S),b[S].push(x));let y=0;for(let x=0;x<i.length;x++){if(i[x].blockId!==-1)continue;let S=y++,A=[x];for(i[x].blockId=S;A.length;){let M=A.pop();for(let E of b[M])i[E].blockId===-1&&(i[E].blockId=S,A.push(E))}}let g=new Map;for(let x of i){let S=g.get(x.blockId)??[];S.push(x),g.set(x.blockId,S)}let v=[];for(let x of i){if(x.pts.length<4||Ig(x.pts)<Eg)continue;let S=os(x.pts);S&&(!Number.isFinite(S.cx)||!Number.isFinite(S.cy)||v.push({x:S.cx,y:S.cy}))}let P=v.length>=2?(()=>{let x=v.map(M=>M.x).sort((M,E)=>M-E),S=v.map(M=>M.y).sort((M,E)=>M-E),A=Math.floor(v.length/2);return{cx:x[A],cy:S[A]}})():null;if(P){let x=k=>Math.hypot(k.x-P.cx,k.y-P.cy),S=1/0,A=-1/0,M=[];for(let k of i){let _=1/0,R=-1/0;for(let C of k.pts){let O=x(C);O<_&&(_=O),O>R&&(R=O)}M.push(R-_),_<S&&(S=_),R>A&&(A=R)}let E=A-S;M.sort((k,_)=>k-_);let T=M[Math.min(M.length-1,Math.floor(M.length*.9))];if(E>1e-9&&T/E<=Rg){let k=i.map(L=>{let G=0;for(let j of L.pts)G+=x(j);return{row:L,radius:G/L.pts.length}}),_=0,R=0;for(let L of k)_+=L.radius,R+=L.row.focalDistance;_/=k.length,R/=k.length;let C=0;for(let L of k)C+=(L.radius-_)*(L.row.focalDistance-R);if(C<0)for(let L of k)L.radius=-L.radius;let B=1/0;for(let L of k)L.radius<B&&(B=L.radius);k.sort((L,G)=>L.radius-G.radius);let F=-1,N=-1/0,V=E/Math.max(1,k.length)*.5,H=[];for(let L of k)L.radius-N>V&&(F++,N=L.radius),L.row.ordinal=F,L.row.blockDepth=L.radius-B,H.push(L.row);return{sectionId:e,rows:H,blockCount:y}}}let w=[];for(let[,x]of g){let S=_g(x);if(S){let A=k=>{let _=0;for(let R of k.pts)_+=R.x*S.x+R.y*S.y;return _/k.pts.length};x.sort((k,_)=>A(k)-A(_)),x.length>=2&&x[0].focalDistance>x[x.length-1].focalDistance&&x.reverse();let M=[],E=d*.5;for(let k of x){let _=M[M.length-1];_&&Math.abs(A(k)-A(_[0]))<E?_.push(k):M.push([k])}let T=0;for(let k=0;k<M.length;k++){if(k>0){let _=1/0;for(let R of M[k-1])for(let C of M[k])_=Math.min(_,h(R,C));_=Math.min(_,Math.abs(A(M[k][0])-A(M[k-1][0]))),T+=_}for(let _ of M[k])_.ordinal=k,_.blockDepth=T,w.push(_)}}else{let A=1/0;for(let M of x)M.focalDistance<A&&(A=M.focalDistance);x.sort((M,E)=>M.focalDistance-E.focalDistance);for(let M=0;M<x.length;M++)x[M].ordinal=M,x[M].blockDepth=Math.max(0,x[M].focalDistance-A),w.push(x[M])}}return{sectionId:e,rows:w,blockCount:y}}var kg=/^\d{4}-\d{2}-\d{2}$/;function Lg(e){let t=Date.parse(e);return Number.isFinite(t)?kg.test(e)?t+864e5:t:null}function Og(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let o=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(o)&&(t instanceof Date?t.getTime():t)<=o+366*864e5}let n=Lg(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Fg(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Dg(e){return e.status!=="draft"&&e.status!=="retracted"}function Ng(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function Cu(e,t={}){return!!e&&Dg(e)&&Fg(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Ng(e,t.activeBasisSha256)&&Og(e,t.now)}var Bg=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Hg=/[\s"'<>`\\]/;function Gg(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Bg.test(e);if(Hg.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Tu(e){let t=e.trim();return Gg(t)?t:null}var rs="seatlayer.event-configuration/1";var ho=100,Vg=120,zg=2e5,Ug=1e4,Wg=/^[a-f0-9]{64}$/,jg=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function ar(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Nn(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Xg(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function ku(e){return!Array.isArray(e)||e.length>zg||!e.every(t=>Nn(t,ho))?null:[...new Set(e)].sort()}function Kg(e){return!ar(e)||!Nn(e.chartId,ho)||!Nn(e.version,ho)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Wg.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function is(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Yg(e){return ar(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&is(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function $g(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Ug)return null;let n=new Set(t),o=new Set,r=new Set,i=0,a=[];for(let s of e){if(!ar(s)||!Nn(s.id,ho)||!Nn(s.objectId,ho)||!n.has(s.objectId)||!jg.has(String(s.kind))||!is(s.heightM,.05,50)||s.baseElevationM!==void 0&&!is(s.baseElevationM,-10,100))return null;let c=Yg(s.occlusion);if(!c||o.has(s.id)||r.has(s.objectId))return null;let l=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?Tu(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!l||s.kind!=="screen"||++i>1))return null;o.add(s.id),r.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function Zg(e){let t=[];if(!ar(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==rs&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${rs}`}),Nn(e.id,ho)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),Nn(e.label,Vg)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Xg(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Kg(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 o=ar(e.overlay)?e.overlay:null,r=ku(o?.objectIds),i=ku(o?.productionKillSeatIds),a=r?$g(o?.productionElements,r):null;return(!o||!r||!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||!r||!i||a===null?{issues:t}:{issues:t,value:{schema:rs,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Lu(e){let t=Zg(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function qg(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?bi(e,6):e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,o=e.width,r=e.height;return[{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+r},{x:t,y:n+r}]}function Qg(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),i=Math.sin(o),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*r-s*i,y:t.y+a*i+s*r}}function Ou(e){let t=qg(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>Qg(c,{x:t.reduce((l,u)=>l+u.x,0)/t.length,y:t.reduce((l,u)=>l+u.y,0)/t.length},n)),r=1/0,i=1/0,a=-1/0,s=-1/0;for(let c of o)r=Math.min(r,c.x),i=Math.min(i,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(r)||a-r<1e-6||s-i<1e-6?null:{minX:r,minY:i,maxX:a,maxY:s}}var Jg=5,ey=3,ty=.92,ny=1.9,oy=2,ry=.6,iy=1,ay=.06;function sy(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?qa:di(e.stageKind)?ay:iy}function Fu(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let a of Bu(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let l=Ou(c);l&&(t=Math.min(t,l.minX),n=Math.min(n,l.minY),o=Math.max(o,l.maxX),r=Math.max(r,l.maxY),i=Math.max(i,s+sy(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function cy(e,t,n,o){let r=1/0,i=1/0,a=-1/0,s=-1/0;for(let f of e)Number.isFinite(f.eyeHeightM)&&(r=Math.min(r,f.x),a=Math.max(a,f.x),i=Math.min(i,f.y),s=Math.max(s,f.y));if(!Number.isFinite(r))return null;let c=r*t,l=i*t,u=Math.max(1,Math.ceil((a-r)*t/n)+1),m=Math.max(1,Math.ceil((s-i)*t/n)+1),h=new Float64Array(u*m).fill(-1/0);for(let f of e){if(!Number.isFinite(f.eyeHeightM))continue;let d=f.eyeHeightM-Yt,p=Math.min(u-1,Math.max(0,Math.floor((f.x*t-c)/n))),y=Math.min(m-1,Math.max(0,Math.floor((f.y*t-l)/n)))*u+p,g=d+o;g>h[y]&&(h[y]=g)}return{cellM:n,minX:c,minY:l,cols:u,rows:m,top:h}}function ly(e,t,n){let o=Math.floor((t-e.minX)/e.cellM),r=Math.floor((n-e.minY)/e.cellM);return o<0||r<0||o>=e.cols||r>=e.rows?-1/0:e.top[r*e.cols+o]}function Du(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??Me,i=n.cellM??ry,a=n.chairBackM??ty,s=n.selfRowSkipM??oy,c=n.clearThreshold??.9,l=n.partialThreshold??.25,u=Math.max(1,n.columns??Jg),m=Math.max(1,n.rows??ey),h=cy(e,r,i,a);if(!h)return o;let f=(t.maxX-t.minX)*r,d=(t.maxY-t.minY)*r,p=f>=d,b=(t.minX+t.maxX)/2*r,y=(t.minY+t.maxY)/2*r,g=[];for(let P=0;P<u;P++){let w=(P+.5)/u-.5,x=p?b+w*f:b,S=p?y:y+w*d;for(let A=0;A<m;A++){let M=t.deckTopM+(m===1?0:A/(m-1)*ny);g.push({x,y:S,z:M})}}let v=i/2;for(let P of e){if(!Number.isFinite(P.eyeHeightM))continue;let w=P.x*r,x=P.y*r,S=P.eyeHeightM,A=0,M=1/0;for(let T of g){let k=T.x-w,_=T.y-x,R=Math.hypot(k,_);if(!(R>s)){A++;continue}let C=k/R,O=_/R,B=0;for(let F=s;F<R;F+=v){let N=ly(h,w+C*F,x+O*F);if(!(!Number.isFinite(N)||N>=S)&&N>S+(T.z-S)*F/R){B=F;break}}B?M=Math.min(M,B):A++}let E=A/g.length;E>=c||o.set(P.id,{seatId:P.id,mark:E<l?"obstructedView":"restrictedView",visibleFraction:E,totalRays:g.length,atDistanceM:Number.isFinite(M)?M:0})}return o}function Nu(e,t){if(!t.size)return 0;let n=0;for(let o of e){let r=t.get(o.id);if(!r)continue;let i=o.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(o.commercial={...i,[r.mark]:!0},n++)}return n}function as(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var yi=Math.PI/180;var sr=16;function ss(e,t,n,o){let r=n*yi,i=Math.cos(r),a=Math.sin(r);return{x:o.x+e*i-t*a,y:o.y+e*a+t*i}}function ls(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,a=[];if(e.path)return Su(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(o===0){for(let l=0;l<t;l++)a.push(ss(l*n,0,r,i));return a}let s=o/(t-1)*yi,c=n/(2*Math.sin(Math.abs(s)/2));for(let l=0;l<t;l++){let u=l*s,m=c*Math.sin(u),h=-c+c*Math.cos(u);a.push(ss(m,h,r,i))}return a}function us(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function uy(e,t){let n=us(e);return ls(e).map((o,r)=>{let i=n.get(r),a=as(i),s=Au(e,r,i),c={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:s,displayLabel:ts(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(l=>l!==void 0&&l!==!1&&l!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function my(e){let t=[];for(let n of uy(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function hy(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let r=Math.max(0,Math.round(e.seatCount));for(let i=0;i<r;i++)o[n[i%n.length]]+=1;return o}function fy(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(u=>[u.index,u])),r=(u,m,h,f)=>{let d=o.get(u),p=as(d),b=d?.label??Ru(e,u);return{index:u,label:b,displayLabel:d?.displayLabel??Eu(e,u),x:m+(d?.dx??0),y:h+(d?.dy??0),categoryKey:d?.categoryKey??e.categoryKey,skipped:!!d?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:d?.wheelchairSpaceType,commercial:d?.commercial,glyph:d?.glyph,viewUrl:d?.viewFromSeatUrl,viewMeta:d?.viewFromSeatUrl?d.viewFromSeatMeta:void 0,labelStyle:d?.labelStyle,...f?{side:f}:{}}};if(e.shape==="round"){let u=(e.radius??40)+sr,m=e.rotation*yi,h=Math.max(0,Math.min(360,e.seatArc??360));if(h>=360||n===1){for(let b=0;b<n;b++){let y=m+b/n*2*Math.PI;t.push(r(b,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let f=h*yi,d=(2*Math.PI-f)/2,p=m+d;for(let b=0;b<n;b++){let y=p+b/(n-1)*f;t.push(r(b,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let i=e.width??80,a=e.height??50,s=hy(e),c=["top","bottom","left","right"],l=0;for(let u of c){let m=s[u];for(let h=0;h<m;h++){let f,d;u==="top"?(f=-i/2+(h+.5)*i/m,d=-a/2-sr):u==="bottom"?(f=-i/2+(h+.5)*i/m,d=a/2+sr):u==="left"?(f=-i/2-sr,d=-a/2+(h+.5)*a/m):(f=i/2+sr,d=-a/2+(h+.5)*a/m);let p=ss(f,d,e.rotation,e.center);t.push(r(l++,p.x,p.y,u))}}return t}function dy(e){return fy(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function py(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth",...e.commercial?.note?{commercial:{note:e.commercial.note}}:{}}]}function cs(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,a=t[o].y,s=t[r].x,c=t[r].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function zu(e,t){return t.some((n,o)=>{let r=t[(o+1)%t.length],i=(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),s=(r.x-n.x)**2+(r.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function cr(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function mt(e,t,n){return cs(e,t)&&!cr(n).some(o=>cs(e,o)||zu(e,o))}function gi(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function Uu(e){switch(e.type){case"row":{let t=ls(e),n=us(e),o=0,r=0,i=0;for(let a=0;a<t.length;a++){let s=n.get(a);s?.skip||(o+=t[a].x+(s?.dx??0),r+=t[a].y+(s?.dy??0),i++)}return i?{x:o/i,y:r/i}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return gi(e.points);case"section":return gi(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?gi(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function Hu(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function by(e,t){if(e.type!=="gaArea"||!Hu(e.points,t.outline))return!1;let n=cr(e.holes),o=cr(t.holes);return n.length===o.length&&n.every((r,i)=>Hu(r,o[i]))}function gy(e,t,n=e.filter(r=>r.type==="section"),o=Uu(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(by(t,a)||mt(o,a.outline,a.holes))):void 0)??n.find(a=>mt(o,a.outline,a.holes))??(t.type==="row"&&yy(t)?xy(t,n):void 0)}function yy(e){return(e.overrides??[]).some(t=>t.skip===!0)}function xy(e,t){let n=ls(e),o=us(e),r,i=0;for(let a of t){let s=0;for(let c=0;c<n.length;c++){let l=o.get(c);if(l?.skip)continue;let u={x:n[c].x+(l?.dx??0),y:n[c].y+(l?.dy??0)};mt(u,a.outline,a.holes)&&s++}s>i&&(r=a,i=s)}return r}function Bu(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function Gu(e,t,n,o,r,i,a,s,c){let l=[],u=e.filter(p=>p.type==="section"),m=wu(e),h=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),f=p=>Cu(p,{activeConfigurationId:o,activeConfigurationVersion:c,activeBasisSha256:r,now:s}),d=(p,b)=>f(p)?{...p,coverage:b}:void 0;for(let p of e){let b=[];if(p.type==="row"?b=my(p):p.type==="table"?b=dy(p):p.type==="booth"&&(b=py(p)),!b.length)continue;for(let w of b)w.viewUrl&&!h(w.viewMeta)&&(w.viewUrl=void 0,w.viewMeta=void 0);if(p.type==="row"){let w=m.get(p.id);if(w){let x=new Map((p.overrides??[]).map(S=>[S.index,S]));for(let S of b){let A=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(A))continue;S.logicalRowId=w.groupId,S.logicalSeatIndex=w.adjacencyOffset+A,x.get(A)?.displayLabel||(S.displayLabel=ts(p,A,w)),!S.viewUrl&&w.viewFromSeatUrl&&h(w.viewFromSeatMeta)&&(S.viewUrl=w.viewFromSeatUrl,S.viewMeta=w.viewFromSeatMeta);let M=x.get(A)?.confidenceEvidence;S.confidenceEvidence=d(M,"exact-seat")??d(p.confidenceEvidence,"row-representative")??d(w.confidenceEvidence,"row-representative")}}}let y=gy(e,p,u,p.type==="row"?gi(b):Uu(p)),g=y?.viewFromSeatUrl,P=(y?.zone?t?.find(w=>w.id===y.zone):void 0)?.focalPoint??n;for(let w of b){if(!w.confidenceEvidence){let x=Number(w.id.slice(w.id.lastIndexOf(":")+1)),S=(p.type==="row"||p.type==="table")&&Number.isInteger(x)?p.overrides?.find(A=>A.index===x)?.confidenceEvidence:void 0;w.confidenceEvidence=d(S,"exact-seat")??(p.type==="row"?d(p.confidenceEvidence,"row-representative"):void 0)}w.confidenceEvidence??=d(y?.confidenceEvidence,"section-representative")??(a?d(a.evidence,a.coverage):void 0),!w.viewUrl&&g&&h(y?.viewFromSeatMeta)&&(w.viewUrl=g,w.viewMeta=y?.viewFromSeatMeta),!w.viewUrl&&i&&h(i.meta)&&(w.viewUrl=i.url,w.viewMeta=i.meta),y&&(w.sectionId=y.logicalSectionId??y.id),y?.zone&&(w.zoneId=y.zone),P&&(w.focalPoint={...P})}l.push(...b)}return l}function fo(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,a=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=Gu(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Vu(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,c);for(let l of c)l.floorId=r.id;for(let l of c)o.push(l)}return o}let n=Gu(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&Vu(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),My(e,n,t)}function My(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Nu(t,Du(t,Fu(e))),t}function Vu(e,t,n,o){let r=e.filter(m=>m.type==="section"),i=n>0||r.some(m=>m.height!==void 0||m.rake!==void 0||(m.elevation??0)>0);if(!r.length||!i||!t){for(let m of o)m.eyeHeightM=n+Yt;return}let a=new Array(o.length),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,m);let c=new Map,l=new Map;for(let m=0;m<o.length;m++){let h=o[m],d=(h.sectionId?s.get(h.sectionId)??r.find(b=>b.logicalSectionId===h.sectionId&&mt({x:h.x,y:h.y},b.outline,b.holes)):void 0)??r.find(b=>mt({x:h.x,y:h.y},b.outline,b.holes))??null;if(a[m]=d,!d)continue;c.has(d.id)||c.set(d.id,bn(d,{floorBaseHeightM:n}));let p=l.get(d.id);p?p.push(m):l.set(d.id,[m])}let u=new Array(o.length).fill(void 0);for(let[m,h]of l){let f=c.get(m);if(!f)continue;let d=f.rake>0?Math.tan(f.rake*Math.PI/180):0,p=pi(m,o,h,t);for(let b of p.rows){let y=b.blockDepth*Me*d,g=f.height+y;for(let v of b.seatIndices)u[v]=g}}for(let m=0;m<o.length;m++){let h=o[m],f=a[m];if(!f){h.eyeHeightM=n+Yt;continue}let d=c.get(f.id);h.eyeHeightM=(u[m]??d.height)+Yt}}function vy(e){let t=e.points??[];if(e.kind!=="polygon"||t.length<3||!Array.isArray(e.edgeCurvature))return[];let n=t.map((o,r)=>{let i=e.edgeCurvature[r];return Number.isFinite(i)?Math.min(100,Math.max(-100,i)):0});return n.some(o=>Math.abs(o)>.5)?n:[]}function Sy(e){let t=vy(e);return t.length?Mu(e.points,{edgeCurvature:t}):null}function bi(e,t=2){let n=Sy(e);return n?xu(n,t):e.points??[]}function Wu(e){return e.kind==="polygon"?cr(e.holes):[]}function ju(e){let t=1/0,n=1/0,o=-1/0,r=-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>o&&(o=a.x),a.y>r&&(r=a.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function po(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var hm=jt(require("polygon-clipping"),1);var se={top:1,wallBottom:.58,bottomCap:.4};function Bn(e,t){if(!e)return t;let n=oe(Xt(e,.4),.62);return we(t,n,.22)}function Xu(e,t){return e?we(t,oe(Xt(e,.25),.74),.62):t}var lr={full:[.72,.48],value:.8,spread:.52,paleLuma:.6},ms=[.24,.46,.82];function Ku(e){if(!e)return ms;let t=we(oe(e,1.42),ms,.08),n=Math.max(...t),o=n-Math.min(...t);if(n>=lr.full[0]&&o>=lr.full[1]||.2126*e[0]+.7152*e[1]+.0722*e[2]>=lr.paleLuma)return t;let r=Math.max(...e),i=Math.min(...e);if(r-i<.04)return ms;let a=s=>lr.value-lr.spread*(1-(s-i)/(r-i));return[a(e[0]),a(e[1]),a(e[2])]}function Yu(e,t){let n=Ln(Kt({tierTop:t}));return e?kn(e,n.sectionDeck,Math.min(n.sectionDeckChromaShare*Yo(e),n.sectionDeckChromaCap)):kn(t,n.deck,Math.min(Yo(t),$r))}function $u(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let o=new Map;for(let i of t){if(!i.sectionId)continue;let a=o.get(i.sectionId);a||(a=new Map,o.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,a]of o){let s=0,c=0,l=0,u=0;for(let[m,h]of a){let f=Ie(n.get(m));f&&(s+=f[0]*h,c+=f[1]*h,l+=f[2]*h,u+=h)}u>0&&r.set(i,[s/u,c/u,l/u])}return r}function Zu(e,t){return Ie(e.color)??t.get(e.logicalSectionId??e.id)??null}var ps=jt(require("polygon-clipping"),1);var ds=jt(require("polygon-clipping"),1);var qu=e=>Math.round(e*1e6)/1e6+0;function bo(e){let t=e.map(r=>({x:qu(r.x),y:qu(r.y)})).sort((r,i)=>r.x-i.x||r.y-i.y).filter((r,i,a)=>i===0||r.x!==a[i-1].x||r.y!==a[i-1].y);if(t.length<3)return t;let n=(r,i,a)=>{let s=i.x-r.x,c=i.y-r.y,l=a.x-r.x,u=a.y-r.y;return s*u-c*l>1e-6*Math.hypot(s,c)*Math.hypot(l,u)},o=r=>{let i=[];for(let a of r){for(;i.length>=2&&!n(i[i.length-2],i[i.length-1],a);)i.pop();i.push(a)}return i.pop(),i};return[...o(t),...o([...t].reverse())]}var tm=jt(require("earcut"),1);var wy=.58,Qu=.01,Ot=cn*1.5*kt,Py=.5,Ay=.6;function Ry(e,t){let n=e.length,o=[];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,m=Math.hypot(l,u);if(m<1e-9){o.push([0,0]);continue}l/=m,u/=m,o.push([-u,l])}let r=0;for(let a=0;a<n;a++)r+=(e[a].x-t.x)*o[a][0]+(e[a].y-t.y)*o[a][1];return r<0?o.map(([a,s])=>[-a,-s]):o}function Ey(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(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}},r=o(n[1],n[0]),i=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+r.x*t,y:n[0].y+r.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Ju=Math.PI/12;function Iy(e){if(e.length<3)return[...e];let t=bo(e);return t.length>=3?t:[...e]}function nm(e,t){if(!e.length||!(t>0))return[];let n=Iy(e),o=(s,c,l,u)=>{let m=l-c;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let h=Math.max(1,Math.ceil(m/Ju)),f=t/Math.cos(m/h/2);for(let d=0;d<=h;d++){let p=c+m*d/h;u.push({x:s.x+Math.cos(p)*f,y:s.y+Math.sin(p)*f})}};if(n.length<3){let s=0,c=0;for(let f of n)s+=f.x,c+=f.y;s/=n.length||1,c/=n.length||1;let l=0;for(let f of n)l=Math.max(l,Math.hypot(f.x-s,f.y-c));let u=[],m=Math.max(3,Math.ceil(Math.PI*2/Ju)),h=(l+t)/Math.cos(Math.PI/m);for(let f=0;f<m;f++){let d=f/m*Math.PI*2;u.push({x:s+Math.cos(d)*h,y:c+Math.sin(d)*h})}return u}let r=n.length,i=[];for(let s=0;s<r;s++){let c=n[s],l=n[(s+1)%r];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<r;s++)o(n[s],i[(s+r-1)%r],i[s],a);return sm(a)}function _y(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],a=e[r+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 m=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));m<o&&(o=m)}return o}function xi(e){let t=e.map(r=>{let i=0,a=0;for(let l of r.pts)i+=l.x,a+=l.y;let s=r.pts.length||1;i/=s,a/=s;let c=0;for(let l of r.pts){let u=Math.hypot(l.x-i,l.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),n=r=>{let i=r.length;return i<=2?[...r]:[r[Math.floor(i*.25)],r[Math.floor(i*.5)],r[Math.floor(i*.75)]]},o=[];for(let r=0;r<e.length;r++){let i=n(e[r].pts),a=[],s=1/0,c=null;for(let u of i){let m=1/0;for(let h=0;h<e.length;h++){if(h===r||Math.abs(e[h].y-e[r].y)<.001)continue;let f=t[h],d=Math.hypot(u.x-f.cx,u.y-f.cy)-f.rad;if(d>=m&&d>=s)continue;let p=_y(e[h].pts,u.x,u.y);p<m&&(m=p),e[h].depth<e[r].depth&&p<s&&(s=p,c=e[h].y)}Number.isFinite(m)&&m>0&&a.push(m)}a.sort((u,m)=>u-m);let l=a.length?a[Math.floor(a.length/2)]:1;o.push({pitch:l,belowY:c})}return o}function om(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let u=r.pts[0],m=u.x-o.x,h=u.y-o.y,f=Math.hypot(m,h)||1;m/=f,h/=f;let d=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+h*d,y:u.y-m*d},{x:u.x-h*d,y:u.y+m*d}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let m=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);m>1e-6&&(a+=m,s++)}let c=s>0?a/s:0,l=Ey(i,Math.max(c*Ay,Ot));return{pts:l,nrm:Ry(l,o),front:Math.max(n[t].pitch*wy,Ot),back:Math.max(n[t].pitch*Py,Ot)}}var go=1.5,rm=.3;function hs(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],r=o.x-n.x,i=o.y-n.y,a=Math.hypot(r,i),s=-1,c=-1;for(let m=1;m<e.length-1;m++){let h=e[m],f=a>1e-12?Math.abs((h.x-n.x)*i-(h.y-n.y)*r)/a:Math.hypot(h.x-n.x,h.y-n.y);f>s&&(s=f,c=m)}if(s<=t||c<0)return[n,o];let l=hs(e.slice(0,c+1),t),u=hs(e.slice(c),t);return[...l.slice(0,-1),...u]}function im(e,t){if(e.length<4)return e;let n=hs([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Cy(e){let t=e.map((o,r)=>{let i=e[(r+1)%e.length];return{a:o,b:i,i:r,minX:Math.min(o.x,i.x),maxX:Math.max(o.x,i.x),minY:Math.min(o.y,i.y),maxY:Math.max(o.y,i.y)}}).sort((o,r)=>o.minX-r.minX),n=(o,r,i)=>(r.x-o.x)*(i.y-o.y)-(r.y-o.y)*(i.x-o.x);for(let o=0;o<t.length;o++){let r=t[o];for(let i=o+1;i<t.length&&t[i].minX<=r.maxX;i++){let a=t[i];if(!(Math.abs(r.i-a.i)===1||Math.abs(r.i-a.i)===e.length-1||r.maxY<a.minY||a.maxY<r.minY)&&n(r.a,r.b,a.a)*n(r.a,r.b,a.b)<=0&&n(a.a,a.b,r.a)*n(a.a,a.b,r.b)<=0)return!0}}return!1}function am(e,t,n){if(e.length<2)return[];let o=n??xi(e),r=new Map;for(let a=0;a<e.length;a++){let s=r.get(e[a].blockId);s?s.push(a):r.set(e[a].blockId,[a])}let i=[];for(let[,a]of r){let s=[];for(let g of a){let v=e[g].patch;v&&v.length>=3?i.push({outline:[...v],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,v)=>e[g].depth-e[v].depth);let l=s.map(g=>om(e,g,o,t)).filter(g=>g!==null);if(!l.length)continue;let u=(g,v)=>({x:g.pts[v].x-g.nrm[v][0]*(g.front+go),y:g.pts[v].y-g.nrm[v][1]*(g.front+go)}),m=(g,v)=>({x:g.pts[v].x+g.nrm[v][0]*(g.back+go),y:g.pts[v].y+g.nrm[v][1]*(g.back+go)}),h=l[0],f=l[l.length-1],d=[];for(let g=0;g<h.pts.length;g++)d.push(u(h,g));for(let g of l)d.push(m(g,g.pts.length-1));for(let g=f.pts.length-1;g>=0;g--)d.push(m(f,g));for(let g=l.length-1;g>=0;g--)d.push(u(l[g],0));let p=sm(d),b=1/0;for(let g of s)e[g].y<b&&(b=e[g].y);if(!Number.isFinite(b))continue;if(p.length>=3&&Math.abs(Rt(p))>1e-6&&l.every(g=>{let v=g.pts[Math.floor(g.pts.length/2)];return Ye(p,v.x,v.y)})&&!Cy(p)){i.push({outline:im(p,rm),holes:[],topY:b});continue}for(let g of Ty(l))i.push({outline:g,holes:[],topY:b})}return i}function Ty(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+go,a=n.back+go;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];o.push([l.x-u[0]*i,l.y-u[1]*i]),r.push([l.x+u[0]*a,l.y+u[1]*a])}let s=[...o,...r.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=ds.default.union(t[0],...t.slice(1)),o=[];for(let r of n){if(!r.length||r[0].length<4)continue;let i=r[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&&o.push(im(i,rm))}return o}catch{return[]}}function sm(e){let t=[];for(let n of e){let o=t[t.length-1];o&&Math.hypot(n.x-o.x,n.y-o.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 fs=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 o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.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 o=!0;for(let r of t)if(!Ye(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function em(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let l=[0,1,0],u=o[0];for(let m=1;m+1<o.length;m++){let h=o[m],f=o[m+1];e.tri([u.x*I,r,u.y*I],[h.x*I,r,h.y*I],[f.x*I,r,f.y*I],l,i)}return}let a=o.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=ds.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],m=[],h=[];for(let d=0;d<u.length-1;d++)m.push(u[d][0],u[d][1]),h.push([u[d][0],u[d][1]]);if(h.length<3)continue;let f=(0,tm.default)(m,void 0,2);for(let d=0;d<f.length;d+=3){let p=h[f[d]],b=h[f[d+1]],y=h[f[d+2]];e.tri([p[0]*I,r,p[1]*I],[b[0]*I,r,b[1]*I],[y[0]*I,r,y[1]*I],c,i)}}}function cm(e,t,n,o,r,i,a){if(t.length<2)return;let s=a??xi(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(f=>[f.x,f.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new fs([[...i]]):null,m=f=>{e.setMaterial(2),f(),e.setMaterial(0)},h=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let d=t[f];if(d.patch&&d.patch.length>=3){let w=[...d.patch],x=s[f].belowY??o;if(h(()=>{if(l&&u)em(e,l,u,w,d.y,r.tread);else{let S=w[0];for(let A=1;A+1<w.length;A++){let M=w[A],E=w[A+1];e.tri([S.x*I,d.y,S.y*I],[M.x*I,d.y,M.y*I],[E.x*I,d.y,E.y*I],c,r.tread)}}}),d.y>x+Qu){let S=0,A=0;for(let M of w)S+=M.x,A+=M.y;S/=w.length,A/=w.length,m(()=>{for(let M=0;M<w.length;M++){let E=w[M],T=w[(M+1)%w.length],k=T.x-E.x,_=T.y-E.y,R=Math.hypot(k,_);if(R<1e-6)continue;let C=_/R,O=-k/R;(E.x-S)*C+(E.y-A)*O<0&&(C=-C,O=-O);let B=[C,0,O],F=[E.x*I,d.y,E.y*I],N=[T.x*I,d.y,T.y*I],V=[E.x*I,x,E.y*I],H=[T.x*I,x,T.y*I];e.tri(F,N,H,B,r.riser),e.tri(F,H,V,B,r.riser)}})}continue}let p=om(t,f,s,n);if(!p)continue;let{pts:b,nrm:y,front:g,back:v}=p,P=s[f].belowY??o;for(let w=0;w+1<b.length;w++){let x=b[w],S=b[w+1],A=y[w],M=y[w+1];if(Math.hypot(S.x-x.x,S.y-x.y)<1e-6||A[0]===0&&A[1]===0||M[0]===0&&M[1]===0)continue;let E=[(x.x-A[0]*g)*I,d.y,(x.y-A[1]*g)*I],T=[(S.x-M[0]*g)*I,d.y,(S.y-M[1]*g)*I],k=[(x.x+A[0]*v)*I,d.y,(x.y+A[1]*v)*I],_=[(S.x+M[0]*v)*I,d.y,(S.y+M[1]*v)*I];if(h(()=>{l&&u?em(e,l,u,[{x:x.x-A[0]*g,y:x.y-A[1]*g},{x:S.x-M[0]*g,y:S.y-M[1]*g},{x:S.x+M[0]*v,y:S.y+M[1]*v},{x:x.x+A[0]*v,y:x.y+A[1]*v}],d.y,r.tread):(e.tri(E,T,_,c,r.tread),e.tri(E,_,k,c,r.tread))}),d.y>P+Qu){let R=[E[0],P,E[2]],C=[T[0],P,T[2]],O=[-A[0],0,-A[1]];m(()=>{e.tri(E,T,C,O,r.riser),e.tri(E,C,R,O,r.riser)})}}}}function ky(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function lm(e,t){return e.filter(n=>n.type!=="shape"||ky(n,t))}function ur(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:lm(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:lm(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Ly={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function ln(e){return ju(e)??Ly}function um(e,t){let n=Zt(e.outline,Ot),o=ln(n),r=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&po(o,ln(a.outline)));if(!r.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=ps.default.difference([i(n)],...r.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,m])=>({x:u,y:m}));if(l.length>1){let u=l[0],m=l[l.length-1];Math.abs(u.x-m.x)<1e-9&&Math.abs(u.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function mm(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},o=t.map(i=>[n(i)]),r=[];for(let i of e){let a;try{a=ps.default.intersection([n(i.outline)],o.flat())}catch{r.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&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}function Oy(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Mi=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(c=>[c.x,c.y]);if(o.length<3)return[];o.push(o[0]);let r=ln(t),i=this.rings.filter((c,l)=>po(r,this.boxes[l])&&Oy(n,this.levels[l])),a=[[o]];if(i.length)try{a=hm.default.difference([o],...i).map(l=>l.map(u=>u.map(([m,h])=>[m,h])))}catch{a=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,m])=>({x:u,y:m}));if(l.length>1){let u=l[0],m=l[l.length-1];Math.abs(u.x-m.x)<1e-9&&Math.abs(u.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function yo(e,t,n=e){if(!t)return e;let o=1/0,r=-1/0,i=1/0,a=-1/0;for(let h of n)o=Math.min(o,h.x),r=Math.max(r,h.x),i=Math.min(i,h.y),a=Math.max(a,h.y);let s=(o+r)/2,c=(i+a)/2,l=t*Math.PI/180,u=Math.cos(l),m=Math.sin(l);return e.map(h=>{let f=h.x-s,d=h.y-c;return{x:s+f*u-d*m,y:c+f*m+d*u}})}function fm(e){let t=Wu(e);return!t.length||!e.points?.length?[]:t.map(n=>yo(n,e.rotation,e.points))}function Pe(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3)return yo(bi(e,4),e.rotation,e.points);if(e.kind==="rect"&&e.width&&e.height&&(t=tr(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,o=(e.y??0)+e.height/2;t=mi(n,o,e.width/2,e.height/2)}return t?yo(t,e.rotation):null}function Gt(e){let t=e.role??"",o=t==="stage"?{kind:"stage",heightM:du(e.stageKind)}:{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}}[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var Fy=.08,Dy=30,Ny=.015;function By(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function dm(e,t){let n=Pe(e)??(e.points?.length?yo(e.points,e.rotation):null),o=Gt(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(Rt(n))*Me**2>=Dy?Ny:o.heightM;if(!n)return{topOffsetM:i,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:i,supportOffsetM:0};let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let f of n)a=Math.min(a,f.x),s=Math.min(s,f.y),c=Math.max(c,f.x),l=Math.max(l,f.y);let u=i,m=0,h=1e-6*Math.max(1,c-a,l-s);for(let f of t)c>f.minX&&a<f.maxX&&l>f.minY&&s<f.maxY&&u<=f.topOffsetM+1e-6&&(u=f.topOffsetM+Fy),a>=f.minX-h&&c<=f.maxX+h&&s>=f.minY-h&&l<=f.maxY+h&&(!f.poly||n.every(b=>By(b,f.poly)||Hy(b,f.poly,h)))&&(m=Math.max(m,f.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:a,minY:s,maxX:c,maxY:l,topOffsetM:u,poly:n}),{topOffsetM:u,supportOffsetM:Math.min(m,u)}}function Hy(e,t,n){for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],a=t[o],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/l)):0;if(Math.hypot(e.x-(i.x+u*s),e.y-(i.y+u*c))<=n)return!0}return!1}function yn(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function It(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 gt(e,t,n){return[yn(e[0],e[1],t),yn(e[0],e[1],n),yn(e[3],e[2],n),yn(e[3],e[2],t)]}function mr(e,t,n){return[yn(e[0],e[3],t),yn(e[1],e[2],t),yn(e[1],e[2],n),yn(e[0],e[3],n)]}function _e(e,t,n,o,r,i,a){ue(e,t,a?.length?a:void 0,()=>n,o,r,i,se)}var xo=12,Gy=1500,Vy=240,zy=.25;function Mo(e,t){if(!t.length)return!1;let n=0,o=0,r=0,i=new Set;for(let s of t)n+=s.x,o+=s.y,r+=Math.hypot(s.x-e.x,s.y-e.y),i.add(Math.floor(Math.atan2(s.y-e.y,s.x-e.x)*180/Math.PI/10));let a=Math.hypot(e.x-n/t.length,e.y-o/t.length);return i.size*10>Vy&&a<zy*(r/t.length)}function pm(e,t,n,o){let r=1/0,i=0;for(let a=0;a<e.length;a++){let s=e[a],c=e[(a+1)%e.length],l=c.x-s.x,u=c.y-s.y,m=n*u-o*l;if(Math.abs(m)<1e-12)continue;let h=((s.x-t.x)*u-(s.y-t.y)*l)/m,f=((s.x-t.x)*o-(s.y-t.y)*n)/m;h>0&&f>=0&&f<1&&(i+=1,r=Math.min(r,h))}return i%2===1?r:0}function bm(e,t){let n=e.stageKind??"";if(Et(n)||n==="round"||!t.length)return null;let o=Pe(e);if(!o||o.length<3)return null;let r={x:o.reduce((x,S)=>x+S.x,0)/o.length,y:o.reduce((x,S)=>x+S.y,0)/o.length},i=0,a=0;for(let x of t)i+=x.x,a+=x.y;let s=r.x-i/t.length,c=r.y-a/t.length,l=Math.hypot(s,c);if(l<1e-6||Mo(r,t))return null;let u=s/l,m=c/l,h=-m,f=u,d=-1/0,p=1/0,b=1/0,y=-1/0;for(let x of o){let S=(x.x-r.x)*u+(x.y-r.y)*m,A=(x.x-r.x)*h+(x.y-r.y)*f;d=Math.max(d,S),p=Math.min(p,S),b=Math.min(b,A),y=Math.max(y,A)}let g=(y-b)*I,v=(d-p)*I;if(g<3||v<1.5||g*v>Gy)return null;let P=(x,S)=>({x:r.x+u*x+h*S,y:r.y+m*x+f*S});return{poly:o,centre:r,ux:u,uy:m,vx:h,vy:f,back:d,front:p,left:b,right:y,widthM:g,depthM:v,at:P,box:(x,S,A,M)=>[P(x,A),P(x,M),P(S,M),P(S,A)]}}function xm(e){return e===pu}var Uy={heightShare:.6,heightMin:4.6,heightMax:10.5,heightFloor:2.6,ceilingClear:.5,pierShare:.075,pierMin:.45,pierMax:1.2,headerShare:.17,headerMin:.7,headerMax:1.6,riseShare:.1,riseMaxShare:.2,moulding:.11,cornice:.14,plinth:.4,fold:.34,foldsMin:10,foldsMax:56,swag:2.2,swagsMin:3,swagsMax:9,dropShare:.11,dropMin:.45,dropMax:1.1,fringe:.1,board:.28,boardsMax:96,boardEdge:.04,boardLift:.02,curtainClear:.12,fringeClear:.18,valanceClear:.24,valanceFringeClear:.3,archClear:.36,mouldingClear:.44},Wy=.18,jy=.2,Xy=.02,Ky=2.4,vi=[.2,.165,.145],gm=[.12,.1,.1],Si=[.5,.055,.075],wi=[.15,.012,.028],Yy=[.4,.04,.06],$y=[.13,.01,.024],Ft=[.8,.6,.24],Dt=[.46,.33,.12],Pi=[.36,.295,.225],vo=[.2,.165,.13],bs=[1,.62,.34],Zy=[.37,.25,.15],qy=[1,.87,.64];function Qy(e){let t=Math.sin(e*12.9898+4.1414)*43758.5453;return t-Math.floor(t)}function ym(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=e[(r+1)%e.length];i.across>t!=a.across>t&&n.push(i.along+(t-i.across)/(a.across-i.across)*(a.along-i.along))}n.sort((r,i)=>r-i);let o=[];for(let r=0;r+1<n.length;r+=2)o.push([n[r],n[r+1]]);return o}function Mm(e,t,n,o={}){let{poly:r,centre:i,ux:a,uy:s,vx:c,vy:l,back:u,front:m,left:h,right:f,widthM:d,at:p,box:b}=t,y=Uy,g=Wy/I,v=jy/I,P=o.maxTopY===void 0?1/0:o.maxTopY-y.ceilingClear-n,w=Math.max(y.heightFloor,Math.min(P,Math.max(y.heightMin,Math.min(y.heightMax,d*y.heightShare)))),x=n+w,S=Xy/I,A=u-2*g,M=u-g,E=h+g+v,T=f-g-v;for(let[ee,pe]of[[h+g,E],[T,f-g]])ue(e,b(A,M,ee,pe),void 0,()=>x,n,vi,vi,se);ue(e,b(A,M,E,T),void 0,()=>x,x-.3,vi,vi,se),ue(e,b(A+S,M-S,E,T),void 0,()=>n+Math.min(Ky,w-1),n,gm,gm,se);let k=r.map(ee=>({along:(ee.x-i.x)*a+(ee.y-i.y)*s,across:(ee.x-i.x)*c+(ee.y-i.y)*l})),_=(ee,pe)=>[ee.x*I,pe,ee.y*I],R=[0,1,0],C=n+y.boardLift,O=y.boardEdge/I,B=Math.min(y.boardsMax,Math.max(4,Math.round(d/y.board))),F=f-h-2*O,N=(m+A)/2,V=Math.max(1e-6,(A-m)/2),H=(h+f)/2,L=Math.max(1e-6,(f-h)/2),G=(ee,pe,de)=>{let Te=Math.hypot((pe-N)/V,(de-H)/L);return we(ee,qy,.42*Math.pow(Math.max(0,1-Te),1.3))},j=3;for(let ee=0;ee<B;ee++){let pe=h+O+F*ee/B,de=h+O+F*(ee+1)/B,Te=ym(k,pe+F*1e-4),Oe=ym(k,de-F*1e-4);if(!Te.length||Te.length!==Oe.length)continue;let Ue=oe(Zy,.84+.3*Qy(ee));for(let We=0;We<Te.length;We++){let at=Te[We][0]+O,Ze=Oe[We][0]+O,st=Math.min(Te[We][1]-O,A-O),Bt=Math.min(Oe[We][1]-O,A-O);if(!(st<=at||Bt<=Ze))for(let Ct=0;Ct<j;Ct++){let Ut=Ct/j,fn=(Ct+1)/j,_n=at+(st-at)*Ut,$n=at+(st-at)*fn,Zn=Ze+(Bt-Ze)*Ut,qn=Ze+(Bt-Ze)*fn,zo=_(p(_n,pe),C),ya=_(p($n,pe),C),Uo=_(p(Zn,de),C),Qn=_(p(qn,de),C),Jn=G(Ue,_n,pe),xa=G(Ue,$n,pe),an=G(Ue,Zn,de),Hr=G(Ue,qn,de);e.tri(zo,Uo,Qn,R,Jn,an,Hr),e.tri(zo,Qn,ya,R,Jn,Hr,xa)}}}let D=(T-E)*I,U=Math.max(y.pierMin,Math.min(y.pierMax,d*y.pierShare)),$=h+g+U/I,Z=f-g-U/I,te=(Z-$)*I;if(te<1||D<1)return;let X=Math.max(y.headerMin,Math.min(y.headerMax,w*y.headerShare)),me=w-X,re=Math.min(te*y.riseShare,me*y.riseMaxShare),ce=ee=>me-re*(1-Math.sqrt(Math.max(0,1-ee*ee))),J=[-a,0,-s],ae=(ee,pe,de)=>_(p(A-de/I,ee),n+pe),ie=(ee,pe,de,Te,Oe,Ue,We,at,Ze,st,Bt)=>{let Ct=ae(pe,Te,ee),Ut=ae(de,Oe,ee),fn=ae(de,We,ee),_n=ae(pe,Ue,ee);e.tri(Ct,Ut,fn,J,at,Ze,Bt),e.tri(Ct,fn,_n,J,at,Bt,st)};e.setMaterial(xo);let ge=Math.max(y.foldsMin,Math.min(y.foldsMax,Math.round(D/y.fold))),Ae=[0,.07,.22,.5,1],be=(ee,pe,de,Te)=>{let Oe=ee/(ge*2)*2-1,Ue=oe(ee%2?de:Te,(1-.3*Oe*Oe)*(1-.42*pe)),We=Math.pow(1-pe,5)*(1-.5*Oe*Oe);return[Math.min(1,Ue[0]*(1+1.3*We)+bs[0]*.06*We),Math.min(1,Ue[1]*(1+1.3*We)+bs[1]*.06*We),Math.min(1,Ue[2]*(1+1.3*We)+bs[2]*.06*We)]};for(let ee=0;ee<ge*2;ee++){let pe=E+(T-E)*ee/(ge*2),de=E+(T-E)*(ee+1)/(ge*2);for(let Te=0;Te+1<Ae.length;Te++){let Oe=Ae[Te],Ue=Ae[Te+1];ie(y.curtainClear,pe,de,w*Oe,w*Oe,w*Ue,w*Ue,be(ee,Oe,Si,wi),be(ee+1,Oe,Si,wi),be(ee,Ue,Si,wi),be(ee+1,Ue,Si,wi))}}ie(y.fringeClear,$,Z,0,0,y.fringe,y.fringe,Dt,Dt,Ft,Ft);let ke=Math.max(y.swagsMin,Math.min(y.swagsMax,Math.round(te/y.swag))),Ke=Math.max(y.dropMin,Math.min(y.dropMax,w*y.dropShare)),Be=ke*8,Fe=ee=>{let pe=ee/Be*2-1,de=Math.sin(Math.PI*(ee%8/8));return{x:$+(Z-$)*ee/Be,low:ce(pe)-Ke*(.42+.58*de),high:ce(pe)+.2,tone:.55+.45*de}};for(let ee=0;ee<Be;ee++){let pe=Fe(ee),de=Fe(ee+1),Te=(Oe,Ue)=>oe(we($y,Yy,Oe),1-.3*Ue);ie(y.valanceClear,pe.x,de.x,pe.low,de.low,pe.high,de.high,Te(pe.tone,0),Te(de.tone,0),Te(pe.tone,1),Te(de.tone,1)),ie(y.valanceFringeClear,pe.x,de.x,pe.low-y.fringe*.4,de.low-y.fringe*.4,pe.low+y.fringe*.6,de.low+y.fringe*.6,Dt,Dt,Ft,Ft)}let Ge=ee=>we(Pi,vo,Math.min(1,ee/w)),ne=h+g,W=f-g;for(let[ee,pe]of[[ne,$],[Z,W]]){let de=oe(Pi,.62);ie(y.archClear,ee,pe,0,0,y.plinth,y.plinth,de,de,de,de),ie(y.archClear,ee,pe,y.plinth,y.plinth,w,w,Ge(y.plinth),Ge(y.plinth),Ge(w),Ge(w))}let K=28;for(let ee=0;ee<K;ee++){let pe=ee/K*2-1,de=(ee+1)/K*2-1,Te=$+(Z-$)*ee/K,Oe=$+(Z-$)*(ee+1)/K;ie(y.archClear,Te,Oe,ce(pe),ce(de),w,w,Ge(ce(pe)),Ge(ce(de)),Ge(w),Ge(w)),ie(y.mouldingClear,Te,Oe,ce(pe),ce(de),ce(pe)+y.moulding,ce(de)+y.moulding,Ft,Ft,Dt,Dt)}let Q=y.moulding/I;ie(y.mouldingClear,$-Q,$,y.plinth,y.plinth,ce(-1)+y.moulding,ce(-1)+y.moulding,Dt,Ft,Dt,Ft),ie(y.mouldingClear,Z,Z+Q,y.plinth,y.plinth,ce(1)+y.moulding,ce(1)+y.moulding,Ft,Dt,Ft,Dt),ie(y.mouldingClear,ne,W,w-y.cornice,w-y.cornice,w,w,Dt,Dt,Ft,Ft);let ve=[c,0,l],Ee=(ee,pe,de,Te,Oe,Ue,We,at,Ze)=>{let st=ae(Te,Oe,pe),Bt=ae(Te,Oe,de),Ct=ae(Ue,We,pe),Ut=ae(Ue,We,de);e.tri(st,Ct,Ut,ee,at,Ze,Ze),e.tri(st,Ut,Bt,ee,at,Ze,at)},Ve=oe(Pi,.66),ze=oe(vo,.66);Ee([-ve[0],0,-ve[2]],0,y.archClear,ne,0,ne,w,Ve,ze),Ee(ve,0,y.archClear,W,0,W,w,Ve,ze),Ee(R,0,y.archClear,ne,w,W,w,oe(vo,.9),oe(vo,.9));let ye=oe(Pi,.8),Pt=oe(vo,.8);Ee(ve,y.curtainClear,y.archClear,$,0,$,ce(-1),ye,Pt),Ee([-ve[0],0,-ve[2]],y.curtainClear,y.archClear,Z,0,Z,ce(1),ye,Pt);let fe=oe(vo,.62),Ce=[0,-1,0];for(let ee=0;ee<K;ee++){let pe=ee/K*2-1,de=(ee+1)/K*2-1;Ee(Ce,y.curtainClear,y.archClear,$+(Z-$)*ee/K,ce(pe),$+(Z-$)*(ee+1)/K,ce(de),fe,fe)}e.setMaterial(0)}var vm=[.13,.14,.17],So=[.4,.43,.47],Jy=.18,e1=.02,t1=2.4,n1=[.055,.06,.075],o1=[.46,.33,.22],r1=[1,.96,.84],i1=[.98,.66,.28],a1=[.5,.31,.15],s1=[1,.87,.64],ht={lampEvery:1.8,lampsMin:3,lampsMax:14,lampDrop:.45,lampRadius:[.11,.2],poolShare:.44,poolEdge:.9,poolStrength:.5,washByDay:.35,drapeClear:.12,glowClear:.06,coreClear:.12,poolLift:.02};function Sm(e,t,n,o,r={}){let i=bm(t,o);if(!i)return null;if(xm(t.stageKind))return Mm(e,i,n,r.theatre),"theatre";let{poly:a,ux:s,uy:c,vx:l,vy:u,back:m,front:h,left:f,right:d,widthM:p,depthM:b,at:y,box:g}=i,v=Jy/I,P=n+Math.max(3.5,Math.min(8,p*.35)),w=n+Math.min(t1,P-n-1),x=.2/I,S=h+Math.min(b*.25,1.5)/I,A=e1/I;ue(e,g(m-2*v+A,m-v-A,f+v+x,d-v-x),void 0,()=>w,n,vm,vm,se);for(let[J,ae]of[[f+v,f+v+x],[d-v-x,d-v]])ue(e,g(m-2*v,m-v,J,ae),void 0,()=>P+.3,n,So,So,se),ue(e,g(S+x,m-2*v,J,ae),void 0,()=>P+.3,P,So,So,se);ue(e,g(S,S+x,f+v,d-v),void 0,()=>P+.3,P,So,So,se);let M=(J,ae)=>[J.x*I,ae,J.y*I],E=[-s,0,-c],T=f+v+x,k=d-v-x,_=m-2*v-ht.drapeClear/I,R=P-n,C=r.night===!1?ht.washByDay:1,O=(J,ae)=>we(n1,o1,C*(1-J*J)*Math.pow(Math.max(0,1-ae),1.6)),B=(J,ae,ie=0)=>M(y(_-ie/I,(T+k)/2+J*(k-T)/2),n+R*ae);e.setMaterial(xo);let F=8,N=5;for(let J=0;J<F;J++)for(let ae=0;ae<N;ae++){let ie=J/F*2-1,ge=(J+1)/F*2-1,Ae=ae/N,be=(ae+1)/N;e.tri(B(ie,Ae),B(ge,Ae),B(ge,be),E,O(ie,Ae),O(ge,Ae),O(ge,be)),e.tri(B(ie,Ae),B(ge,be),B(ie,be),E,O(ie,Ae),O(ge,be),O(ie,be))}let V=Math.max(ht.lampsMin,Math.min(ht.lampsMax,Math.round(p/ht.lampEvery))),H=Math.max(ht.lampRadius[0],Math.min(ht.lampRadius[1],p*.012)),L=(k-T)*I,G=1-ht.lampDrop/R,j=(J,ae,ie,ge,Ae)=>{let ke=ae/L*2,Ke=ae/R;for(let Be=0;Be<10;Be++){let Fe=2*Math.PI*Be/10,Ge=2*Math.PI*(Be+1)/10,ne=[Math.cos(Fe)*ke,Math.sin(Fe)*Ke],W=[Math.cos(Ge)*ke,Math.sin(Ge)*Ke];e.tri(B(J,G,ie),B(J+ne[0],G+ne[1],ie),B(J+W[0],G+W[1],ie),E,ge,Ae(ne[0],ne[1]),Ae(W[0],W[1]))}};for(let J=0;J<V;J++){let ae=(J+.5)/V*2-1;j(ae,H*3,ht.glowClear,we(O(ae,G),a1,.85),(ie,ge)=>O(ae+ie,G+ge)),j(ae,H,ht.coreClear,r1,()=>i1)}if(e.setMaterial(0),!r.night||!r.deck)return"rig";let D=r.deck,U=y((h+m-2*v)/2,(f+d)/2),$=n+ht.poolLift,Z=[0,1,0],te=[{r:.4,k:.72},{r:.72,k:.28},{r:1,k:0}],X=28,me=[];for(let J=0;J<X;J++){let ae=2*Math.PI*J/X,ie=Math.cos(ae)*(m-2*v-h)*ht.poolShare,ge=Math.sin(ae)*(d-f)*ht.poolShare,Ae=Math.hypot(ie,ge),be=(s*ie+l*ge)/Ae,ke=(c*ie+u*ge)/Ae;me.push(Math.min(Ae,pm(a,U,be,ke)*ht.poolEdge))}if(me.some(J=>!(J>0)))return"rig";let re=(J,ae)=>{let ie=2*Math.PI*(J%X)/X,ge=Math.cos(ie)*(m-2*v-h)*ht.poolShare,Ae=Math.sin(ie)*(d-f)*ht.poolShare,be=Math.hypot(ge,Ae),ke=me[J%X]*ae/be;return M({x:U.x+(s*ge+l*Ae)*ke,y:U.y+(c*ge+u*Ae)*ke},$)},ce=J=>we(D,s1,ht.poolStrength*J);for(let J=0;J<X;J++){e.tri(M(U,$),re(J,te[0].r),re(J+1,te[0].r),Z,ce(1),ce(te[0].k),ce(te[0].k));for(let ae=0;ae+1<te.length;ae++){let ie=te[ae],ge=te[ae+1];e.tri(re(J,ie.r),re(J,ge.r),re(J+1,ge.r),Z,ce(ie.k),ce(ge.k),ce(ge.k)),e.tri(re(J,ie.r),re(J+1,ge.r),re(J+1,ie.r),Z,ce(ie.k),ce(ge.k),ce(ie.k))}}return"rig"}function wm(e,t){let n={openField:!1,openAir:!1,court:!1,indoorCourt:!1,inTheRound:!1,stage:!1,standing:0,seatCount:t.length};for(let o of e)for(let r of o.objects){if(r.type==="gaArea"&&(n.standing+=r.capacity),r.type!=="shape")continue;let i=r.stageKind;if(hi(i)){n.openField=!0;continue}if(co(i)&&(n.openAir=!0),Et(i)){n.court=!0,fu(i)&&(n.indoorCourt=!0);continue}if(r.role!=="stage")continue;if(n.stage=!0,i==="round"){n.inTheRound=!0;continue}let a=Pe(r);if(!a||a.length<3)continue;let s={x:a.reduce((c,l)=>c+l.x,0)/a.length,y:a.reduce((c,l)=>c+l.y,0)/a.length};Mo(s,t)&&(n.inTheRound=!0)}return n}var Im=10,Hn=11,wo=[.93,.94,.95],c1=[.93,.8,.22],l1=[.82,.14,.16],u1=[.78,.1,.12],gs=[.74,.77,.8],ys={width:7.32,height:2.44,depth:2},Ai={width:1.83,height:1.22,depth:1,fromEndBoards:3.35},m1=1.5,h1=1.8,xs=2.4,yt=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],fr=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],un=e=>{let t=Math.hypot(e[0],e[1],e[2])||1;return[e[0]/t,e[1]/t,e[2]/t]};function Nt(e,t,n,o,r){let i=un(yt(n,t)),a=un(fr(i,Math.abs(i[1])<.9?[0,1,0]:[1,0,0])),s=fr(a,i),c=(l,u)=>{let m=u===0||u===3?-o:o,h=u<2?-o:o;return[l[0]+a[0]*m+s[0]*h,l[1]+a[1]*m+s[1]*h,l[2]+a[2]*m+s[2]*h]};for(let l=0;l<4;l++){let u=(l+1)%4,m=c(t,l),h=c(t,u),f=c(n,l),d=c(n,u),p=un(fr(yt(h,m),yt(f,m))),b=yt([(m[0]+h[0])/2,(m[1]+h[1])/2,(m[2]+h[2])/2],t);p[0]*b[0]+p[1]*b[1]+p[2]*b[2]<0&&(p=[-p[0],-p[1],-p[2]]);let y=oe(r,.86+.14*Math.max(0,p[1]));e.tri(m,h,d,p,y),e.tri(m,d,f,p,y)}}function hr(e,t,n,o,r){let i=Math.hypot(...yt(n,t)),a=Math.hypot(...yt(r,t)),s=un(fr(yt(n,t),yt(r,t)));e.tri(t,n,o,s,[0,0,0],[i,0,0],[i,a,0]),e.tri(t,o,r,s,[0,0,0],[i,a,0],[0,a,0])}function vs(e,t,n,o,r,i,a,s,c){let l=(g,v)=>[g[0],g[1]+v,g[2]],u=g=>[g[0]+o[0]*i,g[1],g[2]+o[2]*i],m=l(t,r),h=l(n,r),f=u(t),d=u(n),p=u(m),b=u(h);e.setMaterial(c),Nt(e,t,m,a,s),Nt(e,n,h,a,s),Nt(e,m,h,a,s),e.setMaterial(Hn);let y=Math.min(a,.03);for(let[g,v]of[[f,p],[d,b],[m,p],[h,b],[p,b],[t,f],[n,d],[f,d]])Nt(e,g,v,y,oe(s,.92));e.setMaterial(Im),hr(e,f,d,b,p),hr(e,m,h,b,p),hr(e,t,f,p,m),hr(e,n,d,b,h),e.setMaterial(0)}var Ms={height:.711,width:.2286,pitchLength:20.12},f1=[.88,.8,.6];function _m(e,t,n){if(t.length!==4)return;let o=a=>Math.hypot(t[(a+1)%4].x-t[a].x,t[(a+1)%4].y-t[a].y),r=o(0)<=o(1)?0:1,i=Math.max(o(0),o(1))*I/Ms.pitchLength;if(i>.2){e.setMaterial(Hn);for(let a of[r,r+2]){let s=t[a%4],c=t[(a+1)%4],l=o(a%4)||1,u={x:(s.x+c.x)/2,y:(s.y+c.y)/2},m=(c.x-s.x)/l,h=(c.y-s.y)/l;for(let f of[-1,0,1]){let d=f*Ms.width*i/2/I,p=$e({x:u.x+m*d,y:u.y+h*d},n);Nt(e,p,[p[0],p[1]+Ms.height*i,p[2]],.019*i,f1)}}e.setMaterial(0)}}var $e=(e,t)=>[e.x*I,t,e.y*I];function Cm(e){if(e.length<3)return null;let t=0,n=0;for(let y of e)t+=y.x,n+=y.y;t/=e.length,n/=e.length;let o=0,r=0,i=0;for(let y of e){let g=y.x-t,v=y.y-n;o+=g*g,r+=v*v,i+=g*v}let a=.5*Math.atan2(2*i,o-r),s=Math.cos(a),c=Math.sin(a),l=1/0,u=-1/0,m=1/0,h=-1/0;for(let y of e){let g=(y.x-t)*s+(y.y-n)*c,v=-(y.x-t)*c+(y.y-n)*s;l=Math.min(l,g),u=Math.max(u,g),m=Math.min(m,v),h=Math.max(h,v)}let f=(u-l)*I,d=(h-m)*I;if(!(f>4)||!(d>2))return null;let p={a:(l+u)/2,b:(m+h)/2};return{at:(y,g)=>{let v=p.a+y/I,P=p.b+g/I;return{x:t+s*v-c*P,y:n+c*v+s*P}},lengthM:f,widthM:d}}function Tm(e,t,n,o,r,i){let a=t.map(c=>$e(c,n)),s=t.map(c=>$e(c,n+o));e.setMaterial(0);for(let c=0;c<t.length;c++)Nt(e,a[c],s[c],r,i);e.setMaterial(Hn);for(let c=0;c+1<t.length;c++)Nt(e,s[c],s[c+1],.025,i);e.setMaterial(Im);for(let c=0;c+1<t.length;c++)hr(e,a[c],a[c+1],s[c+1],s[c]);e.setMaterial(0)}var Pm=[.66,.29,.22],d1=[.87,.79,.58],Am=[.17,.36,.63],km=[.56,.59,.63],p1=[.7,.7,.68],b1={length:176.9,trackWidth:9.76,longJump:{runway:40,runwayWidth:1.22,pit:9,pitWidth:2.75,fromKerb:3,start:-25},highJump:{matLength:3,matWidth:5,matHeight:.7,apron:15,intoBend:3.5,bar:2},cage:{radius:3.5,height:7,intoBend:10,pad:1.07,sectorDeg:34.92,sector:60,openDeg:120}};function Lm(e,t,n){let o=Cm(t);if(!o)return;let{at:r,lengthM:i,widthM:a}=o,s=b1,c=Math.min(1.2,Math.max(.5,i/s.length)),l=a/2,u=i/2-l,m=l-s.trackWidth;if(!(u>30*c)||!(m>22*c))return;let h=n+.03,f=(k,_,R=0)=>{ue(e,k,void 0,()=>h+R,h+R-.004,_,_,se)},d=(k,_,R,C)=>[r(k,R),r(_,R),r(_,C),r(k,C)];e.setMaterial(0),f(d(u-.08,u+.08,-l+.2,-m-.2),wo);let p=s.longJump,b=m-p.fromKerb*c,y=(p.start+p.runway)*c;f(d(p.start*c,y,b-p.runwayWidth*c/2,b+p.runwayWidth*c/2),Pm),f(d(y,y+p.pit*c,b-p.pitWidth*c/2,b+p.pitWidth*c/2),d1);let g=s.highJump,v=-(u+g.intoBend*c),P=[];for(let k=0;k<=16;k++){let _=-Math.PI/2+Math.PI*k/16;P.push(r(v-.3*c+Math.cos(_)*g.apron*c,Math.sin(_)*g.apron*c))}f(P,Pm),ue(e,d(v-g.matLength*c,v,-(g.matWidth*c)/2,g.matWidth*c/2),void 0,()=>n+g.matHeight*c,n,Am,oe(Am,.82),se),e.setMaterial(Hn);let w=[-1,1].map(k=>r(v+.25*c,k*(g.bar+.1)*c));for(let k of w)Nt(e,$e(k,n),$e(k,n+(g.bar+.3)*c),.02,wo);Nt(e,$e(w[0],n+g.bar*c),$e(w[1],n+g.bar*c),.015,wo),e.setMaterial(0);let x=s.cage,S=u+x.intoBend*c;f(((k,_)=>Array.from({length:_},(R,C)=>{let O=2*Math.PI*C/_;return r(S+Math.cos(O)*k,Math.sin(O)*k)}))(x.pad*c,16),p1);let M=x.sectorDeg/2*Math.PI/180;for(let k of[-1,1]){let _=x.sector*c,R=-Math.cos(M),C=k*Math.sin(M);f([r(S+C*.15,-R*.15),r(S+R*_+C*.15,C*_-R*.15),r(S+R*_-C*.15,C*_+R*.15),r(S-C*.15,R*.15)],wo,.006)}let E=x.openDeg/2*Math.PI/180,T=[];for(let k=0;k<=6;k++){let _=E+(2*Math.PI-2*E)*k/6;T.push(r(S-Math.cos(_)*x.radius*c,Math.sin(_)*x.radius*c))}Tm(e,T,n,x.height*c,.05,km)}var g1=[.95,.8,.16],Rm=[.13,.17,.2],Em=[.78,.8,.83],y1={backY:70,backHalf:25,pole:{x:70,y:-18},net:{height:9,inset:.5,wing:15},poleHeight:12,dugout:{length:18,depth:2.4,height:1,along:.32,inset:1.9}};function Om(e,t,n,o,r,i){let a=y1,s={x:a.pole.x-a.backHalf,y:a.pole.y-a.backY},c=Math.hypot(s.x,s.y),l=s.x/c,u=s.y/c,m=(v,P,w)=>t(v*(a.backHalf+l*P+u*w),a.backY+u*P-l*w),h=a.net,f=a.backY-h.inset,d=a.backHalf-h.inset,p=[m(-1,h.wing,h.inset)];for(let v of[-d,-d/2,d/2,d])p.push(t(v,f));p.push(m(1,h.wing,h.inset)),Tm(e,p,n,h.height*o,.05,km),e.setMaterial(0);for(let v of[-1,1]){let P=$e(t(v*(a.pole.x-.4),a.pole.y+.4),n);Nt(e,P,[P[0],P[1]+a.poleHeight*o,P[2]],.09,g1)}if(!i)return;let b=a.dugout,y=b.along*c-b.length/2,g=y+b.length;for(let v of[-1,1]){let P=[m(v,y,b.inset-b.depth/2),m(v,g,b.inset-b.depth/2)],w=[m(v,y,b.inset+b.depth/2),m(v,g,b.inset+b.depth/2)],x=Math.ceil(b.length),S=!0;for(let T=0;S&&T<=x;T++){let k=T/x;S=r({x:P[0].x+(P[1].x-P[0].x)*k,y:P[0].y+(P[1].y-P[0].y)*k})}if(!S)continue;let A=[P[0],P[1],w[1],w[0]];ue(e,A,void 0,()=>n+(b.height-.1)*o,n,Rm,oe(Rm,.85),se);let M=(T,k)=>({x:T.x+(T.x-k.x)*.04,y:T.y+(T.y-k.y)*.04}),E=[M(P[0],w[1]),M(P[1],w[0]),M(w[1],P[0]),M(w[0],P[1])];ue(e,E,void 0,()=>n+b.height*o,n+(b.height-.14)*o,Em,oe(Em,.9),se)}}function Fm(e,t,n,o,r,i){let a=t.lengthM/2,s=t.widthM/2;if(i){let c=ys.width/2*o,l=ys.depth*o;for(let u of[-1,1]){let m=t.at(u*(a+l),-c),h=t.at(u*(a+l),c);if(!r(m)||!r(h))continue;let f=$e(t.at(u*a,-c),n),d=$e(t.at(u*a,c),n),p=$e(t.at(u*(a+1),0),n),b=$e(t.at(u*a,0),n);vs(e,f,d,un(yt(p,b)),ys.height*o,l,.06,wo,0)}}e.setMaterial(Hn);for(let c of[-1,1])for(let l of[-1,1]){if(!r(t.at(c*a,l*s)))continue;let u=$e(t.at(c*a,l*s),n),m=[u[0],u[1]+m1*o,u[2]];Nt(e,u,m,.02,c1);let h=un(yt($e(t.at(c*(a+1),l*(s+1)),n),u)),f=[m[0]+h[0]*.4*o,m[1]-.14*o,m[2]+h[2]*.4*o],d=[m[0],m[1]-.28*o,m[2]];e.tri(m,f,d,un(fr(yt(f,m),yt(d,m))),l1)}e.setMaterial(0)}function Dm(e,t,n,o,r){let i=Cm(t);if(!i)return;let{at:a,lengthM:s}=i,c=Math.min(1.2,Math.max(.5,s/60)),l=s/2-Ai.fromEndBoards*c,u=Ai.width/2*c;for(let b of[-1,1]){let y=$e(a(b*l,-u),n),g=$e(a(b*l,u),n),v=$e(a(b*(l+1),0),n),P=$e(a(b*l,0),n);vs(e,y,g,un(yt(v,P)),Ai.height*c,Ai.depth*c,.03,u1,Hn)}let m=Lt(t,r/2/I);if(m.length<3)return;let h=o+h1;e.setMaterial(Hn);let f=xs;for(let b=0;b<m.length;b++){let y=m[b],g=m[(b+1)%m.length],v=Math.hypot(g.x-y.x,g.y-y.y)*I,P=0;for(;f+(v-P)>=xs;){P+=xs-f,f=0;let w=v>0?P/v:0,x={x:y.x+(g.x-y.x)*w,y:y.y+(g.y-y.y)*w};Nt(e,$e(x,o),$e(x,h),.025,gs)}f+=v-P}let d=Lt(t,(r/2-.03)/I),p=Lt(t,(r/2+.03)/I);d.length>=3&&p.length>=3&&ue(e,d,[p.slice().reverse()],()=>h,h-.05,gs,oe(gs,.9),se),e.setMaterial(0)}function Nm(e,t,n,o,r){if(t.length!==4||!(r-o>.2))return;let i=(d,p)=>({x:(d.x+p.x)/2,y:(d.y+p.y)/2}),a=d=>Math.hypot(d.x-n.x,d.y-n.y),s=a(i(t[0],t[1]))<=a(i(t[3],t[2])),[c,l,u]=s?[t[0],t[1],t[3]]:[t[3],t[2],t[0]],m=Math.hypot(u.x-c.x,u.y-c.y)*I;if(!(m>.05))return;let h=$e(c,o),f=$e(l,o);vs(e,h,f,un(yt($e(u,o),h)),r-o,m,.06,wo,0)}var x1=[.12,.38,.16],M1=[.72,.62,.45],v1=[.88,.93,.96],Bm=[.95,.95,.94],S1=[.66,.29,.22],Ss={length:20.12,width:3.05},w1=.14,P1=9.76,Vt=[.93,.94,.95],Ri=[.1,.11,.13],A1=[.45,.85,1.25],R1=1.45,Hm=.012,Gm=.004,Vm=1.07,Ei=.15,zm=[.93,.76,.18],ws={height:.2,proud:.02,buried:.03};function Gn(e,t,n,o,r,i){e.setMaterial(i),ue(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,se)}var Po=(e,t)=>Lt(e,t/I);function Wm(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<1e-9)return null;let a=-r/i*n,s=o/i*n;return[{x:e.x+a,y:e.y+s},{x:t.x+a,y:t.y+s},{x:t.x-a,y:t.y-s},{x:e.x-a,y:e.y-s}]}function E1(e,t,n,o){let r=t.map(i=>[i.x*I,n,i.y*I]);e.tri(r[0],r[1],r[2],[0,1,0],o),e.tri(r[0],r[2],r[3],[0,1,0],o)}function Ao(e,t,n,o,r,i){let a=n/I,s=[{x:t.x-a,y:t.y-a},{x:t.x+a,y:t.y-a},{x:t.x+a,y:t.y+a},{x:t.x-a,y:t.y+a}];ue(e,s,void 0,()=>r,o,i,oe(i,.85),se)}function xt(e,t,n,o,r,i,a){let s=Wm(t,n,o/I);s&&ue(e,s,void 0,()=>i,r,a,oe(a,.85),se)}function gr(e){let t=It(e),n={x:(t[0].x+t[2].x)/2,y:(t[0].y+t[2].y)/2},o=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y)||1,r=Math.hypot(t[3].x-t[0].x,t[3].y-t[0].y)||1,i={x:(t[1].x-t[0].x)/o,y:(t[1].y-t[0].y)/o},a={x:(t[3].x-t[0].x)/r,y:(t[3].y-t[0].y)/r};return{at:(c,l)=>({x:n.x+(i.x*c+a.x*l)/I,y:n.y+(i.y*c+a.y*l)/I}),lengthM:o*I,widthM:r*I}}function Ps(e){let t=1/0,n=-1/0,o=1/0,r=-1/0;for(let h of e.points??[])t=Math.min(t,h.x),n=Math.max(n,h.x),o=Math.min(o,h.y),r=Math.max(r,h.y);let i=(e.rotation??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=(t+n)/2,l=(o+r)/2,u=h=>i?{x:c+(h.x-c)*a-(h.y-l)*s,y:l+(h.x-c)*s+(h.y-l)*a}:h,m=(h,f,d,p)=>u({x:c+h/d*(n-t),y:l+f/p*(r-o)});return{turn:u,shortSideM:Math.min(n-t,r-o)*I,local:m,widthU:n-t}}function I1(e){let t=Qa(e).find(n=>n.closed&&!n.fill&&n.points.length===4);return t?t.points.map(Ps(e).turn):null}function jm(e,t,n){let o=Qa(t);if(!o.length)return;let{turn:r,shortSideM:i}=Ps(t),a=Math.max(.04,Math.min(.3,i*.004))/I,s=0;e.setMaterial(0);for(let u of o){if(!u.fill)continue;let m=u.points.map(r);Gn(e,m,null,n+Hm+s*Gm,Ie(u.fill)??Vt,0),s++}let c=o.filter(u=>!(u.fill&&u.ink===u.fill)),l=[...new Set(c.map(u=>u.ink??fi))];for(let u of l){let m=n+Hm+s++*Gm,h=Ie(u)??Vt;for(let f of c){if((f.ink??fi)!==u)continue;let d=f.points.map(r),p=f.closed?d.length:d.length-1;for(let b=0;b<p;b++){let y=Wm(d[b],d[(b+1)%d.length],a);y&&E1(e,y,m,h)}}}}function Xm(e,t,n,o,r,i){if(t.length<3)return!1;let a=o+.006,s=r??x1;if(n==="oval-cricket"){let c=t.reduce((x,S)=>x+S.x,0)/t.length,l=t.reduce((x,S)=>x+S.y,0)/t.length,u=x=>t.map(S=>({x:c+(S.x-c)*x,y:l+(S.y-l)*x})),m=8;for(let x=0;x<m;x++){let S=u(1-x/m),A=x===m-1?null:u(1-(x+1)/m);Gn(e,S,A,a,oe(s,x%2?1.04:.96),4)}let h=t[0];for(let x of t)Math.hypot(x.x-c,x.y-l)>Math.hypot(h.x-c,h.y-l)&&(h=x);let f=Math.hypot(h.x-c,h.y-l)||1,d=(h.x-c)/f,p=(h.y-l)/f,b=-p,y=d,g=Math.min(1,2*f*I*w1/Ss.length),v=Ss.length*g/2/I,P=Ss.width*g/2/I,w=(i&&I1(i))??[[-v,-P],[v,-P],[v,P],[-v,P]].map(([x,S])=>({x:c+d*x+b*S,y:l+p*x+y*S}));return Gn(e,w,null,a+.004,M1,0),_m(e,w,a+.004),e.setMaterial(0),!0}if(n==="rink-hockey"){let c=Po(t,Ei);Gn(e,c,null,a,v1,0),e.setMaterial(0),ue(e,t,[c.slice().reverse()],()=>o+Vm,o,Bm,oe(Bm,.9),se);let l=Po(t,Ei-ws.buried),u=Po(t,Ei+ws.proud);return l.length>=3&&u.length>=3&&ue(e,l,[u.slice().reverse()],()=>o+ws.height,o,zm,oe(zm,.92),se),Dm(e,t,a,o+Vm,Ei),!0}if(n==="ring-boxing"&&t.length===4){let{at:c}=gr(t),l=[c(-3.05,-3.05),c(3.05,-3.05),c(3.05,3.05),c(-3.05,3.05)],u=[[.77,.19,.19],Vt,[.17,.42,.69],Vt];e.setMaterial(0),l.forEach((m,h)=>Ao(e,m,.07,o,o+R1,u[h]));for(let m of A1)for(let h=0;h<4;h++)xt(e,l[h],l[(h+1)%4],.025,o+m-.025,o+m+.025,Vt);return!0}if(n==="court-tennis"&&t.length===4){let{at:c}=gr(t);e.setMaterial(0),xt(e,c(0,-6.4),c(0,6.4),.015,o,o+.95,Ri),xt(e,c(0,-6.4),c(0,6.4),.03,o+.95,o+1,Vt);for(let l of[-1,1])Ao(e,c(0,l*6.4),.05,o,o+1.07,Ri);return!0}if(n==="court-basketball"&&t.length===4){let{at:c,lengthM:l}=gr(t),u=Math.min(14,l/2-.5);e.setMaterial(0);for(let m of[-1,1]){let h=c(m*(u+1.2),0),f=c(m*(u-1.2),0);Ao(e,h,.12,o,o+3.4,Ri),xt(e,h,f,.06,o+3.25,o+3.4,Ri),xt(e,c(m*(u-1.2),-.9),c(m*(u-1.2),.9),.03,o+2.9,o+3.95,Vt)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:c,lengthM:l}=gr(t),u=l*(50/120);e.setMaterial(0);for(let m of[-1,1]){for(let h of[-2.8,2.8])Ao(e,c(m*u,h),.07,o,o+12,Vt);xt(e,c(m*u,-2.8),c(m*u,2.8),.06,o+2.94,o+3.06,Vt)}return!0}if(n==="track-athletics"){let c=Po(t,P1);return c.length<3?!1:(Gn(e,t,c,a,S1,0),Gn(e,c,null,a,s,4),e.setMaterial(0),Lm(e,t,o),!0)}return!1}var dr=140,Um=1.6,pr=[.9,.91,.93],Ii=[.15,.19,.3],br=[.14,.15,.18],_1=[.1,.24,.18],_i=.9,C1=6,T1={"pitch-football":105,"pitch-rugby":120,"court-tennis":23.77,"court-basketball":32},k1={sidelineShare:15/19,fromSideline:1.35,tableHalfLength:4.5,tableHalfDepth:.38,tableHeight:.76,benchFrom:6,benchTo:12.5,benchHalfDepth:.25,benchHeight:.45,benchBackHeight:.85},L1=[.13,.15,.2],O1=[.82,.84,.87];function Km(e,t,n,o,r,i=!1,a=!1){let s=t.stageKind;if(!s||n.length<3)return;if(e.setMaterial(0),s==="diamond-baseball"){let{local:M,widthU:E}=Ps(t);if(!(E>0))return;let T=M(0,0,dr,dr),k=r.filter(R=>Math.hypot(R.x-T.x,R.y-T.y)<=E),_=Math.min(1.2,Math.max(.5,E*I/dr));Om(e,(R,C)=>M(R,C,dr,dr),o,_,R=>k.every(C=>Math.hypot(C.x-R.x,C.y-R.y)*I>=Um),!a),e.setMaterial(0);return}if(s==="oval-cricket"){let M=Po(n,2.85),E=Po(n,3.1);M.length>=3&&E.length>=3&&Gn(e,M,E,o+.03,Vt,0),e.setMaterial(0);return}let c=T1[s];if(!c||n.length!==4)return;let{at:l,lengthM:u,widthM:m}=gr(n),h=Math.min(1.2,Math.max(.5,u/c)),f=u/2,d=m/2,p=Math.max(f,d)+14,b=l(0,0),y=r.filter(M=>Math.hypot(M.x-b.x,M.y-b.y)*I<p),g=M=>y.every(E=>Math.hypot(E.x-M.x,E.y-M.y)*I>=Um),v=(M,E)=>{let T=Math.max(1,Math.ceil(Math.hypot(E.x-M.x,E.y-M.y)*I));for(let k=0;k<=T;k++)if(!g({x:M.x+(E.x-M.x)*(k/T),y:M.y+(E.y-M.y)*(k/T)}))return!1;return!0},P=(M,E,T,k,_)=>{let R=Math.hypot(E[0]-M[0],E[1]-M[1]),C=Math.max(1,Math.round(R/C1));for(let O=0;O<C;O++){let B=O/C+.012,F=(O+1)/C-.012,N=l(M[0]+(E[0]-M[0])*B,M[1]+(E[1]-M[1])*B),V=l(M[0]+(E[0]-M[0])*F,M[1]+(E[1]-M[1])*F);v(N,V)&&xt(e,N,V,.06,o,o+_,k&&O%2?k:T)}};if(s==="court-basketball"){let M=k1;for(let E of[-1,1]){let T=E*(d*M.sidelineShare+M.fromSideline*h),k=T+E*M.tableHalfDepth*h,_=(B,F)=>v(l(B,T),l(F,T))&&v(l(B,k),l(F,k)),R=M.tableHalfLength*h;if(!_(-R,R))continue;let C=l(-R,T),O=l(R,T);xt(e,C,O,M.tableHalfDepth*h,o,o+M.tableHeight-.04,L1),xt(e,C,O,M.tableHalfDepth*h+.04,o+M.tableHeight-.06,o+M.tableHeight,O1);for(let B of[-1,1]){let F=B*M.benchFrom*h,N=B*M.benchTo*h;if(!_(F,N))continue;xt(e,l(F,T),l(N,T),M.benchHalfDepth,o,o+M.benchHeight,br);let V=T+E*(M.benchHalfDepth+.04);xt(e,l(F,V),l(N,V),.03,o,o+M.benchBackHeight,br)}break}return}if(s==="court-tennis"){let M=f+6.4*h,E=d+3.66*h;for(let k of[-1,1])P([k*M,-E],[k*M,E],_1,null,1);let T=l(0,d+1.2*h);g(T)&&(Ao(e,T,.3,o,o+1.5,br),Ao(e,T,.36,o+1.5,o+1.62,Vt));return}Fm(e,{at:l,lengthM:u,widthM:m},o,h,g,s==="pitch-football"&&!i);let w=d+3.2*h,x=f+4*h,S=3*h,A=15*h;P([-f+S,w],[f-S,w],pr,Ii,_i),P([-f+S,-w],[-A,-w],pr,Ii,_i),P([A,-w],[f-S,-w],pr,Ii,_i);for(let M of[-1,1])P([M*x,-d+S],[M*x,d-S],pr,Ii,_i);for(let M of a?[]:[-1,1]){let E=M*2.5*h,T=M*10.5*h,k=-(d+4.4*h),_=l(E,k),R=l(T,k);!v(_,R)||!v(l(E,k-.75*h),l(T,k-.75*h))||(xt(e,_,R,.35,o,o+.45,br),xt(e,l(E,k-.75*h),l(T,k-.75*h),.05,o,o+1.9,br),xt(e,l(E,k-.2*h),l(T,k-.2*h),.62,o+1.9,o+1.98,pr))}}var xn=72,F1=1.2,D1=5,N1=30,B1=4;function H1(e,t,n,o){let r=0;for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length],c=s.x-a.x,l=s.y-a.y,u=n*l-o*c;if(Math.abs(u)<1e-12)continue;let m=((a.x-t.x)*l-(a.y-t.y)*c)/u,h=((a.x-t.x)*o-(a.y-t.y)*n)/u;m>r&&h>=-1e-9&&h<=1+1e-9&&(r=m)}return r}function G1(e,t){if(e.length<3)return null;let n={x:e.reduce((s,c)=>s+c.x,0)/e.length,y:e.reduce((s,c)=>s+c.y,0)/e.length},o=2*Math.PI/xn,r=new Float64Array(xn);for(let s=0;s<xn;s++)if(r[s]=H1(e,n,Math.cos(s*o),Math.sin(s*o)),!(r[s]>0))return null;let i=new Float64Array(xn).fill(1/0);for(let s of t){let c=s.x-n.x,l=s.y-n.y,u=Math.hypot(c,l),m=(Math.round(Math.atan2(l,c)/o)%xn+xn)%xn;u>r[m]&&u<i[m]&&(i[m]=u)}let a=[];for(let s=0;s<xn;s++){let l=Number.isFinite(i[s])&&i[s]-r[s]<=N1/I?i[s]+F1/I:r[s]+D1/I;a.push({x:n.x+Math.cos(s*o)*l,y:n.y+Math.sin(s*o)*l})}return a}function V1(e){return we(oe(e,.84),[.33,.36,.31],.22)}function Ym(e,t,n,o,r){let i=G1(t,o);if(!i)return;let a=n-.015;e.setMaterial(B1);let s=V1(r);ue(e,i,void 0,()=>a,a-.004,s,s,se),e.setMaterial(0)}function $m(e){let t=1/0,n=1/0,o=-1/0,r=-1/0;for(let i of e)t=Math.min(t,i.x),o=Math.max(o,i.x),n=Math.min(n,i.y),r=Math.max(r,i.y);return{x:(t+o)/2,y:(n+r)/2}}function z1(e,t){let n=$m(e),o=$m(t);return Ye(t,n.x,n.y)||Ye(e,o.x,o.y)}function Ci(e){let t=new Set;if(e.length<2)return t;let n=[...e].sort((r,i)=>r.baseHeightM-i.baseHeightM||r.index-i.index),o=[];for(let r of n){let i=[];for(let a of r.objects){if(a.type!=="shape"||a.role!=="stage")continue;let s=Pe(a);!s||s.length<3||(o.some(c=>z1(s,c))?t.add(a):i.push(s))}o.push(...i)}return t}var Zm="#ffffff";var U1={wheelchair:"M7.8 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM8 7L10.5 7L10.5 15L8 15ZM8 12.5L18 12.5L18 15L8 15ZM16 15L18 15L18 18L16 18ZM5.5 16a5.5 5.5 0 1 0 11 0a5.5 5.5 0 1 0 -11 0zM8 16a3 3 0 1 1 6 0a3 3 0 1 1 -6 0z",companion:"M5.5 6.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM4.5 18.5L6 11.5L11 11.5L12.5 18.5ZM12.5 7.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM11.5 19L13 12.5L18 12.5L19.5 19Z","semi-ambulatory":"M8.3 3.8a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM9 6.2L12 6.6L11 13.5L8.6 13L9 6.2ZM8.6 13L11 13L9.5 21L7 21ZM10.4 13L12.6 13L13.6 21L11.2 21ZM11.2 7.2L14 8L14.6 9.6L11.9 8.9ZM14.4 6.8L15.9 6.8L16.4 21L14.8 21Z","designated-aisle":"M3 5L6 5L6 14L3 14ZM3 12L13 12L13 15L3 15ZM5 15L7 15L7 20L5 20ZM11 15L13 15L13 20L11 20ZM13 7L20 7L17 4L19 4L23 8.5L19 13L17 13L20 10L13 10Z","step-free":"M4 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM4.4 7L7.5 7L7.5 13L11 15L9.5 17L5 14L4.4 7ZM2 19L8 19L17 10L22 10L22 13L18 13L10 21L2 21Z",hearing:"M15.5 3.5C9 2.2 5.5 6 5.5 11.5C5.5 16 8 19.5 10.5 21C13.2 22.6 16.4 20.8 15.4 18C14.8 16.4 12.9 16.1 13 14C13.1 11.9 15.8 11.4 15.8 8.5C15.8 5.4 13 4 15.5 3.5Z",cart:"M5.5 6L18.5 6a2.5 2.5 0 0 1 2.5 2.5L21 15.5a2.5 2.5 0 0 1 -2.5 2.5L11 18L7 20.5L7.5 18L5.5 18a2.5 2.5 0 0 1 -2.5 -2.5L3 8.5a2.5 2.5 0 0 1 2.5 -2.5zM6.5 11L17.5 11L17.5 12.6L6.5 12.6zM6.5 14L17.5 14L17.5 15.6L6.5 15.6z","sign-language":"M7 11L17 11L17 18a2 2 0 0 1 -2 2L9 20a2 2 0 0 1 -2 -2zM7.6 5L9.4 5L9.4 12L7.6 12zM9.9 3.5L11.7 3.5L11.7 12L9.9 12zM12.3 3.5L14.1 3.5L14.1 12L12.3 12zM14.6 5L16.4 5L16.4 12L14.6 12zM7.2 12.5L5 10.2L6.4 8.9L8.6 11.2Z","low-vision":"M2.5 12C6 6 18 6 21.5 12C18 18 6 18 2.5 12ZM9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM17.5 3L19 3L19 6L17.5 6ZM19 4L22 4L22 5.5L19 5.5Z","sensory-friendly":"M4 11C4 5 7 2.5 12 2.5S20 5 20 11L17 11C17 7 15.5 5.5 12 5.5S7 7 7 11ZM3 10L8 10L8 19L5 19a2 2 0 0 1 -2 -2ZM16 10L21 10L21 17a2 2 0 0 1 -2 2L16 19ZM9 12L15 12L15 14L9 14ZM10 16L14 16L14 18L10 18Z","plus-size":"M9.4 4.3a2.6 2.6 0 1 0 5.2 0a2.6 2.6 0 1 0 -5.2 0zM5 20L4 13C4 10.5 7 9.5 12 9.5C17 9.5 20 10.5 20 13L19 20Z","lift-armrest":"M5 6L8 6L8 19L5 19zM5 16L18 16L18 19L5 19zM8 12L17 12L17 14.5L8 14.5zM14 7L16 7L16 12L14 12zM12 7L18 7L15 3Z"},vR=U1.wheelchair;var Ti=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7"],qm="#a4508b";var As={facilities:qm,"food-drink":Ti[5],navigation:Ti[2],accessibility:Ti[4]},Oi=Zm,Rs={minDiameterPx:12,glyphScale:.66,ringRatio:1/14,largeFromPx:24};var Qe=e=>{let t=Math.round(e*100)/100;return Object.is(t,-0)?"0":String(t)},_o=e=>`${Qe(e[0])} ${Qe(e[1])}`,Io=(e,t,n,o)=>[e+n*Math.cos(o*Math.PI/180),t+n*Math.sin(o*Math.PI/180)];function uh(e){let t=`M${_o(e.from)}`;for(let n of e.segs)t+=n.arc?`A${Qe(n.arc.r)} ${Qe(n.arc.r)} 0 ${n.arc.large} ${n.arc.sweep} ${_o(n.to)}`:`L${_o(n.to)}`;return`${t}Z`}function Je(e){let t=[e.from,...e.segs.map(o=>o.to)],n=[];for(let o=e.segs.length-1;o>=0;o--){let r=e.segs[o].arc;n.push({to:t[o],arc:r&&{...r,sweep:r.sweep?0:1}})}return{from:t[t.length-1],segs:n}}function et(e,t,n){let o={r:n,large:0,sweep:1};return{from:[e-n,t],segs:[{to:[e+n,t],arc:o},{to:[e-n,t],arc:o}]}}function Se(e,t,n,o,r){let i=Math.min(r,n/2,o/2),a={r:i,large:0,sweep:1};return i<=0?rt([[e,t],[e+n,t],[e+n,t+o],[e,t+o]]):{from:[e+i,t],segs:[{to:[e+n-i,t]},{to:[e+n,t+i],arc:a},{to:[e+n,t+o-i]},{to:[e+n-i,t+o],arc:a},{to:[e+i,t+o]},{to:[e,t+o-i],arc:a},{to:[e,t+i]},{to:[e+i,t],arc:a}]}}function rt(e){let t=0;for(let o=0;o<e.length;o++){let[r,i]=e[o],[a,s]=e[(o+1)%e.length];t+=r*s-a*i}let n=t>0?e:[...e].reverse();return{from:n[0],segs:[...n.slice(1).map(o=>({to:o})),{to:n[0]}]}}function je(e,t,n){let o=n/2,r=t[0]-e[0],i=t[1]-e[1],a=Math.hypot(r,i);if(a<1e-6)return et(e[0],e[1],o);let s=[i/a*o,-r/a*o],c={r:o,large:0,sweep:1},l=[e[0]+s[0],e[1]+s[1]];return{from:l,segs:[{to:[t[0]+s[0],t[1]+s[1]]},{to:[t[0]-s[0],t[1]-s[1]],arc:c},{to:[e[0]-s[0],e[1]-s[1]]},{to:l,arc:c}]}}function ot(e,t,n=!1){let o=[],r=n?e.length:e.length-1;for(let i=0;i<r;i++)o.push(je(e[i],e[(i+1)%e.length],t));return o}function zt(e,t,n,o,r,i){let a=i/2,s=r-o>180?1:0,c={r:a,large:0,sweep:1},l=Io(e,t,n+a,o);return{from:l,segs:[{to:Io(e,t,n+a,r),arc:{r:n+a,large:s,sweep:1}},{to:Io(e,t,n-a,r),arc:c},{to:Io(e,t,n-a,o),arc:{r:n-a,large:s,sweep:0}},{to:l,arc:c}]}}var Re=(...e)=>e.flat().map(uh).join(" "),Mt=(e,t,n)=>`M${Qe(e-n)} ${Qe(t)}a${Qe(n)} ${Qe(n)} 0 1 0 ${Qe(2*n)} 0a${Qe(n)} ${Qe(n)} 0 1 0 ${Qe(-2*n)} 0`,Qt=(e,t,n,o,r)=>uh(Se(e,t,n,o,r)),Li=e=>`M${e.map(_o).join("L")}`,ki=(e,t,n,o,r)=>`M${_o(Io(e,t,n,o))}A${Qe(n)} ${Qe(n)} 0 ${r-o>180?1:0} 1 ${_o(Io(e,t,n,r))}`;function Ro(e,t,n,o=1){let r=i=>[i[0]*o+t,i[1]*o+n];return{head:[e.head[0]*o+t,e.head[1]*o+n,e.head[2]*o],limbs:e.limbs.map(i=>i.map(r)),arcs:e.arcs?.map(([i,a,s,c,l])=>[i*o+t,a*o+n,s*o,c,l])}}function yr(e){return[Mt(e.head[0],e.head[1],e.head[2]),...e.limbs.map(Li),...(e.arcs??[]).map(([t,n,o,r,i])=>ki(t,n,o,r,i))].join(" ")}function Eo(e,t=2.6){return[et(e.head[0],e.head[1],e.head[2]+1),...e.limbs.flatMap(n=>ot(n,t)),...(e.arcs??[]).map(([n,o,r,i,a])=>zt(n,o,r,i,a,t-.2))]}var Vn={head:[10,4,2],limbs:[[[10,8.2],[10,14],[15.5,14],[18,19.5],[20.5,19.5]],[[10,10.6],[14.5,10.6]]],arcs:[[9.5,16,5.5,35,235]]},Qm={head:[10.6,3.9,1.9],limbs:[[[9.6,7.8],[7.6,12]],[[5.4,8.2],[9.4,8.4],[12.8,10]],[[4,15.6],[7.6,12],[11,13.6],[10.6,16.4]]]},Jm={cx:12,hr:1.9,arm:5,leg:3,r:2},eh={cx:12,hr:1.9,sh:2.2,hem:6,leg:3},th={cx:6.2,hr:1.8,arm:3.6,leg:2.2,r:1.4},nh={cx:17.8,hr:1.8,sh:1.4,hem:4.1,leg:2.2};function oh({cx:e,hr:t,arm:n,leg:o,r}){return[Mt(e,2+t,t),`M${Qe(e-n+r)} 8.5H${Qe(e+n-r)}a${r} ${r} 0 0 1 ${r} ${r}V15H${Qe(e+o)}V22H${Qe(e-o)}V15H${Qe(e-n)}V${Qe(8.5+r)}a${r} ${r} 0 0 1 ${r} ${-r}Z`,`M${Qe(e)} 15V22`].join(" ")}function rh({cx:e,hr:t,arm:n,leg:o,r}){return[et(e,2+t,t+1),Se(e-n-.5,7.8,2*n+1,7.7,r+.5),Se(e-o-.5,13,o,9.5,1),Se(e+.5,13,o,9.5,1)]}function ih({cx:e,hr:t,sh:n,hem:o,leg:r}){return[Mt(e,2+t,t),Li([[e-n,8.5],[e+n,8.5],[e+o,16],[e+r,16],[e+r,22],[e-r,22],[e-r,16],[e-o,16]])+"Z",`M${Qe(e)} 16V22`].join(" ")}function ah({cx:e,hr:t,sh:n,hem:o,leg:r}){return[et(e,2+t,t+1),rt([[e-n-.6,7.8],[e+n+.6,7.8],[e+o+.9,16.8],[e-o-.9,16.8]]),Se(e-r-.1,15,r-.4,7.5,.9),Se(e+.5,15,r-.4,7.5,.9)]}var W1=[[14.6,1.5],[5.2,13.6],[11,13.6],[9.4,22.5],[18.8,10.4],[13,10.4]],j1="M8.5 3.5 4 5.5l-1.5 5 3 1 1-2v11h11v-11l1 2 3-1-1.5-5-4.5-2c-.5 1.5-1.8 2.5-3.5 2.5s-3-1-3.5-2.5Z",X1="M12 2.5S5 9.5 5 14.5a7 7 0 0 0 14 0c0-5-7-12-7-12Z",K1="M2.5 21.5h19V3h-6v6.2H9.2v6.2H2.5Z",sh=[[9,3],[15,3],[15,9],[21,9],[21,15],[15,15],[15,21],[9,21],[9,15],[3,15],[3,9],[9,9]],Y1={from:[3.8,5.2],segs:[{to:[20.2,5.2]},{to:[22,7],arc:{r:1.8,large:0,sweep:1}},{to:[22,9.7]},{to:[22,14.3],arc:{r:2.3,large:0,sweep:0}},{to:[22,17]},{to:[20.2,18.8],arc:{r:1.8,large:0,sweep:1}},{to:[3.8,18.8]},{to:[2,17],arc:{r:1.8,large:0,sweep:1}},{to:[2,14.3]},{to:[2,9.7],arc:{r:2.3,large:0,sweep:0}},{to:[2,7]},{to:[3.8,5.2],arc:{r:1.8,large:0,sweep:1}}]},$1={from:[12,1.6],segs:[{to:[20.4,4.9]},{to:[20.4,11.2]},{to:[12,22.4],arc:{r:13,large:0,sweep:1}},{to:[3.6,11.2],arc:{r:13,large:0,sweep:1}},{to:[3.6,4.9]},{to:[12,1.6]}]};function ch(e,t,n){return{from:[e-n,t],segs:[{to:[e+n,t],arc:{r:n,large:0,sweep:1}},{to:[e-n,t]}]}}var lh={head:[13.2,4.3,2.2],limbs:[[[12.6,8.6],[11.2,15],[17.8,18.4],[9.4,18.4]],[[12.4,9.8],[16,14.4]]]},Z1=[[6,10.5],[15,10.5],[16.5,7],[18.5,5.5],[20,6.5],[21.5,8.5],[19.5,10],[18,12],[18,19],[16.5,19],[15.5,14],[9.5,14],[8.5,19],[7,19],[6.5,13]],q1=[[5.4,9.8],[14.6,9.8],[16.1,6.4],[18.4,4.6],[20.5,5.9],[22.4,8.6],[19.9,10.6],[18.8,12.3],[18.8,19.8],[15.8,19.8],[15,14.8],[10.1,14.8],[9.2,19.8],[6.2,19.8],[5.6,13.2]],Es=[{key:"restroom-men",label:"Men's restroom",group:"facilities",path:oh(Jm),solid:Re(rh(Jm))},{key:"restroom-women",label:"Women's restroom",group:"facilities",path:ih(eh),solid:Re(ah(eh))},{key:"restroom-accessible",label:"Accessible restroom",group:"facilities",path:[Qt(2.5,2.5,19,19,3.5),yr(Ro(Vn,4.6,4.3,.66))].join(" "),solid:Re(Eo(Vn)),solidLarge:Re(Se(1.5,1.5,21,21,4.5),Je(Se(3.9,3.9,16.2,16.2,2.6)),Eo(Ro(Vn,4.9,4.7,.62),2.2))},{key:"first-aid",label:"First aid",group:"facilities",path:Li(sh)+"Z",solid:Re(rt(sh.map(([e,t])=>[e+(e-12)*.08,t+(t-12)*.08])))},{key:"coat-check",label:"Coat check",group:"facilities",path:"M10 6.5a2 2 0 1 1 2 2V10 M12 10 3.4 16.9a1.4 1.4 0 0 0 .9 2.6h15.4a1.4 1.4 0 0 0 .9-2.6Z",solid:Re(zt(12,6.2,2.2,180,450,2.3),je([12,8.4],[12,10.5],2.3),ot([[12,10.2],[3.2,18.8],[20.8,18.8]],2.8,!0))},{key:"atm",label:"ATM / cash",group:"facilities",path:[Qt(2,6,20,12,2),Mt(12,12,2.75),"M6 12h.01 M18 12h.01"].join(" "),solid:Re(Se(1.5,5.5,21,13,2.4),Je(et(12,12,3.2)))},{key:"info",label:"Info point",group:"facilities",path:[Mt(12,12,9.5),"M10.8 11H12v5.8 M12 7.6h.01"].join(" "),solid:Re(et(12,4.9,2.4),Se(10.3,9.2,3.4,12.3,1),Se(8.2,9.2,4,3,1),Se(8.2,18.5,7.6,3,1))},{key:"lost-found",label:"Lost & found",group:"facilities",path:[Mt(10.5,10.5,7.5),"M16 16l5.5 5.5","M8.4 8.4a2.1 2.1 0 1 1 3 1.9c-.6.4-.9.8-.9 1.6 M10.5 14.6h.01"].join(" "),solid:Re(zt(12,7.6,4.2,180,405,3.4),ot([[14.97,10.57],[12,13],[12,15]],3.4),et(12,20,2.1))},{key:"restrooms",label:"Toilets",group:"facilities",path:[oh(th),ih(nh)].join(" "),solid:Re(rh(th),ah(nh))},{key:"charging",label:"Charging point",group:"facilities",path:[Qt(6,2,12,20,2.5),"M13.2 6.2 9.6 12h4.8l-3.6 5.8"].join(" "),solid:Re(rt(W1))},{key:"smoking",label:"Smoking area",group:"facilities",path:[Qt(2,14.5,14.5,4,1),"M6.5 14.5v4","M15.5 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4 M19 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4"].join(" "),solid:Re(Se(1.5,14,4.2,5,1.2),Se(6.8,14,10.4,5,1.2),ot([[15.9,11.4],[17.3,8.9],[15.9,6.4],[17.1,3.9]],2.2),ot([[19.6,11.4],[21,8.9],[19.6,6.4],[20.8,3.9]],2.2))},{key:"no-smoking",label:"No smoking",group:"facilities",path:[Mt(12,12,9.5),"M5.3 5.3l13.4 13.4","M5.5 10.5h13v3h-13Z"].join(" "),solid:Re(et(12,12,10.6),Je(et(12,12,8)),je([6,6],[18,18],2.8),Se(5,10.4,3,3.2,.6),Se(16,10.4,3,3.2,.6))},{key:"food",label:"Food",group:"food-drink",path:"M5 2.5V8a2.5 2.5 0 0 0 5 0V2.5 M7.5 2.5v19 M18.5 13.5h-2c-1.3 0-2-1-2-2.5 0-4 1.5-7 4-8.5v19",solid:Re(ot([[4.9,2.6],[4.9,8]],2.2),ot([[10.1,2.6],[10.1,8]],2.2),ot([[7.5,2.6],[7.5,8]],2.2),zt(7.5,8,2.6,0,180,2.2),je([7.5,10],[7.5,21.4],3),rt([[19.4,2.2],[19.4,14.2],[16.2,14.2],[14.1,12],[14.1,9.4],[15.2,5.8],[17.3,3.3]]),je([18,13],[18,21.4],3))},{key:"bar",label:"Bar",group:"food-drink",path:"M3.5 3.5h17L12 13Z M6.2 6.5h11.6 M12 13v7.5 M8 20.5h8",solid:Re(rt([[2.8,3],[21.2,3],[12,13.6]]),je([12,12],[12,20.6],2.8),je([7.4,21],[16.6,21],2.8))},{key:"coffee",label:"Caf\xE9 / coffee",group:"food-drink",path:"M4 9h12v4.5a5.5 5.5 0 0 1-5.5 5.5h-1A5.5 5.5 0 0 1 4 13.5Z M16 10.5h1.2a2.75 2.75 0 0 1 0 5.5H16 M8 3v3 M12 3v3 M3 21.5h14",solid:Re({from:[3.4,8.4],segs:[{to:[16.6,8.4]},{to:[16.6,13.4]},{to:[11,19.4],arc:{r:5.8,large:0,sweep:1}},{to:[9,19.4]},{to:[3.4,13.4],arc:{r:5.8,large:0,sweep:1}},{to:[3.4,8.4]}]},zt(17.2,13.25,2.5,270,450,2.4),je([7.8,2.6],[7.8,5.6],2.4),je([12.2,2.6],[12.2,5.6],2.4),je([2.6,21.6],[17.4,21.6],2.6))},{key:"water",label:"Water / drinks",group:"food-drink",path:X1,solid:"M12 1.2S4 8.9 4 14.5a8 8 0 0 0 16 0c0-5.6-8-13.3-8-13.3Z"},{key:"merch",label:"Merch / shop",group:"food-drink",path:j1,solid:"M8.4 2.8 3.5 5l-1.9 6 4.2 1.4.4-.8v9.4h11.6v-9.4l.4.8 4.2-1.4-1.9-6-4.9-2.2c-.4 1.5-1.8 2.6-3.6 2.6s-3.2-1.1-3.6-2.6Z"},{key:"screen",label:"Screen",group:"facilities",path:[Qt(2,3.5,20,13.5,2),"M12 17v3.5 M8 20.5h8","M10 7.8v5.9l5-2.95Z"].join(" "),solid:Re(Se(1.5,3,21,14.4,2.4),Je(rt([[9.6,6.7],[16,10.2],[9.6,13.7]])),Se(10.6,16.5,2.8,4,0),je([7.4,21],[16.6,21],2.8))},{key:"sound-booth",label:"Sound booth",group:"facilities",path:["M6 3v9 M6 16v5 M12 3v3 M12 10v11 M18 3v10 M18 17v4",Mt(6,14,2),Mt(12,8,2),Mt(18,15,2)].join(" "),solid:Re(je([6,2.8],[6,21.2],1.8),je([12,2.8],[12,21.2],1.8),je([18,2.8],[18,21.2],1.8),Se(3.2,11.6,5.6,4.8,1.4),Se(9.2,5.6,5.6,4.8,1.4),Se(15.2,12.6,5.6,4.8,1.4))},{key:"entrance",label:"Entrance",group:"navigation",path:"M11 7V3.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v17a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V17 M2.5 12h13.5 M12.5 8.5 16 12l-3.5 3.5",solid:Re(ot([[11,6.5],[11,2.6],[21,2.6],[21,21.4],[11,21.4],[11,17.5]],2.6),je([2.8,12],[13.5,12],3.2),rt([[12.6,7.8],[18,12],[12.6,16.2]]))},{key:"exit",label:"Exit",group:"navigation",path:"M13 7V3.5a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v17a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V17 M8 12h13.5 M18 8.5l3.5 3.5-3.5 3.5",solid:Re(ot([[13,6.5],[13,2.6],[3,2.6],[3,21.4],[13,21.4],[13,17.5]],2.6),je([7.2,12],[17,12],3.2),rt([[16.2,7.8],[21.6,12],[16.2,16.2]]))},{key:"emergency-exit",label:"Emergency exit",group:"navigation",path:[yr(Ro(Qm,-2,1.4,1.15)),"M15.5 13h6 M19 10.5l2.5 2.5-2.5 2.5"].join(" "),solid:Re(Eo(Ro(Qm,-2,1.4,1.15),2.7),je([15.6,13],[19.5,13],2.8),rt([[18.4,9.4],[22.4,13],[18.4,16.6]]))},{key:"stairs",label:"Stairs",group:"navigation",path:K1,solid:"M1.5 22.5h21V2h-7.8v6.4H8.4v6.4H1.5Z"},{key:"elevator",label:"Elevator",group:"navigation",path:[Qt(3.5,2.5,17,19,2.5),"M8.5 9.5 12 5.5l3.5 4Z M8.5 14.5l3.5 4 3.5-4Z"].join(" "),solid:Re(rt([[12,1.6],[19.6,10.2],[4.4,10.2]]),rt([[4.4,13.8],[19.6,13.8],[12,22.4]]))},{key:"parking",label:"Parking",group:"navigation",path:[Qt(3,3,18,18,3),"M9.5 17V7h3.75a3 3 0 0 1 0 6H9.5"].join(" "),solid:"M6.5 21V3H12a5.5 5.5 0 0 1 0 11h-1.9v7Z M10.1 6.6v3.8H12a1.9 1.9 0 0 0 0-3.8Z"},{key:"wheelchair",label:"Wheelchair access",group:"accessibility",path:yr(Vn),solid:Re(Eo(Vn))},{key:"hearing",label:"Hearing assistance",group:"accessibility",path:["M4 9a6 6 0 1 1 12 0c0 3-1.8 4.3-3 5.2-1.1.8-1.6 1.7-1.6 3.1a3.6 3.6 0 0 1-6.2 2.1","M7.5 9a2.5 2.5 0 0 1 5 0c0 1.2-.7 1.9-1.6 2.5","M18.5 5.5a6.5 6.5 0 0 1 0 8"].join(" "),solid:Re(zt(10,9,6,180,380,3),ot([[15.64,11.05],[12.8,14.3],[11.5,17.2]],3),zt(8.2,17.2,3.3,0,150,3),zt(10,9,2.2,180,400,2.4),zt(13.38,9.5,6.5,322,398,2.6))},{key:"box-office",label:"Box office / tickets",group:"navigation",path:"M3 7.5A1.5 1.5 0 0 1 4.5 6h15A1.5 1.5 0 0 1 21 7.5V10a2 2 0 0 0 0 4v2.5a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 16.5V14a2 2 0 0 0 0-4Z M15 6v2 M15 11v2 M15 16v2",solid:Re(Y1,Je(Se(14.1,7,1.8,2.2,.9)),Je(Se(14.1,10.9,1.8,2.2,.9)),Je(Se(14.1,14.8,1.8,2.2,.9)))},{key:"escalator",label:"Escalator",group:"navigation",path:"M2.5 17H7l9-9h5.5v4h-4l-9 9h-6Z M11 4.5h.01 M11 8.2v3.3",solid:Re(rt([[2,16.4],[6.8,16.4],[15.8,7.4],[22,7.4],[22,12.6],[17.8,12.6],[8.8,21.6],[2,21.6]]),et(11,4.3,2.3),je([11,8],[11,11],2.6))},{key:"ramp",label:"Ramp",group:"navigation",path:"M2.5 19.5h19v-10Z M4.5 13.2 14 8.2 M10.53 7.76 14 8.2l-1.6 3.11",solid:Re(rt([[1.6,20.4],[22.4,20.4],[22.4,8.6]]),je([4.2,13.4],[13.2,8.6],2.6),rt([[15.4,7.5],[13.16,11.84],[10.56,6.88]]))},{key:"taxi",label:"Taxi / rideshare",group:"navigation",path:["M9.5 2.5h5V5h-5Z M6.5 11 8 7h8l1.5 4",Qt(3.5,11,17,6,2),"M6.5 17v2.5 M17.5 17v2.5 M7 14h.01 M17 14h.01"].join(" "),solid:Re(Se(9,1.8,6,3.4,.8),rt([[6,11.4],[7.6,6.4],[16.4,6.4],[18,11.4]]),Se(2.8,10.6,18.4,7,2.2),Je(et(6.8,14,1.3)),Je(et(17.2,14,1.3)),Se(4.8,16,3.6,5.2,1.2),Se(15.6,16,3.6,5.2,1.2))},{key:"transit",label:"Bus / transit",group:"navigation",path:[Qt(4.5,2.5,15,16,3),"M4.5 10.5h15 M9 5.5h6 M7.5 18.5V21 M16.5 18.5V21 M8 14.5h.01 M16 14.5h.01"].join(" "),solid:Re(Se(4,2,16,17,3.2),Je(Se(6.2,5.8,11.6,5,1)),Je(et(8,14.5,1.3)),Je(et(16,14.5,1.3)),Se(6,17,3.4,5,1.2),Se(14.6,17,3.4,5,1.2))},{key:"bike-parking",label:"Bike parking",group:"navigation",path:[Mt(6,14.5,4),Mt(18,14.5,4),"M6 14.5 9 7.5h6.5L18 14.5 M9 7.5l2.5 7H6 M11.5 14.5l4-7 M7.5 6h3 M15.5 7.5 15 5.5h2"].join(" "),solid:Re(et(6,14.5,4.9),Je(et(6,14.5,2.7)),et(18,14.5,4.9),Je(et(18,14.5,2.7)),ot([[6,14.5],[9,7.5],[15.5,7.5],[18,14.5]],2.2),ot([[9,7.5],[11.5,14.5],[15.5,7.5]],2.2),je([6,14.5],[11.5,14.5],2.2),je([7.2,5.8],[10.6,5.8],2.2),ot([[15.4,7.3],[15,5.4],[17.2,5.4]],2.2))},{key:"meeting-point",label:"Meeting point",group:"navigation",path:["M9.5 2.5 12 5l2.5-2.5 M9.5 21.5 12 19l2.5 2.5 M2.5 9.5 5 12l-2.5 2.5 M21.5 9.5 19 12l2.5 2.5",Mt(10,9.6,1.5),Mt(14,9.6,1.5),"M7.5 15.5a2.5 2.5 0 0 1 5 0 M11.5 15.5a2.5 2.5 0 0 1 5 0"].join(" "),solid:Re(ot([[9.4,2.4],[12,5],[14.6,2.4]],2.6),ot([[9.4,21.6],[12,19],[14.6,21.6]],2.6),ot([[2.4,9.4],[5,12],[2.4,14.6]],2.6),ot([[21.6,9.4],[19,12],[21.6,14.6]],2.6),et(9.7,9.3,2.2),et(14.3,9.3,2.2),ch(9.7,16,3),ch(14.3,16,3))},{key:"security",label:"Security / bag check",group:"facilities",path:"M12 2.5 19.5 5.5v6c0 4.6-3.2 8.4-7.5 10-4.3-1.6-7.5-5.4-7.5-10v-6Z M8.5 12l2.5 2.5 4.5-5",solid:Re($1,Je(rt([[7.4,12.2],[9,10.6],[10.9,12.5],[15,8.4],[16.6,10],[10.9,15.7]])))},{key:"lockers",label:"Lockers",group:"facilities",path:[Qt(3.5,2.5,17,19,1.5),"M12 2.5v19 M6 6h3 M15 6h3 M9.5 11.5v2.5 M14.5 11.5v2.5"].join(" "),solid:Re(Se(3,2,8.4,20,1.4),Je(Se(5,5,4.4,1.7,.8)),Je(Se(8.6,10.8,1.5,3.8,.7)),Se(12.6,2,8.4,20,1.4),Je(Se(14.6,5,4.4,1.7,.8)),Je(Se(13.9,10.8,1.5,3.8,.7)))},{key:"baby-change",label:"Baby change",group:"facilities",path:"M10 6.5l.8-3.3a1.2 1.2 0 0 1 2.4 0l.8 3.3 M8.5 6.5h7 M9.5 6.5l-.9 2.2a3 3 0 0 0-.1.9V19a2.5 2.5 0 0 0 2.5 2.5h2a2.5 2.5 0 0 0 2.5-2.5V9.6a3 3 0 0 0-.1-.9l-.9-2.2 M8.5 12.5h3 M8.5 16h3",solid:Re(rt([[9.6,6.2],[10.6,1.8],[13.4,1.8],[14.4,6.2]]),Se(7.6,5.4,8.8,2.6,1),Se(7.8,7.4,8.4,15,2.6),Je(Se(7.8,11.8,3.4,1.5,0)),Je(Se(7.8,15.4,3.4,1.5,0)))},{key:"prayer-room",label:"Prayer room",group:"facilities",path:[yr(lh),"M3 21.5h18"].join(" "),solid:Re(Eo(lh),Se(2.4,20.2,19.2,2.6,1.3))},{key:"quiet-room",label:"Quiet room",group:"facilities",path:"M4 9h3.5l5-4v14l-5-4H4Z M15.5 9.5l5 5 M20.5 9.5l-5 5",solid:Re(rt([[2.6,8.4],[7.2,8.4],[13,3.6],[13,20.4],[7.2,15.6],[2.6,15.6]]),je([15.4,9.2],[20.8,14.8],2.8),je([20.8,9.2],[15.4,14.8],2.8))},{key:"wifi",label:"Wi-Fi",group:"facilities",path:[ki(12,19,11.5,218,322),ki(12,19,7.5,218,322),ki(12,19,3.5,218,322),"M12 19h.01"].join(" "),solid:Re(zt(12,19.2,11,218,322,2.8),zt(12,19.2,6.9,218,322,2.8),et(12,19.2,2.2))},{key:"vip-lounge",label:"VIP lounge",group:"facilities",path:["M6.5 11V7a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v4","M3.5 11.5a1.5 1.5 0 0 1 3 0V14h11v-2.5a1.5 1.5 0 0 1 3 0v6h-17Z","M5.5 17.5V20 M18.5 17.5V20"].join(" "),solid:Re(Se(6,4,12,8.5,2.2),Se(2.4,9.6,4.6,9,2.2),Se(17,9.6,4.6,9,2.2),Se(6,13.2,12,5.4,.6),je([5,18],[5,20.6],2.4),je([19,18],[19,20.6],2.4))},{key:"accessible-entrance",label:"Accessible entrance",group:"accessibility",path:[yr(Ro(Vn,.3,5,.62)),"M12.5 3.5H20a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1h-7.5"].join(" "),solid:Re(Eo(Ro(Vn,.3,5,.62),2.2),ot([[13,2.8],[21.2,2.8],[21.2,21.2],[13,21.2]],2.6))},{key:"assistance-dog",label:"Assistance-dog area",group:"accessibility",path:[Li(Z1)+"Z","M6 10.8 3.5 7.5","M10.5 10.5V6h4.5l1 2.5"].join(" "),solid:Re(rt(q1),je([6.2,11],[3.2,7.2],2.4),ot([[10.5,11],[10.5,5.6],[15.2,5.6],[16.2,8.2]],2.2))}],RR=new Map(Es.map(e=>[e.key,e]));var mh=Es;var Q1=new Map(mh.map(e=>[e.key,e]));function xr(e){return e?Q1.get(e):void 0}var CR=mh.map(e=>e.key);function Mr(e){if(e.length<3)return e.map(n=>({...n}));let t=bo(e);return t.length>=3?t:[...e].sort((n,o)=>n.x-o.x||n.y-o.y).map(n=>({...n}))}var J1=.8,ex=.6,tx=2;function Mn(e,t){if(!t.length)return null;let n=[],o=0;for(let a of e.objects){if(a.type!=="shape"||a.role!=="wall")continue;let s=Pe(a)??[],c=hh(s)/2;!(c>0)||rx(s)/c*I>tx||(n.push(...s),o+=c)}if(n.length<3)return null;let r=Mr(n);if(r.length<3||o<hh(r)*ex)return null;let i=0;for(let a of t)ix(a,r)&&(i+=1);return i>=t.length*J1?r:null}var Fi=6,nx=5,ox=8;function fh(e){return Math.max(ox,(Number.isFinite(e)?e:0)+nx)}function Co(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r++){let i=e[r],a=e[(r+1)%e.length],s=i.x*a.y-a.x*i.y;t+=s,n+=(i.x+a.x)*s,o+=(i.y+a.y)*s}if(Math.abs(t)<1e-9){let r=0,i=0;for(let a of e)r+=a.x,i+=a.y;return{x:r/Math.max(1,e.length),y:i/Math.max(1,e.length)}}return{x:n/(3*t),y:o/(3*t)}}function rx(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2}function hh(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=Math.hypot(r.x-o.x,r.y-o.y)}return t}function ix(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function dh(e,t,n,o=[],r){if(t<1)return null;let i=1/0,a=-1/0,s=1/0,c=-1/0,l=-1/0,u=(v,P)=>{v<i&&(i=v),v>a&&(a=v),P<s&&(s=P),P>c&&(c=P)};for(let v=0;v<t;v++)u(e[v*3],e[v*3+2]),e[v*3+1]>l&&(l=e[v*3+1]);for(let[v,P]of o)u(v,P);if(!Number.isFinite(i)||!Number.isFinite(l))return null;let m=(i+a)/2,h=(s+c)/2,f=Math.max(4,(a-i)/2),d=Math.max(4,(c-s)/2),p=1,b=(v,P)=>{let w=Math.hypot((v-m)/f,(P-h)/d);w>p&&(p=w)};for(let v=0;v<t;v++)b(e[v*3],e[v*3+2]);for(let[v,P]of o)b(v,P);let y=Math.min(9,Math.max(5,2*Math.max(f,d)*.1)),g=Math.max(n+8,l+y);return{centre:[m,h],radii:[f*p+6,d*p+6],floorY:n,ceilingY:r===void 0?g:Math.max(r,l+5)}}function ax(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let o=t-e.x,r=n-e.y,i=Math.hypot(o,r);return i<1e-9?[0,0]:[o/i,r/i]}}}function sx(e,t){if(!e.length)return null;let n=0,o=0,r=0;for(let f of e)n+=f.x,o+=f.y,r+=Math.hypot(f.x-t.x,f.y-t.y);let i=e.length;n/=i,o/=i,r/=i;let a=e[0],s=-1;for(let f of e){let d=Math.hypot(f.x-n,f.y-o);d>s&&(s=d,a=f)}let c=a.x-n,l=a.y-o,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let m=[...e].sort((f,d)=>(f.x-n)*c+(f.y-o)*l-((d.x-n)*c+(d.y-o)*l)),h=0;for(let f of m){let d=Math.hypot(f.x-n,f.y-o);d>h&&(h=d)}return{pts:m,cx:n,cy:o,radius:h,depth:r}}function ph(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let r=1/0;for(let i=0;i+1<o.length;i++){let a=o[i],s=o[i+1],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,m=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;m<0?m=0:m>1&&(m=1);let h=Math.hypot(t-(a.x+m*c),n-(a.y+m*l));h<r&&(r=h)}return r}var Di=8;function cx(e,t,n){let o=new Array(Di).fill(1/0),r=new Array(Di).fill(-1);for(let u=0;u<e.length;u++){let m=e[u],h=Math.hypot(t-m.cx,n-m.cy)-m.radius;for(let f=0;f<Di;f++)if(h<o[f]){for(let d=Di-1;d>f;d--)o[d]=o[d-1],r[d]=r[d-1];o[f]=h,r[f]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of r){if(u<0)continue;let m=ph(e[u],t,n);for(let h=0;h<3;h++)if(m<i[h]){for(let f=2;f>h;f--)i[f]=i[f-1],a[f]=a[f-1];i[h]=m,a[h]=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 m=a[u];if(m<0||i[u]>s)continue;let h=1/(i[u]*i[u]);c+=h*e[m].depth,l+=h}return l>0?c/l:e[a[0]].depth}function lx(e){let t=(o,r)=>cx(e,o,r),n=(o,r)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(o-c.cx,r-c.cy)-c.radius>=i)continue;let l=ph(c,o,r);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,r)=>{let i=(t(o+.5,r)-t(o-.5,r))/1,a=(t(o,r+.5)-t(o,r-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function bh(e,t){let n=[];for(let o of e){let r=sx(o.points,t);r&&n.push(r)}return n.length<2?ax(t):(n.sort((o,r)=>o.depth-r.depth),lx(n))}var vn=.06,ux=.05,yh=.05,gh=.15,Is=25;function xh(e,t,n){let o=new Map,r=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 h=0;h<e.length;h+=1){let f=e[h];for(let d of f.objects){if(d.type==="table"&&u.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let p=Zt(d.outline,Ot);c.set(d.id,{section:d,unit:f,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:d.id,floorIndex:h,box:ln(p),section:d,unit:f,outline:p})}}let m=new Map;for(let h of l){let f=m.get(h.floorIndex);f?f.push(h):m.set(h.floorIndex,[h])}for(let h=0;h<t.length;h++){let f=t[h],d=n?m.get(n[h])??[]:l,p=f.sectionId?d.find(y=>y.id===f.sectionId)??d.find(y=>y.section.logicalSectionId===f.sectionId&&mt({x:f.x,y:f.y},y.outline,y.section.holes)):void 0,b=p?[p]:d;for(let y of b){if(n&&y.floorIndex!==n[h]||!p&&(f.x<y.box.minX||f.x>y.box.maxX||f.y<y.box.minY||f.y>y.box.maxY||!mt({x:f.x,y:f.y},y.outline,y.section.holes)))continue;r[h]=y.id;let g=c.get(y.id);g.hasSeats=!0;let v=f.focalPoint??y.unit.focal,P=Math.hypot(f.x-v.x,f.y-v.y);P<g.frontU&&(g.frontU=P),g.seatIndices.push(h);let w=f.rowId||`__seat-${h}`,x=g.rows.get(w);x?x.push({x:f.x,y:f.y}):g.rows.set(w,[{x:f.x,y:f.y}]);break}}for(let[h,f]of c){let d=bn(f.section,{floorBaseHeightM:f.unit.baseHeightM}),p=f.unit.baseHeightM,b=d.rake>0?Math.tan(d.rake*Math.PI/180):0,y=d.rake<=.01&&d.height<=p+.001,g=f.section.surfaceKind,v=g==="flat"?!0:g==="rakedRows"&&d.rake>.01?!1:y,P=f.hasSeats?pi(h,t,f.seatIndices,f.unit.focal):{sectionId:h,rows:[],blockCount:0},x=P.rows.length<2?bh([...f.rows.values()].map(F=>({points:F})),f.unit.focal):null,S=1/0;if(x){if(f.hasSeats)for(let F of f.rows.values())for(let N of F){let V=x.depthAt(N.x,N.y);V<S&&(S=V)}if(!f.hasSeats||!Number.isFinite(S)){S=1/0;for(let F of f.section.outline){let N=x.depthAt(F.x,F.y);N<S&&(S=N)}}}let A=p+ux,M=Math.max(A,d.height),E=F=>{let N=Math.max(0,F-S)*Me,V=Math.min(N*b,Is);return Math.max(A,d.height+V)},T=F=>{let N=Math.max(0,F)*Me,V=Math.min(N*b,Is);return Math.max(A,d.height+V)},k=v?[]:P.rows.map(F=>({pts:F.pts,y:T(F.blockDepth),depth:F.blockDepth,blockId:F.blockId,...u.has(F.id)?{patch:nm(F.pts,Ot)}:{}})),_=k.length?k[0].y:M,R=k.map(F=>{let N=F.patch&&F.patch.length>=3?F.patch:F.pts,V=0,H=0;for(let j of N)V+=j.x,H+=j.y;let L=N.length||1;V/=L,H/=L;let G=0;for(let j of N){let D=Math.hypot(j.x-V,j.y-H);D>G&&(G=D)}return{cx:V,cy:H,rad:G}}),C=v?()=>M:k.length>=2?(F,N)=>{let V=1/0,H=_;for(let L=0;L<k.length;L++){let G=R[L];if(Math.hypot(F-G.cx,N-G.cy)-G.rad>=V)continue;let j=k[L].patch,D=j&&j.length>=3?Ye(j,F,N)?0:mo(j,F,N):mo(k[L].pts,F,N);D<V&&(V=D,H=k[L].y)}return H}:(F,N)=>x?E(x.depthAt(F,N)):M,O=[0,1,0],B=k.length>=2||v?()=>O:(F,N)=>{if(!x)return O;let V=x.depthAt(F,N);if(V<=S)return O;let H=(V-S)*Me;if(H*b>=Is||d.height+H*b<=A)return O;let[L,G]=x.gradientAt(F,N);if(L===0&&G===0)return O;let j=1/Math.hypot(b,1);return[-L*b*j,j,-G*b*j]};if(!v)for(let F of P.rows){let N=T(F.blockDepth);for(let V of F.seatIndices)a[V]=N}for(let F of P.rows){let N=[];for(let j=1;j<F.pts.length;j++){let D=Math.hypot(F.pts[j].x-F.pts[j-1].x,F.pts[j].y-F.pts[j-1].y);D>1e-6&&N.push(D)}N.sort((j,D)=>j-D);let V=N.length?N[Math.floor(N.length/2)]:1/0,H=1/0,L=F.pts[Math.floor(F.pts.length/2)];if(L)for(let j of P.rows){if(j===F||j.blockId!==F.blockId)continue;let D=mo(j.pts,L.x,L.y);D>1e-6&&D<H&&(H=D)}let G=Math.min(V,Math.max(H,V*.5));if(Number.isFinite(G)&&G>0)for(let j of F.seatIndices)s[j]=G}o.set(h,{sectionId:h,deckAt:C,normalAt:B,flat:v,bottomY:p,rowLevels:k,landingY:_})}for(let h=0;h<t.length;h++){let f=r[h],d=t[h];if(f){let y=a[h];i[h]=(y??o.get(f).deckAt(d.x,d.y))+gh;continue}let p=d.eyeHeightM,b=Number.isFinite(p)?Math.max(0,p-Yt):0;i[h]=d.kind==="booth"?b+vn+gh:b}return{bySection:o,seatOwner:r,seatDeckY:h=>i[h],seatPitchU:h=>s[h]}}function To(e,t,n){if(e.length!==4||n<=t)return null;let o=It(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*I,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*I;if(r<1e-6||i<1e-6)return null;let a=Math.min(.22/r,.16),s=Math.min(.28,(n-t)*.13),c=Math.min(.065/i,.2);return{quad:o,side:a,face:c,opening:gt(o,a,1-a),openingTop:n-s}}function _s(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=It(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*I;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),a=i/r,s=gt(o,a,1-a);return{quad:o,side:a,trim:i,inner:s,panel:mr(s,.15,.85),bottom:t+i,top:n-i}}function Mh(e,t,n,o){let r=_s(e,t,n);if(!r)return;let{panel:i}=r,a=(g,v)=>({x:(g.x+v.x)/2,y:(g.y+v.y)/2}),s=a(i[0],i[1]),c=a(i[3],i[2]),l=Math.hypot(s.x-o.x,s.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[u,m]=l?[i[0],i[1]]:[i[3],i[2]],h=l?{x:s.x-c.x,y:s.y-c.y}:{x:c.x-s.x,y:c.y-s.y},f=Math.hypot(h.x,h.y);if(f<1e-6)return;-(m.y-u.y)*h.x+(m.x-u.x)*h.y<0&&([u,m]=[m,u]);let d=Math.min(.006,f*I*.05),p=h.x/f*d,b=h.y/f*d,y=(g,v)=>[g.x*I+p,v,g.y*I+b];return[y(u,r.bottom),y(m,r.bottom),y(u,r.top),y(m,r.top)]}var Sh=jt(require("polygon-clipping"),1);var vh=jt(require("polygon-clipping"),1);function mn(e,t,n,o,r,i,a,s={}){let c=ln(t),l=s.ao??se,u=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let b=Pe(p);if(!b||b.length!==4||!po(c,ln(b)))return[];let y=s.portalBase??n,g=To(b,y,y+Gt(p).heightM);if(!g)return[];let v=Math.min(o,g.openingTop);return v<=n?[]:[{poly:g.opening,height:v}]});if(!u.length)return!1;let m=p=>p.map(b=>[b.x,b.y]),h=[m(t),...(s.holes??[]).map(m)],f=[n,...new Set(u.map(p=>p.height)),o].sort((p,b)=>p-b),d=[];try{for(let p=1;p<f.length;p++){let b=f[p-1],y=f[p];if(y-b<1e-6)continue;let g=u.filter(P=>P.height>b+1e-6).map(P=>[m(P.poly)]),v=g.length?vh.default.difference(h,...g):[h];d.push({low:b,high:y,polys:v})}}catch{return!1}for(let p of d)for(let b of p.polys){let[y,...g]=b.map(P=>P.map(([w,x])=>({x:w,y:x}))),v=P=>l.wallBottom+(l.top-l.wallBottom)*(P-n)/(o-n);ue(e,y,g,()=>p.high,p.low,i,a,{...l,top:v(p.high),wallBottom:v(p.low)})}return!0}var Cs={depthM:1.6,thicknessM:.35,minWallM:6};function Ni(e,t,n,o,r,i,a,s,c){let l=o-n;if(l<=0)return;let u=s&&(c??l)>=Cs.minWallM?mx(t,s):null,m=u?o-Cs.thicknessM:o,h=m-n,f=h<1.5?[[n,m,1]]:u?[[n,n+Math.min(.9,h*.18),.82],[n+Math.min(.9,h*.18),m,1]]:[[n,n+Math.min(.9,h*.18),.82],[n+Math.min(.9,h*.18),m-.1,1],[m-.1,m,1.1]],d=p=>se.wallBottom+(se.top-se.wallBottom)*(p-n)/l;for(let[p,b,y]of f){let g={...se,top:d(b),wallBottom:d(p)},v=oe(i,y),P=oe(a,y);mn(e,t,p,b,r,v,P,{portalBase:n,ao:g})||ue(e,t,void 0,()=>b,p,v,P,g)}for(let[p,...b]of u??[])ue(e,p,b.length?b:void 0,()=>o,m,oe(i,1.12),oe(a,.78),se)}function mx(e,t){let n=Cs.depthM/I,o=e.map(a=>{let s=t.x-a.x,c=t.y-a.y,l=Math.hypot(s,c)||1;return{x:a.x+s/l*n,y:a.y+c/l*n}}),r=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s},i=[[r(e)],[r(o)]];for(let a=0;a<e.length;a++){let s=(a+1)%e.length;i.push([r([e[a],e[s],o[s],o[a]])])}try{let[a,...s]=i,c=Sh.default.union(a,...s);return c.length?c.map(l=>l.map(u=>u.slice(0,-1).map(([m,h])=>({x:m,y:h})))):null}catch{return null}}function wh(e){return e.route?.stepFree===!0&&(e.kind==="line"||e.kind==="polyline")}function Ph(e){let t=Number.isFinite(e)&&e>0?e:4;return[Math.max(6,t*2.6),Math.max(4,t*1.7)]}function Ah(e,t,n){let o=[];if(e.length<2||!(t>0)||!(n>=0))return o;let r=!0,i=t;for(let a=0;a<e.length-1;a+=1){let s=e[a],c=e[a+1],l=Math.hypot(c.x-s.x,c.y-s.y);if(l<1e-9)continue;let u=(c.x-s.x)/l,m=(c.y-s.y)/l,h=0;for(;h<l-1e-9;){let f=Math.min(i,l-h);r&&o.push([{x:s.x+u*h,y:s.y+m*h},{x:s.x+u*(h+f),y:s.y+m*(h+f)}]),h+=f,i-=f,i<=1e-9&&(r=!r,i=r?t:n)}}return o}function vr(e,t,n){let o=Ie(t.stroke?.color),r=t.stroke?.width??0;if(!o||!Number.isFinite(r)||r<=0)return;let i=t.kind==="line"||t.kind==="polyline",a=i?yo(t.points??[],t.rotation):Pe(t);if(!a||a.length<2)return;let s=r*.5,c=wh(t)?Ah(a,...Ph(r)):Array.from({length:i?a.length-1:a.length},(l,u)=>[a[u],a[(u+1)%a.length]]);for(let[l,u]of c){let m=Math.hypot(u.x-l.x,u.y-l.y);if(m<1e-6)continue;let h=-(u.y-l.y)/m*s,f=(u.x-l.x)/m*s,d=[(l.x+h)*I,n,(l.y+f)*I],p=[(u.x+h)*I,n,(u.y+f)*I],b=[(u.x-h)*I,n,(u.y-f)*I],y=[(l.x-h)*I,n,(l.y-f)*I];e.tri(d,p,b,[0,1,0],o),e.tri(d,b,y,[0,1,0],o)}}function Rh(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var ko=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function Bi(e,t,n,o){let[r,i,a,s]=t?e:[e[3],e[2],e[1],e[0]];return[ko(r,s,n),ko(i,a,n),ko(i,a,o),ko(r,s,o)]}function Eh(e,t,n,o,r,i,a,s,c=!1){if(n.length!==4||r-o<.4)return!1;let l=A=>c?Math.min(A,r):A,u=It(n),m=Math.hypot(u[3].x-u[0].x,u[3].y-u[0].y)*I;if(m<.4)return!1;let h=ko(u[0],u[1],.5),f=ko(u[3],u[2],.5),d=Math.hypot(h.x-s.x,h.y-s.y)<=Math.hypot(f.x-s.x,f.y-s.y),p=we(a,[.92,.9,.86],.35),b=oe(i,.72),y=r-o;if(t==="restroom"){let A=Math.min(.18,y*.08);return _e(e,u,r-A,o,a,i),_e(e,u,r,r-A,p,p),!0}let g=o+Math.min(1.1,y),v=t==="coat"?1:Math.min(.5,.75/m),P=Bi(u,d,0,v);if(_e(e,P,g-.05,o,b,i),_e(e,P,g,g-.05,p,p),t==="coat"||m<1.2)return!0;if(t==="bar"){let A=Bi(u,d,Math.max(v+.2,1-.45/m),1),M=l(o+Math.max(Math.min(2.2,y*2),g-o+.6));return _e(e,A,M,o,a,b),!0}let w=Bi(u,d,Math.max(v+.25,.55),1),x=l(o+Math.max(2.6,g-o+1.4));if(x-.14<=g)return!0;_e(e,w,x-.14,o,a,i),_e(e,u,x,x-.14,p,b);let S=Math.min(.08,.1/Math.max(.1,Math.hypot(u[1].x-u[0].x,u[1].y-u[0].y)*I));for(let[A,M]of[[0,S],[1-S,1]])_e(e,Bi(gt(u,A,M),d,0,Math.min(.08,.1/m)),x-.14,g,b,b);return!0}var Vi=[.19,.4,.15],hx=.012,Lo=2.4,fx=1,dx=.75,px=.15;function _t(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:r}=e;if(!n||!o)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=o/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,m])=>({x:t.x+u*a-m*s,y:t.y+u*s+m*a}))}function kh(e,t,n,o,r,i,a=!1){let s=_t(t);if(s){if(a){let c=Bn(o,r.boothTop),l=$t([...s]);ue(e,Zt(l,bx/I),[l.slice().reverse()],()=>n+.03,n,c,oe(c,.8),se);return}if(!(!t.points&&i&&yx(e,s,n,o,i))){if(!t.points&&i&&s.length===4){gx(e,s,n,o,i);return}ue(e,s,void 0,()=>n+Lo,n,Bn(o,r.boothTop),r.boothWall,se)}}}var Ts=1.1,Ih=[.9,.9,.88],bx=.1,Hi=[.87,.87,.85],_h=.08;function Lh(e,t){let n=c=>({x:(e[c].x+e[(c+1)%4].x)/2,y:(e[c].y+e[(c+1)%4].y)/2}),o=0,r=1/0;for(let c=0;c<4;c++){let l=n(c),u=Math.hypot(l.x-t.x,l.y-t.y);u<r&&(r=u,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),a=(c,l,u)=>({x:c.x+(l.x-c.x)*u,y:c.y+(l.y-c.y)*u});return{q:i,part:(c,l,u,m)=>{let h=a(i[0],i[1],c),f=a(i[0],i[1],l),d=a(i[3],i[2],c),p=a(i[3],i[2],l);return[a(h,d,u),a(f,p,u),a(f,p,m),a(h,d,m)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*I,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*I}}function gx(e,t,n,o,r){let{q:i,part:a}=Lh(t,r),s=o??[.35,.42,.55],c=we(s,[.78,.78,.77],.62),l=we(s,[.95,.95,.94],.45);_e(e,i,n+vn,n,c,oe(c,.8)),_e(e,a(.05,.95,.72,.98),n+Ts-.05,n+vn,l,oe(l,.8)),_e(e,a(.03,.97,.7,1),n+Ts,n+Ts-.05,Ih,oe(Ih,.9))}function yx(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:a,depthM:s,widthM:c}=Lh(t,r);if(s<1||c<1)return!1;let l=o??[.35,.42,.55],u=we(l,[.78,.78,.77],.62),m=n+Lo,h=_h/c,f=_h/s;_e(e,i,n+vn,n,u,oe(u,.8)),_e(e,a(0,1,1-f,1),m,n+vn,Hi,oe(Hi,.9));for(let[b,y]of[[0,h],[1-h,1]])_e(e,a(b,y,0,1-f),m,n+vn,Hi,oe(Hi,.9));_e(e,a(h,1-h,0,Math.min(.5,.06/s)),m,m-.3,l,oe(l,.85));let d=Math.min(.4,.6/c),p=Math.min(.12,.3/s);return _e(e,a(.5-d,.5+d,.72-p,.72+p),n+fx,n+vn,we(l,[.95,.95,.94],.7),oe(l,.75)),!0}function Ui(e){if(e.shape==="round"){let u=e.radius;return u?mi(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:o,center:r}=e;if(!t||!n)return null;let i=(o??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,m])=>({x:r.x+u*a-m*s,y:r.y+u*s+m*a}))}function Oh(e,t,n,o,r,i=!0){let a=Ui(t);if(!a)return;let s=a.reduce((d,p)=>d+p.x,0)/a.length,c=a.reduce((d,p)=>d+p.y,0)/a.length,l=d=>a.map(p=>({x:s+(p.x-s)*d,y:c+(p.y-c)*d})),u=Kt(r)?1:vx,m=i&&o?Bn(o,r.tableTop):oe(xx,u),h=oe(Mx,u),f=n+dx;ue(e,a,void 0,()=>f,n+Sx,m,oe(m,.86),se),ue(e,l(.12),void 0,()=>f+.12,f,h,oe(h,.8),se)}var xx=[.93,.92,.89],Mx=[.78,.66,.42],vx=.62,Sx=.25,Sr={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function wx(e,t,n){let o=e.reduce((y,g)=>y+g.x,0)/4,r=e.reduce((y,g)=>y+g.y,0)/4,i=e[3].x-e[0].x,a=e[3].y-e[0].y,s=Math.hypot(i,a)||1;i/=s,a/=s,i*(t.x-o)+a*(t.y-r)<0&&(i=-i,a=-a);let c=-a,l=i,u=Sr.armM/I,m=Sr.widthM/I,h=s/2+Sr.insideM/I,f=n?-1:1,d=o+i*(h+(n?0:u)),p=r+a*(h+(n?0:u)),b=(y,g)=>({x:d+i*y*f+c*g,y:p+a*y*f+l*g});return[b(0,0),b(-u,u),b(-u-m,u),b(-m,0),b(-u-m,-u),b(-u,-u)]}function Px(e,t,n,o,r){let i=[.94,.95,.96];ue(e,wx(t,o,r),void 0,()=>n+Sr.high,n+Sr.low,i,i,se)}function zi(e,t){let n=Ie(e);return n?{top:oe(Xt(n,.12),.95),wall:oe(Xt(n,.12),.85)}:{top:t.tierTop,wall:t.tierWall}}function Fh(e,t,n,o,r,i,a,s,c=[]){let l=Pe(t),u=fm(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!l){vr(e,t,n+o+hx);return}let h=s?s.kind==="stage":t.role==="stage",f=s?s.kind==="screen":t.role==="screen",d=s?{kind:h?"stage":"solid",heightM:s.topY-s.baseY}:Gt(t),p=s?.baseY??n,b=s?.topY??n+o,y=null;if(h&&a){let _=1/0,R=-1/0,C=1/0,O=-1/0;for(let B of l)B.x<_&&(_=B.x),B.x>R&&(R=B.x),B.y<C&&(C=B.y),B.y>O&&(O=B.y);y={cx:(_+R)/2*I,cz:(C+O)/2*I,y:b,halfX:Math.max((R-_)/2*I,.5),halfZ:Math.max((O-C)/2*I,.5)},a.push(y)}let g=Ie(t.fill),v=t.role==="wall"||t.role==="entrance"||t.role==="exit",P=v?zi(t.fill,r).top:h&&g?we(r.stageTop,oe(Xt(g,.18),.9),.9):!t.role&&g?g:Bn(g,h?r.stageTop:r.decorTop),x=v?zi(t.fill,r).wall:h?g?we(r.stageWall,oe(g,.58),.82):r.stageWall:f?Ku(f?g:null):Bn(Ie(t.fill),r.decorWall),S=h&&Kt(r)?Ln(!0):null,A=S?Th(P,S.stageTop):P,M=S?Th(x,S.stageWall):x;if(y&&(y.top=A),t.role==="wall"&&!s){Ni(e,l,p,b,c,A,M,i),vr(e,t,b+.012);return}if(f&&l.length===4&&b-p>.2){let _=_s(l,p,b);if(!_)return;let{quad:R,side:C,trim:O,inner:B,panel:F}=_,N=[.12,.15,.18];for(let[V,H]of[[0,C],[1-C,1]])_e(e,gt(R,V,H),b,p,N,N);_e(e,B,p+O,p,N,N),_e(e,B,b,b-O,N,N),_e(e,F,b-O,p+O,M,M),vr(e,t,b+.012);return}let E=g?oe(Xt(g,.15),.82):M,T=g?oe(Xt(g,.1),1.02):A;if(Rh(t.role)&&!s&&Eh(e,t.role,l,p,b,E,T,i,t.heightM!==void 0))return;if((t.role==="sound"||s?.kind==="sound_desk")&&l.length===4&&b-p>.3){let _=It(l),R=Math.hypot(_[1].x-_[0].x,_[1].y-_[0].y)*I,C=Math.min(.12,.09/Math.max(R,.001)),O=[.18,.21,.24],B=b-Math.min(.12,(b-p)*.15);for(let[F,N]of[[0,C],[1-C,1]])_e(e,gt(_,F,N),B,p,O,O);_e(e,_,b,B,A,O);return}if(t.role==="rail"&&l.length===4&&b>p){let _=It(l),R=Math.hypot(_[1].x-_[0].x,_[1].y-_[0].y)*I,C=Math.max(1,Math.min(128,Math.ceil(R/1.4))),O=Math.min(.08,.055/Math.max(.055,R)),B=[.58,.64,.66];for(let F=0;F<=C;F++){let N=F/C,V=Math.min(1-O,Math.max(0,N-O/2));_e(e,gt(_,V,V+O),b,p,B,oe(B,.8))}for(let F of[.52,1]){let N=p+(b-p)*F;_e(e,_,N,Math.max(p,N-.055),B,oe(B,.8))}return}if(t.role==="goal"&&l.length===4){Nm(e,It(l),i,p,b),e.setMaterial(0);return}if(d.kind==="portal"&&l.length===4){let _=To(l,p,b);if(!_)return;let{quad:R,side:C,face:O,openingTop:B}=_;for(let[F,N,V]of[[0,O,1],[O,1-O,.67],[1-O,1,1]]){let H=mr(R,F,N),L=oe(A,V),G=oe(M,V);for(let[j,D]of[[0,C],[1-C,1]])_e(e,gt(H,j,D),B,p,L,G);_e(e,H,b,B,L,G)}(t.role==="entrance"||t.role==="exit")&&Px(e,R,p,i,t.role==="exit");return}if(d.kind==="suite"&&l.length===4){let _=l.map((O,B)=>{let F=l[(B+1)%4],N=(O.x+F.x)/2,V=(O.y+F.y)/2;return Math.hypot(N-i.x,V-i.y)}),R=_.indexOf(Math.min(..._)),C=[0,1,2,3].map(O=>l[(R+O)%4]);_e(e,gt(C,0,.08),b,p,A,M),_e(e,gt(C,.92,1),b,p,A,M),_e(e,mr(C,.88,1),b,p,A,M),_e(e,C,b,Math.max(p,b-.18),A,M);return}if(h&&!t.stageKind?.startsWith("pitch-")&&b-p>.12){let _=b-Math.min(.06,(b-p)*.15);_e(e,l,_,p,A,M,u),_e(e,l,b,_,A,we(A,M,.2),u)}else _e(e,l,b,p,A,M,u);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&l.length===4){e.setMaterial(4);let _=It(l),R=we(g??Vi,Vi,g?.45:0);for(let C=0;C<12;C++){let O=gt(_,C/12,(C+1)/12),B=oe(R,C%2?1.09:.91),F=O.map(N=>[N.x*I,b+.006,N.y*I]);e.tri(F[0],F[1],F[2],[0,1,0],B),e.tri(F[0],F[2],F[3],[0,1,0],B)}}t.stageKind&&t.stageKind!=="pitch-football"&&Xm(e,l,t.stageKind,b,g,t),h&&Et(t.stageKind)&&jm(e,t,b),e.setMaterial(f?1:0),vr(e,t,b+.012)}function Wi(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,a=n+r/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=o/2,m=r/2;return[[-u,-m],[u,-m],[u,m],[-u,m]].map(([h,f])=>({x:i+h*c-f*l,y:a+h*l+f*c}))}function Ax(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 o=n[1].trim();if(o==="none"||o==="transparent")return null;let r=o.match(/^url\(#([^)]+)\)$/);if(!r)return Ie(o);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${r[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=Ie(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>we(s,c,1/(l+1)),a[0]):null}function Dh(e,t,n,o){if(t.layer==="foreground")return;let r=Wi(t);if(!r)return;let i=n+px,a=Bn(Ax(t.href),o.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=we(o.ground,a,s)),ue(e,r,void 0,()=>i,n,a,we(a,o.decorWall,.5),se)}function Nh(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=Xu(o,r.gaTop);e.setMaterial(Rx),ue(e,t.points,t.holes,()=>n+wr,n,i,r.gaWall,se),e.setMaterial(0),_x(e,t.points,n+wr)}var Rx=13,wr=.15,Gi=[.72,.74,.76],ks=1.1,Ch=.12,Ls=.05,Ex=.06,Ix=2.4;function _x(e,t,n){let o=$t([...t]),r=Lt(o,Ch/I),i=Lt(o,(Ch+Ls)/I);if(r.length<3||i.length<3)return;for(let s of[n+ks,n+ks*.5])ue(e,r,[i.slice().reverse()],()=>s,s-Ls,Gi,oe(Gi,.85),se);let a=Ex/2/I;for(let s=0;s<r.length;s++){let c=r[s],l=r[(s+1)%r.length],u=Math.hypot(l.x-c.x,l.y-c.y)*I,m=Math.max(1,Math.round(u/Ix));for(let h=0;h<m;h++){let f=h/m,d=c.x+(l.x-c.x)*f,p=c.y+(l.y-c.y)*f,b=[{x:d-a,y:p-a},{x:d+a,y:p-a},{x:d+a,y:p+a},{x:d-a,y:p+a}];ue(e,b,void 0,()=>n+ks-Ls,n,Gi,oe(Gi,.8),se)}}}function Th(e,t){return Kr(e)<t?kn(e,t):e}var Xe={stepM:.79,spacingM:.45,tries:8,edgeM:.35,heightM:[1.5,1.78],capDesktop:6e3,capSmall:2e3,smallCeiling:3e4,maxCellsPerArea:6e4,maxCellsPerVenue:24e4,behind:{levelM:.6,clearM:6,fullM:14,from:.3,sideM:4},clothes:8,skins:4,hairs:5};function zh(e,t,n=!0){if(!n)return 0;let o=t<=Xe.smallCeiling?Xe.capSmall:Xe.capDesktop;return Math.max(0,Math.min(o,Math.floor(t-e)))}function Xi(){let e=globalThis;return(e.navigator?.hardwareConcurrency??8)<=4||(e.navigator?.deviceMemory??8)<=4||(e.matchMedia?.("(pointer: coarse)").matches??!1)?Xe.smallCeiling:Xe.smallCeiling*2}var Bh=[[1,0],[.92388,.382683],[.707107,.707107],[.382683,.92388],[0,1],[-.382683,.92388],[-.707107,.707107],[-.92388,.382683],[-1,0],[-.92388,-.382683],[-.707107,-.707107],[-.382683,-.92388],[0,-1],[.382683,-.92388],[.707107,-.707107],[.92388,-.382683]],Cx=[[.939693,-.34202],[.954588,-.29793],[.967415,-.253195],[.978148,-.207912],[.986762,-.162178],[.993238,-.116093],[.997564,-.069756],[.999729,-.023269],[.999729,.023269],[.997564,.069756],[.993238,.116093],[.986762,.162178],[.978148,.207912],[.967415,.253195],[.954588,.29793],[.939693,.34202]];function hn(e,t,n,o){let r=Math.imul(e|0,2654435761)^Math.imul(t|0,2246822519)^Math.imul(n|0,3266489917)^Math.imul(o|0,668265263);return r^=r>>>15,r=Math.imul(r,739982445),r^=r>>>12,r=Math.imul(r,695872825),r^=r>>>15,r>>>0}var ji=e=>e/4294967296;function Hh(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let a=e[r],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(o=!o)}return o}function Gh(e,t,n){let o=1/0;for(let r=0,i=e.length-1;r<e.length;i=r++){let a=e[r],s=e[i],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,m=u>0?Math.max(0,Math.min(1,((t-a.x)*c+(n-a.y)*l)/u)):0,h=t-(a.x+c*m),f=n-(a.y+l*m);o=Math.min(o,h*h+f*f)}return o}var Uh=(e,t)=>(e+32768)*65536+(t+32768);function Tx(e,t){let n=e.focal;if(!n)return null;let o=Math.sqrt(Xe.behind.fullM*Xe.behind.fullM+Xe.behind.sideM*Xe.behind.sideM)/I,r=1/0,i=1/0,a=-1/0,s=-1/0;for(let m of e.points)r=Math.min(r,m.x),a=Math.max(a,m.x),i=Math.min(i,m.y),s=Math.max(s,m.y);let c=4/I,l=new Map,u=[];for(let m of t){if(m.floorIndex!==e.floorIndex||m.x<r-o||m.x>a+o||m.y<i-o||m.y>s+o||Math.abs(m.deckY-e.floorY)>Xe.behind.levelM)continue;let h=n.x-m.x,f=n.y-m.y,d=Math.sqrt(h*h+f*f);if(!(d>0))continue;let p=Uh(Math.floor(m.x/c),Math.floor(m.y/c)),b=l.get(p);b||l.set(p,b=[]),b.push(u.length),u.push(m.x,m.y,h/d,f/d)}return u.length?{cell:c,cells:l,data:u}:null}function kx(e,t,n){let{clearM:o,fullM:r,from:i,sideM:a}=Xe.behind,s=Math.floor(t/e.cell),c=Math.floor(n/e.cell),l=1;for(let u=c-4;u<=c+4;u++)for(let m=s-4;m<=s+4;m++){let h=e.cells.get(Uh(m,u));if(h)for(let f of h){let d=(t-e.data[f])*I,p=(n-e.data[f+1])*I,b=e.data[f+2],y=e.data[f+3],g=d*b+p*y;if(!(g<=0||g>=r)&&!(Math.abs(d*y-p*b)>a)){if(g<o)return 0;l=Math.min(l,i+(1-i)*(g-o)/(r-o))}}}return l}function Vh(e,t,n,o,r){return(Math.ceil(t/r)-Math.floor(e/r)+1)*(Math.ceil(o/r)-Math.floor(n/r)+1)}function Lx(e,t,n,o,r){let i=Xe.stepM/I,a=Vh(e,t,n,o,i);if(a<=r)return i;let s=i*Math.sqrt(a/r);for(let c=0;c<400&&Vh(e,t,n,o,s)>r;c++)s*=1.05;return s}function Ox(e,t,n,o){if(e.points.length<3||!(e.capacity>0))return[];let r=Xe.edgeM/I,i=r*r,a=1/0,s=1/0,c=-1/0,l=-1/0;for(let w of e.points)a=Math.min(a,w.x),c=Math.max(c,w.x),s=Math.min(s,w.y),l=Math.max(l,w.y);if(!Number.isFinite(a+c+s+l))return[];let u=Lx(a,c,s,l,o),m=Tx(e,n),h=[],f=Xe.spacingM/I,d=f*f,p=Math.floor(s/u),b=Math.ceil(l/u),y=Math.floor(a/u),g=Math.ceil(c/u),v=g-y+1,P=new Int32Array(v*(b-p+1)).fill(-1);for(let w=p;w<=b;w++)for(let x=y;x<=g;x++)for(let S=0;S<Xe.tries;S++){let A=(x+ji(hn(x,w,t,10+S*2)))*u,M=(w+ji(hn(x,w,t,11+S*2)))*u;if(!Hh(e.points,A,M)||Gh(e.points,A,M)<i||e.holes?.some(k=>k.length>=3&&(Hh(k,A,M)||Gh(k,A,M)<i)))continue;let E=!0;for(let k=-1;k<=0&&E;k++)for(let _=-1;_<=1&&E&&!(k===0&&_>=0);_++){let R=x+_-y,C=w+k-p;if(R<0||R>=v||C<0)continue;let O=P[C*v+R];if(O<0)continue;let B=h[O].x-A,F=h[O].y-M;B*B+F*F<d&&(E=!1)}if(!E)continue;let T=m?kx(m,A,M):1;if(T<=0||T<1&&ji(hn(x,w,t,3))>=T)break;P[(w-p)*v+(x-y)]=h.length,h.push({x:A,y:M,i:x,j:w,order:hn(x,w,t,4),thinned:T<1});break}return h}function Fx(e,t,n=Xe.capDesktop){if(!(n>0)||!e.length)return null;let o=Math.max(64,Math.min(Xe.maxCellsPerArea,Math.floor(Xe.maxCellsPerVenue/e.length))),r=e.map((h,f)=>{let d=Ox(h,f,t,o);return d.sort((p,b)=>p.order-b.order||p.j-b.j||p.i-b.i),d.slice(0,Math.min(d.length,Math.floor(h.capacity)))}),i=r.reduce((h,f)=>h+f.length,0);if(!i)return null;let a=i>n?r.map(h=>h.slice(0,Math.floor(h.length*n/i))):r,s=a.reduce((h,f)=>h+f.length,0);if(!s)return null;let c={count:s,iPosition:new Float32Array(s*3),iFacing:new Float32Array(s*2),iHeight:new Float32Array(s),iTone:new Float32Array(s),iFloor:new Float32Array(s)},[l,u]=Xe.heightM,m=0;return a.forEach((h,f)=>{let d=e[f];for(let p of h){c.iPosition[m*3]=p.x*I,c.iPosition[m*3+1]=d.floorY,c.iPosition[m*3+2]=p.y*I;let b=ji(hn(p.i,p.j,f,5));c.iHeight[m]=l+b*(u-l)*(p.thinned?.5:1),c.iTone[m]=hn(p.i,p.j,f,9)%Xe.hairs*(Xe.clothes*Xe.skins)+hn(p.i,p.j,f,6)%Xe.clothes*Xe.skins+hn(p.i,p.j,f,7)%Xe.skins,c.iFloor[m]=d.floorIndex;let y=hn(p.i,p.j,f,8)&15,g=Bh[y][0],v=Bh[y][1];if(d.focal){let P=d.focal.x-p.x,w=d.focal.y-p.y,x=Math.sqrt(P*P+w*w);if(x>0){let[S,A]=Cx[y];g=(P*S-w*A)/x,v=(P*A+w*S)/x}}c.iFacing[m*2]=g,c.iFacing[m*2+1]=v,m++}}),c}function Wh(e,t,n){try{return Fx(e,t,n)}catch{return null}}var Os=.6,jh=3,Dx=.25,Nx=6;function Bx(e,t,n,o){let r=1/0;for(let i=0,a=o.length-1;i<o.length;a=i++){let s=o[a],c=o[i],l=c.x-s.x,u=c.y-s.y,m=t*u-n*l;if(Math.abs(m)<1e-12)continue;let h=((s.x-e.x)*u-(s.y-e.y)*l)/m,f=((s.x-e.x)*n-(s.y-e.y)*t)/m;h>1e-9&&f>=-1e-9&&f<=1+1e-9&&(r=Math.min(r,h))}return r}function Hx(e,t){if(Ye(t,e.x,e.y))return 0;let n=1/0;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],a=t[o],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c||1,u=Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/l));n=Math.min(n,Math.hypot(e.x-(i.x+u*s),e.y-(i.y+u*c)))}return n}function Xh(e,t){return new Map([...Fs(e,t)].map(([n,o])=>[n,o.toward]))}function Fs(e,t){let n=e.map(a=>({booth:a,ring:_t(a)})).filter(a=>!!a.ring&&a.ring.length===4&&!a.booth.points),o=n.map(({ring:a})=>({minX:Math.min(...a.map(s=>s.x)),maxX:Math.max(...a.map(s=>s.x)),minY:Math.min(...a.map(s=>s.y)),maxY:Math.max(...a.map(s=>s.y))})),r=(jh+Os)/I,i=new Map;return n.forEach(({booth:a,ring:s},c)=>{let l={x:s.reduce((d,p)=>d+p.x,0)/4,y:s.reduce((d,p)=>d+p.y,0)/4},u=[0,1,2,3].map(d=>{let p=s[d],b=s[(d+1)%4],y={x:(p.x+b.x)/2,y:(p.y+b.y)/2},g=y.x-l.x,v=y.y-l.y,P=Math.hypot(g,v)||1,w={x:y.x+g/P*Os/I,y:y.y+v/P*Os/I},x=jh/I;return o.forEach((S,A)=>{A===c||w.x<S.minX-r||w.x>S.maxX+r||w.y<S.minY-r||w.y>S.maxY+r||(x=Math.min(x,Hx(w,n[A].ring)))}),{open:x*I,toward:{x:y.x+g/P*10/I,y:y.y+v/P*10/I},focal:Math.hypot(y.x-t.x,y.y-t.y),normal:{x:g/P,y:v/P},halfDepthM:P*I,halfWidthM:Math.hypot(b.x-p.x,b.y-p.y)*I/2,mid:y}}),m=Math.max(...u.map(d=>d.open)),h=u.filter(d=>d.open>=m-Dx).sort((d,p)=>d.focal-p.focal)[0],f=Nx/I;n.forEach((d,p)=>{p!==c&&(f=Math.min(f,Bx(h.mid,h.normal.x,h.normal.y,d.ring)))}),i.set(a.id,{toward:h.toward,normal:h.normal,halfDepthM:h.halfDepthM,halfWidthM:h.halfWidthM,aisleM:f*I})}),i}var Kh=jt(require("polygon-clipping"),1);var Gx=.45,Vx=1500,zx=200;function Yh(e,t){if(e.role!=="stage"||Et(e.stageKind))return e;let n=Pe(e);if(!n||n.length<3||Math.abs(Rt(n))*I*I>Vx)return e;let o=t.filter(a=>Ye(n,a.x,a.y));if(!o.length||o.length>zx)return e;let r=Gx/I,i=o.map(a=>[[[a.x-r,a.y-r],[a.x+r,a.y-r],[a.x+r,a.y+r],[a.x-r,a.y+r],[a.x-r,a.y-r]]]);try{let a=Kh.default.difference([[...n.map(l=>[l.x,l.y]),[n[0].x,n[0].y]]],...i),s=null,c=0;for(let l of a){let u=l[0].slice(0,-1).map(([h,f])=>({x:h,y:f})),m=Math.abs(Rt(u));m>c&&(c=m,s=u)}return!s||s.length<3?e:{...e,kind:"polygon",points:s,rotation:0}}catch{return e}}var Ux=Math.PI/180,Ne=96,Wx=6,jx=60,Xx=150,$h=.2,Kx=.35;function Yx(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Ux;return n<0?n+360:n}function Ki(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function Yi(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%o+o)%o;else if(l<0||l>=o)continue;a+=e[l],s++}r[i]=a/s}return r}function Zh(e,t){let n=e.filter(h=>h.rows.length>=1);if(n.length<1)return null;let o=[],r=0,i=0,a=0;for(let h of n)for(let f of h.rows){for(let d of f.pts)r+=d.x,i+=d.y,a++;if(f.pts.length>=4){let d=os(f.pts);d&&Number.isFinite(d.cx)&&Number.isFinite(d.cy)&&o.push({x:d.cx,y:d.cy})}}if(!a)return null;let s={x:r/a,y:i/a},c=s;if(o.length>=8){let h=Ki(o.map(y=>y.x)),f=Ki(o.map(y=>y.y)),d=0;for(let y of n)for(let g of y.rows)for(let v of g.pts){let P=Math.hypot(v.x-s.x,v.y-s.y);P>d&&(d=P)}let p=0,b=d*.2;for(let y of n)for(let g of y.rows)for(let v of g.pts)Math.hypot(v.x-h,v.y-f)<b&&p++;Math.hypot(h-s.x,f-s.y)<=d&&p/a<.01&&(c={x:h,y:f})}let l=[];for(let h of n){let f={sectionId:h.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of h.rows)for(let p of d.pts){let b=Math.hypot(p.x-c.x,p.y-c.y),y=Math.min(Ne-1,Math.floor(Yx(c,p)/(360/Ne)));f.samples.push({r:b,bin:y,levelM:d.levelM}),b<f.rMin&&(f.rMin=b),b>f.rMax&&(f.rMax=b)}f.samples.length&&l.push(f)}if(!l.length)return null;l.sort((h,f)=>h.rMin+h.rMax-(f.rMin+f.rMax));let u=[];for(let h of l){let f=!1;for(let d of u){let p=Math.min(h.rMax,d.rMax)-Math.max(h.rMin,d.rMin),b=Math.min(h.rMax-h.rMin,d.rMax-d.rMin);if(b>1e-9&&p>=Kx*b){d.members.push(h),d.rMin=Math.min(d.rMin,h.rMin),d.rMax=Math.max(d.rMax,h.rMax),f=!0;break}}f||u.push({members:[h],rMin:h.rMin,rMax:h.rMax})}let m=[];for(let h of u){let f=new Array(Ne).fill(null);for(let _ of h.members)for(let R of _.samples){let C=f[R.bin];C||(C={samples:[]},f[R.bin]=C),C.samples.push({r:R.r,levelM:R.levelM})}let d=f.map(_=>!!_);if(!d.filter(Boolean).length)continue;let b=[],y=[];for(let _ of f){if(!_)continue;let R=1/0,C=-1/0;for(let O of _.samples)O.r<R&&(R=O.r),O.r>C&&(C=O.r);b.push(R),y.push(C)}let g=Ki(b),v=Ki(y);if(!(g>=$h*v)||!(v>0))continue;let P=[...b].sort((_,R)=>_-R);if(!(P[Math.floor(P.length*.1)]>=$h*v))continue;let x=f.map(_=>{if(!_)return null;let R=[..._.samples].sort((L,G)=>L.r-G.r),C=R[0].r,O=R[R.length-1].r,B=R[0].levelM,F=-1/0;for(let L of R)L.levelM>F&&(F=L.levelM);let N=[];for(let L of R){let G={r:L.r,l:L.levelM};for(;N.length&&Math.abs(N[N.length-1].r-G.r)<1e-9;){if(N[N.length-1].l<=G.l){G.skip=!0;break}N.pop()}if(!G.skip){for(;N.length>=2;){let j=N[N.length-2],D=N[N.length-1];if((D.r-j.r)*(G.l-j.l)-(D.l-j.l)*(G.r-j.r)<=0)N.pop();else break}N.push(G)}}let V=N.map(L=>L.r),H=N.map(L=>L.l);return{inner:C,outer:O,front:B,top:F,profile:{rs:V,ls:H}}}),S=d.slice();for(let _=0;_<Ne;_++){if(S[_])continue;let R=-1,C=-1,O=0;for(let U=1;U<=Ne;U++){let $=(_-U+Ne*2)%Ne;if(S[$]){R=$;break}}for(let U=1;U<=Ne;U++){let $=(_+U)%Ne;if(S[$]){C=$,O=U;break}}if(R<0||C<0)continue;let B=0;for(let U=1;U<=Ne;U++){let $=(_-U+Ne*2)%Ne;if(d[$]){B=U;break}}if(B-1+O>Wx)continue;let N=x[R],V=x[C],H=B/(B+O),L=N.inner+(V.inner-N.inner)*H,G=N.outer+(V.outer-N.outer)*H,j=N.front+(V.front-N.front)*H,D=N.top+(V.top-N.top)*H;x[_]={inner:L,outer:G,front:j,top:D,profile:{rs:[L,G],ls:[j,D]}}}for(let _=0;_<Ne;_++)x[_]&&(S[_]=!0);let A=360/Ne,M=[],E=S.filter(Boolean).length,T=[];if(E===Ne)T.push({start:0,len:Ne});else{let _=0;for(;S[_];)_=(_+1)%Ne;let R=-1;for(let C=0;C<=Ne;C++){let O=(_+C)%Ne,B=C<Ne&&S[O];if(B&&R<0)R=O;else if(!B&&R>=0){let F=(O-R+Ne)%Ne||Ne;T.push({start:R,len:F}),R=-1}}}for(let _ of T){if(_.len*A<jx&&_.len<Ne)continue;let R=_.len===Ne,C=new Float64Array(_.len),O=new Float64Array(_.len),B=new Float64Array(_.len),F=new Float64Array(_.len),N=[];for(let U=0;U<_.len;U++){let $=x[(_.start+U)%Ne];C[U]=$.inner,O[U]=$.outer,B[U]=$.front,F[U]=$.top,N.push($.profile??{rs:[$.inner,$.outer],ls:[$.front,$.top]})}let V=Yi(C,R),H=Yi(O,R),L=Yi(B,R),G=Yi(F,R);for(let U=0;U<_.len;U++)V[U]>C[U]&&(V[U]=C[U]),H[U]<O[U]&&(H[U]=O[U]),V[U]>H[U]-1e-6&&(V[U]=Math.max(0,H[U]-1e-6)),G[U]<L[U]&&(G[U]=L[U]);let j={startBin:_.start,binCount:_.len,closed:R,innerR:V,outerR:H,frontLevelM:L,topLevelM:G,profiles:N},D=(U,$,Z)=>{let te=N[U],X=te.rs,me=te.ls;if($<=X[0]){me[0]>Z&&(me[0]=Z);return}if($>=X[X.length-1]){me[me.length-1]>Z&&(me[me.length-1]=Z);return}for(let re=0;re+1<X.length;re++)if($<=X[re+1]){me[re]>Z&&(me[re]=Z),me[re+1]>Z&&(me[re+1]=Z);return}};for(let U=0;U<_.len;U++){let $=f[(_.start+U)%Ne];if($)for(let Z of $.samples){D(U,Z.r,Z.levelM);let te=R?(U-1+_.len)%_.len:U-1,X=R?(U+1)%_.len:U+1;te>=0&&D(te,Z.r,Z.levelM),X<_.len&&D(X,Z.r,Z.levelM)}}M.push(j)}M.reduce((_,R)=>_+R.binCount*A,0)<Xx||m.push({arcs:M,sectionIds:h.members.map(_=>_.sectionId),innerRMedian:g,outerRMedian:v})}if(!m.length)return null;if(m.sort((h,f)=>h.innerRMedian-f.innerRMedian),t){let h=m[m.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*h)return null}return{centre:c,binCount:Ne,binStepDeg:360/Ne,rings:m}}function qh(e,t,n,o){let r=e.binStepDeg,i=n/r-.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 m=t.profiles[u],h=m.rs,f=m.ls;if(o<=h[0])return f[0];if(o>=h[h.length-1])return f[f.length-1];for(let d=0;d+1<h.length;d++)if(o<=h[d+1]){let p=h[d+1]-h[d],b=p>1e-9?(o-h[d])/p:0;return f[d]+(f[d+1]-f[d])*b}return f[f.length-1]};return l(a)*(1-c)+l(s)*c}function Ds(e,t,n,o,r,i,a,s,c,l=[],u=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let m=(p,b,y)=>{mn(e,p,b,y,l,a,s,{portalBase:u,ao:c})||ue(e,p,void 0,()=>y,b,a,s,c)},h=(p,b,y)=>({x:p.x+(b.x-p.x)*y,y:p.y+(b.y-p.y)*y}),f=o?t.length:t.length-1,d=0;for(let p=0;p<f;p++){let b=(p+1)%t.length,y=Math.hypot(n[b].x-n[p].x,n[b].y-n[p].y)*Me;if(y<1e-5)continue;let g=(x,S)=>[h(t[p],t[b],x),h(t[p],t[b],S),h(n[p],n[b],S),h(n[p],n[b],x)];m(g(0,1),r,r+.95),m(g(0,1),i-.22,i);let v=Math.ceil((d-.32)/6)*6,P=!1,w=!1;for(let x=v;x<d+y;x+=6){let S=Math.max(0,(x-d)/y),A=Math.min(1,(x+.32-d)/y);A<=S||(m(g(S,A),r+.95,i-.22),P||=S<1e-6,w||=A>1-1e-6)}if(!o&&(p===0&&!P||p===f-1&&!w)){let x=Math.min(1,.32/y);m(g(p===0?0:1-x,p===0?x:1),r+.95,i-.22)}d+=y}}var Sn=jt(require("polygon-clipping"),1),Ar=.65;function Ns(e,t){let n=1/0;for(let o of t)for(let r=0;r<o.length;r++){let i=o[r],a=o[(r+1)%o.length],s=a.x-i.x,c=a.y-i.y,l=Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/(s*s+c*c||1)));n=Math.min(n,Math.hypot(e.x-i.x-l*s,e.y-i.y-l*c))}return n}var Bs=.01;function Qh(e,t,n,o,r,i,a,s=[],c=!0,l={bays:[],walls:[]}){if(o-r<=1e-5)return;let u=o-r>=3,m=u?o-Ar:r;e.setMaterial(5);let h=u?[]:s.filter(x=>{if(x.role!=="entrance"&&x.role!=="exit")return!1;let S=Pe(x);if(!S)return!1;let A=To(S,r,r+Gt(x).heightM);return A!==null&&A.openingTop<=o-.12});if((!h.length||!mn(e,t,m,o,h,i,a,{holes:n,portalBase:r}))&&ue(e,t,n,()=>o,m,i,a,se,void 0,()=>[0,1,0]),!u){e.setMaterial(0);return}let f=c&&l.bays.length?$x(t,n,Lt(t,Pr/I),l):null,d=6/I,p=.22/I,b=s.flatMap(x=>{if(x.role!=="entrance"&&x.role!=="exit")return[];let S=Pe(x);return S?.length?[{minX:Math.min(...S.map(A=>A.x)),maxX:Math.max(...S.map(A=>A.x)),minY:Math.min(...S.map(A=>A.y)),maxY:Math.max(...S.map(A=>A.y))}]:[]}),y=Math.min(...t.map(x=>x.x)),g=Math.max(...t.map(x=>x.x)),v=Math.min(...t.map(x=>x.y)),P=Math.max(...t.map(x=>x.y));for(let x=y+d/2;x<g;x+=d)for(let S=v+d/2;S<P;S+=d){if(b.some(M=>x+p>=M.minX&&x-p<=M.maxX&&S+p>=M.minY&&S-p<=M.maxY))continue;let A=[{x:x-p,y:S-p},{x:x+p,y:S-p},{x:x+p,y:S+p},{x:x-p,y:S+p}];!mt({x,y:S},t,n)||Ns({x,y:S},[t,...n??[]])<p*Math.SQRT2+(c?Pr/I:0)||f&&Ns({x,y:S},f.flat())<p*Math.SQRT2+Pr/I||ue(e,A,void 0,()=>m,r,i,a,se)}if(f){for(let[x,...S]of f)ue(e,x,S,()=>m,r-Bs,i,a,se);e.setMaterial(0);return}let w=Lt(t,Pr/I);if(c&&w.length>=3){let x=s.filter(M=>{if(M.role!=="entrance"&&M.role!=="exit")return!1;let E=Pe(M);return!!E&&E.some(T=>!mt(T,t,void 0)||Ns(T,[t])<=Pr/I)}),S=[w.slice().reverse()],A=r-Bs;(!x.length||!mn(e,t,A,m,x,i,a,{holes:S,portalBase:r+Bs}))&&ue(e,t,S,()=>m,A,i,a,se)}e.setMaterial(0)}var Hs=.25,Pr=Hs;function $x(e,t,n,o){if(n.length<3)return null;let r=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s},i=a=>{let[s,...c]=a.map(l=>[r(l)]);return Sn.default.union(s,...c)};try{let a=[r(e),...(t??[]).map(r)],s=Sn.default.difference(a,[r(n)]),c=Sn.default.intersection(a,i(o.bays));if(!c.length)return null;let l=Sn.default.difference(Sn.default.intersection(a,i(o.walls)),c);return Sn.default.union(Sn.default.difference(s,c),l).map(m=>m.map(h=>h.slice(0,-1).map(([f,d])=>({x:f,y:d}))))}catch{return null}}var Zx=.02,qx=.25,Qx=1.2,Jx=.6,eM=.45,tM=2.3,nM=Math.PI/180,Jh=.005;function Jt(e,t,n){let o=n*nM;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function oM(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let o=n.outerRMedian*.85;for(let r of e){if(r.role!=="wall")continue;let i=r.points&&r.points.length>=2?r.points:r.x!==void 0&&r.y!==void 0&&r.width!==void 0&&r.height!==void 0?[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height},{x:r.x,y:r.y+r.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)>=o&&a++;if(a>=i.length/2)return!0}return!1}var rM=24,iM=.01;function aM(e,t,n,o,r,i,a,s,c){let l=n.binCount,u=rM,m=Me,h=i+.02,f=i-iM,d=[];for(let R=0;R<l;R++){let C=(n.startBin+R+.5)*t.binStepDeg,O=new Float64Array(u+1);for(let B=0;B<=u;B++){let F=o[R]+(r[R]-o[R])*B/u;O[B]=Math.max(h,qh(t,n,C,F)-qx)}d.push(O)}if(c){let R=0;for(let C=0;C+1<l;C++)for(let O=0;O<u;O++){let B=Jt(t.centre,o[C]+(r[C]-o[C])*O/u,(n.startBin+C+.5)*t.binStepDeg),F=Jt(t.centre,o[C+1]+(r[C+1]-o[C+1])*(O+1)/u,(n.startBin+C+1.5)*t.binStepDeg);R=Math.max(R,Math.hypot(F.x-B.x,F.y-B.y))}for(let C=0;C<l;C++){let O=(n.startBin+C+.5)*t.binStepDeg;for(let B=0;B<=u;B++){let F=Jt(t.centre,o[C]+(r[C]-o[C])*B/u,O),N=c(F.x,F.y,R*1.01);N!==null&&(d[C][B]=Math.min(d[C][B],Math.max(f+Jh,N-Jh)))}}}let p=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],b=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],y=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],g=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],v=(R,C)=>{let O=(n.startBin+R+.5)*t.binStepDeg,B=o[R]+(r[R]-o[R])*C/u,F=Jt(t.centre,B,O);return[F.x*m,d[R][C],F.y*m]};{let R=Math.tan(12*Math.PI/180);for(let C=0;C<6;C++){let O=!1;for(let F=0;F<l;F++)for(let N=u-1;N>=0;N--)d[F][N]>d[F][N+1]&&(d[F][N]=d[F][N+1],O=!0);let B=n.closed?l:l-1;for(let F=0;F<B;F++){let N=(F+1)%l;for(let V=0;V<=u;V++){let H=d[N][V]-d[F][V];if(Math.abs(H)>1)continue;let L=o[F]+(r[F]-o[F])*V/u,G=o[N]+(r[N]-o[N])*V/u,j=Jt(t.centre,L,(n.startBin+F+.5)*t.binStepDeg),D=Jt(t.centre,G,(n.startBin+N+.5)*t.binStepDeg),U=R*Math.hypot(D.x-j.x,D.y-j.y)*m;H>U?(d[N][V]=d[F][V]+U,O=!0):-H>U&&(d[F][V]=d[N][V]+U,O=!0)}}if(!O)break}}let P=1,w=(R,C)=>{for(let O=0;O<=u;O+=4)if(Math.abs(d[R][O]-d[C][O])>P)return!0;return Math.abs(d[R][u]-d[C][u])>P},x=Math.tan(38*Math.PI/180),S=R=>(r[R]-o[R])/u*m,A=(R,C)=>d[R][C+1]-d[R][C]>x*Math.max(1e-6,S(R)),M=(R,C)=>{let O=n.closed?(R-1+l)%l:Math.max(0,R-1),B=n.closed?(R+1)%l:Math.min(l-1,R+1);Math.abs(d[O][C]-d[R][C])>P&&(O=R),Math.abs(d[B][C]-d[R][C])>P&&(B=R);let F=Math.max(0,C-1),N=Math.min(u,C+1);F<C&&A(R,F)&&(F=C),N>C&&A(R,C)&&(N=C);let V=v(O,C),H=v(B,C),L=v(R,F),G=v(R,N),j=H[0]-V[0],D=H[1]-V[1],U=H[2]-V[2],$=G[0]-L[0],Z=G[1]-L[1],te=G[2]-L[2],X=D*te-U*Z,me=U*$-j*te,re=j*Z-D*$,ce=Math.hypot(X,me,re);return ce>1e-12?(X/=ce,me/=ce,re/=ce,me<0&&(X=-X,me=-me,re=-re),[X,me,re]):[0,1,0]},E=(R,C,O=!1)=>{let B=O&&Math.min(R[1],C[1])-i>=3,F=[R[0],B?R[1]-Ar:f,R[2]],N=[C[0],B?C[1]-Ar:f,C[2]],V=C[0]-R[0],H=C[2]-R[2],L=Math.hypot(V,H);if(!(L>1e-12))return;let G=[H/L,0,-V/L];e.tri(R,C,N,G,y,y,g),e.tri(R,N,F,G,y,g,g)},T=.05*kt,k=R=>r[R]-o[R]<T,_=n.closed?l:l-1;for(let R=0;R<_;R++){let C=(R+1)%l;if(k(R)||k(C))continue;if(w(R,C)){let H=(n.startBin+R+1)*t.binStepDeg,L=(Z,te)=>{let X=(o[R]+o[C])/2,me=(r[R]+r[C])/2,re=X+(me-X)*te/u,ce=Jt(t.centre,re,H);return[ce.x*m,d[Z][te],ce.y*m]};for(let Z=0;Z<u;Z++){let te=v(R,Z),X=v(R,Z+1),me=L(R,Z),re=L(R,Z+1),ce=M(R,Z),J=M(R,Z+1);e.triN(te,me,re,ce,ce,J,p),e.triN(te,re,X,ce,J,J,p);let ae=v(C,Z),ie=v(C,Z+1),ge=L(C,Z),Ae=L(C,Z+1),be=M(C,Z),ke=M(C,Z+1);e.triN(ge,ae,ie,be,be,ke,p),e.triN(ge,ie,Ae,be,ke,ke,p);let Ke=L(R,Z),Be=L(R,Z+1),Fe=L(C,Z+1),Ge=L(C,Z),ne=Be[0]-Ke[0],W=Be[2]-Ke[2],K=Math.hypot(ne,W);if(K>1e-12){let Q=[W/K,0,-ne/K];e.tri(Ke,Be,Fe,Q,y),e.tri(Ke,Fe,Ge,Q,y)}}let G=v(R,0),j=v(C,0),D=v(C,u),U=v(R,u),$=Z=>[Z[0],f,Z[2]];Math.min(G[1],j[1])-i<3&&(e.tri($(G),$(D),$(j),[0,-1,0],b),e.tri($(G),$(U),$(D),[0,-1,0],b)),E(G,j,!0),E(U,D,!0);continue}for(let H=0;H<u;H++){let L=M(R,H),G=M(C,H),j=M(C,H+1),D=M(R,H+1);if(A(R,H)||A(C,H)){let X=(Be,Fe)=>{let Ge=(n.startBin+Be+.5)*t.binStepDeg,ne=o[Be]+(r[Be]-o[Be])*(H+.5)/u,W=Jt(t.centre,ne,Ge);return[W.x*m,Fe,W.y*m]},me=v(R,H),re=v(C,H),ce=X(R,d[R][H]),J=X(C,d[C][H]);e.triN(me,re,J,L,G,G,p),e.triN(me,J,ce,L,G,L,p);let ae=v(C,H+1),ie=v(R,H+1),ge=X(R,d[R][H+1]),Ae=X(C,d[C][H+1]);e.triN(ge,Ae,ae,D,j,j,p),e.triN(ge,ae,ie,D,j,D,p);let be=J[0]-ce[0],ke=J[2]-ce[2],Ke=Math.hypot(be,ke);if(Ke>1e-12){let Be=[-ke/Ke,0,be/Ke];e.tri(ce,J,Ae,Be,y),e.tri(ce,Ae,ge,Be,y)}continue}let U=v(R,H),$=v(C,H),Z=v(C,H+1),te=v(R,H+1);e.triN(U,$,Z,L,G,j,p),e.triN(U,Z,te,L,j,D,p)}let O=v(R,0),B=v(C,0),F=v(C,u),N=v(R,u),V=H=>[H[0],f,H[2]];Math.min(O[1],B[1])-i<3&&(e.tri(V(O),V(F),V(B),[0,-1,0],b),e.tri(V(O),V(N),V(F),[0,-1,0],b)),E(O,B,!0),E(N,F,!0)}if(!n.closed)for(let R of[0,l-1])for(let C=0;C<u;C++)E(v(R,C),v(R,C+1))}function ef(e,t,n){let{bottomY:o,colors:r,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let m of u.arcs){let h=new Float64Array(m.binCount),f=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let b=(m.startBin+p)%t.binCount,y=Math.max(0,m.innerR[p]-Ot);h[p]=Math.max(y,a[b]+.001),f[p]=Math.max(h[p]+.001,m.outerR[p]+Ot)}let d=0;for(let p=0;p<m.binCount;p++){let b=m.topLevelM[p]-o;b>d&&(d=b)}d>=Qx&&aM(e,t,m,h,f,o,r,i,n.standTopNear);for(let p=0;p<m.binCount;p++){let b=(m.startBin+p)%t.binCount;f[p]>a[b]&&(a[b]=f[p])}}if(n.deriveShell===!1||oM(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Jx*kt,l=eM*kt;for(let u of s.arcs){let m=[],h=[];for(let M=0;M<u.binCount;M++){let E=(u.startBin+M+.5)*t.binStepDeg,T=u.outerR[M]+Ot+c;m.push(Jt(t.centre,T,E)),h.push(Jt(t.centre,T+l,E))}let f=-1/0;for(let M=0;M<u.binCount;M++)u.topLevelM[M]>f&&(f=u.topLevelM[M]);let d=f+tM,p=u.closed?h:[...h,...m.slice().reverse()],b=u.closed?[m.slice().reverse()]:void 0,y=we(r.shellWall,[.66,.71,.72],.62),g=(M,E,T,k,_)=>{let R=Math.abs(k-f)<1e-6?k-Zx:k;mn(e,M,T,R,n.shapes,r.shellTop,_,{holes:E,portalBase:o,ao:i})||ue(e,M,E,()=>R,T,r.shellTop,_,i)},v=Math.max(1,Math.ceil((f-o)/4.5)),P=(f-o)/v,w=new Set,x=n.tierFrontLevels??t.rings.map(M=>{let E=M.arcs.flatMap(T=>Array.from(T.frontLevelM)).filter(Number.isFinite).sort((T,k)=>T-k);return E[Math.floor(E.length/2)]});for(let M of x)Number.isFinite(M)&&M-o>=3&&M<f&&w.add(Math.max(0,Math.min(v-1,Math.floor((M-o)/P))));let S=Math.min(...x.filter(M=>Number.isFinite(M)&&M-o>=3&&M<f));for(let M=0;M<v;M++)o+(M+1)*P<=S-Ar&&Number.isFinite(S)&&w.add(M);for(let M=0;M<v;M++){let E=o+(f-o)*M/v,T=o+(f-o)*(M+1)/v;w.has(M)&&T-E>=3.2?(g(p,b,E,E+.45,y),Ds(e,m,h,u.closed,E+.45,T-.16,r.shellTop,y,i,n.shapes,o)):g(p,b,E,T-.16,y),g(p,b,T-.16,T,oe(y,.62))}Ds(e,m,h,u.closed,f,d,r.shellTop,y,i,n.shapes,o);let A=8;for(let M=1;M<h.length;M++){if(A+=Math.hypot(h[M].x-h[M-1].x,h[M].y-h[M-1].y)*Me,A<8)continue;A=0;let E=h[M],T=h[M-1],k=E.x-T.x,_=E.y-T.y,R=Math.max(1,Math.hypot(k,_)),C=k/R*.16*kt,O=_/R*.16*kt,B=Math.max(1,Math.hypot(E.x-t.centre.x,E.y-t.centre.y)),F=(E.x-t.centre.x)/B*.24*kt,N=(E.y-t.centre.y)/B*.24*kt,V=[{x:E.x-C,y:E.y-O},{x:E.x+C,y:E.y+O},{x:E.x+C+F,y:E.y+O+N},{x:E.x-C+F,y:E.y-O+N}];g(V,void 0,o,f,oe(y,1.12))}}}var sM=2.5,tf=.65,cM=2,lM=.03;function uM(e,t){let n=()=>{let o=t;for(;e.length>2;){let r=e[0],i=e[1],a=Math.hypot(i.x-r.x,i.y-r.y);if(a>o){e[0]={x:r.x+(i.x-r.x)/a*o,y:r.y+(i.y-r.y)/a*o};return}o-=a,e.shift()}};n(),e.reverse(),n(),e.reverse()}function zs(e,t,n){let o=new Map;for(let i of e){let a=o.get(i.blockId);(!a||i.depth<a.depth)&&o.set(i.blockId,i)}let r=[];for(let[i,a]of o){if(a.y-n<sM||a.pts.length<2)continue;let s=a.pts.map(u=>{let m=u.x-t.x,h=u.y-t.y,f=Math.max(1,Math.hypot(m,h));return{x:u.x-m/f*tf/I,y:u.y-h/f*tf/I}}),c=[],l=[s[0]];for(let u=1;u<s.length;u++){let m=s[u-1],h=s[u];Math.hypot(h.x-m.x,h.y-m.y)*I>cM?(l.length>=2&&c.push(l),l=[h]):l.push(h)}l.length>=2&&c.push(l);for(let u of c)uM(u,lM/I);c.length&&r.push({blockId:i,y:a.y,runs:c})}return r}var nf=.1,mM=1.1,hM=.22,Gs=.95,Vs=.05,of=1.8;function rf(e,t,n,o){let r=[.72,.72,.69],i=[.48,.55,.57];for(let a of zs(t,n,o)){let s=a.y;for(let c of a.runs){let l=of;for(let u=1;u<c.length;u++){let m=c[u-1],h=c[u],f=h.x-m.x,d=h.y-m.y,p=Math.hypot(f,d);if(p<1e-5)continue;let b=y=>{let g=-d/p*y/I/2,v=f/p*y/I/2;return[{x:m.x+g,y:m.y+v},{x:h.x+g,y:h.y+v},{x:h.x-g,y:h.y-v},{x:m.x-g,y:m.y-v}]};if(ue(e,b(hM),void 0,()=>s+nf,s-mM,r,r,se),ue(e,b(Vs),void 0,()=>s+Gs,s+Gs-Vs,i,i,se),l+=p*I,l>=of||u===c.length-1){l=0;let y=.028/I,g=[{x:m.x-y,y:m.y-y},{x:m.x+y,y:m.y-y},{x:m.x+y,y:m.y+y},{x:m.x-y,y:m.y+y}];ue(e,g,void 0,()=>s+Gs-Vs,s+nf,i,i,se)}}}}}var fM=.9,dM=1.5,pM=.3;function af(e,t,n){let o=[],r=[],i=fM/I,a=dM/I,s=pM/I;for(let c of e)for(let l of c.runs){if(l.length<2)continue;let u=l.slice(),m=(b,y)=>{let g=u[b],v=u[y],P=Math.hypot(g.x-v.x,g.y-v.y)||1;u[b]={x:g.x+(g.x-v.x)/P*s,y:g.y+(g.y-v.y)/P*s}};m(0,1),m(u.length-1,u.length-2);let h=u.map((b,y)=>{let g=u[Math.max(0,y-1)],v=u[Math.min(u.length-1,y+1)],P=v.x-g.x,w=v.y-g.y,x=Math.hypot(P,w)||1,S=-w/x,A=P/x;return S*(b.x-t.x)+A*(b.y-t.y)<0&&(S=-S,A=-A),{nx:S,ny:A}}),f=u.map((b,y)=>({x:b.x-h[y].nx*a,y:b.y-h[y].ny*a})),d=u.map((b,y)=>({x:b.x+h[y].nx*i,y:b.y+h[y].ny*i})),p=u.map((b,y)=>({x:b.x+h[y].nx*(i+n/I),y:b.y+h[y].ny*(i+n/I)}));o.push([...f,...d.slice().reverse()]),r.push([...d,...p.reverse()])}return{bays:o,walls:r}}var Us=.88,$i=.27,bM=1.2,gM=.01,yM=7,xM=.05,MM=.25;function sf(e,t,n,o,r){let i=[.67,.71,.68],a=[i[0]*Us,i[1]*Us,i[2]*Us],s=c=>!!r&&r.some((l,u)=>u!==c&&l?.belowY!=null&&Math.abs(l.belowY-t[c].y)<1e-6&&t[u].blockId===t[c].blockId);for(let c=0;c<t.length;c++){let l=t[c];if(!(l.pts.length<2))for(let u of[0,l.pts.length-1]){let m=l.pts[u],h=l.pts[u===0?1:u-1],f=m.x-h.x,d=m.y-h.y,p=Math.hypot(f,d);if(p<1e-5)continue;f/=p,d/=p;let b=1/0;for(let C=0;C<n.length;C++){let O=n[C],B=n[(C+1)%n.length],F=B.x-O.x,N=B.y-O.y,V=f*N-d*F;if(Math.abs(V)<1e-8)continue;let H=O.x-m.x,L=O.y-m.y,G=(H*N-L*F)/V,j=(H*d-L*f)/V;G>0&&j>=0&&j<=1&&(b=Math.min(b,G))}let y=.3/I,g=b-.04/I;if(!Number.isFinite(b)||b*I>2||g-y<.12/I)continue;let v=!!o&&s(c),P=r?.[c]?.pitch,w=v&&P&&Number.isFinite(P)?Math.min(bM/I,Math.max($i/I,P-$i/I-gM/I)):$i/I,x=-d,S=f;o&&x*(o.x-m.x)+S*(o.y-m.y)<0&&(x=-x,S=-S);let A=$i/I,M=[{x:m.x+f*y+x*A,y:m.y+d*y+S*A},{x:m.x+f*g+x*A,y:m.y+d*g+S*A},{x:m.x+f*g-x*w,y:m.y+d*g-S*w},{x:m.x+f*y-x*w,y:m.y+d*y-S*w}];if(!M.every(C=>Ye(n,C.x,C.y)))continue;let E=r?.[c]?.belowY,T=E==null?0:l.y-E,k=!!o&&T>.03&&T<=.65;if(k&&o){let C=(O,B)=>Math.hypot((O.x+B.x)/2-o.x,(O.y+B.y)/2-o.y);C(M[0],M[1])>C(M[3],M[2])&&(M=[M[3],M[2],M[1],M[0]])}let _=k?Math.ceil((T-1e-8)/.2):1,R=(C,O,B)=>({x:C.x+(O.x-C.x)*B,y:C.y+(O.y-C.y)*B});for(let C=0;C<_;C++){let O=C/_,B=(C+1)/_,F=[R(M[0],M[3],O),R(M[1],M[2],O),R(M[1],M[2],B),R(M[0],M[3],B)],N=l.y+.008-(k?T*(1-B):0);if(ue(e,F,void 0,()=>N,N-(k?T/_+.1:.16),i,a,se),!k)continue;let V=Math.hypot(F[3].x-F[0].x,F[3].y-F[0].y)*I;if(V<1e-4)continue;let H=Math.min(xM/V,MM),L=R(F[0],F[3],H),G=R(F[1],F[2],H),j=U=>[U.x*I,N+.004,U.y*I],D=[.8,.67,.3];e.setMaterial(yM),e.tri(j(F[0]),j(F[1]),j(G),[0,1,0],D),e.tri(j(F[0]),j(G),j(L),[0,1,0],D),e.setMaterial(0)}}}}var vM=.02,SM=.012,wM=.01,PM=.3,AM=.5;function RM(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],a=e[r+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=Math.max(0,Math.min(1,u)),o=Math.min(o,Math.hypot(t-(i.x+u*s),n-(i.y+u*c)))}return o}function EM(e,t,n,o){let r=1/0,i=Number.NaN;for(let a=0;a<e.length;a++){let s=t[a];if(Math.hypot(n-s.cx,o-s.cy)-s.rad>=r)continue;let c=RM(e[a].pts,n,o);c<r&&(r=c,i=e[a].y)}return i}function cf(e,t,n,o,r,i,a){let s=o.filter(h=>h.pts.length>0);if(s.length<2||t.length<3)return;let c=s.map(h=>{let f=0,d=0;for(let b of h.pts)f+=b.x,d+=b.y;f/=h.pts.length,d/=h.pts.length;let p=0;for(let b of h.pts)p=Math.max(p,Math.hypot(b.x-f,b.y-d));return{cx:f,cy:d,rad:p}}),l=[...t],u=n.map(h=>[...h]),m=vM/I;for(let h of[l,...u])for(let f=0;f<h.length;f++){let d=h[f],p=h[(f+1)%h.length],b=p.x-d.x,y=p.y-d.y,g=Math.hypot(b,y);if(g*I<.05)continue;let v=(d.x+p.x)/2,P=(d.y+p.y)/2,w=y/g,x=-b/g;mt({x:v+w*m,y:P+x*m},l,u)&&(w=-w,x=-x);let S=r.x-v,A=r.y-P,M=Math.hypot(S,A)||1;if((w*S+x*A)/M>AM)continue;let E=1/0;for(let F of[.2,.5,.8]){let N=EM(s,c,d.x+b*F-w*m*2,d.y+y*F-x*m*2);Number.isFinite(N)&&(E=Math.min(E,N))}if(!Number.isFinite(E)||E-i<PM)continue;let T=i-wM,k=E-SM,_={x:(d.x-w*m)*I,z:(d.y-x*m)*I},R={x:(p.x-w*m)*I,z:(p.y-x*m)*I},C=[w,0,x],O=oe(a,se.wallBottom),B=oe(a,se.top);e.tri([_.x,k,_.z],[R.x,k,R.z],[R.x,T,R.z],C,B,B,O),e.tri([_.x,k,_.z],[R.x,T,R.z],[_.x,T,_.z],C,B,O,O)}}function lf(e,t,n,o,r,i,a,s,c=!1){if(!t.outline||t.outline.length<3)return;let l=n.baseHeightM,u=n.objects.filter(g=>g.type==="shape"&&(g.role==="entrance"||g.role==="exit")),m=Yu(o,s.tierTop);if(!r)return;let h=g=>r.deckAt(g.x,g.y),f=um(t,a),d=f[0]??t.outline;if(r.rowLevels.length>=2){let g=xi(r.rowLevels),v=mm(am(r.rowLevels,n.focal,g),f),P=af(zs(r.rowLevels,n.focal,l),n.focal,Hs);for(let x of v){let S=Math.max(l,x.topY-uf);for(let A of i.subtract(x.outline,S))Qh(e,A,x.holes,S,l,s.tierTop,s.tierWall,u,!c,P);e.setMaterial(5),cf(e,x.outline,x.holes,r.rowLevels,n.focal,S,s.tierWall),e.setMaterial(0)}v.length||ue(e,d,t.holes,()=>r.landingY,l,m,s.tierWall,se);let w={tread:[m[0]*se.top,m[1]*se.top,m[2]*se.top],riser:[m[0]*.72,m[1]*.72,m[2]*.72]};for(let x of f.length?f:[d])cm(e,r.rowLevels,n.focal,r.landingY,w,x,g);rf(e,r.rowLevels,n.focal,l),sf(e,r.rowLevels,t.outline,n.focal,g);return}let p=r.flat?1/0:yh,b=g=>r.normalAt(g.x,g.y),y=r.flat?r.landingY:void 0;for(let g of i.subtract(d,y))ue(e,g,t.holes,h,l,m,s.tierWall,se,p,b)}function IM(e,t,n){let o=new Set;for(let a of e.objects)a.type==="section"&&o.add(a.id);let r=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!o.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a];if(l.kind==="booth")continue;let u=r.get(s);u||(u=new Map,r.set(s,u));let m=l.rowId||`__seat-${a}`,h=u.get(m);h||(h={pts:[],levelM:0,n:0},u.set(m,h)),h.pts.push({x:l.x,y:l.y}),h.levelM+=n.seatDeckY(a),h.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=r.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 _M(e,t){let n=1/0;for(let o=0;o<t.length;o++){let r=t[o],i=t[(o+1)%t.length],a=i.x-r.x,s=i.y-r.y,c=Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/(a*a+s*s||1)));n=Math.min(n,Math.hypot(e.x-r.x-c*a,e.y-r.y-c*s))}return n}var uf=.02;function CM(e,t){let n=e.objects.filter(o=>o.type==="section"&&!!o.outline&&o.outline.length>=3).flatMap(o=>{let r=t.bySection.get(o.id);if(!r)return[];let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let u of o.outline)u.x<i&&(i=u.x),u.x>a&&(a=u.x),u.y<s&&(s=u.y),u.y>c&&(c=u.y);let l=r.landingY;for(let u of r.rowLevels)l=Math.min(l,u.y-uf);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:l,minX:i,maxX:a,minY:s,maxY:c}]});return(o,r,i)=>{let a=null;for(let s of n){if(o<s.minX-i||o>s.maxX+i||r<s.minY-i||r>s.maxY+i)continue;let c={x:o,y:r};if(!mt(c,s.outline,s.holes)&&_M(c,s.outline)>i)continue;let l=Math.min(s.surface.deckAt(o,r),s.floorTop);(a===null||l<a)&&(a=l)}return a}}var TM=3,kM=.4;function mf(e,t,n,o,r,i,a=!0){let s=IM(t,n,o);if(s.length<TM)return;let c=Zh(s,t.focal);if(!c)return;let l=Math.max(0,...c.rings.map(u=>u.arcs.reduce((m,h)=>m+h.binCount,0)))/c.binCount;e.setMaterial(5),ef(e,c,{bottomY:t.baseHeightM,tierFrontLevels:s.map(u=>Math.min(...u.rows.map(m=>m.levelM))),colors:{bandTop:oe(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??oe(r.tierWall,1.15),shellWall:i??r.tierWall},ao:se,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:a&&l>=kM,standTopNear:CM(t,o)}),e.setMaterial(0)}var hf=4;var LM=[[/\b(wc|toilets?|restrooms?|washrooms?|lavatory|loo)\b/i,"restroom"],[/\b(bar|drinks|pub|cocktails?)\b/i,"bar"],[/\b(food|concessions?|snacks?|kiosk|caf[eé]|kitchen|catering)\b/i,"concession"],[/\b(coat ?check|cloak ?room|cloakroom|coats)\b/i,"coat"],[/\b(screen|led wall|projection|video wall)\b/i,"screen"],[/\b(sound|foh|mixing desk|control booth)\b/i,"sound"],[/\b(entrance|entry|way in|gate)\b/i,"entrance"],[/\b(exit|way out)\b/i,"exit"],[/\b(pillar|column|obstruction)\b/i,"obstruction"],[/\b(walls?|outline|boundary|perimeter)\b/i,"wall"]],OM=1.2,FM=12;function ff(e){if(e.heightM!==void 0)return!1;let t=Pe(e);if(!t||t.length<3)return!1;let n=0;for(let r=0;r<t.length;r++){let i=t[r],a=t[(r+1)%t.length];n+=Math.hypot(a.x-i.x,a.y-i.y)}return n*Me<FM*2?!1:2*Rr(t)/n*Me<=OM}function Ws(e){if(!e)return null;for(let[t,n]of LM)if(t.test(e))return n;return null}var pf="auto-rows-";function bf(e){return e.id.startsWith(pf)&&!e.label}var DM=1.15,NM=.09,gf=6,BM=34,HM=.35,GM=6,VM=.35,zM=.75,UM=12,WM=2.5,jM=40,XM=[18,24],KM=[12,16],df=14,YM=.8,$M=.6,ZM=5,qM=.3,yf=.4,xf=2,QM=400,JM=2.6,ev=.8,tv=4,nv=26,ov=.7,rv=.5,iv=.985,av=1.5,sv=2.2,cv=3,lv=25,uv=.985,mv=2,hv=6,fv=3,dv=.1,pv=1.5,bv=1.6,gv=6e3,yv=.6,xv="#c3c7cd",js=300,Mv=240;function vv(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=Ks([...t]),i=new Set;for(let u of o)i.add(Math.floor(Math.atan2(u.y-r.y,u.x-r.x)*180/Math.PI/10));if(i.size*10<Mv)return null;let{h:a,s,l:c}=fl(ml(e.fill));return a<70/360||a>170/360||s<.2||c<.08||c>.75||n.some(u=>u!==e&&u.type==="shape"&&Pe(u)?.some(m=>Zs(m,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var Sv="Estimated from the drawing; confirm with the venue.",Ys=e=>{if(!e.length)return null;let t=[...e].sort((o,r)=>o-r),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2},Ks=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),Rr=e=>{let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2};function wv(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function $s(e){let t=new Map;for(let n of e){let o=t.get(n.rowId);o?o.push(n):t.set(n.rowId,[n])}return t}function Zs(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function qs(e,t){let n=t[0],o=1/0;for(let r=0;r<t.length;r++){let i=t[r],a=t[(r+1)%t.length],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>0?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/l)):0,m={x:i.x+s*u,y:i.y+c*u},h=Math.hypot(e.x-m.x,e.y-m.y);h<o&&(o=h,n=m)}return n}function Mf(e,t){let n=0,o=0;for(let r of e.values()){if(r.length<3)continue;let i=r[0],a=r[r.length-1],s=a.x-i.x,c=a.y-i.y,l=Math.hypot(s,c);if(l<1e-6)continue;let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=qs(u,t),h=m.x-u.x,f=m.y-u.y,d=Math.hypot(h,f);d<1e-6||(o+=Math.abs((-c*h+s*f)/(l*d))*r.length,n+=r.length)}return n?o/n:0}function Pv(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=Pe(r);return p?{shape:r,centre:Ks(p),outline:p,inferred:!1}:null}if(!n.length)return null;let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let p of n)i=Math.min(i,p.x),a=Math.max(a,p.x),s=Math.min(s,p.y),c=Math.max(c,p.y);let l=(a-i)*(c-s),u=[];for(let p of o){if(p.role)continue;let b=Pe(p);if(!b)continue;let y=Rr(b);if(y*Me*Me<6||y>l)continue;let g=Math.min(...b.map(M=>M.x)),v=Math.max(...b.map(M=>M.x)),P=Math.min(...b.map(M=>M.y)),w=Math.max(...b.map(M=>M.y)),x=0;for(let M of n)M.x>g&&M.x<v&&M.y>P&&M.y<w&&Zs(M,b)&&x++;if(x>n.length*.05)continue;let S=Ks(b),A=Mf(t,b);A>=YM&&u.push({shape:p,centre:S,outline:b,score:A,area:y,box:[g,P,v,w]})}let m=(p,b)=>b!==p&&b.area>p.area&&p.box[0]>=b.box[0]-1e-6&&p.box[1]>=b.box[1]-1e-6&&p.box[2]<=b.box[2]+1e-6&&p.box[3]<=b.box[3]+1e-6,h=u.filter(p=>!u.some(b=>m(p,b))),f=Math.max(0,...h.map(p=>p.score)),d=h.filter(p=>p.score>=f-.03).sort((p,b)=>b.area-p.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function Av(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=qs(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function vf(e){return e.length<3?[...e].sort((t,n)=>t.x-n.x||t.y-n.y):bo(e)}function Rv(e){if(!e.length||e.length>gv)return[];let t=[...$s(e).values()],n=t.map((s,c)=>c),o=s=>n[s]===s?s:n[s]=o(n[s]),r=bv/Me,i=t.map(s=>({minX:Math.min(...s.map(c=>c.x))-r,maxX:Math.max(...s.map(c=>c.x))+r,minY:Math.min(...s.map(c=>c.y))-r,maxY:Math.max(...s.map(c=>c.y))+r}));for(let s=0;s<t.length;s++)for(let c=s+1;c<t.length;c++){let l=i[s],u=i[c];if(l.maxX<u.minX||u.maxX<l.minX||l.maxY<u.minY||u.maxY<l.minY)continue;t[s].some(h=>t[c].some(f=>Math.hypot(h.x-f.x,h.y-f.y)<=r))&&(n[o(s)]=o(c))}let a=new Map;return t.forEach((s,c)=>{let l=o(c),u=a.get(l);u?u.push(...s):a.set(l,[...s])}),[...a.values()].filter(s=>new Set(s.map(c=>c.rowId)).size>=2)}function Ev(e,t,n){if(!t.length)return null;let o=t.filter(A=>n.tableIds.has(A.rowId)||A.kind==="booth").length>t.length/2,r=$s(t),i=!n.outline||Mf(r,n.outline)>=$M,a=0,s=0;for(let A of r.values()){if(A.length<2)continue;let M=A[0],E=A[A.length-1],T=E.x-M.x,k=E.y-M.y,_=Math.hypot(T,k);if(_<1e-6)continue;let R={x:(M.x+E.x)/2,y:(M.y+E.y)/2},C=i?n.outline?qs(R,n.outline):n.focal:n.middle,O=-k/_,B=T/_;O*(C.x-R.x)+B*(C.y-R.y)<0&&(O=-O,B=-B),a+=O*A.length,s+=B*A.length}let c={x:t.reduce((A,M)=>A+M.x,0)/t.length,y:t.reduce((A,M)=>A+M.y,0)/t.length};if(Math.hypot(a,s)<1e-9){let A=i?n.focal:n.middle;a=A.x-c.x,s=A.y-c.y}let l=Math.hypot(a,s)||1,u={x:a/l,y:s/l},m=A=>-(A.x*u.x+A.y*u.y),h=A=>-A.x*u.y+A.y*u.x,f=1/0,d=-1/0,p=1/0,b=-1/0,y=1/0,g=new Map;for(let A of t){let M=m(A),E=h(A);f=Math.min(f,M),d=Math.max(d,M),p=Math.min(p,E),b=Math.max(b,E),i&&(y=Math.min(y,Av(A,n.focal,n.outline)));let T=A.logicalRowId??A.rowId,k=g.get(T);k?k.push(M):g.set(T,[M])}i||(y=Math.max(0,f-m(n.middle)));let v=[...g.values()].map(A=>Ys(A)).sort((A,M)=>A-M),P=[];if(!o)for(let A of v)P.length&&A-P[P.length-1]<VM/Me||P.push(A);let w=wv(e),x=bn(e,{floorBaseHeightM:n.baseHeightM}),S={id:e.id,section:e,authored:w,plane:n,facing:u,facesAction:i,hull:vf(t),sample:t.filter((A,M)=>M%Math.ceil(t.length/QM)===0),frontD:f,backD:d,latMin:p,latMax:b,frontDistance:y,rowDepths:P,rowCount:P.length,level:0,height:x.height,rake:w?x.rake:0,backHeight:0};return S.backHeight=S.height+(d-f)*Me*Math.tan(S.rake*Math.PI/180),S}function Iv(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*Me),i=n+DM-o,a=0,s=0;for(let l=1;l<e.length;l++){let u=Math.max(zM,(e[l]-e[l-1])*Me),m=(i+NM)*(r+u)/r;a+=m-i,s+=u,i=m,r+=u}let c=Math.atan(a/s)*180/Math.PI;return Math.round(Math.max(gf,Math.min(BM,c))*10)/10}function _v(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<qM)return null;let o=-1/0,r=1/0,i=-1/0;for(let h of t.hull){o=Math.max(o,-(h.x*e.facing.x+h.y*e.facing.y));let f=-h.x*e.facing.y+h.y*e.facing.x;r=Math.min(r,f),i=Math.max(i,f)}if(Math.min(e.latMax,i)-Math.max(e.latMin,r)<(n?1e-6:yf*(e.latMax-e.latMin)))return null;let s=xf/Me,c=new Map,l=new Map;for(let h of e.sample){let f=Math.floor((-h.x*e.facing.y+h.y*e.facing.x)/s),d=-(h.x*e.facing.x+h.y*e.facing.y);c.set(f,Math.min(c.get(f)??1/0,d))}for(let h of t.sample){let f=Math.floor((-h.x*e.facing.y+h.y*e.facing.x)/s),d=-(h.x*e.facing.x+h.y*e.facing.y);l.set(f,Math.max(l.get(f)??-1/0,d))}let u=[];for(let[h,f]of c){let d=l.get(h);d!==void 0&&u.push(f-d)}let m=u.length?Ys(u):e.frontD-o;return m<-1/Me?null:m}function Cv(e,t){if(t.plane.floorIndex>=e.plane.floorIndex)return!1;let n=-1/0,o=1/0,r=1/0,i=-1/0;for(let c of t.hull){let l=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,l),o=Math.min(o,l);let u=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,u),i=Math.max(i,u)}let a=Math.min(e.latMax,i)-Math.max(e.latMin,r),s=Math.min(e.backD,n)-Math.max(e.frontD,o);return a>yf*(e.latMax-e.latMin)&&s>1/Me}function Tv(e,t){let n=new Set;for(let o of e){let r=(Math.atan2(o.y-t.y,o.x-t.x)*180/Math.PI+360)%360;n.add(Math.floor(r/10))}return n.size/36}function kv(e,t){let n=1/0,o=-1/0;for(let i of t.hull){let a=-(i.x*e.facing.x+i.y*e.facing.y);n=Math.min(n,a),o=Math.max(o,a)}let r=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+r*Me*Math.tan(t.rake*Math.PI/180)}function Lv(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=xf/Me,r=Math.max(1,Math.ceil((e.backD-e.frontD)/o)),i={left:new Map,right:new Map};for(let s of t)if(!(s===e||s.plane.floorIndex!==e.plane.floorIndex)&&!(s.facing.x*e.facing.x+s.facing.y*e.facing.y>=iv))for(let c of s.sample){let l=-(c.x*e.facing.x+c.y*e.facing.y);if(l<e.frontD||l>e.backD)continue;let u=-c.x*e.facing.y+c.y*e.facing.x,m=u<e.latMin?"left":u>e.latMax?"right":null;if(!m)return!1;let h=Math.min(r-1,Math.floor((l-e.frontD)/o)),f=m==="left"?e.latMin-u:u-e.latMax;f<(i[m].get(h)?.gap??1/0)&&i[m].set(h,{gap:f,other:s})}let a=s=>{let c=s==="left"?e.latMin:e.latMax,l=0;for(let[u,{other:m}]of i[s]){if((m.facing.x*n.x+m.facing.y*n.y)*(s==="left"?1:-1)<ov)continue;let f=e.frontD+(u+.5)*o,d={x:-f*e.facing.x+c*n.x,y:-f*e.facing.y+c*n.y},p=-(d.x*m.facing.x+d.y*m.facing.y),b=-d.x*m.facing.y+d.y*m.facing.x;p<m.frontD&&b>=m.latMin&&b<=m.latMax&&l++}return l/r>=rv};return a("left")&&a("right")}function Ov(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<uv)return!1;let n=1/0,o=-1/0,r=1/0;for(let s of t.hull){let c=-s.x*e.facing.y+s.y*e.facing.x;n=Math.min(n,c),o=Math.max(o,c),r=Math.min(r,-(s.x*e.facing.x+s.y*e.facing.y))}let i=(e.frontD-r)*Me;if(i<-mv||i>hv)return!1;let a=Math.max(n-e.latMax,e.latMin-o);return a*Me<=fv&&a*Me>=-dv}function Fv(e,t=!1,n=!1,o){let r=t?KM:XM,i=new Set(n?[]:e.filter(p=>!p.authored&&Lv(p,e))),a=[...e].sort((p,b)=>p.plane.floorIndex-b.plane.floorIndex||Number(i.has(b))-Number(i.has(p))||p.frontDistance-b.frontDistance);for(let p of i)o?.add(p.id);let s=(p,b,y)=>{let g=new Map,v=[],P=new Map,w=x=>{if(x.plane.floorIndex===0||x.plane.baseHeightM>0)return x.plane.baseHeightM;let S=P.get(x.plane.floorIndex-1);return S===void 0?x.plane.baseHeightM:S+hf};for(let x of a){if(i.has(x))x.height=w(x),x.level=0,x.rake=0,x.backHeight=x.height,g.set(x.id,void 0);else if(!x.authored){let A=w(x),M;for(let R of v){if(R.plane.floorIndex>x.plane.floorIndex)continue;if(Cv(x,R)){let F=kv(x,R)+JM;F>A&&(A=F,M=R);continue}let C=_v(x,R,i.has(R));if(C==null)continue;let O=n&&!!x.plane.stageDeck&&R.level===0&&R.plane.floorIndex===x.plane.floorIndex&&Math.max(0,C)*Me<=tv,B=i.has(R)?R.height+av:O?R.backHeight:R.backHeight+HM+Math.min(GM,Math.max(0,C)*Me)*Math.tan(R.rake*Math.PI/180);B>A&&(A=B,M=R)}let E=p.get(x);E&&E.height>A+.01?(A=E.height,M=void 0):E=void 0,x.height=Math.round(Math.min(A,x.plane.baseHeightM+jM)*100)/100;let T=!M&&!E&&x.height>x.plane.baseHeightM;if(x.level=M?M.level+1:E?E.level:T?1:0,x.rake=Iv(x.rowDepths,x.frontDistance,x.height,x.plane.focalHeightM),!x.facesAction&&x.rowCount<ZM)x.rake=0;else if(x.level===0){let R=Math.max(1e-6,(x.backD-x.frontD)*Me);x.rake=Math.min(x.rake,UM,Math.round(Math.atan(WM/R)*1800/Math.PI)/10)}else x.rowCount>=2&&(x.rake=Math.max(x.rake,r[Math.min(x.level,r.length)-1]));let k=(x.backD-x.frontD)*Me,_=M&&i.has(M)||E&&y?.has(E.id);if(b!==void 0&&_&&x.rowCount>=2&&(x.rake=b),t&&k>0&&x.height+k*Math.tan(x.rake*Math.PI/180)>x.plane.baseHeightM+df){let R=Math.max(0,x.plane.baseHeightM+df-x.height);x.rake=Math.max(gf,Math.round(Math.atan(R/k)*1800/Math.PI)/10)}n&&x.plane.stageDeck&&x.level>0&&(x.rake=Math.min(x.rake,nv)),x.backHeight=x.height+k*Math.tan(x.rake*Math.PI/180),g.set(x.id,M?.id??(E?g.get(E.id):void 0))}let S=x.plane.floorIndex;P.set(S,Math.min(P.get(S)??1/0,x.height)),v.push(x)}return g},c=s(new Map),l=new Map,u=p=>l.get(p)?.height??p.height;for(let p=!0,b=0;p&&b<e.length;b++){p=!1;for(let y of e)if(!(y.authored||i.has(y)))for(let g of e){let v=l.get(g)??g;g===y||v.height-v.plane.baseHeightM<pv||v.height<=u(y)+.01||Ov(y,g)&&(l.set(y,v),p=!0)}}let m=new Map(e.map(p=>[p.id,p])),h=e.filter(p=>!p.authored&&p.rowCount>=2&&i.has(m.get(c.get(p.id)??""))),f=h.length?Ys(h.map(p=>p.rake)):void 0;if(!l.size&&f===void 0)return c;let d=new Map([...new Set(l.values())].map(p=>[p,{...p}]));return s(new Map([...l].map(([p,b])=>[p,d.get(b)])),f,new Set(h.map(p=>p.id)))}var Xs=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function Zi(e,t={x:0,y:-40}){let n=fo(e),o=new Map;for(let y of n){if(!y.sectionId)continue;let g=o.get(y.sectionId);g?g.push(y):o.set(y.sectionId,[y])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((y,g)=>({objects:y.objects,floorIndex:g,floorId:y.id,baseHeightM:y.baseHeightM??0,focal:y.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],a=new Set(i.flatMap(y=>y.objects.filter(g=>g.type==="table").map(g=>g.id))),s=[],c,l=new Set,u=i.map(y=>{let g=_=>!e.floors?.length||_.floorId===y.floorId,v=Rv(n.filter(_=>!_.sectionId&&_.kind!=="booth"&&!a.has(_.rowId)&&g(_))),P=[];for(let _ of v){let R=Zt($t(vf(_)),yv/Me);if(n.some(O=>!g(O)&&Zs(O,R)))continue;let C=`${pf}${y.floorIndex}-${P.length}`;l.add(C),o.set(C,_),P.push({type:"section",id:C,label:"",color:xv,outline:R})}let w=P.length?{...y,objects:[...y.objects,...P]}:y,x=new Set(w.objects.filter(_=>_.type==="section").map(_=>_.logicalSectionId??_.id)),S=[...o.entries()].filter(([_])=>x.has(_)).flatMap(([,_])=>_),A=Pv(w.objects,$s(S),S),M=w.focal;(A||w.focal&&!Xs(w.focal,t))&&(r.confident=!0),A&&(r.stage??={id:A.shape.id,inferred:A.inferred,...w.floorId?{floorId:w.floorId}:{}},(A.inferred||Xs(w.focal,t))&&(M=A.centre,r.focalInferred=!0));let E=A&&(!A.inferred||Rr(A.outline)*Me*Me<=js),T=A?void 0:c,k={tableIds:a,floorIndex:w.floorIndex,floorId:w.floorId,baseHeightM:w.baseHeightM,focal:T?.focal??M,outline:A?.outline??T?.outline,focalHeightM:T?.focalHeightM??w.baseHeightM+(A&&E?Gt({...A.shape,role:"stage"}).heightM:0),stageDeck:T?.stageDeck??!!(A&&E&&Rr(A.outline)*Me*Me<=js),middle:S.length?{x:S.reduce((_,R)=>_+R.x,0)/S.length,y:S.reduce((_,R)=>_+R.y,0)/S.length}:M};for(let _ of w.objects){if(_.type!=="section")continue;let R=Ev(_,o.get(_.logicalSectionId??_.id)??[],k);R&&s.push(R)}return k.outline&&(c=k),Xs(w.focal,k.focal)||(r.focal??=[]).push({...w.floorId?{floorId:w.floorId}:{},point:{...k.focal}}),{unit:w,plane:k,stage:A,planeSeats:S}}),m=i.flatMap(y=>y.objects).map(y=>y.type==="shape"&&!y.role&&(Ws(y.label)==="wall"||!Ws(y.label)&&ff(y))?{...y,role:"wall"}:y),h=Mn({objects:m},n)!==null;h&&(r.indoor=!0);let f=new Set,d=Fv(s,h,Tv(n,u[0]?.plane.focal??t)<ev,f),p=new Map(s.filter(y=>!y.authored).map(y=>[y.id,y])),b=u.map(({unit:y,plane:g,stage:v,planeSeats:P})=>y.objects.map(w=>{let x=w.type==="shape"&&!w.role&&w.id!==v?.shape.id?Ws(w.label):null;if(w.type==="shape"&&!w.role&&w.id!==v?.shape.id&&(x==="wall"||!x&&ff(w))&&w.type==="shape"){(r.roles??=[]).push({id:w.id,...g.floorId?{floorId:g.floorId}:{},role:"wall"});let{fill:R,...C}=w;return{...C,role:"wall"}}if(x&&w.type==="shape")return(r.roles??=[]).push({id:w.id,...g.floorId?{floorId:g.floorId}:{},role:x}),{...w,role:x};let A=v?.inferred&&w.id===v.shape.id&&w.type==="shape"?vv(w,v.outline,y.objects,P):null;if(A&&w.type==="shape")return r.stage?.id===w.id&&(r.stage.field=A),{...w,role:"stage",stageKind:A};let M=w.type==="shape"&&w.id===v?.shape.id&&w.heightM===void 0&&!w.stageKind&&s.some(R=>R.plane===g&&(f.has(R.id)||R.level===0&&R.facesAction&&R.rake<=cv&&(R.frontDistance+R.backD-R.frontD)*Me>=lv)),E=M?{heightM:sv}:{};if(v?.inferred&&w.id===v.shape.id&&w.type==="shape"&&Rr(v.outline)*Me*Me<=js)return r.stage?.id===w.id&&(r.stage.deck=!0),{...w,role:"stage",...E};if(M&&w.type==="shape"&&w.role==="stage")return{...w,...E};let T=w.type==="section"?p.get(w.id):void 0;if(!T||w.type!=="section")return w;let k=T.rowCount>=2&&T.rake>0;l.has(T.id)?r.looseRowBlocks=(r.looseRowBlocks??0)+1:r.sections.push({id:T.id,floorId:g.floorId,surfaceKind:k?"rakedRows":"flat",height:T.height,rake:T.rake,stackedOn:d.get(T.id)});let _={status:"inferred",source:"public-2d-topology",note:Sv};return{...w,height:T.height,rake:T.rake,surfaceKind:k?"rakedRows":"flat",physical3dProvenance:{height:_,rake:_,surfaceKind:_}}}));if(e.floors?.length){let y=e.floors.map((g,v)=>({...g,objects:b[v],focalPoint:u[v].plane.focal}));return{doc:{...e,floors:y,objects:y[0].objects,focalPoint:y[0].focalPoint},report:r}}return{doc:{...e,objects:b[0],focalPoint:u[0].plane.focal},report:r}}var Sf=/^[\p{L}\p{N}]{1,4}$/u,Dv=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function wf(e,t){let n=t?.trim();if(!n)return e;let o=e.toLocaleLowerCase("en-US"),r=n.toLocaleLowerCase("en-US");if(o.startsWith(`${r} `)){let a=e.slice(n.length).trim();if(Sf.test(a))return a}let i=Dv.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((r.startsWith(a)||a.startsWith(r))&&Sf.test(s))return s}return e}var Pf={inline:"Inline booth \xB7 1 open side",corner:"Corner booth \xB7 2 open sides",peninsula:"Peninsula booth \xB7 3 open sides",island:"Island booth \xB7 4 open sides"},Nv=new Map(za.map(e=>[e.key,e.label]));function Bv(e){return`picker.access.${e}`}function Af(e){let t=[],n=e.boothType;n&&Object.prototype.hasOwnProperty.call(Pf,n)&&t.push({key:`booth:${n}`,icon:"booth",titleKey:`picker.boothType.${n}`,titleFallback:Pf[n],tone:"place"});let o=e.wheelchairSpaceType;for(let s of e.accessibility??[]){if(s==="wheelchair"&&o)continue;let c=Nv.get(s);c&&t.push({key:`access:${s}`,icon:s,titleKey:Bv(s),titleFallback:c,tone:"access"})}o==="no-seat"?t.push({key:"wheelchair:no-seat",icon:"wheelchair",titleKey:"picker.emptyWheelchairSpace",titleFallback:"Empty wheelchair space",tone:"access"}):o==="seat-present"&&t.push({key:"wheelchair:seat-present",icon:"wheelchair",titleKey:"picker.accessiblePhysicalSeat",titleFallback:"Accessible physical seat",tone:"access"}),e.aisle===!0&&t.push({key:"place:aisle",icon:"aisle",titleKey:"picker.aisleSeat",titleFallback:"Aisle seat",tone:"place"});let r=e.commercial;r?.restrictedView&&t.push({key:"mark:restrictedView",icon:"restrictedView",titleKey:"picker.restrictedView",titleFallback:"Restricted view",tone:"warn"}),r?.obstructedView&&t.push({key:"mark:obstructedView",icon:"obstructedView",titleKey:"picker.obstructedView",titleFallback:"Obstructed view",tone:"warn"}),r?.premium&&t.push({key:"mark:premium",icon:"premium",titleKey:"picker.premiumSeat",titleFallback:"Premium seat",tone:"premium"});let i=r?.note?.trim();if(i){let s=t.find(c=>c.tone==="warn"||c.tone==="premium");s?s.note=i:t.push({key:"note",icon:"note",titleKey:"picker.organizerNote",titleFallback:"Organizer note",tone:"note",note:i})}let a=typeof e.entrance=="string"?e.entrance.trim():"";return a&&t.push({key:"place:entrance",icon:"entrance",titleKey:"picker.entrance",titleFallback:"Entrance",tone:"place",note:a}),t}function Rf(e,t,n){return n<0?t>1?e.filter(o=>o.kind==="floor"):[...e]:e.filter(o=>o.floorIndex===void 0||o.floorIndex===n)}function Ef(e,t){let n=[...e].sort((r,i)=>r.screen.y-i.screen.y),o=[];for(let r of n){let i=o.find(a=>a.some(s=>Math.abs(s.screen.x-r.screen.x)<104&&Math.abs(s.screen.y-r.screen.y)<34));i?i.push(r):o.push([r])}return o.flatMap(r=>r.length<2?r:r.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(r.length-1)/2)*104))}})))}var Hv=1.15,Gv=2.75,Vv=4.5,zv=.85,Uv=.5,Wv=.26;function If(e,t,n){let o=Math.max(1e-6,t),r=e/o,i=n?.hasZoneLabels??!0,a=new Set(["stage","gate"]);return r>=.75&&a.add("floor"),r>=Hv&&a.add("zone"),r<=(i?Gv:Vv)&&(a.add("section"),a.add("ga")),r<=zv&&(a.add("annotation"),a.add("booth")),r<=Uv&&a.add("row"),r<=Wv&&a.add("seat"),a}function _f(e,t,n,o,r,i=6){let a=i+t,s=o-i-t,c=i+n,l=r-i-n;return{...e,x:a>s?o/2:Math.max(a,Math.min(s,e.x)),y:c>l?r/2:Math.max(c,Math.min(l,e.y))}}function en(e,t,n,o){let r=e,i=t[0],a=t[1],s=t[2],c=r[0]*i+r[4]*a+r[8]*s+r[12],l=r[1]*i+r[5]*a+r[9]*s+r[13],u=r[2]*i+r[6]*a+r[10]*s+r[14],m=r[3]*i+r[7]*a+r[11]*s+r[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let h=c/m,f=l/m,d=u/m,p=h>=-1.05&&h<=1.05&&f>=-1.05&&f<=1.05&&d<=1;return{x:(h*.5+.5)*n,y:(1-(f*.5+.5))*o,depth:d,visible:p}}function Cf(e,t,n=t,o=()=>0){let r=[],i=[...e].sort((a,s)=>o(s)-o(a)||a.screen.depth-s.screen.depth);for(let a of i){let s=!1;for(let c of r)if(Er(a,c,t,n)){s=!0;break}s||r.push(a)}return r}var jv=6;function Er(e,t,n,o){let r=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+jv):n;return r<a&&i<o}function Tf(e,t,n){return e.length*t*.58+(n?14:0)}var Xv={row:8,seat:14};function kf(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:Xv}function Lf(e,t,n,o){let r=Math.max(1,Math.min(n,o)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-o/2)/r);return t*(1+1.5*i)}function Ir(e,t,n,o,r=[]){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>=o)break;let c=!1;for(let l of r)if(Er(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(Er(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}function Qs(e,t,n,o){let r=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15];return r<=0||!(n>0)?0:n*Math.hypot(e[0],e[4],e[8])*o/(2*r)}var Kv=1.5,Yv=30,$v=4,Zv=3.6,qv=6,Js=15,Qv=3,Jv=1;function e2(e){return Math.max(Zv,Math.min(qv,2.4+.15*e))}var _r=Math.PI*2;function t2(e,t){let n=0,o=0;for(let m of e)n+=m.x,o+=m.y;let r=Math.atan2(o/e.length-t.y,n/e.length-t.x),i=e.map(m=>{let h=Math.atan2(m.y-t.y,m.x-t.x)-r;for(;h>Math.PI;)h-=_r;for(;h<-Math.PI;)h+=_r;return h+r}),a=i.map((m,h)=>h).sort((m,h)=>i[m]-i[h]),s=i[a[0]],c=i[a[a.length-1]];if(c-s>Math.PI)return null;let l=m=>Math.hypot(m.x-t.x,m.y-t.y),u=m=>{let h=e[m],f=(m+e.length-1)%e.length,d=(m+1)%e.length,p=Math.abs(i[f]-i[m])<=Math.abs(i[d]-i[m])?f:d,b=e[p];return l(h)<=l(b)?[h,b]:[b,h]};return{start:s,end:c,startEdge:u(a[0]),endEdge:u(a[a.length-1])}}function Of(e){return e.type==="shape"&&e.role==="wall"&&e.heightM===void 0}function ec(e,t,n=()=>!0){let o=[];for(let c of e){if(!Of(c)||!n(c))continue;let l=Pe(c);if(!l||l.length<3)continue;let u=t2(l,t);if(!u)return[];o.push(u)}if(o.length<2)return[];let r=e.flatMap(c=>{if(c.type!=="shape"||c.role!=="entrance"&&c.role!=="exit")return[];let l=Pe(c);if(!l?.length)return[];let u=0,m=0;for(let h of l)u+=h.x,m+=h.y;return[{x:u/l.length,y:m/l.length}]}),i=c=>(c%_r+_r)%_r;o.sort((c,l)=>i(c.start)-i(l.start));let a=c=>Math.hypot(c.x-t.x,c.y-t.y),s=[];for(let c=0;c<o.length;c++){let l=o[c],u=o[(c+1)%o.length],m=i(u.start-l.end);if(m<=0||m>=Math.PI/2)continue;let h=x=>i(x-l.end)<m;if(o.some(x=>x!==l&&x!==u&&(h(x.start)||h(x.end)||i(l.end-x.start)<x.end-x.start)))continue;let[d,p]=l.endEdge,[b,y]=u.startEdge,g={x:(d.x+p.x)/2,y:(d.y+p.y)/2},v={x:(b.x+y.x)/2,y:(b.y+y.y)/2},P=Math.hypot(v.x-g.x,v.y-g.y)*I;if(P<Kv||P>Yv||Math.abs(a(g)-a(v))*I>$v+.2*P)continue;let w={x:(g.x+v.x)/2,y:(g.y+v.y)/2};r.some(x=>h(Math.atan2(x.y-t.y,x.x-t.x))&&Math.abs(a(x)-a(w))*I<=Qv)||s.push({quad:[d,p,y,b],mid:w,widthM:P,openingM:e2(P)})}return s}function Ff(e,t){let n=[];for(let i of t)if(i.text?.trim())for(let a of e){let s=Math.hypot(i.position.x-a.mid.x,i.position.y-a.mid.y)*I;s<=Js&&n.push({text:i,gate:a,d:s})}n.sort((i,a)=>i.d-a.d);let o=new Map,r=new Set;for(let{text:i,gate:a}of n)o.has(i.id)||r.has(a)||(o.set(i.id,a),r.add(a));return o}function Df(e,t,n,o,r,i,a,s=()=>!0){let c=ec(t,Co(n),s);if(!c.length)return;let l=t.find(m=>Of(m)&&s(m)),u=zi(l?.fill,a);e.setMaterial(Fi);for(let m of c)r-m.openingM<Jv||Ni(e,m.quad,o+m.openingM,o+r,[],u.top,u.wall,i,r);e.setMaterial(0)}var n2=6,o2=2.2,qi=.1,r2=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,i2=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),a2=.3,s2=1.8,c2=.9,l2=.55,u2=1,Nf=4e3,m2=6,Bf="#d8a425",h2="#e8c15a",tc="#1c1608";function Hf(e){let t=f2(e);if(!t)return null;let n=Af(e).find(o=>o.icon===t.icon);return{...t,name:n?.titleFallback??t.icon}}function f2(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:si(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:Bf,ink:tc}:n?.restrictedView?{icon:"restrictedView",color:Bf,ink:tc}:n?.premium?{icon:"premium",color:h2,ink:tc}:null}function d2(e,t){if(!e)return;let n,o=0;for(let[i,a]of e)a>o&&(o=a,n=i);let r=t.categories?.find(i=>i.key===n)?.color;return r&&/^#[0-9a-f]{6}$/i.test(r)?r:void 0}var p2=6e3,b2=.25,Gf=[-90,90,-135,135,-45,45];function g2(e,t,n,o){let r=e.flatMap(({id:a,a:s,members:c})=>{let l=(s.minX+s.maxX)/2,u=(s.minY+s.maxY)/2,m=.5*Math.hypot(s.maxX-s.minX,s.maxY-s.minY),h=1/0;for(let f of c)h=Math.min(h,Math.hypot(t[f].x-l,t[f].y-u));return c.length&&h>=m*b2?[{id:a,cx:l,cy:u,half:m,members:c}]:[]}).sort((a,s)=>a.half-s.half),i=new Map;return r.forEach(({id:a,cx:s,cy:c,members:l},u)=>{let m=o.x-s,h=o.y-c,p=(Math.hypot(m,h)>1e-6?Math.atan2(h,m):0)+Gf[u%Gf.length]*Math.PI/180,b=Math.cos(p),y=Math.sin(p),g=-1,v=-1/0;for(let P of l){let w=(t[P].x-s)*b+(t[P].y-c)*y;w>v&&(v=w,g=P)}i.set(a,[t[g].x*I,n.seatDeckY(g),t[g].y*I])}),i}function zf(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let h of n)for(let f of h.objects)f.type==="section"&&f.zone&&c.set(f.id,f.zone);let l=new Map,u=new Map;for(let h=0;h<o.length;h++){let f=o[h],d=r.seatOwner[h],p=f.zoneId??(d?c.get(d):void 0);if(!p)continue;let b=l.get(p);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(p,b));let y=u.get(p);y||u.set(p,y=[]),y.push(h),b.n++,f.x<b.minX&&(b.minX=f.x),f.y<b.minY&&(b.minY=f.y),f.x>b.maxX&&(b.maxX=f.x),f.y>b.maxY&&(b.maxY=f.y),b.sumY+=r.seatDeckY(h)}let m=g2(a.flatMap(h=>{let f=l.get(h.id);return f?[{id:h.id,a:f,members:u.get(h.id)??[]}]:[]}),o,r,i);for(let h of a){let f=l.get(h.id),d=[];for(let[p,b]of c)b===h.id&&d.push(p);if(!f||f.n===0){s.push({id:h.id,label:h.label,color:Ie(h.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(h.focalPoint??i).x*I,1.5,(h.focalPoint??i).y*I]});continue}s.push({id:h.id,label:h.label,color:Ie(h.color),sectionIds:d,seatCount:f.n,...m.has(h.id)?{labelAt:m.get(h.id)}:{},center:[(f.minX+f.maxX)/2*I,f.sumY/f.n,(f.minY+f.maxY)/2*I],radius:.5*Math.hypot((f.maxX-f.minX)*I,(f.maxY-f.minY)*I)||1,focalWorld:[(h.focalPoint??i).x*I,1.5,(h.focalPoint??i).y*I]})}}return s}function Uf(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],m=[],h=new Map;for(let d of n)for(let p of d.objects){if(p.type!=="section"||!p.zone)continue;let b=(p.displayLabel||p.label||"").trim().toLocaleLowerCase();if(!b)continue;let y=t.floors?.[d.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&y===b)continue;let g=h.get(p.zone);g||h.set(p.zone,g=new Set),g.add(b)}for(let d of s)d.seatCount!==0&&(h.get(d.id)?.has(d.label.trim().toLocaleLowerCase())||l.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[(d.labelAt??d.center)[0],(d.labelAt??d.center)[1]+n2,(d.labelAt??d.center)[2]],color:t.zones?.find(p=>p.id===d.id)?.color}));{let d=new Map,p=new Map,b=new Map,y=new Map;for(let g=0;g<o.length;g++){let v=r.seatOwner[g];if(!v)continue;let P=d.get(v);P||(P={n:0,x:0,y:0,deck:0},d.set(v,P)),P.n++,P.x+=o[g].x,P.y+=o[g].y,P.deck+=r.seatDeckY(g);let w=o[g].categoryKey;if(w){let S=p.get(v);S||(S=new Map,p.set(v,S)),S.set(w,(S.get(w)??0)+1)}if(o[g].accessibility?.includes("wheelchair")){let S=b.get(v);S?S.push(g):b.set(v,[g])}let x=y.get(v);x||(x={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},y.set(v,x)),x.minDeck=Math.min(x.minDeck,r.seatDeckY(g)),x.maxDeck=Math.max(x.maxDeck,r.seatDeckY(g)),o[g].x<x.minX&&(x.minX=o[g].x),o[g].x>x.maxX&&(x.maxX=o[g].x),o[g].y<x.minY&&(x.minY=o[g].y),o[g].y>x.maxY&&(x.maxY=o[g].y)}for(let g of n)for(let v of g.objects){if(v.type!=="section"||bf(v))continue;let P=d.get(v.id);if(!P||P.n===0)continue;let w=y.get(v.id),x=[P.x/P.n*I,P.deck/P.n,P.y/P.n*I],S=v.displayLabel||v.label||v.id;u.push({id:v.id,floorIndex:g.index,label:S,seatCount:P.n,center:x,radius:Math.max(1,Math.hypot(w.maxX-w.minX,w.maxY-w.minY)*.5*I),box:{min:[w.minX*I-.4,w.minDeck,w.minY*I-.4],max:[w.maxX*I+.4,w.maxDeck+1,w.maxY*I+.4]},focalWorld:[g.focal.x*I,g.baseHeightM+1.5,g.focal.y*I]});let A=t.floors?.[g.index]?.name?.trim().toLocaleLowerCase();if(!(n.length>1&&A===S.trim().toLocaleLowerCase())){let M=d2(p.get(v.id),t),E=b.get(v.id);l.push({id:`section:${v.id}`,kind:"section",text:S,anchor:[x[0],x[1]+o2,x[2]],floorIndex:g.index,...M?{tint:M}:{},...E?{wheelchairSeats:E}:{}})}}}{for(let x of n)for(let S of x.objects){if(S.type!=="gaArea")continue;let A=so(S.points);if(!A)continue;let M=S.labelPresentation?.visible===!1?"":S.displayLabel||S.label||S.id,E=S.capacity>0?[M,S.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):M;E&&l.push({id:`ga:${S.id}`,kind:"ga",text:E,areaName:M,anchor:[A.x*I,x.baseHeightM+s2,A.y*I],floorIndex:x.index})}let d=new Map,p=new Map;for(let x of n)for(let S of x.objects)if(S.type==="section"&&d.set(S.id,S.displayLabel||S.label||S.id),S.type==="row"){let A=S.displayLabel?.trim()||S.segmentedRow?.displayLabel?.trim();A&&p.set(S.id,A)}let b=new Map;for(let x=0;x<o.length;x++){let S=o[x],A=Math.hypot(S.x-c.x,S.y-c.y),M=b.get(S.rowId);(!M||A>M.far)&&b.set(S.rowId,{seat:S,index:x,far:A})}for(let[x,S]of b){let A=r.seatOwner[S.index]??S.seat.sectionId,M=Vf(S.seat.label,x,d.get(A??""),p.get(x));M&&l.push({id:`row:${x}`,kind:"row",text:M,anchor:[S.seat.x*I,r.seatDeckY(S.index)+c2,S.seat.y*I],floorIndex:a[S.index]})}let y=new Map;for(let x=0;x<o.length;x++){let S=o[x],A=y.get(S.rowId);A||(A={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:Vf(S.label,S.rowId,d.get(r.seatOwner[x]??S.sectionId??""),p.get(S.rowId)),sectionId:r.seatOwner[x]??S.sectionId},y.set(S.rowId,A));let M=x*3,E=i.iPosition[M],T=i.iPosition[M+1],k=i.iPosition[M+2];A.n++,A.x+=E,A.y+=T,A.z+=k,A.minX=Math.min(A.minX,E),A.maxX=Math.max(A.maxX,E),A.minZ=Math.min(A.minZ,k),A.maxZ=Math.max(A.maxZ,k)}for(let[x,S]of y)m.push({id:x,label:S.label,sectionId:S.sectionId,seatCount:S.n,center:[S.x/S.n,S.y/S.n,S.z/S.n],radius:Math.max(.8,Math.hypot(S.maxX-S.minX,S.maxZ-S.minZ)*.5)});let g=0,v=(x,S)=>{g++,l.push({id:`access:${o[x].id}`,kind:"access",text:S.name,icon:S.icon,color:S.color,...S.ink?{ink:S.ink}:{},seatWidthM:i.iChairWidth[x]*2,anchor:[o[x].x*I,r.seatDeckY(x)+u2,o[x].y*I],floorIndex:a[x],rowId:o[x].rowId})},P=null,w=()=>{if(P){let x=Hf(o[P.seats[0]]),S=P.seats.length,A=Math.max(1,Math.round(S/m2));for(let M=0;M<A&&g<Nf;M++)v(P.seats[Math.min(S-1,Math.floor((M+.5)*S/A))],x)}P=null};for(let x=0;x<o.length&&g<Nf;x++){let S=Hf(o[x]);if(S&&o[x].accessibility?.length){w(),v(x,S);continue}if(!S){w();continue}P&&P.rowId===o[x].rowId&&P.icon===S.icon?P.seats.push(x):(w(),P={rowId:o[x].rowId,icon:S.icon,seats:[x]})}if(w(),o.length<=p2)for(let x=0;x<o.length;x++){let S=o[x],A=nc(S.displayLabel||S.label);A&&l.push({id:`seat:${S.id}`,kind:"seat",seatWidthM:i.iChairWidth[x]*2,text:A,anchor:[S.x*I,r.seatDeckY(x)+l2,S.y*I],floorIndex:a[x],rowId:S.rowId})}}let f=Ci(n);for(let d of n){let p=Mn(d,n.length===1?o:o.filter((g,v)=>a[v]===d.index)),b=p?Ff(ec(d.objects,Co(p)),d.objects.filter(g=>g.type==="text")):new Map,y=[...b.values()];for(let g of d.objects){let v=g.type==="text"?b.get(g.id):void 0;if(g.type==="shape"&&(g.role==="entrance"||g.role==="exit")&&r2.test(g.label?.trim()??"")){let P=Pe(g),w=P?so(P):null;if(w&&y.some(x=>Math.hypot(w.x-x.mid.x,w.y-x.mid.y)*I<=Js+x.widthM))continue}if(v&&g.type==="text")l.push({id:`text:${g.id}`,kind:"gate",text:g.text,icon:"entrance",anchor:[v.mid.x*I,d.baseHeightM+v.openingM+qi,v.mid.y*I],color:g.color,floorIndex:d.index});else if(g.type==="shape"&&g.role&&i2.has(g.role)){if(f.has(g))continue;let P=Pe(g),w=P?so(P):null;if(!w||!g.label||g.gate?.hideFromBuyers)continue;l.push({id:`architecture:${g.id}`,kind:g.role==="stage"?"stage":g.role==="entrance"||g.role==="exit"?"gate":"annotation",text:g.label,...g.role==="entrance"||g.role==="exit"?{icon:g.role}:{},...g.gate?.stepFree?{stepFree:!0}:{},anchor:[w.x*I,d.baseHeightM+Gt(g).heightM+qi,w.y*I],color:g.fill,floorIndex:d.index})}else if(g.type==="text"){let P=g.semanticKind==="icon"?xr(g.iconKey)?.key:void 0,w=g.text||(P?xr(P).label:"");if(!w)continue;l.push({id:`text:${g.id}`,kind:"annotation",text:w,...P?{venueIcon:P}:{},anchor:P?[(g.position.x+g.fontSize/2)*I,d.baseHeightM+qi,(g.position.y+g.fontSize/2)*I]:[g.position.x*I,d.baseHeightM+qi,g.position.y*I],color:g.color,rotation:g.rotation,floorIndex:d.index})}else if(g.type==="booth"){if(g.labelPresentation?.visible===!1)continue;let P=_t(g);if(!P)continue;let w=so(P);if(!w)continue;l.push({id:`booth:${g.id}`,kind:"booth",text:g.displayLabel||g.label||g.id,anchor:[w.x*I,d.baseHeightM+Lo+a2,w.y*I],floorIndex:d.index})}}}return{labels:l,sections:u,rows:m}}function Wf(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 nc(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Vf(e,t,n,o){if(o?.trim())return o.trim();let r=e?e.lastIndexOf("-"):-1,i=r>0?e.slice(0,r):t;return i&&wf(i,n)}function jf(e){let{doc:t,units:n,seats:o,surfaces:r,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 h=0;h<i.floor.length;h+=1){let f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[h]))),d=h*3,p=l[f];p.minX=Math.min(p.minX,i.position[d]),p.minY=Math.min(p.minY,i.position[d+1]),p.minZ=Math.min(p.minZ,i.position[d+2]),p.maxX=Math.max(p.maxX,i.position[d]),p.maxY=Math.max(p.maxY,i.position[d+1]),p.maxZ=Math.max(p.maxZ,i.position[d+2])}let u=new Map;for(let h=0;h<n.length;h++)for(let f of n[h].objects)f.type==="section"&&u.set(f.id,h);let m=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 h=0;h<o.length;h++){let f=r.seatOwner[h],d=(f!==null?u.get(f):void 0)??a[h];if(d===void 0)continue;let p=m[d],b=o[h];p.n++,b.x<p.minX&&(p.minX=b.x),b.y<p.minY&&(p.minY=b.y),b.x>p.maxX&&(p.maxX=b.x),b.y>p.maxY&&(p.maxY=b.y);let y=r.seatDeckY(h);p.sumX+=b.x*I,p.sumDeck+=y,p.sumZ+=b.y*I,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),s[h]=d}for(let h=0;h<n.length;h++){let f=m[h],d=t.floors?.[h],p=l[h],b=Math.min(f.n?f.minX*I:n[h].focal.x*I-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(f.n?f.maxX*I:n[h].focal.x*I+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(f.n?f.minY*I:n[h].focal.y*I-1,Number.isFinite(p.minZ)?p.minZ:1/0),v=Math.max(f.n?f.maxY*I:n[h].focal.y*I+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),P=Math.min(f.n?Math.min(n[h].baseHeightM,f.minDeck):n[h].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),w=Math.max(f.n?Math.max(f.maxDeck,P+.5):P+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),x=[f.n?f.sumX/f.n:(b+y)/2,f.n?f.sumDeck/f.n:(P+w)/2,f.n?f.sumZ/f.n:(g+v)/2],S=Math.max(1,.5*Math.hypot(y-b,w-P,v-g));c.push({index:h,id:d?.id??`floor-${h}`,label:d?.name??(n.length>1?`Floor ${h+1}`:"Venue"),seatCount:f.n,center:x,radius:S,box:{min:[b,P,g],max:[y,w,v]},focalWorld:[n[h].focal.x*I,n[h].baseHeightM+1.5,n[h].focal.y*I]})}}return c}function ac(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<o&&(o=c),s>r&&(r=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=_t(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=Ui(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=Wi(c);if(l)for(let u of l)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function Qf(e,t,n,o,r,i){if(t.length===1){let a=n.map(m=>({x:m.x,y:m.y}));for(let m of t[0].objects)m.type==="section"?a.push(...m.outline):m.type==="shape"?a.push(...Pe(m)??m.points??[]):m.type==="gaArea"?a.push(...m.points):m.type==="booth"?a.push(..._t(m)??[]):m.type==="table"?a.push(...Ui(m)??[]):m.type==="decorImage"&&a.push(...Wi(m)??[]);if($f(e,t[0],n,i)||qf(e,t[0],n,a,i))return!1;if(Yf(e,t[0].baseHeightM,a,i))return!0;let s=Mr(a),c=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,u=s.length>=3?s.map(m=>{let h=m.x-c,f=m.y-l,d=Math.max(1,Math.hypot(h,f));return{x:m.x+h/d*80,y:m.y+f/d*80}}):tr(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return ue(e,u,void 0,()=>-.04,-.22,i.ground,i.ground,se),!1}else{let a=t.reduce((p,b)=>b.baseHeightM<p.baseHeightM?b:p);e.setFloor(er);let s={...a,objects:t.flatMap(p=>p.objects)},c=n.map(p=>({x:p.x,y:p.y}));for(let p of s.objects)p.type==="section"&&c.push(...p.outline);if($f(e,s,n,i)||qf(e,s,n,c,i))return!1;if(Yf(e,a.baseHeightM,c,i))return!0;let l=n.filter((p,b)=>o[b]===a.index),u=ac([a],l),m=Math.hypot(u.maxX-u.minX,u.maxY-u.minY),h=Math.max(28,Math.min(80,m*.04)),f=tr(u.minX-h,u.minY-h,u.maxX-u.minX+h*2,u.maxY-u.minY+h*2),d=a.baseHeightM-.03;return ue(e,f,void 0,()=>d,d-.22,i.ground,i.ground,se),!1}}function sc(e,t,n,o){let{cx:r,cz:i,radius:a}=n,s=1/0,c=1/0,l=1/0,u=-1/0,m=-1/0,h=-1/0,f=(b,y,g)=>{s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,y),m=Math.max(m,y),l=Math.min(l,g),h=Math.max(h,g)};for(let b=0;b<e.position.length;b+=3){let y=b/3;o&&y>=o[0]&&y<o[1]||f(e.position[b],e.position[b+1],e.position[b+2])}for(let b=0;b<t.count;b++){let y=b*3,g=t.iPosition[y],v=t.iPosition[y+1],P=t.iPosition[y+2],w=Math.max(.35,t.iMaxRadius[b]??.35);f(g-w,v,P-w),f(g+w,v+1.6,P+w)}Number.isFinite(s)||(s=r-a,u=r+a,c=0,m=a*.16,l=i-a,h=i+a);let d=[(s+u)/2,(c+m)/2,(l+h)/2],p=Math.max(1,.5*Math.hypot(u-s,m-c,h-l));return{center:d,radius:p,minY:c,maxY:m}}var y2=4096;function Jf(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/y2)),r=Math.ceil(e.count/o),i=new Float32Array((r*2+t.length*4+n.length)*3),a=0;for(let s=0;s<e.count;s+=o){let c=e.iPosition[s*3],l=e.iPosition[s*3+1],u=e.iPosition[s*3+2];i[a++]=c,i[a++]=l,i[a++]=u,i[a++]=c,i[a++]=0,i[a++]=u}for(let[s,c,l]of n)i[a++]=s,i[a++]=c,i[a++]=l;for(let s of t)for(let[c,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])i[a++]=s.cx+c*s.halfX,i[a++]=s.y,i[a++]=s.cz+l*s.halfZ;return i.subarray(0,a)}function ed(e,t,n,o,r,i,a=[]){let s=1/0,c=1/0,l=-1/0,u=-1/0;for(let w=0;w<e.count;w++){let x=w*3,S=e.iPosition[x],A=e.iPosition[x+2];S<s&&(s=S),S>l&&(l=S),A<c&&(c=A),A>u&&(u=A)}for(let[w,,x]of a)w<s&&(s=w),w>l&&(l=w),x<c&&(c=x),x>u&&(u=x);for(let w of t)s=Math.min(s,w.cx-w.halfX),l=Math.max(l,w.cx+w.halfX),c=Math.min(c,w.cz-w.halfZ),u=Math.max(u,w.cz+w.halfZ);let m=n.minX*I,h=n.maxX*I,f=n.minY*I,d=n.maxY*I,p=m,b=h,y=f,g=d;if(Number.isFinite(s)){let w=Math.max(2,.06*Math.hypot(l-s,u-c));p=Math.max(m,s-w),b=Math.min(h,l+w),y=Math.max(f,c-w),g=Math.min(d,u+w)}let v=Math.min(0,o),P=Math.max(r,i*.05);return{min:[p,v,y],max:[b,P,g]}}var oc=12,x2=.5,M2=6,rc=.8,Xf=5,v2=.6,S2=40,ic=0,Kf=8;function Yf(e,t,n,o){let r=Mr([...n]);if(r.length<3)return!1;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let w of r)i=Math.min(i,w.x),s=Math.max(s,w.x),a=Math.min(a,w.y),c=Math.max(c,w.y);let l=Math.hypot(s-i,c-a)*I,u=Math.max(S2,l*v2),m=w=>Zt(r,w/I,1.2),h=m(x2),f=[h,m(M2),m(oc),m(oc+Xf),m(oc+Xf+u)];if(f.some(w=>w.length!==h.length))return!1;let d=we(o.ground,[.78,.76,.72],.35),p=we(o.ground,[.56,.62,.52],.3),b=[d[0]*rc,d[1]*rc,d[2]*rc],y=t-.04;e.setMaterial(ic),ue(e,h,void 0,()=>y,t-.22,b,b,se);let g=[0,1,0],v=(w,x,S,A,M)=>{let E=w.map(R=>[R.x*I,y,R.y*I]),T=x.map(R=>[R.x*I,y,R.y*I]),[k,_]=M;for(let R=0;R<E.length;R++){let C=(R+1)%E.length;e.tri(E[R],T[C],T[R],g,S,A,A,[k,_,_]),e.tri(E[R],E[C],T[C],g,S,S,A,[k,k,_])}},P=[ic,ic];return v(f[0],f[1],b,d,P),v(f[1],f[2],d,d,P),v(f[2],f[3],d,p,P),v(f[3],f[4],p,p,[Kf,Kf+1]),e.setMaterial(0),!0}function $f(e,t,n,o){let r=Mn(t,n);if(!r)return!1;let i=t.baseHeightM,a=we(o.ground,[.62,.55,.47],.4);return ue(e,r,void 0,()=>i-.04,i-.22,a,a,se),!0}var w2=3e3,P2=20,Zf=1.5,A2=1.2,R2=.25;function qf(e,t,n,o,r){if(!n.length||n.length>w2||o.length<3)return!1;for(let M of t.objects){if(M.type==="shape"&&co(M.stageKind))return!1;if(M.type==="section"){let{height:E}=bn(M,{floorBaseHeightM:t.baseHeightM});if(E-t.baseHeightM>P2)return!1}}let i=0,a=0;for(let M of o)i+=M.x,a+=M.y;i/=o.length,a/=o.length;let s=0,c=0,l=0;for(let M of o){let E=M.x-i,T=M.y-a;s+=E*E,c+=T*T,l+=E*T}let u=.5*Math.atan2(2*l,s-c),m=Math.cos(u),h=Math.sin(u),f=-h,d=m,p=1/0,b=-1/0,y=1/0,g=-1/0;for(let M of o){let E=(M.x-i)*m+(M.y-a)*h,T=(M.x-i)*f+(M.y-a)*d;p=Math.min(p,E),b=Math.max(b,E),y=Math.min(y,T),g=Math.max(g,T)}let v=M=>[[p-M,y-M],[b+M,y-M],[b+M,g+M],[p-M,g+M]].map(([E,T])=>({x:i+m*E+f*T,y:a+h*E+d*T})),P=v(Zf/I),w=v((Zf+R2)/I),x=t.baseHeightM,S=we(r.ground,[.62,.55,.47],.4),A=we(r.ground,[.86,.86,.84],.55);return ue(e,w,void 0,()=>x-.04,x-.22,S,S,se),ue(e,w,[P.slice().reverse()],()=>x+A2,x-.04,we(A,[1,1,1],.2),A,se),!0}function td(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=Lu(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let m of n)for(let h of m.objects)h.type==="shape"&&i.set(h.id,{shape:h,unit:m});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(m=>{let h=m.runtimeContentImageUrl;return[m.id,typeof h=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(h)?h:void 0]})),l=[];for(let m of r.value.overlay.productionElements??[]){let h=i.get(m.objectId),f=h?Pe(h.shape):null,d=m.baseElevationM??0;if(!h||!f||f.length<3||!m.id||a.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();a.add(m.id),s.add(m.objectId);let p=f.map(A=>A.x*I),b=f.map(A=>A.y*I),y=h.unit.baseHeightM+d,g=Math.min(...p),v=Math.max(...p),P=Math.min(...b),w=Math.max(...b),x,S=c.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&S&&(x=Mh(f,y,y+m.heightM,h.unit.focal),!x))if(v-g>=w-P){let A=Math.abs(P-h.unit.focal.y*I)<=Math.abs(w-h.unit.focal.y*I)?P-.006:w+.006;x=[[g,y,A],[v,y,A],[g,y+m.heightM,A],[v,y+m.heightM,A]]}else{let A=Math.abs(g-h.unit.focal.x*I)<=Math.abs(v-h.unit.focal.x*I)?g-.006:v+.006;x=[[A,y,P],[A,y,w],[A,y+m.heightM,P],[A,y+m.heightM,w]]}l.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:h.unit.index,baseY:y,topY:y+m.heightM,bounds:{min:[g,y,P],max:[v,y+m.heightM,w]},occlusion:m.occlusion,...S?{contentImageUrl:S}:{},...x?{contentPlane:x}:{}})}let u=l.sort((m,h)=>m.id.localeCompare(h.id));return{byObjectId:new Map(u.map(m=>[m.objectId,m])),elements:u}}var E2=[1,.87,.64],I2=[1,.96,.84],nd=[.98,.66,.28],tn={poolEdge:{stage:.88,ring:.74},poolStrength:.6,poolLift:{stage:.02,ring:.006},lamps:{stage:8,ring:4},lampOut:.7,lampHeightM:[6,12],lampRadiusM:[.16,.28],minSpanM:3};function _2(e,t){let n=e.stageKind;if(n==="ring-boxing")return"ring";if(Et(n)||!t.length)return null;if(n==="round")return"stage";let o=Pe(e);return!o||o.length<3?null:Mo(od(o),t)?"stage":null}function C2(e,t,n,o){let r=1/0;for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length],c=s.x-a.x,l=s.y-a.y,u=n*l-o*c;if(Math.abs(u)<1e-12)continue;let m=((a.x-t.x)*l-(a.y-t.y)*c)/u,h=((a.x-t.x)*o-(a.y-t.y)*n)/u;m>1e-9&&h>=-1e-9&&h<=1+1e-9&&(r=Math.min(r,m))}return Number.isFinite(r)?r:0}function od(e){return{x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}}function rd(e,t,n,o,r={}){if(!r.night||!r.deck)return!1;let i=_2(t,o);if(!i)return!1;let a=Pe(t);if(!a||a.length<3)return!1;let s=od(a);if(!Ye(a,s.x,s.y))return!1;let c=28,l=[];for(let M=0;M<c;M++){let E=2*Math.PI*M/c;l.push(C2(a,s,Math.cos(E),Math.sin(E))*tn.poolEdge[i])}if(l.some(M=>!(M>0)))return!1;let u=Math.min(...l)*I;if(u*2<tn.minSpanM*tn.poolEdge[i])return!1;let m=r.deck,h=n+tn.poolLift[i],f=[0,1,0],d=(M,E)=>{let T=2*Math.PI*(M%c)/c,k=l[M%c]*E;return[(s.x+Math.cos(T)*k)*I,h,(s.y+Math.sin(T)*k)*I]},p=[s.x*I,h,s.y*I],b=M=>we(m,E2,tn.poolStrength*M),y=[{r:.4,k:.72},{r:.72,k:.28},{r:1,k:0}];e.setMaterial(0);for(let M=0;M<c;M++){e.tri(p,d(M+1,y[0].r),d(M,y[0].r),f,b(1),b(y[0].k),b(y[0].k));for(let E=0;E+1<y.length;E++){let T=y[E],k=y[E+1];e.tri(d(M,T.r),d(M+1,k.r),d(M,k.r),f,b(T.k),b(k.k),b(k.k)),e.tri(d(M,T.r),d(M+1,T.r),d(M+1,k.r),f,b(T.k),b(T.k),b(k.k))}}let[g,v]=tn.lampHeightM,P=n+Math.max(g,Math.min(v,u*1.6)),w=Math.max(tn.lampRadiusM[0],Math.min(tn.lampRadiusM[1],u*.05)),x=[0,-1,0],S=tn.lamps[i],A=10;e.setMaterial(xo);for(let M=0;M<S;M++){let E=2*Math.PI*(M+.5)/S,T=u*tn.lampOut,k=s.x*I+Math.cos(E)*T,_=s.y*I+Math.sin(E)*T;for(let R=0;R<A;R++){let C=2*Math.PI*R/A,O=2*Math.PI*(R+1)/A;e.tri([k,P,_],[k+Math.cos(C)*w,P,_+Math.sin(C)*w],[k+Math.cos(O)*w,P,_+Math.sin(O)*w],x,I2,nd,nd)}}return e.setMaterial(0),!0}function T2(e){let t=Math.min(1,Math.max(0,e));return t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055}function pt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function vt(e){return Array.isArray(e)?e:[]}function k2(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!pt(n))continue;let o=pt(n.extensions)?n.extensions:null;if(o&&Object.prototype.hasOwnProperty.call(o,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function Cr(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function L2(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function O2(e,t){let n=new Array(16).fill(0);for(let o=0;o<4;o++)for(let r=0;r<4;r++)for(let i=0;i<4;i++)n[o*4+r]+=e[i*4+r]*t[o*4+i];return n}function F2(e){let t=Cr(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:Cr(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:Cr(e.rotation,4),r=e.scale===void 0?[1,1,1]:Cr(e.scale,3);if(!n||!o||!r)return null;let[i,a,s,c]=o,l=Math.hypot(i,a,s,c);if(!(l>1e-8))return null;let u=i/l,m=a/l,h=s/l,f=c/l,d=u+u,p=m+m,b=h+h,y=u*d,g=u*p,v=u*b,P=m*p,w=m*b,x=h*b,S=f*d,A=f*p,M=f*b;return[(1-(P+x))*r[0],(g+M)*r[0],(v-A)*r[0],0,(g-M)*r[1],(1-(y+x))*r[1],(w+S)*r[1],0,(v+A)*r[2],(w-S)*r[2],(1-(y+P))*r[2],0,n[0],n[1],n[2],1]}function D2(e,t,n,o){return[e[0]*t+e[4]*n+e[8]*o+e[12],e[1]*t+e[5]*n+e[9]*o+e[13],e[2]*t+e[6]*n+e[10]*o+e[14]]}function N2(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],a=e[9],s=e[2],c=e[6],l=e[10],u=i*l-a*c,m=a*s-r*l,h=r*c-i*s,f=t*u+n*m+o*h;if(Math.abs(f)<1e-12)return null;let d=1/f;return[u*d,m*d,h*d,(o*c-n*l)*d,(t*l-o*s)*d,(n*s-t*c)*d,(n*a-o*i)*d,(o*r-t*a)*d,(t*i-n*r)*d]}function id(e,t,n,o){let r=e[0]*t+e[1]*n+e[2]*o,i=e[3]*t+e[4]*n+e[5]*o,a=e[6]*t+e[7]*n+e[8]*o,s=Math.hypot(r,i,a)||1;return r/=s,i/=s,a/=s,[r,i,a]}function B2(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,o=null,r=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!o)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!pt(c))return null;o=c}catch{return null}else if(a===5130562&&!r)r=s;else return null;n+=i}return n===e.byteLength&&o&&r?{json:o,bin:r}:null}function H2(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function G2(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function V2(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function z2(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=B2(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!pt(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=vt(o.extensionsUsed).filter(A=>typeof A=="string");if(i.includes("KHR_draco_mesh_compression")||k2(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||vt(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(vt(o.images).length||vt(o.textures).length)return{ok:!1,issue:"external_resource"};let a=vt(o.buffers);if(a.length!==1||!pt(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let s=vt(o.accessors),c=vt(o.bufferViews),l=vt(o.meshes),u=vt(o.nodes),m=vt(o.scenes),h=typeof o.scene=="number"?o.scene:0;if(!pt(m[h]))return{ok:!1,issue:"unsupported_glb"};let f=new DataView(r.buffer,r.byteOffset,r.byteLength),d=(A,M,E,T=!1)=>{if(typeof A!="number"||!Number.isInteger(A)||!pt(s[A]))return null;let k=s[A],_=typeof M=="string"?k.type===M:M.includes(k.type),R=k.componentType!==5126,C=T&&R?k.normalized===!0:k.normalized!==!0;if(!_||k.sparse!==void 0||!C||typeof k.count!="number"||!Number.isInteger(k.count)||k.count<1||typeof k.componentType!="number"||!E.includes(k.componentType)||typeof k.bufferView!="number")return null;let O=c[k.bufferView];if(!pt(O)||O.buffer!==0||typeof O.byteLength!="number"||!Number.isInteger(O.byteLength)||O.byteLength<0)return null;let B=G2(k.type),F=H2(k.componentType),N=typeof O.byteStride=="number"?O.byteStride:B*F,V=typeof O.byteOffset=="number"?O.byteOffset:0,H=typeof k.byteOffset=="number"?k.byteOffset:0,L=V+H,G=H+(k.count-1)*N+B*F;if(!Number.isInteger(N)||!Number.isInteger(V)||!Number.isInteger(H)||N<B*F||V<0||H<0||V+O.byteLength>r.byteLength||G>O.byteLength)return null;let j=[];for(let D=0;D<k.count;D++){let U=[];for(let $=0;$<B;$++){let Z=V2(f,L+D*N+$*F,k.componentType);if(!Number.isFinite(Z))return null;U.push(Z)}j.push(U)}return j},p=[],b=[],y=[],g=!1,v=vt(o.materials),P=A=>{if(A===void 0)return null;if(typeof A!="number"||!Number.isInteger(A)||!pt(v[A]))return!1;let M=v[A].pbrMetallicRoughness;if(M===void 0)return null;if(!pt(M))return!1;if(M.baseColorFactor===void 0)return null;let E=Cr(M.baseColorFactor,4);return!E||E.some(T=>T<0||T>1)?!1:[E[0],E[1],E[2]]},w=0,x=new Set,S=(A,M)=>{if(typeof A!="number"||!Number.isInteger(A)||!pt(u[A])||x.has(A))return!1;x.add(A);let E=u[A],T=F2(E);if(!T)return!1;let k=O2(M,T),_=N2(k);if(!_)return!1;if(E.mesh!==void 0){if(typeof E.mesh!="number")return!1;let R=l[E.mesh];if(!pt(R))return!1;for(let C of vt(R.primitives)){if(!pt(C)||C.mode!==void 0&&C.mode!==4||!pt(C.attributes))return!1;let O=d(C.attributes.POSITION,"VEC3",[5126]),B=C.attributes.NORMAL===void 0?null:d(C.attributes.NORMAL,"VEC3",[5126]);if(!O||C.attributes.NORMAL!==void 0&&!B)return!1;let F=P(C.material);if(F===!1)return!1;let N=C.attributes.COLOR_0===void 0?null:d(C.attributes.COLOR_0,["VEC3","VEC4"],[5126,5121,5123],!0);if(C.attributes.COLOR_0!==void 0&&(!N||N.length!==O.length))return!1;let V=N?s[C.attributes.COLOR_0]:null,H=!V||V.componentType===5126?1:V.componentType===5121?1/255:1/65535,L=F!==null||N!==null;L&&(g=!0);let G=O.length;if(C.indices!==void 0){let D=typeof C.indices=="number"?s[C.indices]:null;G=pt(D)?D.count:void 0}if(typeof G!="number"||!Number.isInteger(G)||G%3!==0||(w+=G/3,w>1e5))return!1;let j=C.indices===void 0?O.map((D,U)=>[U]):d(C.indices,"SCALAR",[5121,5123,5125]);if(!j||j.length%3!==0||j.length!==G)return!1;for(let D=0;D<j.length;D+=3){let U=[j[D][0],j[D+1][0],j[D+2][0]];if(U.some(te=>!Number.isInteger(te)||te<0||te>=O.length))return!1;let $=U.map(te=>D2(k,...O[te])),Z=null;if(!B){let te=$[1][0]-$[0][0],X=$[1][1]-$[0][1],me=$[1][2]-$[0][2],re=$[2][0]-$[0][0],ce=$[2][1]-$[0][1],J=$[2][2]-$[0][2];Z=id([1,0,0,0,1,0,0,0,1],X*J-me*ce,me*re-te*J,te*ce-X*re)}for(let te=0;te<3;te++){if(p.push(...$[te]),b.push(...B?id(_,...B[U[te]]):Z),!L){y.push(-1,-1,-1);continue}let X=N?N[U[te]]:null;for(let me=0;me<3;me++)y.push(T2((F?F[me]:1)*(X?X[me]*H:1)))}}}}for(let R of vt(E.children))if(!S(R,k))return!1;return x.delete(A),!0};for(let A of vt(m[h].nodes))if(!S(A,L2()))return{ok:!1,issue:w>1e5?"triangle_limit":"unsupported_glb"};return!w||p.length!==w*9||b.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:w,position:new Float32Array(p),normal:new Float32Array(b),color:g?new Float32Array(y):null}}function ad(e){try{return z2(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Oo(e){let{doc:t}=e,n=ur(t,e.eventConfigurationId??t.eventConfigurationId),o=cu(t.theme,wm(n,e.seats)),r=o.structure,i=td(e.eventConfigurationId,e.eventConfiguration,n),a=e.seats,s=new ui,c=null;if(e.registeredShellGlb){let W=ad(e.registeredShellGlb);if(W.ok){let K=W.position.length/3,Q=new Float32Array(W.position.length),ve=o.materials.shell??r.tierWall,Ee=W.color;for(let Ve=0;Ve<K;Ve++){let ze=W.normal[Ve*3+1],ye=ze<-.25?.4:.62+.38*Math.max(0,ze),Pt=!!Ee&&Ee[Ve*3]!==-1;Q[Ve*3]=(Pt?Ee[Ve*3]:ve[0])*ye,Q[Ve*3+1]=(Pt?Ee[Ve*3+1]:ve[1])*ye,Q[Ve*3+2]=(Pt?Ee[Ve*3+2]:ve[2])*ye}c={position:W.position,normal:W.normal,color:Q,floor:new Float32Array(K).fill(er),material:new Float32Array(K),count:K}}}let l=new Map;for(let W of n)for(let K of W.objects)l.set(K.id,W.index),K.type==="section"&&l.set(K.logicalSectionId??K.id,W.index);let u=a.map(W=>l.get(W.sectionId??"")??l.get(W.rowId??"")??0),m=ac(n,a),h=s.vertexCount,d=Qf(s,n,a,u,m,r)?s.vertexCount:h,p=$u(t,a),b=new Map,y=new Map;for(let W of t.categories??[])b.set(W.key,W.color),W.seatGlyph&&y.set(W.key,W.seatGlyph);let g=[],v=xh(n,a,u),P=new Map;a.forEach((W,K)=>{let Q=v.seatDeckY(K);Number.isFinite(Q)&&P.set(W.rowId,Math.min(P.get(W.rowId)??1/0,Q))});let w=new Float32Array(a.length),x=[],S=[],A=new Map((t.floors??[]).map((W,K)=>[W.id,K])),M=n.map(()=>[]);for(let W of a){let K=W.floorId?A.get(W.floorId)??0:0;M[Math.min(K,M.length-1)]?.push(W)}let E=(W,K)=>{if(!K||K.length<3)return!1;let Q=Math.min(...K.map(ze=>ze.x)),ve=Math.max(...K.map(ze=>ze.x)),Ee=Math.min(...K.map(ze=>ze.y)),Ve=Math.max(...K.map(ze=>ze.y));for(let ze=0;ze<W;ze++)for(let ye of M[ze])if(!(ye.x<Q||ye.x>ve||ye.y<Ee||ye.y>Ve)&&mt(ye,K,void 0))return!0;return!1},T=Ci(n),k=null,_=-1/0;a.forEach((W,K)=>{let Q=v.seatDeckY(K);Number.isFinite(Q)&&Q>_&&(_=Q)});let R=!1,C=W=>n.length===1?a:a.filter((K,Q)=>u[Q]===W),O=(W,K)=>{let Q=_t(W);if(!Q)return!1;let ve=1/0,Ee=1/0,Ve=-1/0,ze=-1/0;for(let ye of Q)ve=Math.min(ve,ye.x),Ve=Math.max(Ve,ye.x),Ee=Math.min(Ee,ye.y),ze=Math.max(ze,ye.y);return a.some((ye,Pt)=>ye.kind!=="booth"&&(n.length===1||u[Pt]===K)&&ye.x>ve&&ye.x<Ve&&ye.y>Ee&&ye.y<ze&&Ye(Q,ye.x,ye.y))},B,F=[],N;for(let W=0;W<n.length;W++){let K=n[W];s.setFloor(W);let Q=Mn(K,C(W)),ve=0;if(Q){let fe=0;for(let Ce of K.objects)if(Ce.type==="section")for(let ee of v.bySection.get(Ce.id)?.rowLevels??[])fe=Math.max(fe,ee.y-K.baseHeightM);ve=fh(fe);for(let Ce of Q)F.push([Ce.x*I,Ce.y*I]);if(N=Math.max(N??-1/0,K.baseHeightM+ve),!B){let Ce=Co(Q);B={centre:[Ce.x*I,Ce.y*I]}}}let Ee=new Mi,Ve=[],ze=K.objects.filter(fe=>fe.type==="shape"&&(fe.role==="entrance"||fe.role==="exit")),ye=K.objects.filter(fe=>fe.type==="section"&&!!fe.outline&&fe.outline.length>=3),Pt=Xh(K.objects.filter(fe=>fe.type==="booth"),K.focal);for(let fe of K.objects)if(fe.type==="section"){let Ce=s.vertexCount;lf(s,fe,K,Zu(fe,p),v.bySection.get(fe.id),Ee,ye,r,W>0&&E(W,fe.outline));let ee=s.vertexCount-Ce;ee>0&&x.push({sectionId:fe.id,start:Ce,count:ee})}else if(fe.type==="shape"){let Ce=i.byObjectId.get(fe.id);if(T.has(fe)&&!Ce)continue;let ee=g.length,pe=Q!==null&&fe.role==="wall"&&!Ce;s.setMaterial(pe?Fi:(Ce?.kind??fe.role)==="screen"?1:0);let de=fe.role==="stage"&&!Ce?Yh(fe,C(W)):pe&&fe.heightM===void 0?{...fe,heightM:ve}:fe,Te=dm(de,Ve),Oe=n.length>1&&fe.role==="stage";if(Oe&&s.setFloor(er),Fh(s,de,K.baseHeightM+Te.supportOffsetM,Te.topOffsetM-Te.supportOffsetM,r,K.focal,g,Ce,ze),s.setMaterial(0),fe.role==="stage"&&!Ce&&g.length>ee&&(k??W)===W){k=W;let Ue=t.floors?.[W]?.id,We=n.length>1&&Ue?a.filter(st=>st.floorId===Ue):a,at=Sm(s,de,g[g.length-1].y,We,{deck:g[g.length-1].top,night:!Kt(r),theatre:{maxTopY:Q?K.baseHeightM+ve:Math.max((n[0]?.baseHeightM??0)+8,_+5)}});at==="theatre"&&(R=!0),at===null&&rd(s,de,g[g.length-1].y,We,{deck:g[g.length-1].top,night:!Kt(r)});let Ze=Et(de.stageKind)?Pe(de):null;Ze&&Km(s,de,Ze,g[g.length-1].y,We,K.objects.some(st=>st.type==="shape"&&st.role==="goal"),K.objects.some(st=>st.type==="shape"&&st.role==="dugout")),Ze&&hi(de.stageKind)&&Ym(s,Ze,g[g.length-1].y,We,Vi),s.setMaterial(0)}Oe&&s.setFloor(W)}else if(fe.type==="gaArea"){let Ce=s.vertexCount;Nh(s,fe,K.baseHeightM,Ie(b.get(fe.categoryKey)),r);let ee=s.vertexCount-Ce;ee>0&&S.push({sectionId:fe.id,start:Ce,count:ee})}else fe.type==="booth"?kh(s,fe,K.baseHeightM,Ie(b.get(fe.categoryKey)),r,Pt.get(fe.id)??K.focal,O(fe,W)):fe.type==="table"?Oh(s,fe,Math.max(K.baseHeightM,P.get(fe.id)??K.baseHeightM),Ie(fe.fill??t.theme?.decorFill??"#232c40"),r,!!(fe.fill??t.theme?.decorFill)):fe.type==="decorImage"&&Dh(s,fe,K.baseHeightM,r);Q&&Df(s,K.objects,Q,K.baseHeightM,ve,K.focal,r,fe=>!i.byObjectId.has(fe.id)),mf(s,K,a,v,r,o.materials.shell,!c)}let V=n.length>1?{x:n.reduce((W,K)=>W+K.focal.x,0)/n.length,y:n.reduce((W,K)=>W+K.focal.y,0)/n.length}:t.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},H=$l(c?[s.build(),c]:[s.build()]),L=new Map;for(let W of n)for(let K of W.objects)K.type==="table"&&L.set(K.id,K.center);let G=Ql(a,e.initialState,v,w,b,y,new Set(L.keys())),j=zf({doc:t,units:n,seats:a,surfaces:v,focal:V}),{labels:D,sections:U,rows:$}=Uf({doc:t,units:n,seats:a,surfaces:v,seatData:G,hintedSeatFloor:u,zones:j,focal:V}),Z=new Map(U.map((W,K)=>[W.id,K]));v.seatOwner.forEach((W,K)=>{G.iSection[K]=W?Z.get(W)??-1:-1});let te=jf({doc:t,units:n,seats:a,surfaces:v,solids:H,hintedSeatFloor:u,seatFloor:w});Wf(D,te),G.iYaw=cl(G.iPosition,a.length,W=>a[W].rowId,W=>{let K=n[w[W]]?.focal??V;return[K.x*I,K.y*I]},W=>{let K=L.get(a[W].rowId);return K?[K.x*I,K.y*I]:void 0});let X=!!t.focalPoint||n.some(W=>W.objects.some(K=>K.type==="shape"&&K.role==="stage")),me=n.flatMap((W,K)=>W.objects.flatMap(Q=>Q.type==="gaArea"&&Q.points?.length>=3?[{points:Q.points,holes:Q.holes,capacity:Q.capacity,floorY:W.baseHeightM+wr,floorIndex:K,focal:X?W.focal:null}]:[])),re=n.flatMap(W=>W.objects.flatMap(K=>K.type==="gaArea"&&K.points?.length>=3?[{id:K.id,points:K.points,...K.holes?.length?{holes:K.holes}:{},floorY:W.baseHeightM+wr,floorIndex:W.index}]:[])),ce=me.length?Wh(me,a.flatMap((W,K)=>W.kind==="booth"||L.has(W.rowId)?[]:[{x:W.x,y:W.y,deckY:v.seatDeckY(K),floorIndex:n.length>1?u[K]:0}]),Math.min(e.crowdFigures??Number.POSITIVE_INFINITY,zh(a.length,e.crowdSeatCeiling??Xi()))):null,J=(m.minX+m.maxX)/2*I,ae=(m.minY+m.maxY)/2*I,ie=.5*Math.hypot((m.maxX-m.minX)*I,(m.maxY-m.minY)*I)||10,ge=sc(H,G,{cx:J,cz:ae,radius:ie},[h,d]),Ae=sc(H,G,{cx:J,cz:ae,radius:ie}),be=X2(n),ke=ed(G,g,m,ge.minY,ge.maxY,ie,be),Ke=!B&&n.some(W=>W.objects.some(K=>K.type==="shape"&&co(K.stageKind))),Be=!!o.house&&!Ke&&!c&&(!!B||o.house.indoor),Fe=g.flatMap(W=>[[W.cx-W.halfX,W.cz-W.halfZ],[W.cx+W.halfX,W.cz-W.halfZ],[W.cx+W.halfX,W.cz+W.halfZ],[W.cx-W.halfX,W.cz+W.halfZ]]),Ge=Be?dh(G.iPosition,a.length,n[0]?.baseHeightM??0,[...Fe,...F],N):null;return{sharedAisles:Jl(n.flatMap(W=>W.objects.flatMap(K=>{if(K.type!=="section")return[];let Q=v.bySection.get(K.id);return Q?[{sectionId:K.id,floorIndex:W.index,rows:Q.rowLevels}]:[]}))),solids:H,sectionSolidRanges:x,seats:G,...ce?{crowd:ce}:{},...re.length?{areas:re}:{},...S.length?{areaSolidRanges:S}:{},seatSectionIds:v.seatOwner,bounds:{center:[(ke.min[0]+ke.max[0])/2,(ke.min[1]+ke.max[1])/2,(ke.min[2]+ke.max[2])/2],radius:ie,groundY:0,box:ke,fitPoints:Jf(G,g,be)},...B?{room:B}:{},...Ke?{outdoor:!0}:{},...Ge?{house:R?{...Ge,theatre:!0}:Ge}:{},renderBounds:{center:ge.center,radius:ge.radius},clipBounds:{center:Ae.center,radius:Ae.radius},stateColorLUT:lu(o,ct),theme:o,seatCount:a.length,focalWorld:[V.x*I,1.5,V.y*I],zones:j,stages:g,productionElements:i.elements,sections:U,rows:$,labels:D,floors:te}}function X2(e){let t=[];for(let n of e)for(let o of n.objects){let r=o.type==="gaArea"?o.points:o.type==="booth"?_t(o):null;for(let i of r??[])t.push([i.x*I,n.baseHeightM,i.y*I])}return t}var wn=require("ogl"),K2=.05,Y2=.55,$2=12,Z2=1.6,q2=1,Q2=2.5,J2=650,zn={height:6,baseRadius:.16,topRadius:.3,fadeInFromM:16,fullByM:40,nearStrength:.6};function eS(e,t){if(t)return 0;let n=(e-zn.fadeInFromM)/(zn.fullByM-zn.fadeInFromM);return Math.max(zn.nearStrength,Math.min(1,n))}var sd=24;function tS(e){let t=[],n=[],o=[],r=(m,h,f)=>{t.push(...m),n.push(...h),o.push(f)};for(let m=0;m<16;m++){let h=m/16*Math.PI*2,f=(m+1)/16*Math.PI*2,d=v=>[Math.cos(v),0,Math.sin(v)],p=[Math.cos(h)*.012,0,Math.sin(h)*.012],b=[Math.cos(f)*.012,0,Math.sin(f)*.012],y=[Math.cos(h)*.03,1,Math.sin(h)*.03],g=[Math.cos(f)*.03,1,Math.sin(f)*.03];r(p,d(h),0),r(y,d(h),0),r(g,d(f),0),r(p,d(h),0),r(g,d(f),0),r(b,d(f),0)}let c=.16,l=.24,u=.01;for(let m=0;m<48;m++){let h=m/48*Math.PI*2,f=(m+1)/48*Math.PI*2,d=[Math.cos(h)*c,u,Math.sin(h)*c],p=[Math.cos(h)*l,u,Math.sin(h)*l],b=[Math.cos(f)*l,u,Math.sin(f)*l],y=[Math.cos(f)*c,u,Math.sin(f)*c];for(let g of[d,p,b,d,b,y])r(g,[0,1,0],1)}for(let m=0;m<32;m++){let h=m/32*Math.PI*2,f=(m+1)/32*Math.PI*2,d=zn.baseRadius,p=zn.topRadius,b=[Math.cos(h)*d,0,Math.sin(h)*d],y=[Math.cos(f)*d,0,Math.sin(f)*d],g=[Math.cos(h)*p,1,Math.sin(h)*p],v=[Math.cos(f)*p,1,Math.sin(f)*p],P=[Math.cos(h),0,Math.sin(h)],w=[Math.cos(f),0,Math.sin(f)];r(b,P,2),r(g,P,2),r(v,w,2),r(b,P,2),r(v,w,2),r(y,w,2)}return new wn.Geometry(e,{position:{size:3,data:new Float32Array(t)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(o)}})}var nS=`#version 300 es
35
35
  precision highp float;
36
36
  in vec3 position; in vec3 normal; in float part;
37
37
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform mat3 normalMatrix;
@@ -58,7 +58,7 @@ void main() {
58
58
  float scale = part > 0.5 ? uRingScale : uHeight;
59
59
  vec3 world = uSeat + vec3(position.x, position.y * grow, position.z) * scale;
60
60
  gl_Position = projectionMatrix * modelViewMatrix * vec4(world, 1.0);
61
- }`,OM=`#version 300 es
61
+ }`,oS=`#version 300 es
62
62
  precision highp float;
63
63
  in vec3 vNormal; in float vPart; in float vAlong;
64
64
  uniform vec3 uColor; uniform float uRingAlpha; uniform vec3 uBeamColor; uniform float uBeam;
@@ -76,25 +76,25 @@ void main() {
76
76
  float key = max(dot(normalize(vNormal), normalize(vec3(-0.4, 0.7, 0.6))), 0.0);
77
77
  vec3 c = uColor * (0.55 + 0.5 * key) + vec3(0.12) * pow(key, 12.0);
78
78
  fragColor = vec4(c, 1.0);
79
- }`;function FM(e){if(e>=1)return 1;if(e<.72){let n=e/.72;return 1-(1-n)*(1-n)}let t=(e-.72)/.28;return 1-.08*Math.sin(t*Math.PI)}function us(e){return Math.max(AM,Math.min(RM,e*PM))}function DM(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=t>=.25?0:Math.min(.45,(.25-t)*2.2);return e.map(o=>o+(1-o)*n)}function kf(e,t,n=[.24,.74,1]){let o=DM(n),r=new nn.Transform,i=LM(e),a=new Map,s=(c,l)=>{let u=new nn.Program(e,{vertex:kM,fragment:OM,uniforms:{uSeat:{value:c},uHeight:{value:1},uLift:{value:0},uRingScale:{value:1},uBeamHeight:{value:wn.height},uBeam:{value:0},uBeamColor:{value:o},uColor:{value:t},uRingAlpha:{value:.85}},transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1}),m=new nn.Mesh(e,{geometry:i,program:u});return m.frustumCulled=!1,m.setParent(r),{mesh:m,program:u,seat:c,start:l}};return{root:r,setSeats(c,l,u){let m=new Set(c.slice(0,Lf).map(f=>f.id));for(let[f,h]of a)m.has(f)||(h.mesh.setParent(null),a.delete(f));for(let f of c.slice(0,Lf))a.has(f.id)||a.set(f.id,s(f.position,u?l:-1/0))},update(c,l,u,m=!1){let f=!1;for(let h of a.values()){let d=l[0]-h.seat[0],p=l[1]-h.seat[1],b=l[2]-h.seat[2],x=Math.hypot(d,p,b);h.mesh.visible=!u&&x>(m?IM:_M);let y=us(x),M=Math.max(0,Math.min(1,(c-h.start)/CM));M<1&&(f=!0),h.program.uniforms.uHeight.value=y,h.program.uniforms.uRingScale.value=Math.min(y,EM),h.program.uniforms.uLift.value=m?1:1-FM(M),h.program.uniforms.uBeam.value=TM(x,m),h.program.uniforms.uRingAlpha.value=.55+.4*(M<1?Math.sin(M*Math.PI):0)}return f},dispose(){for(let c of a.values())c.mesh.setParent(null);a.clear(),i.remove()}}}var NM={wheelchair:'<circle cx="10.6" cy="3.7" r="1.7" /><path d="M8.9 6.3v4.3a1.3 1.3 0 0 0 1.3 1.3h3.4l1.9 4.5h1.9" /><circle cx="9.7" cy="13.3" r="4.7" />',companion:'<circle cx="6" cy="6" r="2" /><circle cx="14" cy="6" r="2" /><path d="M2.5 16v-3.5A3.5 3.5 0 0 1 6 9a3.5 3.5 0 0 1 3.5 3.5V16M10.5 16v-3.5A3.5 3.5 0 0 1 14 9a3.5 3.5 0 0 1 3.5 3.5V16" />',"semi-ambulatory":'<circle cx="8" cy="4" r="1.7" /><path d="m8 6 2 4 3 2M10 10l-2 3-1 4M10 10l2 7M14 7l2 10" />',"designated-aisle":'<path d="M3.5 5.5v7h8.5V10H6.5M5 12.5V17M11 12.5V17" /><path d="M13.5 6.5H19M16.5 4l2.5 2.5L16.5 9" />',"step-free":'<circle cx="5.5" cy="5" r="1.7" /><path d="M5.5 7v4l3 2M2.5 16.5H8l7-7h3M8 16.5h10" />',hearing:'<path d="M7 16c-1-1.2-1.5-2.4-1.5-3.8V9a5 5 0 1 1 10 0c0 2.2-1.2 3.2-2.6 4-1.2.7-1.7 1.4-1.7 2.4A2.6 2.6 0 0 1 8.6 18" />',cart:'<path d="M8 6.5A4 4 0 1 0 8 13M17 6.5a4 4 0 1 0 0 6.5" />',"sign-language":'<path d="M6 16V8.5a1 1 0 0 1 2 0v3M8 11V5.5a1 1 0 0 1 2 0V11M10 11V4.5a1 1 0 0 1 2 0V11M12 11V6a1 1 0 0 1 2 0v6l1-1.5a1.2 1.2 0 0 1 2 1.3L14 17H9.5A3.5 3.5 0 0 1 6 13.5" />',"low-vision":'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><circle cx="10" cy="10" r="2.5" /><path d="m15 4 .5-1.5M17 5l1.5-.8" />',"sensory-friendly":'<path d="M4 11v-1a6 6 0 0 1 12 0v1M4 11h2.5v5H5a1 1 0 0 1-1-1v-4ZM16 11h-2.5v5H15a1 1 0 0 0 1-1v-4Z" /><path d="M8.5 11.5c.8.7 2.2.7 3 0M9 14c.6.4 1.4.4 2 0" />',"plus-size":'<path d="M5 9V6.5A2.5 2.5 0 0 1 7.5 4h5A2.5 2.5 0 0 1 15 6.5V9M3.5 8.5v5h13v-5M6 13.5V17M14 13.5V17" />',"lift-armrest":'<path d="M5 10V6.5A2.5 2.5 0 0 1 7.5 4h4A2.5 2.5 0 0 1 14 6.5V10M4 9v4h11V9M6 13v4M13 13v4" /><path d="M17 11V4M15 6l2-2 2 2" />',obstructedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="m4 17 12-14" />',restrictedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="M10 7.5v3.5M10 13.5h.01" />',premium:'<path d="m10 2.5 2.2 4.6 5 .7-3.6 3.5.9 5-4.5-2.4-4.5 2.4.9-5-3.6-3.5 5-.7Z" />',note:'<circle cx="10" cy="10" r="7.5" /><path d="M10 9.2v4.6M10 6.3h.01" />',aisle:'<path d="M2.5 6v7h6.5v-2.5H4.5M3.5 13v3.5M8 13v3.5" /><path d="M12.5 3v14M17 3v14" />',entrance:'<path d="M10 3.5h6.5v13H10" /><path d="M3 10h8.5M8.5 7l3 3-3 3" />',booth:'<path d="M3.5 8.5h13v8h-13ZM2.5 8.5 4 4h12l1.5 4.5M8 16.5v-4h4v4" />'};function BM(e){return NM[e]??""}function ti(e,t={}){let n=BM(e);if(!n)return"";let o=t.size??18,r=20;return`<svg viewBox="0 0 ${r} ${r}" width="${o}" height="${o}" fill="none" stroke="currentColor" stroke-width="1.45" stroke-linecap="round" stroke-linejoin="round"`+(t.className?` class="${t.className}"`:"")+` aria-hidden="true" focusable="false">${n}</svg>`}var Xo="#ffffff",Of="#0b1220",Ko=6,VM=80,Ff=14,Df=88,Nf=20,Bf={floor:{size:14,weight:"700",opacity:.98},stage:{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},gate:{size:12,weight:"700",opacity:.98},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1},access:{size:12,weight:"700",opacity:1}},GM=640,HM=.8,zM=11,UM="3px 7px",jM="2px 5px",Vf="rgba(10,14,22,.62)",WM="#f4f7fb",Gf=5,Hf=2,XM=6,Yo=new Set(["row","seat","access"]),ms={stage:6,gate:5,floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},oo={row:{x:66,y:20},seat:{x:52,y:22}},Pn=ve,fs=e=>mc(e);function An(e,t){let n=fs(e),o=fs(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function KM(e){let t=Pn(e);if(!t)return null;let n=i=>`#${i.map(a=>Math.round(Math.max(0,Math.min(1,a))*255).toString(16).padStart(2,"0")).join("")}`,o=t.map(i=>i+(1-i)*.78),r=t.map(i=>i*.62);for(let i=0;i<12&&An(r,o)<4.5;i++)r=r.map(a=>a*.8);return{fill:n(o),ink:n(r),border:n(t.map(i=>i+(1-i)*.35)),contrast:An(r,o)}}var YM=30;function hs(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let o=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(r=>Number(n[r])/255*o+t[r-1]*(1-o))}function $M(e,t=[.04,.06,.1],n=!0){let o=fs(t)<.42,r=o?"#f4f7fb":"#0b1220",i=o?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?hs(i,t):t,s=Pn(e),c=n?7:4.5,l=s&&An(s,a)>=c?e:r;return o?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}function ZM(e,t=[.04,.06,.1]){let n=hs(Vf,t),o=Pn(e);return{ink:o&&An(o,n)>=4.5?e:WM,backing:Vf}}var qM=.8,ro=20,QM=14,JM=60,ev='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',ni=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.wheelchairFree=new Map;this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.overviewDistance=null;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.seatNumberRow=void 0;this.seatNumberSeat=null;this.pinHeads=[];this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let o=this.root.style;o.position="absolute",o.inset="0",o.pointerEvents="none",o.overflow="hidden",o.fontFamily=n.fontFamily||ev,t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;let n=new Set(t.map(o=>o.id));for(let[o,r]of this.nodes)n.has(o)||(r.remove(),this.nodes.delete(o))}setForcedDense(t){this.forcedDense=t}setOverviewDistance(t){this.overviewDistance=t>0?t:null}setSeatNumberRow(t){return t===this.seatNumberRow?!1:(this.seatNumberRow=t,!0)}setSeatNumberSeat(t){let n=t?`seat:${t}`:null;return n===this.seatNumberSeat?!1:(this.seatNumberSeat=n,!0)}setWheelchairFree(t){let n=t.size!==this.wheelchairFree.size;if(!n){for(let[o,r]of t)if(this.wheelchairFree.get(o)!==r){n=!0;break}}return n&&(this.wheelchairFree=new Map(t)),n}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}sizeFor(t){let n=Bf[t].size;return!this.narrowStage||Yo.has(t)?n:Math.max(zM,n*HM)}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(o=>{let r=this.nodes.get(o.id),i=r?.getBoundingClientRect(),a=!!(n&&r&&r.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:o.id,kind:o.kind,text:o.text,visible:a,renderedFontPx:r&&Number.parseFloat(r.style.fontSize)||0,contrast:r?Number(r.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,o,r,i,a){if(!this.labels.length)return;this.narrowStage=n>0&&n<GM;let s=tf(r,i,{hasZoneLabels:this.labels.some(v=>v.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"),s.add("access")),!this.forcedDense&&this.overviewDistance!==null&&r>this.overviewDistance*qM&&(s.delete("section"),s.delete("ga")),s.has("section")&&this.labels.some(v=>v.kind==="section")&&s.delete("zone");let c=[];for(let v of this.labels){let P=v.kind==="annotation"&&!!v.venueIcon;if(!s.has(v.kind)&&!P&&!(v.kind==="seat"&&this.selectedSeatLabelIds.has(v.id)))continue;let E=v.kind==="seat"&&a&&this.selectedSeatLabelIds.has(v.id)?v.pinBase:void 0,k=E&&a?[E[0],E[1]+us(Math.hypot(E[0]-a[0],E[1]-a[1],E[2]-a[2])),E[2]]:v.anchor,L=Ot(t,k,n,o);if(!L.visible)continue;let I=Yo.has(v.kind),R=this.sizeFor(v.kind),_=v.kind==="access"?ro:rf(v.text,R,!I)+(I?Gf*2:0)+((this.wheelchairFree.get(v.id)??0)>0?YM:0);if(v.kind==="access"&&v.seatWidthM!==void 0&&es(t,v.anchor,v.seatWidthM,n)<QM||v.kind==="seat"&&v.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(v.id)&&es(t,v.anchor,v.seatWidthM,n)<Math.max(22,_))continue;let F=nf(L,_/2,R/2+(I?Hf:4),n,o),N=a?Math.hypot(v.anchor[0]-a[0],v.anchor[1]-a[1],v.anchor[2]-a[2]):1;c.push({label:v,screen:F,focus:sf(F,N,n,o),halfWidth:_/2,...this.selectedSeatLabelIds.has(v.id)?{priority:1}:{}})}let l=ef(c.filter(v=>v.label.kind==="floor"),n),u=[...c.filter(v=>!Yo.has(v.label.kind)&&v.label.kind!=="floor"),...l],m=af(n),f=c.filter(v=>v.label.kind==="seat"&&this.selectedSeatLabelIds.has(v.label.id)),h=Uo(f,oo.seat.x,oo.seat.y,m.seat);this.placePinHeads(f.filter(v=>v.label.pinBase&&!h.includes(v)).map(v=>v.screen));let d=of(u,Df,Nf,v=>ms[v.label.kind]??0).filter(v=>!h.some(P=>zo(v,P,Df,Nf))),p=Uo(c.filter(v=>v.label.kind==="access"),ro,ro,JM,[...d,...h]),b=Uo(c.filter(v=>v.label.kind==="row"),oo.row.x,oo.row.y,m.row,[...d,...h,...p]),x=this.seatNumberRow!==void 0||this.seatNumberSeat!==null,y=Uo(c.filter(v=>v.label.kind==="seat"&&!this.selectedSeatLabelIds.has(v.label.id)&&(this.seatNumberSeat!==null?v.label.id===this.seatNumberSeat:!x||this.seatNumberRow!==null&&v.label.rowId===this.seatNumberRow)),oo.seat.x,oo.seat.y,x?VM:m.seat-h.length,[...d,...h,...p,...b]),M=[...d,...p,...b,...h,...y],A=new Set(M.map(v=>v.label.id));for(let{label:v,screen:P}of M){let k=this.nodeFor(v).style;k.display=v.kind==="access"?"flex":v.kind==="gate"?"inline-flex":"";let L=!!v.pinBase&&this.selectedSeatLabelIds.has(v.id);k.transform=L?`translate(-50%, -100%) translate(${P.x.toFixed(1)}px, ${(P.y-Ko).toFixed(1)}px)`:`translate(-50%, -50%) translate(${P.x.toFixed(1)}px, ${P.y.toFixed(1)}px)`}let g=M.filter(({label:v})=>!Yo.has(v.kind)).sort((v,P)=>ms[P.label.kind]-ms[v.label.kind]||v.screen.depth-P.screen.depth||v.focus-P.focus).flatMap(({label:v})=>{let P=this.nodes.get(v.id);return P&&P.style.display!=="none"?[{node:P,box:P.getBoundingClientRect()}]:[]}),S=[];for(let{node:v,box:P}of g)S.some(k=>P.left<k.right+3&&P.right+3>k.left&&P.top<k.bottom+3&&P.bottom+3>k.top)?v.style.display="none":S.push(P);for(let[v,P]of this.nodes)A.has(v)||(P.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let x=n.style;x.position="absolute",x.left="0",x.top="0",x.whiteSpace="nowrap",x.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}let o=this.selectedSeatLabelIds.has(t.id),r=this.nodeAppearance.get(n),i=this.wheelchairFree.get(t.id)??0,a=t.text+(t.icon??"")+(t.venueIcon??"")+(t.tint??"")+(i>0?`|${i}`:"");if(r&&r.text===a&&r.kind===t.kind&&r.color===t.color&&r.selected===o&&r.narrow===this.narrowStage)return n;if(this.nodeAppearance.set(n,{text:a,kind:t.kind,color:t.color,selected:o,narrow:this.narrowStage}),t.kind==="access")return this.paintAccessChip(n,t);if(n.textContent=t.text,o){let x=document.createElement("span"),y=x.style;y.position="absolute",y.left="50%",y.bottom=`-${Ko}px`,y.transform="translateX(-50%)",y.borderLeft=`${Ko}px solid transparent`,y.borderRight=`${Ko}px solid transparent`,y.borderTop=`${Ko}px solid ${Xo}`,n.appendChild(x)}n.setAttribute("data-label-kind",t.kind),n.toggleAttribute("data-selected-seat",o);let s=Bf[t.kind],c=n.style;c.fontSize=`${this.sizeFor(t.kind)}px`,c.fontWeight=o?"800":s.weight,c.opacity=o?"1":String(s.opacity);let l=Yo.has(t.kind),u=!l,m=$M(t.color??this.opts.ink,this.opts.backgroundRgb,!0),f=l?ZM(t.color??this.opts.ink,this.opts.backgroundRgb):m;c.color=o?Of:f.ink,c.background=o?Xo:f.backing,c.border=o?`1px solid ${Xo}`:u?`1px solid ${m.border}`:"",c.borderRadius=o||u?"999px":`${XM}px`;let h=this.narrowStage?jM:UM;c.padding=o||u?h:`${Hf}px ${Gf}px`,c.lineHeight=l?"1.1":"",c.boxShadow=o?"0 0 0 3px rgba(255,255,255,.28), 0 0 18px rgba(255,255,255,.55), 0 5px 14px rgba(0,0,0,.45)":u?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",c.textShadow=o||u?"none":"0 1px 1px rgba(0,0,0,0.4)",c.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let d=this.opts.backgroundRgb??[.04,.06,.1],p=Pn(o?Of:f.ink)??[1,1,1],b=hs(o?Xo:f.backing,d);return n.dataset.qualityContrast=An(p,b).toFixed(3),c.textTransform=t.kind==="zone"||t.kind==="floor"?"uppercase":"",t.kind==="section"&&this.dressSectionTag(n,t,i),t.kind==="gate"&&this.dressGateTag(n,t),t.venueIcon&&this.dressVenueIconTag(n,t.venueIcon),n}dressVenueIconTag(t,n){let o=Fo(n);if(!o)return;let r=t.style;r.display="inline-flex",r.alignItems="center",r.gap="5px";let i=16,a=_a.glyphScale,s=document.createElement("span");s.setAttribute("aria-hidden","true"),s.setAttribute("data-venue-icon",o.key),s.style.lineHeight="0",s.innerHTML=`<svg width="${i}" height="${i}" viewBox="0 0 24 24"><circle cx="12" cy="12" r="11.25" fill="${Ia[o.group]}" stroke="${Br}" stroke-width="1.5"/><path transform="translate(${12-12*a} ${12-12*a}) scale(${a})" d="${o.solid}" fill="${Br}"/></svg>`,t.prepend(s)}dressGateTag(t,n){let o=t.style;o.background="#0f172a",o.color="#ffffff",o.border="1px solid rgba(255,255,255,0.28)",o.textTransform="uppercase",o.letterSpacing="0.06em",o.display="inline-flex",o.alignItems="center",o.gap="5px";let r=document.createElement("span");if(r.setAttribute("aria-hidden","true"),r.setAttribute("data-gate-arrow",n.icon==="exit"?"out":"in"),r.innerHTML=n.icon==="exit"?'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M5 1.5H2v9h3"/><path d="M5.5 6h5M8.5 3.5 11 6 8.5 8.5"/></svg>':'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M7 1.5h3v9H7"/><path d="M1 6h5.5M4 3.5 6.5 6 4 8.5"/></svg>',t.prepend(r),n.stepFree){let i=document.createElement("span");i.setAttribute("data-gate-step-free","true"),i.setAttribute("aria-label","Step-free"),i.style.lineHeight="0",i.innerHTML=ti("wheelchair",{size:11}),t.append(i)}t.dataset.qualityContrast=An([1,1,1],Pn("#0f172a")).toFixed(3)}dressSectionTag(t,n,o){let r=n.tint?KM(n.tint):null,i=t.style;if(r&&(i.background=r.fill,i.color=r.ink,i.border=`1px solid ${r.border}`,t.dataset.qualityContrast=r.contrast.toFixed(3)),o<=0)return;let a=document.createElement("span");a.setAttribute("data-wheelchair-free",String(o)),a.setAttribute("aria-label",`${o} wheelchair ${o===1?"place":"places"} free`),a.innerHTML=`${ti("wheelchair",{size:11})}<span>${o}</span>`;let s=a.style;s.display="inline-flex",s.alignItems="center",s.gap="2px",s.marginLeft="6px",s.padding="1px 5px",s.borderRadius="999px",s.background="#2563eb",s.color="#ffffff",s.fontSize="0.85em",s.lineHeight="1.2",s.verticalAlign="middle",t.appendChild(a)}paintAccessChip(t,n){t.setAttribute("data-label-kind","access"),t.setAttribute("data-access-type",n.icon??""),t.innerHTML=n.icon?ti(n.icon,{size:ro-6}):"",t.setAttribute("role","img"),t.setAttribute("aria-label",n.text);let o=t.style;return o.width=`${ro}px`,o.height=`${ro}px`,o.alignItems="center",o.justifyContent="center",o.borderRadius="50%",o.background=n.color??"#3b82f6",o.color=n.ink??"#ffffff",o.border="1.5px solid #ffffff",o.boxShadow="0 2px 6px rgba(0,0,0,.35)",o.padding="0",o.lineHeight="0",o.boxSizing="border-box",t.dataset.qualityContrast=An(Pn(n.ink??"#ffffff")??[1,1,1],Pn(n.color??"#3b82f6")??[.23,.51,.96]).toFixed(3),t}placePinHeads(t){for(;this.pinHeads.length<t.length;){let n=document.createElement("div");n.setAttribute("data-pin-head",""),n.setAttribute("aria-hidden","true");let o=n.style;o.position="absolute",o.left="0",o.top="0",o.width=`${Ff}px`,o.height=`${Ff}px`,o.borderRadius="50%",o.background=Xo,o.boxShadow="0 0 0 3px rgba(255,255,255,.28), 0 0 14px rgba(255,255,255,.55), 0 3px 8px rgba(0,0,0,.45)",o.pointerEvents="none",this.root.appendChild(n),this.pinHeads.push(n)}this.pinHeads.forEach((n,o)=>{let r=t[o];n.style.display=r?"":"none",r&&(n.style.transform=`translate(-50%, -100%) translate(${r.x.toFixed(1)}px, ${r.y.toFixed(1)}px)`)})}dispose(){this.pinHeads=[],this.root.remove(),this.nodes.clear()}};var Uf=1;var tv=new Set(["floor","stage","zone","section","ga","booth","annotation"]);function nv(e){return e.every(t=>Number.isFinite(t))}function ov(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 zf(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Rn(e){return Math.round(e*1e4)/1e4}function rv(e){if(e)return{box:{x:Rn(e.box.x),y:Rn(e.box.y),width:Rn(e.box.width),height:Rn(e.box.height)},horizontalFillRatio:Rn(e.horizontalFillRatio),verticalFillRatio:Rn(e.verticalFillRatio),visibleAreaRatio:Rn(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Ft(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function oi(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>tv.has(s.kind)),o=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,r=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)ov(n[s].screenBox,n[c].screenBox)&&r.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=[Ft("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Ft("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Ft("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Ft("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}`}]),Ft("camera-invalid","The capture camera must have a finite physical pose",nv(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Ft("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}]),Ft("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",o===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${o} expected hierarchy labels`}]),Ft("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}))),Ft("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}))),Ft("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",r)].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:rv(e.framing)},metrics:{minimumHierarchyFontPx:zf(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:zf(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}function jf(e,t,n){e.fill(0);for(let o=0;o<Math.min(n,t.length);o++)e[t[o]]=1}var ze=require("ogl");var on=require("ogl");var ri=`
79
+ }`;function rS(e){if(e>=1)return 1;if(e<.72){let n=e/.72;return 1-(1-n)*(1-n)}let t=(e-.72)/.28;return 1-.08*Math.sin(t*Math.PI)}function cc(e){return Math.max(Y2,Math.min($2,e*K2))}function iS(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=t>=.25?0:Math.min(.45,(.25-t)*2.2);return e.map(o=>o+(1-o)*n)}function cd(e,t,n=[.24,.74,1]){let o=iS(n),r=new wn.Transform,i=tS(e),a=new Map,s=(c,l)=>{let u=new wn.Program(e,{vertex:nS,fragment:oS,uniforms:{uSeat:{value:c},uHeight:{value:1},uLift:{value:0},uRingScale:{value:1},uBeamHeight:{value:zn.height},uBeam:{value:0},uBeamColor:{value:o},uColor:{value:t},uRingAlpha:{value:.85}},transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1}),m=new wn.Mesh(e,{geometry:i,program:u});return m.frustumCulled=!1,m.setParent(r),{mesh:m,program:u,seat:c,start:l}};return{root:r,setSeats(c,l,u){let m=new Set(c.slice(0,sd).map(h=>h.id));for(let[h,f]of a)m.has(h)||(f.mesh.setParent(null),a.delete(h));for(let h of c.slice(0,sd))a.has(h.id)||a.set(h.id,s(h.position,u?l:-1/0))},update(c,l,u,m=!1){let h=!1;for(let f of a.values()){let d=l[0]-f.seat[0],p=l[1]-f.seat[1],b=l[2]-f.seat[2],y=Math.hypot(d,p,b);f.mesh.visible=!u&&y>(m?q2:Q2);let g=cc(y),v=Math.max(0,Math.min(1,(c-f.start)/J2));v<1&&(h=!0),f.program.uniforms.uHeight.value=g,f.program.uniforms.uRingScale.value=Math.min(g,Z2),f.program.uniforms.uLift.value=m?1:1-rS(v),f.program.uniforms.uBeam.value=eS(y,m),f.program.uniforms.uRingAlpha.value=.55+.4*(v<1?Math.sin(v*Math.PI):0)}return h},dispose(){for(let c of a.values())c.mesh.setParent(null);a.clear(),i.remove()}}}var aS={wheelchair:'<circle cx="10.6" cy="3.7" r="1.7" /><path d="M8.9 6.3v4.3a1.3 1.3 0 0 0 1.3 1.3h3.4l1.9 4.5h1.9" /><circle cx="9.7" cy="13.3" r="4.7" />',companion:'<circle cx="6" cy="6" r="2" /><circle cx="14" cy="6" r="2" /><path d="M2.5 16v-3.5A3.5 3.5 0 0 1 6 9a3.5 3.5 0 0 1 3.5 3.5V16M10.5 16v-3.5A3.5 3.5 0 0 1 14 9a3.5 3.5 0 0 1 3.5 3.5V16" />',"semi-ambulatory":'<circle cx="8" cy="4" r="1.7" /><path d="m8 6 2 4 3 2M10 10l-2 3-1 4M10 10l2 7M14 7l2 10" />',"designated-aisle":'<path d="M3.5 5.5v7h8.5V10H6.5M5 12.5V17M11 12.5V17" /><path d="M13.5 6.5H19M16.5 4l2.5 2.5L16.5 9" />',"step-free":'<circle cx="5.5" cy="5" r="1.7" /><path d="M5.5 7v4l3 2M2.5 16.5H8l7-7h3M8 16.5h10" />',hearing:'<path d="M7 16c-1-1.2-1.5-2.4-1.5-3.8V9a5 5 0 1 1 10 0c0 2.2-1.2 3.2-2.6 4-1.2.7-1.7 1.4-1.7 2.4A2.6 2.6 0 0 1 8.6 18" />',cart:'<path d="M8 6.5A4 4 0 1 0 8 13M17 6.5a4 4 0 1 0 0 6.5" />',"sign-language":'<path d="M6 16V8.5a1 1 0 0 1 2 0v3M8 11V5.5a1 1 0 0 1 2 0V11M10 11V4.5a1 1 0 0 1 2 0V11M12 11V6a1 1 0 0 1 2 0v6l1-1.5a1.2 1.2 0 0 1 2 1.3L14 17H9.5A3.5 3.5 0 0 1 6 13.5" />',"low-vision":'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><circle cx="10" cy="10" r="2.5" /><path d="m15 4 .5-1.5M17 5l1.5-.8" />',"sensory-friendly":'<path d="M4 11v-1a6 6 0 0 1 12 0v1M4 11h2.5v5H5a1 1 0 0 1-1-1v-4ZM16 11h-2.5v5H15a1 1 0 0 0 1-1v-4Z" /><path d="M8.5 11.5c.8.7 2.2.7 3 0M9 14c.6.4 1.4.4 2 0" />',"plus-size":'<path d="M5 9V6.5A2.5 2.5 0 0 1 7.5 4h5A2.5 2.5 0 0 1 15 6.5V9M3.5 8.5v5h13v-5M6 13.5V17M14 13.5V17" />',"lift-armrest":'<path d="M5 10V6.5A2.5 2.5 0 0 1 7.5 4h4A2.5 2.5 0 0 1 14 6.5V10M4 9v4h11V9M6 13v4M13 13v4" /><path d="M17 11V4M15 6l2-2 2 2" />',obstructedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="m4 17 12-14" />',restrictedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="M10 7.5v3.5M10 13.5h.01" />',premium:'<path d="m10 2.5 2.2 4.6 5 .7-3.6 3.5.9 5-4.5-2.4-4.5 2.4.9-5-3.6-3.5 5-.7Z" />',note:'<circle cx="10" cy="10" r="7.5" /><path d="M10 9.2v4.6M10 6.3h.01" />',aisle:'<path d="M2.5 6v7h6.5v-2.5H4.5M3.5 13v3.5M8 13v3.5" /><path d="M12.5 3v14M17 3v14" />',entrance:'<path d="M10 3.5h6.5v13H10" /><path d="M3 10h8.5M8.5 7l3 3-3 3" />',booth:'<path d="M3.5 8.5h13v8h-13ZM2.5 8.5 4 4h12l1.5 4.5M8 16.5v-4h4v4" />'};function sS(e){return aS[e]??""}function Qi(e,t={}){let n=sS(e);if(!n)return"";let o=t.size??18,r=20;return`<svg viewBox="0 0 ${r} ${r}" width="${o}" height="${o}" fill="none" stroke="currentColor" stroke-width="1.45" stroke-linecap="round" stroke-linejoin="round"`+(t.className?` class="${t.className}"`:"")+` aria-hidden="true" focusable="false">${n}</svg>`}var Un="#ffffff",lc="#0b1220",Tr=6,cS=80,ld=14,ud=88,md=20,hd={floor:{size:14,weight:"700",opacity:.98},stage:{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},gate:{size:12,weight:"700",opacity:.98},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1},access:{size:12,weight:"700",opacity:1}},lS=640,uS=.8,mS=11,hS="3px 7px",fS="2px 5px",fd="rgba(10,14,22,.62)",dS="#f4f7fb",dd=5,pd=2,pS=6,kr=new Set(["row","seat","access"]),uc={stage:6,gate:5,floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Fo={row:{x:66,y:20},seat:{x:52,y:22}},Wn=Ie,mc=e=>hl(e);function jn(e,t){let n=mc(e),o=mc(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function bS(e){let t=Wn(e);if(!t)return null;let n=i=>`#${i.map(a=>Math.round(Math.max(0,Math.min(1,a))*255).toString(16).padStart(2,"0")).join("")}`,o=t.map(i=>i+(1-i)*.78),r=t.map(i=>i*.62);for(let i=0;i<12&&jn(r,o)<4.5;i++)r=r.map(a=>a*.8);return{fill:n(o),ink:n(r),border:n(t.map(i=>i+(1-i)*.35)),contrast:jn(r,o)}}var gS=30,yS=30,xS=.62;function hc(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let o=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(r=>Number(n[r])/255*o+t[r-1]*(1-o))}function MS(e,t=[.04,.06,.1],n=!0){let o=mc(t)<.42,r=o?"#f4f7fb":"#0b1220",i=o?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?hc(i,t):t,s=Wn(e),c=n?7:4.5,l=s&&jn(s,a)>=c?e:r;return o?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}function vS(e,t=[.04,.06,.1]){let n=hc(fd,t),o=Wn(e);return{ink:o&&jn(o,n)>=4.5?e:dS,backing:fd}}var SS=.8,Do=20,wS=14,PS=60,AS='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Ji=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.wheelchairFree=new Map;this.placedTags=[];this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.overviewDistance=null;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.seatNumberRow=void 0;this.seatNumberSeat=null;this.pinHeads=[];this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let o=this.root.style;o.position="absolute",o.inset="0",o.pointerEvents="none",o.overflow="hidden",o.fontFamily=n.fontFamily||AS,t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}tagAt(t,n){if(this.root.style.visibility==="hidden")return null;for(let o of this.placedTags)if(t>=o.left&&t<=o.right&&n>=o.top&&n<=o.bottom)return o.id;return null}setLabels(t){this.labels=t;let n=new Set(t.map(o=>o.id));for(let[o,r]of this.nodes)n.has(o)||(r.remove(),this.nodes.delete(o))}setForcedDense(t){this.forcedDense=t}setOverviewDistance(t){this.overviewDistance=t>0?t:null}setSeatNumberRow(t){return t===this.seatNumberRow?!1:(this.seatNumberRow=t,!0)}setSeatNumberSeat(t){let n=t?`seat:${t}`:null;return n===this.seatNumberSeat?!1:(this.seatNumberSeat=n,!0)}setWheelchairFree(t){let n=t.size!==this.wheelchairFree.size;if(!n){for(let[o,r]of t)if(this.wheelchairFree.get(o)!==r){n=!0;break}}return n&&(this.wheelchairFree=new Map(t)),n}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}sizeFor(t){let n=hd[t].size;return!this.narrowStage||kr.has(t)?n:Math.max(mS,n*uS)}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(o=>{let r=this.nodes.get(o.id),i=r?.getBoundingClientRect(),a=!!(n&&r&&r.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:o.id,kind:o.kind,text:o.text,visible:a,renderedFontPx:r&&Number.parseFloat(r.style.fontSize)||0,contrast:r?Number(r.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,o,r,i,a){if(!this.labels.length){this.placedTags=[];return}this.narrowStage=n>0&&n<lS;let s=If(r,i,{hasZoneLabels:this.labels.some(M=>M.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"),s.add("access")),!this.forcedDense&&this.overviewDistance!==null&&r>this.overviewDistance*SS&&(s.delete("section"),s.delete("ga")),s.has("section")&&this.labels.some(M=>M.kind==="section")&&s.delete("zone");let c=[];for(let M of this.labels){let E=M.kind==="annotation"&&!!M.venueIcon;if(!s.has(M.kind)&&!E&&!(M.kind==="seat"&&this.selectedSeatLabelIds.has(M.id)))continue;let T=M.kind==="seat"&&a&&this.selectedSeatLabelIds.has(M.id)?M.pinBase:void 0,k=T&&a?[T[0],T[1]+cc(Math.hypot(T[0]-a[0],T[1]-a[1],T[2]-a[2])),T[2]]:M.anchor,_=en(t,k,n,o);if(!_.visible)continue;let R=kr.has(M.kind),C=this.sizeFor(M.kind),O=M.kind==="access"?Do:Tf(M.text,C,!R)+(R?dd*2:0)+((this.wheelchairFree.get(M.id)??0)>0?gS:0)+((M.count??0)>0?yS:0);if(M.kind==="access"&&M.seatWidthM!==void 0&&Qs(t,M.anchor,M.seatWidthM,n)<wS||M.kind==="seat"&&M.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(M.id)&&Qs(t,M.anchor,M.seatWidthM,n)<Math.max(22,O))continue;let B=_f(_,O/2,C/2+(R?pd:4),n,o),F=a?Math.hypot(M.anchor[0]-a[0],M.anchor[1]-a[1],M.anchor[2]-a[2]):1;c.push({label:M,screen:B,focus:Lf(B,F,n,o),halfWidth:O/2,...this.selectedSeatLabelIds.has(M.id)?{priority:1}:{}})}let l=Ef(c.filter(M=>M.label.kind==="floor"),n),u=[...c.filter(M=>!kr.has(M.label.kind)&&M.label.kind!=="floor"),...l],m=kf(n),h=c.filter(M=>M.label.kind==="seat"&&this.selectedSeatLabelIds.has(M.label.id)),f=Ir(h,Fo.seat.x,Fo.seat.y,m.seat);this.placePinHeads(h.filter(M=>M.label.pinBase&&!f.includes(M)).map(M=>M.screen));let d=Cf(u,ud,md,M=>uc[M.label.kind]??0).filter(M=>!f.some(E=>Er(M,E,ud,md))),p=Ir(c.filter(M=>M.label.kind==="access"),Do,Do,PS,[...d,...f]),b=Ir(c.filter(M=>M.label.kind==="row"),Fo.row.x,Fo.row.y,m.row,[...d,...f,...p]),y=this.seatNumberRow!==void 0||this.seatNumberSeat!==null,g=Ir(c.filter(M=>M.label.kind==="seat"&&!this.selectedSeatLabelIds.has(M.label.id)&&(this.seatNumberSeat!==null?M.label.id===this.seatNumberSeat:!y||this.seatNumberRow!==null&&M.label.rowId===this.seatNumberRow)),Fo.seat.x,Fo.seat.y,y?cS:m.seat-f.length,[...d,...f,...p,...b]),v=[...d,...p,...b,...f,...g],P=new Set(v.map(M=>M.label.id));for(let{label:M,screen:E}of v){let k=this.nodeFor(M).style;k.display=M.kind==="access"?"flex":M.kind==="gate"?"inline-flex":"";let _=!!M.pinBase&&this.selectedSeatLabelIds.has(M.id);k.transform=_?`translate(-50%, -100%) translate(${E.x.toFixed(1)}px, ${(E.y-Tr).toFixed(1)}px)`:`translate(-50%, -50%) translate(${E.x.toFixed(1)}px, ${E.y.toFixed(1)}px)`}let x=v.filter(({label:M})=>!kr.has(M.kind)).sort((M,E)=>uc[E.label.kind]-uc[M.label.kind]||M.screen.depth-E.screen.depth||M.focus-E.focus).flatMap(({label:M})=>{let E=this.nodes.get(M.id);return E&&E.style.display!=="none"?[{id:M.id,node:E,box:E.getBoundingClientRect()}]:[]}),S=[],A=[];for(let{id:M,node:E,box:T}of x)S.some(_=>T.left<_.right+3&&T.right+3>_.left&&T.top<_.bottom+3&&T.bottom+3>_.top)?E.style.display="none":(S.push(T),T.width>0&&T.height>0&&A.push({id:M,left:T.left,right:T.right,top:T.top,bottom:T.bottom}));this.placedTags=A;for(let[M,E]of this.nodes)P.has(M)||(E.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let y=n.style;y.position="absolute",y.left="0",y.top="0",y.whiteSpace="nowrap",y.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}let o=this.selectedSeatLabelIds.has(t.id),r=this.nodeAppearance.get(n),i=this.wheelchairFree.get(t.id)??0,a=t.text+(t.icon??"")+(t.venueIcon??"")+(t.tint??"")+(i>0?`|${i}`:"")+((t.count??0)>0?`|x${t.count}`:"")+(t.muted?"|muted":"");if(r&&r.text===a&&r.kind===t.kind&&r.color===t.color&&r.selected===o&&r.narrow===this.narrowStage)return n;if(this.nodeAppearance.set(n,{text:a,kind:t.kind,color:t.color,selected:o,narrow:this.narrowStage}),t.kind==="access")return this.paintAccessChip(n,t);if(n.textContent=t.text,o){let y=document.createElement("span"),g=y.style;g.position="absolute",g.left="50%",g.bottom=`-${Tr}px`,g.transform="translateX(-50%)",g.borderLeft=`${Tr}px solid transparent`,g.borderRight=`${Tr}px solid transparent`,g.borderTop=`${Tr}px solid ${Un}`,n.appendChild(y)}n.setAttribute("data-label-kind",t.kind),n.toggleAttribute("data-selected-seat",o);let s=hd[t.kind],c=n.style;c.fontSize=`${this.sizeFor(t.kind)}px`,c.fontWeight=o?"800":s.weight,c.opacity=o?"1":String(s.opacity);let l=kr.has(t.kind),u=!l,m=MS(t.color??this.opts.ink,this.opts.backgroundRgb,!0),h=l?vS(t.color??this.opts.ink,this.opts.backgroundRgb):m;c.color=o?lc:h.ink,c.background=o?Un:h.backing,c.border=o?`1px solid ${Un}`:u?`1px solid ${m.border}`:"",c.borderRadius=o||u?"999px":`${pS}px`;let f=this.narrowStage?fS:hS;c.padding=o||u?f:`${pd}px ${dd}px`,c.lineHeight=l?"1.1":"",c.boxShadow=o?"0 0 0 3px rgba(255,255,255,.28), 0 0 18px rgba(255,255,255,.55), 0 5px 14px rgba(0,0,0,.45)":u?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",c.textShadow=o||u?"none":"0 1px 1px rgba(0,0,0,0.4)",c.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let d=this.opts.backgroundRgb??[.04,.06,.1],p=Wn(o?lc:h.ink)??[1,1,1],b=hc(o?Un:h.backing,d);return n.dataset.qualityContrast=jn(p,b).toFixed(3),c.textTransform=t.kind==="zone"||t.kind==="floor"?"uppercase":"",t.kind==="section"&&this.dressSectionTag(n,t,i),t.kind==="gate"&&this.dressGateTag(n,t),t.kind==="ga"&&this.dressAreaTag(n,t),t.venueIcon&&this.dressVenueIconTag(n,t.venueIcon),n}dressVenueIconTag(t,n){let o=xr(n);if(!o)return;let r=t.style;r.display="inline-flex",r.alignItems="center",r.gap="5px";let i=16,a=Rs.glyphScale,s=document.createElement("span");s.setAttribute("aria-hidden","true"),s.setAttribute("data-venue-icon",o.key),s.style.lineHeight="0",s.innerHTML=`<svg width="${i}" height="${i}" viewBox="0 0 24 24"><circle cx="12" cy="12" r="11.25" fill="${As[o.group]}" stroke="${Oi}" stroke-width="1.5"/><path transform="translate(${12-12*a} ${12-12*a}) scale(${a})" d="${o.solid}" fill="${Oi}"/></svg>`,t.prepend(s)}dressGateTag(t,n){let o=t.style;o.background="#0f172a",o.color="#ffffff",o.border="1px solid rgba(255,255,255,0.28)",o.textTransform="uppercase",o.letterSpacing="0.06em",o.display="inline-flex",o.alignItems="center",o.gap="5px";let r=document.createElement("span");if(r.setAttribute("aria-hidden","true"),r.setAttribute("data-gate-arrow",n.icon==="exit"?"out":"in"),r.innerHTML=n.icon==="exit"?'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M5 1.5H2v9h3"/><path d="M5.5 6h5M8.5 3.5 11 6 8.5 8.5"/></svg>':'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M7 1.5h3v9H7"/><path d="M1 6h5.5M4 3.5 6.5 6 4 8.5"/></svg>',t.prepend(r),n.stepFree){let i=document.createElement("span");i.setAttribute("data-gate-step-free","true"),i.setAttribute("aria-label","Step-free"),i.style.lineHeight="0",i.innerHTML=Qi("wheelchair",{size:11}),t.append(i)}t.dataset.qualityContrast=jn([1,1,1],Wn("#0f172a")).toFixed(3)}dressAreaTag(t,n){let o=n.count??0;if(t.toggleAttribute("data-area-quiet",n.muted===!0),n.muted&&o<=0&&(t.style.opacity=String(xS)),o<=0){t.removeAttribute("data-area-count");return}t.setAttribute("data-area-count",String(o)),t.style.border=`2px solid ${Un}`;let r=document.createElement("span");r.textContent=String(o);let i=r.style;i.display="inline-block",i.minWidth="1.2em",i.textAlign="center",i.marginLeft="6px",i.padding="1px 6px",i.borderRadius="999px",i.background=Un,i.color=lc,i.fontWeight="800",i.fontSize="0.9em",i.lineHeight="1.2",i.verticalAlign="middle",t.appendChild(r)}dressSectionTag(t,n,o){let r=n.tint?bS(n.tint):null,i=t.style;if(r&&(i.background=r.fill,i.color=r.ink,i.border=`1px solid ${r.border}`,t.dataset.qualityContrast=r.contrast.toFixed(3)),o<=0)return;let a=document.createElement("span");a.setAttribute("data-wheelchair-free",String(o)),a.setAttribute("aria-label",`${o} wheelchair ${o===1?"place":"places"} free`),a.innerHTML=`${Qi("wheelchair",{size:11})}<span>${o}</span>`;let s=a.style;s.display="inline-flex",s.alignItems="center",s.gap="2px",s.marginLeft="6px",s.padding="1px 5px",s.borderRadius="999px",s.background="#2563eb",s.color="#ffffff",s.fontSize="0.85em",s.lineHeight="1.2",s.verticalAlign="middle",t.appendChild(a)}paintAccessChip(t,n){t.setAttribute("data-label-kind","access"),t.setAttribute("data-access-type",n.icon??""),t.innerHTML=n.icon?Qi(n.icon,{size:Do-6}):"",t.setAttribute("role","img"),t.setAttribute("aria-label",n.text);let o=t.style;return o.width=`${Do}px`,o.height=`${Do}px`,o.alignItems="center",o.justifyContent="center",o.borderRadius="50%",o.background=n.color??"#3b82f6",o.color=n.ink??"#ffffff",o.border="1.5px solid #ffffff",o.boxShadow="0 2px 6px rgba(0,0,0,.35)",o.padding="0",o.lineHeight="0",o.boxSizing="border-box",t.dataset.qualityContrast=jn(Wn(n.ink??"#ffffff")??[1,1,1],Wn(n.color??"#3b82f6")??[.23,.51,.96]).toFixed(3),t}placePinHeads(t){for(;this.pinHeads.length<t.length;){let n=document.createElement("div");n.setAttribute("data-pin-head",""),n.setAttribute("aria-hidden","true");let o=n.style;o.position="absolute",o.left="0",o.top="0",o.width=`${ld}px`,o.height=`${ld}px`,o.borderRadius="50%",o.background=Un,o.boxShadow="0 0 0 3px rgba(255,255,255,.28), 0 0 14px rgba(255,255,255,.55), 0 3px 8px rgba(0,0,0,.45)",o.pointerEvents="none",this.root.appendChild(n),this.pinHeads.push(n)}this.pinHeads.forEach((n,o)=>{let r=t[o];n.style.display=r?"":"none",r&&(n.style.transform=`translate(-50%, -100%) translate(${r.x.toFixed(1)}px, ${r.y.toFixed(1)}px)`)})}dispose(){this.pinHeads=[],this.root.remove(),this.nodes.clear()}};var gd=1;var RS=new Set(["floor","stage","zone","section","ga","booth","annotation"]);function ES(e){return e.every(t=>Number.isFinite(t))}function IS(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 bd(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Xn(e){return Math.round(e*1e4)/1e4}function _S(e){if(e)return{box:{x:Xn(e.box.x),y:Xn(e.box.y),width:Xn(e.box.width),height:Xn(e.box.height)},horizontalFillRatio:Xn(e.horizontalFillRatio),verticalFillRatio:Xn(e.verticalFillRatio),visibleAreaRatio:Xn(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function nn(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function ea(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>RS.has(s.kind)),o=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,r=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)IS(n[s].screenBox,n[c].screenBox)&&r.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=[nn("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),nn("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),nn("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),nn("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}`}]),nn("camera-invalid","The capture camera must have a finite physical pose",ES(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),nn("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}]),nn("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",o===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${o} expected hierarchy labels`}]),nn("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}))),nn("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}))),nn("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",r)].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:_S(e.framing)},metrics:{minimumHierarchyFontPx:bd(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:bd(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}function yd(e,t,n){e.fill(0);for(let o=0;o<Math.min(n,t.length);o++)e[t[o]]=1}var it=require("ogl");function CS(e,t,n){let o=e+(t<<8)+(n<<16);return o===0?-1:o-1}var fc=128;function xd(e,t,n,o,r){if(!(o>=0&&o<t&&r>=0&&r<n))return!1;let i=(r*t+o)*4;return e[i]===0&&e[i+1]===0&&e[i+2]===0&&Math.abs(e[i+3]-fc)<=8}function Md(e,t,n,o,r,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,m=CS(e[u],e[u+1],e[u+2]);if(m<0||m>=i)continue;let h=l-o,f=c-r,d=h*h+f*f;d<s&&(s=d,a=m)}return a}function vd(e,t,n,o,r,i){let a=e-n.left,s=t-n.top,c=Math.round(a*o),l=Math.round((n.height-s)*o);return{x:Math.max(0,Math.min(r-1,c)),y:Math.max(0,Math.min(i-1,l))}}var Pn=require("ogl");var ta=`
80
80
  float chairWeight(float depth) {
81
81
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
82
- }`,ds=`
83
- const float TIP_SIN = ${Math.sin(Li*Math.PI/180).toFixed(4)};
84
- const float TIP_COS = ${Math.cos(Li*Math.PI/180).toFixed(4)};
82
+ }`,dc=`
83
+ const float TIP_SIN = ${Math.sin(Ra*Math.PI/180).toFixed(4)};
84
+ const float TIP_COS = ${Math.cos(Ra*Math.PI/180).toFixed(4)};
85
85
  vec3 tipUpPad(vec3 p, float halfWidth, float up) {
86
86
  if (up < 0.5) return p;
87
- float hingeZ = (${rc.toFixed(2)}) * halfWidth + ${ic.toFixed(2)};
88
- float dy = p.y - ${Ti.toFixed(2)};
87
+ float hingeZ = (${il.toFixed(2)}) * halfWidth + ${al.toFixed(2)};
88
+ float dy = p.y - ${Aa.toFixed(2)};
89
89
  float dz = p.z - hingeZ;
90
90
  return vec3(p.x,
91
- ${Ti.toFixed(2)} + dz * TIP_SIN + dy * TIP_COS,
91
+ ${Aa.toFixed(2)} + dz * TIP_SIN + dy * TIP_COS,
92
92
  hingeZ + dz * TIP_COS - dy * TIP_SIN);
93
93
  }
94
94
  vec3 tipUpNormal(vec3 n, float up) {
95
95
  if (up < 0.5) return n;
96
96
  return vec3(n.x, n.z * TIP_SIN + n.y * TIP_COS, n.z * TIP_COS - n.y * TIP_SIN);
97
- }`,ps=`
97
+ }`,pc=`
98
98
  float glyphEq(float glyph, float expected) {
99
99
  return 1.0 - step(0.25, abs(glyph - expected));
100
100
  }
@@ -129,7 +129,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
129
129
  if (stool > 0.5) return vec3(0.0);
130
130
  // A dining chair's back is a panel held clear of the seat on its two rear
131
131
  // legs: open under it, where an auditorium seat is closed to the pad.
132
- if (dining > 0.5) { p.x *= 0.78; p.y = ${Kt.toFixed(2)} - (${Kt.toFixed(2)} - p.y) * ${nc.toFixed(2)}; }
132
+ if (dining > 0.5) { p.x *= 0.78; p.y = ${dn.toFixed(2)} - (${dn.toFixed(2)} - p.y) * ${ol.toFixed(2)}; }
133
133
  else if (folding > 0.5) { p.x *= 0.90; p.y = 0.45 + (p.y - 0.45) * 0.72; }
134
134
  else if (bench > 0.5) { p.x *= 1.10; p.y = 0.45 + (p.y - 0.45) * 0.62; }
135
135
  } else if (partId < 3.5) {
@@ -145,11 +145,11 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
145
145
  // Slim legs set in under the seat. The rear pair stand behind the pad and
146
146
  // carry on up into the foot of the back, so the back is held by the
147
147
  // chair's own frame and daylight shows between it and the seat.
148
- p.x = sign(p.x) * (${Js.toFixed(2)} + (abs(p.x) - 0.72) * ${rr.toFixed(2)});
149
- if (p.z > 0.0) p.z = ${ec.toFixed(2)} + (p.z - 0.59) * ${rr.toFixed(2)};
148
+ p.x = sign(p.x) * (${el.toFixed(2)} + (abs(p.x) - 0.72) * ${Wr.toFixed(2)});
149
+ if (p.z > 0.0) p.z = ${tl.toFixed(2)} + (p.z - 0.59) * ${Wr.toFixed(2)};
150
150
  else {
151
- p.z = ${tc.toFixed(2)} + (p.z + 0.59) * ${rr.toFixed(2)};
152
- if (p.y > 0.2) p.y = ${oc.toFixed(2)};
151
+ p.z = ${nl.toFixed(2)} + (p.z + 0.59) * ${Wr.toFixed(2)};
152
+ if (p.y > 0.2) p.y = ${rl.toFixed(2)};
153
153
  }
154
154
  }
155
155
  } else if (partId < 6.5) {
@@ -165,7 +165,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
165
165
  if (generic < 0.5) return vec3(0.0);
166
166
  }
167
167
  return p;
168
- }`,iv=1.5,io=`
168
+ }`,TS=1.5,No=`
169
169
  uniform vec4 uSeeThrough; // xyz = the seats looked at, w = cone radius there; 0 = off
170
170
  bool seeThroughCut(vec3 p, vec3 eye) {
171
171
  if (uSeeThrough.w <= 0.0) return false;
@@ -174,11 +174,11 @@ bool seeThroughCut(vec3 p, vec3 eye) {
174
174
  if (len < 1.0) return false;
175
175
  vec3 dir = axis / len;
176
176
  float t = dot(p - eye, dir);
177
- if (t <= 0.0 || t > len - ${iv.toFixed(2)}) return false;
177
+ if (t <= 0.0 || t > len - ${TS.toFixed(2)}) return false;
178
178
  vec3 onLine = eye + dir * t;
179
179
  if (p.y < onLine.y - 0.25) return false;
180
180
  return length(p - onLine) < uSeeThrough.w * t / len;
181
- }`,av=`#version 300 es
181
+ }`,kS=`#version 300 es
182
182
  precision highp float;
183
183
  in vec3 position;
184
184
  in vec3 normal;
@@ -216,13 +216,13 @@ void main() {
216
216
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
217
217
  vColor = color;
218
218
  gl_Position = projectionMatrix * mv;
219
- }`,Wf=`
219
+ }`,Sd=`
220
220
  bool roomWallHidden(float material, vec3 normalWorld, vec3 posWorld, vec3 eye, vec2 roomCentre) {
221
221
  if (abs(material - 6.0) > 0.5) return false;
222
222
  vec3 n = normalize(normalWorld);
223
223
  if (abs(n.y) > 0.5) return true;
224
224
  return dot(n.xz, eye.xz - posWorld.xz) * dot(n.xz, roomCentre - posWorld.xz) <= 0.0;
225
- }`,Xf=`
225
+ }`,wd=`
226
226
  uniform vec3 uTop;
227
227
  uniform vec3 uBottom;
228
228
  uniform float uSky; // 1 for an open-air venue, see SceneModel.outdoor
@@ -244,7 +244,7 @@ vec3 backdrop(vec2 uv, vec3 dir) {
244
244
  col = mix(col, sky, smoothstep(-0.22, 0.03, dir.y));
245
245
  }
246
246
  return col;
247
- }`,sv=`
247
+ }`,LS=`
248
248
  // A fixed 4 by 4 threshold pattern: a net thinned by it reads as a fine mesh,
249
249
  // where random grain would read as dirt.
250
250
  float orderedThreshold(vec2 pixel) {
@@ -269,7 +269,7 @@ float netShown(vec2 place) {
269
269
  // less, gone by 4.5. pixelM: the world size of this pixel, metres.
270
270
  float slenderShown(float pixelM) {
271
271
  return 1.0 - smoothstep(0.025, 0.045, pixelM);
272
- }`,cv=`#version 300 es
272
+ }`,OS=`#version 300 es
273
273
  precision highp float;
274
274
  in vec3 vColor;
275
275
  in vec3 vNormalWorld;
@@ -292,10 +292,10 @@ uniform vec3 cameraPosition;
292
292
  uniform vec2 uRoomCentre;
293
293
  uniform vec2 uViewport; // drawing buffer size, pixels
294
294
  out vec4 fragColor;
295
- ${Wf}
296
- ${io}
297
- ${Xf}
298
- ${sv}
295
+ ${Sd}
296
+ ${No}
297
+ ${wd}
298
+ ${LS}
299
299
  // Stable world-space variation; no textures or per-frame random grain.
300
300
  float turfHash(vec2 p) {
301
301
  vec3 q = fract(vec3(p.xyx) * 0.1031);
@@ -406,6 +406,22 @@ void main() {
406
406
  * mix(0.10, 0.055, concreteSurface) * fine;
407
407
  vColorRung *= 1.0 + variation;
408
408
  }
409
+ if (abs(vMaterial - 13.0) < 0.5 && vNormalWorld.y > 0.5) {
410
+ // A standing area's floor (objectBuilders.ts STANDING_FLOOR_MATERIAL) is
411
+ // event flooring in the area's own colour: panels 1.2 m square in a
412
+ // staggered bond, a fine joint between them, each panel a shade apart.
413
+ // Joints and shades fade out before a panel is a few pixels wide, so a
414
+ // distant field is one even colour and never a moire.
415
+ vec2 panel = vPosWorld.xz / 1.2;
416
+ vec2 footprint = fwidth(panel);
417
+ float resolved = 1.0 - smoothstep(0.035, 0.11, max(footprint.x, footprint.y));
418
+ panel.x += 0.5 * mod(floor(panel.y), 2.0);
419
+ vec2 toJoint = 0.5 - abs(fract(panel) - 0.5);
420
+ vec2 line = 1.0 - smoothstep(vec2(0.0), max(footprint, vec2(0.012)), toJoint);
421
+ float shade = turfHash(floor(panel)) - 0.5;
422
+ vColorRung *= 1.0 + resolved * (shade * 0.07 - max(line.x, line.y) * 0.20);
423
+ vColorRung *= 1.0 + (turfNoise(vPosWorld.xz * 0.32) - 0.5) * 0.07;
424
+ }
409
425
  // Unresolved row faces need the same lighting, not merely the same paint:
410
426
  // alternating vertical/horizontal normals otherwise recreate a moire comb.
411
427
  float rowOverview = max(tread, riser) * (1.0 - uStructureDetail);
@@ -434,7 +450,7 @@ void main() {
434
450
  // exactly the historical rim strength so an unthemed chart does not shift.
435
451
  float poweredMaterial = 1.0 - step(0.5, abs(vMaterial - 1.0));
436
452
  float sheen = mix(clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0), 1.0, poweredMaterial);
437
- float concreteSheen = abs(vMaterial - 5.0) < 0.5 ? 0.45 : 1.0;
453
+ float concreteSheen = (abs(vMaterial - 5.0) < 0.5 || abs(vMaterial - 13.0) < 0.5) ? 0.45 : 1.0;
438
454
  base += vec3(0.26, 0.31, 0.38) * fres * 0.16 * sheen * (1.0 - rowOverview) * concreteSheen; // cool rim, restrained
439
455
  // Bright, saturated authored screen faces should read as powered displays,
440
456
  // not painted slabs. Vertex colour is deliberately the material signal here:
@@ -469,9 +485,9 @@ void main() {
469
485
  base = mix(base, backdrop(gl_FragCoord.xy / uViewport, normalize(vPosWorld - cameraPosition)), out_);
470
486
  }
471
487
  fragColor = vec4(base, 1.0);
472
- }`,Kf=`
473
- ${ps}
474
- ${ds}
488
+ }`,Pd=`
489
+ ${pc}
490
+ ${dc}
475
491
  vec4 seatSurface(vec3 source, float radius) {
476
492
  vec4 origin = modelViewMatrix * vec4(iOffset, 1.0);
477
493
  if (iPhysicalSeat < 0.5) {
@@ -486,12 +502,12 @@ vec4 seatSurface(vec3 source, float radius) {
486
502
  vec3 p = glyphChairPosition(source, surface, iGlyph);
487
503
  p.xz *= iChairWidth;
488
504
  if (surface < 1.5) p = tipUpPad(p, iChairWidth, iTipUp);
489
- if (surface > 1.5) p.z -= max(p.y - ${Bt.toFixed(2)}, 0.0) * ${mo.toFixed(2)} * glyphBackRake(iGlyph);
505
+ if (surface > 1.5) p.z -= max(p.y - ${sn.toFixed(2)}, 0.0) * ${Ko.toFixed(2)} * glyphBackRake(iGlyph);
490
506
  float c = cos(iYaw), s = sin(iYaw);
491
507
  vec3 rotated = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
492
508
  return modelViewMatrix * vec4(iOffset + rotated, 1.0);
493
509
  }
494
- `,lv=`#version 300 es
510
+ `,FS=`#version 300 es
495
511
  precision highp float;
496
512
  in float surface;
497
513
  in float iYaw;
@@ -532,9 +548,9 @@ out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
532
548
  out float vPhysicalSeat;
533
549
  out float vPixelRadius;
534
550
  uniform vec3 cameraPosition;
535
- ${ri}
536
- ${Kf}
537
- ${io}
551
+ ${ta}
552
+ ${Pd}
553
+ ${No}
538
554
  void main() {
539
555
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
540
556
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
@@ -556,7 +572,7 @@ void main() {
556
572
  mv = seatSurface(position, r);
557
573
  // Match the shell's non-uniform width/depth scale before its back rake.
558
574
  vec3 n = vec3(normal.x / iChairWidth, normal.y, normal.z / iChairWidth);
559
- if (surface > 1.5) n.y += n.z * ${mo.toFixed(2)} * glyphBackRake(iGlyph);
575
+ if (surface > 1.5) n.y += n.z * ${Ko.toFixed(2)} * glyphBackRake(iGlyph);
560
576
  n = normalize(n);
561
577
  if (surface > 0.5 && surface < 1.5) n = tipUpNormal(n, iTipUp);
562
578
  vSeatNormal = vec3(n.x * cos(iYaw) + n.z * sin(iYaw), n.y, -n.x * sin(iYaw) + n.z * cos(iYaw));
@@ -569,13 +585,13 @@ void main() {
569
585
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
570
586
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
571
587
  gl_Position = projectionMatrix * mv;
572
- }`,Yf=`
588
+ }`,Ad=`
573
589
  float seatSilhouette(vec2 uv, float physical) {
574
590
  // Solid furniture owns its silhouette in geometry. Only empty bays need
575
591
  // a fragment mask; cutting physical faces would open holes in the volume.
576
592
  return mix(max(abs(uv.x), abs(uv.y)), 0.0, physical);
577
593
  }
578
- `,uv=`#version 300 es
594
+ `,DS=`#version 300 es
579
595
  precision highp float;
580
596
  in vec3 vSeatNormal;
581
597
  in float vSeatHeight;
@@ -597,7 +613,7 @@ uniform float uSeatDetail; // 0 for venue/area overview; 1 in section/row/sea
597
613
  uniform vec3 uFadeColor;
598
614
  uniform float uRoughness;
599
615
  out vec4 fragColor;
600
- ${Yf}
616
+ ${Ad}
601
617
  void main() {
602
618
  if (vDim > 0.5) discard;
603
619
  // Same screen-door dissolve as the structure rung (uStructureDetail): the
@@ -670,7 +686,7 @@ void main() {
670
686
  c = mix(c, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
671
687
  }
672
688
  fragColor = vec4(c, alpha);
673
- }`,mv=`#version 300 es
689
+ }`,NS=`#version 300 es
674
690
  precision highp float;
675
691
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
676
692
  in vec3 normal;
@@ -708,11 +724,11 @@ out float vSectionFade;
708
724
  out float vTaken; // 1 = sold or held: not for sale
709
725
  out vec3 vLocal; // x/z in chair half-widths, y in metres: where on the chair
710
726
  out vec3 vViewWorld;// from the surface to the eye, world space (not unit)
711
- ${ri}
712
- ${ps}
713
- ${ds}
727
+ ${ta}
728
+ ${pc}
729
+ ${dc}
714
730
  uniform vec3 cameraPosition;
715
- ${io}
731
+ ${No}
716
732
  void main() {
717
733
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
718
734
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
@@ -736,7 +752,7 @@ void main() {
736
752
  bool shared = position.x > 0.0;
737
753
  armrestAt = shared ? iArmrests.xy : iArmrests.zw;
738
754
  if (dot(armrestAt, armrestAt) <= 0.0) p = vec3(0.0);
739
- else if (dot(p, p) > 0.0) p.x += shared ? -${mn.toFixed(2)} : ${mn.toFixed(2)};
755
+ else if (dot(p, p) > 0.0) p.x += shared ? -${Tn.toFixed(2)} : ${Tn.toFixed(2)};
740
756
  }
741
757
  if (iPhysicalSeat < 0.5) p = vec3(0.0); // sellable space, but no physical chair
742
758
  float localHeight = p.y;
@@ -787,7 +803,7 @@ void main() {
787
803
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
788
804
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
789
805
  gl_Position = projectionMatrix * mv;
790
- }`,fv=`#version 300 es
806
+ }`,BS=`#version 300 es
791
807
  precision highp float;
792
808
  in vec3 vColor;
793
809
  in vec3 vNormalWorld;
@@ -855,7 +871,7 @@ void main() {
855
871
  float padPart = step(0.5, vPart) * (1.0 - step(1.5, vPart));
856
872
  float backPart = step(1.5, vPart) * (1.0 - step(2.5, vPart));
857
873
  float crease = mix(1.0, mix(0.70, 1.0, smoothstep(-0.95, -0.15, vLocal.z)), padPart)
858
- * mix(1.0, mix(0.74, 1.0, smoothstep(0.0, 0.20, vLocal.y - ${Bt.toFixed(2)})), backPart);
874
+ * mix(1.0, mix(0.74, 1.0, smoothstep(0.0, 0.20, vLocal.y - ${sn.toFixed(2)})), backPart);
859
875
  // The seam. On a tight row neighbouring pads meet edge to edge, and without a
860
876
  // line between them the row is one long bench. Each pad darkens toward its
861
877
  // own sides, which draws that line whether or not there is a gap to see.
@@ -891,17 +907,17 @@ void main() {
891
907
  base = mix(base, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
892
908
  }
893
909
  fragColor = vec4(base, 1.0);
894
- }`,hv=`#version 300 es
910
+ }`,HS=`#version 300 es
895
911
  precision highp float;
896
912
  in vec2 position;
897
913
  out vec2 vUv;
898
914
  void main() {
899
915
  vUv = position * 0.5 + 0.5;
900
916
  gl_Position = vec4(position, 0.999, 1.0);
901
- }`,dv=`#version 300 es
917
+ }`,GS=`#version 300 es
902
918
  precision highp float;
903
919
  in vec2 vUv;
904
- ${Xf}
920
+ ${wd}
905
921
  uniform mat4 uInvViewProj;
906
922
  uniform float uHouse; // 1 for an indoor venue, see SceneModel.house
907
923
  uniform vec4 uHouseShape; // the wall: centre x, centre z, half-width x, half-width z (world metres)
@@ -909,6 +925,7 @@ uniform vec2 uHouseLevels; // floor y, ceiling y
909
925
  uniform vec3 uHouseCeiling;
910
926
  uniform vec3 uHouseWall;
911
927
  uniform vec3 uHouseLamp;
928
+ uniform float uHouseTheatre; // 1 for a theatre's room: pilasters, wall lights, a dado and a cornice
912
929
  uniform vec3 uEye; // camera, world metres
913
930
  out vec4 fragColor;
914
931
 
@@ -916,6 +933,16 @@ out vec4 fragColor;
916
933
  const float HOUSE_BAY_M = 7.0;
917
934
  const float HOUSE_LAMP_BAYS = 0.055; // lamp radius, in bays
918
935
  const float HOUSE_COURSE_M = 3.2; // height of one course of wall panels
936
+ // A theatre's wall, metres: a pilaster about every bay, a wall light in the
937
+ // middle of each bay on every second course, a dado at its foot and a cornice
938
+ // under the ceiling.
939
+ const float THEATRE_BAY_M = 5.0;
940
+ const float THEATRE_PILASTER_M = 0.26; // half its width
941
+ const float THEATRE_LIGHT_AT_M = 2.6; // the lowest row, above the floor
942
+ const float THEATRE_LIGHT_ROWS_M = 6.4; // between rows
943
+ const float THEATRE_LIGHT_M = 0.11; // a light's radius
944
+ const float THEATRE_DADO_M = 1.0;
945
+ const float THEATRE_CORNICE_M = 0.45;
919
946
 
920
947
  void main() {
921
948
  // This pixel's line of sight. A venue with neither a sky nor a room skips
@@ -950,6 +977,8 @@ void main() {
950
977
  float tWall = wa > 1e-9 ? (-wb + sqrt(max(0.0, wb * wb - wa * wk))) / wa : 1e9;
951
978
  float course = (uEye.y + dir.y * tWall - uHouseLevels.x) / HOUSE_COURSE_M;
952
979
  float coursePixel = fwidth(course); // courses per pixel
980
+ vec3 onWall = uEye + dir * min(tWall, 1.0e4);
981
+ float wallPixel = max(length(dFdx(onWall)), length(dFdy(onWall))); // metres per pixel
953
982
  float inside = smoothstep(0.0, 0.05, -wk) * smoothstep(0.0, 3.0, headroom);
954
983
  if (inside > 0.0) {
955
984
  if (dir.y > 1e-4 && tCeiling < tWall) {
@@ -977,12 +1006,38 @@ void main() {
977
1006
  vec3 room = uHouseWall * mix(1.06, 0.6, smoothstep(0.3, 1.0, h));
978
1007
  float joint = 1.0 - smoothstep(0.014 - coursePixel, 0.014 + coursePixel, 0.5 - abs(fract(course) - 0.5));
979
1008
  room *= 1.0 - 0.14 * joint * (1.0 - smoothstep(0.08, 0.35, coursePixel));
1009
+ if (uHouseTheatre > 0.5) {
1010
+ // A theatre's wall. All of it is paint on the backdrop: nothing
1011
+ // stands in the room. Far away, where a light is a pixel or less,
1012
+ // the detail gives way to the plain wall.
1013
+ float fine = 1.0 - smoothstep(0.05, 0.22, wallPixel);
1014
+ float tall = uHouseLevels.y - uHouseLevels.x;
1015
+ float up = course * HOUSE_COURSE_M;
1016
+ vec2 at = eye + across * tWall; // on the wall, as a unit circle
1017
+ float girth = 6.2831853 * sqrt(0.5 * dot(uHouseShape.zw, uHouseShape.zw));
1018
+ float bays = max(8.0, floor(girth / THEATRE_BAY_M));
1019
+ float bayM = girth / bays;
1020
+ float along = (fract(atan(at.y, at.x) / 6.2831853 * bays) - 0.5) * bayM; // metres from the bay's middle
1021
+ float pilaster = 1.0 - smoothstep(THEATRE_PILASTER_M - wallPixel, THEATRE_PILASTER_M + wallPixel, 0.5 * bayM - abs(along));
1022
+ room *= 1.0 + 0.2 * pilaster * fine;
1023
+ room *= mix(1.0, 0.74, (1.0 - smoothstep(THEATRE_DADO_M - wallPixel, THEATRE_DADO_M + wallPixel, up)) * fine);
1024
+ float cornice = smoothstep(tall - THEATRE_CORNICE_M - wallPixel, tall - THEATRE_CORNICE_M + wallPixel, up);
1025
+ room = mix(room, uHouseWall * 1.3, 0.7 * cornice * fine);
1026
+ // The wall lights: a small bright lamp and the wash it throws up and down the wall.
1027
+ float row = max(0.0, floor((up - THEATRE_LIGHT_AT_M) / THEATRE_LIGHT_ROWS_M + 0.5));
1028
+ float rowAt = THEATRE_LIGHT_AT_M + row * THEATRE_LIGHT_ROWS_M;
1029
+ float hangs = step(rowAt + 1.6, tall); // none in the cornice
1030
+ vec2 off = vec2(along, up - rowAt);
1031
+ float lampAt = 1.0 - smoothstep(THEATRE_LIGHT_M - wallPixel, THEATRE_LIGHT_M + wallPixel, length(off));
1032
+ float wash = exp(-(off.x * off.x * 1.3 + off.y * off.y * 0.26));
1033
+ room += uHouseLamp * hangs * mix(0.012, 0.85 * lampAt + 0.17 * wash, fine);
1034
+ }
980
1035
  col = mix(col, room, inside * smoothstep(-0.02, 0.0, h));
981
1036
  }
982
1037
  }
983
1038
  }
984
1039
  fragColor = vec4(col, 1.0);
985
- }`,pv=`#version 300 es
1040
+ }`,VS=`#version 300 es
986
1041
  precision highp float;
987
1042
  in float surface;
988
1043
  in float iYaw;
@@ -1012,9 +1067,9 @@ out float vDotWeight;
1012
1067
  out float vHidden;
1013
1068
  flat out vec3 vPick;
1014
1069
  uniform vec3 cameraPosition;
1015
- ${ri}
1016
- ${Kf}
1017
- ${io}
1070
+ ${ta}
1071
+ ${Pd}
1072
+ ${No}
1018
1073
  void main() {
1019
1074
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
1020
1075
  int id = gl_InstanceID + 1; // 0 reserved for no-hit
@@ -1029,7 +1084,7 @@ void main() {
1029
1084
  vPhysicalSeat = iPhysicalSeat;
1030
1085
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
1031
1086
  gl_Position = projectionMatrix * mv;
1032
- }`,bv=`#version 300 es
1087
+ }`,zS=`#version 300 es
1033
1088
  precision highp float;
1034
1089
  in vec2 vUv;
1035
1090
  in float vPhysicalSeat;
@@ -1037,7 +1092,7 @@ in float vDotWeight;
1037
1092
  in float vHidden;
1038
1093
  flat in vec3 vPick;
1039
1094
  out vec4 fragColor;
1040
- ${Yf}
1095
+ ${Ad}
1041
1096
  void main() {
1042
1097
  if (vHidden > 0.5) discard;
1043
1098
  if (vDotWeight <= 0.99) discard;
@@ -1045,7 +1100,7 @@ void main() {
1045
1100
  float d = seatSilhouette(vUv, vPhysicalSeat);
1046
1101
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
1047
1102
  fragColor = vec4(vPick, 1.0);
1048
- }`,yv=`#version 300 es
1103
+ }`,US=`#version 300 es
1049
1104
  precision highp float;
1050
1105
  in vec3 position;
1051
1106
  in float part;
@@ -1069,10 +1124,10 @@ flat out vec3 vPick;
1069
1124
  out float vChairWeight;
1070
1125
  out float vHidden;
1071
1126
  uniform vec3 cameraPosition;
1072
- ${ri}
1073
- ${ps}
1074
- ${ds}
1075
- ${io}
1127
+ ${ta}
1128
+ ${pc}
1129
+ ${dc}
1130
+ ${No}
1076
1131
  void main() {
1077
1132
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
1078
1133
  int id = int(iPickIndex + 0.5); // already global index + 1
@@ -1092,7 +1147,7 @@ void main() {
1092
1147
  bool shared = position.x > 0.0;
1093
1148
  armrestAt = shared ? iArmrests.xy : iArmrests.zw;
1094
1149
  if (dot(armrestAt, armrestAt) <= 0.0) p = vec3(0.0);
1095
- else if (dot(p, p) > 0.0) p.x += shared ? -${mn.toFixed(2)} : ${mn.toFixed(2)};
1150
+ else if (dot(p, p) > 0.0) p.x += shared ? -${Tn.toFixed(2)} : ${Tn.toFixed(2)};
1096
1151
  }
1097
1152
  if (iPhysicalSeat < 0.5) p = vec3(0.0);
1098
1153
  p.xz *= iRadius;
@@ -1108,7 +1163,7 @@ void main() {
1108
1163
  // A collapsed armrest (p = 0) must stay collapsed, so the offset rides on w.
1109
1164
  rp.xz += armrestAt * step(0.01, w) * step(0.0001, dot(p, p));
1110
1165
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
1111
- }`,gv=`#version 300 es
1166
+ }`,WS=`#version 300 es
1112
1167
  precision highp float;
1113
1168
  flat in vec3 vPick;
1114
1169
  in float vHidden;
@@ -1118,7 +1173,7 @@ void main() {
1118
1173
  if (vHidden > 0.5) discard;
1119
1174
  if (vChairWeight < 0.01) discard;
1120
1175
  fragColor = vec4(vPick, 1.0);
1121
- }`,xv=`#version 300 es
1176
+ }`,jS=`#version 300 es
1122
1177
  precision highp float;
1123
1178
  in vec3 position;
1124
1179
  in vec3 normal;
@@ -1133,12 +1188,14 @@ out float vMaterial;
1133
1188
  out vec3 vNormalWorld;
1134
1189
  out vec3 vPosWorld;
1135
1190
  void main() {
1136
- vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
1191
+ // What is drawn hides what is behind it: the venue-wide solids (floor -2)
1192
+ // stay in a single-level view, so they stay in its depth too.
1193
+ vHidden = (floorIndex > -1.5 && uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
1137
1194
  vMaterial = materialIndex;
1138
1195
  vNormalWorld = mat3(modelMatrix) * normal;
1139
1196
  vPosWorld = (modelMatrix * vec4(position, 1.0)).xyz;
1140
1197
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1141
- }`,Mv=`#version 300 es
1198
+ }`,XS=`#version 300 es
1142
1199
  precision highp float;
1143
1200
  in float vHidden;
1144
1201
  in float vMaterial;
@@ -1147,8 +1204,8 @@ in vec3 vPosWorld;
1147
1204
  uniform vec3 cameraPosition;
1148
1205
  uniform vec2 uRoomCentre;
1149
1206
  out vec4 fragColor;
1150
- ${Wf}
1151
- ${io}
1207
+ ${Sd}
1208
+ ${No}
1152
1209
  void main() {
1153
1210
  if (vHidden > 0.5) discard;
1154
1211
  if (roomWallHidden(vMaterial, vNormalWorld, vPosWorld, cameraPosition, uRoomCentre)) discard;
@@ -1157,8 +1214,12 @@ void main() {
1157
1214
  // buyer behind the goal picks a seat through the net. Nor does stage light
1158
1215
  // (12), which from behind is not there at all.
1159
1216
  if (vMaterial > 9.5 && vMaterial < 12.5) discard;
1160
- fragColor = vec4(0.0, 0.0, 0.0, 1.0);
1161
- }`;function $f(e){return new on.Program(e,{vertex:pv,fragment:bv,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uSeatRadius:{value:Gt},uSeatScale:{value:1},uMinPixels:{value:kn},uPixelToWorld:{value:.002},uChairFull:{value:bo},uChairNone:{value:On},uFocusFloor:{value:-1}}})}function Zf(e){return new on.Program(e,{vertex:yv,fragment:gv,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uChairFull:{value:bo},uChairNone:{value:On},uBackRake:{value:mo},uBackBase:{value:Bt},uFocusFloor:{value:-1}}})}function qf(e){return new on.Program(e,{vertex:xv,fragment:Mv,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uFocusFloor:{value:-1},uRoomCentre:{value:new Float32Array([0,0])}}})}function Qf(e,t=.78,n=[.63,.66,.65]){return new on.Program(e,{vertex:av,fragment:cv,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:t},uRoomCentre:{value:new Float32Array([0,0])},uViewport:{value:new Float32Array([1,1])},uTop:{value:new Float32Array([0,0,0])},uBottom:{value:new Float32Array([0,0,0])},uSky:{value:0},uZenith:{value:new Float32Array([0,0,0])},uHorizon:{value:new Float32Array([0,0,0])}}})}function Jf(e){return new on.Program(e,{vertex:lv,fragment:uv,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uSeatRadius:{value:Gt},uSeatScale:{value:1},uMinPixels:{value:kn},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:bo},uChairNone:{value:On}}})}function eh(e,t=.78){return new on.Program(e,{vertex:mv,fragment:fv,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:bo},uChairNone:{value:On},uBackRake:{value:mo},uBackBase:{value:Bt},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:t}}})}function th(e,t,n,o,r){return new on.Program(e,{vertex:hv,fragment:dv,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)},uSky:{value:o?1:0},uZenith:{value:new Float32Array(o?.zenith??[0,0,0])},uHorizon:{value:new Float32Array(o?.horizon??[0,0,0])},uInvViewProj:{value:new Float32Array(16)},uHouse:{value:r?1:0},uHouseShape:{value:new Float32Array(r?[...r.centre,...r.radii]:[0,0,1,1])},uHouseLevels:{value:new Float32Array(r?[r.floorY,r.ceilingY]:[0,1])},uHouseCeiling:{value:new Float32Array(r?.ceiling??[0,0,0])},uHouseWall:{value:new Float32Array(r?.wall??[0,0,0])},uHouseLamp:{value:new Float32Array(r?.lamp??[0,0,0])},uEye:{value:new Float32Array(3)}}})}var st=require("ogl"),vv=45,Sv=.16;function nh(e,t,n,o){let r=Math.max(3,n.radius*1.04),i=e.getParameter(e.MAX_TEXTURE_SIZE),a=r<=vv||i<2048?1024:2048,s=!!o&&2*r/a<=Sv,[c,l,u]=n.center,m=new st.Camera(e,{left:-r,right:r,bottom:-r,top:r,near:.1,far:r*6});m.position.set(c-r*1.44,l+r*2.34,u+r*1.2),m.lookAt([c,l,u]);let f=new st.RenderTarget(e,{width:a,height:a,depthTexture:!0,minFilter:e.NEAREST,magFilter:e.NEAREST}),h=new st.Program(e,{cullFace:!1,vertex:`#version 300 es
1217
+ // A standing area's floor (material 13, its top face) says so in alpha: see
1218
+ // pick/encode.ts STANDING_FLOOR_PICK_ALPHA. Black like every solid, so seats
1219
+ // behind it still read as no hit.
1220
+ float floorMark = (abs(vMaterial - 13.0) < 0.5 && vNormalWorld.y > 0.5) ? ${(fc/255).toFixed(6)} : 1.0;
1221
+ fragColor = vec4(0.0, 0.0, 0.0, floorMark);
1222
+ }`;function Rd(e){return new Pn.Program(e,{vertex:VS,fragment:zS,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uSeatRadius:{value:cn},uSeatScale:{value:1},uMinPixels:{value:io},uPixelToWorld:{value:.002},uChairFull:{value:qo},uChairNone:{value:ao},uFocusFloor:{value:-1}}})}function Ed(e){return new Pn.Program(e,{vertex:US,fragment:WS,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uChairFull:{value:qo},uChairNone:{value:ao},uBackRake:{value:Ko},uBackBase:{value:sn},uFocusFloor:{value:-1}}})}function Id(e){return new Pn.Program(e,{vertex:jS,fragment:XS,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uFocusFloor:{value:-1},uRoomCentre:{value:new Float32Array([0,0])}}})}function _d(e,t=.78,n=[.63,.66,.65]){return new Pn.Program(e,{vertex:kS,fragment:OS,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:t},uRoomCentre:{value:new Float32Array([0,0])},uViewport:{value:new Float32Array([1,1])},uTop:{value:new Float32Array([0,0,0])},uBottom:{value:new Float32Array([0,0,0])},uSky:{value:0},uZenith:{value:new Float32Array([0,0,0])},uHorizon:{value:new Float32Array([0,0,0])}}})}function Cd(e){return new Pn.Program(e,{vertex:FS,fragment:DS,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uSeatRadius:{value:cn},uSeatScale:{value:1},uMinPixels:{value:io},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:qo},uChairNone:{value:ao}}})}function Td(e,t=.78){return new Pn.Program(e,{vertex:NS,fragment:BS,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:qo},uChairNone:{value:ao},uBackRake:{value:Ko},uBackBase:{value:sn},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:t}}})}function kd(e,t,n,o,r){return new Pn.Program(e,{vertex:HS,fragment:GS,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)},uSky:{value:o?1:0},uZenith:{value:new Float32Array(o?.zenith??[0,0,0])},uHorizon:{value:new Float32Array(o?.horizon??[0,0,0])},uInvViewProj:{value:new Float32Array(16)},uHouse:{value:r?1:0},uHouseShape:{value:new Float32Array(r?[...r.centre,...r.radii]:[0,0,1,1])},uHouseLevels:{value:new Float32Array(r?[r.floorY,r.ceilingY]:[0,1])},uHouseCeiling:{value:new Float32Array(r?.ceiling??[0,0,0])},uHouseWall:{value:new Float32Array(r?.wall??[0,0,0])},uHouseLamp:{value:new Float32Array(r?.lamp??[0,0,0])},uHouseTheatre:{value:r?.theatre?1:0},uEye:{value:new Float32Array(3)}}})}var St=require("ogl"),KS=45,YS=.16;function Ld(e,t,n,o){let r=Math.max(3,n.radius*1.04),i=e.getParameter(e.MAX_TEXTURE_SIZE),a=r<=KS||i<2048?1024:2048,s=!!o&&2*r/a<=YS,[c,l,u]=n.center,m=new St.Camera(e,{left:-r,right:r,bottom:-r,top:r,near:.1,far:r*6});m.position.set(c-r*1.44,l+r*2.34,u+r*1.2),m.lookAt([c,l,u]);let h=new St.RenderTarget(e,{width:a,height:a,depthTexture:!0,minFilter:e.NEAREST,magFilter:e.NEAREST}),f=new St.Program(e,{cullFace:!1,vertex:`#version 300 es
1162
1223
  in vec3 position;
1163
1224
  in float materialIndex;
1164
1225
  uniform mat4 modelViewMatrix;
@@ -1172,7 +1233,7 @@ void main() {
1172
1233
  // ...nor do nets and slender sport fittings (10, 11): a net is mostly air.
1173
1234
  if (abs(vMaterial - 6.0) < 0.5 || (vMaterial > 9.5 && vMaterial < 12.5)) discard;
1174
1235
  fragColor = vec4(1.0);
1175
- }`}),d=new st.Transform,p=new st.Mesh(e,{geometry:t,program:h});p.frustumCulled=!1,p.setParent(d);let b=s?new st.Program(e,{cullFace:!1,vertex:`#version 300 es
1236
+ }`}),d=new St.Transform,p=new St.Mesh(e,{geometry:t,program:f});p.frustumCulled=!1,p.setParent(d);let b=s?new St.Program(e,{cullFace:!1,vertex:`#version 300 es
1176
1237
  in vec3 position;
1177
1238
  in float surface;
1178
1239
  in vec3 iOffset;
@@ -1192,7 +1253,64 @@ void main() {
1192
1253
  }`,fragment:`#version 300 es
1193
1254
  precision highp float;
1194
1255
  out vec4 fragColor;
1195
- void main() { fragColor = vec4(1.0); }`}):null;if(b&&o){let A=new st.Mesh(e,{geometry:o,program:b});A.frustumCulled=!1,A.setParent(d)}let x=e.getParameter(e.COLOR_CLEAR_VALUE),y=e.isEnabled(e.DITHER);try{e.disable(e.DITHER),e.clearColor(1,1,1,1),e.renderer.render({scene:d,camera:m,target:f})}finally{y&&e.enable(e.DITHER),e.clearColor(x[0],x[1],x[2],x[3]),h.remove(),b?.remove()}let M=new st.Mat4().multiply(m.projectionMatrix,m.viewMatrix);return{texture:f.depthTexture,matrix:M,seatsCast:s,dispose(){for(let A of f.textures)e.deleteTexture(A.texture);e.deleteTexture(f.depthTexture.texture),e.deleteFramebuffer(f.buffer),f.depthBuffer&&e.deleteRenderbuffer(f.depthBuffer)}}}var wv=.65,Pv=new Set(["dimmed","sold","held"]);function oh(e,t,n){let o=new Set,r=!1;for(let i of e){let a=t.get(i.sectionId);if(!a||!a.length){o.add(i.sectionId);continue}let s=!1;for(let c of a){let l=je[n[c]]??"available";if(!Pv.has(l)){s=!0;break}}s?o.add(i.sectionId):r=!0}return{lit:o,anyUnlit:r}}function rh(e,t,n,o,r,i){let a=[];for(let s of e){let c=r===null||r.has(s.sectionId);if(o.get(s.sectionId)===c)continue;o.set(s.sectionId,c);let l=(s.start+s.count)*3;for(let u=s.start*3;u<l;u++)t[u]=c?n[u]:n[u]+(i[u%3]-n[u])*wv;a.push(s)}return a}var Av=je.map(e=>e==="available"||e==="dimmed"),ih=je.indexOf("selected");function Rv(e,t){return[0,1,2].map(n=>e[n]*.15+.75+t[n]*.1)}function ah(e,t,n,o,r,i){for(let a=n;a<n+o;a++){let s=i&&t[a]===0,c=i&&t[a]===ih?Rv([i[a*3],i[a*3+1],i[a*3+2]],r[ih]??r[0]):s?null:r[t[a]]??r[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 Ev=new Float32Array([-1,-1,3,-1,-1,3]);function sh(e,t){let n=new ze.Transform,o=new ze.Transform,r=new ze.Geometry(e,{position:{size:2,data:Ev}}),i=th(e,t.theme.background.top,t.theme.background.bottom,t.outdoor?t.theme.sky:null,t.house&&t.theme.house?{...t.house,...t.theme.house}:null),a=new ze.Mesh(e,{geometry:r,program:i});a.frustumCulled=!1,a.setParent(o);let s=new ze.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=Qf(e,t.theme.materials.roughness,t.theme.structure.tierTop);t.room&&c.uniforms.uRoomCentre.value.set(t.room.centre);for(let B of["uTop","uBottom","uSky","uZenith","uHorizon"])c.uniforms[B]=i.uniforms[B];let l=new ze.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let u=Jf(e),m=new Float32Array(t.seats.count*3),f=je.map(B=>t.theme.seatStates[B]),h=t.seats.iCategory.slice(),d=Vt(t.theme.structure);for(let B=0;B<t.seats.count;B++){if(t.seats.iPhysicalSeat[B]<.5)continue;let Y=t.theme.materials.seat??bc([h[B*3],h[B*3+1],h[B*3+2]],d);h.set(Y,B*3)}ah(m,t.seats.iState,0,t.seats.count,f,h);let p=lc(),b=new Uint8Array(t.seats.count),x=new Uint8Array(t.seats.count);for(let B=0;B<t.seats.count;B++){let Y=t.seats.iArmrests[B*4]!==0||t.seats.iArmrests[B*4+1]!==0;x[B]=Y&&t.seats.iPhysicalSeat[B]>=.5&&t.seats.iGlyph[B]<1.5?1:0}let y=new Float32Array(t.seats.count),M=(B,Y)=>{for(let q=B;q<B+Y;q++)y[q]=x[q]&&Av[t.seats.iState[q]]?1:0};M(0,t.seats.count);let A=new ze.Geometry(e,{position:{size:3,data:p.position},normal:{size:3,data:p.normal},uv:{size:2,data:p.uv},index:{size:1,data:p.index},surface:{size:1,data:p.surface},iYaw:{size:1,data:t.seats.iYaw,instanced:1},iChairWidth:{size:1,data:t.seats.iChairWidth,instanced:1},iGlyph:{size:1,data:t.seats.iGlyph,instanced:1},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:m,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iHasChair:{size:1,data:b,type:e.UNSIGNED_BYTE,usage:e.DYNAMIC_DRAW,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iTipUp:{size:1,data:y,usage:e.DYNAMIC_DRAW,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1},iSection:{size:1,data:t.seats.iSection,instanced:1}}),w=new ze.Mesh(e,{geometry:A,program:u});w.frustumCulled=!1,t.seats.count>0&&w.setParent(n);let g=nh(e,s,t.renderBounds,t.seats.count>0?A:null);c.uniforms.tVenueShadow={value:g.texture},c.uniforms.uShadowMatrix={value:g.matrix};let S=A.attributes.iColor,v=t.solids.color.slice(),P=t.theme.structure.ground,E=new Map(t.sectionSolidRanges.map(B=>[B.sectionId,!0])),k=ac(),L=eh(e,t.theme.materials.roughness),I=pr,R=new Float32Array(I*3),_=new Float32Array(I*3),F=new Float32Array(I),N=new Float32Array(I),O=new Float32Array(I),V=new Float32Array(I*3),z=new Float32Array(I),G=new Float32Array(I),T=new Float32Array(I),D=new Float32Array(I*4),W=new Float32Array(I),H=new Float32Array(I),j=new Float32Array(I),Z=new ze.Geometry(e,{position:{size:3,data:k.position},normal:{size:3,data:k.normal},part:{size:1,data:k.part},index:{data:k.index},iOffset:{size:3,data:R,instanced:1},iColor:{size:3,data:_,instanced:1},iRadius:{size:1,data:F,instanced:1},iYaw:{size:1,data:N,instanced:1},iGlyph:{size:1,data:O,instanced:1},iRing:{size:3,data:V,instanced:1},iFloor:{size:1,data:z,instanced:1},iSection:{size:1,data:G,instanced:1},iPhysicalSeat:{size:1,data:T,instanced:1},iArmrests:{size:4,data:D,instanced:1},iTipUp:{size:1,data:W,instanced:1},iTaken:{size:1,data:j,instanced:1},iPickIndex:{size:1,data:H,instanced:1}}),X=B=>B.map(Y=>1+(Y-1)*Uc);c.uniforms.uKeyColor.value.set(t.theme.light.key),c.uniforms.uAmbientColor.value.set(t.theme.light.ambient);for(let B of[u,L])B.uniforms.uKeyColor.value.set(X(t.theme.light.key)),B.uniforms.uAmbientColor.value.set(X(t.theme.light.ambient));let ee=new ze.Mesh(e,{geometry:Z,program:L});ee.frustumCulled=!1;let ne=0,ue=!1,de=!1,me=null,pe=null,Pe=null,_e=new Int32Array(0),xe=()=>{let B=t.seats;for(let Y=0;Y<ne;Y++){let q=_e[Y];j[Y]=Vc(B.iState[q]),W[Y]=y[q],_[Y*3]=m[q*3],_[Y*3+1]=m[q*3+1],_[Y*3+2]=m[q*3+2]}Z.attributes.iColor.needsUpdate=!0,Z.attributes.iTipUp.needsUpdate=!0,Z.attributes.iTaken.needsUpdate=!0},Ce={main:n,background:o,backgroundProgram:i,seatProgram:u,solidProgram:c,chairProgram:L,seatGeometry:A,chairGeometry:Z,solidGeometry:s,drawCalls:3,setNearSeats(B,Y){let q=Math.min(Y,I,B.length);if(jf(b,B,q),A.attributes.iHasChair.needsUpdate=!0,_e=B,ne=q,q===0){ee.parent&&ee.setParent(null),Z.instancedCount=0,Ce.drawCalls=3+(ue?1:0);return}let J=t.seats;for(let te=0;te<q;te++){let ae=B[te];R[te*3]=J.iPosition[ae*3],R[te*3+1]=J.iPosition[ae*3+1],R[te*3+2]=J.iPosition[ae*3+2],F[te]=J.iChairWidth[ae],N[te]=J.iYaw[ae],O[te]=J.iGlyph[ae],V[te*3]=J.iRing[ae*3],V[te*3+1]=J.iRing[ae*3+1],V[te*3+2]=J.iRing[ae*3+2],z[te]=J.iFloor[ae],G[te]=J.iSection[ae],T[te]=J.iPhysicalSeat[ae],D.set(J.iArmrests.subarray(ae*4,ae*4+4),te*4),H[te]=ae+1}xe(),Z.attributes.iOffset.needsUpdate=!0,Z.attributes.iRadius.needsUpdate=!0,Z.attributes.iYaw.needsUpdate=!0,Z.attributes.iGlyph.needsUpdate=!0,Z.attributes.iRing.needsUpdate=!0,Z.attributes.iFloor.needsUpdate=!0,Z.attributes.iSection.needsUpdate=!0,Z.attributes.iPhysicalSeat.needsUpdate=!0,Z.attributes.iArmrests.needsUpdate=!0,Z.attributes.iTaken.needsUpdate=!0,Z.attributes.iPickIndex.needsUpdate=!0,Z.instancedCount=q,ee.parent||ee.setParent(n),Ce.drawCalls=4+(ue?1:0)},nearSeatCount(){return ne},setSectionShellLit(B){c.uniforms.uSectionFilter.value=B===null?0:1;let Y=rh(t.sectionSolidRanges,t.solids.color,v,E,B,P);if(!Y.length)return;let q=s.attributes.color,J=q.buffer;if(!J){q.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,J);for(let te of Y){let ae=t.solids.color.subarray(te.start*3,(te.start+te.count)*3);e.bufferSubData(e.ARRAY_BUFFER,te.start*3*Float32Array.BYTES_PER_ELEMENT,ae)}},uploadSeatStateRuns(B){if(!B.length)return;for(let J of B)M(J.start,J.length);let Y=A.attributes.iTipUp;if(!Y.buffer)Y.needsUpdate=!0;else{e.bindBuffer(e.ARRAY_BUFFER,Y.buffer);for(let J of B)e.bufferSubData(e.ARRAY_BUFFER,J.start*Float32Array.BYTES_PER_ELEMENT,y.subarray(J.start,J.start+J.length))}for(let J of B)ah(m,t.seats.iState,J.start,J.length,f,h);ne&&xe();let q=S.buffer;if(!q){S.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,q);for(let J of B){let te=m.subarray(J.start*3,(J.start+J.length)*3);e.bufferSubData(e.ARRAY_BUFFER,J.start*3*Float32Array.BYTES_PER_ELEMENT,te)}},dispose(){de=!0,g.dispose(),r.remove(),i.remove(),s.remove(),c.remove(),A.remove(),u.remove(),Z.remove(),L.remove(),me?.remove(),pe?.remove(),Pe?.texture&&e.deleteTexture(Pe.texture)}},$=t.productionElements.find(B=>B.contentImageUrl&&B.contentPlane);if($?.contentImageUrl&&$.contentPlane?.length===4&&typeof Image<"u"){let B=new Image;B.crossOrigin="anonymous",B.onload=()=>{if(de)return;let Y=$.contentPlane;me=new ze.Geometry(e,{position:{size:3,data:new Float32Array(Y.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill($.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),Pe=new ze.Texture(e,{image:B,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),pe=new ze.Program(e,{vertex:`#version 300 es
1256
+ void main() { fragColor = vec4(1.0); }`}):null;if(b&&o){let P=new St.Mesh(e,{geometry:o,program:b});P.frustumCulled=!1,P.setParent(d)}let y=e.getParameter(e.COLOR_CLEAR_VALUE),g=e.isEnabled(e.DITHER);try{e.disable(e.DITHER),e.clearColor(1,1,1,1),e.renderer.render({scene:d,camera:m,target:h})}finally{g&&e.enable(e.DITHER),e.clearColor(y[0],y[1],y[2],y[3]),f.remove(),b?.remove()}let v=new St.Mat4().multiply(m.projectionMatrix,m.viewMatrix);return{texture:h.depthTexture,matrix:v,seatsCast:s,dispose(){for(let P of h.textures)e.deleteTexture(P.texture);e.deleteTexture(h.depthTexture.texture),e.deleteFramebuffer(h.buffer),h.depthBuffer&&e.deleteRenderbuffer(h.depthBuffer)}}}var $S=.65,ZS=new Set(["dimmed","sold","held"]);function Fd(e,t,n){let o=new Set,r=!1;for(let i of e){let a=t.get(i.sectionId);if(!a||!a.length){o.add(i.sectionId);continue}let s=!1;for(let c of a){let l=ct[n[c]]??"available";if(!ZS.has(l)){s=!0;break}}s?o.add(i.sectionId):r=!0}return{lit:o,anyUnlit:r}}var Od=new WeakMap;function Dd(e){let t=Od.get(e);if(t)return e.color.set(t),t;let n=e.color.slice();return Od.set(e,n),n}function bc(e,t,n,o,r,i){let a=[];for(let s of e){let c=r===null||r.has(s.sectionId);if(o.get(s.sectionId)===c)continue;o.set(s.sectionId,c);let l=(s.start+s.count)*3;for(let u=s.start*3;u<l;u++)t[u]=c?n[u]:n[u]+(i[u%3]-n[u])*$S;a.push(s)}return a}var Go=require("ogl"),gc=[[.16,.2,.3],[.3,.14,.16],[.2,.26,.2],[.34,.3,.24],[.42,.42,.46],[.12,.12,.14],[.5,.36,.16],[.24,.3,.42]],Kn=[[.78,.6,.48],[.56,.4,.3],[.36,.25,.19],[.86,.7,.58]],yc=[[.08,.07,.06],[.2,.13,.08],[.36,.24,.13],[.62,.5,.3],[.5,.5,.5]],na=32,Nd=1.6,Bd=2.2,qS=0,Ho=1,Hd=2,xc=3,Mc=[{part:qS,y:[0,.47],halfWidth:[.105,.15],halfDepth:[.085,.1]},{part:Ho,y:[.47,.8],halfWidth:[.15,.225],halfDepth:[.1,.115]},{part:Ho,y:[.8,.845],halfWidth:[.225,.065],halfDepth:[.115,.06]}],Bo=6,Lr={y:[.855,.95],halfWidth:[.075,.092],halfDepth:[.085,.1]},QS={y:[.95,1],halfWidth:[.092,.05],halfDepth:[.1,.055]},An={hips:{y:.47,inside:.004},shoulders:{y:.8,inside:.001}};function JS(){let e=[],t=(f,d,p,b,y="out")=>{let v=d[0]-f[0],P=(d[1]-f[1])*1.64,w=d[2]-f[2],x=p[0]-f[0],S=(p[1]-f[1])*1.64,A=p[2]-f[2],M=P*A-w*S,E=w*x-v*A,T=v*S-P*x,k=Math.hypot(M,E,T)||1;M/=k,E/=k,T/=k;let _=(f[0]+d[0]+p[0])*M+(f[2]+d[2]+p[2])*T,R=y==="down"?E>0:_<0||_===0&&E<0,C=R?[-M,-E,-T]:[M,E,T],O=R!==(y==="lining");e.push(O?{a:f,b:p,c:d,normal:C,part:b,lining:y==="lining"}:{a:f,b:d,c:p,normal:C,part:b,lining:y==="lining"})},n=(f,d,p,b)=>f===4?[[-p,d,-b],[p,d,-b],[p,d,b],[-p,d,b]]:Array.from({length:f},(y,g)=>{let v=2*Math.PI*(g+.5)/f;return[Math.sin(v)*p,d,-Math.cos(v)*b]}),o=(f,d,p,b="out")=>{let y=n(f,d.y[0],d.halfWidth[0],d.halfDepth[0]),g=n(f,d.y[1],d.halfWidth[1],d.halfDepth[1]);for(let v=0;v<f;v++){let P=(v+1)%f;t(y[v],y[P],g[P],p(v),b),t(y[v],g[P],g[v],p(v),b)}return g};for(let f of Mc)o(4,f,()=>f.part);let r=n(Bo,Lr.y[0],Lr.halfWidth[0],Lr.halfDepth[0]);o(Bo,Lr,f=>{let d=r[f],p=r[(f+1)%Bo];return d[2]+p[2]<-Lr.halfDepth[0]?xc:Hd});let i=o(Bo,QS,()=>xc);for(let f=1;f<Bo-1;f++)t(i[0],i[f],i[f+1],xc);let a=Mc[1],s=Mc[2],c=s.halfWidth[0]-An.shoulders.inside,l=s.halfDepth[0]-An.shoulders.inside,u=a.halfWidth[0]-An.hips.inside,m=a.halfDepth[0]-An.hips.inside;o(4,{y:[An.shoulders.y,s.y[1]],halfWidth:[c,s.halfWidth[1]],halfDepth:[l,s.halfDepth[1]]},()=>Ho,"lining"),o(4,{y:[An.hips.y,An.shoulders.y],halfWidth:[u,c],halfDepth:[m,l]},()=>Ho,"lining");let h=n(4,An.hips.y,u,m);t(h[0],h[1],h[2],Ho),t(h[0],h[2],h[3],Ho);for(let f=1;f<Bo-1;f++)t(r[0],r[f],r[f+1],Hd,"down");return e}var Or=e=>e.map(t=>Math.round(t*1e6)).join(",");function ew(e="flat",t="last"){let n=JS(),o=[],r=[],i=[],a=[],s=(c,l,u)=>(o.push(...c),r.push(...l),i.push(u),i.length-1);if(e==="indexed"){let c=new Map;for(let l of n)for(let u of[l.a,l.b,l.c]){let m=`${Or(u)}|${Or(l.normal)}|${l.part}`,h=c.get(m);h===void 0&&(h=s(u,l.normal,l.part),c.set(m,h)),a.push(h)}}else{let c=new Map,l=p=>{let b=c.get(Or(p));return b===void 0&&(b=s(p,[0,1,0],0),c.set(Or(p),b)),b},u=new Map;for(let p of n){let b=[p.a,p.b,p.c].map(l),y=`${Or(p.normal)}|${p.part}`,g=u.get(y);g?(g.triangles.push(p),g.shared=g.shared.filter(v=>b.includes(v))):u.set(y,{triangles:[p],shared:b})}let m=[...u.values()],h=new Map,f=(p,b)=>{for(let y of m[p].shared){if(b.has(y))continue;b.add(y);let g=h.get(y);if(g===void 0||f(g,b))return h.set(y,p),!0}return!1};m.forEach((p,b)=>f(b,new Set));let d=new Map;for(let[p,b]of h)d.set(b,p);m.forEach((p,b)=>{let y=p.triangles[0],g=d.get(b),v=g;if(v===void 0){let P=p.shared[0];v=P===void 0?void 0:s([o[P*3],o[P*3+1],o[P*3+2]],y.normal,y.part)}for(let P of p.triangles){let w=[P.a,P.b,P.c].map(l),x=v===void 0?2:w.indexOf(g??p.shared[0]);x<0&&(x=2);let S=v??s(P.c,P.normal,P.part);r.splice(S*3,3,...P.normal),i[S]=P.part;let A=[w[(x+1)%3],w[(x+2)%3]];a.push(...t==="first"?[S,A[0],A[1]]:[A[0],A[1],S])}})}return{position:new Float32Array(o),normal:new Float32Array(r),part:new Float32Array(i),index:new Uint16Array(a),vertices:i.length,triangles:n.length}}var vc=e=>e.map(([t,n,o])=>`vec3(${t.toFixed(3)}, ${n.toFixed(3)}, ${o.toFixed(3)})`).join(", "),Gd=e=>`#version 300 es
1257
+ precision highp float;
1258
+ in vec3 position;
1259
+ in vec3 normal;
1260
+ in float part; // 0 legs, 1 body, 2 skin, 3 hair
1261
+ in vec3 iOffset; // feet, world metres
1262
+ in vec2 iFacing; // unit, world (x, z)
1263
+ in float iHeight;
1264
+ in float iTone; // hair * ${na} + clothes * ${Kn.length} + skin
1265
+ in float iFloor;
1266
+ uniform mat4 modelMatrix;
1267
+ uniform mat4 modelViewMatrix;
1268
+ uniform mat4 projectionMatrix;
1269
+ uniform vec3 cameraPosition;
1270
+ uniform float uFocusFloor; // -1 = show every floor
1271
+ uniform vec3 uKeyDir;
1272
+ uniform vec3 uKeyColor;
1273
+ uniform vec3 uAmbientColor;
1274
+ ${e?"flat ":""}out vec3 vColor;
1275
+ const vec3 CLOTHES[${gc.length}] = vec3[${gc.length}](${vc(gc)});
1276
+ const vec3 SKIN[${Kn.length}] = vec3[${Kn.length}](${vc(Kn)});
1277
+ const vec3 HAIR[${yc.length}] = vec3[${yc.length}](${vc(yc)});
1278
+ void main() {
1279
+ // A figure that must not show is dropped whole, here: on another level than the one in focus, or
1280
+ // nearer the eye than its own distance between ${Nd.toFixed(1)} and ${Bd.toFixed(1)} m. No pixel is ever discarded.
1281
+ vec4 chest = modelMatrix * vec4(iOffset + vec3(0.0, iHeight * 0.7, 0.0), 1.0);
1282
+ float own = fract(52.9829189 * fract(dot(iOffset.xz, vec2(0.06711056, 0.00583715))));
1283
+ bool onLevel = uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5;
1284
+ if (!onLevel || distance(cameraPosition, chest.xyz) < mix(${Nd.toFixed(1)}, ${Bd.toFixed(1)}, own)) {
1285
+ vColor = vec3(0.0);
1286
+ gl_Position = vec4(2.0, 2.0, 2.0, 1.0);
1287
+ return;
1288
+ }
1289
+ vec2 f = iFacing;
1290
+ vec2 r = vec2(-f.y, f.x);
1291
+ vec3 local = iOffset + vec3(r.x * position.x + f.x * position.z, position.y * iHeight, r.y * position.x + f.y * position.z);
1292
+ vec3 n = vec3(r.x * normal.x + f.x * normal.z, normal.y, r.y * normal.x + f.y * normal.z);
1293
+ int tone = int(iTone + 0.5);
1294
+ int look = tone - (tone / ${na}) * ${na};
1295
+ vec3 clothes = CLOTHES[look / ${Kn.length}];
1296
+ vec3 base = part > 2.5 ? HAIR[tone / ${na}]
1297
+ : part > 1.5 ? SKIN[look - (look / ${Kn.length}) * ${Kn.length}]
1298
+ : part > 0.5 ? clothes : clothes * 0.62;
1299
+ // A flat face has one colour, so the venue's light is worked out here, once a vertex, not once a pixel.
1300
+ vec3 N = normalize(mat3(modelMatrix) * n);
1301
+ float hemi = 0.5 + 0.5 * N.y;
1302
+ float key = max(dot(N, uKeyDir), 0.0);
1303
+ vec3 fillDir = normalize(vec3(-uKeyDir.x, 0.25, -uKeyDir.z));
1304
+ float fill = max(dot(N, fillDir), 0.0);
1305
+ vColor = base * ((0.34 + 0.26 * hemi) * uAmbientColor + key * 0.60 * uKeyColor + fill * 0.26 * uAmbientColor);
1306
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(local, 1.0);
1307
+ }`,Vd=e=>`#version 300 es
1308
+ precision highp float;
1309
+ ${e?"flat ":""}in vec3 vColor;
1310
+ out vec4 fragColor;
1311
+ void main() {
1312
+ fragColor = vec4(vColor, 1.0);
1313
+ }`,oC=Gd(!0),rC=Vd(!0);function zd(e,t,n,o="flat"){let r=o==="flat"?e.getExtension("WEBGL_provoking_vertex"):null;r?.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL);let i=r?"first":"last",a=ew(o,i),s=new Go.Geometry(e,{position:{size:3,data:a.position},normal:{size:3,data:a.normal},part:{size:1,data:a.part},index:{data:a.index},iOffset:{size:3,data:t.iPosition,instanced:1},iFacing:{size:2,data:t.iFacing,instanced:1},iHeight:{size:1,data:t.iHeight,instanced:1},iTone:{size:1,data:t.iTone,instanced:1},iFloor:{size:1,data:t.iFloor,instanced:1}});s.instancedCount=t.count;let c=new Go.Program(e,{vertex:Gd(o==="flat"),fragment:Vd(o==="flat"),cullFace:e.BACK,frontFace:e.CW,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:n.uniforms.uKeyDir,uKeyColor:n.uniforms.uKeyColor,uAmbientColor:n.uniforms.uAmbientColor,uFocusFloor:n.uniforms.uFocusFloor}}),l=new Go.Mesh(e,{geometry:s,program:c});return l.frustumCulled=!1,{mesh:l,kind:o,provoking:i,dispose:()=>{s.remove(),c.remove()}}}function Ud(e){let t=null;try{if(t=e(),tw(t.mesh.program))return t}catch{}try{t?.dispose()}catch{}return null}function tw(e){let t=e;return t.uniformLocations instanceof Map&&t.attributeLocations instanceof Map}var nw=ct.map(e=>e==="available"||e==="dimmed"),Wd=ct.indexOf("selected");function ow(e,t){return[0,1,2].map(n=>e[n]*.15+.75+t[n]*.1)}function jd(e,t,n,o,r,i){for(let a=n;a<n+o;a++){let s=i&&t[a]===0,c=i&&t[a]===Wd?ow([i[a*3],i[a*3+1],i[a*3+2]],r[Wd]??r[0]):s?null:r[t[a]]??r[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 rw=new Float32Array([-1,-1,3,-1,-1,3]);function Xd(e,t){let n=Dd(t.solids),o=new it.Transform,r=new it.Transform,i=new it.Geometry(e,{position:{size:2,data:rw}}),a=kd(e,t.theme.background.top,t.theme.background.bottom,t.outdoor?t.theme.sky:null,t.house&&t.theme.house?{...t.house,...t.theme.house}:null),s=new it.Mesh(e,{geometry:i,program:a});s.frustumCulled=!1,s.setParent(r);let c=new it.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}}),l=_d(e,t.theme.materials.roughness,t.theme.structure.tierTop);t.room&&l.uniforms.uRoomCentre.value.set(t.room.centre);for(let ne of["uTop","uBottom","uSky","uZenith","uHorizon"])l.uniforms[ne]=a.uniforms[ne];let u=new it.Mesh(e,{geometry:c,program:l});u.frustumCulled=!1,u.setParent(o);let m=t.crowd,h=m?Ud(()=>zd(e,m,l)):null;h?.mesh.setParent(o);let f=h?1:0,d=Cd(e),p=new Float32Array(t.seats.count*3),b=ct.map(ne=>t.theme.seatStates[ne]),y=t.seats.iCategory.slice(),g=Kt(t.theme.structure);for(let ne=0;ne<t.seats.count;ne++){if(t.seats.iPhysicalSeat[ne]<.5)continue;let W=t.theme.materials.seat??gl([y[ne*3],y[ne*3+1],y[ne*3+2]],g);y.set(W,ne*3)}jd(p,t.seats.iState,0,t.seats.count,b,y);let v=ul(),P=new Uint8Array(t.seats.count),w=new Uint8Array(t.seats.count);for(let ne=0;ne<t.seats.count;ne++){let W=t.seats.iArmrests[ne*4]!==0||t.seats.iArmrests[ne*4+1]!==0;w[ne]=W&&t.seats.iPhysicalSeat[ne]>=.5&&t.seats.iGlyph[ne]<1.5?1:0}let x=new Float32Array(t.seats.count),S=(ne,W)=>{for(let K=ne;K<ne+W;K++)x[K]=w[K]&&nw[t.seats.iState[K]]?1:0};S(0,t.seats.count);let A=new it.Geometry(e,{position:{size:3,data:v.position},normal:{size:3,data:v.normal},uv:{size:2,data:v.uv},index:{size:1,data:v.index},surface:{size:1,data:v.surface},iYaw:{size:1,data:t.seats.iYaw,instanced:1},iChairWidth:{size:1,data:t.seats.iChairWidth,instanced:1},iGlyph:{size:1,data:t.seats.iGlyph,instanced:1},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},iHasChair:{size:1,data:P,type:e.UNSIGNED_BYTE,usage:e.DYNAMIC_DRAW,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iTipUp:{size:1,data:x,usage:e.DYNAMIC_DRAW,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1},iSection:{size:1,data:t.seats.iSection,instanced:1}}),M=new it.Mesh(e,{geometry:A,program:d});M.frustumCulled=!1,t.seats.count>0&&M.setParent(o);let E=Ld(e,c,t.renderBounds,t.seats.count>0?A:null);l.uniforms.tVenueShadow={value:E.texture},l.uniforms.uShadowMatrix={value:E.matrix};let T=A.attributes.iColor,k=t.theme.structure.ground,_=new Map(t.sectionSolidRanges.map(ne=>[ne.sectionId,!0])),R=new Map((t.areaSolidRanges??[]).map(ne=>[ne.sectionId,!0])),C=ne=>{if(!ne.length)return;let W=c.attributes.color,K=W.buffer;if(!K){W.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,K);for(let Q of ne){let ve=t.solids.color.subarray(Q.start*3,(Q.start+Q.count)*3);e.bufferSubData(e.ARRAY_BUFFER,Q.start*3*Float32Array.BYTES_PER_ELEMENT,ve)}},O=sl(),B=Td(e,t.theme.materials.roughness),F=ai,N=new Float32Array(F*3),V=new Float32Array(F*3),H=new Float32Array(F),L=new Float32Array(F),G=new Float32Array(F),j=new Float32Array(F*3),D=new Float32Array(F),U=new Float32Array(F),$=new Float32Array(F),Z=new Float32Array(F*4),te=new Float32Array(F),X=new Float32Array(F),me=new Float32Array(F),re=new it.Geometry(e,{position:{size:3,data:O.position},normal:{size:3,data:O.normal},part:{size:1,data:O.part},index:{data:O.index},iOffset:{size:3,data:N,instanced:1},iColor:{size:3,data:V,instanced:1},iRadius:{size:1,data:H,instanced:1},iYaw:{size:1,data:L,instanced:1},iGlyph:{size:1,data:G,instanced:1},iRing:{size:3,data:j,instanced:1},iFloor:{size:1,data:D,instanced:1},iSection:{size:1,data:U,instanced:1},iPhysicalSeat:{size:1,data:$,instanced:1},iArmrests:{size:4,data:Z,instanced:1},iTipUp:{size:1,data:te,instanced:1},iTaken:{size:1,data:me,instanced:1},iPickIndex:{size:1,data:X,instanced:1}}),ce=ne=>ne.map(W=>1+(W-1)*tu);l.uniforms.uKeyColor.value.set(t.theme.light.key),l.uniforms.uAmbientColor.value.set(t.theme.light.ambient);for(let ne of[d,B])ne.uniforms.uKeyColor.value.set(ce(t.theme.light.key)),ne.uniforms.uAmbientColor.value.set(ce(t.theme.light.ambient));let J=new it.Mesh(e,{geometry:re,program:B});J.frustumCulled=!1;let ae=0,ie=!1,ge=!1,Ae=null,be=null,ke=null,Ke=new Int32Array(0),Be=()=>{let ne=t.seats;for(let W=0;W<ae;W++){let K=Ke[W];me[W]=ql(ne.iState[K]),te[W]=x[K],V[W*3]=p[K*3],V[W*3+1]=p[K*3+1],V[W*3+2]=p[K*3+2]}re.attributes.iColor.needsUpdate=!0,re.attributes.iTipUp.needsUpdate=!0,re.attributes.iTaken.needsUpdate=!0},Fe={main:o,background:r,backgroundProgram:a,seatProgram:d,solidProgram:l,chairProgram:B,seatGeometry:A,chairGeometry:re,solidGeometry:c,drawCalls:3+f,setNearSeats(ne,W){let K=Math.min(W,F,ne.length);if(yd(P,ne,K),A.attributes.iHasChair.needsUpdate=!0,Ke=ne,ae=K,K===0){J.parent&&J.setParent(null),re.instancedCount=0,Fe.drawCalls=3+f+(ie?1:0);return}let Q=t.seats;for(let ve=0;ve<K;ve++){let Ee=ne[ve];N[ve*3]=Q.iPosition[Ee*3],N[ve*3+1]=Q.iPosition[Ee*3+1],N[ve*3+2]=Q.iPosition[Ee*3+2],H[ve]=Q.iChairWidth[Ee],L[ve]=Q.iYaw[Ee],G[ve]=Q.iGlyph[Ee],j[ve*3]=Q.iRing[Ee*3],j[ve*3+1]=Q.iRing[Ee*3+1],j[ve*3+2]=Q.iRing[Ee*3+2],D[ve]=Q.iFloor[Ee],U[ve]=Q.iSection[Ee],$[ve]=Q.iPhysicalSeat[Ee],Z.set(Q.iArmrests.subarray(Ee*4,Ee*4+4),ve*4),X[ve]=Ee+1}Be(),re.attributes.iOffset.needsUpdate=!0,re.attributes.iRadius.needsUpdate=!0,re.attributes.iYaw.needsUpdate=!0,re.attributes.iGlyph.needsUpdate=!0,re.attributes.iRing.needsUpdate=!0,re.attributes.iFloor.needsUpdate=!0,re.attributes.iSection.needsUpdate=!0,re.attributes.iPhysicalSeat.needsUpdate=!0,re.attributes.iArmrests.needsUpdate=!0,re.attributes.iTaken.needsUpdate=!0,re.attributes.iPickIndex.needsUpdate=!0,re.instancedCount=K,J.parent||J.setParent(o),Fe.drawCalls=4+f+(ie?1:0)},nearSeatCount(){return ae},setSectionShellLit(ne){l.uniforms.uSectionFilter.value=ne===null?0:1;let W=bc(t.sectionSolidRanges,t.solids.color,n,_,ne,k);C(W)},setAreaFloorsQuiet(ne){let W=t.areaSolidRanges;if(!W?.length)return;let K=new Set(W.map(Q=>Q.sectionId).filter(Q=>!ne.has(Q)));C(bc(W,t.solids.color,n,R,K,k))},uploadSeatStateRuns(ne){if(!ne.length)return;for(let Q of ne)S(Q.start,Q.length);let W=A.attributes.iTipUp;if(!W.buffer)W.needsUpdate=!0;else{e.bindBuffer(e.ARRAY_BUFFER,W.buffer);for(let Q of ne)e.bufferSubData(e.ARRAY_BUFFER,Q.start*Float32Array.BYTES_PER_ELEMENT,x.subarray(Q.start,Q.start+Q.length))}for(let Q of ne)jd(p,t.seats.iState,Q.start,Q.length,b,y);ae&&Be();let K=T.buffer;if(!K){T.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,K);for(let Q of ne){let ve=p.subarray(Q.start*3,(Q.start+Q.length)*3);e.bufferSubData(e.ARRAY_BUFFER,Q.start*3*Float32Array.BYTES_PER_ELEMENT,ve)}},dispose(){ge=!0,E.dispose(),i.remove(),a.remove(),c.remove(),l.remove(),h?.dispose(),A.remove(),d.remove(),re.remove(),B.remove(),Ae?.remove(),be?.remove(),ke?.texture&&e.deleteTexture(ke.texture)}},Ge=t.productionElements.find(ne=>ne.contentImageUrl&&ne.contentPlane);if(Ge?.contentImageUrl&&Ge.contentPlane?.length===4&&typeof Image<"u"){let ne=new Image;ne.crossOrigin="anonymous",ne.onload=()=>{if(ge)return;let W=Ge.contentPlane;Ae=new it.Geometry(e,{position:{size:3,data:new Float32Array(W.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(Ge.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),ke=new it.Texture(e,{image:ne,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),be=new it.Program(e,{vertex:`#version 300 es
1196
1314
  precision highp float;
1197
1315
  in vec3 position; in vec2 uv; in float floorIndex;
1198
1316
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
@@ -1200,4 +1318,4 @@ void main() {
1200
1318
  void main(){ vUv=uv; vDim=(uFocusFloor < -0.5 || abs(floorIndex-uFocusFloor)<0.5)?0.0:1.0; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }`,fragment:`#version 300 es
1201
1319
  precision highp float;
1202
1320
  in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
1203
- void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:Pe},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let q=new ze.Mesh(e,{geometry:me,program:pe});q.frustumCulled=!1,q.setParent(n),Ce.screenProgram=pe,ue=!0,Ce.drawCalls=3+(ne?1:0)+1},B.src=$.contentImageUrl}return Ce}var Dt=require("ogl");function Iv(e,t,n){let o=e+(t<<8)+(n<<16);return o===0?-1:o-1}function ch(e,t,n,o,r,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,m=Iv(e[u],e[u+1],e[u+2]);if(m<0||m>=i)continue;let f=l-o,h=c-r,d=f*f+h*h;d<s&&(s=d,a=m)}return a}function lh(e,t,n,o,r,i){let a=e-n.left,s=t-n.top,c=Math.round(a*o),l=Math.round((n.height-s)*o);return{x:Math.max(0,Math.min(r-1,c)),y:Math.max(0,Math.min(i-1,l))}}var _v=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],ii=class{constructor(t,n,o,r,i){this.seatScene=new Dt.Transform;this.chairScene=new Dt.Transform;this.solidScene=new Dt.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=$f(this.gl),this.chairProg=Zf(this.gl),this.depthProg=qf(this.gl);let a=new Dt.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Dt.Mesh(this.gl,{geometry:o,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Dt.Mesh(this.gl,{geometry:r,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRoomCentre(t){this.depthProg.uniforms.uRoomCentre.value.set(t??[0,0])}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of _v)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;let o=t.uniforms.uSeeThrough?.value;if(o)for(let r of[this.seatProg,this.chairProg,this.depthProg])r.uniforms.uSeeThrough.value=o}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 Dt.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,o,r){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-r),u=Math.max(0,o-r),m=Math.max(1,Math.min(s,n+r+1)-l),f=Math.max(1,Math.min(c,o+r+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(l,u,m,f);let[h,d,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(h,d,p,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(m*f*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,u,m,f,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),ch(b,m,f,n-l,o-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function uh(e,t){let n=[];for(let o of t)e.has(o.seatId)?e.set(o.seatId,ho(o.state)):n.push(o);return n}function mh(e,t,n){let o=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&o.add(a);let r=new Map(e),i=[];for(let[a,s]of e)o.has(a)||(i.push({seatId:a,state:je[s]??"available"}),r.delete(a));for(let a of o){if(r.has(a))continue;let s=n(a);s!==void 0&&(r.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:r}}var rn=require("ogl");function Cv(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function fh(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Tv(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function hh(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 bs(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function ys(e,t){return Math.max(0,Math.min(1,e+t))}function dh(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let o=Math.max(0,Math.min(1,t)),r=n-1,i=Math.floor(o*r);i>=r&&(i=r-1);let a=o*r-i,s=e[Math.max(0,i-1)],c=e[i],l=e[i+1],u=e[Math.min(n-1,i+2)],m=a*a,f=m*a,h=[0,0,0];for(let d=0;d<3;d++)h[d]=.5*(2*c[d]+(-s[d]+l[d])*a+(2*s[d]-5*c[d]+4*l[d]-u[d])*m+(-s[d]+3*c[d]-3*l[d]+u[d])*f);return h}function gs(e,t,n,o,r){let i=hh(Cv(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=fh(fh(t,Tv(i,2.5)),[0,1.5,0]),s=[t[0]-o[0],0,t[2]-o[2]],c=hh(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,r),u=[o[0]+c[0]*l*1.3,o[1]+l*.75,o[2]+c[2]*l*1.3];return{waypoints:[e,u,a],finalPos:a}}function xs(e,t,n=35,o=28){let r=bs(t),i=dh(e,r),a=bs(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(o-n)*a,eased:r}}function gh(e,t,n){let o=e.position.clone(),r=new rn.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new rn.Vec3(n[0],n[1],n[2]));let i=new rn.Quat().copy(e.quaternion);return e.position.copy(o),e.quaternion.copy(r),i}var ai=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new rn.Quat;this.endQuat=new rn.Quat;this.outQuat=new rn.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,o,r=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(o),this.duration=r,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:o,fov:r,eased:i}=xs(this.waypoints,n,35,this.endFov);return this.camera.position.set(o[0],o[1],o[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,ys(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=r,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 xh=Qs,Lv=.12,kv=1.6,Mh=.12;function vh(e,t,n){let o=e[t*3],r=e[t*3+1],i=e[t*3+2],a=n[0]-o,s=n[2]-i,c=Math.hypot(a,s);if(!(c>.001))return null;let l=a/c,u=s/c,m=1/0,f=null;for(let h=0;h*3<e.length;h++){if(h===t)continue;let d=e[h*3]-o,p=e[h*3+2]-i,b=d*l+p*u;b<.3||b>1.6||Math.abs(d*u-p*l)>.6||b<m&&(m=b,f=r-e[h*3+1])}return f}var Ov=.25,Fv=1.5;function Sh(e,t,n=0,o,r,i=!1){let a=[t.x*C,n+Fv,t.y*C],s=r?[r[0],r[1],r[2]]:a,c=e[1],l=Number.isFinite(c)?c+(i?kv:xh):Number.isFinite(o)?n+o:n+xh,u=a[0]-e[0],m=a[2]-e[2],f=Math.hypot(u,m),h=f>.001?Math.min(Lv,f*Ov):0,d=f>.001?u/f:0,p=f>.001?m/f:0;return{eye:[e[0]+d*h,l,e[2]+p*h],focal:s}}var an=Math.PI/180,Dv=45,Ms=80,si=70,Nv=1,Bv=.99;function Vv(e,t){if(!(e<Nv))return Ms;if(!(Number.isFinite(t)&&t>0))return si;let n=2*Math.atan(t/(2*ci*Bv)/Math.max(.05,e))/an;return Math.max(si,Math.min(Ms,n))}var Gv=.25,ci=1,Hv=.25,zv=12*an,Uv=.2,jv=1.5,wh=.8,Ph=6,Ch=1.9,Wv=2/3,Xv=.12,Kv=.9,Yv=1.2,$v=2,Th=.05,Zv=6;function Lh(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+wh,t[1]),t[2]+6]};let o=1/0,r=-1/0,i=1/0,a=-1/0,s=n;for(let d of e)o=Math.min(o,d.cx-d.halfX),r=Math.max(r,d.cx+d.halfX),i=Math.min(i,d.cz-d.halfZ),a=Math.max(a,d.cz+d.halfZ),s=Math.max(s,d.y);let c=r-o,l=a-i,u=Math.max(c,Math.min(l,Ph))/2,m=Math.max(l,Math.min(c,Ph))/2,f=(o+r)/2,h=(i+a)/2;return{min:[f-u,n,h-m],max:[f+u,Math.max(n+wh,s),h+m]}}function qv(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Ch,e.max[2]]}}function vs(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+jv,t+Uv,t+Ch*Wv),(e.min[2]+e.max[2])/2]}function kh(e,t){let n=e[0]-t[0],o=e[2]-t[2],r=Math.hypot(n,o);return r<.001?{x:0,z:1}:{x:n/r,z:o/r}}function Ah(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(o,r,i)||1;o/=a,r/=a,i/=a;let s=-i,c=o,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let u=1/0,m=-1/0;for(let f=0;f<8;f++){let h=(f&1?n.max[0]:n.min[0])-e[0],d=(f&2?n.max[1]:n.min[1])-e[1],p=(f&4?n.max[2]:n.min[2])-e[2],b=Math.max(Th,h*o+d*r+p*i),x=(h*s+p*c)/b;x<u&&(u=x),x>m&&(m=x)}return m-u}function Rh(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(o,r,i)||1;o/=a,r/=a,i/=a;let s=-i,c=o,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let u=-c*r,m=c*o-s*i,f=s*r,h=1/0,d=-1/0;for(let p=0;p<8;p++){let b=(p&1?n.max[0]:n.min[0])-e[0],x=(p&2?n.max[1]:n.min[1])-e[1],y=(p&4?n.max[2]:n.min[2])-e[2],M=Math.max(Th,b*o+x*r+y*i),A=(b*u+x*m+y*f)/M;A<h&&(h=A),A>d&&(d=A)}return d-h}function li(e,t){return Math.tan(e*an/2)*Math.max(.05,t)}function Eh(e,t,n){let o=Vv(n,e),r=c=>Math.max(Dv,Math.min(o,c)),i=c=>2*Math.atan(c)/an,a=Number.isFinite(e)&&e>0?r(i(e/(2*Gv)/Math.max(.05,n))):o;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,r(i(t/(2*Xv))));return e/(2*li(s,n))>ci?a:s}function Oh(e,t,n,o={}){let r=vs(t),i=[e[0],e[1],e[2]],a=0,s=0,c=d=>{if(!(d>0))return;let p=kh(i,r);i[0]+=p.x*d,i[2]+=p.z*d,s+=d},l=o.preserveEye?0:t.max[1]+Hv-i[1];l>0&&(i[1]+=l,a=l,c(l/Math.tan(zv)));let u=qv(t),m=Ah(i,r,t),f=Eh(m,Rh(i,r,u),n),h=m/(2*li(f,n));for(let d=0;!o.preserveEye&&d<Zv&&h>ci;d++){let p=Math.max(1,Math.hypot(i[0]-r[0],i[2]-r[2])),b=Number.isFinite(h)?h/ci:2;c(Math.min(60,p*(Math.min(4,b)-1)+.5)),m=Ah(i,r,t),f=Eh(m,Rh(i,r,u),n),h=m/(2*li(f,n))}return{eye:i,focal:r,fov:f,raisedM:a,pulledBackM:s,stageFrameWidth:h}}function Qv(e,t,n){let o=Math.tan(t*an/2),r=li(t,n);return Math.max(1,e/Math.max(.05,Math.min(o,r)))}var Jv=.7,Ih=.5,e2=.8;function _h(e,t,n){let o=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],r=[n[0]-e[0],n[1]-e[1],n[2]-e[2]],i=o[0]*r[0]+o[1]*r[1]+o[2]*r[2],a=Math.hypot(o[0],o[1],o[2])*Math.hypot(r[0],r[1],r[2])||1;return Math.acos(Math.max(-1,Math.min(1,i/a)))/an}function t2(e,t,n){let o=l=>{let u=Math.hypot(l[0],l[1],l[2])||1;return[l[0]/u,l[1]/u,l[2]/u]},r=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],i=Math.hypot(r[0],r[1],r[2]),a=o(r),s=o([n[0]-e[0],n[1]-e[1],n[2]-e[2]]),c=o([0,1,2].map(l=>a[l]*(1-Ih)+s[l]*Ih));return[e[0]+c[0]*i,e[1]+c[1]*i,e[2]+c[2]*i]}function Fh(e,t){let{aspect:n,venue:o}=t,r=e.focal,i=kh(e.eye,r),a=p=>(p[0]-r[0])*i.x+(p[2]-r[2])*i.z,s=[{name:"seat",eye:e.eye,focal:r,fov:e.fov}],c=$v*(t.rowDepthM??Kv),l=[e.eye[0]+i.x*c,e.eye[1]+Yv,e.eye[2]+i.z*c],u=[e.eye[0],e.eye[1]-Jv,e.eye[2]],m=t2(l,r,u);s.push({name:"row",eye:l,focal:m,fov:Math.min(Ms,Math.max(e.fov,2*Math.max(_h(l,m,u),_h(l,m,r))/e2))});let f=(p,b,x,y)=>{let M=Qv(x,e.fov,n)*1.08,A=M*Math.sin(y*an),w=Number.isFinite(t.seatingTopY)?t.seatingTopY+2:-1/0,g=Math.max(A,w-b[1]),S=M*Math.cos(y*an);return{name:p,eye:[b[0]+i.x*S,b[1]+g,b[2]+i.z*S],focal:b,fov:e.fov}};t.section&&t.section.radius>0&&s.push(f("section",t.section.center,t.section.radius,35)),s.push(f("venue",o.center,Math.max(1,o.radius),40));let h=[],d=-1/0;for(let p of s){let b=a(p.eye);h.length&&b<=d+.5||(h.push(p),d=b)}return h}var Vh=require("ogl"),Zo=Math.PI/180,Ss=320,Dh=70*Zo,n2=32*Zo,o2=24*Zo,Nh=.0026,r2=.22,i2=.006,a2=180,s2=900,c2=1100,l2=4,ct=(e,t,n)=>Math.max(t,Math.min(n,e)),Bh=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Gh(e){let{canvas:t,camera:n}=e,o=[],r=!1,i=0,a=0,s=0,c=0,l=0,u=0,m=Ss,f=null,h=()=>{f&&(clearTimeout(f),f=null)},d=!1,p=[0,0],b=0,x=!1,y=null,M=null,A=new Map,w=!1,g=0,S=0,v=0,P=0,E=()=>r&&o.length?o[ct(Math.round(i),0,o.length-1)].name:null,k=()=>{let T=E();T!==y&&(y=T,e.onStopChange?.(T))},L=()=>{if(!r||!o.length)return;let T=o[ct(Math.floor(i),0,o.length-1)],D=o[ct(Math.ceil(i),0,o.length-1)],W=ct(i-Math.floor(i),0,1),H=(xe,Ce)=>xe+(Ce-xe)*W,j=[H(T.eye[0],D.eye[0]),H(T.eye[1],D.eye[1]),H(T.eye[2],D.eye[2])],Z=[H(T.focal[0],D.focal[0]),H(T.focal[1],D.focal[1]),H(T.focal[2],D.focal[2])],X=Z[0]-j[0],ee=Z[1]-j[1],ne=Z[2]-j[2],ue=Math.hypot(X,ee,ne)||1,de=Math.atan2(X,ne),me=Math.asin(ct(ee/ue,-1,1)),pe=de+a,Pe=ct(me+s,-80*Zo,80*Zo),_e=Math.cos(Pe)*ue;X=Math.sin(pe)*_e,ee=Math.sin(Pe)*ue,ne=Math.cos(pe)*_e,n.position.set(j[0],j[1],j[2]),n.fov=H(T.fov,D.fov),n.updateProjectionMatrix(),n.lookAt(new Vh.Vec3(j[0]+X,j[1]+ee,j[2]+ne)),e.onApplied?.()},I=()=>{if(!r||!o.length)return;let T=ct(Math.round(i),0,o.length-1);if(e.reducedMotion()){d=!1,i=T,L(),k(),e.requestRender();return}if(Math.abs(T-i)<.001){d=!1,k();return}c=i,l=T,u=performance.now(),m=Ss,d=!0,e.requestRender()},R=T=>{!r||o.length<2||(h(),d=!1,i=ct(i+T,0,o.length-1),L(),k(),e.requestRender())},_=(T,D)=>{r&&(h(),d=!1,x=!1,a=ct(a-T*Nh,-Dh,Dh),s=ct(s-D*Nh,-o2,n2),L(),e.requestRender())},F=T=>{r&&(A.set(T.pointerId,{x:T.clientX,y:T.clientY}),A.size===1?(w=!0,P=0,g=T.clientX,S=T.clientY):A.size===2&&(w=!1,v=N()))},N=()=>{let T=[...A.values()];return T.length<2?0:Math.hypot(T[0].x-T[1].x,T[0].y-T[1].y)},O=T=>{if(!r||!A.has(T.pointerId))return;if(A.set(T.pointerId,{x:T.clientX,y:T.clientY}),A.size>=2){let H=N();v>0&&R((v-H)*i2),v=H;return}if(!w)return;let D=T.clientX-g,W=T.clientY-S;g=T.clientX,S=T.clientY,P+=Math.abs(D)+Math.abs(W),!(P<=l2)&&_(D,W)},V=T=>{A.delete(T.pointerId)&&(A.size<2&&(v=0),A.size===0&&(w=!1,I()))},z=T=>{if(!r)return;T.preventDefault();let D=T.deltaMode===1?16:T.deltaMode===2?100:1,W=ct(T.deltaY*D/100,-2,2);R(W*r2),M&&clearTimeout(M),M=setTimeout(()=>{M=null,I()},a2)},G=()=>{h(),r&&(r=!1,d=!1,x=!1,o=[],A.clear(),w=!1,M&&(clearTimeout(M),M=null),y!==null&&(y=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",F),t.addEventListener("pointermove",O),t.addEventListener("pointerup",V),t.addEventListener("pointercancel",V),t.addEventListener("wheel",z,{passive:!1}),{get active(){return r},enter(T,D=0){if(T.length<2){G();return}h(),o=T,r=!0,i=e.reducedMotion()?0:ct(D,0,T.length-1),i>0&&(f=setTimeout(()=>{f=null,r&&(c=i,l=0,u=performance.now(),m=c2,d=!0,e.requestRender())},s2)),a=0,s=0,d=!1,x=!1,y=null,L(),k(),e.requestRender()},exit:G,recentre(){return r?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(x=!1,a=0,s=0,L(),e.requestRender(),!0):(p=[a,s],b=performance.now(),x=!0,e.requestRender(),!0):!1},update(T){if(!r)return!1;let D=!1;if(x){let W=ct((T-b)/Ss,0,1),H=1-Bh(W);a=p[0]*H,s=p[1]*H,W>=1?(x=!1,a=0,s=0):D=!0}if(d){let W=ct((T-u)/m,0,1);i=c+(l-c)*Bh(W),W>=1?(d=!1,i=l,k()):D=!0}return L(),D},currentStop:E,dispose(){G(),t.removeEventListener("pointerdown",F),t.removeEventListener("pointermove",O),t.removeEventListener("pointerup",V),t.removeEventListener("pointercancel",V),t.removeEventListener("wheel",z)}}}function Hh(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}function zh(e,t){return e?-1:t}var Rs=null;function td(){return Rs??=Promise.resolve().then(()=>(ed(),Jh)).catch(e=>{throw Rs=null,e}),Rs}var nd=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),bi=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,o,r){this.emit("3d_opened",{seats:t,hasHeights:n,...o===void 0?{}:{buildMs:Math.round(o)},...r===void 0?{}:{prepSource:r}})}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=nd(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(nd()-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 od(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function rd(e){let{container:t,model:n,opts:o,expandedSeatById:r,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let m=a();Object.assign(s.style,m?{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:(m,f,h=!1)=>{if(l(),e.isDisposed())return null;let d=document.createElement("div");d.setAttribute("role","group"),Object.assign(d.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.chrome?.caption!==!1,b=o.chrome?.seatStepper!==!1;if(!p&&!b)return null;let x=r.get(m),y=x?.sectionId?n.sections.find(E=>E.id===x.sectionId):void 0,M=x?.label??m;d.setAttribute("aria-label",`Explore views near ${y?.label?`${y.label}, `:""}seat ${M}`);let A=document.createElement("span");A.textContent=o.seatViewCaption?.(m)??["Live 3D seat view",y?.label,M].filter(Boolean).join(" \xB7 "),Object.assign(A.style,{maxWidth:"min(70vw, 560px)",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)"}),p&&d.appendChild(A);let w=document.createElement("div");Object.assign(w.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),d.appendChild(w);let g=x?.rowId?i.get(x.rowId):void 0,S=g?.indexOf(m)??-1,v=S>=0?[g?.[S-1],g?.[S+1]]:[void 0,void 0],P=(E,k,L,I=!1)=>{let R=document.createElement("button");R.type="button",R.textContent=E,R.setAttribute("aria-label",k),Object.assign(R.style,{minHeight:"44px",padding:I?"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"}),I||(R.style.minWidth="44px"),I&&(R.dataset.panoramaTrigger=""),R.addEventListener("click",L),w.appendChild(R)};if(b&&v[0]){let E=r.get(v[0])?.label??v[0];P("\u2039",`View previous seat ${E}`,()=>{e.flyToSeat(v[0])})}if(b&&o.getSeatView){let E=o.seatViewActionLabel?.(m)??"Open 360\xB0 panorama";P(h?`\u21BB Retry ${E}`:`\u25C9 ${E}`,`${h?"Retry":E} from seat ${M}`,()=>{if(e.isDisposed()||f!==e.flightGen()){l();return}l(),e.openPanorama(m,400,f)},!0)}if(b&&v[1]){let E=r.get(v[1])?.label??v[1];P("\u203A",`View next seat ${E}`,()=>{e.flyToSeat(v[1])})}return!w.childElementCount&&!p?null:(t.appendChild(d),s=d,c(),d)},remove:l,layout:c}}var P2={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function id(e){let{container:t,orbit:n,isNarrow:o}=e,r={...P2,...e.labels??{}},i=(w,g)=>{w.setAttribute("aria-label",g),w.title=g},a=document.createElement("div"),s=!1;a.className="sl-3d-navigation-controls",Object.assign(a.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let c=document.createElement("div");c.setAttribute("role","group"),c.setAttribute("aria-label","3D drag mode"),Object.assign(c.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let l=document.createElement("div");l.setAttribute("role","group"),l.setAttribute("aria-label","3D view controls"),Object.assign(l.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("button");u.type="button",u.textContent="\u21BB",i(u,r.rotate);let m=document.createElement("button");m.type="button",m.textContent="\u2725",i(m,r.move);let f=document.createElement("button");f.type="button",f.textContent="\u2212",i(f,r.zoomOut);let h=document.createElement("button");h.type="button",h.textContent="+",i(h,r.zoomIn);for(let w of[u,m,f,h])w.className="sl-3d-icon-control",Object.assign(w.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"});c.append(u,m),l.append(h,f);let d=null,p=()=>{let w=n.dragAction();if(w===d)return;d=w;let g=w==="orbit";u.setAttribute("aria-pressed",String(g)),m.setAttribute("aria-pressed",String(!g)),u.style.background=g?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",m.style.background=g?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=g?`${r.rotate} \xB7 ${r.move} with Shift`:`${r.move} \xB7 ${r.rotate} with Shift`},b=w=>{n.setPrimaryDragMode(w),p()};u.addEventListener("click",()=>b("orbit")),m.addEventListener("click",()=>b("pan"));let x=()=>{let{atMin:w,atMax:g}=n.dollyLimitState();h.disabled!==w&&(h.disabled=w),f.disabled!==g&&(f.disabled=g)};f.addEventListener("click",()=>{n.zoomBy(po),x()}),h.addEventListener("click",()=>{n.zoomBy(Ln),x()}),a.append(c,l),b("auto"),t.appendChild(a);let y=e.enabled!==!1,M=()=>{let w=o();a.style.display=s||!y?"none":"flex",a.style.right=w?"12px":"14px",a.style.bottom=w?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=w?"none":"flex",h.style.display=w?"none":"",f.style.display=w?"none":""};return M(),{element:a,utilityControls:l,setNavigationMode:b,syncNavigationMode:p,syncZoomLimits:x,setSeatViewLocked:w=>{s=w,n.setInteractionEnabled(!w),M()},seatViewLocked:()=>s,layout:M}}var A2=.5,ad=12,sd=20,R2=28;function E2(e,t,n){return!(e>0)||!(n>0)?0:A2*n/(2*e*Math.tan(t*Math.PI/360))}function cd(e){let{glctx:t,orbit:n,model:o,seats:r,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:m,cancelFlight:f,focusSectionCamera:h,setSelection:d,ensureSeatView:p}=e,b=0,x=0,y=0,M=-1,A=!1,w=!1,g=I=>{e.seatViewLocked()||M===-1&&(M=I.pointerId,b=I.clientX,x=I.clientY,y=performance.now(),A=!1,w=a.active,a.active&&(s.cinematicCancelled(),f(),i.onViewTargetChange?.(null)))},S=I=>{I.pointerId===M&&Math.hypot(I.clientX-b,I.clientY-x)>u&&(A=!0)},v=(I,R,_,F,N)=>{let O=t.canvas.getBoundingClientRect(),V=t.canvas.clientWidth||O.width||1,z=t.canvas.clientHeight||O.height||1,G=I-O.left,T=R-O.top,D=F*F,W=-1,H=D,j=1/0;for(let Z of r){if(_&&Z.sectionId!==_)continue;let X=o.seats.idToIndex.get(Z.id);if(X===void 0)continue;if(N){let pe=Math.round(o.seats.iState[X]??0);if(pe!==0&&pe!==3)continue}let ee=X*3,ne=Ot(n.camera.projectionViewMatrix,[o.seats.iPosition[ee],o.seats.iPosition[ee+1]+.55,o.seats.iPosition[ee+2]],V,z);if(!ne.visible)continue;let ue=ne.x-G,de=ne.y-T,me=ue*ue+de*de;(me<H||Math.abs(me-H)<1&&ne.depth<j)&&(W=X,H=me,j=ne.depth)}return W},P=(I,R)=>{let _=e.gpu(),F=e.pick();if(!_||!F)return-1;F.syncFromSeatProgram(_.seatProgram);let N=t.canvas.getBoundingClientRect(),O=t.renderer.dpr,{x:V,y:z}=lh(I,R,N,O,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),G=Math.max(2,Math.round(8*O));return F.pick(n.camera,V,z,G)},E=()=>t.canvas.clientHeight||t.canvas.getBoundingClientRect().height,k=(I,R=ad)=>{let _=n.camera?.position;if(!_)return!1;let F=I*3,N=Math.hypot(_.x-o.seats.iPosition[F],_.y-o.seats.iPosition[F+1],_.z-o.seats.iPosition[F+2]);return E2(N,n.fovY,E())>=R};return{onDown:g,onMove:S,onUp:I=>{if(I.pointerId!==M)return;let R=!A&&performance.now()-y<m;if(M=-1,w){w=!1;return}let _=e.gpu(),F=e.pick();if(!R||!_||!F)return;let N=P(I.clientX,I.clientY),O=I.pointerType==="touch"||I.pointerType==="pen",V=O?sd:ad,z=N>=0&&k(N,V),G=!1;if(e.focusedSectionId()&&N>=0){let W=c[N],H=W?l.get(W):void 0;if(H&&H!==e.focusedSectionId()&&h(H,{keepCamera:z})){if(!z)return;G=!0}}if(e.focusedSectionId()&&N<0&&(N=v(I.clientX,I.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&N<0){let W=v(I.clientX,I.clientY,null,72,!1),H=W>=0?c[W]:void 0,j=H?l.get(H):void 0;if(j&&j!==e.focusedSectionId()&&h(j))return}if(!e.focusedSectionId()){N<0&&(N=v(I.clientX,I.clientY,null,42,!1));let W=N>=0?c[N]:void 0,H=W?l.get(W):void 0;if(H&&h(H,{keepCamera:z})){if(!z)return;G=!0}}if(N<0||N>=c.length){e.selection().size&&(d([]),i.onViewTargetChange?.(null));return}let T=c[N];if(O&&e.focusedSectionId()&&!G&&!k(N,sd)){e.focusSeatCamera(T,{seatPx:R2,viewportHeightPx:E()});return}let D=je[Math.round(o.seats.iState[N]??0)]??"available";if(D!=="available"&&D!=="selected"){i.onSeatInspect?.(T,D);return}if(e.selection().has(T)&&e.selection().size===1){d([]),i.onViewTargetChange?.(null),i.onSeatPick?.(T);return}d([T]),p(T),s.seatPicked(T,l.get(T)),i.onSeatPick?.(T)}}}var yi=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,o=1/0,r=-1/0,i=-1/0;for(let h=0;h<this.count;h++){let d=t[h*3],p=t[h*3+2];d<n&&(n=d),d>r&&(r=d),p<o&&(o=p),p>i&&(i=p)}let a=Math.max(r-n,.001),s=Math.max(i-o,.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=o;let c=this.cols*this.rows,l=new Int32Array(c+1),u=h=>{let d=Math.min(this.cols-1,Math.max(0,Math.floor((t[h*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[h*3+2]-o)/this.cell)))*this.cols+d};for(let h=0;h<this.count;h++)l[u(h)+1]++;for(let h=0;h<c;h++)l[h+1]+=l[h];let m=new Int32Array(this.count),f=l.slice(0,c);for(let h=0;h<this.count;h++)m[f[u(h)]++]=h;this.cellStart=l,this.cellItems=m}gather(t,n,o,r,i){this.ensureGrid();let a=this.cellStart,s=this.cellItems;if(!a||!s)return 0;let c=r.length,l=o*o,u=Math.floor((t-this.minX)/this.cell),m=Math.floor((n-this.minZ)/this.cell),f=Math.ceil(o/this.cell)+1,h=this.iPosition,d=0;for(let p=0;p<=f&&d<c;p++){let b=m-p,x=m+p,y=u-p,M=u+p;for(let A=b;A<=x&&d<c;A++){if(A<0||A>=this.rows)continue;let w=A===b||A===x;for(let g=y;g<=M&&d<c;g++){if(!w&&g!==y&&g!==M){g=M-1;continue}if(g<0||g>=this.cols)continue;let S=A*this.cols+g;for(let v=a[S],P=a[S+1];v<P&&d<c;v++){let E=s[v],k=h[E*3]-t,L=h[E*3+2]-n,I=i===void 0?0:h[E*3+1]-i;k*k+I*I+L*L<=l&&(r[d++]=E)}}}}return d}};var gi=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(pr);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new yi(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,o=this.ctx.gpu();if(!o)return;if(!t){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let r=this.ctx.orbit().camera.position;if(Math.hypot(r.x-this.lastGatherX,r.y-this.lastGatherY,r.z-this.lastGatherZ)<Wi)return;if(this.lastGatherX=r.x,this.lastGatherY=r.y,this.lastGatherZ=r.z,Math.hypot(r.x-n.bounds.center[0],r.y-n.bounds.center[1],r.z-n.bounds.center[2])-n.bounds.radius>ji){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(r.x,r.z,ji,this.nearBuf,r.y);s===0&&o.nearSeatCount()===0||o.setNearSeats(this.nearBuf,s)}ease(t,n,o){let r=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?r:i),this.structureDetailMix+=(o-this.structureDetailMix)*(o>this.structureDetailMix?r:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(o-this.structureDetailMix)<.01&&(this.structureDetailMix=o)}};function ld(e){let t=Math.max(5,e.radius),n=e.focalWorld[0]-e.center[0],o=e.focalWorld[2]-e.center[2],r=Math.hypot(n,o);if(r<t*.12)return{center:e.center,radius:t,polarDeg:48};let i=Math.min(r*.25,t*.2);return{center:[e.center[0]+n/r*i,e.center[1],e.center[2]+o/r*i],radius:t+i,polarDeg:50}}var xi=require("ogl");function ud(){let e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round");let n=document.createElementNS(e,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),t.appendChild(n),t}function md(e){let{container:t,model:n,opts:o,orbit:r,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=e,m=0,f=-1,h=(E,k,L=28)=>{r.camera.position.set(E[0],E[1],E[2]),r.camera.lookAt(new xi.Vec3(k[0],k[1],k[2])),r.camera.fov=L,r.camera.updateProjectionMatrix()},d=document.createElement("button");d.className="sl-3d-overview-control sl-3d-icon-control",d.type="button",d.replaceChildren(ud());let p=o.navLabels?.fitView??"Show whole venue";d.setAttribute("aria-label",p),d.title=p,Object.assign(d.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 b=()=>{d.firstElementChild||d.replaceChildren(ud())};b();let x=E=>{f=E;let k=e.gpu();k&&(k.seatProgram.uniforms.uFocusFloor.value=E,k.solidProgram.uniforms.uFocusFloor.value=E,k.chairProgram.uniforms.uFocusFloor.value=E),e.showSectionSeatLabels(null)},y=null,M=!1,A=()=>{if(y=null,M=!1,e.setSeeThrough?.(null),e.isDisposed())return;o.onViewTargetChange?.(null),o.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),d.style.display="",c.setVisible(!0),e.setFrozen(!1);let E=f>=0?n.floors[f]:null;if(e.setNearFieldDetailEnabled(!!E),e.setSeatViewLocked(!1),w(),e.removeArriveChip(),e.setNavigationMode("auto"),E){let k=E.focalWorld[0]-E.center[0],L=E.focalWorld[2]-E.center[2],I=Math.hypot(k,L)>E.radius*.12?Math.atan2(k,L):l,R={center:E.center,radius:E.radius,box:E.box},_={polarDeg:58,margin:1.12};e.reducedMotion()?r.frame(R,!1,I,!1,_):r.frameSoft(R,I,!1,_)}else e.reducedMotion()?r.frame(n.bounds,!1,l,o.portraitOverviewCrop===!0,u):r.frameSoft(n.bounds,l,o.portraitOverviewCrop===!0,u);c.setOverviewDistance(r.targetDistance),e.showSectionSeatLabels(null),s.requestRender()},w=()=>{m++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),r.resumeAfterFlight(n.focalWorld))},g=E=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let k=n.seats.idToIndex.get(E);if(k===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),o.onViewTargetChange?.(E),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),d.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let L=e.inSeatView()&&o.arriveAtSeatEye===!0;e.setSeatStepping(L),e.setSeatViewLocked(!1);let I=++m;L?e.showArriveChip(E,I):e.removeArriveChip();let{eye:R,focal:_}=e.resolvedSeatViewPose(E,k),F=o.arriveAtSeatEye?e.seatViewArrival(E,k):null,N=F&&F.stops.length>1&&F.stops[1].name==="row"?F.stops[1]:null,O=F?F.focal:_,V=[r.camera.position.x,r.camera.position.y,r.camera.position.z],z=gs(V,F?.eye??R,O,n.bounds.center,n.bounds.radius),G=N?N.eye:F?F.eye:o.arriveAtSeatEye?R:z.finalPos,T=F?F.fov:o.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?si:65:28,D=[z.waypoints[0],z.waypoints[1],G];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),h(G,O,T),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||r.syncFromCamera(),e.setSeatViewLocked(o.arriveAtSeatEye===!0),F&&e.enterSeatView(F.stops),e.showArriveChip(E,I),Promise.resolve();let W=new xi.Quat().copy(r.camera.quaternion),H=gh(r.camera,G,O);s.requestRender();let j=L?700:2500;return i.start(D,W,H,j,T).then(()=>{e.isDisposed()||I!==m||(e.setSeatStepping(!1),a.cinematicPlayed(j),r.resumeAfterFlight(O),e.setSeatViewLocked(o.arriveAtSeatEye===!0),F&&e.enterSeatView(F.stops,N?1:0),s.requestRender(),e.showArriveChip(E,I))})},S=(E,k)=>{let L=n.sections.find(I=>I.id===E);if(!L||L.seatCount===0)return!1;if(y=E,M=!1,e.setSeeThrough?.(null),e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&f!==L.floorIndex&&x(L.floorIndex),e.setNavigationMode("auto"),e.panorama()||c.setVisible(!0),e.showSectionSeatLabels(E),!k?.keepCamera){let I=ld(L),R={polarDeg:I.polarDeg,margin:1.12};e.reducedMotion()?r.frame({center:I.center,radius:I.radius},!1,r.currentAzimuth,!1,R):r.glideTo({center:I.center,radius:I.radius},R)}return o.onSectionFocusChange?.(E),s.requestRender(),!0},v=(E,k)=>{if(e.isDisposed()||!e.gpu())return!1;let L=n.seats.idToIndex.get(E);if(L===void 0)return!1;let I=L*3,R=[n.seats.iPosition[I],n.seats.iPosition[I+1]+.55,n.seats.iPosition[I+2]],_=k?I2(k,r.fovY,r.camera.aspect||1):fd;return M=!0,e.setSeeThrough?.(R),e.reducedMotion()?r.frame({center:R,radius:_},!1,void 0,!1,Es):r.frameSoft({center:R,radius:_},void 0,!1,Es),s.requestRender(),!0},P=()=>{if(e.isNarrow?.()&&M&&y&&S(y)){s.requestRender();return}A()};return d.addEventListener("click",P),{overviewChip:d,layoutOverviewChip:b,flightGen:()=>m,focusedFloor:()=>f,applyFloorFocus:x,placeCameraFinal:h,cancelFlight:w,focusOverview:A,flyToSeat:g,focusSectionCamera:S,focusSeatCamera:v}}var fd=4.5;function I2(e,t,n){let o=Math.tan(t*Math.PI/360),r=o*Math.max(.001,n),a=_2*e.viewportHeightPx/(2*Math.max(1,e.seatPx)*o)*Math.min(o,r)/Es.margin;return Math.max(C2,Math.min(fd,a))}var _2=.5,C2=1.5,Es={polarDeg:48,margin:1.25};function Qo(e,t){let{doc:n,report:o}=Jr(e),r=o.confident&&(o.sections.length>0||!!o.looseRowBlocks);if(!r&&!o.roles?.length)return null;if(!r){let c=new Map(o.roles.map(h=>[h.id,h.role])),l=h=>h.map(d=>d.type==="shape"&&c.has(d.id)?{...d,role:c.get(d.id)}:d),u=e.floors?.map(h=>({...h,objects:l(h.objects)})),m=new Float64Array(t.length).fill(Number.NaN),f=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((h,d)=>{h.eyeHeightM!==void 0&&(m[d]=h.eyeHeightM),h.focalPoint&&(f[d*2]=h.focalPoint.x,f[d*2+1]=h.focalPoint.y)}),{doc:{...e,objects:u?.[0]?.objects??l(e.objects),...u?{floors:u}:{}},report:o,eyeHeightM:m,focal:f}}let i=new Map(Gn(n).map(c=>[c.id,c])),a=new Float64Array(t.length).fill(Number.NaN),s=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,l)=>{let u=i.get(c.id)??c;u.eyeHeightM!==void 0&&(a[l]=u.eyeHeightM),u.focalPoint&&(s[l*2]=u.focalPoint.x,s[l*2+1]=u.focalPoint.y)}),{doc:n,report:o,eyeHeightM:a,focal:s}}function Is(e,t){return e.map((n,o)=>{let r=t.eyeHeightM[o],i=t.focal[o*2],a=t.focal[o*2+1],s={...n};return Number.isNaN(r)?delete s.eyeHeightM:s.eyeHeightM=r,Number.isNaN(i)?delete s.focalPoint:s.focalPoint={x:i,y:a},s})}function hd(e){let t=e.estimate===!1?null:Qo(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:Is(e.seats,t)},estimate:t}:{input:e}}function _s(e,t,n,o,r,i,a,s,c=.5){let l=-1,u=s*s,m=1/0;for(let f=0;f<t;f++){let h=f*3,d=Ot(n,[e[h],e[h+1]+c,e[h+2]],o,r);if(!d.visible)continue;let p=d.x-i,b=d.y-a,x=p*p+b*b;(x<u-4||x<u+4&&d.depth<m)&&(l=f,u=Math.min(u,x),m=d.depth)}return l}var L2={};function dd(e){let t=performance.now(),{input:n,estimate:o}=hd(e);return{model:no(n),buildMs:performance.now()-t,source:"main",...o?{estimate:o}:{}}}function T2(e){let t=Gn(e.doc);return{...dd({...e,seats:t}),seats:t}}function pd(e,t,n){let o=i=>({...t(),fallbackReason:i});if(typeof Worker>"u")return Promise.resolve(o("unavailable"));let r;try{r=new Worker(new URL("./scene/scene.worker.js",L2.url),{type:"module"})}catch{return Promise.resolve(o("unavailable"))}return new Promise(i=>{let a=!1,s=u=>{a||(a=!0,clearTimeout(l),r.terminate(),i(u))},c=u=>s(o(u)),l=window.setTimeout(()=>c("timeout"),15e3);r.onerror=()=>c("worker_error"),r.onmessage=u=>{let m=n(u.data);m?s(m):c("bad_response")},r.postMessage(e)})}function bd(e){return pd(e,()=>dd(e),({model:t,buildMs:n,estimate:o})=>({model:t,buildMs:n,source:"worker",...o?{estimate:o}:{}}))}function yd(e){return pd(e,()=>T2(e),({model:t,buildMs:n,seats:o,estimate:r})=>o?{model:t,buildMs:n,seats:o,source:"worker",...r?{estimate:r}:{}}:null)}var k2=40,O2=48,F2=Math.PI/180,D2=6,N2=500,B2=6;function V2(e,t,n={}){let o=performance.now(),r=t.prepared?t.prepared.estimate:t.estimate===!1?null:Qo(t.doc,t.seats);r&&(t={...t,doc:r.doc,seats:Is(t.seats,r)});let i=t.prepared?.model??no(t),a=new bi(n.onAnalytics),s=new Array(i.seats.count);for(let[U,K]of i.seats.idToIndex)s[K]=U;let c=new Map(t.seats.map(U=>[U.id,U])),l=new Map;for(let U of t.seats){if(!U.rowId)continue;let K=l.get(U.rowId);K?K.push(U.id):l.set(U.rowId,[U.id])}let u=new Map,m=[0,0,0,0];function f(){if(b)for(let U of[b.seatProgram,b.solidProgram,b.chairProgram])U.uniforms.uSeeThrough.value=m}t.seats.forEach((U,K)=>{u.set(U.id,i.seatSectionIds?.[K]??U.sectionId)});let h=new Map;for(let[U,K]of i.seats.idToIndex){let Q=u.get(U);if(!Q)continue;let le=h.get(Q);le?le.push(K):h.set(Q,[K])}let d=()=>{if(!b||!i.sectionSolidRanges.length)return;let{lit:U,anyUnlit:K}=oh(i.sectionSolidRanges,h,i.seats.iState);b.setSectionShellLit(K?U:null)},p=t.doc.floors?.some(K=>(K.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(K=>K.objects)??t.doc.objects).some(K=>K.type==="section"&&((K.height??0)>0||(K.rake??0)>0)),b=null,x=null,y=null,M=!1,A=!1,w=!1,g=new Map,S=null,v=null,P=null,E=new Map,k=null,L=()=>{P===null&&(P=e.style.zIndex,e.style.zIndex="20")},I=()=>{P!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=P),P=null)},R=!1,_=()=>R?tt.focusedFloor():-1,F=()=>{b=sh(D.gl,i),x?.dispose(),x=kf(D.gl,[1,1,1],i.theme.seatStates.selected),Ls(!1),d(),te(),y=new ii(D.renderer,b.seatGeometry,b.chairGeometry,b.solidGeometry,i.seats.count),D.setClearColor(i.theme.background.top),y.setRestoreClear(i.theme.background.top),y.setRoomCentre(i.room?.centre),b.seatProgram.uniforms.uSeatRadius.value=Gt*i.theme.seatScale,b.seatProgram.uniforms.uFocusFloor.value=_(),b.solidProgram.uniforms.uFocusFloor.value=_(),b.chairProgram.uniforms.uFocusFloor.value=_(),b.screenProgram&&(b.screenProgram.uniforms.uFocusFloor.value=_()),f(),O.forceRegather()},N=!1,O=new gi({model:i,orbit:()=>X,gpu:()=>b}),V=!1,z=new Map,G=24,T=U=>O.setDetailEnabled(U),D=new ur(e,{onContextLost:()=>{w||a.contextLost(),M=!0,Ee.stop(),b=null,y=null,W.reset()},onContextRestored:()=>{F(),M=!1,w||a.contextRestored(),Ee.requestRender()}}),W=new mr(D.gl,D.renderer,D.smoothingSamples),H=new fr,j=!1,Z=(U,K)=>{if(!b)return{smooth:!1,onBudget:!1};if(i.seatCount<=gc||b.nearSeatCount()>0||!U)return{smooth:!0,onBudget:!1};let Q=H.allows(K);return{smooth:Q,onBudget:Q}},X=new hr(D.gl,D.canvas,()=>Ee.requestRender(),()=>a.orbitEngaged());X.setAspect(D.aspect);let ee=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),ne=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(ee&&i.stages.length===0))return Ks(i.focalWorld,i.seats.iPosition,i.bounds)})(),ue=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="shape"&&U.stageKind?.startsWith("pitch-")),de=i.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:ue?36:48,margin:1.05},me=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;X.frame(i.bounds,!me&&n.skipInitialOverviewAnimation!==!0,ne,n.portraitOverviewCrop===!0,de);let pe=new ai(X.camera),Pe=od(e),_e=Ys(e,i),xe=new ni(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:i.theme.background.top}),Ce=i.labels,$=()=>Jm(Ce,i.floors.length,_());xe.setLabels($()),xe.setOverviewDistance(X.targetDistance);let B=()=>{let U=new Map,K=je.indexOf("available");for(let Q of Ce){if(!Q.wheelchairSeats)continue;let le=0;for(let be of Q.wheelchairSeats)i.seats.iState[be]===K&&le++;le>0&&U.set(Q.id,le)}return xe.setWheelchairFree(U)};B();let Y=null,q=()=>[...g.keys()].flatMap(U=>{let K=i.seats.idToIndex.get(U),Q=K===void 0?void 0:t.seats[K];if(K===void 0||Q?.id!==U)return[];let le=K*3;return[{id:`seat:${U}`,kind:"seat",seatWidthM:i.seats.iChairWidth[K]*2,text:Q.displayLabel||Q.label,anchor:[i.seats.iPosition[le],i.seats.iPosition[le+1]+1.05,i.seats.iPosition[le+2]],pinBase:cn(le)}]}),J=-1,te=()=>{b&&(J=Y?i.sections.findIndex(U=>U.id===Y):-1,b.seatProgram.uniforms.uFocusSection.value=J,b.chairProgram.uniforms.uFocusSection.value=J)},ae=U=>{if(Y=U,te(),xe.setForcedDense(!!U),!U){let ce=q(),He=new Set(ce.map(Be=>Be.id));xe.setLabels([...$().filter(Be=>!He.has(Be.id)),...ce]);return}let K=t.seats.filter(ce=>u.get(ce.id)===U),Q=new Set(K.map(ce=>ce.id)),le=new Set(K.map(ce=>ce.rowId)),be=new Set(g.keys()),Ae=new Set(K.filter(ce=>be.has(ce.id)).map(ce=>ce.id)),Re=$().filter(ce=>ce.kind!=="row"&&ce.kind!=="seat"&&ce.kind!=="access"||ce.kind==="access"&&Q.has(ce.id.slice(7))||(ce.kind==="row"?le.has(ce.id.slice(4)):Q.has(ce.id.slice(5))));if(i.seatCount<=6e3&&Ae.size===0){xe.setLabels(Re);return}let ke=K,$e=new Set(ke.map(ce=>`seat:${ce.id}`)),ut=ke.flatMap(ce=>{let He=i.seats.idToIndex.get(ce.id);if(He===void 0)return[];let Be=He*3;return[{id:`seat:${ce.id}`,kind:"seat",seatWidthM:i.seats.iChairWidth[He]*2,rowId:ce.rowId,text:be.has(ce.id)?ce.displayLabel||ce.label:rs(ce.displayLabel||ce.label),anchor:[i.seats.iPosition[Be],i.seats.iPosition[Be+1]+(be.has(ce.id)?1.05:.55),i.seats.iPosition[Be+2]],...be.has(ce.id)?{pinBase:cn(Be)}:{}}]});xe.setLabels([...Re.filter(ce=>!$e.has(ce.id)),...ut])};F();let fe=null,Ue=null,se=new gd.Mat4,Te=U=>{if(M||!b||A)return!1;let K=Hh({flying:pe.active,panoramaMounted:S!==null,seatViewActive:fe?.active===!0}),Q=zh(fe?.active===!0,_());b.seatProgram.uniforms.uFocusFloor.value=Q,b.solidProgram.uniforms.uFocusFloor.value=Q,b.chairProgram.uniforms.uFocusFloor.value=Q,b.screenProgram&&(b.screenProgram.uniforms.uFocusFloor.value=Q);let le=K==="orbit"?J:-1;b.seatProgram.uniforms.uFocusSection.value=le,b.chairProgram.uniforms.uFocusSection.value=le;let be=V?!1:K==="cinematic"?pe.update(performance.now()):K==="seatView"?fe.update(performance.now()):K==="orbit"?X.update():!1;Ue?.syncZoomLimits(),Ue?.syncNavigationMode();let Ae=_()>=0?i.floors[_()]:null,Re=Ae?.radius??i.bounds.radius,ke=Ec(X.currentDistance,Re),$e=N?{center:[X.camera.position.x,X.camera.position.y,X.camera.position.z],radius:520}:i.clipBounds??i.renderBounds;X.updateClipping($e);let ut=Ae?.center??i.renderBounds.center,ce=Ae?.radius??i.renderBounds.radius,He=(Mt,Ci)=>Math.hypot(X.camera.position.x-Mt[0],X.camera.position.y-Mt[1],X.camera.position.z-Mt[2])<=Ci*(O.detailVisible?1.8:1.55),Be=He(ut,ce);if(!Be&&Y){let Mt=i.sections.find(Ci=>Ci.id===Y);Mt&&(Be=He(Mt.center,Math.max(12,Mt.radius*2)))}O.detailVisible=Be;let Qe=b.seatProgram.uniforms;Qe.uSeatScale.value=ke.scale,Qe.uSeatFade.value=ke.fade;let un=!!Ae&&Ic(Ae.seatCount,D.canvas.clientWidth||1,D.canvas.clientHeight||1),Ii=_c(i.seats.count,Re,X.currentDistance,X.camera.fov,D.canvas.clientHeight||1),En=O.detailVisible||un||Ii?1:0,tr=O.detailVisible||_()>=0||i.floors.length>1?1:0;O.ease(U,En,tr),Qe.uSeatDetail.value=O.seatDetailMix;let In=En===0&&O.seatDetailMix<.01;b.seatGeometry.setDrawRange(In?Oi:0,In?cc:Oi),b.solidProgram.uniforms.uStructureDetail.value=O.structureDetailMix,b.solidProgram.uniforms.uViewport.value.set([D.gl.drawingBufferWidth,D.gl.drawingBufferHeight]),Qe.uMinPixels.value=ke.minPixels,Qe.uPixelToWorld.value=2*Math.tan(X.camera.fov*F2/2)/Math.max(1,D.pixelHeight),O.update(O.detailVisible),(i.outdoor||i.house)&&(se.copy(X.camera.projectionViewMatrix).inverse(),b.backgroundProgram.uniforms.uInvViewProj.value.set(se),b.backgroundProgram.uniforms.uEye.value.set([X.camera.position.x,X.camera.position.y,X.camera.position.z]));let _n=Z(be,X.currentDistance),dt=W.begin(_n.smooth);j=dt!==null,H.frame(_n.onBudget&&dt!==null,X.currentDistance,performance.now());let _i=dt?{target:dt}:{};D.renderer.render({scene:b.background,clear:!0,..._i}),D.renderer.render({scene:b.main,camera:X.camera,clear:!1,..._i});let Id=x?x.update(performance.now(),[X.camera.position.x,X.camera.position.y,X.camera.position.z],S!==null,K==="seatView"):!1;if(x&&D.renderer.render({scene:x.root,camera:X.camera,clear:!1,..._i}),W.end(),_e){let Mt=X.camera.worldMatrix;_e.update(K==="seatView"?[X.camera.position.x,X.camera.position.y,X.camera.position.z]:null,[-Mt[8],-Mt[9],-Mt[10]])}xe.update(X.camera.projectionViewMatrix,D.canvas.clientWidth||1,D.canvas.clientHeight||1,X.currentDistance,Re,[X.camera.position.x,X.camera.position.y,X.camera.position.z]);let js=be||Id||O.seatDetailMix!==En||O.structureDetailMix!==tr;return ht(!js),js},ht=Ac(e),Ee=new dr(Te),qe=typeof ResizeObserver<"u"?new ResizeObserver(()=>Ei.resize()):null;qe?.observe(e),X.setZoomPointResolver((U,K)=>{let Q=D.canvas.getBoundingClientRect(),le=D.canvas.clientWidth||Q.width,be=D.canvas.clientHeight||Q.height;if(!(le>0)||!(be>0))return null;X.camera.updateMatrixWorld();let Ae=_s(i.seats.iPosition,i.seats.count,X.camera.projectionViewMatrix,le,be,U-Q.left,K-Q.top,k2);if(Ae<0)return null;let Re=Ae*3;return[i.seats.iPosition[Re],i.seats.iPosition[Re+1]+.5,i.seats.iPosition[Re+2]]});function cn(U){return[i.seats.iPosition[U],i.seats.iPosition[U+1]+.5,i.seats.iPosition[U+2]]}xe.setSeatNumberRow(null);let lt=null,xt=0,Wt=null,Rt=()=>{xt=0;let U=null,K=null;if(lt&&!fe?.active&&!pe.active){let be=D.canvas.getBoundingClientRect(),Ae=D.canvas.clientWidth||be.width,Re=D.canvas.clientHeight||be.height;if(Ae>0&&Re>0){let ke=_s(i.seats.iPosition,i.seats.count,X.camera.projectionViewMatrix,Ae,Re,lt.x-be.left,lt.y-be.top,O2);U=ke>=0?t.seats[ke]?.rowId??null:null;let $e=ke>=0?t.seats[ke]?.id??null:null;if(K=$e,lt.mouse&&!lt.pressing&&!!Y&&!!$e&&u.get($e)===Y){let ce=e.getBoundingClientRect();Wt=$e,n.onSeatHover?.($e,{x:lt.x-ce.left,y:lt.y-ce.top})}else Cs()}}else Cs();let Q=lt?.mouse?K:null,le=xe.setSeatNumberSeat(Q);(xe.setSeatNumberRow(U)||le)&&Ee.requestRender()};function Cs(){Wt!==null&&(Wt=null,n.onSeatHover?.(null,null))}let Jo=U=>{lt={x:U.clientX,y:U.clientY,mouse:U.pointerType==="mouse",pressing:U.type==="pointerdown"},xt||(xt=requestAnimationFrame(Rt))},Ts=U=>{U.pointerType==="mouse"&&(lt=null,xt||(xt=requestAnimationFrame(Rt)))};D.canvas.addEventListener("pointermove",Jo),D.canvas.addEventListener("pointerdown",Jo),D.canvas.addEventListener("pointerleave",Ts);function Ls(U){if(!x)return;let K=[];for(let Q of g.keys()){let le=i.seats.idToIndex.get(Q);if(le===void 0)continue;let be=le*3;K.push({id:Q,position:cn(be)})}x.setSeats(K,performance.now(),U)}let ks=U=>{let K=be=>{let Ae=i.seats.idToIndex.get(be);return Ae===void 0?void 0:i.seats.iState[Ae]},{updates:Q,next:le}=mh(g,U,K);if(g=le,xe.setSelectedSeatIds(g.keys()),Ls(!so()),Ee.requestRender(),ae(Y),Q.length){let be=Qi(i.seats,Q);b&&b.uploadSeatStateRuns(be),d(),Ee.requestRender()}},so=()=>k!==null?k:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,xd=8,Os=U=>{if(!n.getSeatView)return null;let K=E.get(U);if(!K)for(K=Promise.resolve(n.getSeatView(U)),E.set(U,K),K.catch(()=>{E.get(U)===K&&E.delete(U)});E.size>xd;){let Q=E.keys().next().value;if(Q===void 0)break;E.delete(Q)}return K},Fs=Lh(i.stages,i.focalWorld,i.bounds.groundY??0),Ds=vs(Fs),Mi=(U,K)=>{let Q=c.get(U),le=Math.max(0,Math.round(i.seats.iFloor[K]??0)),be=t.doc.floors?.[le],Ae=i.floors[le],Re=be?.focalPoint??t.doc.focalPoint,ke=Ae?{x:Ae.focalWorld[0]/C,y:Ae.focalWorld[2]/C}:Re,$e=Q?.focalPoint?{x:Q.focalPoint.x+ke.x-Re.x,y:Q.focalPoint.y+ke.y-Re.y}:ke,ut=[i.seats.iPosition[K*3],i.seats.iPosition[K*3+1],i.seats.iPosition[K*3+2]],ce=vh(i.seats.iPosition,K,Ds),He=ce!==null&&Math.abs(ce)<Mh;return Sh(ut,$e,be?.baseHeightM??0,Q?.eyeHeightM,Ds,He)},vi=()=>(e.clientWidth||D.canvas.clientWidth)<=520,Si=null,Ns=null,Md=async(U,K,Q)=>{if(!n.getSeatView||w||Q!==tt.flightGen())return;let le;try{le=await td()}catch{if(a.panoramaFailed(U,"mount"),!w&&Q===tt.flightGen()){let be=Pi(U,Q,!0);requestAnimationFrame(()=>be?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(w||Q!==tt.flightGen()||!Si))return Ns??=le.createOpenPanorama(Si),Ns(U,K,Q)},wi=rd({container:e,model:i,opts:n,expandedSeatById:c,seatIdsByRow:l,isNarrow:vi,isDisposed:()=>w,flightGen:()=>tt.flightGen(),flyToSeat:U=>zs(U),openPanorama:(U,K,Q)=>Md(U,K,Q)}),Pi=wi.show,Ai=wi.remove,vd=wi.layout,ln=id({container:e,orbit:X,isNarrow:vi,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});Ue=ln;let Sd=ln.element,co=ln.setNavigationMode,wd=ln.layout,Pd=ln.utilityControls,lo=null,Bs=!1,er=U=>{ln.setSeatViewLocked(U),U||fe?.exit()};fe=Gh({canvas:D.canvas,camera:X.camera,requestRender:()=>Ee.requestRender(),reducedMotion:so,onStopChange:U=>{let K=U??(Bs?"seat":null);lo=K;try{n.onSeatViewStopChange?.(K)}catch{}},onApplied:()=>{w||X.syncFromCamera()}});let Vs=i.sections.reduce((U,K)=>K.seatCount>0&&K.box?Math.max(U,K.box.max[1]):U,-1/0),Gs=(U,K)=>{let{eye:Q}=Mi(U,K),le=(e.clientWidth||D.canvas.clientWidth||1)/Math.max(1,e.clientHeight||D.canvas.clientHeight||1),be=Oh(Q,Fs,le,{preserveEye:!0});if(n.seatViewStops===!1)return{...be,stops:[]};let Ae=u.get(U),Re=Ae?i.sections.find(ke=>ke.id===Ae):void 0;return{...be,stops:Fh(be,{aspect:le,seatingTopY:Number.isFinite(Vs)?Vs:i.bounds.box.max[1],section:Re&&Re.seatCount>0?{center:Re.center,radius:Re.radius}:null,venue:{center:i.bounds.center,radius:i.bounds.radius}})}},tt=md({isNarrow:vi,setSeeThrough:U=>{m=U?[U[0],U[1],U[2],B2]:[0,0,0,0],f(),Ee.requestRender()},container:e,model:i,opts:n,orbit:X,cinematic:pe,analytics:a,loop:Ee,labelOverlay:xe,stageAzimuth:ne,overviewFraming:de,gpu:()=>b,isDisposed:()=>w,panorama:()=>S,setPanorama:U=>{S=U},setPanoramaSphereVisible:U=>{N=U},panoramaLoadAbort:()=>v,setPanoramaLoadAbort:U=>{v=U},setFrozen:U=>{A=U},restorePanoramaLayer:I,reducedMotion:so,resolvedSeatViewPose:Mi,showSectionSeatLabels:ae,setNearFieldDetailEnabled:T,setSeatViewLocked:er,setNavigationMode:co,showArriveChip:Pi,removeArriveChip:Ai,inSeatView:()=>lo!==null,setSeatStepping:U=>{Bs=U},seatViewArrival:(U,K)=>n.arriveAtSeatEye?Gs(U,K):null,enterSeatView:(U,K)=>fe?.enter(U,K)});R=!0;let Ri=tt.overviewChip,Ad=tt.layoutOverviewChip,Rd=tt.applyFloorFocus,Ed=tt.focusOverview,Hs=tt.cancelFlight,zs=tt.flyToSeat,Us=tt.focusSectionCamera;Pd.appendChild(Ri),Si={container:e,model:i,opts:n,analytics:a,orbit:X,loop:Ee,seatsById:c,ensureSeatView:Os,resolvedSeatViewPose:Mi,gpu:()=>b,gl:D.gl,isContextLost:()=>M,isDisposed:()=>w,flightGen:()=>tt.flightGen(),setPanorama:U=>{S=U},getLoadAbort:()=>v,setLoadAbort:U=>{v=U},setPanoramaSphereVisible:U=>{N=U,U&&fe?.exit()},setFrozen:U=>{A=U},raisePanoramaLayer:L,restorePanoramaLayer:I,getOverviewChip:()=>Ri,labelOverlay:xe,reducedMotion:so,removeArriveChip:Ai,showArriveChip:Pi};let Xt=cd({glctx:D,orbit:X,model:i,seats:t.seats,opts:n,cinematic:pe,analytics:a,seatIdByIndex:s,sectionIdBySeatId:u,tapSlop:D2,tapMs:N2,gpu:()=>b,pick:()=>y,seatViewLocked:()=>ln.seatViewLocked(),focusedSectionId:()=>Y,selection:()=>g,cancelFlight:Hs,focusSectionCamera:Us,focusSeatCamera:tt.focusSeatCamera,setSelection:ks,ensureSeatView:Os});D.canvas.addEventListener("pointerdown",Xt.onDown),D.canvas.addEventListener("pointermove",Xt.onMove),D.canvas.addEventListener("pointerup",Xt.onUp),D.canvas.addEventListener("pointercancel",Xt.onUp),Ee.requestRender();let Ei={setAvailability(U){let K=uh(g,U),Q=Qi(i.seats,K);Q.length&&b&&b.uploadSeatStateRuns(Q),d(),Q.length&&B(),Ee.requestRender()},setSelection:ks,setNavigationMode:co,zoomIn(){X.zoomBy(Ln),Ee.requestRender()},zoomOut(){X.zoomBy(po),Ee.requestRender()},flyToSeat:zs,focusOverview:Ed,seatViewStop:()=>lo,recentreSeatView:()=>fe?.recentre()??!1,resize(){let{width:U,height:K}=D.resize();X.setAspect(U/Math.max(1,K)),vd(),wd(),Ad(),Ee.requestRender()},stats(){return{...Ee.stats(),drawCalls:b?b.drawCalls:0,fallbackTriangles:b?b.seatGeometry.drawRange.count/3*i.seats.count:0,seatCount:i.seatCount}},captureImage(U=1280){if(M||!b||typeof document>"u")return null;Te(0);let K=D.canvas,Q=Math.min(1,U/Math.max(K.width,K.height,1)),le=document.createElement("canvas");le.width=Math.max(1,Math.round(K.width*Q)),le.height=Math.max(1,Math.round(K.height*Q));let be=le.getContext("2d");return be?(be.drawImage(K,0,0,le.width,le.height),le.toDataURL("image/jpeg",.82)):null},captureSeatView(U,K=480){if(M||!b||A||typeof document>"u"||pe.active||S!==null||fe?.active)return null;let Q=z.get(U);if(Q)return Q;let le=i.seats.idToIndex.get(U);if(le===void 0)return null;let{eye:be,focal:Ae,fov:Re}=Gs(U,le),ke=X.snapshot(),$e=[O.seatDetailMix,O.structureDetailMix],ut=null;try{V=!0,X.camera.position.set(be[0],be[1],be[2]),X.camera.perspective({fov:Re,aspect:X.camera.aspect}),X.camera.lookAt(Ae),X.camera.updateMatrixWorld(),X.syncFromCamera(),O.seatDetailMix=1,O.structureDetailMix=1,O.forceRegather(),Te(0);let ce=D.canvas,He=Math.min(ce.width,Math.round(ce.height*16/9)),Be=Math.round(He*9/16),Qe=document.createElement("canvas");Qe.width=Math.max(1,Math.round(K)),Qe.height=Math.max(1,Math.round(K*9/16));let un=Qe.getContext("2d");un&&(un.drawImage(ce,(ce.width-He)/2,(ce.height-Be)/2,He,Be,0,0,Qe.width,Qe.height),ut=Qe.toDataURL("image/jpeg",.8))}finally{V=!1,ke(),O.seatDetailMix=$e[0],O.structureDetailMix=$e[1],O.forceRegather(),Te(0)}if(ut)for(z.set(U,ut);z.size>G;)z.delete(z.keys().next().value);return ut},getQualityEvidence(){let U=Ee.stats(),K=D.canvas.clientWidth||1,Q=D.canvas.clientHeight||1,le=i.bounds.center,be=Ot(X.camera.projectionViewMatrix,[le[0],i.bounds.box.min[1],le[2]],K,Q),Ae=Ot(X.camera.projectionViewMatrix,[le[0],i.bounds.box.max[1],le[2]],K,Q),Re=i.bounds.box,ke=[Re.min[0],Re.max[0]].flatMap(ce=>[Re.min[1],Re.max[1]].flatMap(He=>[Re.min[2],Re.max[2]].map(Be=>Ot(X.camera.projectionViewMatrix,[ce,He,Be],K,Q)))).filter(ce=>Number.isFinite(ce.x)&&Number.isFinite(ce.y)&&Number.isFinite(ce.depth)),$e=ke.length?(()=>{let ce=Math.min(...ke.map(dt=>dt.x)),He=Math.max(...ke.map(dt=>dt.x)),Be=Math.min(...ke.map(dt=>dt.y)),Qe=Math.max(...ke.map(dt=>dt.y)),un=Math.max(0,ce),Ii=Math.min(K,He),En=Math.max(0,Be),tr=Math.min(Q,Qe),In=Math.max(0,Ii-un),_n=Math.max(0,tr-En);return{box:{x:un,y:En,width:In,height:_n},horizontalFillRatio:In/K,verticalFillRatio:_n/Q,visibleAreaRatio:In*_n/(K*Q),clippedEdges:[...Be<0?["top"]:[],...He>K?["right"]:[],...Qe>Q?["bottom"]:[],...ce<0?["left"]:[]]}})():void 0,ut=String(D.gl.getParameter(D.gl.VERSION)??"");return{viewport:{width:K,height:Q},context:{webgl2:/webgl\s*2/i.test(ut),lost:M},frame:{rendered:U.rendered,idle:U.idle,smoothed:j},camera:{position:[X.camera.position.x,X.camera.position.y,X.camera.position.z],distance:X.currentDistance,verticalFovDeg:X.fovY},scene:{seatCount:i.seatCount,floorCount:i.floors.length,zoneCount:i.zones.length,sectionCount:i.sections.length,authoredRelief:p,renderedVerticalSpanM:Math.max(0,i.bounds.box.max[1]-i.bounds.box.min[1]),projectedReliefPx:be.visible&&Ae.visible?Math.abs(be.y-Ae.y):0},labels:xe.qualityEvidence(),framing:$e,...lo?{seatView:{fovDeg:X.camera.fov,stop:lo}}:{}}},getQualityReport(){return oi(Ei.getQualityEvidence())},loseContextForTest(){D.simulateContextLossCycle()},floors(){return i.floors},focusFloor(U){if(U!==null&&!i.floors.some(Q=>Q.index===U))return!1;let K=U??-1;if(T(U!==null),er(!1),Rd(K),co("orbit"),U===null)pe.cancel(),so()?X.frame(i.bounds,!1,ne,n.portraitOverviewCrop===!0,de):X.frameSoft(i.bounds,ne,n.portraitOverviewCrop===!0,de),xe.setOverviewDistance(X.targetDistance);else{let Q=i.floors[U];if(Q.seatCount>0){pe.cancel();let le=Q.focalWorld[0]-Q.center[0],be=Q.focalWorld[2]-Q.center[2],Ae=Math.hypot(le,be)>Q.radius*.12?Math.atan2(le,be):ne;X.frame({center:Q.center,radius:Q.radius,box:Q.box},!1,Ae,!1,{polarDeg:58,margin:1.12}),xe.setOverviewDistance(X.targetDistance)}}return Ee.requestRender(),!0},zones(){return i.zones},focusZone(U){let K=i.zones.find(Ae=>Ae.id===U);if(!K||K.seatCount===0)return!1;T(!1),er(!1),pe.cancel(),co("orbit"),ae(null),n.onSectionFocusChange?.(null);let Q=K.focalWorld[0]-K.center[0],le=K.focalWorld[2]-K.center[2],be=Math.hypot(Q,le)>K.radius*.12?Math.atan2(Q,le):void 0;return X.frame({center:K.center,radius:K.radius*1.25},!1,be),Ee.requestRender(),!0},sections(){return i.sections},focusSection(U){return Us(U)},rows(U){return U?i.rows.filter(K=>K.sectionId===U):i.rows},seatsInRow(U){return t.seats.filter(K=>K.rowId===U).map(K=>({id:K.id,label:K.displayLabel||K.label}))},focusRow(U){let K=i.rows.find(Q=>Q.id===U);return!K||K.seatCount===0?!1:(T(!0),er(!1),pe.cancel(),co("pan"),K.sectionId&&(ae(K.sectionId),n.onSectionFocusChange?.(K.sectionId)),X.frame({center:K.center,radius:Math.max(2.5,K.radius*.65)}),Ee.requestRender(),!0)},setReducedMotionForTest(U){k=U},dispose(){w=!0,_e?.dispose(),ht(!1),Ai(),Ri.remove(),Sd.remove(),Hs(),fe?.dispose(),Ee.stop(),xe.dispose(),qe?.disconnect(),S&&(S.dispose(),S=null),I(),Pe(),D.canvas.removeEventListener("pointerdown",Xt.onDown),D.canvas.removeEventListener("pointermove",Xt.onMove),D.canvas.removeEventListener("pointerup",Xt.onUp),D.canvas.removeEventListener("pointercancel",Xt.onUp),D.canvas.removeEventListener("pointermove",Jo),D.canvas.removeEventListener("pointerdown",Jo),D.canvas.removeEventListener("pointerleave",Ts),xt&&cancelAnimationFrame(xt),X.dispose(),y&&y.dispose(),b&&b.dispose(),b=null,x?.dispose(),x=null,y=null,W.dispose(),D.dispose()}};return a.opened(i.seatCount,p,t.prepared?.buildMs??performance.now()-o,t.prepared?.source??"inline"),Ei}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,autoVenue3d,buildSceneModel,estimateVenue3D,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});
1321
+ void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:ke},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let K=new it.Mesh(e,{geometry:Ae,program:be});K.frustumCulled=!1,K.setParent(o),Fe.screenProgram=be,ie=!0,Fe.drawCalls=3+f+(ae?1:0)+1},ne.src=Ge.contentImageUrl}return Fe}var on=require("ogl");var iw=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],oa=class{constructor(t,n,o,r,i){this.seatScene=new on.Transform;this.chairScene=new on.Transform;this.solidScene=new on.Transform;this.target=null;this.floorAtLastPick=!1;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=Rd(this.gl),this.chairProg=Ed(this.gl),this.depthProg=Id(this.gl);let a=new on.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new on.Mesh(this.gl,{geometry:o,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new on.Mesh(this.gl,{geometry:r,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}standingFloorAtLastPick(){return this.floorAtLastPick}setRoomCentre(t){this.depthProg.uniforms.uRoomCentre.value.set(t??[0,0])}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of iw)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;let o=t.uniforms.uSeeThrough?.value;if(o)for(let r of[this.seatProg,this.chairProg,this.depthProg])r.uniforms.uSeeThrough.value=o}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 on.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,o,r){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-r),u=Math.max(0,o-r),m=Math.max(1,Math.min(s,n+r+1)-l),h=Math.max(1,Math.min(c,o+r+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(l,u,m,h);let[f,d,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(f,d,p,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(m*h*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,u,m,h,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),this.floorAtLastPick=xd(b,m,h,n-l,o-u),Md(b,m,h,n-l,o-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Kd(e,t){let n=[];for(let o of t)e.has(o.seatId)?e.set(o.seatId,$o(o.state)):n.push(o);return n}function Yd(e,t,n){let o=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&o.add(a);let r=new Map(e),i=[];for(let[a,s]of e)o.has(a)||(i.push({seatId:a,state:ct[s]??"available"}),r.delete(a));for(let a of o){if(r.has(a))continue;let s=n(a);s!==void 0&&(r.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:r}}var Rn=require("ogl");function aw(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function $d(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function sw(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Zd(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 Sc(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function wc(e,t){return Math.max(0,Math.min(1,e+t))}function qd(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let o=Math.max(0,Math.min(1,t)),r=n-1,i=Math.floor(o*r);i>=r&&(i=r-1);let a=o*r-i,s=e[Math.max(0,i-1)],c=e[i],l=e[i+1],u=e[Math.min(n-1,i+2)],m=a*a,h=m*a,f=[0,0,0];for(let d=0;d<3;d++)f[d]=.5*(2*c[d]+(-s[d]+l[d])*a+(2*s[d]-5*c[d]+4*l[d]-u[d])*m+(-s[d]+3*c[d]-3*l[d]+u[d])*h);return f}function Pc(e,t,n,o,r){let i=Zd(aw(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=$d($d(t,sw(i,2.5)),[0,1.5,0]),s=[t[0]-o[0],0,t[2]-o[2]],c=Zd(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,r),u=[o[0]+c[0]*l*1.3,o[1]+l*.75,o[2]+c[2]*l*1.3];return{waypoints:[e,u,a],finalPos:a}}function Ac(e,t,n=35,o=28){let r=Sc(t),i=qd(e,r),a=Sc(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(o-n)*a,eased:r}}function tp(e,t,n){let o=e.position.clone(),r=new Rn.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new Rn.Vec3(n[0],n[1],n[2]));let i=new Rn.Quat().copy(e.quaternion);return e.position.copy(o),e.quaternion.copy(r),i}var ra=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new Rn.Quat;this.endQuat=new Rn.Quat;this.outQuat=new Rn.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,o,r=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(o),this.duration=r,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:o,fov:r,eased:i}=Ac(this.waypoints,n,35,this.endFov);return this.camera.position.set(o[0],o[1],o[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,wc(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=r,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 np=Jc,cw=.12,Rc=1.6,op=.12;function rp(e,t,n){let o=e[t*3],r=e[t*3+1],i=e[t*3+2],a=n[0]-o,s=n[2]-i,c=Math.hypot(a,s);if(!(c>.001))return null;let l=a/c,u=s/c,m=1/0,h=null;for(let f=0;f*3<e.length;f++){if(f===t)continue;let d=e[f*3]-o,p=e[f*3+2]-i,b=d*l+p*u;b<.3||b>1.6||Math.abs(d*u-p*l)>.6||b<m&&(m=b,h=r-e[f*3+1])}return h}var lw=.25,uw=1.5;function ip(e,t,n=0,o,r,i=!1){let a=[t.x*I,n+uw,t.y*I],s=r?[r[0],r[1],r[2]]:a,c=e[1],l=Number.isFinite(c)?c+(i?Rc:np):Number.isFinite(o)?n+o:n+np,u=a[0]-e[0],m=a[2]-e[2],h=Math.hypot(u,m),f=h>.001?Math.min(cw,h*lw):0,d=h>.001?u/h:0,p=h>.001?m/h:0;return{eye:[e[0]+d*f,l,e[2]+p*f],focal:s}}var Yn={aisleShare:.7,aisleMost:.9,standOffM:[.9,2.6],lookHeightM:1.25,frameMargin:1.12,fovDeg:[45,80]};function mw(e,t){let n=0,o=0,r=!1;for(let i of t)i.kind==="booth"?n++:o++;for(let i of ur(e,e.eventConfigurationId))for(let a of i.objects)a.type==="gaArea"?o+=a.capacity>0?a.capacity:0:a.type==="shape"&&a.role==="stage"&&(r=!0);return r&&o>n}function ap(e,t){let n=new Map;if(mw(e,t))return n;for(let o of ur(e,e.eventConfigurationId)){let r=o.objects.filter(a=>a.type==="booth");if(!r.length)continue;let i=Fs(r,o.focal);for(let a of r){let s=i.get(a.id),c=_t(a);if(!s||!c)continue;t.some(u=>u.kind!=="booth"&&Ye(c,u.x,u.y))||n.set(`${a.id}:0`,s)}}return n}function sp(e){let[t,n]=Yn.standOffM;return Math.min(n,Math.max(Math.min(t,e.aisleM*Yn.aisleMost),e.aisleM*Yn.aisleShare))}function Ec(e,t){let n=t.halfDepthM+sp(t);return{eye:[e[0]+t.normal.x*n,e[1]+Rc,e[2]+t.normal.y*n],focal:[e[0],e[1]+Yn.lookHeightM,e[2]]}}function cp(e,t,n){let{eye:o,focal:r}=Ec(e,t),i=sp(t),a=Yn.frameMargin,s=t.halfWidthM*a/i,c=Lo/2*a/i,l=2*Math.atan(Math.max(c,s/Math.max(.3,n)))*180/Math.PI,u=Math.max(Yn.fovDeg[0],Math.min(Yn.fovDeg[1],l)),m=Math.tan(u*Math.PI/360)*n;return{eye:o,focal:r,fov:u,raisedM:0,pulledBackM:0,stageFrameWidth:t.halfWidthM/(i*m)}}var En=Math.PI/180,hw=45,Ic=80,ia=70,fw=1,dw=.99;function pw(e,t){if(!(e<fw))return Ic;if(!(Number.isFinite(t)&&t>0))return ia;let n=2*Math.atan(t/(2*aa*dw)/Math.max(.05,e))/En;return Math.max(ia,Math.min(Ic,n))}var bw=.25,aa=1,gw=.25,yw=12*En,xw=.2,Mw=1.5,lp=.8,up=6,bp=1.9,vw=2/3,Sw=.12,ww=.9,Pw=1.2,Aw=2,gp=.05,Rw=6;function yp(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+lp,t[1]),t[2]+6]};let o=1/0,r=-1/0,i=1/0,a=-1/0,s=n;for(let d of e)o=Math.min(o,d.cx-d.halfX),r=Math.max(r,d.cx+d.halfX),i=Math.min(i,d.cz-d.halfZ),a=Math.max(a,d.cz+d.halfZ),s=Math.max(s,d.y);let c=r-o,l=a-i,u=Math.max(c,Math.min(l,up))/2,m=Math.max(l,Math.min(c,up))/2,h=(o+r)/2,f=(i+a)/2;return{min:[h-u,n,f-m],max:[h+u,Math.max(n+lp,s),f+m]}}function Ew(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+bp,e.max[2]]}}function _c(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Mw,t+xw,t+bp*vw),(e.min[2]+e.max[2])/2]}function xp(e,t){let n=e[0]-t[0],o=e[2]-t[2],r=Math.hypot(n,o);return r<.001?{x:0,z:1}:{x:n/r,z:o/r}}function mp(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(o,r,i)||1;o/=a,r/=a,i/=a;let s=-i,c=o,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let u=1/0,m=-1/0;for(let h=0;h<8;h++){let f=(h&1?n.max[0]:n.min[0])-e[0],d=(h&2?n.max[1]:n.min[1])-e[1],p=(h&4?n.max[2]:n.min[2])-e[2],b=Math.max(gp,f*o+d*r+p*i),y=(f*s+p*c)/b;y<u&&(u=y),y>m&&(m=y)}return m-u}function hp(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(o,r,i)||1;o/=a,r/=a,i/=a;let s=-i,c=o,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let u=-c*r,m=c*o-s*i,h=s*r,f=1/0,d=-1/0;for(let p=0;p<8;p++){let b=(p&1?n.max[0]:n.min[0])-e[0],y=(p&2?n.max[1]:n.min[1])-e[1],g=(p&4?n.max[2]:n.min[2])-e[2],v=Math.max(gp,b*o+y*r+g*i),P=(b*u+y*m+g*h)/v;P<f&&(f=P),P>d&&(d=P)}return d-f}function sa(e,t){return Math.tan(e*En/2)*Math.max(.05,t)}function fp(e,t,n){let o=pw(n,e),r=c=>Math.max(hw,Math.min(o,c)),i=c=>2*Math.atan(c)/En,a=Number.isFinite(e)&&e>0?r(i(e/(2*bw)/Math.max(.05,n))):o;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,r(i(t/(2*Sw))));return e/(2*sa(s,n))>aa?a:s}function Mp(e,t,n,o={}){let r=_c(t),i=[e[0],e[1],e[2]],a=0,s=0,c=d=>{if(!(d>0))return;let p=xp(i,r);i[0]+=p.x*d,i[2]+=p.z*d,s+=d},l=o.preserveEye?0:t.max[1]+gw-i[1];l>0&&(i[1]+=l,a=l,c(l/Math.tan(yw)));let u=Ew(t),m=mp(i,r,t),h=fp(m,hp(i,r,u),n),f=m/(2*sa(h,n));for(let d=0;!o.preserveEye&&d<Rw&&f>aa;d++){let p=Math.max(1,Math.hypot(i[0]-r[0],i[2]-r[2])),b=Number.isFinite(f)?f/aa:2;c(Math.min(60,p*(Math.min(4,b)-1)+.5)),m=mp(i,r,t),h=fp(m,hp(i,r,u),n),f=m/(2*sa(h,n))}return{eye:i,focal:r,fov:h,raisedM:a,pulledBackM:s,stageFrameWidth:f}}function Iw(e,t,n){let o=Math.tan(t*En/2),r=sa(t,n);return Math.max(1,e/Math.max(.05,Math.min(o,r)))}var _w=.7,dp=.5,Cw=.8;function pp(e,t,n){let o=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],r=[n[0]-e[0],n[1]-e[1],n[2]-e[2]],i=o[0]*r[0]+o[1]*r[1]+o[2]*r[2],a=Math.hypot(o[0],o[1],o[2])*Math.hypot(r[0],r[1],r[2])||1;return Math.acos(Math.max(-1,Math.min(1,i/a)))/En}function Tw(e,t,n){let o=l=>{let u=Math.hypot(l[0],l[1],l[2])||1;return[l[0]/u,l[1]/u,l[2]/u]},r=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],i=Math.hypot(r[0],r[1],r[2]),a=o(r),s=o([n[0]-e[0],n[1]-e[1],n[2]-e[2]]),c=o([0,1,2].map(l=>a[l]*(1-dp)+s[l]*dp));return[e[0]+c[0]*i,e[1]+c[1]*i,e[2]+c[2]*i]}function vp(e,t){let{aspect:n,venue:o}=t,r=e.focal,i=xp(e.eye,r),a=p=>(p[0]-r[0])*i.x+(p[2]-r[2])*i.z,s=[{name:"seat",eye:e.eye,focal:r,fov:e.fov}],c=Aw*(t.rowDepthM??ww),l=[e.eye[0]+i.x*c,e.eye[1]+Pw,e.eye[2]+i.z*c],u=[e.eye[0],e.eye[1]-_w,e.eye[2]],m=Tw(l,r,u);s.push({name:"row",eye:l,focal:m,fov:Math.min(Ic,Math.max(e.fov,2*Math.max(pp(l,m,u),pp(l,m,r))/Cw))});let h=(p,b,y,g)=>{let v=Iw(y,e.fov,n)*1.08,P=v*Math.sin(g*En),w=Number.isFinite(t.seatingTopY)?t.seatingTopY+2:-1/0,x=Math.max(P,w-b[1]),S=v*Math.cos(g*En);return{name:p,eye:[b[0]+i.x*S,b[1]+x,b[2]+i.z*S],focal:b,fov:e.fov}};t.section&&t.section.radius>0&&s.push(h("section",t.section.center,t.section.radius,35)),s.push(h("venue",o.center,Math.max(1,o.radius),40));let f=[],d=-1/0;for(let p of s){let b=a(p.eye);f.length&&b<=d+.5||(f.push(p),d=b)}return f}var Ap=require("ogl"),Dr=Math.PI/180,Cc=320,Sp=70*Dr,kw=32*Dr,Lw=24*Dr,wp=.0026,Ow=.22,Fw=.006,Dw=180,Nw=900,Bw=1100,Hw=4,wt=(e,t,n)=>Math.max(t,Math.min(n,e)),Pp=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Rp(e){let{canvas:t,camera:n}=e,o=[],r=!1,i=0,a=0,s=0,c=0,l=0,u=0,m=Cc,h=null,f=()=>{h&&(clearTimeout(h),h=null)},d=!1,p=[0,0],b=0,y=!1,g=null,v=null,P=new Map,w=!1,x=0,S=0,A=0,M=0,E=()=>r&&o.length?o[wt(Math.round(i),0,o.length-1)].name:null,T=()=>{let L=E();L!==g&&(g=L,e.onStopChange?.(L))},k=()=>{if(!r||!o.length)return;let L=o[wt(Math.floor(i),0,o.length-1)],G=o[wt(Math.ceil(i),0,o.length-1)],j=wt(i-Math.floor(i),0,1),D=(ge,Ae)=>ge+(Ae-ge)*j,U=[D(L.eye[0],G.eye[0]),D(L.eye[1],G.eye[1]),D(L.eye[2],G.eye[2])],$=[D(L.focal[0],G.focal[0]),D(L.focal[1],G.focal[1]),D(L.focal[2],G.focal[2])],Z=$[0]-U[0],te=$[1]-U[1],X=$[2]-U[2],me=Math.hypot(Z,te,X)||1,re=Math.atan2(Z,X),ce=Math.asin(wt(te/me,-1,1)),J=re+a,ae=wt(ce+s,-80*Dr,80*Dr),ie=Math.cos(ae)*me;Z=Math.sin(J)*ie,te=Math.sin(ae)*me,X=Math.cos(J)*ie,n.position.set(U[0],U[1],U[2]),n.fov=D(L.fov,G.fov),n.updateProjectionMatrix(),n.lookAt(new Ap.Vec3(U[0]+Z,U[1]+te,U[2]+X)),e.onApplied?.()},_=()=>{if(!r||!o.length)return;let L=wt(Math.round(i),0,o.length-1);if(e.reducedMotion()){d=!1,i=L,k(),T(),e.requestRender();return}if(Math.abs(L-i)<.001){d=!1,T();return}c=i,l=L,u=performance.now(),m=Cc,d=!0,e.requestRender()},R=L=>{!r||o.length<2||(f(),d=!1,i=wt(i+L,0,o.length-1),k(),T(),e.requestRender())},C=(L,G)=>{r&&(f(),d=!1,y=!1,a=wt(a-L*wp,-Sp,Sp),s=wt(s-G*wp,-Lw,kw),k(),e.requestRender())},O=L=>{r&&(P.set(L.pointerId,{x:L.clientX,y:L.clientY}),P.size===1?(w=!0,M=0,x=L.clientX,S=L.clientY):P.size===2&&(w=!1,A=B()))},B=()=>{let L=[...P.values()];return L.length<2?0:Math.hypot(L[0].x-L[1].x,L[0].y-L[1].y)},F=L=>{if(!r||!P.has(L.pointerId))return;if(P.set(L.pointerId,{x:L.clientX,y:L.clientY}),P.size>=2){let D=B();A>0&&R((A-D)*Fw),A=D;return}if(!w)return;let G=L.clientX-x,j=L.clientY-S;x=L.clientX,S=L.clientY,M+=Math.abs(G)+Math.abs(j),!(M<=Hw)&&C(G,j)},N=L=>{P.delete(L.pointerId)&&(P.size<2&&(A=0),P.size===0&&(w=!1,_()))},V=L=>{if(!r)return;L.preventDefault();let G=L.deltaMode===1?16:L.deltaMode===2?100:1,j=wt(L.deltaY*G/100,-2,2);R(j*Ow),v&&clearTimeout(v),v=setTimeout(()=>{v=null,_()},Dw)},H=()=>{f(),r&&(r=!1,d=!1,y=!1,o=[],P.clear(),w=!1,v&&(clearTimeout(v),v=null),g!==null&&(g=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",O),t.addEventListener("pointermove",F),t.addEventListener("pointerup",N),t.addEventListener("pointercancel",N),t.addEventListener("wheel",V,{passive:!1}),{get active(){return r},enter(L,G=0){if(L.length<2){H();return}f(),o=L,r=!0,i=e.reducedMotion()?0:wt(G,0,L.length-1),i>0&&(h=setTimeout(()=>{h=null,r&&(c=i,l=0,u=performance.now(),m=Bw,d=!0,e.requestRender())},Nw)),a=0,s=0,d=!1,y=!1,g=null,k(),T(),e.requestRender()},exit:H,recentre(){return r?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(y=!1,a=0,s=0,k(),e.requestRender(),!0):(p=[a,s],b=performance.now(),y=!0,e.requestRender(),!0):!1},update(L){if(!r)return!1;let G=!1;if(y){let j=wt((L-b)/Cc,0,1),D=1-Pp(j);a=p[0]*D,s=p[1]*D,j>=1?(y=!1,a=0,s=0):G=!0}if(d){let j=wt((L-u)/m,0,1);i=c+(l-c)*Pp(j),j>=1?(d=!1,i=l,T()):G=!0}return k(),G},currentStop:E,dispose(){H(),t.removeEventListener("pointerdown",O),t.removeEventListener("pointermove",F),t.removeEventListener("pointerup",N),t.removeEventListener("pointercancel",N),t.removeEventListener("wheel",V)}}}function Ep(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}function Ip(e,t){return e?-1:t}var Oc=null;function Vp(){return Oc??=Promise.resolve().then(()=>(Gp(),Hp)).catch(e=>{throw Oc=null,e}),Oc}var zp=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),da=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,o,r){this.emit("3d_opened",{seats:t,hasHeights:n,...o===void 0?{}:{buildMs:Math.round(o)},...r===void 0?{}:{prepSource:r}})}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=zp(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(zp()-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 Up(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function Wp(e){let{container:t,model:n,opts:o,expandedSeatById:r,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let m=a();Object.assign(s.style,m?{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:(m,h,f=!1)=>{if(l(),e.isDisposed())return null;let d=document.createElement("div");d.setAttribute("role","group"),Object.assign(d.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.chrome?.caption!==!1,b=o.chrome?.seatStepper!==!1;if(!p&&!b)return null;let y=r.get(m),g=y?.sectionId?n.sections.find(E=>E.id===y.sectionId):void 0,v=y?.label??m;d.setAttribute("aria-label",`Explore views near ${g?.label?`${g.label}, `:""}seat ${v}`);let P=document.createElement("span");P.textContent=o.seatViewCaption?.(m)??["Live 3D seat view",g?.label,v].filter(Boolean).join(" \xB7 "),Object.assign(P.style,{maxWidth:"min(70vw, 560px)",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)"}),p&&d.appendChild(P);let w=document.createElement("div");Object.assign(w.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),d.appendChild(w);let x=y?.rowId?i.get(y.rowId):void 0,S=x?.indexOf(m)??-1,A=S>=0?[x?.[S-1],x?.[S+1]]:[void 0,void 0],M=(E,T,k,_=!1)=>{let R=document.createElement("button");R.type="button",R.textContent=E,R.setAttribute("aria-label",T),Object.assign(R.style,{minHeight:"44px",padding:_?"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"}),_||(R.style.minWidth="44px"),_&&(R.dataset.panoramaTrigger=""),R.addEventListener("click",k),w.appendChild(R)};if(b&&A[0]){let E=r.get(A[0])?.label??A[0];M("\u2039",`View previous seat ${E}`,()=>{e.flyToSeat(A[0])})}if(b&&o.getSeatView){let E=o.seatViewActionLabel?.(m)??"Open 360\xB0 panorama";M(f?`\u21BB Retry ${E}`:`\u25C9 ${E}`,`${f?"Retry":E} from seat ${v}`,()=>{if(e.isDisposed()||h!==e.flightGen()){l();return}l(),e.openPanorama(m,400,h)},!0)}if(b&&A[1]){let E=r.get(A[1])?.label??A[1];M("\u203A",`View next seat ${E}`,()=>{e.flyToSeat(A[1])})}return!w.childElementCount&&!p?null:(t.appendChild(d),s=d,c(),d)},remove:l,layout:c}}var eP={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function tP(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}function jp(e){let{container:t,orbit:n,isNarrow:o}=e,r={...eP,...e.labels??{}},i=(x,S)=>{x.setAttribute("aria-label",S),x.title=S},a=document.createElement("div"),s=!1;a.className="sl-3d-navigation-controls",Object.assign(a.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let c=document.createElement("div");c.setAttribute("role","group"),c.setAttribute("aria-label","3D drag mode"),Object.assign(c.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let l=document.createElement("div");l.setAttribute("role","group"),l.setAttribute("aria-label","3D view controls"),Object.assign(l.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("button");u.type="button",u.textContent="\u21BB",i(u,r.rotate);let m=document.createElement("button");m.type="button",m.textContent="\u2725",i(m,r.move);let h=document.createElement("button");h.type="button",h.textContent="\u2212",i(h,r.zoomOut);let f=document.createElement("button");f.type="button",f.textContent="+",i(f,r.zoomIn);for(let x of[u,m,h,f])x.className="sl-3d-icon-control",Object.assign(x.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"});c.append(u,m),l.append(f,h);let d=null,p=()=>{let x=n.dragAction();if(x===d)return;d=x;let S=x==="orbit";u.setAttribute("aria-pressed",String(S)),m.setAttribute("aria-pressed",String(!S)),u.style.background=S?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",m.style.background=S?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=S?`${r.rotate} \xB7 ${r.move} with Shift`:`${r.move} \xB7 ${r.rotate} with Shift`},b=x=>{n.setPrimaryDragMode(x),p()};u.addEventListener("click",()=>b("orbit")),m.addEventListener("click",()=>b("pan"));let y=()=>{let{atMin:x,atMax:S}=n.dollyLimitState();f.disabled!==x&&(f.disabled=x),h.disabled!==S&&(h.disabled=S)};h.addEventListener("click",()=>{n.zoomBy(Zo),y()}),f.addEventListener("click",()=>{n.zoomBy(ro),y()}),a.append(c,l),b("auto"),t.appendChild(a);let g=e.enabled!==!1,v=()=>n.touchNavigationMode==="map"&&tP(),P=()=>{let x=o();a.style.display=s||!g?"none":"flex",a.style.right=x?"12px":"14px",a.style.bottom=x?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=x||v()?"none":"flex",f.style.display=x?"none":"",h.style.display=x?"none":""};return P(),{element:a,utilityControls:l,setNavigationMode:b,syncNavigationMode:p,syncZoomLimits:y,setSeatViewLocked:x=>{s=x,n.setInteractionEnabled(!x),P()},seatViewLocked:()=>s,layout:P}}var nP=.5,Xp=12,Kp=20,oP=28;function rP(e,t,n){return!(e>0)||!(n>0)?0:nP*n/(2*e*Math.tan(t*Math.PI/360))}var iP=700;function Yp(e){let{glctx:t,orbit:n,model:o,seats:r,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:m,cancelFlight:h,focusSectionCamera:f,setSelection:d,ensureSeatView:p}=e,b=0,y=0,g=0,v=-1,P=!1,w=!1,x=0,S=C=>{e.seatViewLocked()||v===-1&&(v=C.pointerId,b=C.clientX,y=C.clientY,g=performance.now(),P=!1,w=a.active,a.active&&(s.cinematicCancelled(),h(),i.onViewTargetChange?.(null)))},A=C=>{C.pointerId===v&&Jr(C.clientX-b,C.clientY-y,u)&&(P=!0)},M=(C,O,B,F,N)=>{let V=t.canvas.getBoundingClientRect(),H=t.canvas.clientWidth||V.width||1,L=t.canvas.clientHeight||V.height||1,G=C-V.left,j=O-V.top,D=F*F,U=-1,$=D,Z=1/0;for(let te of r){if(B&&te.sectionId!==B)continue;let X=o.seats.idToIndex.get(te.id);if(X===void 0)continue;if(N){let ie=Math.round(o.seats.iState[X]??0);if(ie!==0&&ie!==3)continue}let me=X*3,re=en(n.camera.projectionViewMatrix,[o.seats.iPosition[me],o.seats.iPosition[me+1]+.55,o.seats.iPosition[me+2]],H,L);if(!re.visible)continue;let ce=re.x-G,J=re.y-j,ae=ce*ce+J*J;(ae<$||Math.abs(ae-$)<1&&re.depth<Z)&&(U=X,$=ae,Z=re.depth)}return U},E=(C,O)=>{let B=e.gpu(),F=e.pick();if(!B||!F)return-1;F.syncFromSeatProgram(B.seatProgram);let N=t.canvas.getBoundingClientRect(),V=t.renderer.dpr,{x:H,y:L}=vd(C,O,N,V,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),G=Math.max(2,Math.round(8*V));return F.pick(n.camera,H,L,G)},T=()=>t.canvas.clientHeight||t.canvas.getBoundingClientRect().height,k=(C,O=Xp)=>{let B=n.camera?.position;if(!B)return!1;let F=C*3,N=Math.hypot(B.x-o.seats.iPosition[F],B.y-o.seats.iPosition[F+1],B.z-o.seats.iPosition[F+2]);return rP(N,n.fovY,T())>=O};return{onDown:S,onMove:A,onUp:C=>{if(C.pointerId!==v)return;let O=!P&&performance.now()-g<m;if(v=-1,w){w=!1;return}let B=e.gpu(),F=e.pick();if(!O||!B||!F)return;let N=E(C.clientX,C.clientY),V=N,H=C.pointerType==="touch"||C.pointerType==="pen",L=H?Kp:Xp,G=N>=0&&k(N,L),j=!1;if(e.focusedSectionId()&&N>=0){let te=c[N],X=te?l.get(te):void 0;if(X&&X!==e.focusedSectionId()&&f(X,{keepCamera:G})){if(!G)return;j=!0}}let D=V<0&&!!i.onObjectPick,U=D&&F.standingFloorAtLastPick?.()===!0;if(e.focusedSectionId()&&N<0&&(N=M(C.clientX,C.clientY,e.focusedSectionId(),44,!1)),N<0&&D){let te=e.areaAt?.(C.clientX,C.clientY,U)??null;if(te){if(!te.pickable)return;C.pointerType!=="mouse"&&(x=performance.now()),i.onObjectPick?.({kind:"area",id:te.id,point:{x:C.clientX,y:C.clientY}});return}}if(e.focusedSectionId()&&N<0){let te=M(C.clientX,C.clientY,null,72,!1),X=te>=0?c[te]:void 0,me=X?l.get(X):void 0;if(me&&me!==e.focusedSectionId()&&f(me))return}if(!e.focusedSectionId()){N<0&&(N=M(C.clientX,C.clientY,null,42,!1));let te=N>=0?c[N]:void 0,X=te?l.get(te):void 0;if(X&&f(X,{keepCamera:G})){if(!G)return;j=!0}}if(N<0||N>=c.length){e.selection().size&&(d([]),i.onViewTargetChange?.(null));return}let $=c[N];if(H&&e.focusedSectionId()&&!j&&!k(N,Kp)){e.focusSeatCamera($,{seatPx:oP,viewportHeightPx:T()});return}let Z=ct[Math.round(o.seats.iState[N]??0)]??"available";if(Z!=="available"&&Z!=="selected"){i.onSeatInspect?.($,Z);return}if(e.selection().has($)&&e.selection().size===1){d([]),i.onViewTargetChange?.(null),i.onSeatPick?.($);return}d([$]),p($),s.seatPicked($,l.get($)),i.onSeatPick?.($)},onTouchEnd:C=>{let O=x;x=0,O&&performance.now()-O<iP&&C.cancelable&&C.preventDefault()}}}function qp(e,t){return e.available===t.available&&(e.selected??0)===(t.selected??0)&&(e.wheelchairFree??null)===(t.wheelchairFree??null)&&e.filteredOut===!0==(t.filteredOut===!0)&&(e.statusText??"")===(t.statusText??"")}function Qp(e){return e?.available!=null&&e.available<=0}function aP(e){return Qp(e)||e?.wheelchairFree!=null&&e.wheelchairFree<=0}function Fc(e){return aP(e)||e?.filteredOut===!0}function sP(e){return!Qp(e)&&e?.filteredOut!==!0}function $p(e,t,n){return t<0?n<=1:e.floorIndex===t}function Jp(e,t){return t.size===0?e:e.map(n=>{if(n.kind!=="ga")return n;let o=t.get(n.id.slice(3));if(!o)return n;let r=n.areaName??"",i=o.statusText?[r,o.statusText].filter(Boolean).join(" \xB7 "):o.available!=null&&r?r:n.text,a=o.selected&&o.selected>0?Math.floor(o.selected):0;return{...n,text:i,...a?{count:a}:{},...Fc(o)?{muted:!0}:{}}})}function cP(e){let t=e[0],n=e[1],o=e[2],r=e[3],i=e[4],a=e[5],s=e[6],c=e[7],l=e[8],u=e[9],m=e[10],h=e[11],f=e[12],d=e[13],p=e[14],b=e[15],y=t*a-n*i,g=t*s-o*i,v=t*c-r*i,P=n*s-o*a,w=n*c-r*a,x=o*c-r*s,S=l*d-u*f,A=l*p-m*f,M=l*b-h*f,E=u*p-m*d,T=u*b-h*d,k=m*b-h*p,_=y*k-g*T+v*E+P*M-w*A+x*S;if(!Number.isFinite(_)||Math.abs(_)<1e-18)return null;let R=1/_;return[(a*k-s*T+c*E)*R,(o*T-n*k-r*E)*R,(d*x-p*w+b*P)*R,(m*w-u*x-h*P)*R,(s*M-i*k-c*A)*R,(t*k-o*M+r*A)*R,(p*v-f*x-b*g)*R,(l*x-m*v+h*g)*R,(i*T-a*M+c*S)*R,(n*M-t*T-r*S)*R,(f*w-d*v+b*y)*R,(u*v-l*w-h*y)*R,(a*A-i*E-s*S)*R,(t*E-n*A+o*S)*R,(d*g-f*P-p*y)*R,(l*P-u*g+m*y)*R]}function Zp(e,t,n,o){let r=e[3]*t+e[7]*n+e[11]*o+e[15];return!Number.isFinite(r)||Math.abs(r)<1e-12?null:[(e[0]*t+e[4]*n+e[8]*o+e[12])/r,(e[1]*t+e[5]*n+e[9]*o+e[13])/r,(e[2]*t+e[6]*n+e[10]*o+e[14])/r]}function lP(e,t,n,o,r=()=>!0){if(!e.length||!(n>=-1&&n<=1&&o>=-1&&o<=1))return null;let i=cP(t);if(!i)return null;let a=Zp(i,n,o,-1),s=Zp(i,n,o,1);if(!a||!s)return null;let c=s[1]-a[1];if(Math.abs(c)<1e-9)return null;let l=null,u=1/0;for(let m of e){if(m.points.length<3||!r(m))continue;let h=(m.floorY-a[1])/c;if(!(h>=0&&h<=1)||h>=u)continue;let f=(a[0]+(s[0]-a[0])*h)/I,d=(a[2]+(s[2]-a[2])*h)/I;Ye(m.points,f,d)&&(m.holes?.some(p=>p.length>=3&&Ye(p,f,d))||(l=m,u=h))}return l}function e0(e){return(t,n,o=!0)=>{let r=e.areas;if(!r?.length)return null;let i=e.focusedFloor(),a=u=>({id:u.id,pickable:sP(e.state(u.id))}),s=e.tagAt?.(t,n)??null;if(s){let u=s.startsWith("ga:")?r.find(m=>m.id===s.slice(3)&&$p(m,i,e.floorCount)):void 0;return u?a(u):null}if(!o)return null;let c=e.canvas.getBoundingClientRect();if(!(c.width>0&&c.height>0))return null;let l=lP(r,e.viewProjection(),(t-c.left)/c.width*2-1,1-(n-c.top)/c.height*2,u=>$p(u,i,e.floorCount));return l?a(l):null}}var pa=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,o=1/0,r=-1/0,i=-1/0;for(let f=0;f<this.count;f++){let d=t[f*3],p=t[f*3+2];d<n&&(n=d),d>r&&(r=d),p<o&&(o=p),p>i&&(i=p)}let a=Math.max(r-n,.001),s=Math.max(i-o,.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=o;let c=this.cols*this.rows,l=new Int32Array(c+1),u=f=>{let d=Math.min(this.cols-1,Math.max(0,Math.floor((t[f*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[f*3+2]-o)/this.cell)))*this.cols+d};for(let f=0;f<this.count;f++)l[u(f)+1]++;for(let f=0;f<c;f++)l[f+1]+=l[f];let m=new Int32Array(this.count),h=l.slice(0,c);for(let f=0;f<this.count;f++)m[h[u(f)]++]=f;this.cellStart=l,this.cellItems=m}gather(t,n,o,r,i){this.ensureGrid();let a=this.cellStart,s=this.cellItems;if(!a||!s)return 0;let c=r.length,l=o*o,u=Math.floor((t-this.minX)/this.cell),m=Math.floor((n-this.minZ)/this.cell),h=Math.ceil(o/this.cell)+1,f=this.iPosition,d=0;for(let p=0;p<=h&&d<c;p++){let b=m-p,y=m+p,g=u-p,v=u+p;for(let P=b;P<=y&&d<c;P++){if(P<0||P>=this.rows)continue;let w=P===b||P===y;for(let x=g;x<=v&&d<c;x++){if(!w&&x!==g&&x!==v){x=v-1;continue}if(x<0||x>=this.cols)continue;let S=P*this.cols+x;for(let A=a[S],M=a[S+1];A<M&&d<c;A++){let E=s[A],T=f[E*3]-t,k=f[E*3+2]-n,_=i===void 0?0:f[E*3+1]-i;T*T+_*_+k*k<=l&&(r[d++]=E)}}}}return d}};var ba=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(ai);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new pa(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,o=this.ctx.gpu();if(!o)return;if(!t){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let r=this.ctx.orbit().camera.position;if(Math.hypot(r.x-this.lastGatherX,r.y-this.lastGatherY,r.z-this.lastGatherZ)<Va)return;if(this.lastGatherX=r.x,this.lastGatherY=r.y,this.lastGatherZ=r.z,Math.hypot(r.x-n.bounds.center[0],r.y-n.bounds.center[1],r.z-n.bounds.center[2])-n.bounds.radius>Ga){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(r.x,r.z,Ga,this.nearBuf,r.y);s===0&&o.nearSeatCount()===0||o.setNearSeats(this.nearBuf,s)}ease(t,n,o){let r=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?r:i),this.structureDetailMix+=(o-this.structureDetailMix)*(o>this.structureDetailMix?r:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(o-this.structureDetailMix)<.01&&(this.structureDetailMix=o)}};function t0(e){let t=Math.max(5,e.radius),n=e.focalWorld[0]-e.center[0],o=e.focalWorld[2]-e.center[2],r=Math.hypot(n,o);if(r<t*.12)return{center:e.center,radius:t,polarDeg:48};let i=Math.min(r*.25,t*.2);return{center:[e.center[0]+n/r*i,e.center[1],e.center[2]+o/r*i],radius:t+i,polarDeg:50}}var ga=require("ogl");function n0(){let e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round");let n=document.createElementNS(e,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),t.appendChild(n),t}function o0(e){let{container:t,model:n,opts:o,orbit:r,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=e,m=0,h=-1,f=(E,T,k=28)=>{r.camera.position.set(E[0],E[1],E[2]),r.camera.lookAt(new ga.Vec3(T[0],T[1],T[2])),r.camera.fov=k,r.camera.updateProjectionMatrix()},d=document.createElement("button");d.className="sl-3d-overview-control sl-3d-icon-control",d.type="button",d.replaceChildren(n0());let p=o.navLabels?.fitView??"Show whole venue";d.setAttribute("aria-label",p),d.title=p,Object.assign(d.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 b=()=>{d.firstElementChild||d.replaceChildren(n0())};b();let y=E=>{h=E;let T=e.gpu();T&&(T.seatProgram.uniforms.uFocusFloor.value=E,T.solidProgram.uniforms.uFocusFloor.value=E,T.chairProgram.uniforms.uFocusFloor.value=E),e.showSectionSeatLabels(null)},g=null,v=!1,P=()=>{if(g=null,v=!1,e.setSeeThrough?.(null),e.isDisposed())return;o.onViewTargetChange?.(null),o.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),d.style.display="",c.setVisible(!0),e.setFrozen(!1);let E=h>=0?n.floors[h]:null;if(e.setNearFieldDetailEnabled(!!E),e.setSeatViewLocked(!1),w(),e.removeArriveChip(),e.setNavigationMode("auto"),E){let T=E.focalWorld[0]-E.center[0],k=E.focalWorld[2]-E.center[2],_=Math.hypot(T,k)>E.radius*.12?Math.atan2(T,k):l,R={center:E.center,radius:E.radius,box:E.box},C={polarDeg:58,margin:1.12};e.reducedMotion()?r.frame(R,!1,_,!1,C):r.frameSoft(R,_,!1,C)}else e.reducedMotion()?r.frame(n.bounds,!1,l,o.portraitOverviewCrop===!0,u):r.frameSoft(n.bounds,l,o.portraitOverviewCrop===!0,u);c.setOverviewDistance(r.targetDistance),e.showSectionSeatLabels(null),s.requestRender()},w=()=>{m++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),r.resumeAfterFlight(n.focalWorld))},x=E=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let T=n.seats.idToIndex.get(E);if(T===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),o.onViewTargetChange?.(E),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),d.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let k=e.inSeatView()&&o.arriveAtSeatEye===!0;e.setSeatStepping(k),e.setSeatViewLocked(!1);let _=++m;k?e.showArriveChip(E,_):e.removeArriveChip();let{eye:R,focal:C}=e.resolvedSeatViewPose(E,T),O=o.arriveAtSeatEye?e.seatViewArrival(E,T):null,B=O&&O.stops.length>1&&O.stops[1].name==="row"?O.stops[1]:null,F=O?O.focal:C,N=[r.camera.position.x,r.camera.position.y,r.camera.position.z],V=Pc(N,O?.eye??R,F,n.bounds.center,n.bounds.radius),H=B?B.eye:O?O.eye:o.arriveAtSeatEye?R:V.finalPos,L=O?O.fov:o.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?ia:65:28,G=[V.waypoints[0],V.waypoints[1],H];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),f(H,F,L),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||r.syncFromCamera(),e.setSeatViewLocked(o.arriveAtSeatEye===!0),O&&e.enterSeatView(O.stops),e.showArriveChip(E,_),Promise.resolve();let j=new ga.Quat().copy(r.camera.quaternion),D=tp(r.camera,H,F);s.requestRender();let U=k?700:2500;return i.start(G,j,D,U,L).then(()=>{e.isDisposed()||_!==m||(e.setSeatStepping(!1),a.cinematicPlayed(U),r.resumeAfterFlight(F),e.setSeatViewLocked(o.arriveAtSeatEye===!0),O&&e.enterSeatView(O.stops,B?1:0),s.requestRender(),e.showArriveChip(E,_))})},S=(E,T)=>{let k=n.sections.find(_=>_.id===E);if(!k||k.seatCount===0)return!1;if(g=E,v=!1,e.setSeeThrough?.(null),e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&h!==k.floorIndex&&y(k.floorIndex),e.setNavigationMode("auto"),e.panorama()||c.setVisible(!0),e.showSectionSeatLabels(E),!T?.keepCamera){let _=t0(k),R={polarDeg:_.polarDeg,margin:1.12};e.reducedMotion()?r.frame({center:_.center,radius:_.radius},!1,r.currentAzimuth,!1,R):r.glideTo({center:_.center,radius:_.radius},R)}return o.onSectionFocusChange?.(E),s.requestRender(),!0},A=(E,T)=>{if(e.isDisposed()||!e.gpu())return!1;let k=n.seats.idToIndex.get(E);if(k===void 0)return!1;let _=k*3,R=[n.seats.iPosition[_],n.seats.iPosition[_+1]+.55,n.seats.iPosition[_+2]],C=T?uP(T,r.fovY,r.camera.aspect||1):r0;return v=!0,e.setSeeThrough?.(R),e.reducedMotion()?r.frame({center:R,radius:C},!1,void 0,!1,Dc):r.frameSoft({center:R,radius:C},void 0,!1,Dc),s.requestRender(),!0},M=()=>{if(e.isNarrow?.()&&v&&g&&S(g)){s.requestRender();return}P()};return d.addEventListener("click",M),{overviewChip:d,layoutOverviewChip:b,flightGen:()=>m,focusedFloor:()=>h,applyFloorFocus:y,placeCameraFinal:f,cancelFlight:w,focusOverview:P,flyToSeat:x,focusSectionCamera:S,focusSeatCamera:A}}var r0=4.5;function uP(e,t,n){let o=Math.tan(t*Math.PI/360),r=o*Math.max(.001,n),a=mP*e.viewportHeightPx/(2*Math.max(1,e.seatPx)*o)*Math.min(o,r)/Dc.margin;return Math.max(hP,Math.min(r0,a))}var mP=.5,hP=1.5,Dc={polarDeg:48,margin:1.25};function Br(e,t){let{doc:n,report:o}=Zi(e),r=o.confident&&(o.sections.length>0||!!o.looseRowBlocks);if(!r&&!o.roles?.length)return null;if(!r){let c=new Map(o.roles.map(f=>[f.id,f.role])),l=f=>f.map(d=>d.type==="shape"&&c.has(d.id)?{...d,role:c.get(d.id)}:d),u=e.floors?.map(f=>({...f,objects:l(f.objects)})),m=new Float64Array(t.length).fill(Number.NaN),h=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((f,d)=>{f.eyeHeightM!==void 0&&(m[d]=f.eyeHeightM),f.focalPoint&&(h[d*2]=f.focalPoint.x,h[d*2+1]=f.focalPoint.y)}),{doc:{...e,objects:u?.[0]?.objects??l(e.objects),...u?{floors:u}:{}},report:o,eyeHeightM:m,focal:h}}let i=new Map(fo(n).map(c=>[c.id,c])),a=new Float64Array(t.length).fill(Number.NaN),s=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,l)=>{let u=i.get(c.id)??c;u.eyeHeightM!==void 0&&(a[l]=u.eyeHeightM),u.focalPoint&&(s[l*2]=u.focalPoint.x,s[l*2+1]=u.focalPoint.y)}),{doc:n,report:o,eyeHeightM:a,focal:s}}function Nc(e,t){return e.map((n,o)=>{let r=t.eyeHeightM[o],i=t.focal[o*2],a=t.focal[o*2+1],s={...n};return Number.isNaN(r)?delete s.eyeHeightM:s.eyeHeightM=r,Number.isNaN(i)?delete s.focalPoint:s.focalPoint={x:i,y:a},s})}function i0(e){let t=e.estimate===!1?null:Br(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:Nc(e.seats,t)},estimate:t}:{input:e}}function Bc(e,t,n,o,r,i,a,s,c=.5){let l=-1,u=s*s,m=1/0;for(let h=0;h<t;h++){let f=h*3,d=en(n,[e[f],e[f+1]+c,e[f+2]],o,r);if(!d.visible)continue;let p=d.x-i,b=d.y-a,y=p*p+b*b;(y<u-4||y<u+4&&d.depth<m)&&(l=h,u=Math.min(u,y),m=d.depth)}return l}var dP={};function a0(e){let t=performance.now(),{input:n,estimate:o}=i0(e);return{model:Oo(n),buildMs:performance.now()-t,source:"main",...o?{estimate:o}:{}}}function fP(e){let t=fo(e.doc);return{...a0({...e,seats:t}),seats:t}}function s0(e,t,n){let o=i=>({...t(),fallbackReason:i});if(typeof Worker>"u")return Promise.resolve(o("unavailable"));let r;try{r=new Worker(new URL("./scene/scene.worker.js",dP.url),{type:"module"})}catch{return Promise.resolve(o("unavailable"))}return new Promise(i=>{let a=!1,s=u=>{a||(a=!0,clearTimeout(l),r.terminate(),i(u))},c=u=>s(o(u)),l=window.setTimeout(()=>c("timeout"),15e3);r.onerror=()=>c("worker_error"),r.onmessage=u=>{let m=n(u.data);m?s(m):c("bad_response")},r.postMessage({...e,crowdSeatCeiling:e.crowdSeatCeiling??Xi()})})}function c0(e){return s0(e,()=>a0(e),({model:t,buildMs:n,estimate:o})=>({model:t,buildMs:n,source:"worker",...o?{estimate:o}:{}}))}function l0(e){return s0(e,()=>fP(e),({model:t,buildMs:n,seats:o,estimate:r})=>o?{model:t,buildMs:n,seats:o,source:"worker",...r?{estimate:r}:{}}:null)}var pP=40,bP=48,gP=Math.PI/180,yP=Fa,xP=500,MP=6;function vP(e,t,n={}){let o=performance.now(),r=t.prepared?t.prepared.estimate:t.estimate===!1?null:Br(t.doc,t.seats);r&&(t={...t,doc:r.doc,seats:Nc(t.seats,r)});let i=t.prepared?.model??Oo(t),a=new da(n.onAnalytics),s=new Array(i.seats.count);for(let[z,Y]of i.seats.idToIndex)s[Y]=z;let c=new Map(t.seats.map(z=>[z.id,z])),l=new Map;for(let z of t.seats){if(!z.rowId)continue;let Y=l.get(z.rowId);Y?Y.push(z.id):l.set(z.rowId,[z.id])}let u=new Map,m=[0,0,0,0];function h(){if(g)for(let z of[g.seatProgram,g.solidProgram,g.chairProgram])z.uniforms.uSeeThrough.value=m}t.seats.forEach((z,Y)=>{u.set(z.id,i.seatSectionIds?.[Y]??z.sectionId)});let f=new Map;for(let[z,Y]of i.seats.idToIndex){let q=u.get(z);if(!q)continue;let le=f.get(q);le?le.push(Y):f.set(q,[Y])}let d=()=>{if(!g||!i.sectionSolidRanges.length)return;let{lit:z,anyUnlit:Y}=Fd(i.sectionSolidRanges,f,i.seats.iState);g.setSectionShellLit(Y?z:null)},p=new Map,b=()=>{!g||!i.areaSolidRanges?.length||g.setAreaFloorsQuiet(new Set([...p].filter(([,z])=>Fc(z)).map(([z])=>z)))},y=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)),g=null,v=null,P=null,w=!1,x=!1,S=!1,A=new Map,M=null,E=null,T=null,k=new Map,_=null,R=()=>{T===null&&(T=e.style.zIndex,e.style.zIndex="20")},C=()=>{T!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=T),T=null)},O=!1,B=()=>O?bt.focusedFloor():-1,F=()=>{g=Xd(D.gl,i),v?.dispose(),v=cd(D.gl,[1,1,1],i.theme.seatStates.selected),We(!1),d(),b(),W(),P=new oa(D.renderer,g.seatGeometry,g.chairGeometry,g.solidGeometry,i.seats.count),D.setClearColor(i.theme.background.top),P.setRestoreClear(i.theme.background.top),P.setRoomCentre(i.room?.centre),g.seatProgram.uniforms.uSeatRadius.value=cn*i.theme.seatScale,g.seatProgram.uniforms.uFocusFloor.value=B(),g.solidProgram.uniforms.uFocusFloor.value=B(),g.chairProgram.uniforms.uFocusFloor.value=B(),g.screenProgram&&(g.screenProgram.uniforms.uFocusFloor.value=B()),h(),V.forceRegather()},N=!1,V=new ba({model:i,orbit:()=>X,gpu:()=>g}),H=!1,L=new Map,G=24,j=z=>V.setDetailEnabled(z),D=new Zr(e,{onContextLost:()=>{S||a.contextLost(),w=!0,ye.stop(),g=null,P=null,U.reset()},onContextRestored:()=>{F(),w=!1,S||a.contextRestored(),ye.requestRender()}}),U=new qr(D.gl,D.renderer,D.smoothingSamples),$=new Qr,Z=!1,te=(z,Y)=>{if(!g)return{smooth:!1,onBudget:!1};if(Ml(i.seatCount,i.crowd?.count??0,xl)||g.nearSeatCount()>0||!z)return{smooth:!0,onBudget:!1};let q=$.allows(Y);return{smooth:q,onBudget:q}},X=new ri(D.gl,D.canvas,()=>ye.requestRender(),()=>a.orbitEngaged());X.setTouchNavigation(Sl(n)),X.setAspect(D.aspect);let me=(t.doc.floors?.flatMap(z=>z.objects)??t.doc.objects).some(z=>z.type==="section"&&z.physical3dProvenance?.surfaceKind?.status==="inferred"),re=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(me&&i.stages.length===0))return Yc(i.focalWorld,i.seats.iPosition,i.bounds)})(),ce=(t.doc.floors?.flatMap(z=>z.objects)??t.doc.objects).some(z=>z.type==="shape"&&z.stageKind?.startsWith("pitch-")),J=i.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:ce?36:48,margin:1.05},ae=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;X.frame(i.bounds,!ae&&n.skipInitialOverviewAnimation!==!0,re,n.portraitOverviewCrop===!0,J);let ie=new ra(X.camera),ge=Up(e),Ae=$c(e,i),be=new Ji(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:i.theme.background.top}),ke=i.labels,Ke=()=>Rf(ke,i.floors.length,B());be.setLabels(Ke()),be.setOverviewDistance(X.targetDistance);let Be=()=>{let z=new Map,Y=ct.indexOf("available");for(let q of ke){if(!q.wheelchairSeats)continue;let le=0;for(let xe of q.wheelchairSeats)i.seats.iState[xe]===Y&&le++;le>0&&z.set(q.id,le)}return be.setWheelchairFree(z)};Be();let Fe=null,Ge=()=>[...A.keys()].flatMap(z=>{let Y=i.seats.idToIndex.get(z),q=Y===void 0?void 0:t.seats[Y];if(Y===void 0||q?.id!==z)return[];let le=Y*3;return[{id:`seat:${z}`,kind:"seat",seatWidthM:i.seats.iChairWidth[Y]*2,text:q.displayLabel||q.label,anchor:[i.seats.iPosition[le],i.seats.iPosition[le+1]+1.05,i.seats.iPosition[le+2]],pinBase:fe(le)}]}),ne=-1,W=()=>{g&&(ne=Fe?i.sections.findIndex(z=>z.id===Fe):-1,g.seatProgram.uniforms.uFocusSection.value=ne,g.chairProgram.uniforms.uFocusSection.value=ne)},K=z=>{if(Fe=z,W(),be.setForcedDense(!!z),!z){let he=Ge(),nt=new Set(he.map(qe=>qe.id));be.setLabels([...Ke().filter(qe=>!nt.has(qe.id)),...he]);return}let Y=t.seats.filter(he=>u.get(he.id)===z),q=new Set(Y.map(he=>he.id)),le=new Set(Y.map(he=>he.rowId)),xe=new Set(A.keys()),Le=new Set(Y.filter(he=>xe.has(he.id)).map(he=>he.id)),De=Ke().filter(he=>he.kind!=="row"&&he.kind!=="seat"&&he.kind!=="access"||he.kind==="access"&&q.has(he.id.slice(7))||(he.kind==="row"?le.has(he.id.slice(4)):q.has(he.id.slice(5))));if(i.seatCount<=6e3&&Le.size===0){be.setLabels(De);return}let He=Y,tt=new Set(He.map(he=>`seat:${he.id}`)),At=He.flatMap(he=>{let nt=i.seats.idToIndex.get(he.id);if(nt===void 0)return[];let qe=nt*3;return[{id:`seat:${he.id}`,kind:"seat",seatWidthM:i.seats.iChairWidth[nt]*2,rowId:he.rowId,text:xe.has(he.id)?he.displayLabel||he.label:nc(he.displayLabel||he.label),anchor:[i.seats.iPosition[qe],i.seats.iPosition[qe+1]+(xe.has(he.id)?1.05:.55),i.seats.iPosition[qe+2]],...xe.has(he.id)?{pinBase:fe(qe)}:{}}]});be.setLabels([...De.filter(he=>!tt.has(he.id)),...At])};F();let Q=null,ve=null,Ee=new u0.Mat4,Ve=z=>{if(w||!g||x)return!1;let Y=Ep({flying:ie.active,panoramaMounted:M!==null,seatViewActive:Q?.active===!0}),q=Ip(Q?.active===!0,B());g.seatProgram.uniforms.uFocusFloor.value=q,g.solidProgram.uniforms.uFocusFloor.value=q,g.chairProgram.uniforms.uFocusFloor.value=q,g.screenProgram&&(g.screenProgram.uniforms.uFocusFloor.value=q);let le=Y==="orbit"?ne:-1;g.seatProgram.uniforms.uFocusSection.value=le,g.chairProgram.uniforms.uFocusSection.value=le;let xe=H?!1:Y==="cinematic"?ie.update(performance.now()):Y==="seatView"?Q.update(performance.now()):Y==="orbit"?X.update():!1;ve?.syncZoomLimits(),ve?.syncNavigationMode();let Le=B()>=0?i.floors[B()]:null,De=Le?.radius??i.bounds.radius,He=Hl(X.currentDistance,De),tt=N?{center:[X.camera.position.x,X.camera.position.y,X.camera.position.z],radius:520}:i.clipBounds??i.renderBounds;X.updateClipping(tt);let At=Le?.center??i.renderBounds.center,he=Le?.radius??i.renderBounds.radius,nt=(Ht,Pa)=>Math.hypot(X.camera.position.x-Ht[0],X.camera.position.y-Ht[1],X.camera.position.z-Ht[2])<=Pa*(V.detailVisible?1.8:1.55),qe=nt(At,he);if(!qe&&Fe){let Ht=i.sections.find(Pa=>Pa.id===Fe);Ht&&(qe=nt(Ht.center,Math.max(12,Ht.radius*2)))}V.detailVisible=qe;let ft=g.seatProgram.uniforms;ft.uSeatScale.value=He.scale,ft.uSeatFade.value=He.fade;let Cn=!!Le&&Gl(Le.seatCount,D.canvas.clientWidth||1,D.canvas.clientHeight||1),Sa=Vl(i.seats.count,De,X.currentDistance,X.camera.fov,D.canvas.clientHeight||1),eo=V.detailVisible||Cn||Sa?1:0,Vr=V.detailVisible||B()>=0||i.floors.length>1?1:0;V.ease(z,eo,Vr),ft.uSeatDetail.value=V.seatDetailMix;let to=eo===0&&V.seatDetailMix<.01;g.seatGeometry.setDrawRange(to?Ia:0,to?ll:Ia),g.solidProgram.uniforms.uStructureDetail.value=V.structureDetailMix,g.solidProgram.uniforms.uViewport.value.set([D.gl.drawingBufferWidth,D.gl.drawingBufferHeight]),ft.uMinPixels.value=He.minPixels,ft.uPixelToWorld.value=2*Math.tan(X.camera.fov*gP/2)/Math.max(1,D.pixelHeight),V.update(V.detailVisible),(i.outdoor||i.house)&&(Ee.copy(X.camera.projectionViewMatrix).inverse(),g.backgroundProgram.uniforms.uInvViewProj.value.set(Ee),g.backgroundProgram.uniforms.uEye.value.set([X.camera.position.x,X.camera.position.y,X.camera.position.z]));let no=te(xe,X.currentDistance),Tt=U.begin(no.smooth);Z=Tt!==null,$.frame(no.onBudget&&Tt!==null,X.currentDistance,performance.now());let wa=Tt?{target:Tt}:{};D.renderer.render({scene:g.background,clear:!0,...wa}),D.renderer.render({scene:g.main,camera:X.camera,clear:!1,...wa});let g0=v?v.update(performance.now(),[X.camera.position.x,X.camera.position.y,X.camera.position.z],M!==null,Y==="seatView"):!1;if(v&&D.renderer.render({scene:v.root,camera:X.camera,clear:!1,...wa}),U.end(),Ae){let Ht=X.camera.worldMatrix;Ae.update(Y==="seatView"?[X.camera.position.x,X.camera.position.y,X.camera.position.z]:null,[-Ht[8],-Ht[9],-Ht[10]])}be.update(X.camera.projectionViewMatrix,D.canvas.clientWidth||1,D.canvas.clientHeight||1,X.currentDistance,De,[X.camera.position.x,X.camera.position.y,X.camera.position.z]);let jc=xe||g0||V.seatDetailMix!==eo||V.structureDetailMix!==Vr;return ze(!jc),jc},ze=Nl(e),ye=new ii(Ve),Pt=typeof ResizeObserver<"u"?new ResizeObserver(()=>va.resize()):null;Pt?.observe(e),X.setZoomPointResolver((z,Y)=>{let q=D.canvas.getBoundingClientRect(),le=D.canvas.clientWidth||q.width,xe=D.canvas.clientHeight||q.height;if(!(le>0)||!(xe>0))return null;X.camera.updateMatrixWorld();let Le=Bc(i.seats.iPosition,i.seats.count,X.camera.projectionViewMatrix,le,xe,z-q.left,Y-q.top,pP);if(Le<0)return null;let De=Le*3;return[i.seats.iPosition[De],i.seats.iPosition[De+1]+.5,i.seats.iPosition[De+2]]});function fe(z){return[i.seats.iPosition[z],i.seats.iPosition[z+1]+.5,i.seats.iPosition[z+2]]}be.setSeatNumberRow(null);let Ce=null,ee=0,pe=null,de=()=>{ee=0;let z=null,Y=null;if(Ce&&!Q?.active&&!ie.active){let xe=D.canvas.getBoundingClientRect(),Le=D.canvas.clientWidth||xe.width,De=D.canvas.clientHeight||xe.height;if(Le>0&&De>0){let He=Bc(i.seats.iPosition,i.seats.count,X.camera.projectionViewMatrix,Le,De,Ce.x-xe.left,Ce.y-xe.top,bP);z=He>=0?t.seats[He]?.rowId??null:null;let tt=He>=0?t.seats[He]?.id??null:null;if(Y=tt,Ce.mouse&&!Ce.pressing&&!!Fe&&!!tt&&u.get(tt)===Fe){let he=e.getBoundingClientRect();pe=tt,n.onSeatHover?.(tt,{x:Ce.x-he.left,y:Ce.y-he.top})}else Te()}}else Te();let q=Ce?.mouse?Y:null,le=be.setSeatNumberSeat(q);(be.setSeatNumberRow(z)||le)&&ye.requestRender()};function Te(){pe!==null&&(pe=null,n.onSeatHover?.(null,null))}let Oe=z=>{Ce={x:z.clientX,y:z.clientY,mouse:z.pointerType==="mouse",pressing:z.type==="pointerdown"},ee||(ee=requestAnimationFrame(de))},Ue=z=>{z.pointerType==="mouse"&&(Ce=null,ee||(ee=requestAnimationFrame(de)))};D.canvas.addEventListener("pointermove",Oe),D.canvas.addEventListener("pointerdown",Oe),D.canvas.addEventListener("pointerleave",Ue);function We(z){if(!v)return;let Y=[];for(let q of A.keys()){let le=i.seats.idToIndex.get(q);if(le===void 0)continue;let xe=le*3;Y.push({id:q,position:fe(xe)})}v.setSeats(Y,performance.now(),z)}let at=z=>{let Y=xe=>{let Le=i.seats.idToIndex.get(xe);return Le===void 0?void 0:i.seats.iState[Le]},{updates:q,next:le}=Yd(A,z,Y);if(A=le,be.setSelectedSeatIds(A.keys()),We(!Ze()),ye.requestRender(),K(Fe),q.length){let xe=Ya(i.seats,q);g&&g.uploadSeatStateRuns(xe),d(),ye.requestRender()}},Ze=()=>_!==null?_:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,st=8,Bt=z=>{if(!n.getSeatView)return null;let Y=k.get(z);if(!Y)for(Y=Promise.resolve(n.getSeatView(z)),k.set(z,Y),Y.catch(()=>{k.get(z)===Y&&k.delete(z)});k.size>st;){let q=k.keys().next().value;if(q===void 0)break;k.delete(q)}return Y},Ct=yp(i.stages,i.focalWorld,i.bounds.groundY??0),Ut=_c(Ct),fn=null,_n=(z,Y)=>{if(c.get(z)?.kind!=="booth")return null;fn??=ap(t.doc,t.seats);let q=fn.get(z),le=[i.seats.iPosition[Y*3],i.seats.iPosition[Y*3+1],i.seats.iPosition[Y*3+2]];return q?{at:le,front:q}:null},$n=(z,Y)=>{let q=_n(z,Y);if(q)return Ec(q.at,q.front);let le=c.get(z),xe=Math.max(0,Math.round(i.seats.iFloor[Y]??0)),Le=t.doc.floors?.[xe],De=i.floors[xe],He=Le?.focalPoint??t.doc.focalPoint,tt=De?{x:De.focalWorld[0]/I,y:De.focalWorld[2]/I}:He,At=le?.focalPoint?{x:le.focalPoint.x+tt.x-He.x,y:le.focalPoint.y+tt.y-He.y}:tt,he=[i.seats.iPosition[Y*3],i.seats.iPosition[Y*3+1],i.seats.iPosition[Y*3+2]],nt=rp(i.seats.iPosition,Y,Ut),qe=nt!==null&&Math.abs(nt)<op;return ip(he,At,Le?.baseHeightM??0,le?.eyeHeightM,Ut,qe)},Zn=()=>(e.clientWidth||D.canvas.clientWidth)<=520,qn=null,zo=null,ya=async(z,Y,q)=>{if(!n.getSeatView||S||q!==bt.flightGen())return;let le;try{le=await Vp()}catch{if(a.panoramaFailed(z,"mount"),!S&&q===bt.flightGen()){let xe=Qn(z,q,!0);requestAnimationFrame(()=>xe?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(S||q!==bt.flightGen()||!qn))return zo??=le.createOpenPanorama(qn),zo(z,Y,q)},Uo=Wp({container:e,model:i,opts:n,expandedSeatById:c,seatIdsByRow:l,isNarrow:Zn,isDisposed:()=>S,flightGen:()=>bt.flightGen(),flyToSeat:z=>Uc(z),openPanorama:(z,Y,q)=>ya(z,Y,q)}),Qn=Uo.show,Jn=Uo.remove,xa=Uo.layout,an=jp({container:e,orbit:X,isNarrow:Zn,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});ve=an;let Hr=an.element,Wo=an.setNavigationMode,m0=an.layout,h0=an.utilityControls,jo=null,Hc=!1,Gr=z=>{an.setSeatViewLocked(z),z||Q?.exit()};Q=Rp({canvas:D.canvas,camera:X.camera,requestRender:()=>ye.requestRender(),reducedMotion:Ze,onStopChange:z=>{let Y=z??(Hc?"seat":null);jo=Y;try{n.onSeatViewStopChange?.(Y)}catch{}},onApplied:()=>{S||X.syncFromCamera()}});let Gc=i.sections.reduce((z,Y)=>Y.seatCount>0&&Y.box?Math.max(z,Y.box.max[1]):z,-1/0),Vc=(z,Y)=>{let{eye:q}=$n(z,Y),le=(e.clientWidth||D.canvas.clientWidth||1)/Math.max(1,e.clientHeight||D.canvas.clientHeight||1),xe=_n(z,Y),Le=xe?cp(xe.at,xe.front,le):Mp(q,Ct,le,{preserveEye:!0});if(n.seatViewStops===!1)return{...Le,stops:[]};let De=u.get(z),He=De?i.sections.find(tt=>tt.id===De):void 0;return{...Le,stops:vp(Le,{aspect:le,seatingTopY:Number.isFinite(Gc)?Gc:i.bounds.box.max[1],section:He&&He.seatCount>0?{center:He.center,radius:He.radius}:null,venue:{center:i.bounds.center,radius:i.bounds.radius}})}},bt=o0({isNarrow:Zn,setSeeThrough:z=>{m=z?[z[0],z[1],z[2],MP]:[0,0,0,0],h(),ye.requestRender()},container:e,model:i,opts:n,orbit:X,cinematic:ie,analytics:a,loop:ye,labelOverlay:be,stageAzimuth:re,overviewFraming:J,gpu:()=>g,isDisposed:()=>S,panorama:()=>M,setPanorama:z=>{M=z},setPanoramaSphereVisible:z=>{N=z},panoramaLoadAbort:()=>E,setPanoramaLoadAbort:z=>{E=z},setFrozen:z=>{x=z},restorePanoramaLayer:C,reducedMotion:Ze,resolvedSeatViewPose:$n,showSectionSeatLabels:K,setNearFieldDetailEnabled:j,setSeatViewLocked:Gr,setNavigationMode:Wo,showArriveChip:Qn,removeArriveChip:Jn,inSeatView:()=>jo!==null,setSeatStepping:z=>{Hc=z},seatViewArrival:(z,Y)=>n.arriveAtSeatEye?Vc(z,Y):null,enterSeatView:(z,Y)=>Q?.enter(z,Y)});O=!0;let Ma=bt.overviewChip,f0=bt.layoutOverviewChip,d0=bt.applyFloorFocus,p0=bt.focusOverview,zc=bt.cancelFlight,Uc=bt.flyToSeat,Wc=bt.focusSectionCamera;h0.appendChild(Ma),qn={container:e,model:i,opts:n,analytics:a,orbit:X,loop:ye,seatsById:c,ensureSeatView:Bt,resolvedSeatViewPose:$n,gpu:()=>g,gl:D.gl,isContextLost:()=>w,isDisposed:()=>S,flightGen:()=>bt.flightGen(),setPanorama:z=>{M=z},getLoadAbort:()=>E,setLoadAbort:z=>{E=z},setPanoramaSphereVisible:z=>{N=z,z&&Q?.exit()},setFrozen:z=>{x=z},raisePanoramaLayer:R,restorePanoramaLayer:C,getOverviewChip:()=>Ma,labelOverlay:be,reducedMotion:Ze,removeArriveChip:Jn,showArriveChip:Qn};let b0=e0({canvas:D.canvas,areas:i.areas,viewProjection:()=>X.camera.projectionViewMatrix,state:z=>p.get(z),focusedFloor:B,floorCount:i.floors.length,tagAt:(z,Y)=>be.tagAt(z,Y)}),Wt=Yp({glctx:D,orbit:X,model:i,seats:t.seats,opts:n,cinematic:ie,analytics:a,seatIdByIndex:s,sectionIdBySeatId:u,tapSlop:yP,tapMs:xP,gpu:()=>g,pick:()=>P,seatViewLocked:()=>an.seatViewLocked(),focusedSectionId:()=>Fe,selection:()=>A,cancelFlight:zc,focusSectionCamera:Wc,focusSeatCamera:bt.focusSeatCamera,setSelection:at,ensureSeatView:Bt,areaAt:b0});D.canvas.addEventListener("pointerdown",Wt.onDown),D.canvas.addEventListener("pointermove",Wt.onMove),D.canvas.addEventListener("pointerup",Wt.onUp),D.canvas.addEventListener("pointercancel",Wt.onUp),D.canvas.addEventListener("touchend",Wt.onTouchEnd,{passive:!1}),ye.requestRender();let va={setAvailability(z){let Y=Kd(A,z),q=Ya(i.seats,Y);q.length&&g&&g.uploadSeatStateRuns(q),d(),q.length&&Be(),ye.requestRender()},setSelection:at,setAreaStates(z){let Y=!1;for(let[q,le]of Object.entries(z)){let xe=p.get(q);xe&&qp(xe,le)||(p.set(q,{available:le.available,selected:le.selected,wheelchairFree:le.wheelchairFree,filteredOut:le.filteredOut===!0,statusText:le.statusText??""}),Y=!0)}Y&&(ke=Jp(i.labels,p),b(),K(Fe),ye.requestRender())},setNavigationMode:Wo,zoomIn(){X.zoomBy(ro),ye.requestRender()},zoomOut(){X.zoomBy(Zo),ye.requestRender()},flyToSeat:Uc,focusOverview:p0,seatViewStop:()=>jo,recentreSeatView:()=>Q?.recentre()??!1,resize(){let{width:z,height:Y}=D.resize();X.setAspect(z/Math.max(1,Y)),xa(),m0(),f0(),ye.requestRender()},stats(){return{...ye.stats(),drawCalls:g?g.drawCalls:0,fallbackTriangles:g?g.seatGeometry.drawRange.count/3*i.seats.count:0,seatCount:i.seatCount}},captureImage(z=1280){if(w||!g||typeof document>"u")return null;Ve(0);let Y=D.canvas,q=Math.min(1,z/Math.max(Y.width,Y.height,1)),le=document.createElement("canvas");le.width=Math.max(1,Math.round(Y.width*q)),le.height=Math.max(1,Math.round(Y.height*q));let xe=le.getContext("2d");return xe?(xe.drawImage(Y,0,0,le.width,le.height),le.toDataURL("image/jpeg",.82)):null},captureSeatView(z,Y=480){if(w||!g||x||typeof document>"u"||ie.active||M!==null||Q?.active)return null;let q=L.get(z);if(q)return q;let le=i.seats.idToIndex.get(z);if(le===void 0)return null;let{eye:xe,focal:Le,fov:De}=Vc(z,le),He=X.snapshot(),tt=[V.seatDetailMix,V.structureDetailMix],At=null;try{H=!0,X.camera.position.set(xe[0],xe[1],xe[2]),X.camera.perspective({fov:De,aspect:X.camera.aspect}),X.camera.lookAt(Le),X.camera.updateMatrixWorld(),X.syncFromCamera(),V.seatDetailMix=1,V.structureDetailMix=1,V.forceRegather(),Ve(0);let he=D.canvas,nt=Math.min(he.width,Math.round(he.height*16/9)),qe=Math.round(nt*9/16),ft=document.createElement("canvas");ft.width=Math.max(1,Math.round(Y)),ft.height=Math.max(1,Math.round(Y*9/16));let Cn=ft.getContext("2d");Cn&&(Cn.drawImage(he,(he.width-nt)/2,(he.height-qe)/2,nt,qe,0,0,ft.width,ft.height),At=ft.toDataURL("image/jpeg",.8))}finally{H=!1,He(),V.seatDetailMix=tt[0],V.structureDetailMix=tt[1],V.forceRegather(),Ve(0)}if(At)for(L.set(z,At);L.size>G;)L.delete(L.keys().next().value);return At},getQualityEvidence(){let z=ye.stats(),Y=D.canvas.clientWidth||1,q=D.canvas.clientHeight||1,le=i.bounds.center,xe=en(X.camera.projectionViewMatrix,[le[0],i.bounds.box.min[1],le[2]],Y,q),Le=en(X.camera.projectionViewMatrix,[le[0],i.bounds.box.max[1],le[2]],Y,q),De=i.bounds.box,He=[De.min[0],De.max[0]].flatMap(he=>[De.min[1],De.max[1]].flatMap(nt=>[De.min[2],De.max[2]].map(qe=>en(X.camera.projectionViewMatrix,[he,nt,qe],Y,q)))).filter(he=>Number.isFinite(he.x)&&Number.isFinite(he.y)&&Number.isFinite(he.depth)),tt=He.length?(()=>{let he=Math.min(...He.map(Tt=>Tt.x)),nt=Math.max(...He.map(Tt=>Tt.x)),qe=Math.min(...He.map(Tt=>Tt.y)),ft=Math.max(...He.map(Tt=>Tt.y)),Cn=Math.max(0,he),Sa=Math.min(Y,nt),eo=Math.max(0,qe),Vr=Math.min(q,ft),to=Math.max(0,Sa-Cn),no=Math.max(0,Vr-eo);return{box:{x:Cn,y:eo,width:to,height:no},horizontalFillRatio:to/Y,verticalFillRatio:no/q,visibleAreaRatio:to*no/(Y*q),clippedEdges:[...qe<0?["top"]:[],...nt>Y?["right"]:[],...ft>q?["bottom"]:[],...he<0?["left"]:[]]}})():void 0,At=String(D.gl.getParameter(D.gl.VERSION)??"");return{viewport:{width:Y,height:q},context:{webgl2:/webgl\s*2/i.test(At),lost:w},frame:{rendered:z.rendered,idle:z.idle,smoothed:Z},camera:{position:[X.camera.position.x,X.camera.position.y,X.camera.position.z],distance:X.currentDistance,verticalFovDeg:X.fovY},scene:{seatCount:i.seatCount,floorCount:i.floors.length,zoneCount:i.zones.length,sectionCount:i.sections.length,authoredRelief:y,renderedVerticalSpanM:Math.max(0,i.bounds.box.max[1]-i.bounds.box.min[1]),projectedReliefPx:xe.visible&&Le.visible?Math.abs(xe.y-Le.y):0},labels:be.qualityEvidence(),framing:tt,...jo?{seatView:{fovDeg:X.camera.fov,stop:jo}}:{}}},getQualityReport(){return ea(va.getQualityEvidence())},loseContextForTest(){D.simulateContextLossCycle()},floors(){return i.floors},focusFloor(z){if(z!==null&&!i.floors.some(q=>q.index===z))return!1;let Y=z??-1;if(j(z!==null),Gr(!1),d0(Y),Wo("orbit"),z===null)ie.cancel(),Ze()?X.frame(i.bounds,!1,re,n.portraitOverviewCrop===!0,J):X.frameSoft(i.bounds,re,n.portraitOverviewCrop===!0,J),be.setOverviewDistance(X.targetDistance);else{let q=i.floors[z];if(q.seatCount>0){ie.cancel();let le=q.focalWorld[0]-q.center[0],xe=q.focalWorld[2]-q.center[2],Le=Math.hypot(le,xe)>q.radius*.12?Math.atan2(le,xe):re;X.frame({center:q.center,radius:q.radius,box:q.box},!1,Le,!1,{polarDeg:58,margin:1.12}),be.setOverviewDistance(X.targetDistance)}}return ye.requestRender(),!0},zones(){return i.zones},focusZone(z){let Y=i.zones.find(Le=>Le.id===z);if(!Y||Y.seatCount===0)return!1;j(!1),Gr(!1),ie.cancel(),Wo("orbit"),K(null),n.onSectionFocusChange?.(null);let q=Y.focalWorld[0]-Y.center[0],le=Y.focalWorld[2]-Y.center[2],xe=Math.hypot(q,le)>Y.radius*.12?Math.atan2(q,le):void 0;return X.frame({center:Y.center,radius:Y.radius*1.25},!1,xe),ye.requestRender(),!0},sections(){return i.sections},focusSection(z){return Wc(z)},rows(z){return z?i.rows.filter(Y=>Y.sectionId===z):i.rows},seatsInRow(z){return t.seats.filter(Y=>Y.rowId===z).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(z){let Y=i.rows.find(q=>q.id===z);return!Y||Y.seatCount===0?!1:(j(!0),Gr(!1),ie.cancel(),Wo("pan"),Y.sectionId&&(K(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),X.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),ye.requestRender(),!0)},setReducedMotionForTest(z){_=z},dispose(){S=!0,Ae?.dispose(),ze(!1),Jn(),Ma.remove(),Hr.remove(),zc(),Q?.dispose(),ye.stop(),be.dispose(),Pt?.disconnect(),M&&(M.dispose(),M=null),C(),ge(),D.canvas.removeEventListener("pointerdown",Wt.onDown),D.canvas.removeEventListener("touchend",Wt.onTouchEnd),D.canvas.removeEventListener("pointermove",Wt.onMove),D.canvas.removeEventListener("pointerup",Wt.onUp),D.canvas.removeEventListener("pointercancel",Wt.onUp),D.canvas.removeEventListener("pointermove",Oe),D.canvas.removeEventListener("pointerdown",Oe),D.canvas.removeEventListener("pointerleave",Ue),ee&&cancelAnimationFrame(ee),X.dispose(),P&&P.dispose(),g&&g.dispose(),g=null,v?.dispose(),v=null,P=null,U.dispose(),D.dispose()}};return a.opened(i.seatCount,y,t.prepared?.buildMs??performance.now()-o,t.prepared?.source??"inline"),va}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,autoVenue3d,buildSceneModel,estimateVenue3D,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});