@seatlayer/core 0.109.2 → 0.110.1

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 (166) hide show
  1. package/dist/ar-C5PA2DVE.js +1 -0
  2. package/dist/be-TMKSMYPN.js +1 -0
  3. package/dist/bg-V6HTEDUB.js +1 -0
  4. package/dist/ca-CTZMHWW4.js +1 -0
  5. package/dist/{categoryInventory-WNOXm5Il.d.cts → categoryInventory-BE1AThTx.d.cts} +1 -1
  6. package/dist/{categoryInventory-nNbloQGE.d.ts → categoryInventory-DxciZQK_.d.ts} +1 -1
  7. package/dist/chunk-2VYFNNYC.js +1 -0
  8. package/dist/{chunk-YE4NP3XB.js → chunk-3V32MDJI.js} +1 -1
  9. package/dist/{chunk-GPZFVQXV.js → chunk-4522UUXG.js} +1 -1
  10. package/dist/chunk-4AGC7B64.js +1 -0
  11. package/dist/{chunk-ZYQXT5JP.js → chunk-5IADCFUU.js} +1 -1
  12. package/dist/{chunk-2JFCDE27.js → chunk-6CBJBESS.js} +1 -1
  13. package/dist/{chunk-LFV56MPT.js → chunk-DLHW3UDD.js} +1 -1
  14. package/dist/{chunk-JRZHC75P.js → chunk-EE2CVYFJ.js} +1 -1
  15. package/dist/{chunk-33SRM2CP.js → chunk-GUNNA5LB.js} +1 -1
  16. package/dist/{chunk-UUIZHJYL.js → chunk-GVVZR3YS.js} +1 -1
  17. package/dist/{chunk-MRLWH6RC.js → chunk-GWGWNBGU.js} +1 -1
  18. package/dist/chunk-JQBJZMLG.js +1 -0
  19. package/dist/chunk-NVAF2E7Q.js +1 -0
  20. package/dist/{chunk-WKWXU5QM.js → chunk-PBXGWYB4.js} +1 -1
  21. package/dist/{chunk-UEDS3HJ3.js → chunk-URW7MSCJ.js} +1 -1
  22. package/dist/{chunk-FBXZWNND.js → chunk-YRDOE3N7.js} +1 -1
  23. package/dist/{chunk-UNSAUDO2.js → chunk-ZY6WTPTI.js} +1 -1
  24. package/dist/core/chart-ops/index.cjs +1 -1
  25. package/dist/core/chart-ops/index.d.cts +36 -6
  26. package/dist/core/chart-ops/index.d.ts +36 -6
  27. package/dist/core/chart-ops/index.js +1 -1
  28. package/dist/core/inventory/index.cjs +1 -1
  29. package/dist/core/inventory/index.d.cts +4 -4
  30. package/dist/core/inventory/index.d.ts +4 -4
  31. package/dist/core/inventory/index.js +1 -1
  32. package/dist/core/layout/index.d.cts +5 -5
  33. package/dist/core/layout/index.d.ts +5 -5
  34. package/dist/core/layout/index.js +1 -1
  35. package/dist/core/quality/index.cjs +1 -1
  36. package/dist/core/quality/index.d.cts +3 -3
  37. package/dist/core/quality/index.d.ts +3 -3
  38. package/dist/core/quality/index.js +1 -1
  39. package/dist/core/render-assets/index.cjs +1 -1
  40. package/dist/core/render-assets/index.d.cts +2 -2
  41. package/dist/core/render-assets/index.d.ts +2 -2
  42. package/dist/core/render-assets/index.js +1 -1
  43. package/dist/core/seatConfidence.d.cts +1 -1
  44. package/dist/core/seatConfidence.d.ts +1 -1
  45. package/dist/core/sections/index.d.cts +5 -5
  46. package/dist/core/sections/index.d.ts +5 -5
  47. package/dist/core/sections/index.js +1 -1
  48. package/dist/cs-FUDGOUFL.js +1 -0
  49. package/dist/cy-5RRARIAP.js +1 -0
  50. package/dist/da-PONPPWKY.js +1 -0
  51. package/dist/de-PKG7AAB5.js +1 -0
  52. package/dist/el-H7OFU4QQ.js +1 -0
  53. package/dist/es-QSW5IZ6U.js +1 -0
  54. package/dist/et-GTMPSS72.js +1 -0
  55. package/dist/{eventConfigurations-QwuBqi8E.d.ts → eventConfigurations-Cdt-e0uD.d.ts} +1 -1
  56. package/dist/{eventConfigurations-Dp0gQBxf.d.cts → eventConfigurations-D0us5j0K.d.cts} +1 -1
  57. package/dist/fa-SGLTFGJF.js +1 -0
  58. package/dist/fi-7YTEAVDM.js +1 -0
  59. package/dist/fr-ECCQ24MZ.js +1 -0
  60. package/dist/he-YHMMDOX7.js +1 -0
  61. package/dist/hi-GRAQX2E6.js +1 -0
  62. package/dist/hr-MN33LRIJ.js +1 -0
  63. package/dist/hu-NW3SMQVM.js +1 -0
  64. package/dist/id-3OPRAUF7.js +1 -0
  65. package/dist/index.cjs +1 -1
  66. package/dist/index.d.cts +31 -13
  67. package/dist/index.d.ts +31 -13
  68. package/dist/index.js +1 -1
  69. package/dist/it-RYM74YWO.js +1 -0
  70. package/dist/ja-4NI6DG5D.js +1 -0
  71. package/dist/ko-C4F6UEMK.js +1 -0
  72. package/dist/ku-DMSBMWTC.js +1 -0
  73. package/dist/{labeling-CLrYgex2.d.ts → labeling-DXgkxMoi.d.ts} +1 -1
  74. package/dist/{labeling-Bzfv743A.d.cts → labeling-eYKVPLMb.d.cts} +1 -1
  75. package/dist/localeLoaders-G3GCGLPW.js +1 -0
  76. package/dist/lt-3EXKKZFG.js +1 -0
  77. package/dist/lv-4EWNRDCG.js +1 -0
  78. package/dist/ms-7LJBSAEJ.js +1 -0
  79. package/dist/nl-GWTIWXRW.js +1 -0
  80. package/dist/no-T3FW2WLX.js +1 -0
  81. package/dist/pl-OG5OBRHR.js +1 -0
  82. package/dist/pt-YQ6VES5R.js +1 -0
  83. package/dist/{renderedQuality-DL_Bwohi.d.ts → renderedQuality-Dzo2_8f4.d.ts} +1 -1
  84. package/dist/{renderedQuality-D7adZpeD.d.cts → renderedQuality-Frgw6jdx.d.cts} +1 -1
  85. package/dist/{renderer-BaX5XS07.d.cts → renderer-DM2sv1un.d.cts} +19 -2
  86. package/dist/{renderer-GIwwPupP.d.ts → renderer-DuieD7jP.d.ts} +19 -2
  87. package/dist/ro-VK5MASYF.js +1 -0
  88. package/dist/ru-YU5CYR6T.js +1 -0
  89. package/dist/{seatTypeIcons-BbHRuAXE.d.ts → seatTypeIcons-Bz0OJtEi.d.ts} +1 -1
  90. package/dist/{seatTypeIcons-CnIsRKIM.d.cts → seatTypeIcons-Cm8tjLYl.d.cts} +1 -1
  91. package/dist/{sections-BOaTNaYG.d.ts → sections-Bf_DV0oG.d.ts} +1 -1
  92. package/dist/{sections-DRiD7LLT.d.cts → sections-PbQiqN0i.d.cts} +1 -1
  93. package/dist/{segmentedRowModel-CDm8wEMA.d.ts → segmentedRowModel-CO7DD803.d.ts} +1 -1
  94. package/dist/{segmentedRowModel-C0MT2W3h.d.cts → segmentedRowModel-Co9LqS4i.d.cts} +1 -1
  95. package/dist/sk-CE7PXAYL.js +1 -0
  96. package/dist/sl-EYUPV4BG.js +1 -0
  97. package/dist/sr-PPXCN4IK.js +1 -0
  98. package/dist/sv-WR2BJBCJ.js +1 -0
  99. package/dist/{tableSizing-CjeVoew4.d.ts → tableSizing-BDePQyPD.d.ts} +3 -3
  100. package/dist/{tableSizing-BvWmV_II.d.cts → tableSizing-C6EjKNnk.d.cts} +3 -3
  101. package/dist/th-JUB2DODR.js +1 -0
  102. package/dist/{ticketRestrictions-Cp_Wkjy9.d.cts → ticketRestrictions-CgYwHQOf.d.cts} +2 -2
  103. package/dist/{ticketRestrictions-P3RuwcmT.d.ts → ticketRestrictions-D5wgOq4P.d.ts} +2 -2
  104. package/dist/tr-GFHA7FT6.js +1 -0
  105. package/dist/{types-fSWyPu3f.d.ts → types-CGOr0BpE.d.cts} +41 -16
  106. package/dist/{types-fSWyPu3f.d.cts → types-CGOr0BpE.d.ts} +41 -16
  107. package/dist/uk-3FTS2SRK.js +1 -0
  108. package/dist/vi-7OTXPOQV.js +1 -0
  109. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  110. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  111. package/dist/view3d/index.cjs +410 -169
  112. package/dist/view3d/index.d.cts +100 -4
  113. package/dist/view3d/index.d.ts +100 -4
  114. package/dist/view3d/index.js +408 -167
  115. package/dist/view3d/scene/scene.worker.cjs +1 -1
  116. package/dist/view3d/scene/scene.worker.js +1 -1
  117. package/dist/zh-Hans-FD4XNYUA.js +1 -0
  118. package/dist/zh-Hant-7TXVJKJQ.js +1 -0
  119. package/package.json +1 -1
  120. package/dist/ar-TPTLODBK.js +0 -1
  121. package/dist/be-SX5AJ2EF.js +0 -1
  122. package/dist/bg-T7FBXPVU.js +0 -1
  123. package/dist/ca-TTI23CKH.js +0 -1
  124. package/dist/chunk-4N5CHKHD.js +0 -1
  125. package/dist/chunk-GUXENCHS.js +0 -1
  126. package/dist/chunk-HSEX7LUB.js +0 -1
  127. package/dist/chunk-T2QG47QQ.js +0 -1
  128. package/dist/cs-KEMKTFP3.js +0 -1
  129. package/dist/cy-EGUWNAAE.js +0 -1
  130. package/dist/da-AHX4SSIT.js +0 -1
  131. package/dist/de-U3ISXVMR.js +0 -1
  132. package/dist/el-NBMJFLGN.js +0 -1
  133. package/dist/es-IYOV3DZF.js +0 -1
  134. package/dist/et-QHFQ3BIM.js +0 -1
  135. package/dist/fa-FEFRLXP7.js +0 -1
  136. package/dist/fi-HB6NGCIV.js +0 -1
  137. package/dist/fr-5EX7Z5Z5.js +0 -1
  138. package/dist/he-MEW7GMCW.js +0 -1
  139. package/dist/hi-V2CICZDC.js +0 -1
  140. package/dist/hr-SUZYZ3DL.js +0 -1
  141. package/dist/hu-RJFHJPXB.js +0 -1
  142. package/dist/id-LEP73A6A.js +0 -1
  143. package/dist/it-V65UNUVY.js +0 -1
  144. package/dist/ja-3HISSPHC.js +0 -1
  145. package/dist/ko-5DFMEYUO.js +0 -1
  146. package/dist/ku-H3EOMAJX.js +0 -1
  147. package/dist/localeLoaders-M2TUVL75.js +0 -1
  148. package/dist/lt-XHIM3BWS.js +0 -1
  149. package/dist/lv-P5EQD4YY.js +0 -1
  150. package/dist/ms-XC3SU4I2.js +0 -1
  151. package/dist/nl-K2N44NUV.js +0 -1
  152. package/dist/no-C4MFGLSN.js +0 -1
  153. package/dist/pl-ADABFEA3.js +0 -1
  154. package/dist/pt-4AQPHHDG.js +0 -1
  155. package/dist/ro-PZLP7BEU.js +0 -1
  156. package/dist/ru-33R4HJF2.js +0 -1
  157. package/dist/sk-XCXFOU73.js +0 -1
  158. package/dist/sl-23PMG7BB.js +0 -1
  159. package/dist/sr-SOPFKPZ5.js +0 -1
  160. package/dist/sv-PKDMDUS5.js +0 -1
  161. package/dist/th-NU4K5DFF.js +0 -1
  162. package/dist/tr-HEDRXONB.js +0 -1
  163. package/dist/uk-T7JNLCSZ.js +0 -1
  164. package/dist/vi-EWDKGL2Y.js +0 -1
  165. package/dist/zh-Hans-ED7CX2SQ.js +0 -1
  166. package/dist/zh-Hant-UKJQ2KBS.js +0 -1
@@ -1 +1 @@
1
- "use strict";var va=Object.create;var qo=Object.defineProperty;var Ca=Object.getOwnPropertyDescriptor;var ka=Object.getOwnPropertyNames;var Oa=Object.getPrototypeOf,Ta=Object.prototype.hasOwnProperty;var La=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ka(t))!Ta.call(e,r)&&r!==n&&qo(e,r,{get:()=>t[r],enumerable:!(o=Ca(t,r))||o.enumerable});return e};var Ge=(e,t,n)=>(n=e!=null?va(Oa(e)):{},La(t||!e||!e.__esModule?qo(n,"default",{value:e,enumerable:!0}):n,e));var od=Math.PI/180;function Se(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Vn(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Un(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 ht(e){return e.length?Un(e):null}function Jo(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,s=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+s*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+s*e.end.y}}function er(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[Jo(e,.5)];let o=Array.from({length:n+1},(c,u)=>Jo(e,u/n)),r=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let u=o[c].x-o[c-1].x,l=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(u,l)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],a=1;for(let c=0;c<t;c+=1){let u=i*c/(t-1);for(;a<r.length-1&&r[a]<u;)a+=1;let l=r[a-1],f=r[a],m=f===l?0:(u-l)/(f-l);s.push({x:o[a-1].x+(o[a].x-o[a-1].x)*m,y:o[a-1].y+(o[a].y-o[a-1].y)*m})}return s}function Xn(e,t,n){return Math.max(t,Math.min(n,e))}function Ba(e){return Xn(e,0,1)}function tr(e){let t=Ba(e);return t*t*(3-2*t)}var dt=Math.PI*2;function pt(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Fa(e,t,n){let o=t-e;if(n){for(;o<0;)o+=dt;for(;o>=dt;)o-=dt}else{for(;o>0;)o-=dt;for(;o<=-dt;)o+=dt}return o}function rr(e){if(e.version!==1||e.closed!==!0||!pt(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||!pt(n.end))return!1;if(n.kind==="line"){if(Se(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!pt(n.control1)||!pt(n.control2)||Se(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!pt(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(Se(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(Se(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Se(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return Se(t,e.start)<=1e-4}function Na(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 ir(e,t=2){if(!rr(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 s=Math.atan2(r.y-i.center.y,r.x-i.center.x),a=Math.atan2(i.end.y-i.center.y,i.end.x-i.center.x),c=Fa(s,a,i.clockwise),u=Math.max(2,Math.ceil(Math.abs(c)*i.radius/n));for(let l=1;l<=u;l+=1){let f=s+c*l/u;o.push({x:i.center.x+Math.cos(f)*i.radius,y:i.center.y+Math.sin(f)*i.radius})}}else{let s=Se(r,i.control1)+Se(i.control1,i.control2)+Se(i.control2,i.end),a=Math.max(2,Math.ceil(s/n));for(let c=1;c<=a;c+=1)o.push(Na(r,i,c/a))}r=i.end}return Se(o[o.length-1],o[0])<=1e-4&&o.pop(),o}var Da=45,Kn=150,Ga=60;function ja(e){let t=Da/100;if(e<=t)return Kn;let n=Math.min(1,(e-t)/(1-t));return Kn-n*(Kn-Ga)}var nr=.5523;function or(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function Ha(e){let t=[],n=[];for(e.forEach((o,r)=>{pt(o)&&(t.length&&or(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&or(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}var Va=.5,Ua=4/3;function Xa(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 s=-r/i,a=o/i,c=n*Ua;return{kind:"bezier",control1:{x:e.x+o/3+s*c,y:e.y+r/3+a*c},control2:{x:e.x+o*2/3+s*c,y:e.y+r*2/3+a*c},end:{...t}}}function sr(e,t){let{points:n,sourceIndex:o}=Ha(e),r=n.length;if(r<3)return null;let i=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,a=new Array(r).fill(0);if(s?.length)for(let w=0;w<r;w+=1){let x=s[o[w]];a[w]=Number.isFinite(x)?Math.min(100,Math.max(-100,x))/100:0}let c=a.some(w=>Math.abs(w)>1e-6);if(i<=0&&!c)return null;let u=t.wideAngleThresholdDeg??ja(i),l=[];for(let w=0;w<r;w+=1)l[w]=Se(n[w],n[(w+1)%r]);let f=new Array(r).fill(0);for(let w=0;w<r;w+=1){let x=n[(w-1+r)%r],b=n[w],S=n[(w+1)%r],I={x:x.x-b.x,y:x.y-b.y},R={x:S.x-b.x,y:S.y-b.y},k=Math.hypot(I.x,I.y),L=Math.hypot(R.x,R.y);if(k<=1e-9||L<=1e-9)continue;let T=Math.min(1,Math.max(-1,(I.x*R.x+I.y*R.y)/(k*L))),v=Math.acos(T)*180/Math.PI;if(v<u)continue;let A=tr((v-u)/(180-u));f[w]=i*A*.5*Math.min(k,L)}for(let w=0;w<r;w+=1){let x=(w+1)%r,b=f[w]+f[x];if(b>l[w]&&b>1e-9){let S=l[w]/b;f[w]*=S,f[x]*=S}}let m=new Array(r),h=new Array(r);for(let w=0;w<r;w+=1){let x=n[(w-1+r)%r],b=n[w],S=n[(w+1)%r];if(f[w]<=1e-6){m[w]={...b},h[w]={...b};continue}let I=Se(b,x)||1,R=Se(b,S)||1;m[w]={x:b.x+(x.x-b.x)/I*f[w],y:b.y+(x.y-b.y)/I*f[w]},h[w]={x:b.x+(S.x-b.x)/R*f[w],y:b.y+(S.y-b.y)/R*f[w]}}if(f.every(w=>w<=1e-6)&&!c)return null;let d=[],p={...h[0]},y=p,g=(w,x)=>{if(Se(y,w)<=1e-9)return;let b=a[x];Math.abs(b)>1e-6?d.push(Xa(y,w,b*Va*l[x])):d.push({kind:"line",end:{...w}}),y=w};for(let w=1;w<=r;w+=1){let x=w%r,b=n[x];g(m[x],(w-1)%r),f[x]>1e-6&&Se(m[x],h[x])>1e-9&&(d.push({kind:"bezier",control1:Vn(m[x],b,nr),control2:Vn(h[x],b,nr),end:{...h[x]}}),y=h[x])}if(!d.length)return null;let M=d[d.length-1];Se(M.end,p)>1e-9&&(M.kind==="line"?M.end={...p}:d.push({kind:"line",end:{...p}}));let P={version:1,closed:!0,start:p,segments:d};return rr(P)?P:null}function Ka(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 Ya(e){let t=Ka(e);return t.length?sr(e.points,{edgeCurvature:t}):null}function en(e,t=2){let n=Ya(e);return n?ir(n,t):e.points??[]}function ar(e){return e.kind==="polygon"?Lt(e.holes):[]}function lr(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((m,h)=>m.segmentedRow.componentIndex-h.segmentedRow.componentIndex),s=i[0]?.segmentedRow?.componentCount??0,a=i[0]?.segmentedRow;if(!a||!(s>=2&&i.length===s&&a?.boundaryBefore==="start"&&i.every((m,h)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===o&&m.segmentedRow.componentCount===s&&m.segmentedRow.componentIndex===h&&m.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(h===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===a.displayLabel)))continue;let u=i.reduce((m,h)=>m+h.seatCount,0),l=0,f=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(m.id,{groupId:o,adjacencyOffset:l,displayOffset:f,displayLabel:a.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),l+=m.seatCount,f+=m.seatCount}return t}var Wa="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var za="abcdefghijklmnopqrstuvwxyz";function Za(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 Bt(e,t=!1){let n=t?za:Wa;return Za(Math.max(0,Math.floor(e)-1),n)}var $a=[[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 ur(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of $a)for(;t>=o;)n+=r,t-=o;return n}function Qa(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 Wn(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",s=e.seatNumbering?.prefix??"",a=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`${s}${d}`}let u=i==="odd"||i==="even"?2:r,l=a!=null&&Number.isFinite(a)?a-(c-1)*u:n,f=o==="center"?Qa(c)[t]:o==="rtl"?c-1-t:t,m;switch(i){case"odd":{let h=l%2===1?l:l+1;m=String(h+f*2);break}case"even":{let h=l%2===0?l:l+1;m=String(h+f*2);break}case"roman":m=ur(l+f*r);break;case"letters-upper":m=Bt(l+f*r,!1);break;case"letters-lower":m=Bt(l+f*r,!0);break;default:m=String(l+f*r);break}return`${s}${m}`}function qa(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function fr(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${Wn(e,t)}`}function Ja(e,t,n,o){if(o?.displayLabel)return null;if(e.seatDisplayLabelMode==="number"||!n)return{row:e.displayLabel||e.label,seat:Wn(e,t)};let r=qa(n);return{row:n.displayLabel,seat:Wn(r,n.displayOffset+t)}}function zn(e,t,n,o){let r=Ja(e,t,n,o);return r?e.seatDisplayLabelMode==="number"?r.seat:`${r.row}-${r.seat}`:o.displayLabel}function mr(e,t){return`${e.label}-${t+1}`}function ec(e,t,n){return e?.direction==="anticlockwise"?Math.max(0,t-1-n):n}function tc(e,t){let n=e.chairNumbering,o=n?.start??1,r=ec(n,Math.max(0,Math.round(e.seatCount)),t);return n?.format==="letter"?Bt(Math.max(1,o)+r):String(o+r)}function hr(e,t){let n=tc(e,t);return(e.chairNumbering?.format??"table-number")==="table-number"?`${e.displayLabel??e.label}-${n}`:n}var $=.02291666666666667,Oe=1/$,nc=58,oc=nc*$;var rc=3,dr=0,Zn=120,ic=0,sc=45,ac=7,je=1.2;function $n(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function cc(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=ac?e:rc}function Qe(e,t={}){let n=$n(t.floorBaseHeightM,dr,Zn,0),o=Math.min(Zn,n+cc(e.elevation)*oc),r=e.height===void 0?o:$n(e.height,dr,Zn,o),i=$n(e.rake,ic,sc,0);return{height:r,rake:i}}function pr(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 bt(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],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let f=t-(i.x+l*a),m=n-(i.y+l*c);if(Math.abs(f)>=o||Math.abs(m)>=o)continue;let h=Math.hypot(f,m);h<o&&(o=h)}return o}function lc(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 s=Math.hypot(i.x-t,i.y-n);s>r&&(r=s)}return{cx:t,cy:n,r}}function br(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Qn(e,t){let n=1/0;for(let o of pr(e)){let r=bt(t,o.x,o.y);r<n&&(n=r)}for(let o of pr(t)){let r=bt(e,o.x,o.y);r<n&&(n=r)}return n}function uc(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let l of e)n+=l.x,o+=l.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let l of e){let f=Math.hypot(l.x-n,l.y-o);f>r&&(r=f,i=l)}let s=i.x-n,a=i.y-o,c=Math.hypot(s,a);c>1e-9?(s/=c,a/=c):(s=1,a=0);let u=e.map((l,f)=>({p:l,i:f,t:(l.x-n)*s+(l.y-o)*a})).sort((l,f)=>l.t-f.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function qn(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let M of e)n+=M.x,o+=M.y;n/=t,o/=t;let r=0,i=0,s=0,a=0,c=0,u=0,l=0;for(let M of e){let P=M.x-n,w=M.y-o;r+=P*P,s+=w*w,i+=P*w,a+=P*P*P,c+=w*w*w,u+=P*w*w,l+=w*P*P}let f=r*s-i*i;if(Math.abs(f)<1e-9)return null;let m=(a+u)/2,h=(c+l)/2,d=(m*s-h*i)/f,p=(h*r-m*i)/f,y=d+n,g=p+o;return!Number.isFinite(y)||!Number.isFinite(g)?null:{cx:y,cy:g}}var fc=.15,mc=.001;function hc(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 s=0;for(let a of e){let c=Math.abs((a.x-t.x)*r-(a.y-t.y)*o)/i;c>s&&(s=c)}return s/i}function dc(e){if(e.length<2)return null;let t=e.map(x=>{let b=0,S=0;for(let I of x.pts)b+=I.x,S+=I.y;return{x:b/x.pts.length,y:S/x.pts.length}}),n=0,o=0;for(let x of t)n+=x.x,o+=x.y;n/=t.length,o/=t.length;let r=0,i=0,s=0;for(let x of t){let b=x.x-n,S=x.y-o;r+=b*b,i+=b*S,s+=S*S}let a=r+s,c=r*s-i*i,u=a/2+Math.sqrt(Math.max(0,a*a/4-c)),l,f;Math.abs(i)>1e-12?(l=u-s,f=i):r>=s?(l=1,f=0):(l=0,f=1);let m=Math.hypot(l,f);if(!(m>1e-12))return null;l/=m,f/=m;let h=0,d=0,p=0;for(let x of e){if(x.pts.length<2)continue;let b=x.pts[0],S=x.pts[x.pts.length-1],I=S.x-b.x,R=S.y-b.y,k=Math.hypot(I,R);if(!(k>1e-9))continue;let L=I/k,T=R/k;h+=(L*L-T*T)*k,d+=2*L*T*k,p+=k}if(p>0&&Math.hypot(h,d)>=bc*p){let x=Math.atan2(d,h)/2;l=-Math.sin(x),f=Math.cos(x)}let y=1/0,g=-1/0,M=[];for(let x of e){let b=1/0,S=-1/0;for(let I of x.pts){let R=I.x*l+I.y*f;R<b&&(b=R),R>S&&(S=R),R<y&&(y=R),R>g&&(g=R)}M.push(S-b)}let P=g-y;return P>1e-9?(M.sort((x,b)=>x-b),M[Math.min(M.length-1,Math.floor(M.length*.9))]/P<=pc?{x:l,y:f}:null):null}var pc=.35,bc=.8;function tn(e,t,n,o){let r=new Map;for(let b of n){let S=t[b],I=S.rowId||`__seat-${b}`,R=r.get(I);R||(R={pts:[],idx:[]},r.set(I,R)),R.pts.push({x:S.x,y:S.y}),R.idx.push(b)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,S]of r){let I=uc(S.pts,S.idx),R=0;for(let k of I.pts)R+=Math.hypot(k.x-o.x,k.y-o.y);i.push({id:b,pts:I.pts,seatIndices:I.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:R/I.pts.length})}let s=i.map(b=>lc(b.pts)),a=i.length<=256?i.length*(i.length-1)/2:0,c=a?new Float64Array(a):null;c?.fill(Number.NaN);let u=c?new Map(i.map((b,S)=>[b,S])):null,l=(b,S)=>(b>S&&([b,S]=[S,b]),b*(2*i.length-b-1)/2+(S-b-1)),f=(b,S)=>{if(!c)return Qn(i[b].pts,i[S].pts);let I=l(b,S),R=c[I];if(!Number.isNaN(R))return R;let k=Qn(i[b].pts,i[S].pts);return c[I]=k,k},m=(b,S)=>u?f(u.get(b),u.get(S)):Qn(b.pts,S.pts),h=[];for(let b=0;b<i.length;b++){let S=1/0;for(let I=0;I<i.length;I++){if(b===I||br(s[b],s[I])>=S)continue;let R=f(b,I);R<S&&(S=R)}Number.isFinite(S)&&h.push(S)}h.sort((b,S)=>b-S);let d=h.length?h[Math.floor(h.length/2)]:1,p=Math.max(d*1.8,1e-6),y=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let S=b+1;S<i.length;S++)br(s[b],s[S])>p||f(b,S)<=p&&(y[b].push(S),y[S].push(b));let g=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let S=g++,I=[b];for(i[b].blockId=S;I.length;){let R=I.pop();for(let k of y[R])i[k].blockId===-1&&(i[k].blockId=S,I.push(k))}}let M=new Map;for(let b of i){let S=M.get(b.blockId)??[];S.push(b),M.set(b.blockId,S)}let P=[];for(let b of i){if(b.pts.length<4||hc(b.pts)<mc)continue;let S=qn(b.pts);S&&(!Number.isFinite(S.cx)||!Number.isFinite(S.cy)||P.push({x:S.cx,y:S.cy}))}let w=P.length>=2?(()=>{let b=P.map(R=>R.x).sort((R,k)=>R-k),S=P.map(R=>R.y).sort((R,k)=>R-k),I=Math.floor(P.length/2);return{cx:b[I],cy:S[I]}})():null;if(w){let b=T=>Math.hypot(T.x-w.cx,T.y-w.cy),S=1/0,I=-1/0,R=[];for(let T of i){let v=1/0,A=-1/0;for(let _ of T.pts){let C=b(_);C<v&&(v=C),C>A&&(A=C)}R.push(A-v),v<S&&(S=v),A>I&&(I=A)}let k=I-S;R.sort((T,v)=>T-v);let L=R[Math.min(R.length-1,Math.floor(R.length*.9))];if(k>1e-9&&L/k<=fc){let T=i.map(N=>{let X=0;for(let V of N.pts)X+=b(V);return{row:N,radius:X/N.pts.length}}),v=0,A=0;for(let N of T)v+=N.radius,A+=N.row.focalDistance;v/=T.length,A/=T.length;let _=0;for(let N of T)_+=(N.radius-v)*(N.row.focalDistance-A);if(_<0)for(let N of T)N.radius=-N.radius;let B=1/0;for(let N of T)N.radius<B&&(B=N.radius);T.sort((N,X)=>N.radius-X.radius);let O=-1,F=-1/0,D=k/Math.max(1,T.length)*.5,j=[];for(let N of T)N.radius-F>D&&(O++,F=N.radius),N.row.ordinal=O,N.row.blockDepth=N.radius-B,j.push(N.row);return{sectionId:e,rows:j,blockCount:g}}}let x=[];for(let[,b]of M){let S=dc(b);if(S){let I=T=>{let v=0;for(let A of T.pts)v+=A.x*S.x+A.y*S.y;return v/T.pts.length};b.sort((T,v)=>I(T)-I(v)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let R=[],k=d*.5;for(let T of b){let v=R[R.length-1];v&&Math.abs(I(T)-I(v[0]))<k?v.push(T):R.push([T])}let L=0;for(let T=0;T<R.length;T++){if(T>0){let v=1/0;for(let A of R[T-1])for(let _ of R[T])v=Math.min(v,m(A,_));v=Math.min(v,Math.abs(I(R[T][0])-I(R[T-1][0]))),L+=v}for(let v of R[T])v.ordinal=T,v.blockDepth=L,x.push(v)}}else{let I=1/0;for(let R of b)R.focalDistance<I&&(I=R.focalDistance);b.sort((R,k)=>R.focalDistance-k.focalDistance);for(let R=0;R<b.length;R++)b[R].ordinal=R,b[R].blockDepth=Math.max(0,b[R].focalDistance-I),x.push(b[R])}}return{sectionId:e,rows:x,blockCount:g}}var yc=/^\d{4}-\d{2}-\d{2}$/;function gc(e){let t=Date.parse(e);return Number.isFinite(t)?yc.test(e)?t+864e5:t:null}function xc(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=gc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Mc(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Sc(e){return e.status!=="draft"&&e.status!=="retracted"}function Pc(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 yr(e,t={}){return!!e&&Sc(e)&&Mc(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Pc(e,t.activeBasisSha256)&&xc(e,t.now)}var Ic=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Rc=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function st(e){return!!e&&Ic.has(e)}function nn(e){return!!e&&Rc.has(e)}var Jn=1.1;function Mr(e){return rn(e)?e==="ring-boxing"?Jn:.06:1}var wc={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}},Ec={"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 Ac=Math.PI*2;function _c(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function gr(e,t){let n=Math.max(0,e-t),o=[],r=20;for(let i=0;i<=r;i++){let s=-Math.PI/2+i/r*Math.PI;o.push({x:n+t*Math.cos(s),y:t*Math.sin(s)})}for(let i=0;i<=r;i++){let s=Math.PI/2+i/r*Math.PI;o.push({x:-n+t*Math.cos(s),y:t*Math.sin(s)})}return o}var xr=(()=>{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,s=[],a=Math.atan2(o.y-r,o.x),c=Math.atan2(o.y-r,-o.x);for(let u=0;u<=24;u++){let l=a+(c-a)*u/24;s.push({x:i*Math.cos(l),y:r+i*Math.sin(l)})}return{half:70,home:t,backstop:n,fence:s}})();var on="#f1f5f9";function rn(e){return st(e)}function qe(e,t,n,o,r=32){let i=[];for(let s=0;s<r;s++){let a=s/r*Ac;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function Ke(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 vc(e){let{kind:t,cx:n,cy:o,width:r,height:i}=e,s=(e.rotation??0)*Math.PI/180,a=Math.cos(s),c=Math.sin(s),u=r/2,l=i/2,f=[],m=wc[t],h=p=>m?p/m.width*r:0,d=p=>m?p/m.height*i:0;switch(t){case"pitch-football":{f.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1}),f.push({points:qe(0,0,h(9.15),d(9.15)),closed:!0});for(let p of[-1,1])f.push({points:Ke(p*(u-h(16.5)/2),0,h(16.5)/2,d(40.32)/2),closed:!0}),f.push({points:Ke(p*(u-h(5.5)/2),0,h(5.5)/2,d(18.32)/2),closed:!0});break}case"rink-hockey":{f.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){f.push({points:[{x:p*h(7.5),y:-l},{x:p*h(7.5),y:l}],closed:!1,ink:"#2f6ecb"}),f.push({points:[{x:p*(u-h(4)),y:-d(11)},{x:p*(u-h(4)),y:d(11)}],closed:!1,ink:"#d63b3b"});for(let y of[-1,1])f.push({points:qe(p*h(20.5),y*d(7),h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"})}f.push({points:qe(0,0,h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let y=l-d(1.22)*8;y>0&&f.push({points:gr(u-h(1.22)*8,y),closed:!0,fill:"#2f7d4f"});for(let g=1;g<8;g++){let M=d(1.22)*g,P=l-M;if(P<=0)break;f.push({points:gr(u-h(1.22)*g,P),closed:!0})}break}case"oval-cricket":{f.push({points:qe(0,0,h(27.4),d(27.4+20.12/2),40),closed:!0}),f.push({points:Ke(0,0,h(3.05)/2,d(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=y=>({points:[{x:h(y),y:-l},{x:h(y),y:l}],closed:!1});f.push(p(0));for(let y of[-1,1]){f.push(p(y*50),p(y*28));for(let g=-35;g<35;g+=4)f.push({points:[{x:h(y*10),y:d(g)},{x:h(y*10),y:d(Math.min(35,g+2))}],closed:!1})}break}case"diamond-baseball":{let p=(C,B)=>({x:h(C),y:d(B)}),{home:y}=xr,g=27.43,M=g/Math.SQRT2,P={x:y.x+M,y:y.y-M},w={x:y.x,y:y.y-2*M},x={x:y.x-M,y:y.y-M},b={x:y.x,y:y.y-18.44},S="#b98a59",I=Ec["diamond-baseball"],R=38.94,k=[p(y.x,y.y)],L=Math.atan2(y.y-R/Math.SQRT2-b.y,R/Math.SQRT2),T=Math.PI-L;for(let C=0;C<=16;C++){let B=L-(L+Math.PI*2-T)%(Math.PI*2)*(C/16);k.push(p(b.x+29*Math.cos(B),b.y+29*Math.sin(B)))}f.push({points:k,closed:!0,fill:S,ink:S});let v={x:y.x,y:y.y-M},A=[{x:y.x,y:y.y},P,w,x].map(C=>p(v.x+(C.x-v.x)*.84,v.y+(C.y-v.y)*.84));f.push({points:A,closed:!0,fill:I,ink:I}),f.push({points:qe(h(b.x),d(b.y),h(2.74),d(2.74),20),closed:!0,fill:S,ink:S}),f.push({points:qe(h(y.x),d(y.y),h(3.96),d(3.96),20),closed:!0,fill:S,ink:S});let _=xr.fence;f.push({points:[p(y.x,y.y),p(_[0].x,_[0].y)],closed:!1}),f.push({points:[p(y.x,y.y),p(_[_.length-1].x,_[_.length-1].y)],closed:!1});for(let C of[P,w,x])f.push({points:Ke(h(C.x),d(C.y),h(.3),d(.3)),closed:!0,fill:on});break}case"court-basketball":{f.push({points:Ke(0,0,h(14),d(7.5)),closed:!0}),f.push({points:[{x:0,y:-d(7.5)},{x:0,y:d(7.5)}],closed:!1}),f.push({points:qe(0,0,h(1.8),d(1.8),24),closed:!0});for(let p of[-1,1]){let y=p*14,g=p*(14-5.8),M=p*(14-1.575);f.push({points:Ke(h((y+g)/2),0,h(2.9),d(2.45)),closed:!0,fill:"#2f5d8a"}),f.push({points:qe(h(g),0,h(1.8),d(1.8),24),closed:!0});let P=Math.sqrt(6.75*6.75-6.6*6.6),w=[{x:h(y),y:-d(6.6)}],x=Math.atan2(-6.6,-p*P),b=2*Math.atan2(6.6,P);for(let S=0;S<=16;S++){let I=x-p*b*(S/16);w.push({x:h(M+6.75*Math.cos(I)),y:d(6.75*Math.sin(I))})}w.push({x:h(y),y:d(6.6)}),f.push({points:w,closed:!1})}break}case"court-tennis":{f.push({points:Ke(0,0,h(11.885),d(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])f.push({points:[{x:-h(11.885),y:p*d(4.115)},{x:h(11.885),y:p*d(4.115)}],closed:!1}),f.push({points:[{x:p*h(6.4),y:-d(4.115)},{x:p*h(6.4),y:d(4.115)}],closed:!1});f.push({points:[{x:-h(6.4),y:0},{x:h(6.4),y:0}],closed:!1}),f.push({points:[{x:0,y:-d(6.4)},{x:0,y:d(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{f.push({points:Ke(0,0,h(3.05),d(3.05)),closed:!0});let g=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[M,P,w]of g)f.push({points:Ke(M*h(3.05),P*d(3.05),h(.3),d(.3)),closed:!0,fill:w,ink:w});break}default:return[]}return f.map(p=>({...p,points:p.points.map(y=>_c(y.x,y.y,a,c,n,o))}))}function Sr(e){if(e.role!=="stage"||!rn(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(l=>l.x),o=e.points.map(l=>l.y),r=Math.min(...n),i=Math.max(...n),s=Math.min(...o),a=Math.max(...o),c=Math.max(1,i-r),u=Math.max(1,a-s);t={cx:r+c/2,cy:s+u/2,width:c,height:u}}return t?vc({kind:e.stageKind,...t}):[]}var Cc=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,kc=/[\s"'<>`\\]/;function Oc(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Cc.test(e);if(kc.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Pr(e){let t=e.trim();return Oc(t)?t:null}var eo="seatlayer.event-configuration/1";var yt=100,Tc=120,Lc=2e5,Bc=1e4,Fc=/^[a-f0-9]{64}$/,Nc=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Ft(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function at(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Dc(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Ir(e){return!Array.isArray(e)||e.length>Lc||!e.every(t=>at(t,yt))?null:[...new Set(e)].sort()}function Gc(e){return!Ft(e)||!at(e.chartId,yt)||!at(e.version,yt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Fc.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function to(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function jc(e){return Ft(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&to(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Hc(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Bc)return null;let n=new Set(t),o=new Set,r=new Set,i=0,s=[];for(let a of e){if(!Ft(a)||!at(a.id,yt)||!at(a.objectId,yt)||!n.has(a.objectId)||!Nc.has(String(a.kind))||!to(a.heightM,.05,50)||a.baseElevationM!==void 0&&!to(a.baseElevationM,-10,100))return null;let c=jc(a.occlusion);if(!c||o.has(a.id)||r.has(a.objectId))return null;let u=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?Pr(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!u||a.kind!=="screen"||++i>1))return null;o.add(a.id),r.add(a.objectId),s.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:c,...u?{contentImageUrl:u}:{}})}return s.sort((a,c)=>a.id.localeCompare(c.id))}function Vc(e){let t=[];if(!Ft(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==eo&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${eo}`}),at(e.id,yt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),at(e.label,Tc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Dc(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Gc(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=Ft(e.overlay)?e.overlay:null,r=Ir(o?.objectIds),i=Ir(o?.productionKillSeatIds),s=r?Hc(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"}),s===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||s===null?{issues:t}:{issues:t,value:{schema:eo,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function Rr(e){let t=Vc(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Uc(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?en(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 Xc(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),i=Math.sin(o),s=e.x-t.x,a=e.y-t.y;return{x:t.x+s*r-a*i,y:t.y+s*i+a*r}}function wr(e){let t=Uc(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>Xc(c,{x:t.reduce((u,l)=>u+l.x,0)/t.length,y:t.reduce((u,l)=>u+l.y,0)/t.length},n)),r=1/0,i=1/0,s=-1/0,a=-1/0;for(let c of o)r=Math.min(r,c.x),i=Math.min(i,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y);return!Number.isFinite(r)||s-r<1e-6||a-i<1e-6?null:{minX:r,minY:i,maxX:s,maxY:a}}var Kc=5,Yc=3,Wc=.92,zc=1.9,Zc=2,$c=.6,Qc=1,qc=.06;function Jc(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?Jn:rn(e.stageKind)?qc:Qc}function Er(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let s of vr(e)){let a=s.baseHeightM??0;for(let c of s.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=wr(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),o=Math.max(o,u.maxX),r=Math.max(r,u.maxY),i=Math.max(i,a+Jc(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function el(e,t,n,o){let r=1/0,i=1/0,s=-1/0,a=-1/0;for(let h of e)Number.isFinite(h.eyeHeightM)&&(r=Math.min(r,h.x),s=Math.max(s,h.x),i=Math.min(i,h.y),a=Math.max(a,h.y));if(!Number.isFinite(r))return null;let c=r*t,u=i*t,l=Math.max(1,Math.ceil((s-r)*t/n)+1),f=Math.max(1,Math.ceil((a-i)*t/n)+1),m=new Float64Array(l*f).fill(-1/0);for(let h of e){if(!Number.isFinite(h.eyeHeightM))continue;let d=h.eyeHeightM-je,p=Math.min(l-1,Math.max(0,Math.floor((h.x*t-c)/n))),g=Math.min(f-1,Math.max(0,Math.floor((h.y*t-u)/n)))*l+p,M=d+o;M>m[g]&&(m[g]=M)}return{cellM:n,minX:c,minY:u,cols:l,rows:f,top:m}}function tl(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 Ar(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??$,i=n.cellM??$c,s=n.chairBackM??Wc,a=n.selfRowSkipM??Zc,c=n.clearThreshold??.9,u=n.partialThreshold??.25,l=Math.max(1,n.columns??Kc),f=Math.max(1,n.rows??Yc),m=el(e,r,i,s);if(!m)return o;let h=(t.maxX-t.minX)*r,d=(t.maxY-t.minY)*r,p=h>=d,y=(t.minX+t.maxX)/2*r,g=(t.minY+t.maxY)/2*r,M=[];for(let w=0;w<l;w++){let x=(w+.5)/l-.5,b=p?y+x*h:y,S=p?g:g+x*d;for(let I=0;I<f;I++){let R=t.deckTopM+(f===1?0:I/(f-1)*zc);M.push({x:b,y:S,z:R})}}let P=i/2;for(let w of e){if(!Number.isFinite(w.eyeHeightM))continue;let x=w.x*r,b=w.y*r,S=w.eyeHeightM,I=0,R=1/0;for(let L of M){let T=L.x-x,v=L.y-b,A=Math.hypot(T,v);if(!(A>a)){I++;continue}let _=T/A,C=v/A,B=0;for(let O=a;O<A;O+=P){let F=tl(m,x+_*O,b+C*O);if(!(!Number.isFinite(F)||F>=S)&&F>S+(L.z-S)*O/A){B=O;break}}B?R=Math.min(R,B):I++}let k=I/M.length;k>=c||o.set(w.id,{seatId:w.id,mark:k<u?"obstructedView":"restrictedView",visibleFraction:k,totalRays:M.length,atDistanceM:Number.isFinite(R)?R:0})}return o}function _r(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 no(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var an=Math.PI/180;var Nt=16;function oo(e,t,n,o){let r=n*an,i=Math.cos(r),s=Math.sin(r);return{x:o.x+e*i-t*s,y:o.y+e*s+t*i}}function ro(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,s=[];if(e.path)return er(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(o===0){for(let u=0;u<t;u++)s.push(oo(u*n,0,r,i));return s}let a=o/(t-1)*an,c=n/(2*Math.sin(Math.abs(a)/2));for(let u=0;u<t;u++){let l=u*a,f=c*Math.sin(l),m=-c+c*Math.cos(l);s.push(oo(f,m,r,i))}return s}function io(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function nl(e,t){let n=io(e);return ro(e).map((o,r)=>{let i=n.get(r),s=no(i),a=fr(e,r,i),c={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:a,displayLabel:zn(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function ol(e){let t=[];for(let n of nl(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 rl(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 il(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(l=>[l.index,l])),r=(l,f,m,h)=>{let d=o.get(l),p=no(d),y=d?.label??mr(e,l);return{index:l,label:y,displayLabel:d?.displayLabel??hr(e,l),x:f+(d?.dx??0),y:m+(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 l=(e.radius??40)+Nt,f=e.rotation*an,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let y=0;y<n;y++){let g=f+y/n*2*Math.PI;t.push(r(y,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let h=m*an,d=(2*Math.PI-h)/2,p=f+d;for(let y=0;y<n;y++){let g=p+y/(n-1)*h;t.push(r(y,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let i=e.width??80,s=e.height??50,a=rl(e),c=["top","bottom","left","right"],u=0;for(let l of c){let f=a[l];for(let m=0;m<f;m++){let h,d;l==="top"?(h=-i/2+(m+.5)*i/f,d=-s/2-Nt):l==="bottom"?(h=-i/2+(m+.5)*i/f,d=s/2+Nt):l==="left"?(h=-i/2-Nt,d=-s/2+(m+.5)*s/f):(h=i/2+Nt,d=-s/2+(m+.5)*s/f);let p=oo(h,d,e.rotation,e.center);t.push(r(u++,p.x,p.y,l))}}return t}function sl(e){return il(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 al(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 Yn(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,s=t[o].y,a=t[r].x,c=t[r].y;s>e.y!=c>e.y&&e.x<(a-i)*(e.y-s)/(c-s)+i&&(n=!n)}return n}function cr(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 s=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),a=(r.x-n.x)**2+(r.y-n.y)**2;return s>=-1e-7&&s<=a+1e-7})}function Lt(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Pe(e,t,n){return Yn(e,t)&&!Lt(n).some(o=>Yn(e,o)||cr(e,o))}function sn(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 Tr(e){switch(e.type){case"row":{let t=ro(e),n=io(e),o=0,r=0,i=0;for(let s=0;s<t.length;s++){let a=n.get(s);a?.skip||(o+=t[s].x+(a?.dx??0),r+=t[s].y+(a?.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 sn(e.points);case"section":return sn(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?sn(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 Cr(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function cl(e,t){if(e.type!=="gaArea"||!Cr(e.points,t.outline))return!1;let n=Lt(e.holes),o=Lt(t.holes);return n.length===o.length&&n.every((r,i)=>Cr(r,o[i]))}function ll(e,t,n=e.filter(r=>r.type==="section"),o=Tr(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(s=>(s.logicalSectionId??s.id)===r&&(cl(t,s)||Pe(o,s.outline,s.holes))):void 0)??n.find(s=>Pe(o,s.outline,s.holes))??(t.type==="row"&&ul(t)?fl(t,n):void 0)}function ul(e){return(e.overrides??[]).some(t=>t.skip===!0)}function fl(e,t){let n=ro(e),o=io(e),r,i=0;for(let s of t){let a=0;for(let c=0;c<n.length;c++){let u=o.get(c);if(u?.skip)continue;let l={x:n[c].x+(u?.dx??0),y:n[c].y+(u?.dy??0)};Pe(l,s.outline,s.holes)&&a++}a>i&&(r=s,i=a)}return r}function vr(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 kr(e,t,n,o,r,i,s,a,c){let u=[],l=e.filter(p=>p.type==="section"),f=lr(e),m=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),h=p=>yr(p,{activeConfigurationId:o,activeConfigurationVersion:c,activeBasisSha256:r,now:a}),d=(p,y)=>h(p)?{...p,coverage:y}:void 0;for(let p of e){let y=[];if(p.type==="row"?y=ol(p):p.type==="table"?y=sl(p):p.type==="booth"&&(y=al(p)),!y.length)continue;for(let x of y)x.viewUrl&&!m(x.viewMeta)&&(x.viewUrl=void 0,x.viewMeta=void 0);if(p.type==="row"){let x=f.get(p.id);if(x){let b=new Map((p.overrides??[]).map(S=>[S.index,S]));for(let S of y){let I=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(I))continue;S.logicalRowId=x.groupId,S.logicalSeatIndex=x.adjacencyOffset+I,b.get(I)?.displayLabel||(S.displayLabel=zn(p,I,x)),!S.viewUrl&&x.viewFromSeatUrl&&m(x.viewFromSeatMeta)&&(S.viewUrl=x.viewFromSeatUrl,S.viewMeta=x.viewFromSeatMeta);let R=b.get(I)?.confidenceEvidence;S.confidenceEvidence=d(R,"exact-seat")??d(p.confidenceEvidence,"row-representative")??d(x.confidenceEvidence,"row-representative")}}}let g=ll(e,p,l,p.type==="row"?sn(y):Tr(p)),M=g?.viewFromSeatUrl,w=(g?.zone?t?.find(x=>x.id===g.zone):void 0)?.focalPoint??n;for(let x of y){if(!x.confidenceEvidence){let b=Number(x.id.slice(x.id.lastIndexOf(":")+1)),S=(p.type==="row"||p.type==="table")&&Number.isInteger(b)?p.overrides?.find(I=>I.index===b)?.confidenceEvidence:void 0;x.confidenceEvidence=d(S,"exact-seat")??(p.type==="row"?d(p.confidenceEvidence,"row-representative"):void 0)}x.confidenceEvidence??=d(g?.confidenceEvidence,"section-representative")??(s?d(s.evidence,s.coverage):void 0),!x.viewUrl&&M&&m(g?.viewFromSeatMeta)&&(x.viewUrl=M,x.viewMeta=g?.viewFromSeatMeta),!x.viewUrl&&i&&m(i.meta)&&(x.viewUrl=i.url,x.viewMeta=i.meta),g&&(x.sectionId=g.logicalSectionId??g.id),g?.zone&&(x.zoneId=g.zone),w&&(x.focalPoint={...w})}u.push(...y)}return u}function gt(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,s=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=kr(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Or(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,c);for(let u of c)u.floorId=r.id;for(let u of c)o.push(u)}return o}let n=kr(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&&Or(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),ml(e,n,t)}function ml(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||_r(t,Ar(t,Er(e))),t}function Or(e,t,n,o){let r=e.filter(f=>f.type==="section"),i=n>0||r.some(f=>f.height!==void 0||f.rake!==void 0||(f.elevation??0)>0);if(!r.length||!i||!t){for(let f of o)f.eyeHeightM=n+je;return}let s=new Array(o.length),a=new Map;for(let f of r)a.has(f.id)||a.set(f.id,f);let c=new Map,u=new Map;for(let f=0;f<o.length;f++){let m=o[f],d=(m.sectionId?a.get(m.sectionId)??r.find(y=>y.logicalSectionId===m.sectionId&&Pe({x:m.x,y:m.y},y.outline,y.holes)):void 0)??r.find(y=>Pe({x:m.x,y:m.y},y.outline,y.holes))??null;if(s[f]=d,!d)continue;c.has(d.id)||c.set(d.id,Qe(d,{floorBaseHeightM:n}));let p=u.get(d.id);p?p.push(f):u.set(d.id,[f])}let l=new Array(o.length).fill(void 0);for(let[f,m]of u){let h=c.get(f);if(!h)continue;let d=h.rake>0?Math.tan(h.rake*Math.PI/180):0,p=tn(f,o,m,t);for(let y of p.rows){let g=y.blockDepth*$*d,M=h.height+g;for(let P of y.seatIndices)l[P]=M}}for(let f=0;f<o.length;f++){let m=o[f],h=s[f];if(!h){m.eyeHeightM=n+je;continue}let d=c.get(h.id);m.eyeHeightM=(l[f]??d.height)+je}}var Br=Ge(require("earcut"),1),so=Ge(require("polygon-clipping"),1);function Ae(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 _e(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(o=!o)}return o}var E=$,hl=.002;function dl(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]),s=Math.max(o,r,i);if(s<1e-9)return!0;let a=(o+r+i)/2;return 2*Math.sqrt(Math.max(0,a*(a-o)*(a-r)*(a-i)))/s<hl}var ct=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)}},un=class{constructor(){this.pos=new ct;this.nor=new ct;this.col=new ct;this.flr=new ct;this.mat=new ct;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,s=i,a=i){dl(t,n,o)||(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(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,o,r,i,s,a,c=a,u=a){[...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(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(u[0],u[1],u[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function pl(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],c=n[2]-e[2],u=r*c-i*a,l=i*s-o*c,f=o*a-r*s,m=Math.hypot(u,l,f)||1;return u/=m,l/=m,f/=m,[u,l,f]}function bl(e,t){let n=[...e],o=[];for(let s of e)o.push(s.x,s.y);let r=[];if(t){for(let s of t)if(!(s.length<3)){r.push(n.length);for(let a of s)n.push(a),o.push(a.x,a.y)}}let i=(0,Br.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function He(e){return Ae(e)<0?[...e].reverse():e}var yl=3;function gl(e,t,n,o){let r=o(e),i=o(t),s=o(n),a=(h,d,p,y)=>Math.abs(o({x:(h.x+d.x)/2,y:(h.y+d.y)/2})-(p+y)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,l=(r+i+s)/3,f=Math.max(a(e,t,r,i),a(t,n,i,s),a(n,e,s,r),Math.abs(o({x:c,y:u})-l)),m=(h,d,p)=>{let y=Math.abs(o({x:(h+c)/2,y:(d+u)/2})-(p+l)/2);y>f&&(f=y)};return m((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+s)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(s+r)/2),f}function Dt(e,t,n,o,r){if(r<=0)return gl(e,t,n,o);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},s={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(Dt(e,i,a,o,r-1),Dt(i,t,s,o,r-1),Dt(a,s,n,o,r-1),Dt(i,s,a,o,r-1))}function Gt(e,t,n,o,r,i,s,a){if(s>0){let m={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};Gt(e,t,m,d,r,i,s-1,a),Gt(e,m,n,h,r,i,s-1,a),Gt(e,d,h,o,r,i,s-1,a),Gt(e,m,h,d,r,i,s-1,a);return}let c=[t.x*E,r(t),t.y*E],u=[n.x*E,r(n),n.y*E],l=[o.x*E,r(o),o.y*E];if(a){e.triN(c,u,l,a(t),a(n),a(o),i);return}let f=pl(c,u,l);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),e.tri(c,u,l,f,i)}var xl=8;function Lr(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,s,a,c,u)=>{if(u>0){let l={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=t(l);if(Math.abs(f-(a+c)/2)>n){r(i,l,a,f,u-1),r(l,s,f,c,u-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];r(s,a,t(s),t(a),xl)}return o}function cn(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],s=n[r],a=n[(r+1)%n.length],c=a.x-i.x,u=a.y-i.y,l=Math.hypot(c,u);l>t&&Math.abs((s.x-i.x)*u-(s.y-i.y)*c)/l<t||o.push(s)}return o.length>=3?o:n}var ln=.001*Oe*.1;function z(e,t,n,o,r,i,s,a,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Ae(t))<1e-4))return;let l=cn(Lr(cn(He(t),ln),o,c),ln),f=n?.map(b=>cn(Lr(cn(He(b),ln),o,c),ln)).filter(b=>b.length>=3&&Math.abs(Ae(b))>=1e-4),{pts:m,tris:h}=bl(l,f),d=[i[0]*a.top,i[1]*a.top,i[2]*a.top],p=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],y=[s[0]*a.top,s[1]*a.top,s[2]*a.top],g=[s[0]*a.wallBottom,s[1]*a.wallBottom,s[2]*a.wallBottom],M=0;if(Number.isFinite(c))for(;M<yl;M++){let b=0;for(let S=0;S<h.length;S+=3){let I=Dt(m[h[S]],m[h[S+1]],m[h[S+2]],o,M);I>b&&(b=I)}if(b<=c)break}for(let b=0;b<h.length;b+=3){let S=m[h[b]],I=m[h[b+1]],R=m[h[b+2]];Gt(e,S,I,R,o,d,M,u);let k=[S.x*E,r,S.y*E],L=[I.x*E,r,I.y*E],T=[R.x*E,r,R.y*E];e.tri(k,T,L,[0,-1,0],p)}let P=b=>{if(M<=0)return b;let S=1<<M,I=[];for(let R=0;R<b.length;R++){let k=b[R],L=b[(R+1)%b.length];for(let T=0;T<S;T++){let v=T/S;I.push({x:k.x+(L.x-k.x)*v,y:k.y+(L.y-k.y)*v})}}return I},w=Un(l),x=[{ring:P(l),flip:!1}];if(f)for(let b of f)b.length>=3&&x.push({ring:P(b),flip:!0});for(let{ring:b,flip:S}of x)for(let I=0;I<b.length;I++){let R=b[I],k=b[(I+1)%b.length],L=(k.x-R.x)*E,v=(k.y-R.y)*E,A=-L,_=Math.hypot(v,A)||1;v/=_,A/=_;let C=(R.x+k.x)/2-w.x,B=(R.y+k.y)/2-w.y,O=v*C+A*B;S&&(O=-O),O<0&&(v=-v,A=-A);let F=[v,0,A],D=[R.x*E,o(R),R.y*E],j=[k.x*E,o(k),k.y*E],N=[R.x*E,r,R.y*E],X=[k.x*E,r,k.y*E];e.tri(D,j,X,F,y,y,g),e.tri(D,X,N,F,y,g,g)}}function Fr(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),s=new Float32Array(t),a=0;for(let c of e)n.set(c.position,a*3),o.set(c.normal,a*3),r.set(c.color,a*3),i.set(c.floor,a),s.set(c.material,a),a+=c.count;return{position:n,normal:o,color:r,floor:i,material:s,count:t}}function Le(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=He(e),r=o.length,i=[];for(let a=0;a<r;a++){let c=o[a],u=o[(a+1)%r],l=u.x-c.x,f=u.y-c.y,m=Math.hypot(l,f)||1;i.push({x:f/m,y:-l/m})}let s=[];for(let a=0;a<r;a++){let c=o[a],u=i[(a-1+r)%r],l=i[a],f=u.x+l.x,m=u.y+l.y,h=Math.hypot(f,m),d=()=>{s.push([c.x+u.x*t,c.y+u.y*t]),s.push([c.x+l.x*t,c.y+l.y*t])};if(h<1e-9){d();continue}f/=h,m/=h;let p=f*u.x+m*u.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>n){d();continue}s.push([c.x+f*t*y,c.y+m*t*y])}if(s.length<3)return e;try{let a=so.default.union([[...s,s[0]]]),c=null,u=-1/0;for(let f of a){let m=Math.abs(Ae(f[0].map(([h,d])=>({x:h,y:d}))));m>u&&(u=m,c=f[0])}if(!c)return e;let l=c.map(([f,m])=>({x:f,y:m}));if(l.length>1){let f=l[0],m=l[l.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function Je(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=He(e),r=o.length,i=[];for(let c=0;c<r;c++){let u=o[c],l=o[(c+1)%r],f=Math.hypot(l.x-u.x,l.y-u.y)||1;i.push({x:-(l.y-u.y)/f,y:(l.x-u.x)/f})}let s=[],a=[];for(let c=0;c<r;c++){let u=o[c],l=i[(c-1+r)%r],f=i[c],m=l.x+f.x,h=l.y+f.y,d=Math.hypot(m,h),p=d<1e-9?1/0:1/Math.max(m/d*l.x+h/d*l.y,1e-6);if(!Number.isFinite(p)||p>n){s.push({x:u.x+l.x*t,y:u.y+l.y*t},{x:u.x+f.x*t,y:u.y+f.y*t}),a.push(c,c);continue}m/=d,h/=d,s.push({x:u.x+m*t*p,y:u.y+h*t*p}),a.push(c)}for(let c=0;c<s.length;c++){let u=(c+1)%s.length,l=a[c],f=a[u];if(f!==(l+1)%r)continue;let m=o[l],h=o[f];if((s[u].x-s[c].x)*(h.x-m.x)+(s[u].y-s[c].y)*(h.y-m.y)<=0)return[]}try{let c=so.default.intersection([[...s.map(d=>[d.x,d.y]),[s[0].x,s[0].y]]],[[...o.map(d=>[d.x,d.y]),[o[0].x,o[0].y]]]),u=null,l=0;for(let d of c){let p=Math.abs(Ae(d[0].map(([y,g])=>({x:y,y:g}))));p>l&&(l=p,u=d[0])}if(!u)return[];let f=u.map(([d,p])=>({x:d,y:p})),m=f[0],h=f[f.length-1];return f.length>1&&Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&f.pop(),f.length>=3?He(f):[]}catch{return[]}}function fn(e,t,n,o,r=28){let i=[];for(let s=0;s<r;s++){let a=s/r*Math.PI*2;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function jt(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 Ht=3,lt=.38,Vt=.24;function Ml(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)*E,i=(n.y-t.y)*E,s=(o.x-t.x)*E,a=(o.y-t.y)*E,c=2*(r*a-i*s);if(Math.abs(c)<1e-7)return null;let u=r*r+i*i,l=s*s+a*a,f=(u*a-l*i)/c+t.x*E,m=(r*l-s*u)/c+t.y*E,h=Math.hypot(t.x*E-f,t.y*E-m);return h<1||h>200||!Number.isFinite(h)||e.some(d=>Math.abs(Math.hypot(d.x*E-f,d.y*E-m)-h)>.03)?null:{x:f,z:m,radius:h}}function Nr(e){let t=[],n=new Map,o=(c,u)=>`${Math.floor(c/Ht)},${Math.floor(u/Ht)}`;for(let c of e)for(let u of c.rows){for(let f of u.pts){let m=f.x*E,h=f.y*E,d=o(m,h),p=n.get(d)??[];p.push({x:m,z:h,y:u.y,floor:c.floorIndex}),n.set(d,p)}if(u.patch||u.pts.length<2)continue;let l=Ml(u.pts);for(let f of[0,u.pts.length-1]){let m=u.pts[f],h=u.pts[f===0?1:f-1],d=m.x-h.x,p=m.y-h.y,y=Math.hypot(d,p);y<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:l,row:u,point:m,x:m.x*E,z:m.y*E,dx:d/y,dz:p/y})}}let r=new Map;t.forEach((c,u)=>{let l=o(c.x,c.z),f=r.get(l)??[];f.push(u),r.set(l,f)});let i=(c,u)=>{let l=Math.floor(c/Ht),f=Math.floor(u/Ht);return[-1,0,1].flatMap(m=>[-1,0,1].map(h=>`${l+m},${f+h}`))},s=new Map;t.forEach((c,u)=>{let l=-1,f=1/0,m=!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 y=p.x-c.x,g=p.z-c.z,M=Math.hypot(y,g);if(M<lt*2+.45||M>Ht)continue;let P=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,w=Math.min((y*c.dx+g*c.dz)/M,(-y*p.dx-g*p.dz)/M);(P?w<.8:w<.98)||!P&&(Math.abs(y*c.dz-g*c.dx)>.15||Math.abs(y*p.dz-g*p.dx)>.15)||(M<f-.02?(l=d,f=M,m=!1):Math.abs(M-f)<=.02&&(m=!0))}l>=0&&!m&&s.set(u,l)});let a=[];for(let[c,u]of s){if(c>=u||s.get(u)!==c)continue;let l=t[c],f=t[u],m=Math.hypot(f.x-l.x,f.z-l.z),h=(f.x-l.x)/m,d=(f.z-l.z)/m,p=!1;for(let g of i((l.x+f.x)/2,(l.z+f.z)/2))for(let M of n.get(g)??[]){if(M.floor!==l.floorIndex||Math.abs(M.y-l.row.y)>.75)continue;let P=(M.x-l.x)*h+(M.z-l.z)*d,w=Math.abs((M.x-l.x)*d-(M.z-l.z)*h);P>.01&&P<m-.01&&w<Vt+lt&&(p=!0)}if(p)continue;let y=(g,M)=>({x:(l.x+h*g-d*M)/E,y:(l.z+d*g+h*M)/E});a.push({sections:[l.sectionId,f.sectionId],blocks:[l.row.blockId,f.row.blockId],floorIndex:l.floorIndex,ends:[l.point,f.point],clearWidthM:m-2*lt,heightM:(l.row.y+f.row.y)/2,outline:[y(lt,-Vt),y(m-lt,-Vt),y(m-lt,Vt),y(lt,Vt)]})}return a}var Sl=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Dr(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 Pl(e){let t=Sl.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 oe(e){let t=Pl(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Il(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function re(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 Ve(e,t){let n=Il(e);return re(e,[n,n,n],t)}function Gr({r:e,g:t,b:n}){let o=e/255,r=t/255,i=n/255,s=Math.max(o,r,i),a=Math.min(o,r,i),c=(s+a)/2;if(s===a)return{h:0,s:0,l:c};let u=s-a,l=c>.5?u/(2-s-a):u/(s+a),f;return s===o?f=((r-i)/u+(r<i?6:0))/6:s===r?f=((i-o)/u+2)/6:f=((o-r)/u+4)/6,{h:f,s:l,l:c}}var ao=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,co=e=>e<=.0031308?12.92*e:1.055*Math.max(0,e)**.4166666666666667-.055,lo=e=>Math.min(1,Math.max(0,e));function fo(e){let t=ao(e[0]),n=ao(e[1]),o=ao(e[2]),r=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*o),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*o),s=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*o);return[.2104542553*r+.793617785*i-.0040720468*s,1.9779984951*r-2.428592205*i+.4505937099*s,.0259040371*r+.7827717662*i-.808675766*s]}function uo([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[lo(co(4.0767416621*o-3.3077115913*r+.2309699292*i)),lo(co(-1.2684380046*o+2.6097574011*r-.3413193965*i)),lo(co(-.0041960863*o-.7034186147*r+1.707614701*i))]}var mn=e=>fo(e)[0];function Ut(e){let[,t,n]=fo(e);return Math.hypot(t,n)}function ut(e,t,n){let[,o,r]=fo(e);if(n===void 0)return uo([t,o,r]);let i=Math.hypot(o,r),s=i===0?0:n/i;return uo([t,o*s,r*s])}function hn(e){return uo([e,-.004,-.008])}var dn=["available","held","sold","selected","dimmed"];function Hr(e){let t=dn.indexOf(e);return t<0?0:t}var Vr={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var jr={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}},pn=.012;function bn(e){return mn(e.tierTop)>.6}function xt(e){return e?jr.day:jr.night}var mo={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]},ho={top:[.05,.06,.08],bottom:[.1,.12,.15]};function W(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}var Rl=.15,wl=1.6;function Ur(e){return Xn(e??1,Rl,wl)}var El=.15,Al=.9,_l=1.76;function Xr(e){return po(e)?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function po(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55}function vl(){return{background:{top:[...ho.top],bottom:[...ho.bottom]},sky:Xr(null),structure:mo,seatStates:{...Vr},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Cl(e){return po(e)?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Kr(e){let t=vl();e??={};let n=oe(e.background);if(n){t.background={top:W(n,Al),bottom:W(n,_l)},t.sky=Xr(n);let a={};for(let[u,l]of Object.entries(mo))a[u]=re(l,n,El);n[0]*.2126+n[1]*.7152+n[2]*.0722>.55&&(a.ground=W(n,.86)),t.structure=a}let o=oe(e.selectionColor)??oe(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let r=e.seatScale;typeof r=="number"&&Number.isFinite(r)&&(t.seatScale=Ur(r));let i=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([,a])=>a!=null)),s={...Cl(n),...i};if(s){let a=oe(s.deck),c=oe(s.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),c&&(t.structure={...t.structure,tierWall:c,gaWall:c}),t.materials.seat=oe(s.seat),t.materials.shell=oe(s.shell),typeof s.roughness=="number"&&Number.isFinite(s.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,s.roughness)))}return kl(t,po(n)),t}function kl(e,t){let n=xt(t);e.seatStates={...e.seatStates,held:hn(n.unavailable),sold:hn(n.unavailable),dimmed:hn(n.dimmed)};let o=(i,s)=>ut(i,s,Math.min(Ut(i),pn)),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 Yr(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}function Wr(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=!1;for(let s of e)!Number.isFinite(s.x)||!Number.isFinite(s.y)||(i=!0,s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x>o&&(o=s.x),s.y>r&&(r=s.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function Mt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var bo=[{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"}],hp=new Map(bo.map(e=>[e.key,e]));var Ol={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 yn(e){let t=e?.[0];return t&&Ol[t]||"#3b82f6"}var Tl=[{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"}],dp=new Map(Tl.map(e=>[e.key,e]));var Ll=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],pp=new Set(Ll);var gn=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7"],zr="#a4508b";var Sp={facilities:zr,"food-drink":gn[5],navigation:gn[2],accessibility:gn[4]};var Pp={minDiameterPx:12,glyphScale:.66,ringRatio:1/14,largeFromPx:24};var de=e=>{let t=Math.round(e*100)/100;return Object.is(t,-0)?"0":String(t)},Rt=e=>`${de(e[0])} ${de(e[1])}`,It=(e,t,n,o)=>[e+n*Math.cos(o*Math.PI/180),t+n*Math.sin(o*Math.PI/180)];function ai(e){let t=`M${Rt(e.from)}`;for(let n of e.segs)t+=n.arc?`A${de(n.arc.r)} ${de(n.arc.r)} 0 ${n.arc.large} ${n.arc.sweep} ${Rt(n.to)}`:`L${Rt(n.to)}`;return`${t}Z`}function pe(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 be(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 q(e,t,n,o,r){let i=Math.min(r,n/2,o/2),s={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:s},{to:[e+n,t+o-i]},{to:[e+n-i,t+o],arc:s},{to:[e+i,t+o]},{to:[e,t+o-i],arc:s},{to:[e,t+i]},{to:[e+i,t],arc:s}]}}function ge(e){let t=0;for(let o=0;o<e.length;o++){let[r,i]=e[o],[s,a]=e[(o+1)%e.length];t+=r*a-s*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],s=Math.hypot(r,i);if(s<1e-6)return be(e[0],e[1],o);let a=[i/s*o,-r/s*o],c={r:o,large:0,sweep:1},u=[e[0]+a[0],e[1]+a[1]];return{from:u,segs:[{to:[t[0]+a[0],t[1]+a[1]]},{to:[t[0]-a[0],t[1]-a[1]],arc:c},{to:[e[0]-a[0],e[1]-a[1]]},{to:u,arc:c}]}}function ye(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 Be(e,t,n,o,r,i){let s=i/2,a=r-o>180?1:0,c={r:s,large:0,sweep:1},u=It(e,t,n+s,o);return{from:u,segs:[{to:It(e,t,n+s,r),arc:{r:n+s,large:a,sweep:1}},{to:It(e,t,n-s,r),arc:c},{to:It(e,t,n-s,o),arc:{r:n-s,large:a,sweep:0}},{to:u,arc:c}]}}var ee=(...e)=>e.flat().map(ai).join(" "),Ee=(e,t,n)=>`M${de(e-n)} ${de(t)}a${de(n)} ${de(n)} 0 1 0 ${de(2*n)} 0a${de(n)} ${de(n)} 0 1 0 ${de(-2*n)} 0`,Ue=(e,t,n,o,r)=>ai(q(e,t,n,o,r)),Mn=e=>`M${e.map(Rt).join("L")}`,xn=(e,t,n,o,r)=>`M${Rt(It(e,t,n,o))}A${de(n)} ${de(n)} 0 ${r-o>180?1:0} 1 ${Rt(It(e,t,n,r))}`;function St(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,s,a,c,u])=>[i*o+t,s*o+n,a*o,c,u])}}function Xt(e){return[Ee(e.head[0],e.head[1],e.head[2]),...e.limbs.map(Mn),...(e.arcs??[]).map(([t,n,o,r,i])=>xn(t,n,o,r,i))].join(" ")}function Pt(e,t=2.6){return[be(e.head[0],e.head[1],e.head[2]+1),...e.limbs.flatMap(n=>ye(n,t)),...(e.arcs??[]).map(([n,o,r,i,s])=>Be(n,o,r,i,s,t-.2))]}var ft={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]]},Zr={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]]]},$r={cx:12,hr:1.9,arm:5,leg:3,r:2},Qr={cx:12,hr:1.9,sh:2.2,hem:6,leg:3},qr={cx:6.2,hr:1.8,arm:3.6,leg:2.2,r:1.4},Jr={cx:17.8,hr:1.8,sh:1.4,hem:4.1,leg:2.2};function ei({cx:e,hr:t,arm:n,leg:o,r}){return[Ee(e,2+t,t),`M${de(e-n+r)} 8.5H${de(e+n-r)}a${r} ${r} 0 0 1 ${r} ${r}V15H${de(e+o)}V22H${de(e-o)}V15H${de(e-n)}V${de(8.5+r)}a${r} ${r} 0 0 1 ${r} ${-r}Z`,`M${de(e)} 15V22`].join(" ")}function ti({cx:e,hr:t,arm:n,leg:o,r}){return[be(e,2+t,t+1),q(e-n-.5,7.8,2*n+1,7.7,r+.5),q(e-o-.5,13,o,9.5,1),q(e+.5,13,o,9.5,1)]}function ni({cx:e,hr:t,sh:n,hem:o,leg:r}){return[Ee(e,2+t,t),Mn([[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${de(e)} 16V22`].join(" ")}function oi({cx:e,hr:t,sh:n,hem:o,leg:r}){return[be(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]]),q(e-r-.1,15,r-.4,7.5,.9),q(e+.5,15,r-.4,7.5,.9)]}var Bl=[[14.6,1.5],[5.2,13.6],[11,13.6],[9.4,22.5],[18.8,10.4],[13,10.4]],Fl="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",Nl="M12 2.5S5 9.5 5 14.5a7 7 0 0 0 14 0c0-5-7-12-7-12Z",Dl="M2.5 21.5h19V3h-6v6.2H9.2v6.2H2.5Z",ri=[[9,3],[15,3],[15,9],[21,9],[21,15],[15,15],[15,21],[9,21],[9,15],[3,15],[3,9],[9,9]],Gl={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}}]},jl={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 ii(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 si={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]]]},Hl=[[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]],Vl=[[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]],yo=[{key:"restroom-men",label:"Men's restroom",group:"facilities",path:ei($r),solid:ee(ti($r))},{key:"restroom-women",label:"Women's restroom",group:"facilities",path:ni(Qr),solid:ee(oi(Qr))},{key:"restroom-accessible",label:"Accessible restroom",group:"facilities",path:[Ue(2.5,2.5,19,19,3.5),Xt(St(ft,4.6,4.3,.66))].join(" "),solid:ee(Pt(ft)),solidLarge:ee(q(1.5,1.5,21,21,4.5),pe(q(3.9,3.9,16.2,16.2,2.6)),Pt(St(ft,4.9,4.7,.62),2.2))},{key:"first-aid",label:"First aid",group:"facilities",path:Mn(ri)+"Z",solid:ee(ge(ri.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:ee(Be(12,6.2,2.2,180,450,2.3),le([12,8.4],[12,10.5],2.3),ye([[12,10.2],[3.2,18.8],[20.8,18.8]],2.8,!0))},{key:"atm",label:"ATM / cash",group:"facilities",path:[Ue(2,6,20,12,2),Ee(12,12,2.75),"M6 12h.01 M18 12h.01"].join(" "),solid:ee(q(1.5,5.5,21,13,2.4),pe(be(12,12,3.2)))},{key:"info",label:"Info point",group:"facilities",path:[Ee(12,12,9.5),"M10.8 11H12v5.8 M12 7.6h.01"].join(" "),solid:ee(be(12,4.9,2.4),q(10.3,9.2,3.4,12.3,1),q(8.2,9.2,4,3,1),q(8.2,18.5,7.6,3,1))},{key:"lost-found",label:"Lost & found",group:"facilities",path:[Ee(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:ee(Be(12,7.6,4.2,180,405,3.4),ye([[14.97,10.57],[12,13],[12,15]],3.4),be(12,20,2.1))},{key:"restrooms",label:"Toilets",group:"facilities",path:[ei(qr),ni(Jr)].join(" "),solid:ee(ti(qr),oi(Jr))},{key:"charging",label:"Charging point",group:"facilities",path:[Ue(6,2,12,20,2.5),"M13.2 6.2 9.6 12h4.8l-3.6 5.8"].join(" "),solid:ee(ge(Bl))},{key:"smoking",label:"Smoking area",group:"facilities",path:[Ue(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:ee(q(1.5,14,4.2,5,1.2),q(6.8,14,10.4,5,1.2),ye([[15.9,11.4],[17.3,8.9],[15.9,6.4],[17.1,3.9]],2.2),ye([[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:[Ee(12,12,9.5),"M5.3 5.3l13.4 13.4","M5.5 10.5h13v3h-13Z"].join(" "),solid:ee(be(12,12,10.6),pe(be(12,12,8)),le([6,6],[18,18],2.8),q(5,10.4,3,3.2,.6),q(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:ee(ye([[4.9,2.6],[4.9,8]],2.2),ye([[10.1,2.6],[10.1,8]],2.2),ye([[7.5,2.6],[7.5,8]],2.2),Be(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:ee(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:ee({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]}]},Be(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:Nl,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:Fl,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:[Ue(2,3.5,20,13.5,2),"M12 17v3.5 M8 20.5h8","M10 7.8v5.9l5-2.95Z"].join(" "),solid:ee(q(1.5,3,21,14.4,2.4),pe(ge([[9.6,6.7],[16,10.2],[9.6,13.7]])),q(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",Ee(6,14,2),Ee(12,8,2),Ee(18,15,2)].join(" "),solid:ee(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),q(3.2,11.6,5.6,4.8,1.4),q(9.2,5.6,5.6,4.8,1.4),q(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:ee(ye([[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:ee(ye([[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:[Xt(St(Zr,-2,1.4,1.15)),"M15.5 13h6 M19 10.5l2.5 2.5-2.5 2.5"].join(" "),solid:ee(Pt(St(Zr,-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:Dl,solid:"M1.5 22.5h21V2h-7.8v6.4H8.4v6.4H1.5Z"},{key:"elevator",label:"Elevator",group:"navigation",path:[Ue(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:ee(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:[Ue(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:Xt(ft),solid:ee(Pt(ft))},{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:ee(Be(10,9,6,180,380,3),ye([[15.64,11.05],[12.8,14.3],[11.5,17.2]],3),Be(8.2,17.2,3.3,0,150,3),Be(10,9,2.2,180,400,2.4),Be(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:ee(Gl,pe(q(14.1,7,1.8,2.2,.9)),pe(q(14.1,10.9,1.8,2.2,.9)),pe(q(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:ee(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]]),be(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:ee(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",Ue(3.5,11,17,6,2),"M6.5 17v2.5 M17.5 17v2.5 M7 14h.01 M17 14h.01"].join(" "),solid:ee(q(9,1.8,6,3.4,.8),ge([[6,11.4],[7.6,6.4],[16.4,6.4],[18,11.4]]),q(2.8,10.6,18.4,7,2.2),pe(be(6.8,14,1.3)),pe(be(17.2,14,1.3)),q(4.8,16,3.6,5.2,1.2),q(15.6,16,3.6,5.2,1.2))},{key:"transit",label:"Bus / transit",group:"navigation",path:[Ue(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:ee(q(4,2,16,17,3.2),pe(q(6.2,5.8,11.6,5,1)),pe(be(8,14.5,1.3)),pe(be(16,14.5,1.3)),q(6,17,3.4,5,1.2),q(14.6,17,3.4,5,1.2))},{key:"bike-parking",label:"Bike parking",group:"navigation",path:[Ee(6,14.5,4),Ee(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:ee(be(6,14.5,4.9),pe(be(6,14.5,2.7)),be(18,14.5,4.9),pe(be(18,14.5,2.7)),ye([[6,14.5],[9,7.5],[15.5,7.5],[18,14.5]],2.2),ye([[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),ye([[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",Ee(10,9.6,1.5),Ee(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:ee(ye([[9.4,2.4],[12,5],[14.6,2.4]],2.6),ye([[9.4,21.6],[12,19],[14.6,21.6]],2.6),ye([[2.4,9.4],[5,12],[2.4,14.6]],2.6),ye([[21.6,9.4],[19,12],[21.6,14.6]],2.6),be(9.7,9.3,2.2),be(14.3,9.3,2.2),ii(9.7,16,3),ii(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:ee(jl,pe(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:[Ue(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:ee(q(3,2,8.4,20,1.4),pe(q(5,5,4.4,1.7,.8)),pe(q(8.6,10.8,1.5,3.8,.7)),q(12.6,2,8.4,20,1.4),pe(q(14.6,5,4.4,1.7,.8)),pe(q(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:ee(ge([[9.6,6.2],[10.6,1.8],[13.4,1.8],[14.4,6.2]]),q(7.6,5.4,8.8,2.6,1),q(7.8,7.4,8.4,15,2.6),pe(q(7.8,11.8,3.4,1.5,0)),pe(q(7.8,15.4,3.4,1.5,0)))},{key:"prayer-room",label:"Prayer room",group:"facilities",path:[Xt(si),"M3 21.5h18"].join(" "),solid:ee(Pt(si),q(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:ee(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:[xn(12,19,11.5,218,322),xn(12,19,7.5,218,322),xn(12,19,3.5,218,322),"M12 19h.01"].join(" "),solid:ee(Be(12,19.2,11,218,322,2.8),Be(12,19.2,6.9,218,322,2.8),be(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:ee(q(6,4,12,8.5,2.2),q(2.4,9.6,4.6,9,2.2),q(17,9.6,4.6,9,2.2),q(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:[Xt(St(ft,.3,5,.62)),"M12.5 3.5H20a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1h-7.5"].join(" "),solid:ee(Pt(St(ft,.3,5,.62),2.2),ye([[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:[Mn(Hl)+"Z","M6 10.8 3.5 7.5","M10.5 10.5V6h4.5l1 2.5"].join(" "),solid:ee(ge(Vl),le([6.2,11],[3.2,7.2],2.4),ye([[10.5,11],[10.5,5.6],[15.2,5.6],[16.2,8.2]],2.2))}],Ip=new Map(yo.map(e=>[e.key,e]));var ci=yo;var Ul=new Map(ci.map(e=>[e.key,e]));function go(e){return e?Ul.get(e):void 0}var Ep=ci.map(e=>e.key);function Kt(e){if(e.length<3)return e.map(i=>({...i}));let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y),n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),o=i=>{let s=[];for(let a of i){for(;s.length>=2&&n(s[s.length-2],s[s.length-1],a)<=0;)s.pop();s.push(a)}return s.pop(),s},r=[...o(t),...o([...t].reverse())];return r.length>=3?r.map(i=>({...i})):t.map(i=>({...i}))}var Fi=Ge(require("polygon-clipping"),1);var K={top:1,wallBottom:.58,bottomCap:.4};function mt(e,t){if(!e)return t;let n=W(Ve(e,.4),.62);return re(t,n,.22)}function li(e,t){return e?re(t,W(Ve(e,.25),.74),.62):t}function ui(e,t){let n=xt(bn({tierTop:t}));return e?ut(e,n.sectionDeck,Math.min(n.sectionDeckChromaShare*Ut(e),n.sectionDeckChromaCap)):ut(t,n.deck,Math.min(Ut(t),pn))}function fi(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 s=o.get(i.sectionId);s||(s=new Map,o.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,s]of o){let a=0,c=0,u=0,l=0;for(let[f,m]of s){let h=oe(n.get(f));h&&(a+=h[0]*m,c+=h[1]*m,u+=h[2]*m,l+=m)}l>0&&r.set(i,[a/l,c/l,u/l])}return r}function mi(e,t){return oe(e.color)??t.get(e.logicalSectionId??e.id)??null}var Po=Ge(require("polygon-clipping"),1);var So=Ge(require("polygon-clipping"),1);var di=[{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 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21},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}}],pi=di.map(e=>e.key),Xl=new Map(di.map(e=>[e.key,e]));function hi(e){return typeof e=="string"&&Xl.has(e)}function bi(e,t){return hi(e)?e:hi(t?.seatGlyph)?t.seatGlyph:"circle"}var Re={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Kl=.44,Yl=.15,Wl=.3,zl=.24;function yi(e){return e===void 0||!Number.isFinite(e)||e<=0?zl:Math.min(Wl,Math.max(Yl,e*Kl))}var Zl=.05,gi=.45,$l=gi+Zl,Ql=.92;var Tp=[{part:Re.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:Re.pad,min:[-1,.36,-.95],max:[1,gi,1]},{part:Re.back,min:[-1,$l,-1],max:[1,Ql,-.72]},{part:Re.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:Re.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:Re.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:Re.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:Re.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:Re.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:Re.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Lp=[{part:Re.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:Re.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:Re.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:Re.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:Re.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}];function xi(e,t,n,o){let r=new Float32Array(t),i=u=>e[u*3],s=u=>e[u*3+2],a=0,c=(u,l)=>{let f=l-u;for(let m=u;m<l;m++){let[h,d]=o(m),p=h-i(m),y=d-s(m);if(f>=2){let g=Math.max(u,m-1),M=Math.min(l-1,m+1),P=i(M)-i(g),w=s(M)-s(g),x=Math.hypot(P,w);if(x>1e-6){let b=-w/x,S=P/x;b*p+S*y<0&&(b=-b,S=-S),p=b,y=S}}r[m]=p===0&&y===0?0:Math.atan2(p,y)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(a))&&(c(a,u),a=u);return r}var Sn=.22;var ql=.42;function Jl(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,s=-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>s&&(s=d.y);let a=Math.max(i-o,1e-6),c=Math.max(s-r,1e-6),u=Math.max(Math.sqrt(a*c/t),1e-6),l=Math.max(1,Math.ceil(a/u)+1),f=Math.max(1,Math.ceil(c/u)+1),m=new Map,h=(d,p)=>{let y=Math.min(l-1,Math.max(0,Math.floor((d-o)/u)));return Math.min(f-1,Math.max(0,Math.floor((p-r)/u)))*l+y};for(let d=0;d<t;d++){let p=h(e[d].x,e[d].y),y=m.get(p);y?y.push(d):m.set(p,[d])}for(let d=0;d<t;d++){let p=e[d],y=Math.min(l-1,Math.max(0,Math.floor((p.x-o)/u))),g=Math.min(f-1,Math.max(0,Math.floor((p.y-r)/u))),M=1/0;for(let P=1;P<=4;P++){for(let w=g-P;w<=g+P;w++)if(!(w<0||w>=f))for(let x=y-P;x<=y+P;x++){if(x<0||x>=l||P>1&&Math.abs(w-g)<P&&Math.abs(x-y)<P)continue;let b=m.get(w*l+x);if(b)for(let S of b){if(S===d)continue;let I=Math.hypot(e[S].x-p.x,e[S].y-p.y);I<M&&(M=I)}}if(Number.isFinite(M)&&M<=P*u)break}n[d]=M}return n}function eu(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-je):0}function Mi(e,t,n,o,r,i){let s=e.length,a=new Float32Array(s*3),c=new Float32Array(s),u=new Float32Array(s*3),l=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(s),h=new Float32Array(s),d=new Float32Array(s*3),p=new Map,y=Jl(e);for(let g=0;g<s;g++){let M=e[g],w=(n?.seatPitchU(g)??y[g])*E;l[g]=Number.isFinite(w)?Math.max(.06,Math.min(Sn,w*ql)):Sn,f[g]=yi(Number.isFinite(w)?w:void 0);let x=bi(M.glyph,{seatGlyph:i?.get(M.categoryKey)});m[g]=pi.indexOf(x),h[g]=M.wheelchairSpaceType==="no-seat"?0:1,a[g*3]=M.x*E,a[g*3+1]=n?n.seatDeckY(g):eu(M),a[g*3+2]=M.y*E,c[g]=Hr(t?t(M):"available");let b=oe(r?.get(M.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[g*3]=b[0],u[g*3+1]=b[1],u[g*3+2]=b[2],M.accessibility?.length){let S=oe(yn(M.accessibility));S&&(d[g*3]=S[0],d[g*3+1]=S[1],d[g*3+2]=S[2])}p.set(M.id,g)}return{count:s,iPosition:a,iState:c,iCategory:u,iMaxRadius:l,iRing:d,idToIndex:p,iChairWidth:f,iGlyph:m,iPhysicalSeat:h,iFloor:o??new Float32Array(s),iSection:new Float32Array(s).fill(-1),iYaw:new Float32Array(s)}}var Ri=Ge(require("earcut"),1);var tu=.58,Si=.01,Te=Sn*1.5*Oe,nu=.5,ou=.6;function ru(e,t){let n=e.length,o=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],c=e[Math.min(n-1,s+1)],u=c.x-a.x,l=c.y-a.y,f=Math.hypot(u,l);if(f<1e-9){o.push([0,0]);continue}u/=f,l/=f,o.push([-l,u])}let r=0;for(let s=0;s<n;s++)r+=(e[s].x-t.x)*o[s][0]+(e[s].y-t.y)*o[s][1];return r<0?o.map(([s,a])=>[-s,-a]):o}function iu(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(s,a)=>{let c=a.x-s.x,u=a.y-s.y,l=Math.hypot(c,u)||1;return{x:c/l,y:u/l}},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 Pi=Math.PI/12;function su(e){if(e.length<3)return[...e];let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y),n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),o=i=>{let s=[];for(let a of i){for(;s.length>=2&&n(s[s.length-2],s[s.length-1],a)<=0;)s.pop();s.push(a)}return s.pop(),s},r=[...o(t),...o([...t].reverse())];return r.length>=3?r:[...e]}function wi(e,t){if(!e.length||!(t>0))return[];let n=su(e),o=(a,c,u,l)=>{let f=u-c;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/Pi)),h=t/Math.cos(f/m/2);for(let d=0;d<=m;d++){let p=c+f*d/m;l.push({x:a.x+Math.cos(p)*h,y:a.y+Math.sin(p)*h})}};if(n.length<3){let a=0,c=0;for(let h of n)a+=h.x,c+=h.y;a/=n.length||1,c/=n.length||1;let u=0;for(let h of n)u=Math.max(u,Math.hypot(h.x-a,h.y-c));let l=[],f=Math.max(3,Math.ceil(Math.PI*2/Pi)),m=(u+t)/Math.cos(Math.PI/f);for(let h=0;h<f;h++){let d=h/f*Math.PI*2;l.push({x:a+Math.cos(d)*m,y:c+Math.sin(d)*m})}return l}let r=n.length,i=[];for(let a=0;a<r;a++){let c=n[a],u=n[(a+1)%r];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let s=[];for(let a=0;a<r;a++)o(n[a],i[(a+r-1)%r],i[a],s);return Ci(s)}function au(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],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let f=Math.hypot(t-(i.x+l*a),n-(i.y+l*c));f<o&&(o=f)}return o}function Pn(e){let t=e.map(r=>{let i=0,s=0;for(let u of r.pts)i+=u.x,s+=u.y;let a=r.pts.length||1;i/=a,s/=a;let c=0;for(let u of r.pts){let l=Math.hypot(u.x-i,u.y-s);l>c&&(c=l)}return{cx:i,cy:s,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),s=[],a=1/0,c=null;for(let l of i){let f=1/0;for(let m=0;m<e.length;m++){if(m===r||Math.abs(e[m].y-e[r].y)<.001)continue;let h=t[m],d=Math.hypot(l.x-h.cx,l.y-h.cy)-h.rad;if(d>=f&&d>=a)continue;let p=au(e[m].pts,l.x,l.y);p<f&&(f=p),e[m].depth<e[r].depth&&p<a&&(a=p,c=e[m].y)}Number.isFinite(f)&&f>0&&s.push(f)}s.sort((l,f)=>l-f);let u=s.length?s[Math.floor(s.length/2)]:1;o.push({pitch:u,belowY:c})}return o}function Ei(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let l=r.pts[0],f=l.x-o.x,m=l.y-o.y,h=Math.hypot(f,m)||1;f/=h,m/=h;let d=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+m*d,y:l.y-f*d},{x:l.x-m*d,y:l.y+f*d}]})():[];if(i.length<2)return null;let s=0,a=0;for(let l=1;l<i.length;l++){let f=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);f>1e-6&&(s+=f,a++)}let c=a>0?s/a:0,u=iu(i,Math.max(c*ou,Te));return{pts:u,nrm:ru(u,o),front:Math.max(n[t].pitch*tu,Te),back:Math.max(n[t].pitch*nu,Te)}}var wt=1.5,Ai=.3;function xo(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,s=Math.hypot(r,i),a=-1,c=-1;for(let f=1;f<e.length-1;f++){let m=e[f],h=s>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*r)/s:Math.hypot(m.x-n.x,m.y-n.y);h>a&&(a=h,c=f)}if(a<=t||c<0)return[n,o];let u=xo(e.slice(0,c+1),t),l=xo(e.slice(c),t);return[...u.slice(0,-1),...l]}function _i(e,t){if(e.length<4)return e;let n=xo([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function cu(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 s=t[i];if(!(Math.abs(r.i-s.i)===1||Math.abs(r.i-s.i)===e.length-1||r.maxY<s.minY||s.maxY<r.minY)&&n(r.a,r.b,s.a)*n(r.a,r.b,s.b)<=0&&n(s.a,s.b,r.a)*n(s.a,s.b,r.b)<=0)return!0}}return!1}function vi(e,t,n){if(e.length<2)return[];let o=n??Pn(e),r=new Map;for(let s=0;s<e.length;s++){let a=r.get(e[s].blockId);a?a.push(s):r.set(e[s].blockId,[s])}let i=[];for(let[,s]of r){let a=[];for(let M of s){let P=e[M].patch;P&&P.length>=3?i.push({outline:[...P],holes:[],topY:e[M].y}):a.push(M)}if(!a.length)continue;a.sort((M,P)=>e[M].depth-e[P].depth);let u=a.map(M=>Ei(e,M,o,t)).filter(M=>M!==null);if(!u.length)continue;let l=(M,P)=>({x:M.pts[P].x-M.nrm[P][0]*(M.front+wt),y:M.pts[P].y-M.nrm[P][1]*(M.front+wt)}),f=(M,P)=>({x:M.pts[P].x+M.nrm[P][0]*(M.back+wt),y:M.pts[P].y+M.nrm[P][1]*(M.back+wt)}),m=u[0],h=u[u.length-1],d=[];for(let M=0;M<m.pts.length;M++)d.push(l(m,M));for(let M of u)d.push(f(M,M.pts.length-1));for(let M=h.pts.length-1;M>=0;M--)d.push(f(h,M));for(let M=u.length-1;M>=0;M--)d.push(l(u[M],0));let p=Ci(d),y=1/0;for(let M of a)e[M].y<y&&(y=e[M].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(Ae(p))>1e-6&&u.every(M=>{let P=M.pts[Math.floor(M.pts.length/2)];return _e(p,P.x,P.y)})&&!cu(p)){i.push({outline:_i(p,Ai),holes:[],topY:y});continue}for(let M of lu(u))i.push({outline:M,holes:[],topY:y})}return i}function lu(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+wt,s=n.back+wt;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],l=n.nrm[c];o.push([u.x-l[0]*i,u.y-l[1]*i]),r.push([u.x+l[0]*s,u.y+l[1]*s])}let a=[...o,...r.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=So.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,u])=>({x:c,y:u})),s=i[0],a=i[i.length-1];i.length>1&&Math.abs(s.x-a.x)<1e-9&&Math.abs(s.y-a.y)<1e-9&&i.pop(),i.length>=3&&o.push(_i(i,Ai))}return o}catch{return[]}}function Ci(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 Mo=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(!_e(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function Ii(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let u=[0,1,0],l=o[0];for(let f=1;f+1<o.length;f++){let m=o[f],h=o[f+1];e.tri([l.x*E,r,l.y*E],[m.x*E,r,m.y*E],[h.x*E,r,h.y*E],u,i)}return}let s=o.map(u=>[u.x,u.y]);s.push(s[0]);let a;try{a=So.default.intersection([s],t)}catch{return}let c=[0,1,0];for(let u of a){if(!u.length||u[0].length<4)continue;let l=u[0],f=[],m=[];for(let d=0;d<l.length-1;d++)f.push(l[d][0],l[d][1]),m.push([l[d][0],l[d][1]]);if(m.length<3)continue;let h=(0,Ri.default)(f,void 0,2);for(let d=0;d<h.length;d+=3){let p=m[h[d]],y=m[h[d+1]],g=m[h[d+2]];e.tri([p[0]*E,r,p[1]*E],[y[0]*E,r,y[1]*E],[g[0]*E,r,g[1]*E],c,i)}}}function ki(e,t,n,o,r,i,s){if(t.length<2)return;let a=s??Pn(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(h=>[h.x,h.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new Mo([[...i]]):null,f=h=>{e.setMaterial(2),h(),e.setMaterial(0)},m=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 x=[...d.patch],b=a[h].belowY??o;if(m(()=>{if(u&&l)Ii(e,u,l,x,d.y,r.tread);else{let S=x[0];for(let I=1;I+1<x.length;I++){let R=x[I],k=x[I+1];e.tri([S.x*E,d.y,S.y*E],[R.x*E,d.y,R.y*E],[k.x*E,d.y,k.y*E],c,r.tread)}}}),d.y>b+Si){let S=0,I=0;for(let R of x)S+=R.x,I+=R.y;S/=x.length,I/=x.length,f(()=>{for(let R=0;R<x.length;R++){let k=x[R],L=x[(R+1)%x.length],T=L.x-k.x,v=L.y-k.y,A=Math.hypot(T,v);if(A<1e-6)continue;let _=v/A,C=-T/A;(k.x-S)*_+(k.y-I)*C<0&&(_=-_,C=-C);let B=[_,0,C],O=[k.x*E,d.y,k.y*E],F=[L.x*E,d.y,L.y*E],D=[k.x*E,b,k.y*E],j=[L.x*E,b,L.y*E];e.tri(O,F,j,B,r.riser),e.tri(O,j,D,B,r.riser)}})}continue}let p=Ei(t,h,a,n);if(!p)continue;let{pts:y,nrm:g,front:M,back:P}=p,w=a[h].belowY??o;for(let x=0;x+1<y.length;x++){let b=y[x],S=y[x+1],I=g[x],R=g[x+1];if(Math.hypot(S.x-b.x,S.y-b.y)<1e-6||I[0]===0&&I[1]===0||R[0]===0&&R[1]===0)continue;let k=[(b.x-I[0]*M)*E,d.y,(b.y-I[1]*M)*E],L=[(S.x-R[0]*M)*E,d.y,(S.y-R[1]*M)*E],T=[(b.x+I[0]*P)*E,d.y,(b.y+I[1]*P)*E],v=[(S.x+R[0]*P)*E,d.y,(S.y+R[1]*P)*E];if(m(()=>{u&&l?Ii(e,u,l,[{x:b.x-I[0]*M,y:b.y-I[1]*M},{x:S.x-R[0]*M,y:S.y-R[1]*M},{x:S.x+R[0]*P,y:S.y+R[1]*P},{x:b.x+I[0]*P,y:b.y+I[1]*P}],d.y,r.tread):(e.tri(k,L,v,c,r.tread),e.tri(k,v,T,c,r.tread))}),d.y>w+Si){let A=[k[0],w,k[2]],_=[L[0],w,L[2]],C=[-I[0],0,-I[1]];f(()=>{e.tri(k,L,_,C,r.riser),e.tri(k,_,A,C,r.riser)})}}}}function uu(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Oi(e,t){return e.filter(n=>n.type!=="shape"||uu(n,t))}function Ti(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:Oi(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:Oi(e.objects,t),focal:n,baseHeightM:0,index:0}]}var fu={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Ye(e){return Wr(e)??fu}function Li(e,t){let n=Le(e.outline,Te),o=Ye(n),r=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&Mt(o,Ye(s.outline)));if(!r.length)return[n];let i=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a};try{let s=Po.default.difference([i(n)],...r.map(c=>[i(c.outline)])),a=[];for(let c of s){if(!c.length)continue;let u=c[0].map(([l,f])=>({x:l,y:f}));if(u.length>1){let l=u[0],f=u[u.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a.length?a:[n]}catch{return[n]}}function Bi(e,t){if(!t.length)return e;let n=i=>{let s=i.map(a=>[a.x,a.y]);return s.push(s[0]),s},o=t.map(i=>[n(i)]),r=[];for(let i of e){let s;try{s=Po.default.intersection([n(i.outline)],o.flat())}catch{r.push(i);continue}for(let a of s){if(!a.length)continue;let c=a[0].map(([u,l])=>({x:u,y:l}));if(c.length>1){let u=c[0],l=c[c.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&c.pop()}c.length>=3&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}function mu(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var In=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=Ye(t),i=this.rings.filter((c,u)=>Mt(r,this.boxes[u])&&mu(n,this.levels[u])),s=[[o]];if(i.length)try{s=Fi.default.difference([o],...i).map(u=>u.map(l=>l.map(([f,m])=>[f,m])))}catch{s=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let a=[];for(let c of s){if(!c.length)continue;let u=c[0].map(([l,f])=>({x:l,y:f}));if(u.length>1){let l=u[0],f=u[u.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a}};function Et(e,t,n=e){if(!t)return e;let o=1/0,r=-1/0,i=1/0,s=-1/0;for(let m of n)o=Math.min(o,m.x),r=Math.max(r,m.x),i=Math.min(i,m.y),s=Math.max(s,m.y);let a=(o+r)/2,c=(i+s)/2,u=t*Math.PI/180,l=Math.cos(u),f=Math.sin(u);return e.map(m=>{let h=m.x-a,d=m.y-c;return{x:a+h*l-d*f,y:c+h*f+d*l}})}function Ni(e){let t=ar(e);return!t.length||!e.points?.length?[]:t.map(n=>Et(n,e.rotation,e.points))}function ie(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3)return Et(en(e,4),e.rotation,e.points);if(e.kind==="rect"&&e.width&&e.height&&(t=jt(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=fn(n,o,e.width/2,e.height/2)}return t?Et(t,e.rotation):null}function Fe(e){let t=e.role??"",o=t==="stage"?{kind:"stage",heightM:Mr(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 hu=.08,du=30,pu=.015;function bu(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function Di(e,t){let n=ie(e)??(e.points?.length?Et(e.points,e.rotation):null),o=Fe(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(Ae(n))*$**2>=du?pu:o.heightM;if(!n)return{topOffsetM:i,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:i,supportOffsetM:0};let s=1/0,a=1/0,c=-1/0,u=-1/0;for(let h of n)s=Math.min(s,h.x),a=Math.min(a,h.y),c=Math.max(c,h.x),u=Math.max(u,h.y);let l=i,f=0,m=1e-6*Math.max(1,c-s,u-a);for(let h of t)c>h.minX&&s<h.maxX&&u>h.minY&&a<h.maxY&&l<=h.topOffsetM+1e-6&&(l=h.topOffsetM+hu),s>=h.minX-m&&c<=h.maxX+m&&a>=h.minY-m&&u<=h.maxY+m&&(!h.poly||n.every(y=>bu(y,h.poly)||yu(y,h.poly,m)))&&(f=Math.max(f,h.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:s,minY:a,maxX:c,maxY:u,topOffsetM:l,poly:n}),{topOffsetM:l,supportOffsetM:Math.min(f,l)}}function yu(e,t,n){for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],s=t[o],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u)):0;if(Math.hypot(e.x-(i.x+l*a),e.y-(i.y+l*c))<=n)return!0}return!1}function et(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function ve(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 we(e,t,n){return[et(e[0],e[1],t),et(e[0],e[1],n),et(e[3],e[2],n),et(e[3],e[2],t)]}function Yt(e,t,n){return[et(e[0],e[3],t),et(e[1],e[2],t),et(e[1],e[2],n),et(e[0],e[3],n)]}function ne(e,t,n,o,r,i,s){z(e,t,s?.length?s:void 0,()=>n,o,r,i,K)}var gu=.8,xu=.6,Mu=2;function tt(e,t){if(!t.length)return null;let n=[],o=0;for(let s of e.objects){if(s.type!=="shape"||s.role!=="wall")continue;let a=ie(s)??[],c=Gi(a)/2;!(c>0)||Iu(a)/c*E>Mu||(n.push(...a),o+=c)}if(n.length<3)return null;let r=Kt(n);if(r.length<3||o<Gi(r)*xu)return null;let i=0;for(let s of t)Ru(s,r)&&(i+=1);return i>=t.length*gu?r:null}var Rn=6,Su=5,Pu=8;function ji(e){return Math.max(Pu,(Number.isFinite(e)?e:0)+Su)}function At(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r++){let i=e[r],s=e[(r+1)%e.length],a=i.x*s.y-s.x*i.y;t+=a,n+=(i.x+s.x)*a,o+=(i.y+s.y)*a}if(Math.abs(t)<1e-9){let r=0,i=0;for(let s of e)r+=s.x,i+=s.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 Iu(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 Gi(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 Ru(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function wu(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 Eu(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 s=e[0],a=-1;for(let h of e){let d=Math.hypot(h.x-n,h.y-o);d>a&&(a=d,s=h)}let c=s.x-n,u=s.y-o,l=Math.hypot(c,u);l>1e-9?(c/=l,u/=l):(c=1,u=0);let f=[...e].sort((h,d)=>(h.x-n)*c+(h.y-o)*u-((d.x-n)*c+(d.y-o)*u)),m=0;for(let h of f){let d=Math.hypot(h.x-n,h.y-o);d>m&&(m=d)}return{pts:f,cx:n,cy:o,radius:m,depth:r}}function Hi(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 s=o[i],a=o[i+1],c=a.x-s.x,u=a.y-s.y,l=c*c+u*u,f=l>1e-12?((t-s.x)*c+(n-s.y)*u)/l:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(t-(s.x+f*c),n-(s.y+f*u));m<r&&(r=m)}return r}var wn=8;function Au(e,t,n){let o=new Array(wn).fill(1/0),r=new Array(wn).fill(-1);for(let l=0;l<e.length;l++){let f=e[l],m=Math.hypot(t-f.cx,n-f.cy)-f.radius;for(let h=0;h<wn;h++)if(m<o[h]){for(let d=wn-1;d>h;d--)o[d]=o[d-1],r[d]=r[d-1];o[h]=m,r[h]=l;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let l of r){if(l<0)continue;let f=Hi(e[l],t,n);for(let m=0;m<3;m++)if(f<i[m]){for(let h=2;h>m;h--)i[h]=i[h-1],s[h]=s[h-1];i[m]=f,s[m]=l;break}}if(s[0]<0)return 0;if(i[0]<1e-6)return e[s[0]].depth;let a=i[0]*2.2,c=0,u=0;for(let l=0;l<3;l++){let f=s[l];if(f<0||i[l]>a)continue;let m=1/(i[l]*i[l]);c+=m*e[f].depth,u+=m}return u>0?c/u:e[s[0]].depth}function _u(e){let t=(o,r)=>Au(e,o,r),n=(o,r)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let c=e[a];if(Math.hypot(o-c.cx,r-c.cy)-c.radius>=i)continue;let u=Hi(c,o,r);u<i&&(i=u,s=a)}return s};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,s=(t(o,r+.5)-t(o,r-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function Vi(e,t){let n=[];for(let o of e){let r=Eu(o.points,t);r&&n.push(r)}return n.length<2?wu(t):(n.sort((o,r)=>o.depth-r.depth),_u(n))}var nt=.06,vu=.05,Xi=.05,Ui=.15,Io=25;function Ki(e,t,n){let o=new Map,r=new Array(t.length).fill(null),i=new Float64Array(t.length),s=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0),c=new Map,u=[],l=new Set;for(let m=0;m<e.length;m+=1){let h=e[m];for(let d of h.objects){if(d.type==="table"&&l.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let p=Le(d.outline,Te);c.set(d.id,{section:d,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:d.id,floorIndex:m,box:Ye(p),section:d,unit:h,outline:p})}}let f=new Map;for(let m of u){let h=f.get(m.floorIndex);h?h.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let h=t[m],d=n?f.get(n[m])??[]:u,p=h.sectionId?d.find(g=>g.id===h.sectionId)??d.find(g=>g.section.logicalSectionId===h.sectionId&&Pe({x:h.x,y:h.y},g.outline,g.section.holes)):void 0,y=p?[p]:d;for(let g of y){if(n&&g.floorIndex!==n[m]||!p&&(h.x<g.box.minX||h.x>g.box.maxX||h.y<g.box.minY||h.y>g.box.maxY||!Pe({x:h.x,y:h.y},g.outline,g.section.holes)))continue;r[m]=g.id;let M=c.get(g.id);M.hasSeats=!0;let P=h.focalPoint??g.unit.focal,w=Math.hypot(h.x-P.x,h.y-P.y);w<M.frontU&&(M.frontU=w),M.seatIndices.push(m);let x=h.rowId||`__seat-${m}`,b=M.rows.get(x);b?b.push({x:h.x,y:h.y}):M.rows.set(x,[{x:h.x,y:h.y}]);break}}for(let[m,h]of c){let d=Qe(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,y=d.rake>0?Math.tan(d.rake*Math.PI/180):0,g=d.rake<=.01&&d.height<=p+.001,M=h.section.surfaceKind,P=M==="flat"?!0:M==="rakedRows"&&d.rake>.01?!1:g,w=h.hasSeats?tn(m,t,h.seatIndices,h.unit.focal):{sectionId:m,rows:[],blockCount:0},b=w.rows.length<2?Vi([...h.rows.values()].map(O=>({points:O})),h.unit.focal):null,S=1/0;if(b){if(h.hasSeats)for(let O of h.rows.values())for(let F of O){let D=b.depthAt(F.x,F.y);D<S&&(S=D)}if(!h.hasSeats||!Number.isFinite(S)){S=1/0;for(let O of h.section.outline){let F=b.depthAt(O.x,O.y);F<S&&(S=F)}}}let I=p+vu,R=Math.max(I,d.height),k=O=>{let F=Math.max(0,O-S)*$,D=Math.min(F*y,Io);return Math.max(I,d.height+D)},L=O=>{let F=Math.max(0,O)*$,D=Math.min(F*y,Io);return Math.max(I,d.height+D)},T=P?[]:w.rows.map(O=>({pts:O.pts,y:L(O.blockDepth),depth:O.blockDepth,blockId:O.blockId,...l.has(O.id)?{patch:wi(O.pts,Te)}:{}})),v=T.length?T[0].y:R,A=T.map(O=>{let F=O.patch&&O.patch.length>=3?O.patch:O.pts,D=0,j=0;for(let V of F)D+=V.x,j+=V.y;let N=F.length||1;D/=N,j/=N;let X=0;for(let V of F){let Z=Math.hypot(V.x-D,V.y-j);Z>X&&(X=Z)}return{cx:D,cy:j,rad:X}}),_=P?()=>R:T.length>=2?(O,F)=>{let D=1/0,j=v;for(let N=0;N<T.length;N++){let X=A[N];if(Math.hypot(O-X.cx,F-X.cy)-X.rad>=D)continue;let V=T[N].patch,Z=V&&V.length>=3?_e(V,O,F)?0:bt(V,O,F):bt(T[N].pts,O,F);Z<D&&(D=Z,j=T[N].y)}return j}:(O,F)=>b?k(b.depthAt(O,F)):R,C=[0,1,0],B=T.length>=2||P?()=>C:(O,F)=>{if(!b)return C;let D=b.depthAt(O,F);if(D<=S)return C;let j=(D-S)*$;if(j*y>=Io||d.height+j*y<=I)return C;let[N,X]=b.gradientAt(O,F);if(N===0&&X===0)return C;let V=1/Math.hypot(y,1);return[-N*y*V,V,-X*y*V]};if(!P)for(let O of w.rows){let F=L(O.blockDepth);for(let D of O.seatIndices)s[D]=F}for(let O of w.rows){let F=[];for(let V=1;V<O.pts.length;V++){let Z=Math.hypot(O.pts[V].x-O.pts[V-1].x,O.pts[V].y-O.pts[V-1].y);Z>1e-6&&F.push(Z)}F.sort((V,Z)=>V-Z);let D=F.length?F[Math.floor(F.length/2)]:1/0,j=1/0,N=O.pts[Math.floor(O.pts.length/2)];if(N)for(let V of w.rows){if(V===O||V.blockId!==O.blockId)continue;let Z=bt(V.pts,N.x,N.y);Z>1e-6&&Z<j&&(j=Z)}let X=Math.min(D,Math.max(j,D*.5));if(Number.isFinite(X)&&X>0)for(let V of O.seatIndices)a[V]=X}o.set(m,{sectionId:m,deckAt:_,normalAt:B,flat:P,bottomY:p,rowLevels:T,landingY:v})}for(let m=0;m<t.length;m++){let h=r[m],d=t[m];if(h){let g=s[m];i[m]=(g??o.get(h).deckAt(d.x,d.y))+Ui;continue}let p=d.eyeHeightM,y=Number.isFinite(p)?Math.max(0,p-je):0;i[m]=d.kind==="booth"?y+nt+Ui:y}return{bySection:o,seatOwner:r,seatDeckY:m=>i[m],seatPitchU:m=>a[m]}}function _t(e,t,n){if(e.length!==4||n<=t)return null;let o=ve(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*E,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*E;if(r<1e-6||i<1e-6)return null;let s=Math.min(.22/r,.16),a=Math.min(.28,(n-t)*.13),c=Math.min(.065/i,.2);return{quad:o,side:s,face:c,opening:we(o,s,1-s),openingTop:n-a}}function Ro(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=ve(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*E;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),s=i/r,a=we(o,s,1-s);return{quad:o,side:s,trim:i,inner:a,panel:Yt(a,.15,.85),bottom:t+i,top:n-i}}function Yi(e,t,n,o){let r=Ro(e,t,n);if(!r)return;let{panel:i}=r,s=(M,P)=>({x:(M.x+P.x)/2,y:(M.y+P.y)/2}),a=s(i[0],i[1]),c=s(i[3],i[2]),u=Math.hypot(a.x-o.x,a.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[l,f]=u?[i[0],i[1]]:[i[3],i[2]],m=u?{x:a.x-c.x,y:a.y-c.y}:{x:c.x-a.x,y:c.y-a.y},h=Math.hypot(m.x,m.y);if(h<1e-6)return;-(f.y-l.y)*m.x+(f.x-l.x)*m.y<0&&([l,f]=[f,l]);let d=Math.min(.006,h*E*.05),p=m.x/h*d,y=m.y/h*d,g=(M,P)=>[M.x*E+p,P,M.y*E+y];return[g(l,r.bottom),g(f,r.bottom),g(l,r.top),g(f,r.top)]}var zi=Ge(require("polygon-clipping"),1);var Wi=Ge(require("polygon-clipping"),1);function We(e,t,n,o,r,i,s,a={}){let c=Ye(t),u=a.ao??K,l=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let y=ie(p);if(!y||y.length!==4||!Mt(c,Ye(y)))return[];let g=a.portalBase??n,M=_t(y,g,g+Fe(p).heightM);if(!M)return[];let P=Math.min(o,M.openingTop);return P<=n?[]:[{poly:M.opening,height:P}]});if(!l.length)return!1;let f=p=>p.map(y=>[y.x,y.y]),m=[f(t),...(a.holes??[]).map(f)],h=[n,...new Set(l.map(p=>p.height)),o].sort((p,y)=>p-y),d=[];try{for(let p=1;p<h.length;p++){let y=h[p-1],g=h[p];if(g-y<1e-6)continue;let M=l.filter(w=>w.height>y+1e-6).map(w=>[f(w.poly)]),P=M.length?Wi.default.difference(m,...M):[m];d.push({low:y,high:g,polys:P})}}catch{return!1}for(let p of d)for(let y of p.polys){let[g,...M]=y.map(w=>w.map(([x,b])=>({x,y:b}))),P=w=>u.wallBottom+(u.top-u.wallBottom)*(w-n)/(o-n);z(e,g,M,()=>p.high,p.low,i,s,{...u,top:P(p.high),wallBottom:P(p.low)})}return!0}var wo={depthM:1.6,thicknessM:.35,minWallM:6};function En(e,t,n,o,r,i,s,a,c){let u=o-n;if(u<=0)return;let l=a&&(c??u)>=wo.minWallM?Cu(t,a):null,f=l?o-wo.thicknessM:o,m=f-n,h=m<1.5?[[n,f,1]]:l?[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),f,1]]:[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),f-.1,1],[f-.1,f,1.1]],d=p=>K.wallBottom+(K.top-K.wallBottom)*(p-n)/u;for(let[p,y,g]of h){let M={...K,top:d(y),wallBottom:d(p)},P=W(i,g),w=W(s,g);We(e,t,p,y,r,P,w,{portalBase:n,ao:M})||z(e,t,void 0,()=>y,p,P,w,M)}for(let[p,...y]of l??[])z(e,p,y.length?y:void 0,()=>o,f,W(i,1.12),W(s,.78),K)}function Cu(e,t){let n=wo.depthM/E,o=e.map(s=>{let a=t.x-s.x,c=t.y-s.y,u=Math.hypot(a,c)||1;return{x:s.x+a/u*n,y:s.y+c/u*n}}),r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=[[r(e)],[r(o)]];for(let s=0;s<e.length;s++){let a=(s+1)%e.length;i.push([r([e[s],e[a],o[a],o[s]])])}try{let[s,...a]=i,c=zi.default.union(s,...a);return c.length?c.map(u=>u.map(l=>l.slice(0,-1).map(([f,m])=>({x:f,y:m})))):null}catch{return null}}function Zi(e){return e.route?.stepFree===!0&&(e.kind==="line"||e.kind==="polyline")}function $i(e){let t=Number.isFinite(e)&&e>0?e:4;return[Math.max(6,t*2.6),Math.max(4,t*1.7)]}function Qi(e,t,n){let o=[];if(e.length<2||!(t>0)||!(n>=0))return o;let r=!0,i=t;for(let s=0;s<e.length-1;s+=1){let a=e[s],c=e[s+1],u=Math.hypot(c.x-a.x,c.y-a.y);if(u<1e-9)continue;let l=(c.x-a.x)/u,f=(c.y-a.y)/u,m=0;for(;m<u-1e-9;){let h=Math.min(i,u-m);r&&o.push([{x:a.x+l*m,y:a.y+f*m},{x:a.x+l*(m+h),y:a.y+f*(m+h)}]),m+=h,i-=h,i<=1e-9&&(r=!r,i=r?t:n)}}return o}function Wt(e,t,n){let o=oe(t.stroke?.color),r=t.stroke?.width??0;if(!o||!Number.isFinite(r)||r<=0)return;let i=t.kind==="line"||t.kind==="polyline",s=i?Et(t.points??[],t.rotation):ie(t);if(!s||s.length<2)return;let a=r*.5,c=Zi(t)?Qi(s,...$i(r)):Array.from({length:i?s.length-1:s.length},(u,l)=>[s[l],s[(l+1)%s.length]]);for(let[u,l]of c){let f=Math.hypot(l.x-u.x,l.y-u.y);if(f<1e-6)continue;let m=-(l.y-u.y)/f*a,h=(l.x-u.x)/f*a,d=[(u.x+m)*E,n,(u.y+h)*E],p=[(l.x+m)*E,n,(l.y+h)*E],y=[(l.x-m)*E,n,(l.y-h)*E],g=[(u.x-m)*E,n,(u.y-h)*E];e.tri(d,p,y,[0,1,0],o),e.tri(d,y,g,[0,1,0],o)}}function qi(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var vt=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function An(e,t,n,o){let[r,i,s,a]=t?e:[e[3],e[2],e[1],e[0]];return[vt(r,a,n),vt(i,s,n),vt(i,s,o),vt(r,a,o)]}function Ji(e,t,n,o,r,i,s,a,c=!1){if(n.length!==4||r-o<.4)return!1;let u=I=>c?Math.min(I,r):I,l=ve(n),f=Math.hypot(l[3].x-l[0].x,l[3].y-l[0].y)*E;if(f<.4)return!1;let m=vt(l[0],l[1],.5),h=vt(l[3],l[2],.5),d=Math.hypot(m.x-a.x,m.y-a.y)<=Math.hypot(h.x-a.x,h.y-a.y),p=re(s,[.92,.9,.86],.35),y=W(i,.72),g=r-o;if(t==="restroom"){let I=Math.min(.18,g*.08);return ne(e,l,r-I,o,s,i),ne(e,l,r,r-I,p,p),!0}let M=o+Math.min(1.1,g),P=t==="coat"?1:Math.min(.5,.75/f),w=An(l,d,0,P);if(ne(e,w,M-.05,o,y,i),ne(e,w,M,M-.05,p,p),t==="coat"||f<1.2)return!0;if(t==="bar"){let I=An(l,d,Math.max(P+.2,1-.45/f),1),R=u(o+Math.max(Math.min(2.2,g*2),M-o+.6));return ne(e,I,R,o,s,y),!0}let x=An(l,d,Math.max(P+.25,.55),1),b=u(o+Math.max(2.6,M-o+1.4));if(b-.14<=M)return!0;ne(e,x,b-.14,o,s,i),ne(e,l,b,b-.14,p,y);let S=Math.min(.08,.1/Math.max(.1,Math.hypot(l[1].x-l[0].x,l[1].y-l[0].y)*E));for(let[I,R]of[[0,S],[1-S,1]])ne(e,An(we(l,I,R),d,0,Math.min(.08,.1/f)),b-.14,M,y,y);return!0}var ku=[.12,.38,.16],Ou=[.72,.62,.45],Tu=[.88,.93,.96],es=[.95,.95,.94],Lu=[.66,.29,.22],Eo={length:20.12,width:3.05},Bu=.14,Fu=9.76,ze=[.93,.94,.95],_n=[.1,.11,.13],Nu=[.45,.85,1.25],Du=1.45,ts=.012,ns=.004,Gu=1.07,ju=.15;function kt(e,t,n,o,r,i){e.setMaterial(i),z(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,K)}var os=(e,t)=>Je(e,t/E);function rs(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 s=-r/i*n,a=o/i*n;return[{x:e.x+s,y:e.y+a},{x:t.x+s,y:t.y+a},{x:t.x-s,y:t.y-a},{x:e.x-s,y:e.y-a}]}function Hu(e,t,n,o){let r=t.map(i=>[i.x*E,n,i.y*E]);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 vn(e,t,n,o,r,i){let s=n/E,a=[{x:t.x-s,y:t.y-s},{x:t.x+s,y:t.y-s},{x:t.x+s,y:t.y+s},{x:t.x-s,y:t.y+s}];z(e,a,void 0,()=>r,o,i,W(i,.85),K)}function Ct(e,t,n,o,r,i,s){let a=rs(t,n,o/E);a&&z(e,a,void 0,()=>i,r,s,W(s,.85),K)}function Cn(e){let t=ve(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},s={x:(t[3].x-t[0].x)/r,y:(t[3].y-t[0].y)/r};return{at:(c,u)=>({x:n.x+(i.x*c+s.x*u)/E,y:n.y+(i.y*c+s.y*u)/E}),lengthM:o*E,widthM:r*E}}function is(e,t,n){let o=Sr(t);if(!o.length)return;let r=1/0,i=-1/0,s=1/0,a=-1/0;for(let P of t.points??[])r=Math.min(r,P.x),i=Math.max(i,P.x),s=Math.min(s,P.y),a=Math.max(a,P.y);let c=(t.rotation??0)*Math.PI/180,u=Math.cos(c),l=Math.sin(c),f=(r+i)/2,m=(s+a)/2,h=P=>c?{x:f+(P.x-f)*u-(P.y-m)*l,y:m+(P.x-f)*l+(P.y-m)*u}:P,d=Math.min(i-r,a-s)*E,p=Math.max(.04,Math.min(.3,d*.004))/E,y=0;e.setMaterial(0);for(let P of o){if(!P.fill)continue;let w=P.points.map(h);kt(e,w,null,n+ts+y*ns,oe(P.fill)??ze,0),y++}let g=o.filter(P=>!(P.fill&&P.ink===P.fill)),M=[...new Set(g.map(P=>P.ink??on))];for(let P of M){let w=n+ts+y++*ns,x=oe(P)??ze;for(let b of g){if((b.ink??on)!==P)continue;let S=b.points.map(h),I=b.closed?S.length:S.length-1;for(let R=0;R<I;R++){let k=rs(S[R],S[(R+1)%S.length],p);k&&Hu(e,k,w,x)}}}}function ss(e,t,n,o,r){if(t.length<3)return!1;let i=o+.006,s=r??ku;if(n==="oval-cricket"){let a=t.reduce((x,b)=>x+b.x,0)/t.length,c=t.reduce((x,b)=>x+b.y,0)/t.length,u=x=>t.map(b=>({x:a+(b.x-a)*x,y:c+(b.y-c)*x})),l=8;for(let x=0;x<l;x++){let b=u(1-x/l),S=x===l-1?null:u(1-(x+1)/l);kt(e,b,S,i,W(s,x%2?1.04:.96),4)}let f=t[0];for(let x of t)Math.hypot(x.x-a,x.y-c)>Math.hypot(f.x-a,f.y-c)&&(f=x);let m=Math.hypot(f.x-a,f.y-c)||1,h=(f.x-a)/m,d=(f.y-c)/m,p=-d,y=h,g=Math.min(1,2*m*E*Bu/Eo.length),M=Eo.length*g/2/E,P=Eo.width*g/2/E,w=[[-M,-P],[M,-P],[M,P],[-M,P]].map(([x,b])=>({x:a+h*x+p*b,y:c+d*x+y*b}));return kt(e,w,null,i+.004,Ou,0),e.setMaterial(0),!0}if(n==="rink-hockey"){let a=os(t,ju);return kt(e,a,null,i,Tu,0),e.setMaterial(0),z(e,t,[a.slice().reverse()],()=>o+Gu,o,es,W(es,.9),K),!0}if(n==="ring-boxing"&&t.length===4){let{at:a}=Cn(t),c=[a(-3.05,-3.05),a(3.05,-3.05),a(3.05,3.05),a(-3.05,3.05)],u=[[.77,.19,.19],ze,[.17,.42,.69],ze];e.setMaterial(0),c.forEach((l,f)=>vn(e,l,.07,o,o+Du,u[f]));for(let l of Nu)for(let f=0;f<4;f++)Ct(e,c[f],c[(f+1)%4],.025,o+l-.025,o+l+.025,ze);return!0}if(n==="court-tennis"&&t.length===4){let{at:a}=Cn(t);e.setMaterial(0),Ct(e,a(0,-6.4),a(0,6.4),.015,o,o+.95,_n),Ct(e,a(0,-6.4),a(0,6.4),.03,o+.95,o+1,ze);for(let c of[-1,1])vn(e,a(0,c*6.4),.05,o,o+1.07,_n);return!0}if(n==="court-basketball"&&t.length===4){let{at:a,lengthM:c}=Cn(t),u=Math.min(14,c/2-.5);e.setMaterial(0);for(let l of[-1,1]){let f=a(l*(u+1.2),0),m=a(l*(u-1.2),0);vn(e,f,.12,o,o+3.4,_n),Ct(e,f,m,.06,o+3.25,o+3.4,_n),Ct(e,a(l*(u-1.2),-.9),a(l*(u-1.2),.9),.03,o+2.9,o+3.95,ze)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:a,lengthM:c}=Cn(t),u=c*(50/120);e.setMaterial(0);for(let l of[-1,1]){for(let f of[-2.8,2.8])vn(e,a(l*u,f),.07,o,o+12,ze);Ct(e,a(l*u,-2.8),a(l*u,2.8),.06,o+2.94,o+3.06,ze)}return!0}if(n==="track-athletics"){let a=os(t,Fu);return a.length<3?!1:(kt(e,t,a,i,Lu,0),kt(e,a,null,i,s,4),e.setMaterial(0),!0)}return!1}var as=[.19,.4,.15],Vu=.012,Ln=2.4,Uu=1,Xu=.75,Ku=.15;function Ne(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,s=Math.cos(i),a=Math.sin(i),c=n/2,u=o/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,f])=>({x:t.x+l*s-f*a,y:t.y+l*a+f*s}))}function ds(e,t,n,o,r,i,s=!1){let a=Ne(t);if(a){if(s){let c=mt(o,r.boothTop),u=He([...a]);z(e,Le(u,Yu/E),[u.slice().reverse()],()=>n+.03,n,c,W(c,.8),K);return}if(!(!t.points&&i&&zu(e,a,n,o,i))){if(!t.points&&i&&a.length===4){Wu(e,a,n,o,i);return}z(e,a,void 0,()=>n+Ln,n,mt(o,r.boothTop),r.boothWall,K)}}}var Ao=1.1,cs=[.9,.9,.88],Yu=.1,kn=[.87,.87,.85],ls=.08;function ps(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 u=n(c),l=Math.hypot(u.x-t.x,u.y-t.y);l<r&&(r=l,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),s=(c,u,l)=>({x:c.x+(u.x-c.x)*l,y:c.y+(u.y-c.y)*l});return{q:i,part:(c,u,l,f)=>{let m=s(i[0],i[1],c),h=s(i[0],i[1],u),d=s(i[3],i[2],c),p=s(i[3],i[2],u);return[s(m,d,l),s(h,p,l),s(h,p,f),s(m,d,f)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*E,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*E}}function Wu(e,t,n,o,r){let{q:i,part:s}=ps(t,r),a=o??[.35,.42,.55],c=re(a,[.78,.78,.77],.62),u=re(a,[.95,.95,.94],.45);ne(e,i,n+nt,n,c,W(c,.8)),ne(e,s(.05,.95,.72,.98),n+Ao-.05,n+nt,u,W(u,.8)),ne(e,s(.03,.97,.7,1),n+Ao,n+Ao-.05,cs,W(cs,.9))}function zu(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:s,depthM:a,widthM:c}=ps(t,r);if(a<1||c<1)return!1;let u=o??[.35,.42,.55],l=re(u,[.78,.78,.77],.62),f=n+Ln,m=ls/c,h=ls/a;ne(e,i,n+nt,n,l,W(l,.8)),ne(e,s(0,1,1-h,1),f,n+nt,kn,W(kn,.9));for(let[y,g]of[[0,m],[1-m,1]])ne(e,s(y,g,0,1-h),f,n+nt,kn,W(kn,.9));ne(e,s(m,1-m,0,Math.min(.5,.06/a)),f,f-.3,u,W(u,.85));let d=Math.min(.4,.6/c),p=Math.min(.12,.3/a);return ne(e,s(.5-d,.5+d,.72-p,.72+p),n+Uu,n+nt,re(u,[.95,.95,.94],.7),W(u,.75)),!0}function Bn(e){if(e.shape==="round"){let l=e.radius;return l?fn(e.center.x,e.center.y,l,l,24):null}let{width:t,height:n,rotation:o,center:r}=e;if(!t||!n)return null;let i=(o??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),c=t/2,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,f])=>({x:r.x+l*s-f*a,y:r.y+l*a+f*s}))}function bs(e,t,n,o,r,i=!0){let s=Bn(t);if(!s)return;let a=s.reduce((m,h)=>m+h.x,0)/s.length,c=s.reduce((m,h)=>m+h.y,0)/s.length,u=m=>s.map(h=>({x:a+(h.x-a)*m,y:c+(h.y-c)*m})),l=i&&o?mt(o,r.tableTop):Zu,f=n+Xu;z(e,s,void 0,()=>f,n+$u,l,W(l,.86),K),z(e,u(.12),void 0,()=>f+.12,f,us,W(us,.8),K)}var Zu=[.93,.92,.89],us=[.78,.66,.42],$u=.25,zt={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function Qu(e,t,n){let o=e.reduce((g,M)=>g+M.x,0)/4,r=e.reduce((g,M)=>g+M.y,0)/4,i=e[3].x-e[0].x,s=e[3].y-e[0].y,a=Math.hypot(i,s)||1;i/=a,s/=a,i*(t.x-o)+s*(t.y-r)<0&&(i=-i,s=-s);let c=-s,u=i,l=zt.armM/E,f=zt.widthM/E,m=a/2+zt.insideM/E,h=n?-1:1,d=o+i*(m+(n?0:l)),p=r+s*(m+(n?0:l)),y=(g,M)=>({x:d+i*g*h+c*M,y:p+s*g*h+u*M});return[y(0,0),y(-l,l),y(-l-f,l),y(-f,0),y(-l-f,-l),y(-l,-l)]}function qu(e,t,n,o,r){let i=[.94,.95,.96];z(e,Qu(t,o,r),void 0,()=>n+zt.high,n+zt.low,i,i,K)}function Tn(e,t){let n=oe(e);return n?{top:W(Ve(n,.12),.95),wall:W(Ve(n,.12),.85)}:{top:t.tierTop,wall:t.tierWall}}function ys(e,t,n,o,r,i,s,a,c=[]){let u=ie(t),l=Ni(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!u){Wt(e,t,n+o+Vu);return}let m=a?a.kind==="stage":t.role==="stage",h=a?a.kind==="screen":t.role==="screen",d=a?{kind:m?"stage":"solid",heightM:a.topY-a.baseY}:Fe(t),p=a?.baseY??n,y=a?.topY??n+o;if(m&&s){let T=1/0,v=-1/0,A=1/0,_=-1/0;for(let C of u)C.x<T&&(T=C.x),C.x>v&&(v=C.x),C.y<A&&(A=C.y),C.y>_&&(_=C.y);s.push({cx:(T+v)/2*E,cz:(A+_)/2*E,y,halfX:Math.max((v-T)/2*E,.5),halfZ:Math.max((_-A)/2*E,.5)})}let g=oe(t.fill),M=t.role==="wall"||t.role==="entrance"||t.role==="exit",P=M?Tn(t.fill,r).top:m&&g?re(r.stageTop,W(Ve(g,.18),.9),.9):!t.role&&g?g:mt(g,m?r.stageTop:r.decorTop),w=h?g:null,x=M?Tn(t.fill,r).wall:m?g?re(r.stageWall,W(g,.58),.82):r.stageWall:h?w?re(W(w,1.42),[.24,.46,.82],.08):[.24,.46,.82]:mt(oe(t.fill),r.decorWall),b=m&&bn(r)?xt(!0):null,S=b?hs(P,b.stageTop):P,I=b?hs(x,b.stageWall):x;if(t.role==="wall"&&!a){En(e,u,p,y,c,S,I,i),Wt(e,t,y+.012);return}if(h&&u.length===4&&y-p>.2){let T=Ro(u,p,y);if(!T)return;let{quad:v,side:A,trim:_,inner:C,panel:B}=T,O=[.12,.15,.18];for(let[F,D]of[[0,A],[1-A,1]])ne(e,we(v,F,D),y,p,O,O);ne(e,C,p+_,p,O,O),ne(e,C,y,y-_,O,O),ne(e,B,y-_,p+_,I,I),Wt(e,t,y+.012);return}let R=g?W(Ve(g,.15),.82):I,k=g?W(Ve(g,.1),1.02):S;if(qi(t.role)&&!a&&Ji(e,t.role,u,p,y,R,k,i,t.heightM!==void 0))return;if((t.role==="sound"||a?.kind==="sound_desk")&&u.length===4&&y-p>.3){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.min(.12,.09/Math.max(v,.001)),_=[.18,.21,.24],C=y-Math.min(.12,(y-p)*.15);for(let[B,O]of[[0,A],[1-A,1]])ne(e,we(T,B,O),C,p,_,_);ne(e,T,y,C,S,_);return}if(t.role==="rail"&&u.length===4&&y>p){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.max(1,Math.min(128,Math.ceil(v/1.4))),_=Math.min(.08,.055/Math.max(.055,v)),C=[.58,.64,.66];for(let B=0;B<=A;B++){let O=B/A,F=Math.min(1-_,Math.max(0,O-_/2));ne(e,we(T,F,F+_),y,p,C,W(C,.8))}for(let B of[.52,1]){let O=p+(y-p)*B;ne(e,T,O,Math.max(p,O-.055),C,W(C,.8))}return}if(t.role==="goal"&&u.length===4){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.min(.12,.1/Math.max(.1,v)),_=[.9,.94,.94];for(let[C,B]of[[0,A],[1-A,1]])ne(e,we(T,C,B),Math.max(p,y-.1),p,_,_);ne(e,T,y,Math.max(p,y-.1),_,_);return}if(d.kind==="portal"&&u.length===4){let T=_t(u,p,y);if(!T)return;let{quad:v,side:A,face:_,openingTop:C}=T;for(let[B,O,F]of[[0,_,1],[_,1-_,.67],[1-_,1,1]]){let D=Yt(v,B,O),j=W(S,F),N=W(I,F);for(let[X,V]of[[0,A],[1-A,1]])ne(e,we(D,X,V),C,p,j,N);ne(e,D,y,C,j,N)}(t.role==="entrance"||t.role==="exit")&&qu(e,v,p,i,t.role==="exit");return}if(d.kind==="suite"&&u.length===4){let T=u.map((_,C)=>{let B=u[(C+1)%4],O=(_.x+B.x)/2,F=(_.y+B.y)/2;return Math.hypot(O-i.x,F-i.y)}),v=T.indexOf(Math.min(...T)),A=[0,1,2,3].map(_=>u[(v+_)%4]);ne(e,we(A,0,.08),y,p,S,I),ne(e,we(A,.92,1),y,p,S,I),ne(e,Yt(A,.88,1),y,p,S,I),ne(e,A,y,Math.max(p,y-.18),S,I);return}if(m&&!t.stageKind?.startsWith("pitch-")&&y-p>.12){let T=y-Math.min(.06,(y-p)*.15);ne(e,u,T,p,S,I,l),ne(e,u,y,T,S,re(S,I,.2),l)}else ne(e,u,y,p,S,I,l);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&u.length===4){e.setMaterial(4);let T=ve(u),v=re(g??as,as,g?.45:0);for(let A=0;A<12;A++){let _=we(T,A/12,(A+1)/12),C=W(v,A%2?1.09:.91),B=_.map(O=>[O.x*E,y+.006,O.y*E]);e.tri(B[0],B[1],B[2],[0,1,0],C),e.tri(B[0],B[2],B[3],[0,1,0],C)}}t.stageKind&&t.stageKind!=="pitch-football"&&ss(e,u,t.stageKind,y,g),m&&st(t.stageKind)&&is(e,t,y),e.setMaterial(h?1:0),Wt(e,t,y+.012)}function Fn(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,s=n+r/2,a=(e.rotation??0)*Math.PI/180,c=Math.cos(a),u=Math.sin(a),l=o/2,f=r/2;return[[-l,-f],[l,-f],[l,f],[-l,f]].map(([m,h])=>({x:i+m*c-h*u,y:s+m*u+h*c}))}function Ju(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 oe(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 s=[];for(let a of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=oe(a[1].trim());c&&s.push(c)}return s.length?s.reduce((a,c,u)=>re(a,c,1/(u+1)),s[0]):null}function gs(e,t,n,o){if(t.layer==="foreground")return;let r=Fn(t);if(!r)return;let i=n+Ku,s=mt(Ju(t.href),o.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=re(o.ground,s,a)),z(e,r,void 0,()=>i,n,s,re(s,o.decorWall,.5),K)}function xs(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=li(o,r.gaTop);z(e,t.points,t.holes,()=>n+fs,n,i,r.gaWall,K),nf(e,t.points,n+fs)}var fs=.15,On=[.72,.74,.76],_o=1.1,ms=.12,vo=.05,ef=.06,tf=2.4;function nf(e,t,n){let o=He([...t]),r=Je(o,ms/E),i=Je(o,(ms+vo)/E);if(r.length<3||i.length<3)return;for(let a of[n+_o,n+_o*.5])z(e,r,[i.slice().reverse()],()=>a,a-vo,On,W(On,.85),K);let s=ef/2/E;for(let a=0;a<r.length;a++){let c=r[a],u=r[(a+1)%r.length],l=Math.hypot(u.x-c.x,u.y-c.y)*E,f=Math.max(1,Math.round(l/tf));for(let m=0;m<f;m++){let h=m/f,d=c.x+(u.x-c.x)*h,p=c.y+(u.y-c.y)*h,y=[{x:d-s,y:p-s},{x:d+s,y:p-s},{x:d+s,y:p+s},{x:d-s,y:p+s}];z(e,y,void 0,()=>n+_o-vo,n,On,W(On,.8),K)}}}function hs(e,t){return mn(e)<t?ut(e,t):e}var Co=.6,Ms=3,of=.25;function rf(e,t){if(_e(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],s=t[o],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c||1,l=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u));n=Math.min(n,Math.hypot(e.x-(i.x+l*a),e.y-(i.y+l*c)))}return n}function Ss(e,t){let n=e.map(s=>({booth:s,ring:Ne(s)})).filter(s=>!!s.ring&&s.ring.length===4&&!s.booth.points),o=n.map(({ring:s})=>({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))})),r=(Ms+Co)/E,i=new Map;return n.forEach(({booth:s,ring:a},c)=>{let u={x:a.reduce((h,d)=>h+d.x,0)/4,y:a.reduce((h,d)=>h+d.y,0)/4},l=[0,1,2,3].map(h=>{let d=a[h],p=a[(h+1)%4],y={x:(d.x+p.x)/2,y:(d.y+p.y)/2},g=y.x-u.x,M=y.y-u.y,P=Math.hypot(g,M)||1,w={x:y.x+g/P*Co/E,y:y.y+M/P*Co/E},x=Ms/E;return o.forEach((b,S)=>{S===c||w.x<b.minX-r||w.x>b.maxX+r||w.y<b.minY-r||w.y>b.maxY+r||(x=Math.min(x,rf(w,n[S].ring)))}),{open:x*E,toward:{x:y.x+g/P*10/E,y:y.y+M/P*10/E},focal:Math.hypot(y.x-t.x,y.y-t.y)}}),f=Math.max(...l.map(h=>h.open)),m=l.filter(h=>h.open>=f-of).sort((h,d)=>h.focal-d.focal)[0];i.set(s.id,m.toward)}),i}var Ps=Ge(require("polygon-clipping"),1);var sf=.45,af=1500,cf=200;function Is(e,t){if(e.role!=="stage"||st(e.stageKind))return e;let n=ie(e);if(!n||n.length<3||Math.abs(Ae(n))*E*E>af)return e;let o=t.filter(s=>_e(n,s.x,s.y));if(!o.length||o.length>cf)return e;let r=sf/E,i=o.map(s=>[[[s.x-r,s.y-r],[s.x+r,s.y-r],[s.x+r,s.y+r],[s.x-r,s.y+r],[s.x-r,s.y-r]]]);try{let s=Ps.default.difference([[...n.map(u=>[u.x,u.y]),[n[0].x,n[0].y]]],...i),a=null,c=0;for(let u of s){let l=u[0].slice(0,-1).map(([m,h])=>({x:m,y:h})),f=Math.abs(Ae(l));f>c&&(c=f,a=l)}return!a||a.length<3?e:{...e,kind:"polygon",points:a,rotation:0}}catch{return e}}var lf=Math.PI/180,se=96,uf=6,ff=60,mf=150,Rs=.2,hf=.35;function df(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/lf;return n<0?n+360:n}function Nn(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function Dn(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let s=0,a=0;for(let c=-n;c<=n;c++){let u=i+c;if(t)u=(u%o+o)%o;else if(u<0||u>=o)continue;s+=e[u],a++}r[i]=s/a}return r}function ws(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let o=[],r=0,i=0,s=0;for(let m of n)for(let h of m.rows){for(let d of h.pts)r+=d.x,i+=d.y,s++;if(h.pts.length>=4){let d=qn(h.pts);d&&Number.isFinite(d.cx)&&Number.isFinite(d.cy)&&o.push({x:d.cx,y:d.cy})}}if(!s)return null;let a={x:r/s,y:i/s},c=a;if(o.length>=8){let m=Nn(o.map(g=>g.x)),h=Nn(o.map(g=>g.y)),d=0;for(let g of n)for(let M of g.rows)for(let P of M.pts){let w=Math.hypot(P.x-a.x,P.y-a.y);w>d&&(d=w)}let p=0,y=d*.2;for(let g of n)for(let M of g.rows)for(let P of M.pts)Math.hypot(P.x-m,P.y-h)<y&&p++;Math.hypot(m-a.x,h-a.y)<=d&&p/s<.01&&(c={x:m,y:h})}let u=[];for(let m of n){let h={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of m.rows)for(let p of d.pts){let y=Math.hypot(p.x-c.x,p.y-c.y),g=Math.min(se-1,Math.floor(df(c,p)/(360/se)));h.samples.push({r:y,bin:g,levelM:d.levelM}),y<h.rMin&&(h.rMin=y),y>h.rMax&&(h.rMax=y)}h.samples.length&&u.push(h)}if(!u.length)return null;u.sort((m,h)=>m.rMin+m.rMax-(h.rMin+h.rMax));let l=[];for(let m of u){let h=!1;for(let d of l){let p=Math.min(m.rMax,d.rMax)-Math.max(m.rMin,d.rMin),y=Math.min(m.rMax-m.rMin,d.rMax-d.rMin);if(y>1e-9&&p>=hf*y){d.members.push(m),d.rMin=Math.min(d.rMin,m.rMin),d.rMax=Math.max(d.rMax,m.rMax),h=!0;break}}h||l.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let f=[];for(let m of l){let h=new Array(se).fill(null);for(let v of m.members)for(let A of v.samples){let _=h[A.bin];_||(_={samples:[]},h[A.bin]=_),_.samples.push({r:A.r,levelM:A.levelM})}let d=h.map(v=>!!v);if(!d.filter(Boolean).length)continue;let y=[],g=[];for(let v of h){if(!v)continue;let A=1/0,_=-1/0;for(let C of v.samples)C.r<A&&(A=C.r),C.r>_&&(_=C.r);y.push(A),g.push(_)}let M=Nn(y),P=Nn(g);if(!(M>=Rs*P)||!(P>0))continue;let w=[...y].sort((v,A)=>v-A);if(!(w[Math.floor(w.length*.1)]>=Rs*P))continue;let b=h.map(v=>{if(!v)return null;let A=[...v.samples].sort((N,X)=>N.r-X.r),_=A[0].r,C=A[A.length-1].r,B=A[0].levelM,O=-1/0;for(let N of A)N.levelM>O&&(O=N.levelM);let F=[];for(let N of A){let X={r:N.r,l:N.levelM};for(;F.length&&Math.abs(F[F.length-1].r-X.r)<1e-9;){if(F[F.length-1].l<=X.l){X.skip=!0;break}F.pop()}if(!X.skip){for(;F.length>=2;){let V=F[F.length-2],Z=F[F.length-1];if((Z.r-V.r)*(X.l-V.l)-(Z.l-V.l)*(X.r-V.r)<=0)F.pop();else break}F.push(X)}}let D=F.map(N=>N.r),j=F.map(N=>N.l);return{inner:_,outer:C,front:B,top:O,profile:{rs:D,ls:j}}}),S=d.slice();for(let v=0;v<se;v++){if(S[v])continue;let A=-1,_=-1,C=0;for(let U=1;U<=se;U++){let te=(v-U+se*2)%se;if(S[te]){A=te;break}}for(let U=1;U<=se;U++){let te=(v+U)%se;if(S[te]){_=te,C=U;break}}if(A<0||_<0)continue;let B=0;for(let U=1;U<=se;U++){let te=(v-U+se*2)%se;if(d[te]){B=U;break}}if(B-1+C>uf)continue;let F=b[A],D=b[_],j=B/(B+C),N=F.inner+(D.inner-F.inner)*j,X=F.outer+(D.outer-F.outer)*j,V=F.front+(D.front-F.front)*j,Z=F.top+(D.top-F.top)*j;b[v]={inner:N,outer:X,front:V,top:Z,profile:{rs:[N,X],ls:[V,Z]}}}for(let v=0;v<se;v++)b[v]&&(S[v]=!0);let I=360/se,R=[],k=S.filter(Boolean).length,L=[];if(k===se)L.push({start:0,len:se});else{let v=0;for(;S[v];)v=(v+1)%se;let A=-1;for(let _=0;_<=se;_++){let C=(v+_)%se,B=_<se&&S[C];if(B&&A<0)A=C;else if(!B&&A>=0){let O=(C-A+se)%se||se;L.push({start:A,len:O}),A=-1}}}for(let v of L){if(v.len*I<ff&&v.len<se)continue;let A=v.len===se,_=new Float64Array(v.len),C=new Float64Array(v.len),B=new Float64Array(v.len),O=new Float64Array(v.len),F=[];for(let U=0;U<v.len;U++){let te=b[(v.start+U)%se];_[U]=te.inner,C[U]=te.outer,B[U]=te.front,O[U]=te.top,F.push(te.profile??{rs:[te.inner,te.outer],ls:[te.front,te.top]})}let D=Dn(_,A),j=Dn(C,A),N=Dn(B,A),X=Dn(O,A);for(let U=0;U<v.len;U++)D[U]>_[U]&&(D[U]=_[U]),j[U]<C[U]&&(j[U]=C[U]),D[U]>j[U]-1e-6&&(D[U]=Math.max(0,j[U]-1e-6)),X[U]<N[U]&&(X[U]=N[U]);let V={startBin:v.start,binCount:v.len,closed:A,innerR:D,outerR:j,frontLevelM:N,topLevelM:X,profiles:F},Z=(U,te,Q)=>{let fe=F[U],ue=fe.rs,G=fe.ls;if(te<=ue[0]){G[0]>Q&&(G[0]=Q);return}if(te>=ue[ue.length-1]){G[G.length-1]>Q&&(G[G.length-1]=Q);return}for(let H=0;H+1<ue.length;H++)if(te<=ue[H+1]){G[H]>Q&&(G[H]=Q),G[H+1]>Q&&(G[H+1]=Q);return}};for(let U=0;U<v.len;U++){let te=h[(v.start+U)%se];if(te)for(let Q of te.samples){Z(U,Q.r,Q.levelM);let fe=A?(U-1+v.len)%v.len:U-1,ue=A?(U+1)%v.len:U+1;fe>=0&&Z(fe,Q.r,Q.levelM),ue<v.len&&Z(ue,Q.r,Q.levelM)}}R.push(V)}R.reduce((v,A)=>v+A.binCount*I,0)<mf||f.push({arcs:R,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:M,outerRMedian:P})}if(!f.length)return null;if(f.sort((m,h)=>m.innerRMedian-h.innerRMedian),t){let m=f[f.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:se,binStepDeg:360/se,rings:f}}function Es(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 s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),c=i-s,u=l=>{let f=t.profiles[l],m=f.rs,h=f.ls;if(o<=m[0])return h[0];if(o>=m[m.length-1])return h[h.length-1];for(let d=0;d+1<m.length;d++)if(o<=m[d+1]){let p=m[d+1]-m[d],y=p>1e-9?(o-m[d])/p:0;return h[d]+(h[d+1]-h[d])*y}return h[h.length-1]};return u(s)*(1-c)+u(a)*c}function ko(e,t,n,o,r,i,s,a,c,u=[],l=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let f=(p,y,g)=>{We(e,p,y,g,u,s,a,{portalBase:l,ao:c})||z(e,p,void 0,()=>g,y,s,a,c)},m=(p,y,g)=>({x:p.x+(y.x-p.x)*g,y:p.y+(y.y-p.y)*g}),h=o?t.length:t.length-1,d=0;for(let p=0;p<h;p++){let y=(p+1)%t.length,g=Math.hypot(n[y].x-n[p].x,n[y].y-n[p].y)*$;if(g<1e-5)continue;let M=(b,S)=>[m(t[p],t[y],b),m(t[p],t[y],S),m(n[p],n[y],S),m(n[p],n[y],b)];f(M(0,1),r,r+.95),f(M(0,1),i-.22,i);let P=Math.ceil((d-.32)/6)*6,w=!1,x=!1;for(let b=P;b<d+g;b+=6){let S=Math.max(0,(b-d)/g),I=Math.min(1,(b+.32-d)/g);I<=S||(f(M(S,I),r+.95,i-.22),w||=S<1e-6,x||=I>1-1e-6)}if(!o&&(p===0&&!w||p===h-1&&!x)){let b=Math.min(1,.32/g);f(M(p===0?0:1-b,p===0?b:1),r+.95,i-.22)}d+=g}}var ot=Ge(require("polygon-clipping"),1),$t=.65;function Oo(e,t){let n=1/0;for(let o of t)for(let r=0;r<o.length;r++){let i=o[r],s=o[(r+1)%o.length],a=s.x-i.x,c=s.y-i.y,u=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/(a*a+c*c||1)));n=Math.min(n,Math.hypot(e.x-i.x-u*a,e.y-i.y-u*c))}return n}var To=.01;function As(e,t,n,o,r,i,s,a=[],c=!0,u={bays:[],walls:[]}){if(o-r<=1e-5)return;let l=o-r>=3,f=l?o-$t:r;e.setMaterial(5);let m=l?[]:a.filter(b=>{if(b.role!=="entrance"&&b.role!=="exit")return!1;let S=ie(b);if(!S)return!1;let I=_t(S,r,r+Fe(b).heightM);return I!==null&&I.openingTop<=o-.12});if((!m.length||!We(e,t,f,o,m,i,s,{holes:n,portalBase:r}))&&z(e,t,n,()=>o,f,i,s,K,void 0,()=>[0,1,0]),!l){e.setMaterial(0);return}let h=c&&u.bays.length?pf(t,n,Je(t,Zt/E),u):null,d=6/E,p=.22/E,y=a.flatMap(b=>{if(b.role!=="entrance"&&b.role!=="exit")return[];let S=ie(b);return S?.length?[{minX:Math.min(...S.map(I=>I.x)),maxX:Math.max(...S.map(I=>I.x)),minY:Math.min(...S.map(I=>I.y)),maxY:Math.max(...S.map(I=>I.y))}]:[]}),g=Math.min(...t.map(b=>b.x)),M=Math.max(...t.map(b=>b.x)),P=Math.min(...t.map(b=>b.y)),w=Math.max(...t.map(b=>b.y));for(let b=g+d/2;b<M;b+=d)for(let S=P+d/2;S<w;S+=d){if(y.some(R=>b+p>=R.minX&&b-p<=R.maxX&&S+p>=R.minY&&S-p<=R.maxY))continue;let I=[{x:b-p,y:S-p},{x:b+p,y:S-p},{x:b+p,y:S+p},{x:b-p,y:S+p}];!Pe({x:b,y:S},t,n)||Oo({x:b,y:S},[t,...n??[]])<p*Math.SQRT2+(c?Zt/E:0)||h&&Oo({x:b,y:S},h.flat())<p*Math.SQRT2+Zt/E||z(e,I,void 0,()=>f,r,i,s,K)}if(h){for(let[b,...S]of h)z(e,b,S,()=>f,r-To,i,s,K);e.setMaterial(0);return}let x=Je(t,Zt/E);if(c&&x.length>=3){let b=a.filter(R=>{if(R.role!=="entrance"&&R.role!=="exit")return!1;let k=ie(R);return!!k&&k.some(L=>!Pe(L,t,void 0)||Oo(L,[t])<=Zt/E)}),S=[x.slice().reverse()],I=r-To;(!b.length||!We(e,t,I,f,b,i,s,{holes:S,portalBase:r+To}))&&z(e,t,S,()=>f,I,i,s,K)}e.setMaterial(0)}var Lo=.25,Zt=Lo;function pf(e,t,n,o){if(n.length<3)return null;let r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=s=>{let[a,...c]=s.map(u=>[r(u)]);return ot.default.union(a,...c)};try{let s=[r(e),...(t??[]).map(r)],a=ot.default.difference(s,[r(n)]),c=ot.default.intersection(s,i(o.bays));if(!c.length)return null;let u=ot.default.difference(ot.default.intersection(s,i(o.walls)),c);return ot.default.union(ot.default.difference(a,c),u).map(f=>f.map(m=>m.slice(0,-1).map(([h,d])=>({x:h,y:d}))))}catch{return null}}var bf=.02,yf=.25,gf=1.2,xf=.6,Mf=.45,Sf=2.3,Pf=Math.PI/180,_s=.005;function Xe(e,t,n){let o=n*Pf;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function If(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 s=0;for(let a of i)Math.hypot(a.x-t.centre.x,a.y-t.centre.y)>=o&&s++;if(s>=i.length/2)return!0}return!1}var Rf=24,wf=.01;function Ef(e,t,n,o,r,i,s,a,c){let u=n.binCount,l=Rf,f=$,m=i+.02,h=i-wf,d=[];for(let A=0;A<u;A++){let _=(n.startBin+A+.5)*t.binStepDeg,C=new Float64Array(l+1);for(let B=0;B<=l;B++){let O=o[A]+(r[A]-o[A])*B/l;C[B]=Math.max(m,Es(t,n,_,O)-yf)}d.push(C)}if(c){let A=0;for(let _=0;_+1<u;_++)for(let C=0;C<l;C++){let B=Xe(t.centre,o[_]+(r[_]-o[_])*C/l,(n.startBin+_+.5)*t.binStepDeg),O=Xe(t.centre,o[_+1]+(r[_+1]-o[_+1])*(C+1)/l,(n.startBin+_+1.5)*t.binStepDeg);A=Math.max(A,Math.hypot(O.x-B.x,O.y-B.y))}for(let _=0;_<u;_++){let C=(n.startBin+_+.5)*t.binStepDeg;for(let B=0;B<=l;B++){let O=Xe(t.centre,o[_]+(r[_]-o[_])*B/l,C),F=c(O.x,O.y,A*1.01);F!==null&&(d[_][B]=Math.min(d[_][B],Math.max(h+_s,F-_s)))}}}let p=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],y=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],g=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],M=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],P=(A,_)=>{let C=(n.startBin+A+.5)*t.binStepDeg,B=o[A]+(r[A]-o[A])*_/l,O=Xe(t.centre,B,C);return[O.x*f,d[A][_],O.y*f]};{let A=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let C=!1;for(let O=0;O<u;O++)for(let F=l-1;F>=0;F--)d[O][F]>d[O][F+1]&&(d[O][F]=d[O][F+1],C=!0);let B=n.closed?u:u-1;for(let O=0;O<B;O++){let F=(O+1)%u;for(let D=0;D<=l;D++){let j=d[F][D]-d[O][D];if(Math.abs(j)>1)continue;let N=o[O]+(r[O]-o[O])*D/l,X=o[F]+(r[F]-o[F])*D/l,V=Xe(t.centre,N,(n.startBin+O+.5)*t.binStepDeg),Z=Xe(t.centre,X,(n.startBin+F+.5)*t.binStepDeg),U=A*Math.hypot(Z.x-V.x,Z.y-V.y)*f;j>U?(d[F][D]=d[O][D]+U,C=!0):-j>U&&(d[O][D]=d[F][D]+U,C=!0)}}if(!C)break}}let w=1,x=(A,_)=>{for(let C=0;C<=l;C+=4)if(Math.abs(d[A][C]-d[_][C])>w)return!0;return Math.abs(d[A][l]-d[_][l])>w},b=Math.tan(38*Math.PI/180),S=A=>(r[A]-o[A])/l*f,I=(A,_)=>d[A][_+1]-d[A][_]>b*Math.max(1e-6,S(A)),R=(A,_)=>{let C=n.closed?(A-1+u)%u:Math.max(0,A-1),B=n.closed?(A+1)%u:Math.min(u-1,A+1);Math.abs(d[C][_]-d[A][_])>w&&(C=A),Math.abs(d[B][_]-d[A][_])>w&&(B=A);let O=Math.max(0,_-1),F=Math.min(l,_+1);O<_&&I(A,O)&&(O=_),F>_&&I(A,_)&&(F=_);let D=P(C,_),j=P(B,_),N=P(A,O),X=P(A,F),V=j[0]-D[0],Z=j[1]-D[1],U=j[2]-D[2],te=X[0]-N[0],Q=X[1]-N[1],fe=X[2]-N[2],ue=Z*fe-U*Q,G=U*te-V*fe,H=V*Q-Z*te,J=Math.hypot(ue,G,H);return J>1e-12?(ue/=J,G/=J,H/=J,G<0&&(ue=-ue,G=-G,H=-H),[ue,G,H]):[0,1,0]},k=(A,_,C=!1)=>{let B=C&&Math.min(A[1],_[1])-i>=3,O=[A[0],B?A[1]-$t:h,A[2]],F=[_[0],B?_[1]-$t:h,_[2]],D=_[0]-A[0],j=_[2]-A[2],N=Math.hypot(D,j);if(!(N>1e-12))return;let X=[j/N,0,-D/N];e.tri(A,_,F,X,g,g,M),e.tri(A,F,O,X,g,M,M)},L=.05*Oe,T=A=>r[A]-o[A]<L,v=n.closed?u:u-1;for(let A=0;A<v;A++){let _=(A+1)%u;if(T(A)||T(_))continue;if(x(A,_)){let j=(n.startBin+A+1)*t.binStepDeg,N=(Q,fe)=>{let ue=(o[A]+o[_])/2,G=(r[A]+r[_])/2,H=ue+(G-ue)*fe/l,J=Xe(t.centre,H,j);return[J.x*f,d[Q][fe],J.y*f]};for(let Q=0;Q<l;Q++){let fe=P(A,Q),ue=P(A,Q+1),G=N(A,Q),H=N(A,Q+1),J=R(A,Q),me=R(A,Q+1);e.triN(fe,G,H,J,J,me,p),e.triN(fe,H,ue,J,me,me,p);let xe=P(_,Q),Ie=P(_,Q+1),ae=N(_,Q),ce=N(_,Q+1),De=R(_,Q),Y=R(_,Q+1);e.triN(ae,xe,Ie,De,De,Y,p),e.triN(ae,Ie,ce,De,Y,Y,p);let he=N(A,Q),Me=N(A,Q+1),rt=N(_,Q+1),it=N(_,Q),Ze=Me[0]-he[0],$e=Me[2]-he[2],Tt=Math.hypot(Ze,$e);if(Tt>1e-12){let Jt=[$e/Tt,0,-Ze/Tt];e.tri(he,Me,rt,Jt,g),e.tri(he,rt,it,Jt,g)}}let X=P(A,0),V=P(_,0),Z=P(_,l),U=P(A,l),te=Q=>[Q[0],h,Q[2]];Math.min(X[1],V[1])-i<3&&(e.tri(te(X),te(Z),te(V),[0,-1,0],y),e.tri(te(X),te(U),te(Z),[0,-1,0],y)),k(X,V,!0),k(U,Z,!0);continue}for(let j=0;j<l;j++){let N=R(A,j),X=R(_,j),V=R(_,j+1),Z=R(A,j+1);if(I(A,j)||I(_,j)){let ue=(Me,rt)=>{let it=(n.startBin+Me+.5)*t.binStepDeg,Ze=o[Me]+(r[Me]-o[Me])*(j+.5)/l,$e=Xe(t.centre,Ze,it);return[$e.x*f,rt,$e.y*f]},G=P(A,j),H=P(_,j),J=ue(A,d[A][j]),me=ue(_,d[_][j]);e.triN(G,H,me,N,X,X,p),e.triN(G,me,J,N,X,N,p);let xe=P(_,j+1),Ie=P(A,j+1),ae=ue(A,d[A][j+1]),ce=ue(_,d[_][j+1]);e.triN(ae,ce,xe,Z,V,V,p),e.triN(ae,xe,Ie,Z,V,Z,p);let De=me[0]-J[0],Y=me[2]-J[2],he=Math.hypot(De,Y);if(he>1e-12){let Me=[-Y/he,0,De/he];e.tri(J,me,ce,Me,g),e.tri(J,ce,ae,Me,g)}continue}let U=P(A,j),te=P(_,j),Q=P(_,j+1),fe=P(A,j+1);e.triN(U,te,Q,N,X,V,p),e.triN(U,Q,fe,N,V,Z,p)}let C=P(A,0),B=P(_,0),O=P(_,l),F=P(A,l),D=j=>[j[0],h,j[2]];Math.min(C[1],B[1])-i<3&&(e.tri(D(C),D(O),D(B),[0,-1,0],y),e.tri(D(C),D(F),D(O),[0,-1,0],y)),k(C,B,!0),k(F,O,!0)}if(!n.closed)for(let A of[0,u-1])for(let _=0;_<l;_++)k(P(A,_),P(A,_+1))}function vs(e,t,n){let{bottomY:o,colors:r,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let f of l.arcs){let m=new Float64Array(f.binCount),h=new Float64Array(f.binCount);for(let p=0;p<f.binCount;p++){let y=(f.startBin+p)%t.binCount,g=Math.max(0,f.innerR[p]-Te);m[p]=Math.max(g,s[y]+.001),h[p]=Math.max(m[p]+.001,f.outerR[p]+Te)}let d=0;for(let p=0;p<f.binCount;p++){let y=f.topLevelM[p]-o;y>d&&(d=y)}d>=gf&&Ef(e,t,f,m,h,o,r,i,n.standTopNear);for(let p=0;p<f.binCount;p++){let y=(f.startBin+p)%t.binCount;h[p]>s[y]&&(s[y]=h[p])}}if(n.deriveShell===!1||If(n.shapes,t))return;let a=t.rings[t.rings.length-1],c=xf*Oe,u=Mf*Oe;for(let l of a.arcs){let f=[],m=[];for(let R=0;R<l.binCount;R++){let k=(l.startBin+R+.5)*t.binStepDeg,L=l.outerR[R]+Te+c;f.push(Xe(t.centre,L,k)),m.push(Xe(t.centre,L+u,k))}let h=-1/0;for(let R=0;R<l.binCount;R++)l.topLevelM[R]>h&&(h=l.topLevelM[R]);let d=h+Sf,p=l.closed?m:[...m,...f.slice().reverse()],y=l.closed?[f.slice().reverse()]:void 0,g=re(r.shellWall,[.66,.71,.72],.62),M=(R,k,L,T,v)=>{let A=Math.abs(T-h)<1e-6?T-bf:T;We(e,R,L,A,n.shapes,r.shellTop,v,{holes:k,portalBase:o,ao:i})||z(e,R,k,()=>A,L,r.shellTop,v,i)},P=Math.max(1,Math.ceil((h-o)/4.5)),w=(h-o)/P,x=new Set,b=n.tierFrontLevels??t.rings.map(R=>{let k=R.arcs.flatMap(L=>Array.from(L.frontLevelM)).filter(Number.isFinite).sort((L,T)=>L-T);return k[Math.floor(k.length/2)]});for(let R of b)Number.isFinite(R)&&R-o>=3&&R<h&&x.add(Math.max(0,Math.min(P-1,Math.floor((R-o)/w))));let S=Math.min(...b.filter(R=>Number.isFinite(R)&&R-o>=3&&R<h));for(let R=0;R<P;R++)o+(R+1)*w<=S-$t&&Number.isFinite(S)&&x.add(R);for(let R=0;R<P;R++){let k=o+(h-o)*R/P,L=o+(h-o)*(R+1)/P;x.has(R)&&L-k>=3.2?(M(p,y,k,k+.45,g),ko(e,f,m,l.closed,k+.45,L-.16,r.shellTop,g,i,n.shapes,o)):M(p,y,k,L-.16,g),M(p,y,L-.16,L,W(g,.62))}ko(e,f,m,l.closed,h,d,r.shellTop,g,i,n.shapes,o);let I=8;for(let R=1;R<m.length;R++){if(I+=Math.hypot(m[R].x-m[R-1].x,m[R].y-m[R-1].y)*$,I<8)continue;I=0;let k=m[R],L=m[R-1],T=k.x-L.x,v=k.y-L.y,A=Math.max(1,Math.hypot(T,v)),_=T/A*.16*Oe,C=v/A*.16*Oe,B=Math.max(1,Math.hypot(k.x-t.centre.x,k.y-t.centre.y)),O=(k.x-t.centre.x)/B*.24*Oe,F=(k.y-t.centre.y)/B*.24*Oe,D=[{x:k.x-_,y:k.y-C},{x:k.x+_,y:k.y+C},{x:k.x+_+O,y:k.y+C+F},{x:k.x-_+O,y:k.y-C+F}];M(D,void 0,o,h,W(g,1.12))}}}var Af=2.5,Cs=.65,_f=2,vf=.03;function Cf(e,t){let n=()=>{let o=t;for(;e.length>2;){let r=e[0],i=e[1],s=Math.hypot(i.x-r.x,i.y-r.y);if(s>o){e[0]={x:r.x+(i.x-r.x)/s*o,y:r.y+(i.y-r.y)/s*o};return}o-=s,e.shift()}};n(),e.reverse(),n(),e.reverse()}function No(e,t,n){let o=new Map;for(let i of e){let s=o.get(i.blockId);(!s||i.depth<s.depth)&&o.set(i.blockId,i)}let r=[];for(let[i,s]of o){if(s.y-n<Af||s.pts.length<2)continue;let a=s.pts.map(l=>{let f=l.x-t.x,m=l.y-t.y,h=Math.max(1,Math.hypot(f,m));return{x:l.x-f/h*Cs/E,y:l.y-m/h*Cs/E}}),c=[],u=[a[0]];for(let l=1;l<a.length;l++){let f=a[l-1],m=a[l];Math.hypot(m.x-f.x,m.y-f.y)*E>_f?(u.length>=2&&c.push(u),u=[m]):u.push(m)}u.length>=2&&c.push(u);for(let l of c)Cf(l,vf/E);c.length&&r.push({blockId:i,y:s.y,runs:c})}return r}var ks=.1,kf=1.1,Of=.22,Bo=.95,Fo=.05,Os=1.8;function Ts(e,t,n,o){let r=[.72,.72,.69],i=[.48,.55,.57];for(let s of No(t,n,o)){let a=s.y;for(let c of s.runs){let u=Os;for(let l=1;l<c.length;l++){let f=c[l-1],m=c[l],h=m.x-f.x,d=m.y-f.y,p=Math.hypot(h,d);if(p<1e-5)continue;let y=g=>{let M=-d/p*g/E/2,P=h/p*g/E/2;return[{x:f.x+M,y:f.y+P},{x:m.x+M,y:m.y+P},{x:m.x-M,y:m.y-P},{x:f.x-M,y:f.y-P}]};if(z(e,y(Of),void 0,()=>a+ks,a-kf,r,r,K),z(e,y(Fo),void 0,()=>a+Bo,a+Bo-Fo,i,i,K),u+=p*E,u>=Os||l===c.length-1){u=0;let g=.028/E,M=[{x:f.x-g,y:f.y-g},{x:f.x+g,y:f.y-g},{x:f.x+g,y:f.y+g},{x:f.x-g,y:f.y+g}];z(e,M,void 0,()=>a+Bo-Fo,a+ks,i,i,K)}}}}}var Tf=.9,Lf=1.5,Bf=.3;function Ls(e,t,n){let o=[],r=[],i=Tf/E,s=Lf/E,a=Bf/E;for(let c of e)for(let u of c.runs){if(u.length<2)continue;let l=u.slice(),f=(y,g)=>{let M=l[y],P=l[g],w=Math.hypot(M.x-P.x,M.y-P.y)||1;l[y]={x:M.x+(M.x-P.x)/w*a,y:M.y+(M.y-P.y)/w*a}};f(0,1),f(l.length-1,l.length-2);let m=l.map((y,g)=>{let M=l[Math.max(0,g-1)],P=l[Math.min(l.length-1,g+1)],w=P.x-M.x,x=P.y-M.y,b=Math.hypot(w,x)||1,S=-x/b,I=w/b;return S*(y.x-t.x)+I*(y.y-t.y)<0&&(S=-S,I=-I),{nx:S,ny:I}}),h=l.map((y,g)=>({x:y.x-m[g].nx*s,y:y.y-m[g].ny*s})),d=l.map((y,g)=>({x:y.x+m[g].nx*i,y:y.y+m[g].ny*i})),p=l.map((y,g)=>({x:y.x+m[g].nx*(i+n/E),y:y.y+m[g].ny*(i+n/E)}));o.push([...h,...d.slice().reverse()]),r.push([...d,...p.reverse()])}return{bays:o,walls:r}}var Do=.88,Gn=.27,Ff=1.2,Nf=.01;function Bs(e,t,n,o,r){let i=[.67,.71,.68],s=[i[0]*Do,i[1]*Do,i[2]*Do],a=c=>!!r&&r.some((u,l)=>l!==c&&u?.belowY!=null&&Math.abs(u.belowY-t[c].y)<1e-6&&t[l].blockId===t[c].blockId);for(let c=0;c<t.length;c++){let u=t[c];if(!(u.pts.length<2))for(let l of[0,u.pts.length-1]){let f=u.pts[l],m=u.pts[l===0?1:l-1],h=f.x-m.x,d=f.y-m.y,p=Math.hypot(h,d);if(p<1e-5)continue;h/=p,d/=p;let y=1/0;for(let _=0;_<n.length;_++){let C=n[_],B=n[(_+1)%n.length],O=B.x-C.x,F=B.y-C.y,D=h*F-d*O;if(Math.abs(D)<1e-8)continue;let j=C.x-f.x,N=C.y-f.y,X=(j*F-N*O)/D,V=(j*d-N*h)/D;X>0&&V>=0&&V<=1&&(y=Math.min(y,X))}let g=.3/E,M=y-.04/E;if(!Number.isFinite(y)||y*E>2||M-g<.12/E)continue;let P=!!o&&a(c),w=r?.[c]?.pitch,x=P&&w&&Number.isFinite(w)?Math.min(Ff/E,Math.max(Gn/E,w-Gn/E-Nf/E)):Gn/E,b=-d,S=h;o&&b*(o.x-f.x)+S*(o.y-f.y)<0&&(b=-b,S=-S);let I=Gn/E,R=[{x:f.x+h*g+b*I,y:f.y+d*g+S*I},{x:f.x+h*M+b*I,y:f.y+d*M+S*I},{x:f.x+h*M-b*x,y:f.y+d*M-S*x},{x:f.x+h*g-b*x,y:f.y+d*g-S*x}];if(!R.every(_=>_e(n,_.x,_.y)))continue;let k=r?.[c]?.belowY,L=k==null?0:u.y-k,T=!!o&&L>.03&&L<=.65;if(T&&o){let _=(C,B)=>Math.hypot((C.x+B.x)/2-o.x,(C.y+B.y)/2-o.y);_(R[0],R[1])>_(R[3],R[2])&&(R=[R[3],R[2],R[1],R[0]])}let v=T?Math.ceil((L-1e-8)/.2):1,A=(_,C,B)=>({x:_.x+(C.x-_.x)*B,y:_.y+(C.y-_.y)*B});for(let _=0;_<v;_++){let C=_/v,B=(_+1)/v,O=[A(R[0],R[3],C),A(R[1],R[2],C),A(R[1],R[2],B),A(R[0],R[3],B)],F=u.y+.008-(T?L*(1-B):0);z(e,O,void 0,()=>F,F-(T?L/v+.1:.16),i,s,K)}}}}var Df=.02,Gf=.012,jf=.01,Hf=.3,Vf=.5;function Uf(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],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l=Math.max(0,Math.min(1,l)),o=Math.min(o,Math.hypot(t-(i.x+l*a),n-(i.y+l*c)))}return o}function Xf(e,t,n,o){let r=1/0,i=Number.NaN;for(let s=0;s<e.length;s++){let a=t[s];if(Math.hypot(n-a.cx,o-a.cy)-a.rad>=r)continue;let c=Uf(e[s].pts,n,o);c<r&&(r=c,i=e[s].y)}return i}function Fs(e,t,n,o,r,i,s){let a=o.filter(m=>m.pts.length>0);if(a.length<2||t.length<3)return;let c=a.map(m=>{let h=0,d=0;for(let y of m.pts)h+=y.x,d+=y.y;h/=m.pts.length,d/=m.pts.length;let p=0;for(let y of m.pts)p=Math.max(p,Math.hypot(y.x-h,y.y-d));return{cx:h,cy:d,rad:p}}),u=[...t],l=n.map(m=>[...m]),f=Df/E;for(let m of[u,...l])for(let h=0;h<m.length;h++){let d=m[h],p=m[(h+1)%m.length],y=p.x-d.x,g=p.y-d.y,M=Math.hypot(y,g);if(M*E<.05)continue;let P=(d.x+p.x)/2,w=(d.y+p.y)/2,x=g/M,b=-y/M;Pe({x:P+x*f,y:w+b*f},u,l)&&(x=-x,b=-b);let S=r.x-P,I=r.y-w,R=Math.hypot(S,I)||1;if((x*S+b*I)/R>Vf)continue;let k=1/0;for(let O of[.2,.5,.8]){let F=Xf(a,c,d.x+y*O-x*f*2,d.y+g*O-b*f*2);Number.isFinite(F)&&(k=Math.min(k,F))}if(!Number.isFinite(k)||k-i<Hf)continue;let L=i-jf,T=k-Gf,v={x:(d.x-x*f)*E,z:(d.y-b*f)*E},A={x:(p.x-x*f)*E,z:(p.y-b*f)*E},_=[x,0,b],C=W(s,K.wallBottom),B=W(s,K.top);e.tri([v.x,T,v.z],[A.x,T,A.z],[A.x,L,A.z],_,B,B,C),e.tri([v.x,T,v.z],[A.x,L,A.z],[v.x,L,v.z],_,B,C,C)}}function Ns(e,t,n,o,r,i,s,a,c=!1){if(!t.outline||t.outline.length<3)return;let u=n.baseHeightM,l=n.objects.filter(M=>M.type==="shape"&&(M.role==="entrance"||M.role==="exit")),f=ui(o,a.tierTop);if(!r)return;let m=M=>r.deckAt(M.x,M.y),h=Li(t,s),d=h[0]??t.outline;if(r.rowLevels.length>=2){let M=Pn(r.rowLevels),P=Bi(vi(r.rowLevels,n.focal,M),h),w=Ls(No(r.rowLevels,n.focal,u),n.focal,Lo);for(let b of P){let S=Math.max(u,b.topY-Ds);for(let I of i.subtract(b.outline,S))As(e,I,b.holes,S,u,a.tierTop,a.tierWall,l,!c,w);e.setMaterial(5),Fs(e,b.outline,b.holes,r.rowLevels,n.focal,S,a.tierWall),e.setMaterial(0)}P.length||z(e,d,t.holes,()=>r.landingY,u,f,a.tierWall,K);let x={tread:[f[0]*K.top,f[1]*K.top,f[2]*K.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let b of h.length?h:[d])ki(e,r.rowLevels,n.focal,r.landingY,x,b,M);Ts(e,r.rowLevels,n.focal,u),Bs(e,r.rowLevels,t.outline,n.focal,M);return}let p=r.flat?1/0:Xi,y=M=>r.normalAt(M.x,M.y),g=r.flat?r.landingY:void 0;for(let M of i.subtract(d,g))z(e,M,t.holes,m,u,f,a.tierWall,K,p,y)}function Kf(e,t,n){let o=new Set;for(let s of e.objects)s.type==="section"&&o.add(s.id);let r=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!o.has(a))continue;let c=n.bySection.get(a);if(c&&c.rowLevels.length>=2)continue;let u=t[s];if(u.kind==="booth")continue;let l=r.get(a);l||(l=new Map,r.set(a,l));let f=u.rowId||`__seat-${s}`,m=l.get(f);m||(m={pts:[],levelM:0,n:0},l.set(f,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=n.seatDeckY(s),m.n++}let i=[];for(let s of e.objects){if(s.type!=="section")continue;let a=n.bySection.get(s.id);if(a&&a.rowLevels.length>=2){let u=a.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&i.push({sectionId:s.id,rows:u});continue}let c=r.get(s.id);c&&i.push({sectionId:s.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function Yf(e,t){let n=1/0;for(let o=0;o<t.length;o++){let r=t[o],i=t[(o+1)%t.length],s=i.x-r.x,a=i.y-r.y,c=Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*a)/(s*s+a*a||1)));n=Math.min(n,Math.hypot(e.x-r.x-c*s,e.y-r.y-c*a))}return n}var Ds=.02;function Wf(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,s=-1/0,a=1/0,c=-1/0;for(let l of o.outline)l.x<i&&(i=l.x),l.x>s&&(s=l.x),l.y<a&&(a=l.y),l.y>c&&(c=l.y);let u=r.landingY;for(let l of r.rowLevels)u=Math.min(u,l.y-Ds);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:u,minX:i,maxX:s,minY:a,maxY:c}]});return(o,r,i)=>{let s=null;for(let a of n){if(o<a.minX-i||o>a.maxX+i||r<a.minY-i||r>a.maxY+i)continue;let c={x:o,y:r};if(!Pe(c,a.outline,a.holes)&&Yf(c,a.outline)>i)continue;let u=Math.min(a.surface.deckAt(o,r),a.floorTop);(s===null||u<s)&&(s=u)}return s}}var zf=3,Zf=.4;function Gs(e,t,n,o,r,i,s=!0){let a=Kf(t,n,o);if(a.length<zf)return;let c=ws(a,t.focal);if(!c)return;let u=Math.max(0,...c.rings.map(l=>l.arcs.reduce((f,m)=>f+m.binCount,0)))/c.binCount;e.setMaterial(5),vs(e,c,{bottomY:t.baseHeightM,tierFrontLevels:a.map(l=>Math.min(...l.rows.map(f=>f.levelM))),colors:{bandTop:W(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??W(r.tierWall,1.15),shellWall:i??r.tierWall},ao:K,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:s&&u>=Zf,standTopNear:Wf(t,o)}),e.setMaterial(0)}var js=4;var $f=[[/\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"]],Qf=1.2,qf=12;function Hs(e){if(e.heightM!==void 0)return!1;let t=ie(e);if(!t||t.length<3)return!1;let n=0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length];n+=Math.hypot(s.x-i.x,s.y-i.y)}return n*$<qf*2?!1:2*Qt(t)/n*$<=Qf}function Go(e){if(!e)return null;for(let[t,n]of $f)if(t.test(e))return n;return null}var Us="auto-rows-";function Xs(e){return e.id.startsWith(Us)&&!e.label}var Jf=1.15,em=.09,Ks=6,tm=34,nm=.35,om=6,rm=.35,im=.75,sm=12,am=2.5,cm=40,lm=[18,24],um=[12,16],Vs=14,fm=.8,mm=.6,hm=5,dm=.3,Ys=.4,Ws=2,pm=400,bm=2.6,ym=.8,gm=4,xm=26,Mm=.7,Sm=.5,Pm=.985,Im=1.5,Rm=2.2,wm=3,Em=25,Am=.985,_m=2,vm=6,Cm=3,km=.1,Om=1.5,Tm=1.6,Lm=6e3,Bm=.6,Fm="#c3c7cd",jo=300,Nm=240;function Dm(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=Vo([...t]),i=new Set;for(let l of o)i.add(Math.floor(Math.atan2(l.y-r.y,l.x-r.x)*180/Math.PI/10));if(i.size*10<Nm)return null;let{h:s,s:a,l:c}=Gr(Dr(e.fill));return s<70/360||s>170/360||a<.2||c<.08||c>.75||n.some(l=>l!==e&&l.type==="shape"&&ie(l)?.some(f=>Ko(f,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var Gm="Estimated from the drawing; confirm with the venue.",Uo=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},Vo=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),Qt=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 jm(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function Xo(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 Ko(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function Yo(e,t){let n=t[0],o=1/0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>0?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u)):0,f={x:i.x+a*l,y:i.y+c*l},m=Math.hypot(e.x-f.x,e.y-f.y);m<o&&(o=m,n=f)}return n}function zs(e,t){let n=0,o=0;for(let r of e.values()){if(r.length<3)continue;let i=r[0],s=r[r.length-1],a=s.x-i.x,c=s.y-i.y,u=Math.hypot(a,c);if(u<1e-6)continue;let l={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=Yo(l,t),m=f.x-l.x,h=f.y-l.y,d=Math.hypot(m,h);d<1e-6||(o+=Math.abs((-c*m+a*h)/(u*d))*r.length,n+=r.length)}return n?o/n:0}function Hm(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=ie(r);return p?{shape:r,centre:Vo(p),outline:p,inferred:!1}:null}if(!n.length)return null;let i=1/0,s=-1/0,a=1/0,c=-1/0;for(let p of n)i=Math.min(i,p.x),s=Math.max(s,p.x),a=Math.min(a,p.y),c=Math.max(c,p.y);let u=(s-i)*(c-a),l=[];for(let p of o){if(p.role)continue;let y=ie(p);if(!y)continue;let g=Qt(y);if(g*$*$<6||g>u)continue;let M=Math.min(...y.map(R=>R.x)),P=Math.max(...y.map(R=>R.x)),w=Math.min(...y.map(R=>R.y)),x=Math.max(...y.map(R=>R.y)),b=0;for(let R of n)R.x>M&&R.x<P&&R.y>w&&R.y<x&&Ko(R,y)&&b++;if(b>n.length*.05)continue;let S=Vo(y),I=zs(t,y);I>=fm&&l.push({shape:p,centre:S,outline:y,score:I,area:g,box:[M,w,P,x]})}let f=(p,y)=>y!==p&&y.area>p.area&&p.box[0]>=y.box[0]-1e-6&&p.box[1]>=y.box[1]-1e-6&&p.box[2]<=y.box[2]+1e-6&&p.box[3]<=y.box[3]+1e-6,m=l.filter(p=>!l.some(y=>f(p,y))),h=Math.max(0,...m.map(p=>p.score)),d=m.filter(p=>p.score>=h-.03).sort((p,y)=>y.area-p.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function Vm(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=Yo(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function Zs(e){let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y);if(t.length<3)return t;let n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),o=[];for(let i of t){for(;o.length>=2&&n(o[o.length-2],o[o.length-1],i)<=0;)o.pop();o.push(i)}let r=[];for(let i=t.length-1;i>=0;i--){let s=t[i];for(;r.length>=2&&n(r[r.length-2],r[r.length-1],s)<=0;)r.pop();r.push(s)}return[...o.slice(0,-1),...r.slice(0,-1)]}function Um(e){if(!e.length||e.length>Lm)return[];let t=[...Xo(e).values()],n=t.map((a,c)=>c),o=a=>n[a]===a?a:n[a]=o(n[a]),r=Tm/$,i=t.map(a=>({minX:Math.min(...a.map(c=>c.x))-r,maxX:Math.max(...a.map(c=>c.x))+r,minY:Math.min(...a.map(c=>c.y))-r,maxY:Math.max(...a.map(c=>c.y))+r}));for(let a=0;a<t.length;a++)for(let c=a+1;c<t.length;c++){let u=i[a],l=i[c];if(u.maxX<l.minX||l.maxX<u.minX||u.maxY<l.minY||l.maxY<u.minY)continue;t[a].some(m=>t[c].some(h=>Math.hypot(m.x-h.x,m.y-h.y)<=r))&&(n[o(a)]=o(c))}let s=new Map;return t.forEach((a,c)=>{let u=o(c),l=s.get(u);l?l.push(...a):s.set(u,[...a])}),[...s.values()].filter(a=>new Set(a.map(c=>c.rowId)).size>=2)}function Xm(e,t,n){if(!t.length)return null;let o=t.filter(I=>n.tableIds.has(I.rowId)||I.kind==="booth").length>t.length/2,r=Xo(t),i=!n.outline||zs(r,n.outline)>=mm,s=0,a=0;for(let I of r.values()){if(I.length<2)continue;let R=I[0],k=I[I.length-1],L=k.x-R.x,T=k.y-R.y,v=Math.hypot(L,T);if(v<1e-6)continue;let A={x:(R.x+k.x)/2,y:(R.y+k.y)/2},_=i?n.outline?Yo(A,n.outline):n.focal:n.middle,C=-T/v,B=L/v;C*(_.x-A.x)+B*(_.y-A.y)<0&&(C=-C,B=-B),s+=C*I.length,a+=B*I.length}let c={x:t.reduce((I,R)=>I+R.x,0)/t.length,y:t.reduce((I,R)=>I+R.y,0)/t.length};if(Math.hypot(s,a)<1e-9){let I=i?n.focal:n.middle;s=I.x-c.x,a=I.y-c.y}let u=Math.hypot(s,a)||1,l={x:s/u,y:a/u},f=I=>-(I.x*l.x+I.y*l.y),m=I=>-I.x*l.y+I.y*l.x,h=1/0,d=-1/0,p=1/0,y=-1/0,g=1/0,M=new Map;for(let I of t){let R=f(I),k=m(I);h=Math.min(h,R),d=Math.max(d,R),p=Math.min(p,k),y=Math.max(y,k),i&&(g=Math.min(g,Vm(I,n.focal,n.outline)));let L=I.logicalRowId??I.rowId,T=M.get(L);T?T.push(R):M.set(L,[R])}i||(g=Math.max(0,h-f(n.middle)));let P=[...M.values()].map(I=>Uo(I)).sort((I,R)=>I-R),w=[];if(!o)for(let I of P)w.length&&I-w[w.length-1]<rm/$||w.push(I);let x=jm(e),b=Qe(e,{floorBaseHeightM:n.baseHeightM}),S={id:e.id,section:e,authored:x,plane:n,facing:l,facesAction:i,hull:Zs(t),sample:t.filter((I,R)=>R%Math.ceil(t.length/pm)===0),frontD:h,backD:d,latMin:p,latMax:y,frontDistance:g,rowDepths:w,rowCount:w.length,level:0,height:b.height,rake:x?b.rake:0,backHeight:0};return S.backHeight=S.height+(d-h)*$*Math.tan(S.rake*Math.PI/180),S}function Km(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*$),i=n+Jf-o,s=0,a=0;for(let u=1;u<e.length;u++){let l=Math.max(im,(e[u]-e[u-1])*$),f=(i+em)*(r+l)/r;s+=f-i,a+=l,i=f,r+=l}let c=Math.atan(s/a)*180/Math.PI;return Math.round(Math.max(Ks,Math.min(tm,c))*10)/10}function Ym(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<dm)return null;let o=-1/0,r=1/0,i=-1/0;for(let m of t.hull){o=Math.max(o,-(m.x*e.facing.x+m.y*e.facing.y));let h=-m.x*e.facing.y+m.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:Ys*(e.latMax-e.latMin)))return null;let a=Ws/$,c=new Map,u=new Map;for(let m of e.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);c.set(h,Math.min(c.get(h)??1/0,d))}for(let m of t.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);u.set(h,Math.max(u.get(h)??-1/0,d))}let l=[];for(let[m,h]of c){let d=u.get(m);d!==void 0&&l.push(h-d)}let f=l.length?Uo(l):e.frontD-o;return f<-1/$?null:f}function Wm(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 u=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,u),o=Math.min(o,u);let l=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,l),i=Math.max(i,l)}let s=Math.min(e.latMax,i)-Math.max(e.latMin,r),a=Math.min(e.backD,n)-Math.max(e.frontD,o);return s>Ys*(e.latMax-e.latMin)&&a>1/$}function zm(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 Zm(e,t){let n=1/0,o=-1/0;for(let i of t.hull){let s=-(i.x*e.facing.x+i.y*e.facing.y);n=Math.min(n,s),o=Math.max(o,s)}let r=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+r*$*Math.tan(t.rake*Math.PI/180)}function $m(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=Ws/$,r=Math.max(1,Math.ceil((e.backD-e.frontD)/o)),i={left:new Map,right:new Map};for(let a of t)if(!(a===e||a.plane.floorIndex!==e.plane.floorIndex)&&!(a.facing.x*e.facing.x+a.facing.y*e.facing.y>=Pm))for(let c of a.sample){let u=-(c.x*e.facing.x+c.y*e.facing.y);if(u<e.frontD||u>e.backD)continue;let l=-c.x*e.facing.y+c.y*e.facing.x,f=l<e.latMin?"left":l>e.latMax?"right":null;if(!f)return!1;let m=Math.min(r-1,Math.floor((u-e.frontD)/o)),h=f==="left"?e.latMin-l:l-e.latMax;h<(i[f].get(m)?.gap??1/0)&&i[f].set(m,{gap:h,other:a})}let s=a=>{let c=a==="left"?e.latMin:e.latMax,u=0;for(let[l,{other:f}]of i[a]){if((f.facing.x*n.x+f.facing.y*n.y)*(a==="left"?1:-1)<Mm)continue;let h=e.frontD+(l+.5)*o,d={x:-h*e.facing.x+c*n.x,y:-h*e.facing.y+c*n.y},p=-(d.x*f.facing.x+d.y*f.facing.y),y=-d.x*f.facing.y+d.y*f.facing.x;p<f.frontD&&y>=f.latMin&&y<=f.latMax&&u++}return u/r>=Sm};return s("left")&&s("right")}function Qm(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<Am)return!1;let n=1/0,o=-1/0,r=1/0;for(let a of t.hull){let c=-a.x*e.facing.y+a.y*e.facing.x;n=Math.min(n,c),o=Math.max(o,c),r=Math.min(r,-(a.x*e.facing.x+a.y*e.facing.y))}let i=(e.frontD-r)*$;if(i<-_m||i>vm)return!1;let s=Math.max(n-e.latMax,e.latMin-o);return s*$<=Cm&&s*$>=-km}function qm(e,t=!1,n=!1,o){let r=t?um:lm,i=new Set(n?[]:e.filter(p=>!p.authored&&$m(p,e))),s=[...e].sort((p,y)=>p.plane.floorIndex-y.plane.floorIndex||Number(i.has(y))-Number(i.has(p))||p.frontDistance-y.frontDistance);for(let p of i)o?.add(p.id);let a=(p,y,g)=>{let M=new Map,P=[],w=new Map,x=b=>{if(b.plane.floorIndex===0||b.plane.baseHeightM>0)return b.plane.baseHeightM;let S=w.get(b.plane.floorIndex-1);return S===void 0?b.plane.baseHeightM:S+js};for(let b of s){if(i.has(b))b.height=x(b),b.level=0,b.rake=0,b.backHeight=b.height,M.set(b.id,void 0);else if(!b.authored){let I=x(b),R;for(let A of P){if(A.plane.floorIndex>b.plane.floorIndex)continue;if(Wm(b,A)){let O=Zm(b,A)+bm;O>I&&(I=O,R=A);continue}let _=Ym(b,A,i.has(A));if(_==null)continue;let C=n&&!!b.plane.stageDeck&&A.level===0&&A.plane.floorIndex===b.plane.floorIndex&&Math.max(0,_)*$<=gm,B=i.has(A)?A.height+Im:C?A.backHeight:A.backHeight+nm+Math.min(om,Math.max(0,_)*$)*Math.tan(A.rake*Math.PI/180);B>I&&(I=B,R=A)}let k=p.get(b);k&&k.height>I+.01?(I=k.height,R=void 0):k=void 0,b.height=Math.round(Math.min(I,b.plane.baseHeightM+cm)*100)/100;let L=!R&&!k&&b.height>b.plane.baseHeightM;if(b.level=R?R.level+1:k?k.level:L?1:0,b.rake=Km(b.rowDepths,b.frontDistance,b.height,b.plane.focalHeightM),!b.facesAction&&b.rowCount<hm)b.rake=0;else if(b.level===0){let A=Math.max(1e-6,(b.backD-b.frontD)*$);b.rake=Math.min(b.rake,sm,Math.round(Math.atan(am/A)*1800/Math.PI)/10)}else b.rowCount>=2&&(b.rake=Math.max(b.rake,r[Math.min(b.level,r.length)-1]));let T=(b.backD-b.frontD)*$,v=R&&i.has(R)||k&&g?.has(k.id);if(y!==void 0&&v&&b.rowCount>=2&&(b.rake=y),t&&T>0&&b.height+T*Math.tan(b.rake*Math.PI/180)>b.plane.baseHeightM+Vs){let A=Math.max(0,b.plane.baseHeightM+Vs-b.height);b.rake=Math.max(Ks,Math.round(Math.atan(A/T)*1800/Math.PI)/10)}n&&b.plane.stageDeck&&b.level>0&&(b.rake=Math.min(b.rake,xm)),b.backHeight=b.height+T*Math.tan(b.rake*Math.PI/180),M.set(b.id,R?.id??(k?M.get(k.id):void 0))}let S=b.plane.floorIndex;w.set(S,Math.min(w.get(S)??1/0,b.height)),P.push(b)}return M},c=a(new Map),u=new Map,l=p=>u.get(p)?.height??p.height;for(let p=!0,y=0;p&&y<e.length;y++){p=!1;for(let g of e)if(!(g.authored||i.has(g)))for(let M of e){let P=u.get(M)??M;M===g||P.height-P.plane.baseHeightM<Om||P.height<=l(g)+.01||Qm(g,M)&&(u.set(g,P),p=!0)}}let f=new Map(e.map(p=>[p.id,p])),m=e.filter(p=>!p.authored&&p.rowCount>=2&&i.has(f.get(c.get(p.id)??""))),h=m.length?Uo(m.map(p=>p.rake)):void 0;if(!u.size&&h===void 0)return c;let d=new Map([...new Set(u.values())].map(p=>[p,{...p}]));return a(new Map([...u].map(([p,y])=>[p,d.get(y)])),h,new Set(m.map(p=>p.id)))}var Ho=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function $s(e,t={x:0,y:-40}){let n=gt(e),o=new Map;for(let g of n){if(!g.sectionId)continue;let M=o.get(g.sectionId);M?M.push(g):o.set(g.sectionId,[g])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((g,M)=>({objects:g.objects,floorIndex:M,floorId:g.id,baseHeightM:g.baseHeightM??0,focal:g.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],s=new Set(i.flatMap(g=>g.objects.filter(M=>M.type==="table").map(M=>M.id))),a=[],c,u=new Set,l=i.map(g=>{let M=v=>!e.floors?.length||v.floorId===g.floorId,P=Um(n.filter(v=>!v.sectionId&&v.kind!=="booth"&&!s.has(v.rowId)&&M(v))),w=[];for(let v of P){let A=Le(He(Zs(v)),Bm/$);if(n.some(C=>!M(C)&&Ko(C,A)))continue;let _=`${Us}${g.floorIndex}-${w.length}`;u.add(_),o.set(_,v),w.push({type:"section",id:_,label:"",color:Fm,outline:A})}let x=w.length?{...g,objects:[...g.objects,...w]}:g,b=new Set(x.objects.filter(v=>v.type==="section").map(v=>v.logicalSectionId??v.id)),S=[...o.entries()].filter(([v])=>b.has(v)).flatMap(([,v])=>v),I=Hm(x.objects,Xo(S),S),R=x.focal;(I||x.focal&&!Ho(x.focal,t))&&(r.confident=!0),I&&(r.stage??={id:I.shape.id,inferred:I.inferred,...x.floorId?{floorId:x.floorId}:{}},(I.inferred||Ho(x.focal,t))&&(R=I.centre,r.focalInferred=!0));let k=I&&(!I.inferred||Qt(I.outline)*$*$<=jo),L=I?void 0:c,T={tableIds:s,floorIndex:x.floorIndex,floorId:x.floorId,baseHeightM:x.baseHeightM,focal:L?.focal??R,outline:I?.outline??L?.outline,focalHeightM:L?.focalHeightM??x.baseHeightM+(I&&k?Fe({...I.shape,role:"stage"}).heightM:0),stageDeck:L?.stageDeck??!!(I&&k&&Qt(I.outline)*$*$<=jo),middle:S.length?{x:S.reduce((v,A)=>v+A.x,0)/S.length,y:S.reduce((v,A)=>v+A.y,0)/S.length}:R};for(let v of x.objects){if(v.type!=="section")continue;let A=Xm(v,o.get(v.logicalSectionId??v.id)??[],T);A&&a.push(A)}return T.outline&&(c=T),Ho(x.focal,T.focal)||(r.focal??=[]).push({...x.floorId?{floorId:x.floorId}:{},point:{...T.focal}}),{unit:x,plane:T,stage:I,planeSeats:S}}),f=i.flatMap(g=>g.objects).map(g=>g.type==="shape"&&!g.role&&(Go(g.label)==="wall"||!Go(g.label)&&Hs(g))?{...g,role:"wall"}:g),m=tt({objects:f},n)!==null;m&&(r.indoor=!0);let h=new Set,d=qm(a,m,zm(n,l[0]?.plane.focal??t)<ym,h),p=new Map(a.filter(g=>!g.authored).map(g=>[g.id,g])),y=l.map(({unit:g,plane:M,stage:P,planeSeats:w})=>g.objects.map(x=>{let b=x.type==="shape"&&!x.role&&x.id!==P?.shape.id?Go(x.label):null;if(x.type==="shape"&&!x.role&&x.id!==P?.shape.id&&(b==="wall"||!b&&Hs(x))&&x.type==="shape"){(r.roles??=[]).push({id:x.id,...M.floorId?{floorId:M.floorId}:{},role:"wall"});let{fill:A,..._}=x;return{..._,role:"wall"}}if(b&&x.type==="shape")return(r.roles??=[]).push({id:x.id,...M.floorId?{floorId:M.floorId}:{},role:b}),{...x,role:b};let I=P?.inferred&&x.id===P.shape.id&&x.type==="shape"?Dm(x,P.outline,g.objects,w):null;if(I&&x.type==="shape")return r.stage?.id===x.id&&(r.stage.field=I),{...x,role:"stage",stageKind:I};let R=x.type==="shape"&&x.id===P?.shape.id&&x.heightM===void 0&&!x.stageKind&&a.some(A=>A.plane===M&&(h.has(A.id)||A.level===0&&A.facesAction&&A.rake<=wm&&(A.frontDistance+A.backD-A.frontD)*$>=Em)),k=R?{heightM:Rm}:{};if(P?.inferred&&x.id===P.shape.id&&x.type==="shape"&&Qt(P.outline)*$*$<=jo)return r.stage?.id===x.id&&(r.stage.deck=!0),{...x,role:"stage",...k};if(R&&x.type==="shape"&&x.role==="stage")return{...x,...k};let L=x.type==="section"?p.get(x.id):void 0;if(!L||x.type!=="section")return x;let T=L.rowCount>=2&&L.rake>0;u.has(L.id)?r.looseRowBlocks=(r.looseRowBlocks??0)+1:r.sections.push({id:L.id,floorId:M.floorId,surfaceKind:T?"rakedRows":"flat",height:L.height,rake:L.rake,stackedOn:d.get(L.id)});let v={status:"inferred",source:"public-2d-topology",note:Gm};return{...x,height:L.height,rake:L.rake,surfaceKind:T?"rakedRows":"flat",physical3dProvenance:{height:v,rake:v,surfaceKind:v}}}));if(e.floors?.length){let g=e.floors.map((M,P)=>({...M,objects:y[P],focalPoint:l[P].plane.focal}));return{doc:{...e,floors:g,objects:g[0].objects,focalPoint:g[0].focalPoint},report:r}}return{doc:{...e,objects:y[0],focalPoint:l[0].plane.focal},report:r}}var Qs=/^[\p{L}\p{N}]{1,4}$/u,Jm=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function qs(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 s=e.slice(n.length).trim();if(Qs.test(s))return s}let i=Jm.exec(e);if(i){let s=i[1].toLocaleLowerCase("en-US"),a=i[2].trim();if((r.startsWith(s)||s.startsWith(r))&&Qs.test(a))return a}return e}var Js={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"},eh=new Map(bo.map(e=>[e.key,e.label]));function th(e){return`picker.access.${e}`}function ea(e){let t=[],n=e.boothType;n&&Object.prototype.hasOwnProperty.call(Js,n)&&t.push({key:`booth:${n}`,icon:"booth",titleKey:`picker.boothType.${n}`,titleFallback:Js[n],tone:"place"});let o=e.wheelchairSpaceType;for(let a of e.accessibility??[]){if(a==="wheelchair"&&o)continue;let c=eh.get(a);c&&t.push({key:`access:${a}`,icon:a,titleKey:th(a),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 a=t.find(c=>c.tone==="warn"||c.tone==="premium");a?a.note=i:t.push({key:"note",icon:"note",titleKey:"picker.organizerNote",titleFallback:"Organizer note",tone:"note",note:i})}let s=typeof e.entrance=="string"?e.entrance.trim():"";return s&&t.push({key:"place:entrance",icon:"entrance",titleKey:"picker.entrance",titleFallback:"Entrance",tone:"place",note:s}),t}var nh=1.5,oh=30,rh=4,ih=3.6,sh=6,Wo=15,ah=3,ch=1;function lh(e){return Math.max(ih,Math.min(sh,2.4+.15*e))}var qt=Math.PI*2;function uh(e,t){let n=0,o=0;for(let f of e)n+=f.x,o+=f.y;let r=Math.atan2(o/e.length-t.y,n/e.length-t.x),i=e.map(f=>{let m=Math.atan2(f.y-t.y,f.x-t.x)-r;for(;m>Math.PI;)m-=qt;for(;m<-Math.PI;)m+=qt;return m+r}),s=i.map((f,m)=>m).sort((f,m)=>i[f]-i[m]),a=i[s[0]],c=i[s[s.length-1]];if(c-a>Math.PI)return null;let u=f=>Math.hypot(f.x-t.x,f.y-t.y),l=f=>{let m=e[f],h=(f+e.length-1)%e.length,d=(f+1)%e.length,p=Math.abs(i[h]-i[f])<=Math.abs(i[d]-i[f])?h:d,y=e[p];return u(m)<=u(y)?[m,y]:[y,m]};return{start:a,end:c,startEdge:l(s[0]),endEdge:l(s[s.length-1])}}function ta(e){return e.type==="shape"&&e.role==="wall"&&e.heightM===void 0}function zo(e,t,n=()=>!0){let o=[];for(let c of e){if(!ta(c)||!n(c))continue;let u=ie(c);if(!u||u.length<3)continue;let l=uh(u,t);if(!l)return[];o.push(l)}if(o.length<2)return[];let r=e.flatMap(c=>{if(c.type!=="shape"||c.role!=="entrance"&&c.role!=="exit")return[];let u=ie(c);if(!u?.length)return[];let l=0,f=0;for(let m of u)l+=m.x,f+=m.y;return[{x:l/u.length,y:f/u.length}]}),i=c=>(c%qt+qt)%qt;o.sort((c,u)=>i(c.start)-i(u.start));let s=c=>Math.hypot(c.x-t.x,c.y-t.y),a=[];for(let c=0;c<o.length;c++){let u=o[c],l=o[(c+1)%o.length],f=i(l.start-u.end);if(f<=0||f>=Math.PI/2)continue;let m=b=>i(b-u.end)<f;if(o.some(b=>b!==u&&b!==l&&(m(b.start)||m(b.end)||i(u.end-b.start)<b.end-b.start)))continue;let[d,p]=u.endEdge,[y,g]=l.startEdge,M={x:(d.x+p.x)/2,y:(d.y+p.y)/2},P={x:(y.x+g.x)/2,y:(y.y+g.y)/2},w=Math.hypot(P.x-M.x,P.y-M.y)*E;if(w<nh||w>oh||Math.abs(s(M)-s(P))*E>rh+.2*w)continue;let x={x:(M.x+P.x)/2,y:(M.y+P.y)/2};r.some(b=>m(Math.atan2(b.y-t.y,b.x-t.x))&&Math.abs(s(b)-s(x))*E<=ah)||a.push({quad:[d,p,g,y],mid:x,widthM:w,openingM:lh(w)})}return a}function na(e,t){let n=[];for(let i of t)if(i.text?.trim())for(let s of e){let a=Math.hypot(i.position.x-s.mid.x,i.position.y-s.mid.y)*E;a<=Wo&&n.push({text:i,gate:s,d:a})}n.sort((i,s)=>i.d-s.d);let o=new Map,r=new Set;for(let{text:i,gate:s}of n)o.has(i.id)||r.has(s)||(o.set(i.id,s),r.add(s));return o}function oa(e,t,n,o,r,i,s,a=()=>!0){let c=zo(t,At(n),a);if(!c.length)return;let u=t.find(f=>ta(f)&&a(f)),l=Tn(u?.fill,s);e.setMaterial(Rn);for(let f of c)r-f.openingM<ch||En(e,f.quad,o+f.openingM,o+r,[],l.top,l.wall,i,r);e.setMaterial(0)}var fh=6,mh=2.2,jn=.1,hh=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,dh=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),ph=.3,bh=1.8,yh=.9,gh=.55,xh=1,ra=4e3,Mh=6,ia="#d8a425",Sh="#e8c15a",Zo="#1c1608";function sa(e){let t=Ph(e);if(!t)return null;let n=ea(e).find(o=>o.icon===t.icon);return{...t,name:n?.titleFallback??t.icon}}function Ph(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:yn(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:ia,ink:Zo}:n?.restrictedView?{icon:"restrictedView",color:ia,ink:Zo}:n?.premium?{icon:"premium",color:Sh,ink:Zo}:null}function Ih(e,t){if(!e)return;let n,o=0;for(let[i,s]of e)s>o&&(o=s,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 Rh=6e3,wh=.25,aa=[-90,90,-135,135,-45,45];function Eh(e,t,n,o){let r=e.flatMap(({id:s,a,members:c})=>{let u=(a.minX+a.maxX)/2,l=(a.minY+a.maxY)/2,f=.5*Math.hypot(a.maxX-a.minX,a.maxY-a.minY),m=1/0;for(let h of c)m=Math.min(m,Math.hypot(t[h].x-u,t[h].y-l));return c.length&&m>=f*wh?[{id:s,cx:u,cy:l,half:f,members:c}]:[]}).sort((s,a)=>s.half-a.half),i=new Map;return r.forEach(({id:s,cx:a,cy:c,members:u},l)=>{let f=o.x-a,m=o.y-c,p=(Math.hypot(f,m)>1e-6?Math.atan2(m,f):0)+aa[l%aa.length]*Math.PI/180,y=Math.cos(p),g=Math.sin(p),M=-1,P=-1/0;for(let w of u){let x=(t[w].x-a)*y+(t[w].y-c)*g;x>P&&(P=x,M=w)}i.set(s,[t[M].x*E,n.seatDeckY(M),t[M].y*E])}),i}function la(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,s=t.zones??[],a=[];if(s.length){let c=new Map;for(let m of n)for(let h of m.objects)h.type==="section"&&h.zone&&c.set(h.id,h.zone);let u=new Map,l=new Map;for(let m=0;m<o.length;m++){let h=o[m],d=r.seatOwner[m],p=h.zoneId??(d?c.get(d):void 0);if(!p)continue;let y=u.get(p);y||(y={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(p,y));let g=l.get(p);g||l.set(p,g=[]),g.push(m),y.n++,h.x<y.minX&&(y.minX=h.x),h.y<y.minY&&(y.minY=h.y),h.x>y.maxX&&(y.maxX=h.x),h.y>y.maxY&&(y.maxY=h.y),y.sumY+=r.seatDeckY(m)}let f=Eh(s.flatMap(m=>{let h=u.get(m.id);return h?[{id:m.id,a:h,members:l.get(m.id)??[]}]:[]}),o,r,i);for(let m of s){let h=u.get(m.id),d=[];for(let[p,y]of c)y===m.id&&d.push(p);if(!h||h.n===0){a.push({id:m.id,label:m.label,color:oe(m.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(m.focalPoint??i).x*E,1.5,(m.focalPoint??i).y*E]});continue}a.push({id:m.id,label:m.label,color:oe(m.color),sectionIds:d,seatCount:h.n,...f.has(m.id)?{labelAt:f.get(m.id)}:{},center:[(h.minX+h.maxX)/2*E,h.sumY/h.n,(h.minY+h.maxY)/2*E],radius:.5*Math.hypot((h.maxX-h.minX)*E,(h.maxY-h.minY)*E)||1,focalWorld:[(m.focalPoint??i).x*E,1.5,(m.focalPoint??i).y*E]})}}return a}function ua(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:s,zones:a,focal:c}=e,u=[],l=[],f=[],m=new Map;for(let h of n)for(let d of h.objects){if(d.type!=="section"||!d.zone)continue;let p=(d.displayLabel||d.label||"").trim().toLocaleLowerCase();if(!p)continue;let y=t.floors?.[h.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&y===p)continue;let g=m.get(d.zone);g||m.set(d.zone,g=new Set),g.add(p)}for(let h of a)h.seatCount!==0&&(m.get(h.id)?.has(h.label.trim().toLocaleLowerCase())||u.push({id:`zone:${h.id}`,kind:"zone",text:h.label,anchor:[(h.labelAt??h.center)[0],(h.labelAt??h.center)[1]+fh,(h.labelAt??h.center)[2]],color:t.zones?.find(d=>d.id===h.id)?.color}));{let h=new Map,d=new Map,p=new Map,y=new Map;for(let g=0;g<o.length;g++){let M=r.seatOwner[g];if(!M)continue;let P=h.get(M);P||(P={n:0,x:0,y:0,deck:0},h.set(M,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 b=d.get(M);b||(b=new Map,d.set(M,b)),b.set(w,(b.get(w)??0)+1)}if(o[g].accessibility?.includes("wheelchair")){let b=p.get(M);b?b.push(g):p.set(M,[g])}let x=y.get(M);x||(x={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},y.set(M,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 M of g.objects){if(M.type!=="section"||Xs(M))continue;let P=h.get(M.id);if(!P||P.n===0)continue;let w=y.get(M.id),x=[P.x/P.n*E,P.deck/P.n,P.y/P.n*E],b=M.displayLabel||M.label||M.id;l.push({id:M.id,floorIndex:g.index,label:b,seatCount:P.n,center:x,radius:Math.max(1,Math.hypot(w.maxX-w.minX,w.maxY-w.minY)*.5*E),box:{min:[w.minX*E-.4,w.minDeck,w.minY*E-.4],max:[w.maxX*E+.4,w.maxDeck+1,w.maxY*E+.4]},focalWorld:[g.focal.x*E,g.baseHeightM+1.5,g.focal.y*E]});let S=t.floors?.[g.index]?.name?.trim().toLocaleLowerCase();if(!(n.length>1&&S===b.trim().toLocaleLowerCase())){let I=Ih(d.get(M.id),t),R=p.get(M.id);u.push({id:`section:${M.id}`,kind:"section",text:b,anchor:[x[0],x[1]+mh,x[2]],floorIndex:g.index,...I?{tint:I}:{},...R?{wheelchairSeats:R}:{}})}}}{for(let x of n)for(let b of x.objects){if(b.type!=="gaArea")continue;let S=ht(b.points);if(!S)continue;let I=b.labelPresentation?.visible===!1?"":b.displayLabel||b.label||b.id,R=b.capacity>0?[I,b.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):I;R&&u.push({id:`ga:${b.id}`,kind:"ga",text:R,anchor:[S.x*E,x.baseHeightM+bh,S.y*E],floorIndex:x.index})}let h=new Map,d=new Map;for(let x of n)for(let b of x.objects)if(b.type==="section"&&h.set(b.id,b.displayLabel||b.label||b.id),b.type==="row"){let S=b.displayLabel?.trim()||b.segmentedRow?.displayLabel?.trim();S&&d.set(b.id,S)}let p=new Map;for(let x=0;x<o.length;x++){let b=o[x],S=Math.hypot(b.x-c.x,b.y-c.y),I=p.get(b.rowId);(!I||S>I.far)&&p.set(b.rowId,{seat:b,index:x,far:S})}for(let[x,b]of p){let S=r.seatOwner[b.index]??b.seat.sectionId,I=ca(b.seat.label,x,h.get(S??""),d.get(x));I&&u.push({id:`row:${x}`,kind:"row",text:I,anchor:[b.seat.x*E,r.seatDeckY(b.index)+yh,b.seat.y*E],floorIndex:s[b.index]})}let y=new Map;for(let x=0;x<o.length;x++){let b=o[x],S=y.get(b.rowId);S||(S={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:ca(b.label,b.rowId,h.get(r.seatOwner[x]??b.sectionId??""),d.get(b.rowId)),sectionId:r.seatOwner[x]??b.sectionId},y.set(b.rowId,S));let I=x*3,R=i.iPosition[I],k=i.iPosition[I+1],L=i.iPosition[I+2];S.n++,S.x+=R,S.y+=k,S.z+=L,S.minX=Math.min(S.minX,R),S.maxX=Math.max(S.maxX,R),S.minZ=Math.min(S.minZ,L),S.maxZ=Math.max(S.maxZ,L)}for(let[x,b]of y)f.push({id:x,label:b.label,sectionId:b.sectionId,seatCount:b.n,center:[b.x/b.n,b.y/b.n,b.z/b.n],radius:Math.max(.8,Math.hypot(b.maxX-b.minX,b.maxZ-b.minZ)*.5)});let g=0,M=(x,b)=>{g++,u.push({id:`access:${o[x].id}`,kind:"access",text:b.name,icon:b.icon,color:b.color,...b.ink?{ink:b.ink}:{},seatWidthM:i.iChairWidth[x]*2,anchor:[o[x].x*E,r.seatDeckY(x)+xh,o[x].y*E],floorIndex:s[x],rowId:o[x].rowId})},P=null,w=()=>{if(P){let x=sa(o[P.seats[0]]),b=P.seats.length,S=Math.max(1,Math.round(b/Mh));for(let I=0;I<S&&g<ra;I++)M(P.seats[Math.min(b-1,Math.floor((I+.5)*b/S))],x)}P=null};for(let x=0;x<o.length&&g<ra;x++){let b=sa(o[x]);if(b&&o[x].accessibility?.length){w(),M(x,b);continue}if(!b){w();continue}P&&P.rowId===o[x].rowId&&P.icon===b.icon?P.seats.push(x):(w(),P={rowId:o[x].rowId,icon:b.icon,seats:[x]})}if(w(),o.length<=Rh)for(let x=0;x<o.length;x++){let b=o[x],S=Ah(b.displayLabel||b.label);S&&u.push({id:`seat:${b.id}`,kind:"seat",seatWidthM:i.iChairWidth[x]*2,text:S,anchor:[b.x*E,r.seatDeckY(x)+gh,b.y*E],floorIndex:s[x],rowId:b.rowId})}}for(let h of n){let d=tt(h,n.length===1?o:o.filter((g,M)=>s[M]===h.index)),p=d?na(zo(h.objects,At(d)),h.objects.filter(g=>g.type==="text")):new Map,y=[...p.values()];for(let g of h.objects){let M=g.type==="text"?p.get(g.id):void 0;if(g.type==="shape"&&(g.role==="entrance"||g.role==="exit")&&hh.test(g.label?.trim()??"")){let P=ie(g),w=P?ht(P):null;if(w&&y.some(x=>Math.hypot(w.x-x.mid.x,w.y-x.mid.y)*E<=Wo+x.widthM))continue}if(M&&g.type==="text")u.push({id:`text:${g.id}`,kind:"gate",text:g.text,icon:"entrance",anchor:[M.mid.x*E,h.baseHeightM+M.openingM+jn,M.mid.y*E],color:g.color,floorIndex:h.index});else if(g.type==="shape"&&g.role&&dh.has(g.role)){let P=ie(g),w=P?ht(P):null;if(!w||!g.label||g.gate?.hideFromBuyers)continue;u.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*E,h.baseHeightM+Fe(g).heightM+jn,w.y*E],color:g.fill,floorIndex:h.index})}else if(g.type==="text"){let P=g.semanticKind==="icon"?go(g.iconKey)?.key:void 0,w=g.text||(P?go(P).label:"");if(!w)continue;u.push({id:`text:${g.id}`,kind:"annotation",text:w,...P?{venueIcon:P}:{},anchor:P?[(g.position.x+g.fontSize/2)*E,h.baseHeightM+jn,(g.position.y+g.fontSize/2)*E]:[g.position.x*E,h.baseHeightM+jn,g.position.y*E],color:g.color,rotation:g.rotation,floorIndex:h.index})}else if(g.type==="booth"){if(g.labelPresentation?.visible===!1)continue;let P=Ne(g);if(!P)continue;let w=ht(P);if(!w)continue;u.push({id:`booth:${g.id}`,kind:"booth",text:g.displayLabel||g.label||g.id,anchor:[w.x*E,h.baseHeightM+Ln+ph,w.y*E],floorIndex:h.index})}}}return{labels:u,sections:l,rows:f}}function fa(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 Ah(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function ca(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&&qs(i,n)}function ma(e){let{doc:t,units:n,seats:o,surfaces:r,solids:i,hintedSeatFloor:s,seatFloor:a}=e,c=[];{let u=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let h=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),d=m*3,p=u[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 l=new Map;for(let m=0;m<n.length;m++)for(let h of n[m].objects)h.type==="section"&&l.set(h.id,m);let f=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<o.length;m++){let h=r.seatOwner[m],d=(h!==null?l.get(h):void 0)??s[m];if(d===void 0)continue;let p=f[d],y=o[m];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let g=r.seatDeckY(m);p.sumX+=y.x*E,p.sumDeck+=g,p.sumZ+=y.y*E,p.minDeck=Math.min(p.minDeck,g),p.maxDeck=Math.max(p.maxDeck,g+1.6),a[m]=d}for(let m=0;m<n.length;m++){let h=f[m],d=t.floors?.[m],p=u[m],y=Math.min(h.n?h.minX*E:n[m].focal.x*E-1,Number.isFinite(p.minX)?p.minX:1/0),g=Math.max(h.n?h.maxX*E:n[m].focal.x*E+1,Number.isFinite(p.maxX)?p.maxX:-1/0),M=Math.min(h.n?h.minY*E:n[m].focal.y*E-1,Number.isFinite(p.minZ)?p.minZ:1/0),P=Math.max(h.n?h.maxY*E:n[m].focal.y*E+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),w=Math.min(h.n?Math.min(n[m].baseHeightM,h.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),x=Math.max(h.n?Math.max(h.maxDeck,w+.5):w+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),b=[h.n?h.sumX/h.n:(y+g)/2,h.n?h.sumDeck/h.n:(w+x)/2,h.n?h.sumZ/h.n:(M+P)/2],S=Math.max(1,.5*Math.hypot(g-y,x-w,P-M));c.push({index:m,id:d?.id??`floor-${m}`,label:d?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:b,radius:S,box:{min:[y,w,M],max:[g,x,P]},focalWorld:[n[m].focal.x*E,n[m].baseHeightM+1.5,n[m].focal.y*E]})}}return c}function $o(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,s=(a,c)=>{a<n&&(n=a),c<o&&(o=c),a>r&&(r=a),c>i&&(i=c)};for(let a of t)s(a.x,a.y);for(let a of e)for(let c of a.objects)if(c.type==="section")for(let u of c.outline)s(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)s(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)s(u.x,u.y);else if(c.type==="booth"){let u=Ne(c);if(u)for(let l of u)s(l.x,l.y)}else if(c.type==="table"){let u=Bn(c);if(u)for(let l of u)s(l.x,l.y)}else if(c.type==="decorImage"){let u=Fn(c);if(u)for(let l of u)s(l.x,l.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function ga(e,t,n,o,r,i,s){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(...ie(m)??m.points??[]):m.type==="gaArea"?a.push(...m.points):m.type==="booth"?a.push(...Ne(m)??[]):m.type==="table"?a.push(...Bn(m)??[]):m.type==="decorImage"&&a.push(...Fn(m)??[]);if(pa(e,t[0],n,i)||ya(e,t[0],n,a,i))return!1;if(s&&da(e,t[0].baseHeightM,a,i,s))return!0;let c=Kt(a),u=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,f=c.length>=3?c.map(m=>{let h=m.x-u,d=m.y-l,p=Math.max(1,Math.hypot(h,d));return{x:m.x+h/p*80,y:m.y+d/p*80}}):jt(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return z(e,f,void 0,()=>-.04,-.22,i.ground,i.ground,K),!1}else{let a=t.reduce((y,g)=>g.baseHeightM<y.baseHeightM?g:y);e.setFloor(a.index);let c={...a,objects:t.flatMap(y=>y.objects)},u=n.map(y=>({x:y.x,y:y.y}));for(let y of c.objects)y.type==="section"&&u.push(...y.outline);if(pa(e,c,n,i)||ya(e,c,n,u,i))return!1;if(s&&da(e,a.baseHeightM,u,i,s))return!0;let l=n.filter((y,g)=>o[g]===a.index),f=$o([a],l),m=Math.hypot(f.maxX-f.minX,f.maxY-f.minY),h=Math.max(28,Math.min(80,m*.04)),d=jt(f.minX-h,f.minY-h,f.maxX-f.minX+h*2,f.maxY-f.minY+h*2),p=a.baseHeightM-.03;return z(e,d,void 0,()=>p,p-.22,i.ground,i.ground,K),!1}}function Qo(e,t,n,o){let{cx:r,cz:i,radius:s}=n,a=1/0,c=1/0,u=1/0,l=-1/0,f=-1/0,m=-1/0,h=(y,g,M)=>{a=Math.min(a,y),l=Math.max(l,y),c=Math.min(c,g),f=Math.max(f,g),u=Math.min(u,M),m=Math.max(m,M)};for(let y=0;y<e.position.length;y+=3){let g=y/3;o&&g>=o[0]&&g<o[1]||h(e.position[y],e.position[y+1],e.position[y+2])}for(let y=0;y<t.count;y++){let g=y*3,M=t.iPosition[g],P=t.iPosition[g+1],w=t.iPosition[g+2],x=Math.max(.35,t.iMaxRadius[y]??.35);h(M-x,P,w-x),h(M+x,P+1.6,w+x)}Number.isFinite(a)||(a=r-s,l=r+s,c=0,f=s*.16,u=i-s,m=i+s);let d=[(a+l)/2,(c+f)/2,(u+m)/2],p=Math.max(1,.5*Math.hypot(l-a,f-c,m-u));return{center:d,radius:p,minY:c,maxY:f}}var _h=4096;function xa(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/_h)),r=Math.ceil(e.count/o),i=new Float32Array((r*2+t.length*4+n.length)*3),s=0;for(let a=0;a<e.count;a+=o){let c=e.iPosition[a*3],u=e.iPosition[a*3+1],l=e.iPosition[a*3+2];i[s++]=c,i[s++]=u,i[s++]=l,i[s++]=c,i[s++]=0,i[s++]=l}for(let[a,c,u]of n)i[s++]=a,i[s++]=c,i[s++]=u;for(let a of t)for(let[c,u]of[[-1,-1],[1,-1],[1,1],[-1,1]])i[s++]=a.cx+c*a.halfX,i[s++]=a.y,i[s++]=a.cz+u*a.halfZ;return i.subarray(0,s)}function Ma(e,t,n,o,r,i,s=[]){let a=1/0,c=1/0,u=-1/0,l=-1/0;for(let x=0;x<e.count;x++){let b=x*3,S=e.iPosition[b],I=e.iPosition[b+2];S<a&&(a=S),S>u&&(u=S),I<c&&(c=I),I>l&&(l=I)}for(let[x,,b]of s)x<a&&(a=x),x>u&&(u=x),b<c&&(c=b),b>l&&(l=b);for(let x of t)a=Math.min(a,x.cx-x.halfX),u=Math.max(u,x.cx+x.halfX),c=Math.min(c,x.cz-x.halfZ),l=Math.max(l,x.cz+x.halfZ);let f=n.minX*E,m=n.maxX*E,h=n.minY*E,d=n.maxY*E,p=f,y=m,g=h,M=d;if(Number.isFinite(a)){let x=Math.max(2,.06*Math.hypot(u-a,l-c));p=Math.max(f,a-x),y=Math.min(m,u+x),g=Math.max(h,c-x),M=Math.min(d,l+x)}let P=Math.min(0,o),w=Math.max(r,i*.05);return{min:[p,P,g],max:[y,w,M]}}var ha=12,vh=.6,Ch=40;function da(e,t,n,o,r){let i=Kt([...n]);if(i.length<3)return!1;let s=1/0,a=1/0,c=-1/0,u=-1/0;for(let w of i)s=Math.min(s,w.x),c=Math.max(c,w.x),a=Math.min(a,w.y),u=Math.max(u,w.y);let l=Math.hypot(c-s,u-a)*E,f=Le(i,ha/E,1.2),m=Math.max(Ch,l*vh),h=Le(i,(ha+m)/E,1.2);if(f.length!==h.length)return!1;let d=re(o.ground,[.78,.76,.72],.35),p=re(o.ground,[.56,.62,.52],.3);z(e,f,void 0,()=>t-.04,t-.22,d,d,K);let y=t-.05,g=f.map(w=>[w.x*E,y,w.y*E]),M=h.map(w=>[w.x*E,y,w.y*E]),P=[0,1,0];for(let w=0;w<g.length;w++){let x=(w+1)%g.length;e.tri(g[w],M[x],M[w],P,p,r,r),e.tri(g[w],g[x],M[x],P,p,p,r)}return!0}function pa(e,t,n,o){let r=tt(t,n);if(!r)return!1;let i=t.baseHeightM,s=re(o.ground,[.62,.55,.47],.4);return z(e,r,void 0,()=>i-.04,i-.22,s,s,K),!0}var kh=3e3,Oh=20,ba=1.5,Th=1.2,Lh=.25;function ya(e,t,n,o,r){if(!n.length||n.length>kh||o.length<3)return!1;for(let R of t.objects){if(R.type==="shape"&&nn(R.stageKind))return!1;if(R.type==="section"){let{height:k}=Qe(R,{floorBaseHeightM:t.baseHeightM});if(k-t.baseHeightM>Oh)return!1}}let i=0,s=0;for(let R of o)i+=R.x,s+=R.y;i/=o.length,s/=o.length;let a=0,c=0,u=0;for(let R of o){let k=R.x-i,L=R.y-s;a+=k*k,c+=L*L,u+=k*L}let l=.5*Math.atan2(2*u,a-c),f=Math.cos(l),m=Math.sin(l),h=-m,d=f,p=1/0,y=-1/0,g=1/0,M=-1/0;for(let R of o){let k=(R.x-i)*f+(R.y-s)*m,L=(R.x-i)*h+(R.y-s)*d;p=Math.min(p,k),y=Math.max(y,k),g=Math.min(g,L),M=Math.max(M,L)}let P=R=>[[p-R,g-R],[y+R,g-R],[y+R,M+R],[p-R,M+R]].map(([k,L])=>({x:i+f*k+h*L,y:s+m*k+d*L})),w=P(ba/E),x=P((ba+Lh)/E),b=t.baseHeightM,S=re(r.ground,[.62,.55,.47],.4),I=re(r.ground,[.86,.86,.84],.55);return z(e,x,void 0,()=>b-.04,b-.22,S,S,K),z(e,x,[w.slice().reverse()],()=>b+Th,b-.04,re(I,[1,1,1],.2),I,K),!0}function Sa(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=Rr(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let f of n)for(let m of f.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:f});let s=new Set,a=new Set,c=new Map((t.overlay.productionElements??[]).map(f=>{let m=f.runtimeContentImageUrl;return[f.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),u=[];for(let f of r.value.overlay.productionElements??[]){let m=i.get(f.objectId),h=m?ie(m.shape):null,d=f.baseElevationM??0;if(!m||!h||h.length<3||!f.id||s.has(f.id)||a.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();s.add(f.id),a.add(f.objectId);let p=h.map(I=>I.x*E),y=h.map(I=>I.y*E),g=m.unit.baseHeightM+d,M=Math.min(...p),P=Math.max(...p),w=Math.min(...y),x=Math.max(...y),b,S=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&S&&(b=Yi(h,g,g+f.heightM,m.unit.focal),!b))if(P-M>=x-w){let I=Math.abs(w-m.unit.focal.y*E)<=Math.abs(x-m.unit.focal.y*E)?w-.006:x+.006;b=[[M,g,I],[P,g,I],[M,g+f.heightM,I],[P,g+f.heightM,I]]}else{let I=Math.abs(M-m.unit.focal.x*E)<=Math.abs(P-m.unit.focal.x*E)?M-.006:P+.006;b=[[I,g,w],[I,g,x],[I,g+f.heightM,w],[I,g+f.heightM,x]]}u.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:g,topY:g+f.heightM,bounds:{min:[M,g,w],max:[P,g+f.heightM,x]},occlusion:f.occlusion,...S?{contentImageUrl:S}:{},...b?{contentPlane:b}:{}})}let l=u.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(l.map(f=>[f.objectId,f])),elements:l}}var Pa=[.13,.14,.17],Ot=[.4,.43,.47],Bh=.18,Fh=.02,Nh=2.4,Dh=1500,Gh=240,jh=.25;function Ia(e,t,n,o){let r=t.stageKind??"";if(st(r)||r==="round"||!o.length)return;let i=ie(t);if(!i||i.length<3)return;let s={x:i.reduce((C,B)=>C+B.x,0)/i.length,y:i.reduce((C,B)=>C+B.y,0)/i.length},a=0,c=0,u=new Set;for(let C of o)a+=C.x,c+=C.y,u.add(Math.floor(Math.atan2(C.y-s.y,C.x-s.x)*180/Math.PI/10));let l=s.x-a/o.length,f=s.y-c/o.length,m=Math.hypot(l,f);if(m<1e-6)return;let h=o.reduce((C,B)=>C+Math.hypot(B.x-s.x,B.y-s.y),0)/o.length;if(u.size*10>Gh&&m<jh*h)return;let d=l/m,p=f/m,y=-p,g=d,M=-1/0,P=1/0,w=1/0,x=-1/0;for(let C of i){let B=(C.x-s.x)*d+(C.y-s.y)*p,O=(C.x-s.x)*y+(C.y-s.y)*g;M=Math.max(M,B),P=Math.min(P,B),w=Math.min(w,O),x=Math.max(x,O)}let b=(x-w)*E,S=(M-P)*E;if(b<3||S<1.5||b*S>Dh)return;let I=Bh/E,R=(C,B)=>({x:s.x+d*C+y*B,y:s.y+p*C+g*B}),k=(C,B,O,F)=>[R(C,O),R(C,F),R(B,F),R(B,O)],L=n+Math.max(3.5,Math.min(8,b*.35)),T=n+Math.min(Nh,L-n-1),v=.2/E,A=P+Math.min(S*.25,1.5)/E,_=Fh/E;z(e,k(M-2*I+_,M-I-_,w+I+v,x-I-v),void 0,()=>T,n,Pa,Pa,K);for(let[C,B]of[[w+I,w+I+v],[x-I-v,x-I]])z(e,k(M-2*I,M-I,C,B),void 0,()=>L+.3,n,Ot,Ot,K),z(e,k(A+v,M-2*I,C,B),void 0,()=>L+.3,L,Ot,Ot,K);z(e,k(A,A+v,w+I,x-I),void 0,()=>L+.3,L,Ot,Ot,K)}function ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ce(e){return Array.isArray(e)?e:[]}function Hh(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ke(n))continue;let o=ke(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 Hn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Vh(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Uh(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 Xh(e){let t=Hn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:Hn(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:Hn(e.rotation,4),r=e.scale===void 0?[1,1,1]:Hn(e.scale,3);if(!n||!o||!r)return null;let[i,s,a,c]=o,u=Math.hypot(i,s,a,c);if(!(u>1e-8))return null;let l=i/u,f=s/u,m=a/u,h=c/u,d=l+l,p=f+f,y=m+m,g=l*d,M=l*p,P=l*y,w=f*p,x=f*y,b=m*y,S=h*d,I=h*p,R=h*y;return[(1-(w+b))*r[0],(M+R)*r[0],(P-I)*r[0],0,(M-R)*r[1],(1-(g+b))*r[1],(x+S)*r[1],0,(P+I)*r[2],(x-S)*r[2],(1-(g+w))*r[2],0,n[0],n[1],n[2],1]}function Kh(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 Yh(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],s=e[9],a=e[2],c=e[6],u=e[10],l=i*u-s*c,f=s*a-r*u,m=r*c-i*a,h=t*l+n*f+o*m;if(Math.abs(h)<1e-12)return null;let d=1/h;return[l*d,f*d,m*d,(o*c-n*u)*d,(t*u-o*a)*d,(n*a-t*c)*d,(n*s-o*i)*d,(o*r-t*s)*d,(t*i-n*r)*d]}function Ra(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,s=e[6]*t+e[7]*n+e[8]*o,a=Math.hypot(r,i,s)||1;return r/=a,i/=a,s/=a,[r,i,s]}function Wh(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),s=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let a=e.subarray(n,n+i);if(s===1313821514&&!o)try{let c=JSON.parse(new TextDecoder().decode(a).replace(/[\u0000 ]+$/g,""));if(!ke(c))return null;o=c}catch{return null}else if(s===5130562&&!r)r=a;else return null;n+=i}return n===e.byteLength&&o&&r?{json:o,bin:r}:null}function zh(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Zh(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function $h(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 Qh(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Wh(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!ke(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=Ce(o.extensionsUsed).filter(w=>typeof w=="string");if(i.includes("KHR_draco_mesh_compression")||Hh(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||Ce(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(Ce(o.images).length||Ce(o.textures).length)return{ok:!1,issue:"external_resource"};let s=Ce(o.buffers);if(s.length!==1||!ke(s[0])||s[0].uri!==void 0||typeof s[0].byteLength!="number"||!Number.isInteger(s[0].byteLength)||s[0].byteLength<0||s[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let a=Ce(o.accessors),c=Ce(o.bufferViews),u=Ce(o.meshes),l=Ce(o.nodes),f=Ce(o.scenes),m=typeof o.scene=="number"?o.scene:0;if(!ke(f[m]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(r.buffer,r.byteOffset,r.byteLength),d=(w,x,b)=>{if(typeof w!="number"||!Number.isInteger(w)||!ke(a[w]))return null;let S=a[w];if(S.type!==x||S.sparse!==void 0||S.normalized===!0||typeof S.count!="number"||!Number.isInteger(S.count)||S.count<1||typeof S.componentType!="number"||!b.includes(S.componentType)||typeof S.bufferView!="number")return null;let I=c[S.bufferView];if(!ke(I)||I.buffer!==0||typeof I.byteLength!="number"||!Number.isInteger(I.byteLength)||I.byteLength<0)return null;let R=Zh(S.type),k=zh(S.componentType),L=typeof I.byteStride=="number"?I.byteStride:R*k,T=typeof I.byteOffset=="number"?I.byteOffset:0,v=typeof S.byteOffset=="number"?S.byteOffset:0,A=T+v,_=v+(S.count-1)*L+R*k;if(!Number.isInteger(L)||!Number.isInteger(T)||!Number.isInteger(v)||L<R*k||T<0||v<0||T+I.byteLength>r.byteLength||_>I.byteLength)return null;let C=[];for(let B=0;B<S.count;B++){let O=[];for(let F=0;F<R;F++){let D=$h(h,A+B*L+F*k,S.componentType);if(!Number.isFinite(D))return null;O.push(D)}C.push(O)}return C},p=[],y=[],g=0,M=new Set,P=(w,x)=>{if(typeof w!="number"||!Number.isInteger(w)||!ke(l[w])||M.has(w))return!1;M.add(w);let b=l[w],S=Xh(b);if(!S)return!1;let I=Uh(x,S),R=Yh(I);if(!R)return!1;if(b.mesh!==void 0){if(typeof b.mesh!="number")return!1;let k=u[b.mesh];if(!ke(k))return!1;for(let L of Ce(k.primitives)){if(!ke(L)||L.mode!==void 0&&L.mode!==4||!ke(L.attributes))return!1;let T=d(L.attributes.POSITION,"VEC3",[5126]),v=L.attributes.NORMAL===void 0?null:d(L.attributes.NORMAL,"VEC3",[5126]);if(!T||L.attributes.NORMAL!==void 0&&!v)return!1;let A=T.length;if(L.indices!==void 0){let C=typeof L.indices=="number"?a[L.indices]:null;A=ke(C)?C.count:void 0}if(typeof A!="number"||!Number.isInteger(A)||A%3!==0||(g+=A/3,g>1e5))return!1;let _=L.indices===void 0?T.map((C,B)=>[B]):d(L.indices,"SCALAR",[5121,5123,5125]);if(!_||_.length%3!==0||_.length!==A)return!1;for(let C=0;C<_.length;C+=3){let B=[_[C][0],_[C+1][0],_[C+2][0]];if(B.some(D=>!Number.isInteger(D)||D<0||D>=T.length))return!1;let O=B.map(D=>Kh(I,...T[D])),F=null;if(!v){let D=O[1][0]-O[0][0],j=O[1][1]-O[0][1],N=O[1][2]-O[0][2],X=O[2][0]-O[0][0],V=O[2][1]-O[0][1],Z=O[2][2]-O[0][2];F=Ra([1,0,0,0,1,0,0,0,1],j*Z-N*V,N*X-D*Z,D*V-j*X)}for(let D=0;D<3;D++)p.push(...O[D]),y.push(...v?Ra(R,...v[B[D]]):F)}}}for(let k of Ce(b.children))if(!P(k,I))return!1;return M.delete(w),!0};for(let w of Ce(f[m].nodes))if(!P(w,Vh()))return{ok:!1,issue:g>1e5?"triangle_limit":"unsupported_glb"};return!g||p.length!==g*9||y.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:g,position:new Float32Array(p),normal:new Float32Array(y)}}function wa(e){try{return Qh(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Ea(e){let{doc:t}=e,n=Kr(t.theme),o=n.structure,r=Ti(t,e.eventConfigurationId??t.eventConfigurationId),i=Sa(e.eventConfigurationId,e.eventConfiguration,r),s=e.seats,a=new un,c=null;if(e.registeredShellGlb){let G=wa(e.registeredShellGlb);if(G.ok){let H=G.position.length/3,J=new Float32Array(G.position.length),me=n.materials.shell??o.tierWall;for(let xe=0;xe<H;xe++){let Ie=G.normal[xe*3+1],ae=Ie<-.25?.4:.62+.38*Math.max(0,Ie);J[xe*3]=me[0]*ae,J[xe*3+1]=me[1]*ae,J[xe*3+2]=me[2]*ae}c={position:G.position,normal:G.normal,color:J,floor:new Float32Array(H).fill(-2),material:new Float32Array(H),count:H}}}let u=new Map;for(let G of r)for(let H of G.objects)u.set(H.id,G.index),H.type==="section"&&u.set(H.logicalSectionId??H.id,G.index);let l=s.map(G=>u.get(G.sectionId??"")??u.get(G.rowId??"")??0),f=$o(r,s),m=a.vertexCount,d=ga(a,r,s,l,f,o,re(n.background.top,n.background.bottom,.5))?a.vertexCount:m,p=fi(t,s),y=new Map,g=new Map;for(let G of t.categories??[])y.set(G.key,G.color),G.seatGlyph&&g.set(G.key,G.seatGlyph);let M=[],P=Ki(r,s,l),w=new Map;s.forEach((G,H)=>{let J=P.seatDeckY(H);Number.isFinite(J)&&w.set(G.rowId,Math.min(w.get(G.rowId)??1/0,J))});let x=new Float32Array(s.length),b=[],S=new Map((t.floors??[]).map((G,H)=>[G.id,H])),I=r.map(()=>[]);for(let G of s){let H=G.floorId?S.get(G.floorId)??0:0;I[Math.min(H,I.length-1)]?.push(G)}let R=(G,H)=>{if(!H||H.length<3)return!1;let J=Math.min(...H.map(ae=>ae.x)),me=Math.max(...H.map(ae=>ae.x)),xe=Math.min(...H.map(ae=>ae.y)),Ie=Math.max(...H.map(ae=>ae.y));for(let ae=0;ae<G;ae++)for(let ce of I[ae])if(!(ce.x<J||ce.x>me||ce.y<xe||ce.y>Ie)&&Pe(ce,H,void 0))return!0;return!1},k=null,L=G=>r.length===1?s:s.filter((H,J)=>l[J]===G),T=(G,H)=>{let J=Ne(G);if(!J)return!1;let me=1/0,xe=1/0,Ie=-1/0,ae=-1/0;for(let ce of J)me=Math.min(me,ce.x),Ie=Math.max(Ie,ce.x),xe=Math.min(xe,ce.y),ae=Math.max(ae,ce.y);return s.some((ce,De)=>ce.kind!=="booth"&&(r.length===1||l[De]===H)&&ce.x>me&&ce.x<Ie&&ce.y>xe&&ce.y<ae&&_e(J,ce.x,ce.y))},v;for(let G=0;G<r.length;G++){let H=r[G];a.setFloor(G);let J=tt(H,L(G)),me=0;if(J){let Y=0;for(let he of H.objects)if(he.type==="section")for(let Me of P.bySection.get(he.id)?.rowLevels??[])Y=Math.max(Y,Me.y-H.baseHeightM);if(me=ji(Y),!v){let he=At(J);v={centre:[he.x*E,he.y*E]}}}let xe=new In,Ie=[],ae=H.objects.filter(Y=>Y.type==="shape"&&(Y.role==="entrance"||Y.role==="exit")),ce=H.objects.filter(Y=>Y.type==="section"&&!!Y.outline&&Y.outline.length>=3),De=Ss(H.objects.filter(Y=>Y.type==="booth"),H.focal);for(let Y of H.objects)if(Y.type==="section"){let he=a.vertexCount;Ns(a,Y,H,mi(Y,p),P.bySection.get(Y.id),xe,ce,o,G>0&&R(G,Y.outline));let Me=a.vertexCount-he;Me>0&&b.push({sectionId:Y.id,start:he,count:Me})}else if(Y.type==="shape"){let he=i.byObjectId.get(Y.id),Me=M.length,rt=J!==null&&Y.role==="wall"&&!he;a.setMaterial(rt?Rn:(he?.kind??Y.role)==="screen"?1:0);let it=Y.role==="stage"&&!he?Is(Y,L(G)):rt&&Y.heightM===void 0?{...Y,heightM:me}:Y,Ze=Di(it,Ie);if(ys(a,it,H.baseHeightM+Ze.supportOffsetM,Ze.topOffsetM-Ze.supportOffsetM,o,H.focal,M,he,ae),a.setMaterial(0),Y.role==="stage"&&!he&&M.length>Me&&(k??G)===G){k=G;let $e=t.floors?.[G]?.id,Tt=r.length>1&&$e?s.filter(Jt=>Jt.floorId===$e):s;Ia(a,it,M[M.length-1].y,Tt)}}else Y.type==="gaArea"?xs(a,Y,H.baseHeightM,oe(y.get(Y.categoryKey)),o):Y.type==="booth"?ds(a,Y,H.baseHeightM,oe(y.get(Y.categoryKey)),o,De.get(Y.id)??H.focal,T(Y,G)):Y.type==="table"?bs(a,Y,Math.max(H.baseHeightM,w.get(Y.id)??H.baseHeightM),oe(Y.fill??t.theme?.decorFill??"#232c40"),o,!!(Y.fill??t.theme?.decorFill)):Y.type==="decorImage"&&gs(a,Y,H.baseHeightM,o);J&&oa(a,H.objects,J,H.baseHeightM,me,H.focal,o,Y=>!i.byObjectId.has(Y.id)),Gs(a,H,s,P,o,n.materials.shell,!c)}let A=r.length>1?{x:r.reduce((G,H)=>G+H.focal.x,0)/r.length,y:r.reduce((G,H)=>G+H.focal.y,0)/r.length}:t.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},_=Fr(c?[a.build(),c]:[a.build()]),C=Mi(s,e.initialState,P,x,y,g),B=la({doc:t,units:r,seats:s,surfaces:P,focal:A}),{labels:O,sections:F,rows:D}=ua({doc:t,units:r,seats:s,surfaces:P,seatData:C,hintedSeatFloor:l,zones:B,focal:A}),j=new Map(F.map((G,H)=>[G.id,H]));P.seatOwner.forEach((G,H)=>{C.iSection[H]=G?j.get(G)??-1:-1});let N=ma({doc:t,units:r,seats:s,surfaces:P,solids:_,hintedSeatFloor:l,seatFloor:x});fa(O,N),C.iYaw=xi(C.iPosition,s.length,G=>s[G].rowId,G=>{let H=r[x[G]]?.focal??A;return[H.x*E,H.y*E]});let X=(f.minX+f.maxX)/2*E,V=(f.minY+f.maxY)/2*E,Z=.5*Math.hypot((f.maxX-f.minX)*E,(f.maxY-f.minY)*E)||10,U=Qo(_,C,{cx:X,cz:V,radius:Z},[m,d]),te=Qo(_,C,{cx:X,cz:V,radius:Z}),Q=qh(r),fe=Ma(C,M,f,U.minY,U.maxY,Z,Q);return{sharedAisles:Nr(r.flatMap(G=>G.objects.flatMap(H=>{if(H.type!=="section")return[];let J=P.bySection.get(H.id);return J?[{sectionId:H.id,floorIndex:G.index,rows:J.rowLevels}]:[]}))),solids:_,sectionSolidRanges:b,seats:C,seatSectionIds:P.seatOwner,bounds:{center:[(fe.min[0]+fe.max[0])/2,(fe.min[1]+fe.max[1])/2,(fe.min[2]+fe.max[2])/2],radius:Z,groundY:0,box:fe,fitPoints:xa(C,M,Q)},...v?{room:v}:{},...!v&&r.some(G=>G.objects.some(H=>H.type==="shape"&&nn(H.stageKind)))?{outdoor:!0}:{},renderBounds:{center:U.center,radius:U.radius},clipBounds:{center:te.center,radius:te.radius},stateColorLUT:Yr(n,dn),theme:n,seatCount:s.length,focalWorld:[A.x*E,1.5,A.y*E],zones:B,stages:M,productionElements:i.elements,sections:F,rows:D,labels:O,floors:N}}function qh(e){let t=[];for(let n of e)for(let o of n.objects){let r=o.type==="gaArea"?o.points:o.type==="booth"?Ne(o):null;for(let i of r??[])t.push([i.x*E,n.baseHeightM,i.y*E])}return t}function Jh(e,t){let{doc:n,report:o}=$s(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])),u=h=>h.map(d=>d.type==="shape"&&c.has(d.id)?{...d,role:c.get(d.id)}:d),l=e.floors?.map(h=>({...h,objects:u(h.objects)})),f=new Float64Array(t.length).fill(Number.NaN),m=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((h,d)=>{h.eyeHeightM!==void 0&&(f[d]=h.eyeHeightM),h.focalPoint&&(m[d*2]=h.focalPoint.x,m[d*2+1]=h.focalPoint.y)}),{doc:{...e,objects:l?.[0]?.objects??u(e.objects),...l?{floors:l}:{}},report:o,eyeHeightM:f,focal:m}}let i=new Map(gt(n).map(c=>[c.id,c])),s=new Float64Array(t.length).fill(Number.NaN),a=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,u)=>{let l=i.get(c.id)??c;l.eyeHeightM!==void 0&&(s[u]=l.eyeHeightM),l.focalPoint&&(a[u*2]=l.focalPoint.x,a[u*2+1]=l.focalPoint.y)}),{doc:n,report:o,eyeHeightM:s,focal:a}}function ed(e,t){return e.map((n,o)=>{let r=t.eyeHeightM[o],i=t.focal[o*2],s=t.focal[o*2+1],a={...n};return Number.isNaN(r)?delete a.eyeHeightM:a.eyeHeightM=r,Number.isNaN(i)?delete a.focalPoint:a.focalPoint={x:i,y:s},a})}function Aa(e){let t=e.estimate===!1?null:Jh(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:ed(e.seats,t)},estimate:t}:{input:e}}function td(e){return[e.solids.position,e.solids.normal,e.solids.color,e.solids.floor,e.solids.material,e.seats.iPosition,e.seats.iState,e.seats.iCategory,e.seats.iMaxRadius,e.seats.iRing,e.seats.iFloor,e.seats.iYaw,e.seats.iChairWidth,e.seats.iGlyph,e.seats.iPhysicalSeat].map(n=>n.buffer)}var _a=self;_a.onmessage=e=>{let t=performance.now(),n=!e.data.seats,o=e.data.seats??gt(e.data.doc),{input:r,estimate:i}=Aa({doc:e.data.doc,seats:o,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb,estimate:e.data.estimate}),s=Ea(r),a=td(s);i&&a.push(i.eyeHeightM.buffer,i.focal.buffer),_a.postMessage({model:s,buildMs:performance.now()-t,...n?{seats:o}:{},...i?{estimate:i}:{}},a)};
1
+ "use strict";var zc=Object.create;var Ur=Object.defineProperty;var Zc=Object.getOwnPropertyDescriptor;var $c=Object.getOwnPropertyNames;var Qc=Object.getPrototypeOf,qc=Object.prototype.hasOwnProperty;var Jc=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of $c(t))!qc.call(e,r)&&r!==n&&Ur(e,r,{get:()=>t[r],enumerable:!(o=Zc(t,r))||o.enumerable});return e};var et=(e,t,n)=>(n=e!=null?zc(Qc(e)):{},Jc(t||!e||!e.__esModule?Ur(n,"default",{value:e,enumerable:!0}):n,e));var yb=Math.PI/180;function we(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function xo(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Mo(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 kt(e){return e.length?Mo(e):null}function Xr(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,s=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+s*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+s*e.end.y}}function Kr(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[Xr(e,.5)];let o=Array.from({length:n+1},(c,l)=>Xr(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 s=[],a=1;for(let c=0;c<t;c+=1){let l=i*c/(t-1);for(;a<r.length-1&&r[a]<l;)a+=1;let u=r[a-1],f=r[a],m=f===u?0:(l-u)/(f-u);s.push({x:o[a-1].x+(o[a].x-o[a-1].x)*m,y:o[a-1].y+(o[a].y-o[a-1].y)*m})}return s}function So(e,t,n){return Math.max(t,Math.min(n,e))}function el(e){return So(e,0,1)}function Wr(e){let t=el(e);return t*t*(3-2*t)}var Ot=Math.PI*2;function Lt(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function tl(e,t,n){let o=t-e;if(n){for(;o<0;)o+=Ot;for(;o>=Ot;)o-=Ot}else{for(;o>0;)o-=Ot;for(;o<=-Ot;)o+=Ot}return o}function Zr(e){if(e.version!==1||e.closed!==!0||!Lt(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||!Lt(n.end))return!1;if(n.kind==="line"){if(we(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!Lt(n.control1)||!Lt(n.control2)||we(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!Lt(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(we(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(we(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||we(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return we(t,e.start)<=1e-4}function nl(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 $r(e,t=2){if(!Zr(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 s=Math.atan2(r.y-i.center.y,r.x-i.center.x),a=Math.atan2(i.end.y-i.center.y,i.end.x-i.center.x),c=tl(s,a,i.clockwise),l=Math.max(2,Math.ceil(Math.abs(c)*i.radius/n));for(let u=1;u<=l;u+=1){let f=s+c*u/l;o.push({x:i.center.x+Math.cos(f)*i.radius,y:i.center.y+Math.sin(f)*i.radius})}}else{let s=we(r,i.control1)+we(i.control1,i.control2)+we(i.control2,i.end),a=Math.max(2,Math.ceil(s/n));for(let c=1;c<=a;c+=1)o.push(nl(r,i,c/a))}r=i.end}return we(o[o.length-1],o[0])<=1e-4&&o.pop(),o}var ol=45,Ro=150,rl=60;function il(e){let t=ol/100;if(e<=t)return Ro;let n=Math.min(1,(e-t)/(1-t));return Ro-n*(Ro-rl)}var Yr=.5523;function zr(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function sl(e){let t=[],n=[];for(e.forEach((o,r)=>{Lt(o)&&(t.length&&zr(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&zr(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}var al=.5,cl=4/3;function ll(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 s=-r/i,a=o/i,c=n*cl;return{kind:"bezier",control1:{x:e.x+o/3+s*c,y:e.y+r/3+a*c},control2:{x:e.x+o*2/3+s*c,y:e.y+r*2/3+a*c},end:{...t}}}function Qr(e,t){let{points:n,sourceIndex:o}=sl(e),r=n.length;if(r<3)return null;let i=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,a=new Array(r).fill(0);if(s?.length)for(let _=0;_<r;_+=1){let I=s[o[_]];a[_]=Number.isFinite(I)?Math.min(100,Math.max(-100,I))/100:0}let c=a.some(_=>Math.abs(_)>1e-6);if(i<=0&&!c)return null;let l=t.wideAngleThresholdDeg??il(i),u=[];for(let _=0;_<r;_+=1)u[_]=we(n[_],n[(_+1)%r]);let f=new Array(r).fill(0);for(let _=0;_<r;_+=1){let I=n[(_-1+r)%r],y=n[_],x=n[(_+1)%r],P={x:I.x-y.x,y:I.y-y.y},R={x:x.x-y.x,y:x.y-y.y},v=Math.hypot(P.x,P.y),T=Math.hypot(R.x,R.y);if(v<=1e-9||T<=1e-9)continue;let k=Math.min(1,Math.max(-1,(P.x*R.x+P.y*R.y)/(v*T))),C=Math.acos(k)*180/Math.PI;if(C<l)continue;let E=Wr((C-l)/(180-l));f[_]=i*E*.5*Math.min(v,T)}for(let _=0;_<r;_+=1){let I=(_+1)%r,y=f[_]+f[I];if(y>u[_]&&y>1e-9){let x=u[_]/y;f[_]*=x,f[I]*=x}}let m=new Array(r),h=new Array(r);for(let _=0;_<r;_+=1){let I=n[(_-1+r)%r],y=n[_],x=n[(_+1)%r];if(f[_]<=1e-6){m[_]={...y},h[_]={...y};continue}let P=we(y,I)||1,R=we(y,x)||1;m[_]={x:y.x+(I.x-y.x)/P*f[_],y:y.y+(I.y-y.y)/P*f[_]},h[_]={x:y.x+(x.x-y.x)/R*f[_],y:y.y+(x.y-y.y)/R*f[_]}}if(f.every(_=>_<=1e-6)&&!c)return null;let d=[],p={...h[0]},b=p,M=(_,I)=>{if(we(b,_)<=1e-9)return;let y=a[I];Math.abs(y)>1e-6?d.push(ll(b,_,y*al*u[I])):d.push({kind:"line",end:{..._}}),b=_};for(let _=1;_<=r;_+=1){let I=_%r,y=n[I];M(m[I],(_-1)%r),f[I]>1e-6&&we(m[I],h[I])>1e-9&&(d.push({kind:"bezier",control1:xo(m[I],y,Yr),control2:xo(h[I],y,Yr),end:{...h[I]}}),b=h[I])}if(!d.length)return null;let g=d[d.length-1];we(g.end,p)>1e-9&&(g.kind==="line"?g.end={...p}:d.push({kind:"line",end:{...p}}));let S={version:1,closed:!0,start:p,segments:d};return Zr(S)?S:null}function ul(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 fl(e){let t=ul(e);return t.length?Qr(e.points,{edgeCurvature:t}):null}function An(e,t=2){let n=fl(e);return n?$r(n,t):e.points??[]}function qr(e){return e.kind==="polygon"?Jt(e.holes):[]}function ei(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((m,h)=>m.segmentedRow.componentIndex-h.segmentedRow.componentIndex),s=i[0]?.segmentedRow?.componentCount??0,a=i[0]?.segmentedRow;if(!a||!(s>=2&&i.length===s&&a?.boundaryBefore==="start"&&i.every((m,h)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===o&&m.segmentedRow.componentCount===s&&m.segmentedRow.componentIndex===h&&m.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(h===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===a.displayLabel)))continue;let l=i.reduce((m,h)=>m+h.seatCount,0),u=0,f=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(m.id,{groupId:o,adjacencyOffset:u,displayOffset:f,displayLabel:a.displayLabel,totalSeats:l,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),u+=m.seatCount,f+=m.seatCount}return t}var ml="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var hl="abcdefghijklmnopqrstuvwxyz";function dl(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 en(e,t=!1){let n=t?hl:ml;return dl(Math.max(0,Math.floor(e)-1),n)}var pl=[[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 ti(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of pl)for(;t>=o;)n+=r,t-=o;return n}function bl(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 Po(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",s=e.seatNumbering?.prefix??"",a=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`${s}${d}`}let l=i==="odd"||i==="even"?2:r,u=a!=null&&Number.isFinite(a)?a-(c-1)*l:n,f=o==="center"?bl(c)[t]:o==="rtl"?c-1-t:t,m;switch(i){case"odd":{let h=u%2===1?u:u+1;m=String(h+f*2);break}case"even":{let h=u%2===0?u:u+1;m=String(h+f*2);break}case"roman":m=ti(u+f*r);break;case"letters-upper":m=en(u+f*r,!1);break;case"letters-lower":m=en(u+f*r,!0);break;default:m=String(u+f*r);break}return`${s}${m}`}function yl(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function ni(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${Po(e,t)}`}function gl(e,t,n,o){if(o?.displayLabel)return null;if(e.seatDisplayLabelMode==="number"||!n)return{row:e.displayLabel||e.label,seat:Po(e,t)};let r=yl(n);return{row:n.displayLabel,seat:Po(r,n.displayOffset+t)}}function _o(e,t,n,o){let r=gl(e,t,n,o);return r?e.seatDisplayLabelMode==="number"?r.seat:`${r.row}-${r.seat}`:o.displayLabel}function oi(e,t){return`${e.label}-${t+1}`}function xl(e,t,n){return e?.direction==="anticlockwise"?Math.max(0,t-1-n):n}function Ml(e,t){let n=e.chairNumbering,o=n?.start??1,r=xl(n,Math.max(0,Math.round(e.seatCount)),t);return n?.format==="letter"?en(Math.max(1,o)+r):String(o+r)}function ri(e,t){let n=Ml(e,t);return(e.chairNumbering?.format??"table-number")==="table-number"?`${e.displayLabel??e.label}-${n}`:n}var ee=.02291666666666667,Ke=1/ee,Sl=58,Rl=Sl*ee;var Il=3,ii=0,wo=120,Pl=0,_l=45,wl=7,tt=1.2;function Eo(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function El(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=wl?e:Il}function mt(e,t={}){let n=Eo(t.floorBaseHeightM,ii,wo,0),o=Math.min(wo,n+El(e.elevation)*Rl),r=e.height===void 0?o:Eo(e.height,ii,wo,o),i=Eo(e.rake,Pl,_l,0);return{height:r,rake:i}}function si(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 Tt(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],s=e[r+1],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c,u=l>1e-12?((t-i.x)*a+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let f=t-(i.x+u*a),m=n-(i.y+u*c);if(Math.abs(f)>=o||Math.abs(m)>=o)continue;let h=Math.hypot(f,m);h<o&&(o=h)}return o}function Al(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 s=Math.hypot(i.x-t,i.y-n);s>r&&(r=s)}return{cx:t,cy:n,r}}function ai(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Ao(e,t){let n=1/0;for(let o of si(e)){let r=Tt(t,o.x,o.y);r<n&&(n=r)}for(let o of si(t)){let r=Tt(e,o.x,o.y);r<n&&(n=r)}return n}function Cl(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 f=Math.hypot(u.x-n,u.y-o);f>r&&(r=f,i=u)}let s=i.x-n,a=i.y-o,c=Math.hypot(s,a);c>1e-9?(s/=c,a/=c):(s=1,a=0);let l=e.map((u,f)=>({p:u,i:f,t:(u.x-n)*s+(u.y-o)*a})).sort((u,f)=>u.t-f.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function Co(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,s=0,a=0,c=0,l=0,u=0;for(let g of e){let S=g.x-n,_=g.y-o;r+=S*S,s+=_*_,i+=S*_,a+=S*S*S,c+=_*_*_,l+=S*_*_,u+=_*S*S}let f=r*s-i*i;if(Math.abs(f)<1e-9)return null;let m=(a+l)/2,h=(c+u)/2,d=(m*s-h*i)/f,p=(h*r-m*i)/f,b=d+n,M=p+o;return!Number.isFinite(b)||!Number.isFinite(M)?null:{cx:b,cy:M}}var vl=.15,kl=.001;function Ol(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 s=0;for(let a of e){let c=Math.abs((a.x-t.x)*r-(a.y-t.y)*o)/i;c>s&&(s=c)}return s/i}function Ll(e){if(e.length<2)return null;let t=e.map(I=>{let y=0,x=0;for(let P of I.pts)y+=P.x,x+=P.y;return{x:y/I.pts.length,y:x/I.pts.length}}),n=0,o=0;for(let I of t)n+=I.x,o+=I.y;n/=t.length,o/=t.length;let r=0,i=0,s=0;for(let I of t){let y=I.x-n,x=I.y-o;r+=y*y,i+=y*x,s+=x*x}let a=r+s,c=r*s-i*i,l=a/2+Math.sqrt(Math.max(0,a*a/4-c)),u,f;Math.abs(i)>1e-12?(u=l-s,f=i):r>=s?(u=1,f=0):(u=0,f=1);let m=Math.hypot(u,f);if(!(m>1e-12))return null;u/=m,f/=m;let h=0,d=0,p=0;for(let I of e){if(I.pts.length<2)continue;let y=I.pts[0],x=I.pts[I.pts.length-1],P=x.x-y.x,R=x.y-y.y,v=Math.hypot(P,R);if(!(v>1e-9))continue;let T=P/v,k=R/v;h+=(T*T-k*k)*v,d+=2*T*k*v,p+=v}if(p>0&&Math.hypot(h,d)>=Bl*p){let I=Math.atan2(d,h)/2;u=-Math.sin(I),f=Math.cos(I)}let b=1/0,M=-1/0,g=[];for(let I of e){let y=1/0,x=-1/0;for(let P of I.pts){let R=P.x*u+P.y*f;R<y&&(y=R),R>x&&(x=R),R<b&&(b=R),R>M&&(M=R)}g.push(x-y)}let S=M-b;return S>1e-9?(g.sort((I,y)=>I-y),g[Math.min(g.length-1,Math.floor(g.length*.9))]/S<=Tl?{x:u,y:f}:null):null}var Tl=.35,Bl=.8;function Cn(e,t,n,o){let r=new Map;for(let y of n){let x=t[y],P=x.rowId||`__seat-${y}`,R=r.get(P);R||(R={pts:[],idx:[]},r.set(P,R)),R.pts.push({x:x.x,y:x.y}),R.idx.push(y)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[y,x]of r){let P=Cl(x.pts,x.idx),R=0;for(let v of P.pts)R+=Math.hypot(v.x-o.x,v.y-o.y);i.push({id:y,pts:P.pts,seatIndices:P.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:R/P.pts.length})}let s=i.map(y=>Al(y.pts)),a=i.length<=256?i.length*(i.length-1)/2:0,c=a?new Float64Array(a):null;c?.fill(Number.NaN);let l=c?new Map(i.map((y,x)=>[y,x])):null,u=(y,x)=>(y>x&&([y,x]=[x,y]),y*(2*i.length-y-1)/2+(x-y-1)),f=(y,x)=>{if(!c)return Ao(i[y].pts,i[x].pts);let P=u(y,x),R=c[P];if(!Number.isNaN(R))return R;let v=Ao(i[y].pts,i[x].pts);return c[P]=v,v},m=(y,x)=>l?f(l.get(y),l.get(x)):Ao(y.pts,x.pts),h=[];for(let y=0;y<i.length;y++){let x=1/0;for(let P=0;P<i.length;P++){if(y===P||ai(s[y],s[P])>=x)continue;let R=f(y,P);R<x&&(x=R)}Number.isFinite(x)&&h.push(x)}h.sort((y,x)=>y-x);let d=h.length?h[Math.floor(h.length/2)]:1,p=Math.max(d*1.8,1e-6),b=i.map(()=>[]);for(let y=0;y<i.length;y++)for(let x=y+1;x<i.length;x++)ai(s[y],s[x])>p||f(y,x)<=p&&(b[y].push(x),b[x].push(y));let M=0;for(let y=0;y<i.length;y++){if(i[y].blockId!==-1)continue;let x=M++,P=[y];for(i[y].blockId=x;P.length;){let R=P.pop();for(let v of b[R])i[v].blockId===-1&&(i[v].blockId=x,P.push(v))}}let g=new Map;for(let y of i){let x=g.get(y.blockId)??[];x.push(y),g.set(y.blockId,x)}let S=[];for(let y of i){if(y.pts.length<4||Ol(y.pts)<kl)continue;let x=Co(y.pts);x&&(!Number.isFinite(x.cx)||!Number.isFinite(x.cy)||S.push({x:x.cx,y:x.cy}))}let _=S.length>=2?(()=>{let y=S.map(R=>R.x).sort((R,v)=>R-v),x=S.map(R=>R.y).sort((R,v)=>R-v),P=Math.floor(S.length/2);return{cx:y[P],cy:x[P]}})():null;if(_){let y=k=>Math.hypot(k.x-_.cx,k.y-_.cy),x=1/0,P=-1/0,R=[];for(let k of i){let C=1/0,E=-1/0;for(let A of k.pts){let O=y(A);O<C&&(C=O),O>E&&(E=O)}R.push(E-C),C<x&&(x=C),E>P&&(P=E)}let v=P-x;R.sort((k,C)=>k-C);let T=R[Math.min(R.length-1,Math.floor(R.length*.9))];if(v>1e-9&&T/v<=vl){let k=i.map(G=>{let V=0;for(let U of G.pts)V+=y(U);return{row:G,radius:V/G.pts.length}}),C=0,E=0;for(let G of k)C+=G.radius,E+=G.row.focalDistance;C/=k.length,E/=k.length;let A=0;for(let G of k)A+=(G.radius-C)*(G.row.focalDistance-E);if(A<0)for(let G of k)G.radius=-G.radius;let F=1/0;for(let G of k)G.radius<F&&(F=G.radius);k.sort((G,V)=>G.radius-V.radius);let L=-1,B=-1/0,D=v/Math.max(1,k.length)*.5,j=[];for(let G of k)G.radius-B>D&&(L++,B=G.radius),G.row.ordinal=L,G.row.blockDepth=G.radius-F,j.push(G.row);return{sectionId:e,rows:j,blockCount:M}}}let I=[];for(let[,y]of g){let x=Ll(y);if(x){let P=k=>{let C=0;for(let E of k.pts)C+=E.x*x.x+E.y*x.y;return C/k.pts.length};y.sort((k,C)=>P(k)-P(C)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let R=[],v=d*.5;for(let k of y){let C=R[R.length-1];C&&Math.abs(P(k)-P(C[0]))<v?C.push(k):R.push([k])}let T=0;for(let k=0;k<R.length;k++){if(k>0){let C=1/0;for(let E of R[k-1])for(let A of R[k])C=Math.min(C,m(E,A));C=Math.min(C,Math.abs(P(R[k][0])-P(R[k-1][0]))),T+=C}for(let C of R[k])C.ordinal=k,C.blockDepth=T,I.push(C)}}else{let P=1/0;for(let R of y)R.focalDistance<P&&(P=R.focalDistance);y.sort((R,v)=>R.focalDistance-v.focalDistance);for(let R=0;R<y.length;R++)y[R].ordinal=R,y[R].blockDepth=Math.max(0,y[R].focalDistance-P),I.push(y[R])}}return{sectionId:e,rows:I,blockCount:M}}var Nl=/^\d{4}-\d{2}-\d{2}$/;function Fl(e){let t=Date.parse(e);return Number.isFinite(t)?Nl.test(e)?t+864e5:t:null}function Dl(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=Fl(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Gl(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Hl(e){return e.status!=="draft"&&e.status!=="retracted"}function jl(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 ci(e,t={}){return!!e&&Hl(e)&&Gl(e,t.activeConfigurationId,t.activeConfigurationVersion)&&jl(e,t.activeBasisSha256)&&Dl(e,t.now)}var Vl=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Ul=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function Ze(e){return!!e&&Vl.has(e)}function St(e){return!!e&&Ul.has(e)}var Xl=new Set(["court-basketball","rink-hockey","ring-boxing"]);function fi(e){return!!e&&Xl.has(e)}var vo=1.1;function mi(e){return kn(e)?e==="ring-boxing"?vo:.06:1}var Kl={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}},Wl={"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 Yl=Math.PI*2;function zl(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function li(e,t){let n=Math.max(0,e-t),o=[],r=20;for(let i=0;i<=r;i++){let s=-Math.PI/2+i/r*Math.PI;o.push({x:n+t*Math.cos(s),y:t*Math.sin(s)})}for(let i=0;i<=r;i++){let s=Math.PI/2+i/r*Math.PI;o.push({x:-n+t*Math.cos(s),y:t*Math.sin(s)})}return o}var ui=(()=>{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,s=[],a=Math.atan2(o.y-r,o.x),c=Math.atan2(o.y-r,-o.x);for(let l=0;l<=24;l++){let u=a+(c-a)*l/24;s.push({x:i*Math.cos(u),y:r+i*Math.sin(u)})}return{half:70,home:t,backstop:n,fence:s}})();var vn="#f1f5f9";function kn(e){return Ze(e)}function ht(e,t,n,o,r=32){let i=[];for(let s=0;s<r;s++){let a=s/r*Yl;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function ct(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 Zl(e){let{kind:t,cx:n,cy:o,width:r,height:i}=e,s=(e.rotation??0)*Math.PI/180,a=Math.cos(s),c=Math.sin(s),l=r/2,u=i/2,f=[],m=Kl[t],h=p=>m?p/m.width*r:0,d=p=>m?p/m.height*i:0;switch(t){case"pitch-football":{f.push({points:[{x:0,y:-u},{x:0,y:u}],closed:!1}),f.push({points:ht(0,0,h(9.15),d(9.15)),closed:!0});for(let p of[-1,1])f.push({points:ct(p*(l-h(16.5)/2),0,h(16.5)/2,d(40.32)/2),closed:!0}),f.push({points:ct(p*(l-h(5.5)/2),0,h(5.5)/2,d(18.32)/2),closed:!0});break}case"rink-hockey":{f.push({points:[{x:0,y:-u},{x:0,y:u}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){f.push({points:[{x:p*h(7.5),y:-u},{x:p*h(7.5),y:u}],closed:!1,ink:"#2f6ecb"}),f.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])f.push({points:ht(p*h(20.5),b*d(7),h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"})}f.push({points:ht(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&&f.push({points:li(l-h(1.22)*8,b),closed:!0,fill:"#2f7d4f"});for(let M=1;M<8;M++){let g=d(1.22)*M,S=u-g;if(S<=0)break;f.push({points:li(l-h(1.22)*M,S),closed:!0})}break}case"oval-cricket":{f.push({points:ht(0,0,h(27.4),d(27.4+20.12/2),40),closed:!0}),f.push({points:ct(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});f.push(p(0));for(let b of[-1,1]){f.push(p(b*50),p(b*28));for(let M=-35;M<35;M+=4)f.push({points:[{x:h(b*10),y:d(M)},{x:h(b*10),y:d(Math.min(35,M+2))}],closed:!1})}break}case"diamond-baseball":{let p=(O,F)=>({x:h(O),y:d(F)}),{home:b}=ui,M=27.43,g=M/Math.SQRT2,S={x:b.x+g,y:b.y-g},_={x:b.x,y:b.y-2*g},I={x:b.x-g,y:b.y-g},y={x:b.x,y:b.y-18.44},x="#b98a59",P=Wl["diamond-baseball"],R=38.94,v=[p(b.x,b.y)],T=Math.atan2(b.y-R/Math.SQRT2-y.y,R/Math.SQRT2),k=Math.PI-T;for(let O=0;O<=16;O++){let F=T-(T+Math.PI*2-k)%(Math.PI*2)*(O/16);v.push(p(y.x+29*Math.cos(F),y.y+29*Math.sin(F)))}f.push({points:v,closed:!0,fill:x,ink:x});let C={x:b.x,y:b.y-g},E=[{x:b.x,y:b.y},S,_,I].map(O=>p(C.x+(O.x-C.x)*.84,C.y+(O.y-C.y)*.84));f.push({points:E,closed:!0,fill:P,ink:P}),f.push({points:ht(h(y.x),d(y.y),h(2.74),d(2.74),20),closed:!0,fill:x,ink:x}),f.push({points:ht(h(b.x),d(b.y),h(3.96),d(3.96),20),closed:!0,fill:x,ink:x});let A=ui.fence;f.push({points:[p(b.x,b.y),p(A[0].x,A[0].y)],closed:!1}),f.push({points:[p(b.x,b.y),p(A[A.length-1].x,A[A.length-1].y)],closed:!1});for(let O of[S,_,I])f.push({points:ct(h(O.x),d(O.y),h(.3),d(.3)),closed:!0,fill:vn});break}case"court-basketball":{f.push({points:ct(0,0,h(14),d(7.5)),closed:!0}),f.push({points:[{x:0,y:-d(7.5)},{x:0,y:d(7.5)}],closed:!1}),f.push({points:ht(0,0,h(1.8),d(1.8),24),closed:!0});for(let p of[-1,1]){let b=p*14,M=p*(14-5.8),g=p*(14-1.575);f.push({points:ct(h((b+M)/2),0,h(2.9),d(2.45)),closed:!0,fill:"#2f5d8a"}),f.push({points:ht(h(M),0,h(1.8),d(1.8),24),closed:!0});let S=Math.sqrt(6.75*6.75-6.6*6.6),_=[{x:h(b),y:-d(6.6)}],I=Math.atan2(-6.6,-p*S),y=2*Math.atan2(6.6,S);for(let x=0;x<=16;x++){let P=I-p*y*(x/16);_.push({x:h(g+6.75*Math.cos(P)),y:d(6.75*Math.sin(P))})}_.push({x:h(b),y:d(6.6)}),f.push({points:_,closed:!1})}break}case"court-tennis":{f.push({points:ct(0,0,h(11.885),d(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])f.push({points:[{x:-h(11.885),y:p*d(4.115)},{x:h(11.885),y:p*d(4.115)}],closed:!1}),f.push({points:[{x:p*h(6.4),y:-d(4.115)},{x:p*h(6.4),y:d(4.115)}],closed:!1});f.push({points:[{x:-h(6.4),y:0},{x:h(6.4),y:0}],closed:!1}),f.push({points:[{x:0,y:-d(6.4)},{x:0,y:d(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{f.push({points:ct(0,0,h(3.05),d(3.05)),closed:!0});let M=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[g,S,_]of M)f.push({points:ct(g*h(3.05),S*d(3.05),h(.3),d(.3)),closed:!0,fill:_,ink:_});break}default:return[]}return f.map(p=>({...p,points:p.points.map(b=>zl(b.x,b.y,a,c,n,o))}))}function ko(e){if(e.role!=="stage"||!kn(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),s=Math.min(...o),a=Math.max(...o),c=Math.max(1,i-r),l=Math.max(1,a-s);t={cx:r+c/2,cy:s+l/2,width:c,height:l}}return t?Zl({kind:e.stageKind,...t}):[]}var $l=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Ql=/[\s"'<>`\\]/;function ql(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return $l.test(e);if(Ql.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function hi(e){let t=e.trim();return ql(t)?t:null}var Oo="seatlayer.event-configuration/1";var Bt=100,Jl=120,eu=2e5,tu=1e4,nu=/^[a-f0-9]{64}$/,ou=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function tn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Rt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function ru(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function di(e){return!Array.isArray(e)||e.length>eu||!e.every(t=>Rt(t,Bt))?null:[...new Set(e)].sort()}function iu(e){return!tn(e)||!Rt(e.chartId,Bt)||!Rt(e.version,Bt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!nu.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function Lo(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function su(e){return tn(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&Lo(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function au(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>tu)return null;let n=new Set(t),o=new Set,r=new Set,i=0,s=[];for(let a of e){if(!tn(a)||!Rt(a.id,Bt)||!Rt(a.objectId,Bt)||!n.has(a.objectId)||!ou.has(String(a.kind))||!Lo(a.heightM,.05,50)||a.baseElevationM!==void 0&&!Lo(a.baseElevationM,-10,100))return null;let c=su(a.occlusion);if(!c||o.has(a.id)||r.has(a.objectId))return null;let l=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?hi(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!l||a.kind!=="screen"||++i>1))return null;o.add(a.id),r.add(a.objectId),s.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return s.sort((a,c)=>a.id.localeCompare(c.id))}function cu(e){let t=[];if(!tn(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Oo&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Oo}`}),Rt(e.id,Bt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),Rt(e.label,Jl)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),ru(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=iu(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=tn(e.overlay)?e.overlay:null,r=di(o?.objectIds),i=di(o?.productionKillSeatIds),s=r?au(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"}),s===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||s===null?{issues:t}:{issues:t,value:{schema:Oo,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function pi(e){let t=cu(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function lu(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?An(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 uu(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),i=Math.sin(o),s=e.x-t.x,a=e.y-t.y;return{x:t.x+s*r-a*i,y:t.y+s*i+a*r}}function bi(e){let t=lu(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>uu(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,s=-1/0,a=-1/0;for(let c of o)r=Math.min(r,c.x),i=Math.min(i,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y);return!Number.isFinite(r)||s-r<1e-6||a-i<1e-6?null:{minX:r,minY:i,maxX:s,maxY:a}}var fu=5,mu=3,hu=.92,du=1.9,pu=2,bu=.6,yu=1,gu=.06;function xu(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?vo:kn(e.stageKind)?gu:yu}function yi(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let s of Mi(e)){let a=s.baseHeightM??0;for(let c of s.objects){if(c.type!=="shape"||c.role!=="stage")continue;let l=bi(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,a+xu(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function Mu(e,t,n,o){let r=1/0,i=1/0,s=-1/0,a=-1/0;for(let h of e)Number.isFinite(h.eyeHeightM)&&(r=Math.min(r,h.x),s=Math.max(s,h.x),i=Math.min(i,h.y),a=Math.max(a,h.y));if(!Number.isFinite(r))return null;let c=r*t,l=i*t,u=Math.max(1,Math.ceil((s-r)*t/n)+1),f=Math.max(1,Math.ceil((a-i)*t/n)+1),m=new Float64Array(u*f).fill(-1/0);for(let h of e){if(!Number.isFinite(h.eyeHeightM))continue;let d=h.eyeHeightM-tt,p=Math.min(u-1,Math.max(0,Math.floor((h.x*t-c)/n))),M=Math.min(f-1,Math.max(0,Math.floor((h.y*t-l)/n)))*u+p,g=d+o;g>m[M]&&(m[M]=g)}return{cellM:n,minX:c,minY:l,cols:u,rows:f,top:m}}function Su(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 gi(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??ee,i=n.cellM??bu,s=n.chairBackM??hu,a=n.selfRowSkipM??pu,c=n.clearThreshold??.9,l=n.partialThreshold??.25,u=Math.max(1,n.columns??fu),f=Math.max(1,n.rows??mu),m=Mu(e,r,i,s);if(!m)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,M=(t.minY+t.maxY)/2*r,g=[];for(let _=0;_<u;_++){let I=(_+.5)/u-.5,y=p?b+I*h:b,x=p?M:M+I*d;for(let P=0;P<f;P++){let R=t.deckTopM+(f===1?0:P/(f-1)*du);g.push({x:y,y:x,z:R})}}let S=i/2;for(let _ of e){if(!Number.isFinite(_.eyeHeightM))continue;let I=_.x*r,y=_.y*r,x=_.eyeHeightM,P=0,R=1/0;for(let T of g){let k=T.x-I,C=T.y-y,E=Math.hypot(k,C);if(!(E>a)){P++;continue}let A=k/E,O=C/E,F=0;for(let L=a;L<E;L+=S){let B=Su(m,I+A*L,y+O*L);if(!(!Number.isFinite(B)||B>=x)&&B>x+(T.z-x)*L/E){F=L;break}}F?R=Math.min(R,F):P++}let v=P/g.length;v>=c||o.set(_.id,{seatId:_.id,mark:v<l?"obstructedView":"restrictedView",visibleFraction:v,totalRays:g.length,atDistanceM:Number.isFinite(R)?R:0})}return o}function xi(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 To(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var Ln=Math.PI/180;var nn=16;function Bo(e,t,n,o){let r=n*Ln,i=Math.cos(r),s=Math.sin(r);return{x:o.x+e*i-t*s,y:o.y+e*s+t*i}}function No(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,s=[];if(e.path)return Kr(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(o===0){for(let l=0;l<t;l++)s.push(Bo(l*n,0,r,i));return s}let a=o/(t-1)*Ln,c=n/(2*Math.sin(Math.abs(a)/2));for(let l=0;l<t;l++){let u=l*a,f=c*Math.sin(u),m=-c+c*Math.cos(u);s.push(Bo(f,m,r,i))}return s}function Fo(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Ru(e,t){let n=Fo(e);return No(e).map((o,r)=>{let i=n.get(r),s=To(i),a=ni(e,r,i),c={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:a,displayLabel:_o(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,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 Iu(e){let t=[];for(let n of Ru(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 Pu(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 _u(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,f,m,h)=>{let d=o.get(u),p=To(d),b=d?.label??oi(e,u);return{index:u,label:b,displayLabel:d?.displayLabel??ri(e,u),x:f+(d?.dx??0),y:m+(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)+nn,f=e.rotation*Ln,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let b=0;b<n;b++){let M=f+b/n*2*Math.PI;t.push(r(b,e.center.x+u*Math.cos(M),e.center.y+u*Math.sin(M)))}return t}let h=m*Ln,d=(2*Math.PI-h)/2,p=f+d;for(let b=0;b<n;b++){let M=p+b/(n-1)*h;t.push(r(b,e.center.x+u*Math.cos(M),e.center.y+u*Math.sin(M)))}return t}let i=e.width??80,s=e.height??50,a=Pu(e),c=["top","bottom","left","right"],l=0;for(let u of c){let f=a[u];for(let m=0;m<f;m++){let h,d;u==="top"?(h=-i/2+(m+.5)*i/f,d=-s/2-nn):u==="bottom"?(h=-i/2+(m+.5)*i/f,d=s/2+nn):u==="left"?(h=-i/2-nn,d=-s/2+(m+.5)*s/f):(h=i/2+nn,d=-s/2+(m+.5)*s/f);let p=Bo(h,d,e.rotation,e.center);t.push(r(l++,p.x,p.y,u))}}return t}function wu(e){return _u(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 Eu(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 Io(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,s=t[o].y,a=t[r].x,c=t[r].y;s>e.y!=c>e.y&&e.x<(a-i)*(e.y-s)/(c-s)+i&&(n=!n)}return n}function Jr(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 s=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),a=(r.x-n.x)**2+(r.y-n.y)**2;return s>=-1e-7&&s<=a+1e-7})}function Jt(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Ee(e,t,n){return Io(e,t)&&!Jt(n).some(o=>Io(e,o)||Jr(e,o))}function On(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 Pi(e){switch(e.type){case"row":{let t=No(e),n=Fo(e),o=0,r=0,i=0;for(let s=0;s<t.length;s++){let a=n.get(s);a?.skip||(o+=t[s].x+(a?.dx??0),r+=t[s].y+(a?.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 On(e.points);case"section":return On(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?On(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 Si(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function Au(e,t){if(e.type!=="gaArea"||!Si(e.points,t.outline))return!1;let n=Jt(e.holes),o=Jt(t.holes);return n.length===o.length&&n.every((r,i)=>Si(r,o[i]))}function Cu(e,t,n=e.filter(r=>r.type==="section"),o=Pi(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(s=>(s.logicalSectionId??s.id)===r&&(Au(t,s)||Ee(o,s.outline,s.holes))):void 0)??n.find(s=>Ee(o,s.outline,s.holes))??(t.type==="row"&&vu(t)?ku(t,n):void 0)}function vu(e){return(e.overrides??[]).some(t=>t.skip===!0)}function ku(e,t){let n=No(e),o=Fo(e),r,i=0;for(let s of t){let a=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)};Ee(u,s.outline,s.holes)&&a++}a>i&&(r=s,i=a)}return r}function Mi(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 Ri(e,t,n,o,r,i,s,a,c){let l=[],u=e.filter(p=>p.type==="section"),f=ei(e),m=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),h=p=>ci(p,{activeConfigurationId:o,activeConfigurationVersion:c,activeBasisSha256:r,now:a}),d=(p,b)=>h(p)?{...p,coverage:b}:void 0;for(let p of e){let b=[];if(p.type==="row"?b=Iu(p):p.type==="table"?b=wu(p):p.type==="booth"&&(b=Eu(p)),!b.length)continue;for(let I of b)I.viewUrl&&!m(I.viewMeta)&&(I.viewUrl=void 0,I.viewMeta=void 0);if(p.type==="row"){let I=f.get(p.id);if(I){let y=new Map((p.overrides??[]).map(x=>[x.index,x]));for(let x of b){let P=Number(x.id.slice(x.id.lastIndexOf(":")+1));if(!Number.isInteger(P))continue;x.logicalRowId=I.groupId,x.logicalSeatIndex=I.adjacencyOffset+P,y.get(P)?.displayLabel||(x.displayLabel=_o(p,P,I)),!x.viewUrl&&I.viewFromSeatUrl&&m(I.viewFromSeatMeta)&&(x.viewUrl=I.viewFromSeatUrl,x.viewMeta=I.viewFromSeatMeta);let R=y.get(P)?.confidenceEvidence;x.confidenceEvidence=d(R,"exact-seat")??d(p.confidenceEvidence,"row-representative")??d(I.confidenceEvidence,"row-representative")}}}let M=Cu(e,p,u,p.type==="row"?On(b):Pi(p)),g=M?.viewFromSeatUrl,_=(M?.zone?t?.find(I=>I.id===M.zone):void 0)?.focalPoint??n;for(let I of b){if(!I.confidenceEvidence){let y=Number(I.id.slice(I.id.lastIndexOf(":")+1)),x=(p.type==="row"||p.type==="table")&&Number.isInteger(y)?p.overrides?.find(P=>P.index===y)?.confidenceEvidence:void 0;I.confidenceEvidence=d(x,"exact-seat")??(p.type==="row"?d(p.confidenceEvidence,"row-representative"):void 0)}I.confidenceEvidence??=d(M?.confidenceEvidence,"section-representative")??(s?d(s.evidence,s.coverage):void 0),!I.viewUrl&&g&&m(M?.viewFromSeatMeta)&&(I.viewUrl=g,I.viewMeta=M?.viewFromSeatMeta),!I.viewUrl&&i&&m(i.meta)&&(I.viewUrl=i.url,I.viewMeta=i.meta),M&&(I.sectionId=M.logicalSectionId??M.id),M?.zone&&(I.zoneId=M.zone),_&&(I.focalPoint={..._})}l.push(...b)}return l}function Nt(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,s=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=Ri(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Ii(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=Ri(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&&Ii(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Ou(e,n,t)}function Ou(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||xi(t,gi(t,yi(e))),t}function Ii(e,t,n,o){let r=e.filter(f=>f.type==="section"),i=n>0||r.some(f=>f.height!==void 0||f.rake!==void 0||(f.elevation??0)>0);if(!r.length||!i||!t){for(let f of o)f.eyeHeightM=n+tt;return}let s=new Array(o.length),a=new Map;for(let f of r)a.has(f.id)||a.set(f.id,f);let c=new Map,l=new Map;for(let f=0;f<o.length;f++){let m=o[f],d=(m.sectionId?a.get(m.sectionId)??r.find(b=>b.logicalSectionId===m.sectionId&&Ee({x:m.x,y:m.y},b.outline,b.holes)):void 0)??r.find(b=>Ee({x:m.x,y:m.y},b.outline,b.holes))??null;if(s[f]=d,!d)continue;c.has(d.id)||c.set(d.id,mt(d,{floorBaseHeightM:n}));let p=l.get(d.id);p?p.push(f):l.set(d.id,[f])}let u=new Array(o.length).fill(void 0);for(let[f,m]of l){let h=c.get(f);if(!h)continue;let d=h.rake>0?Math.tan(h.rake*Math.PI/180):0,p=Cn(f,o,m,t);for(let b of p.rows){let M=b.blockDepth*ee*d,g=h.height+M;for(let S of b.seatIndices)u[S]=g}}for(let f=0;f<o.length;f++){let m=o[f],h=s[f];if(!h){m.eyeHeightM=n+tt;continue}let d=c.get(h.id);m.eyeHeightM=(u[f]??d.height)+tt}}var wi=et(require("earcut"),1),Do=et(require("polygon-clipping"),1);function je(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 Ce(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(o=!o)}return o}var w=ee,Lu=.002;function Tu(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]),s=Math.max(o,r,i);if(s<1e-9)return!0;let a=(o+r+i)/2;return 2*Math.sqrt(Math.max(0,a*(a-o)*(a-r)*(a-i)))/s<Lu}var It=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)}},Nn=class{constructor(){this.pos=new It;this.nor=new It;this.col=new It;this.flr=new It;this.mat=new It;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,s=i,a=i,c){if(Tu(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(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[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,s,a,c=a,l=a){[...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(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[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 Bu(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],c=n[2]-e[2],l=r*c-i*a,u=i*s-o*c,f=o*a-r*s,m=Math.hypot(l,u,f)||1;return l/=m,u/=m,f/=m,[l,u,f]}function Nu(e,t){let n=[...e],o=[];for(let s of e)o.push(s.x,s.y);let r=[];if(t){for(let s of t)if(!(s.length<3)){r.push(n.length);for(let a of s)n.push(a),o.push(a.x,a.y)}}let i=(0,wi.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function nt(e){return je(e)<0?[...e].reverse():e}var Fu=3;function Du(e,t,n,o){let r=o(e),i=o(t),s=o(n),a=(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+s)/3,f=Math.max(a(e,t,r,i),a(t,n,i,s),a(n,e,s,r),Math.abs(o({x:c,y:l})-u)),m=(h,d,p)=>{let b=Math.abs(o({x:(h+c)/2,y:(d+l)/2})-(p+u)/2);b>f&&(f=b)};return m((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+s)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(s+r)/2),f}function on(e,t,n,o,r){if(r<=0)return Du(e,t,n,o);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},s={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(on(e,i,a,o,r-1),on(i,t,s,o,r-1),on(a,s,n,o,r-1),on(i,s,a,o,r-1))}function rn(e,t,n,o,r,i,s,a){if(s>0){let m={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};rn(e,t,m,d,r,i,s-1,a),rn(e,m,n,h,r,i,s-1,a),rn(e,d,h,o,r,i,s-1,a),rn(e,m,h,d,r,i,s-1,a);return}let c=[t.x*w,r(t),t.y*w],l=[n.x*w,r(n),n.y*w],u=[o.x*w,r(o),o.y*w];if(a){e.triN(c,l,u,a(t),a(n),a(o),i);return}let f=Bu(c,l,u);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),e.tri(c,l,u,f,i)}var Gu=8;function _i(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,s,a,c,l)=>{if(l>0){let u={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=t(u);if(Math.abs(f-(a+c)/2)>n){r(i,u,a,f,l-1),r(u,s,f,c,l-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];r(s,a,t(s),t(a),Gu)}return o}function Tn(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],s=n[r],a=n[(r+1)%n.length],c=a.x-i.x,l=a.y-i.y,u=Math.hypot(c,l);u>t&&Math.abs((s.x-i.x)*l-(s.y-i.y)*c)/u<t||o.push(s)}return o.length>=3?o:n}var Bn=.001*Ke*.1;function $(e,t,n,o,r,i,s,a,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(je(t))<1e-4))return;let u=Tn(_i(Tn(nt(t),Bn),o,c),Bn),f=n?.map(y=>Tn(_i(Tn(nt(y),Bn),o,c),Bn)).filter(y=>y.length>=3&&Math.abs(je(y))>=1e-4),{pts:m,tris:h}=Nu(u,f),d=[i[0]*a.top,i[1]*a.top,i[2]*a.top],p=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],b=[s[0]*a.top,s[1]*a.top,s[2]*a.top],M=[s[0]*a.wallBottom,s[1]*a.wallBottom,s[2]*a.wallBottom],g=0;if(Number.isFinite(c))for(;g<Fu;g++){let y=0;for(let x=0;x<h.length;x+=3){let P=on(m[h[x]],m[h[x+1]],m[h[x+2]],o,g);P>y&&(y=P)}if(y<=c)break}for(let y=0;y<h.length;y+=3){let x=m[h[y]],P=m[h[y+1]],R=m[h[y+2]];rn(e,x,P,R,o,d,g,l);let v=[x.x*w,r,x.y*w],T=[P.x*w,r,P.y*w],k=[R.x*w,r,R.y*w];e.tri(v,k,T,[0,-1,0],p)}let S=y=>{if(g<=0)return y;let x=1<<g,P=[];for(let R=0;R<y.length;R++){let v=y[R],T=y[(R+1)%y.length];for(let k=0;k<x;k++){let C=k/x;P.push({x:v.x+(T.x-v.x)*C,y:v.y+(T.y-v.y)*C})}}return P},_=Mo(u),I=[{ring:S(u),flip:!1}];if(f)for(let y of f)y.length>=3&&I.push({ring:S(y),flip:!0});for(let{ring:y,flip:x}of I)for(let P=0;P<y.length;P++){let R=y[P],v=y[(P+1)%y.length],T=(v.x-R.x)*w,C=(v.y-R.y)*w,E=-T,A=Math.hypot(C,E)||1;C/=A,E/=A;let O=(R.x+v.x)/2-_.x,F=(R.y+v.y)/2-_.y,L=C*O+E*F;x&&(L=-L),L<0&&(C=-C,E=-E);let B=[C,0,E],D=[R.x*w,o(R),R.y*w],j=[v.x*w,o(v),v.y*w],G=[R.x*w,r,R.y*w],V=[v.x*w,r,v.y*w];e.tri(D,j,V,B,b,b,M),e.tri(D,V,G,B,b,M,M)}}function Ei(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),s=new Float32Array(t),a=0;for(let c of e)n.set(c.position,a*3),o.set(c.normal,a*3),r.set(c.color,a*3),i.set(c.floor,a),s.set(c.material,a),a+=c.count;return{position:n,normal:o,color:r,floor:i,material:s,count:t}}function ot(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=nt(e),r=o.length,i=[];for(let a=0;a<r;a++){let c=o[a],l=o[(a+1)%r],u=l.x-c.x,f=l.y-c.y,m=Math.hypot(u,f)||1;i.push({x:f/m,y:-u/m})}let s=[];for(let a=0;a<r;a++){let c=o[a],l=i[(a-1+r)%r],u=i[a],f=l.x+u.x,m=l.y+u.y,h=Math.hypot(f,m),d=()=>{s.push([c.x+l.x*t,c.y+l.y*t]),s.push([c.x+u.x*t,c.y+u.y*t])};if(h<1e-9){d();continue}f/=h,m/=h;let p=f*l.x+m*l.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){d();continue}s.push([c.x+f*t*b,c.y+m*t*b])}if(s.length<3)return e;try{let a=Do.default.union([[...s,s[0]]]),c=null,l=-1/0;for(let f of a){let m=Math.abs(je(f[0].map(([h,d])=>({x:h,y:d}))));m>l&&(l=m,c=f[0])}if(!c)return e;let u=c.map(([f,m])=>({x:f,y:m}));if(u.length>1){let f=u[0],m=u[u.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function We(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=nt(e),r=o.length,i=[];for(let c=0;c<r;c++){let l=o[c],u=o[(c+1)%r],f=Math.hypot(u.x-l.x,u.y-l.y)||1;i.push({x:-(u.y-l.y)/f,y:(u.x-l.x)/f})}let s=[],a=[];for(let c=0;c<r;c++){let l=o[c],u=i[(c-1+r)%r],f=i[c],m=u.x+f.x,h=u.y+f.y,d=Math.hypot(m,h),p=d<1e-9?1/0:1/Math.max(m/d*u.x+h/d*u.y,1e-6);if(!Number.isFinite(p)||p>n){s.push({x:l.x+u.x*t,y:l.y+u.y*t},{x:l.x+f.x*t,y:l.y+f.y*t}),a.push(c,c);continue}m/=d,h/=d,s.push({x:l.x+m*t*p,y:l.y+h*t*p}),a.push(c)}for(let c=0;c<s.length;c++){let l=(c+1)%s.length,u=a[c],f=a[l];if(f!==(u+1)%r)continue;let m=o[u],h=o[f];if((s[l].x-s[c].x)*(h.x-m.x)+(s[l].y-s[c].y)*(h.y-m.y)<=0)return[]}try{let c=Do.default.intersection([[...s.map(d=>[d.x,d.y]),[s[0].x,s[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(je(d[0].map(([b,M])=>({x:b,y:M}))));p>u&&(u=p,l=d[0])}if(!l)return[];let f=l.map(([d,p])=>({x:d,y:p})),m=f[0],h=f[f.length-1];return f.length>1&&Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&f.pop(),f.length>=3?nt(f):[]}catch{return[]}}function Fn(e,t,n,o,r=28){let i=[];for(let s=0;s<r;s++){let a=s/r*Math.PI*2;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function sn(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 an=3,Pt=.38,cn=.24;function Hu(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)*w,i=(n.y-t.y)*w,s=(o.x-t.x)*w,a=(o.y-t.y)*w,c=2*(r*a-i*s);if(Math.abs(c)<1e-7)return null;let l=r*r+i*i,u=s*s+a*a,f=(l*a-u*i)/c+t.x*w,m=(r*u-s*l)/c+t.y*w,h=Math.hypot(t.x*w-f,t.y*w-m);return h<1||h>200||!Number.isFinite(h)||e.some(d=>Math.abs(Math.hypot(d.x*w-f,d.y*w-m)-h)>.03)?null:{x:f,z:m,radius:h}}function Ai(e){let t=[],n=new Map,o=(c,l)=>`${Math.floor(c/an)},${Math.floor(l/an)}`;for(let c of e)for(let l of c.rows){for(let f of l.pts){let m=f.x*w,h=f.y*w,d=o(m,h),p=n.get(d)??[];p.push({x:m,z:h,y:l.y,floor:c.floorIndex}),n.set(d,p)}if(l.patch||l.pts.length<2)continue;let u=Hu(l.pts);for(let f of[0,l.pts.length-1]){let m=l.pts[f],h=l.pts[f===0?1:f-1],d=m.x-h.x,p=m.y-h.y,b=Math.hypot(d,p);b<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:u,row:l,point:m,x:m.x*w,z:m.y*w,dx:d/b,dz:p/b})}}let r=new Map;t.forEach((c,l)=>{let u=o(c.x,c.z),f=r.get(u)??[];f.push(l),r.set(u,f)});let i=(c,l)=>{let u=Math.floor(c/an),f=Math.floor(l/an);return[-1,0,1].flatMap(m=>[-1,0,1].map(h=>`${u+m},${f+h}`))},s=new Map;t.forEach((c,l)=>{let u=-1,f=1/0,m=!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,M=p.z-c.z,g=Math.hypot(b,M);if(g<Pt*2+.45||g>an)continue;let S=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,_=Math.min((b*c.dx+M*c.dz)/g,(-b*p.dx-M*p.dz)/g);(S?_<.8:_<.98)||!S&&(Math.abs(b*c.dz-M*c.dx)>.15||Math.abs(b*p.dz-M*p.dx)>.15)||(g<f-.02?(u=d,f=g,m=!1):Math.abs(g-f)<=.02&&(m=!0))}u>=0&&!m&&s.set(l,u)});let a=[];for(let[c,l]of s){if(c>=l||s.get(l)!==c)continue;let u=t[c],f=t[l],m=Math.hypot(f.x-u.x,f.z-u.z),h=(f.x-u.x)/m,d=(f.z-u.z)/m,p=!1;for(let M of i((u.x+f.x)/2,(u.z+f.z)/2))for(let g of n.get(M)??[]){if(g.floor!==u.floorIndex||Math.abs(g.y-u.row.y)>.75)continue;let S=(g.x-u.x)*h+(g.z-u.z)*d,_=Math.abs((g.x-u.x)*d-(g.z-u.z)*h);S>.01&&S<m-.01&&_<cn+Pt&&(p=!0)}if(p)continue;let b=(M,g)=>({x:(u.x+h*M-d*g)/w,y:(u.z+d*M+h*g)/w});a.push({sections:[u.sectionId,f.sectionId],blocks:[u.row.blockId,f.row.blockId],floorIndex:u.floorIndex,ends:[u.point,f.point],clearWidthM:m-2*Pt,heightM:(u.row.y+f.row.y)/2,outline:[b(Pt,-cn),b(m-Pt,-cn),b(m-Pt,cn),b(Pt,cn)]})}return a}var ju=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ci(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 Vu(e){let t=ju.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 me(e){let t=Vu(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Uu(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function fe(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 rt(e,t){let n=Uu(e);return fe(e,[n,n,n],t)}function vi({r:e,g:t,b:n}){let o=e/255,r=t/255,i=n/255,s=Math.max(o,r,i),a=Math.min(o,r,i),c=(s+a)/2;if(s===a)return{h:0,s:0,l:c};let l=s-a,u=c>.5?l/(2-s-a):l/(s+a),f;return s===o?f=((r-i)/l+(r<i?6:0))/6:s===r?f=((i-o)/l+2)/6:f=((o-r)/l+4)/6,{h:f,s:u,l:c}}var Go=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,Ho=e=>e<=.0031308?12.92*e:1.055*Math.max(0,e)**.4166666666666667-.055,jo=e=>Math.min(1,Math.max(0,e));function Uo(e){let t=Go(e[0]),n=Go(e[1]),o=Go(e[2]),r=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*o),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*o),s=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*o);return[.2104542553*r+.793617785*i-.0040720468*s,1.9779984951*r-2.428592205*i+.4505937099*s,.0259040371*r+.7827717662*i-.808675766*s]}function Vo([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[jo(Ho(4.0767416621*o-3.3077115913*r+.2309699292*i)),jo(Ho(-1.2684380046*o+2.6097574011*r-.3413193965*i)),jo(Ho(-.0041960863*o-.7034186147*r+1.707614701*i))]}var Dn=e=>Uo(e)[0];function ln(e){let[,t,n]=Uo(e);return Math.hypot(t,n)}function _t(e,t,n){let[,o,r]=Uo(e);if(n===void 0)return Vo([t,o,r]);let i=Math.hypot(o,r),s=i===0?0:n/i;return Vo([t,o*s,r*s])}function Gn(e){return Vo([e,-.004,-.008])}var Hn=["available","held","sold","selected","dimmed"];function Oi(e){let t=Hn.indexOf(e);return t<0?0:t}var Li={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var ki={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}},jn=.012;function wt(e){return Dn(e.tierTop)>.6}function Ft(e){return e?ki.day:ki.night}var Xo={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]},Ko={top:[.05,.06,.08],bottom:[.1,.12,.15]};function Y(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}var Xu=.15,Ku=1.6;function Ti(e){return So(e??1,Xu,Ku)}var Wo={key:[1,1,1],ambient:[1,1,1]};var Wu=[{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}],Yu=new Map(Wu.map(e=>[e.id,e])),Bi="plain",Ni=3e3;function Fi(e,t){return e.openField?t?"daylight":"floodlit":e.court||e.inTheRound||e.stage&&e.seatCount>Ni?t?"daylight":"arena-show":e.stage?t?"concert-hall":"theatre":t?"daylight":"evening"}function Di(e){return e.openField?!1:e.indoorCourt?!0:e.stage&&!e.inTheRound&&!e.court&&e.standing<e.seatCount&&e.seatCount<=Ni}function Yo(e){return e&&Yu.get(e)||null}var zu=.15,Zu=.9,$u=1.76;function Qu(e,t,n){let o=e??qu,r=(i,s,a)=>[Math.min(1,i[0]*s*a[0]),Math.min(1,i[1]*s*a[1]),Math.min(1,i[2]*s*a[2])];return un(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 qu=[.075,.09,.115];function Gi(e){return un(e)?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function un(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55}function Ju(){return{background:{top:[...Ko.top],bottom:[...Ko.bottom]},sky:Gi(null),structure:Xo,seatStates:{...Li},seatScale:1,materials:{seat:null,shell:null,roughness:.78},light:{key:[...Wo.key],ambient:[...Wo.ambient]},house:null}}function ef(e){return un(e)?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Hi(e,t){let n=e?.venue3d?.look;if(n===Bi)return{look:null,chosen:!0};let o=Yo(n);return o?{look:o,chosen:!0}:t?{look:Yo(Fi(t,un(me(e?.background)))),chosen:!1}:{look:null,chosen:!1}}function tf(e,t){let{look:n,chosen:o}=Hi(e,t);return me(e?.background)??(o?me(n?.background):null)}function ji(e,t){let n=Ju();e??={};let{look:o,chosen:r}=Hi(e,t);o&&(n.light={key:[...o.light.key],ambient:[...o.light.ambient]});let i=tf(e,t);if(o&&(n.house=Qu(i,o,r?o.indoor:!!t&&Di(t))),i){n.background={top:Y(i,Zu),bottom:Y(i,$u)},n.sky=Gi(i);let u={};for(let[m,h]of Object.entries(Xo))u[m]=fe(h,i,zu);i[0]*.2126+i[1]*.7152+i[2]*.0722>.55&&(u.ground=Y(i,.86)),n.structure=u}let s=me(e.selectionColor)??me(e.accent);s&&(n.seatStates={...n.seatStates,selected:s});let a=e.seatScale;typeof a=="number"&&Number.isFinite(a)&&(n.seatScale=Ti(a));let c=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([u,f])=>f!=null&&u!=="look")),l={...ef(i),...o?.materials,...c};if(l){let u=me(l.deck),f=me(l.fascia);u&&(n.structure={...n.structure,tierTop:u,gaTop:u}),f&&(n.structure={...n.structure,tierWall:f,gaWall:f}),n.materials.seat=me(l.seat),n.materials.shell=me(l.shell),typeof l.roughness=="number"&&Number.isFinite(l.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,l.roughness)))}return nf(n,un(i)),n}function nf(e,t){let n=Ft(t);e.seatStates={...e.seatStates,held:Gn(n.unavailable),sold:Gn(n.unavailable),dimmed:Gn(n.dimmed)};let o=(i,s)=>_t(i,s,Math.min(ln(i),jn)),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 Vi(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}function Ui(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=!1;for(let s of e)!Number.isFinite(s.x)||!Number.isFinite(s.y)||(i=!0,s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x>o&&(o=s.x),s.y>r&&(r=s.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function Dt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Ms=et(require("polygon-clipping"),1);var W={top:1,wallBottom:.58,bottomCap:.4};function Et(e,t){if(!e)return t;let n=Y(rt(e,.4),.62);return fe(t,n,.22)}function Xi(e,t){return e?fe(t,Y(rt(e,.25),.74),.62):t}function Ki(e,t){let n=Ft(wt({tierTop:t}));return e?_t(e,n.sectionDeck,Math.min(n.sectionDeckChromaShare*ln(e),n.sectionDeckChromaCap)):_t(t,n.deck,Math.min(ln(t),jn))}function Wi(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 s=o.get(i.sectionId);s||(s=new Map,o.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,s]of o){let a=0,c=0,l=0,u=0;for(let[f,m]of s){let h=me(n.get(f));h&&(a+=h[0]*m,c+=h[1]*m,l+=h[2]*m,u+=m)}u>0&&r.set(i,[a/u,c/u,l/u])}return r}function Yi(e,t){return me(e.color)??t.get(e.logicalSectionId??e.id)??null}var Jo=et(require("polygon-clipping"),1);var qo=et(require("polygon-clipping"),1);var zi=e=>Math.round(e*1e6)/1e6+0;function Gt(e){let t=e.map(r=>({x:zi(r.x),y:zi(r.y)})).sort((r,i)=>r.x-i.x||r.y-i.y).filter((r,i,s)=>i===0||r.x!==s[i-1].x||r.y!==s[i-1].y);if(t.length<3)return t;let n=(r,i,s)=>{let a=i.x-r.x,c=i.y-r.y,l=s.x-r.x,u=s.y-r.y;return a*u-c*l>1e-6*Math.hypot(a,c)*Math.hypot(l,u)},o=r=>{let i=[];for(let s of r){for(;i.length>=2&&!n(i[i.length-2],i[i.length-1],s);)i.pop();i.push(s)}return i.pop(),i};return[...o(t),...o([...t].reverse())]}var zo=[{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"}],Ly=new Map(zo.map(e=>[e.key,e]));var of={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 Vn(e){let t=e?.[0];return t&&of[t]||"#3b82f6"}var rf=[{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"}],Ty=new Map(rf.map(e=>[e.key,e]));var sf=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],By=new Set(sf);var $i=[{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}}],Qi=$i.map(e=>e.key),af=new Map($i.map(e=>[e.key,e]));function Zi(e){return typeof e=="string"&&af.has(e)}function qi(e,t){return Zi(e)?e:Zi(t?.seatGlyph)?t.seatGlyph:"circle"}var Ve={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,spine:6,armrest:7},cf=.44,lf=.15,uf=.3,ff=.24;function es(e){return e===void 0||!Number.isFinite(e)||e<=0?ff:Math.min(uf,Math.max(lf,e*cf))}var mf=.05,ts=.45,hf=ts+mf,df=.92;var pf=.28,Ji=.15,Hy=[{part:Ve.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:Ve.pad,min:[-1,.36,-.95],max:[1,ts,1]},{part:Ve.back,min:[-1,hf,-1],max:[1,df,-.72]},{part:Ve.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:Ve.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:Ve.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:Ve.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:Ve.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:Ve.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:Ve.leg,min:[.62,0,.48],max:[.82,.37,.7]},{part:Ve.spine,min:[-.8,.3,-1],max:[.8,.6,-.9]},...[1,-1].flatMap(e=>{let t=s=>{let a=e*(Ji-s),c=e*(Ji+s);return[Math.min(a,c),Math.max(a,c)]},[n,o]=t(.09),[r,i]=t(pf/2);return[{part:Ve.armrest,min:[n,0,-.5],max:[o,.6,.05],skip:[2,3]},{part:Ve.armrest,min:[r,.6,-.74],max:[i,.655,.58],skip:[3]}]})];var Zo=20*Math.PI/180;function ns(e,t,n,o,r){let i=new Float32Array(t),s=f=>e[f*3],a=f=>e[f*3+2],c=Math.cos(Zo),l=0,u=(f,m)=>{let h=m-f,d=r?.(f),p=d!==void 0;for(let S=f+1;!p&&S<m-1;S++){let _=s(S)-s(S-1),I=a(S)-a(S-1),y=s(S+1)-s(S),x=a(S+1)-a(S),P=Math.hypot(_,I)*Math.hypot(y,x);P>1e-9&&(_*y+I*x)/P<c&&(p=!0)}let b=0,M=0,g=!1;if(p){if(d)[b,M]=d;else{for(let _=f;_<m;_++)b+=s(_),M+=a(_);b/=h,M/=h}let S=0;for(let _=f+1;_<m;_++)S=Math.max(S,Math.hypot(s(_)-s(_-1),a(_)-a(_-1)));g=h>=3&&Math.hypot(s(m-1)-s(f),a(m-1)-a(f))<=S*1.6}for(let S=f;S<m;S++){let[_,I]=p?[b,M]:o(S),y=_-s(S),x=I-a(S);if(h>=2&&!(d&&h<3)){let P=g?f+(S-1-f+h)%h:Math.max(f,S-1),R=g?f+(S+1-f)%h:Math.min(m-1,S+1),v=s(R)-s(P),T=a(R)-a(P),k=Math.hypot(v,T);if(k>1e-6){let C=-T/k,E=v/k;C*y+E*x<0&&(C=-C,E=-E),y=C,x=E}}i[S]=y===0&&x===0?0:Math.atan2(y,x)}};for(let f=1;f<=t;f++)(f===t||n(f)!==n(l))&&(u(l,f),l=f);return i}var Un=.22;var bf=.42,os=1.6;function yf(e,t){let n=new Float32Array(e.length*4),o=Math.cos(Zo),r=0;for(let i=1;i<=e.length;i++){if(i<e.length&&e[i].rowId===e[r].rowId)continue;let s=i-r>=2&&!t?.has(e[r].rowId);for(let l=r;s&&l<i;l++)e[l].kind==="booth"&&(s=!1);for(let l=r+1;s&&l<i-1;l++){let u=e[l].x-e[l-1].x,f=e[l].y-e[l-1].y,m=e[l+1].x-e[l].x,h=e[l+1].y-e[l].y,d=Math.hypot(u,f)*Math.hypot(m,h);d>1e-9&&(u*m+f*h)/d<o&&(s=!1)}let a=[];for(let l=r+1;s&&l<i;l++){let u=Math.hypot(e[l].x-e[l-1].x,e[l].y-e[l-1].y);u>1e-6&&a.push(u)}a.sort((l,u)=>l-u);let c=a.length?a[Math.floor(a.length/2)]:0;for(let l=r;c>0&&l<i;l++){let u=b=>{let M=l+b;if(M<r||M>=i)return null;let g=e[M].x-e[l].x,S=e[M].y-e[l].y,_=Math.hypot(g,S);return _>1e-6?{x:g/_,y:S/_,gap:_}:null},f=u(1),m=u(-1),h=c/2,d=f??(m?{x:-m.x,y:-m.y,gap:1/0}:null);if(!d)continue;let p=f&&f.gap<c*os?f.gap/2:h;if(n[l*4]=d.x*p*w,n[l*4+1]=d.y*p*w,!m||m.gap>=c*os){let b=m??{x:-d.x,y:-d.y};n[l*4+2]=b.x*h*w,n[l*4+3]=b.y*h*w}}r=i}return n}function gf(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,s=-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>s&&(s=d.y);let a=Math.max(i-o,1e-6),c=Math.max(s-r,1e-6),l=Math.max(Math.sqrt(a*c/t),1e-6),u=Math.max(1,Math.ceil(a/l)+1),f=Math.max(1,Math.ceil(c/l)+1),m=new Map,h=(d,p)=>{let b=Math.min(u-1,Math.max(0,Math.floor((d-o)/l)));return Math.min(f-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=m.get(p);b?b.push(d):m.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))),M=Math.min(f-1,Math.max(0,Math.floor((p.y-r)/l))),g=1/0;for(let S=1;S<=4;S++){for(let _=M-S;_<=M+S;_++)if(!(_<0||_>=f))for(let I=b-S;I<=b+S;I++){if(I<0||I>=u||S>1&&Math.abs(_-M)<S&&Math.abs(I-b)<S)continue;let y=m.get(_*u+I);if(y)for(let x of y){if(x===d)continue;let P=Math.hypot(e[x].x-p.x,e[x].y-p.y);P<g&&(g=P)}}if(Number.isFinite(g)&&g<=S*l)break}n[d]=g}return n}function xf(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-tt):0}function rs(e,t,n,o,r,i,s){let a=e.length,c=new Float32Array(a*3),l=new Float32Array(a),u=new Float32Array(a*3),f=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a),d=new Float32Array(a),p=new Float32Array(a*3),b=new Map,M=gf(e);for(let g=0;g<a;g++){let S=e[g],I=(n?.seatPitchU(g)??M[g])*w;f[g]=Number.isFinite(I)?Math.max(.06,Math.min(Un,I*bf)):Un,m[g]=es(Number.isFinite(I)?I:void 0);let y=qi(S.glyph,{seatGlyph:i?.get(S.categoryKey)}),x=S.glyph!==void 0||i?.has(S.categoryKey);h[g]=Qi.indexOf(!x&&s?.has(S.rowId)?"dining":y),d[g]=S.wheelchairSpaceType==="no-seat"?0:1,c[g*3]=S.x*w,c[g*3+1]=n?n.seatDeckY(g):xf(S),c[g*3+2]=S.y*w,l[g]=Oi(t?t(S):"available");let P=me(r?.get(S.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[g*3]=P[0],u[g*3+1]=P[1],u[g*3+2]=P[2],S.accessibility?.length){let R=me(Vn(S.accessibility));R&&(p[g*3]=R[0],p[g*3+1]=R[1],p[g*3+2]=R[2])}b.set(S.id,g)}return{count:a,iPosition:c,iState:l,iCategory:u,iMaxRadius:f,iRing:p,idToIndex:b,iChairWidth:m,iGlyph:h,iPhysicalSeat:d,iArmrests:yf(e,s),iFloor:o??new Float32Array(a),iSection:new Float32Array(a).fill(-1),iYaw:new Float32Array(a)}}var cs=et(require("earcut"),1);var Mf=.58,is=.01,Ye=Un*1.5*Ke,Sf=.5,Rf=.6;function If(e,t){let n=e.length,o=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],c=e[Math.min(n-1,s+1)],l=c.x-a.x,u=c.y-a.y,f=Math.hypot(l,u);if(f<1e-9){o.push([0,0]);continue}l/=f,u/=f,o.push([-u,l])}let r=0;for(let s=0;s<n;s++)r+=(e[s].x-t.x)*o[s][0]+(e[s].y-t.y)*o[s][1];return r<0?o.map(([s,a])=>[-s,-a]):o}function Pf(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(s,a)=>{let c=a.x-s.x,l=a.y-s.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 ss=Math.PI/12;function _f(e){if(e.length<3)return[...e];let t=Gt(e);return t.length>=3?t:[...e]}function ls(e,t){if(!e.length||!(t>0))return[];let n=_f(e),o=(a,c,l,u)=>{let f=l-c;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/ss)),h=t/Math.cos(f/m/2);for(let d=0;d<=m;d++){let p=c+f*d/m;u.push({x:a.x+Math.cos(p)*h,y:a.y+Math.sin(p)*h})}};if(n.length<3){let a=0,c=0;for(let h of n)a+=h.x,c+=h.y;a/=n.length||1,c/=n.length||1;let l=0;for(let h of n)l=Math.max(l,Math.hypot(h.x-a,h.y-c));let u=[],f=Math.max(3,Math.ceil(Math.PI*2/ss)),m=(l+t)/Math.cos(Math.PI/f);for(let h=0;h<f;h++){let d=h/f*Math.PI*2;u.push({x:a+Math.cos(d)*m,y:c+Math.sin(d)*m})}return u}let r=n.length,i=[];for(let a=0;a<r;a++){let c=n[a],l=n[(a+1)%r];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let s=[];for(let a=0;a<r;a++)o(n[a],i[(a+r-1)%r],i[a],s);return ds(s)}function wf(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],s=e[r+1],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c,u=l>1e-12?((t-i.x)*a+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let f=Math.hypot(t-(i.x+u*a),n-(i.y+u*c));f<o&&(o=f)}return o}function Xn(e){let t=e.map(r=>{let i=0,s=0;for(let l of r.pts)i+=l.x,s+=l.y;let a=r.pts.length||1;i/=a,s/=a;let c=0;for(let l of r.pts){let u=Math.hypot(l.x-i,l.y-s);u>c&&(c=u)}return{cx:i,cy:s,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),s=[],a=1/0,c=null;for(let u of i){let f=1/0;for(let m=0;m<e.length;m++){if(m===r||Math.abs(e[m].y-e[r].y)<.001)continue;let h=t[m],d=Math.hypot(u.x-h.cx,u.y-h.cy)-h.rad;if(d>=f&&d>=a)continue;let p=wf(e[m].pts,u.x,u.y);p<f&&(f=p),e[m].depth<e[r].depth&&p<a&&(a=p,c=e[m].y)}Number.isFinite(f)&&f>0&&s.push(f)}s.sort((u,f)=>u-f);let l=s.length?s[Math.floor(s.length/2)]:1;o.push({pitch:l,belowY:c})}return o}function us(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let u=r.pts[0],f=u.x-o.x,m=u.y-o.y,h=Math.hypot(f,m)||1;f/=h,m/=h;let d=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+m*d,y:u.y-f*d},{x:u.x-m*d,y:u.y+f*d}]})():[];if(i.length<2)return null;let s=0,a=0;for(let u=1;u<i.length;u++){let f=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);f>1e-6&&(s+=f,a++)}let c=a>0?s/a:0,l=Pf(i,Math.max(c*Rf,Ye));return{pts:l,nrm:If(l,o),front:Math.max(n[t].pitch*Mf,Ye),back:Math.max(n[t].pitch*Sf,Ye)}}var Ht=1.5,fs=.3;function $o(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,s=Math.hypot(r,i),a=-1,c=-1;for(let f=1;f<e.length-1;f++){let m=e[f],h=s>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*r)/s:Math.hypot(m.x-n.x,m.y-n.y);h>a&&(a=h,c=f)}if(a<=t||c<0)return[n,o];let l=$o(e.slice(0,c+1),t),u=$o(e.slice(c),t);return[...l.slice(0,-1),...u]}function ms(e,t){if(e.length<4)return e;let n=$o([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Ef(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 s=t[i];if(!(Math.abs(r.i-s.i)===1||Math.abs(r.i-s.i)===e.length-1||r.maxY<s.minY||s.maxY<r.minY)&&n(r.a,r.b,s.a)*n(r.a,r.b,s.b)<=0&&n(s.a,s.b,r.a)*n(s.a,s.b,r.b)<=0)return!0}}return!1}function hs(e,t,n){if(e.length<2)return[];let o=n??Xn(e),r=new Map;for(let s=0;s<e.length;s++){let a=r.get(e[s].blockId);a?a.push(s):r.set(e[s].blockId,[s])}let i=[];for(let[,s]of r){let a=[];for(let g of s){let S=e[g].patch;S&&S.length>=3?i.push({outline:[...S],holes:[],topY:e[g].y}):a.push(g)}if(!a.length)continue;a.sort((g,S)=>e[g].depth-e[S].depth);let l=a.map(g=>us(e,g,o,t)).filter(g=>g!==null);if(!l.length)continue;let u=(g,S)=>({x:g.pts[S].x-g.nrm[S][0]*(g.front+Ht),y:g.pts[S].y-g.nrm[S][1]*(g.front+Ht)}),f=(g,S)=>({x:g.pts[S].x+g.nrm[S][0]*(g.back+Ht),y:g.pts[S].y+g.nrm[S][1]*(g.back+Ht)}),m=l[0],h=l[l.length-1],d=[];for(let g=0;g<m.pts.length;g++)d.push(u(m,g));for(let g of l)d.push(f(g,g.pts.length-1));for(let g=h.pts.length-1;g>=0;g--)d.push(f(h,g));for(let g=l.length-1;g>=0;g--)d.push(u(l[g],0));let p=ds(d),b=1/0;for(let g of a)e[g].y<b&&(b=e[g].y);if(!Number.isFinite(b))continue;if(p.length>=3&&Math.abs(je(p))>1e-6&&l.every(g=>{let S=g.pts[Math.floor(g.pts.length/2)];return Ce(p,S.x,S.y)})&&!Ef(p)){i.push({outline:ms(p,fs),holes:[],topY:b});continue}for(let g of Af(l))i.push({outline:g,holes:[],topY:b})}return i}function Af(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+Ht,s=n.back+Ht;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]*s,l.y+u[1]*s])}let a=[...o,...r.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=qo.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})),s=i[0],a=i[i.length-1];i.length>1&&Math.abs(s.x-a.x)<1e-9&&Math.abs(s.y-a.y)<1e-9&&i.pop(),i.length>=3&&o.push(ms(i,fs))}return o}catch{return[]}}function ds(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 Qo=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(!Ce(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function as(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 f=1;f+1<o.length;f++){let m=o[f],h=o[f+1];e.tri([u.x*w,r,u.y*w],[m.x*w,r,m.y*w],[h.x*w,r,h.y*w],l,i)}return}let s=o.map(l=>[l.x,l.y]);s.push(s[0]);let a;try{a=qo.default.intersection([s],t)}catch{return}let c=[0,1,0];for(let l of a){if(!l.length||l[0].length<4)continue;let u=l[0],f=[],m=[];for(let d=0;d<u.length-1;d++)f.push(u[d][0],u[d][1]),m.push([u[d][0],u[d][1]]);if(m.length<3)continue;let h=(0,cs.default)(f,void 0,2);for(let d=0;d<h.length;d+=3){let p=m[h[d]],b=m[h[d+1]],M=m[h[d+2]];e.tri([p[0]*w,r,p[1]*w],[b[0]*w,r,b[1]*w],[M[0]*w,r,M[1]*w],c,i)}}}function ps(e,t,n,o,r,i,s){if(t.length<2)return;let a=s??Xn(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 Qo([[...i]]):null,f=h=>{e.setMaterial(2),h(),e.setMaterial(0)},m=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 I=[...d.patch],y=a[h].belowY??o;if(m(()=>{if(l&&u)as(e,l,u,I,d.y,r.tread);else{let x=I[0];for(let P=1;P+1<I.length;P++){let R=I[P],v=I[P+1];e.tri([x.x*w,d.y,x.y*w],[R.x*w,d.y,R.y*w],[v.x*w,d.y,v.y*w],c,r.tread)}}}),d.y>y+is){let x=0,P=0;for(let R of I)x+=R.x,P+=R.y;x/=I.length,P/=I.length,f(()=>{for(let R=0;R<I.length;R++){let v=I[R],T=I[(R+1)%I.length],k=T.x-v.x,C=T.y-v.y,E=Math.hypot(k,C);if(E<1e-6)continue;let A=C/E,O=-k/E;(v.x-x)*A+(v.y-P)*O<0&&(A=-A,O=-O);let F=[A,0,O],L=[v.x*w,d.y,v.y*w],B=[T.x*w,d.y,T.y*w],D=[v.x*w,y,v.y*w],j=[T.x*w,y,T.y*w];e.tri(L,B,j,F,r.riser),e.tri(L,j,D,F,r.riser)}})}continue}let p=us(t,h,a,n);if(!p)continue;let{pts:b,nrm:M,front:g,back:S}=p,_=a[h].belowY??o;for(let I=0;I+1<b.length;I++){let y=b[I],x=b[I+1],P=M[I],R=M[I+1];if(Math.hypot(x.x-y.x,x.y-y.y)<1e-6||P[0]===0&&P[1]===0||R[0]===0&&R[1]===0)continue;let v=[(y.x-P[0]*g)*w,d.y,(y.y-P[1]*g)*w],T=[(x.x-R[0]*g)*w,d.y,(x.y-R[1]*g)*w],k=[(y.x+P[0]*S)*w,d.y,(y.y+P[1]*S)*w],C=[(x.x+R[0]*S)*w,d.y,(x.y+R[1]*S)*w];if(m(()=>{l&&u?as(e,l,u,[{x:y.x-P[0]*g,y:y.y-P[1]*g},{x:x.x-R[0]*g,y:x.y-R[1]*g},{x:x.x+R[0]*S,y:x.y+R[1]*S},{x:y.x+P[0]*S,y:y.y+P[1]*S}],d.y,r.tread):(e.tri(v,T,C,c,r.tread),e.tri(v,C,k,c,r.tread))}),d.y>_+is){let E=[v[0],_,v[2]],A=[T[0],_,T[2]],O=[-P[0],0,-P[1]];f(()=>{e.tri(v,T,A,O,r.riser),e.tri(v,A,E,O,r.riser)})}}}}function Cf(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function bs(e,t){return e.filter(n=>n.type!=="shape"||Cf(n,t))}function ys(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:bs(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:bs(e.objects,t),focal:n,baseHeightM:0,index:0}]}var vf={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function lt(e){return Ui(e)??vf}function gs(e,t){let n=ot(e.outline,Ye),o=lt(n),r=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&Dt(o,lt(s.outline)));if(!r.length)return[n];let i=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a};try{let s=Jo.default.difference([i(n)],...r.map(c=>[i(c.outline)])),a=[];for(let c of s){if(!c.length)continue;let l=c[0].map(([u,f])=>({x:u,y:f}));if(l.length>1){let u=l[0],f=l[l.length-1];Math.abs(u.x-f.x)<1e-9&&Math.abs(u.y-f.y)<1e-9&&l.pop()}l.length>=3&&a.push(l)}return a.length?a:[n]}catch{return[n]}}function xs(e,t){if(!t.length)return e;let n=i=>{let s=i.map(a=>[a.x,a.y]);return s.push(s[0]),s},o=t.map(i=>[n(i)]),r=[];for(let i of e){let s;try{s=Jo.default.intersection([n(i.outline)],o.flat())}catch{r.push(i);continue}for(let a of s){if(!a.length)continue;let c=a[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 kf(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Kn=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=lt(t),i=this.rings.filter((c,l)=>Dt(r,this.boxes[l])&&kf(n,this.levels[l])),s=[[o]];if(i.length)try{s=Ms.default.difference([o],...i).map(l=>l.map(u=>u.map(([f,m])=>[f,m])))}catch{s=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let a=[];for(let c of s){if(!c.length)continue;let l=c[0].map(([u,f])=>({x:u,y:f}));if(l.length>1){let u=l[0],f=l[l.length-1];Math.abs(u.x-f.x)<1e-9&&Math.abs(u.y-f.y)<1e-9&&l.pop()}l.length>=3&&a.push(l)}return a}};function jt(e,t,n=e){if(!t)return e;let o=1/0,r=-1/0,i=1/0,s=-1/0;for(let m of n)o=Math.min(o,m.x),r=Math.max(r,m.x),i=Math.min(i,m.y),s=Math.max(s,m.y);let a=(o+r)/2,c=(i+s)/2,l=t*Math.PI/180,u=Math.cos(l),f=Math.sin(l);return e.map(m=>{let h=m.x-a,d=m.y-c;return{x:a+h*u-d*f,y:c+h*f+d*u}})}function Ss(e){let t=qr(e);return!t.length||!e.points?.length?[]:t.map(n=>jt(n,e.rotation,e.points))}function ce(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3)return jt(An(e,4),e.rotation,e.points);if(e.kind==="rect"&&e.width&&e.height&&(t=sn(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=Fn(n,o,e.width/2,e.height/2)}return t?jt(t,e.rotation):null}function $e(e){let t=e.role??"",o=t==="stage"?{kind:"stage",heightM:mi(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 Of=.08,Lf=30,Tf=.015;function Bf(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function Rs(e,t){let n=ce(e)??(e.points?.length?jt(e.points,e.rotation):null),o=$e(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(je(n))*ee**2>=Lf?Tf:o.heightM;if(!n)return{topOffsetM:i,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:i,supportOffsetM:0};let s=1/0,a=1/0,c=-1/0,l=-1/0;for(let h of n)s=Math.min(s,h.x),a=Math.min(a,h.y),c=Math.max(c,h.x),l=Math.max(l,h.y);let u=i,f=0,m=1e-6*Math.max(1,c-s,l-a);for(let h of t)c>h.minX&&s<h.maxX&&l>h.minY&&a<h.maxY&&u<=h.topOffsetM+1e-6&&(u=h.topOffsetM+Of),s>=h.minX-m&&c<=h.maxX+m&&a>=h.minY-m&&l<=h.maxY+m&&(!h.poly||n.every(b=>Bf(b,h.poly)||Nf(b,h.poly,m)))&&(f=Math.max(f,h.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:s,minY:a,maxX:c,maxY:l,topOffsetM:u,poly:n}),{topOffsetM:u,supportOffsetM:Math.min(f,u)}}function Nf(e,t,n){for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],s=t[o],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c,u=l?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/l)):0;if(Math.hypot(e.x-(i.x+u*a),e.y-(i.y+u*c))<=n)return!0}return!1}function dt(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Ue(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 Te(e,t,n){return[dt(e[0],e[1],t),dt(e[0],e[1],n),dt(e[3],e[2],n),dt(e[3],e[2],t)]}function fn(e,t,n){return[dt(e[0],e[3],t),dt(e[1],e[2],t),dt(e[1],e[2],n),dt(e[0],e[3],n)]}function he(e,t,n,o,r,i,s){$(e,t,s?.length?s:void 0,()=>n,o,r,i,W)}var Is=[.13,.14,.17],Vt=[.4,.43,.47],Ff=.18,Df=.02,Gf=2.4,Hf=1500,jf=240,Vf=.25,Uf=12,Xf=[.055,.06,.075],Kf=[.46,.33,.22],Wf=[1,.96,.84],Yf=[.98,.66,.28],zf=[.5,.31,.15],Zf=[1,.87,.64],Ae={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 $f(e,t,n,o){let r=1/0,i=0;for(let s=0;s<e.length;s++){let a=e[s],c=e[(s+1)%e.length],l=c.x-a.x,u=c.y-a.y,f=n*u-o*l;if(Math.abs(f)<1e-12)continue;let m=((a.x-t.x)*u-(a.y-t.y)*l)/f,h=((a.x-t.x)*o-(a.y-t.y)*n)/f;m>0&&h>=0&&h<1&&(i+=1,r=Math.min(r,m))}return i%2===1?r:0}function er(e,t){if(!t.length)return!1;let n=0,o=0,r=0,i=new Set;for(let a of t)n+=a.x,o+=a.y,r+=Math.hypot(a.x-e.x,a.y-e.y),i.add(Math.floor(Math.atan2(a.y-e.y,a.x-e.x)*180/Math.PI/10));let s=Math.hypot(e.x-n/t.length,e.y-o/t.length);return i.size*10>jf&&s<Vf*(r/t.length)}function Ps(e,t,n,o,r={}){let i=t.stageKind??"";if(Ze(i)||i==="round"||!o.length)return;let s=ce(t);if(!s||s.length<3)return;let a={x:s.reduce((N,K)=>N+K.x,0)/s.length,y:s.reduce((N,K)=>N+K.y,0)/s.length},c=0,l=0;for(let N of o)c+=N.x,l+=N.y;let u=a.x-c/o.length,f=a.y-l/o.length,m=Math.hypot(u,f);if(m<1e-6||er(a,o))return;let h=u/m,d=f/m,p=-d,b=h,M=-1/0,g=1/0,S=1/0,_=-1/0;for(let N of s){let K=(N.x-a.x)*h+(N.y-a.y)*d,Z=(N.x-a.x)*p+(N.y-a.y)*b;M=Math.max(M,K),g=Math.min(g,K),S=Math.min(S,Z),_=Math.max(_,Z)}let I=(_-S)*w,y=(M-g)*w;if(I<3||y<1.5||I*y>Hf)return;let x=Ff/w,P=(N,K)=>({x:a.x+h*N+p*K,y:a.y+d*N+b*K}),R=(N,K,Z,te)=>[P(N,Z),P(N,te),P(K,te),P(K,Z)],v=n+Math.max(3.5,Math.min(8,I*.35)),T=n+Math.min(Gf,v-n-1),k=.2/w,C=g+Math.min(y*.25,1.5)/w,E=Df/w;$(e,R(M-2*x+E,M-x-E,S+x+k,_-x-k),void 0,()=>T,n,Is,Is,W);for(let[N,K]of[[S+x,S+x+k],[_-x-k,_-x]])$(e,R(M-2*x,M-x,N,K),void 0,()=>v+.3,n,Vt,Vt,W),$(e,R(C+k,M-2*x,N,K),void 0,()=>v+.3,v,Vt,Vt,W);$(e,R(C,C+k,S+x,_-x),void 0,()=>v+.3,v,Vt,Vt,W);let A=(N,K)=>[N.x*w,K,N.y*w],O=[-h,0,-d],F=S+x+k,L=_-x-k,B=M-2*x-Ae.drapeClear/w,D=v-n,j=r.night===!1?Ae.washByDay:1,G=(N,K)=>fe(Xf,Kf,j*(1-N*N)*Math.pow(1-K,1.6)),V=(N,K,Z=0)=>A(P(B-Z/w,(F+L)/2+N*(L-F)/2),n+D*K);e.setMaterial(Uf);let U=8,z=5;for(let N=0;N<U;N++)for(let K=0;K<z;K++){let Z=N/U*2-1,te=(N+1)/U*2-1,re=K/z,ue=(K+1)/z;e.tri(V(Z,re),V(te,re),V(te,ue),O,G(Z,re),G(te,re),G(te,ue)),e.tri(V(Z,re),V(te,ue),V(Z,ue),O,G(Z,re),G(te,ue),G(Z,ue))}let X=Math.max(Ae.lampsMin,Math.min(Ae.lampsMax,Math.round(I/Ae.lampEvery))),Q=Math.max(Ae.lampRadius[0],Math.min(Ae.lampRadius[1],I*.012)),q=(L-F)*w,oe=1-Ae.lampDrop/D,se=(N,K,Z,te,re)=>{let ae=K/q*2,Le=K/D;for(let J=0;J<10;J++){let Me=2*Math.PI*J/10,at=2*Math.PI*(J+1)/10,xt=[Math.cos(Me)*ae,Math.sin(Me)*Le],Xe=[Math.cos(at)*ae,Math.sin(at)*Le];e.tri(V(N,oe,Z),V(N+xt[0],oe+xt[1],Z),V(N+Xe[0],oe+Xe[1],Z),O,te,re(xt[0],xt[1]),re(Xe[0],Xe[1]))}};for(let N=0;N<X;N++){let K=(N+.5)/X*2-1;se(K,Q*3,Ae.glowClear,fe(G(K,oe),zf,.85),(Z,te)=>G(K+Z,oe+te)),se(K,Q,Ae.coreClear,Wf,()=>Yf)}if(e.setMaterial(0),!r.night||!r.deck)return;let le=r.deck,de=P((g+M-2*x)/2,(S+_)/2),pe=n+Ae.poolLift,_e=[0,1,0],Oe=[{r:.4,k:.72},{r:.72,k:.28},{r:1,k:0}],Ge=28,He=[];for(let N=0;N<Ge;N++){let K=2*Math.PI*N/Ge,Z=Math.cos(K)*(M-2*x-g)*Ae.poolShare,te=Math.sin(K)*(_-S)*Ae.poolShare,re=Math.hypot(Z,te),ue=(h*Z+p*te)/re,ae=(d*Z+b*te)/re;He.push(Math.min(re,$f(s,de,ue,ae)*Ae.poolEdge))}if(He.some(N=>!(N>0)))return;let ve=(N,K)=>{let Z=2*Math.PI*(N%Ge)/Ge,te=Math.cos(Z)*(M-2*x-g)*Ae.poolShare,re=Math.sin(Z)*(_-S)*Ae.poolShare,ue=Math.hypot(te,re),ae=He[N%Ge]*K/ue;return A({x:de.x+(h*te+p*re)*ae,y:de.y+(d*te+b*re)*ae},pe)},H=N=>fe(le,Zf,Ae.poolStrength*N);for(let N=0;N<Ge;N++){e.tri(A(de,pe),ve(N,Oe[0].r),ve(N+1,Oe[0].r),_e,H(1),H(Oe[0].k),H(Oe[0].k));for(let K=0;K+1<Oe.length;K++){let Z=Oe[K],te=Oe[K+1];e.tri(ve(N,Z.r),ve(N,te.r),ve(N+1,te.r),_e,H(Z.k),H(te.k),H(te.k)),e.tri(ve(N,Z.r),ve(N+1,te.r),ve(N+1,Z.r),_e,H(Z.k),H(te.k),H(Z.k))}}}function _s(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(St(i)){n.openField=!0;continue}if(Ze(i)){n.court=!0,fi(i)&&(n.indoorCourt=!0);continue}if(r.role!=="stage")continue;if(n.stage=!0,i==="round"){n.inTheRound=!0;continue}let s=ce(r);if(!s||s.length<3)continue;let a={x:s.reduce((c,l)=>c+l.x,0)/s.length,y:s.reduce((c,l)=>c+l.y,0)/s.length};er(a,t)&&(n.inTheRound=!0)}return n}var vs=10,At=11,Ut=[.93,.94,.95],Qf=[.93,.8,.22],qf=[.82,.14,.16],Jf=[.78,.1,.12],tr=[.74,.77,.8],nr={width:7.32,height:2.44,depth:2},Wn={width:1.83,height:1.22,depth:1,fromEndBoards:3.35},em=1.5,tm=1.8,or=2.4,Be=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],hn=(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 ze(e,t,n,o,r){let i=ut(Be(n,t)),s=ut(hn(i,Math.abs(i[1])<.9?[0,1,0]:[1,0,0])),a=hn(s,i),c=(l,u)=>{let f=u===0||u===3?-o:o,m=u<2?-o:o;return[l[0]+s[0]*f+a[0]*m,l[1]+s[1]*f+a[1]*m,l[2]+s[2]*f+a[2]*m]};for(let l=0;l<4;l++){let u=(l+1)%4,f=c(t,l),m=c(t,u),h=c(n,l),d=c(n,u),p=ut(hn(Be(m,f),Be(h,f))),b=Be([(f[0]+m[0])/2,(f[1]+m[1])/2,(f[2]+m[2])/2],t);p[0]*b[0]+p[1]*b[1]+p[2]*b[2]<0&&(p=[-p[0],-p[1],-p[2]]);let M=Y(r,.86+.14*Math.max(0,p[1]));e.tri(f,m,d,p,M),e.tri(f,d,h,p,M)}}function mn(e,t,n,o,r){let i=Math.hypot(...Be(n,t)),s=Math.hypot(...Be(r,t)),a=ut(hn(Be(n,t),Be(r,t)));e.tri(t,n,o,a,[0,0,0],[i,0,0],[i,s,0]),e.tri(t,o,r,a,[0,0,0],[i,s,0],[0,s,0])}function ir(e,t,n,o,r,i,s,a,c){let l=(g,S)=>[g[0],g[1]+S,g[2]],u=g=>[g[0]+o[0]*i,g[1],g[2]+o[2]*i],f=l(t,r),m=l(n,r),h=u(t),d=u(n),p=u(f),b=u(m);e.setMaterial(c),ze(e,t,f,s,a),ze(e,n,m,s,a),ze(e,f,m,s,a),e.setMaterial(At);let M=Math.min(s,.03);for(let[g,S]of[[h,p],[d,b],[f,p],[m,b],[p,b],[t,h],[n,d],[h,d]])ze(e,g,S,M,Y(a,.92));e.setMaterial(vs),mn(e,h,d,b,p),mn(e,f,m,b,p),mn(e,t,h,p,f),mn(e,n,d,b,m),e.setMaterial(0)}var rr={height:.711,width:.2286,pitchLength:20.12},nm=[.88,.8,.6];function ks(e,t,n){if(t.length!==4)return;let o=s=>Math.hypot(t[(s+1)%4].x-t[s].x,t[(s+1)%4].y-t[s].y),r=o(0)<=o(1)?0:1,i=Math.max(o(0),o(1))*w/rr.pitchLength;if(i>.2){e.setMaterial(At);for(let s of[r,r+2]){let a=t[s%4],c=t[(s+1)%4],l=o(s%4)||1,u={x:(a.x+c.x)/2,y:(a.y+c.y)/2},f=(c.x-a.x)/l,m=(c.y-a.y)/l;for(let h of[-1,0,1]){let d=h*rr.width*i/2/w,p=ge({x:u.x+f*d,y:u.y+m*d},n);ze(e,p,[p[0],p[1]+rr.height*i,p[2]],.019*i,nm)}}e.setMaterial(0)}}var ge=(e,t)=>[e.x*w,t,e.y*w];function Os(e){if(e.length<3)return null;let t=0,n=0;for(let M of e)t+=M.x,n+=M.y;t/=e.length,n/=e.length;let o=0,r=0,i=0;for(let M of e){let g=M.x-t,S=M.y-n;o+=g*g,r+=S*S,i+=g*S}let s=.5*Math.atan2(2*i,o-r),a=Math.cos(s),c=Math.sin(s),l=1/0,u=-1/0,f=1/0,m=-1/0;for(let M of e){let g=(M.x-t)*a+(M.y-n)*c,S=-(M.x-t)*c+(M.y-n)*a;l=Math.min(l,g),u=Math.max(u,g),f=Math.min(f,S),m=Math.max(m,S)}let h=(u-l)*w,d=(m-f)*w;if(!(h>4)||!(d>2))return null;let p={a:(l+u)/2,b:(f+m)/2};return{at:(M,g)=>{let S=p.a+M/w,_=p.b+g/w;return{x:t+a*S-c*_,y:n+c*S+a*_}},lengthM:h,widthM:d}}function Ls(e,t,n,o,r,i){let s=t.map(c=>ge(c,n)),a=t.map(c=>ge(c,n+o));e.setMaterial(0);for(let c=0;c<t.length;c++)ze(e,s[c],a[c],r,i);e.setMaterial(At);for(let c=0;c+1<t.length;c++)ze(e,a[c],a[c+1],.025,i);e.setMaterial(vs);for(let c=0;c+1<t.length;c++)mn(e,s[c],s[c+1],a[c+1],a[c]);e.setMaterial(0)}var ws=[.66,.29,.22],om=[.87,.79,.58],Es=[.17,.36,.63],Ts=[.56,.59,.63],rm=[.7,.7,.68],im={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 Bs(e,t,n){let o=Os(t);if(!o)return;let{at:r,lengthM:i,widthM:s}=o,a=im,c=Math.min(1.2,Math.max(.5,i/a.length)),l=s/2,u=i/2-l,f=l-a.trackWidth;if(!(u>30*c)||!(f>22*c))return;let m=n+.03,h=(k,C,E=0)=>{$(e,k,void 0,()=>m+E,m+E-.004,C,C,W)},d=(k,C,E,A)=>[r(k,E),r(C,E),r(C,A),r(k,A)];e.setMaterial(0),h(d(u-.08,u+.08,-l+.2,-f-.2),Ut);let p=a.longJump,b=f-p.fromKerb*c,M=(p.start+p.runway)*c;h(d(p.start*c,M,b-p.runwayWidth*c/2,b+p.runwayWidth*c/2),ws),h(d(M,M+p.pit*c,b-p.pitWidth*c/2,b+p.pitWidth*c/2),om);let g=a.highJump,S=-(u+g.intoBend*c),_=[];for(let k=0;k<=16;k++){let C=-Math.PI/2+Math.PI*k/16;_.push(r(S-.3*c+Math.cos(C)*g.apron*c,Math.sin(C)*g.apron*c))}h(_,ws),$(e,d(S-g.matLength*c,S,-(g.matWidth*c)/2,g.matWidth*c/2),void 0,()=>n+g.matHeight*c,n,Es,Y(Es,.82),W),e.setMaterial(At);let I=[-1,1].map(k=>r(S+.25*c,k*(g.bar+.1)*c));for(let k of I)ze(e,ge(k,n),ge(k,n+(g.bar+.3)*c),.02,Ut);ze(e,ge(I[0],n+g.bar*c),ge(I[1],n+g.bar*c),.015,Ut),e.setMaterial(0);let y=a.cage,x=u+y.intoBend*c;h(((k,C)=>Array.from({length:C},(E,A)=>{let O=2*Math.PI*A/C;return r(x+Math.cos(O)*k,Math.sin(O)*k)}))(y.pad*c,16),rm);let R=y.sectorDeg/2*Math.PI/180;for(let k of[-1,1]){let C=y.sector*c,E=-Math.cos(R),A=k*Math.sin(R);h([r(x+A*.15,-E*.15),r(x+E*C+A*.15,A*C-E*.15),r(x+E*C-A*.15,A*C+E*.15),r(x-A*.15,E*.15)],Ut,.006)}let v=y.openDeg/2*Math.PI/180,T=[];for(let k=0;k<=6;k++){let C=v+(2*Math.PI-2*v)*k/6;T.push(r(x-Math.cos(C)*y.radius*c,Math.sin(C)*y.radius*c))}Ls(e,T,n,y.height*c,.05,Ts)}var sm=[.95,.8,.16],As=[.13,.17,.2],Cs=[.78,.8,.83],am={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 Ns(e,t,n,o,r,i){let s=am,a={x:s.pole.x-s.backHalf,y:s.pole.y-s.backY},c=Math.hypot(a.x,a.y),l=a.x/c,u=a.y/c,f=(S,_,I)=>t(S*(s.backHalf+l*_+u*I),s.backY+u*_-l*I),m=s.net,h=s.backY-m.inset,d=s.backHalf-m.inset,p=[f(-1,m.wing,m.inset)];for(let S of[-d,-d/2,d/2,d])p.push(t(S,h));p.push(f(1,m.wing,m.inset)),Ls(e,p,n,m.height*o,.05,Ts),e.setMaterial(0);for(let S of[-1,1]){let _=ge(t(S*(s.pole.x-.4),s.pole.y+.4),n);ze(e,_,[_[0],_[1]+s.poleHeight*o,_[2]],.09,sm)}if(!i)return;let b=s.dugout,M=b.along*c-b.length/2,g=M+b.length;for(let S of[-1,1]){let _=[f(S,M,b.inset-b.depth/2),f(S,g,b.inset-b.depth/2)],I=[f(S,M,b.inset+b.depth/2),f(S,g,b.inset+b.depth/2)],y=Math.ceil(b.length),x=!0;for(let T=0;x&&T<=y;T++){let k=T/y;x=r({x:_[0].x+(_[1].x-_[0].x)*k,y:_[0].y+(_[1].y-_[0].y)*k})}if(!x)continue;let P=[_[0],_[1],I[1],I[0]];$(e,P,void 0,()=>n+(b.height-.1)*o,n,As,Y(As,.85),W);let R=(T,k)=>({x:T.x+(T.x-k.x)*.04,y:T.y+(T.y-k.y)*.04}),v=[R(_[0],I[1]),R(_[1],I[0]),R(I[1],_[0]),R(I[0],_[1])];$(e,v,void 0,()=>n+b.height*o,n+(b.height-.14)*o,Cs,Y(Cs,.9),W)}}function Fs(e,t,n,o,r,i){let s=t.lengthM/2,a=t.widthM/2;if(i){let c=nr.width/2*o,l=nr.depth*o;for(let u of[-1,1]){let f=t.at(u*(s+l),-c),m=t.at(u*(s+l),c);if(!r(f)||!r(m))continue;let h=ge(t.at(u*s,-c),n),d=ge(t.at(u*s,c),n),p=ge(t.at(u*(s+1),0),n),b=ge(t.at(u*s,0),n);ir(e,h,d,ut(Be(p,b)),nr.height*o,l,.06,Ut,0)}}e.setMaterial(At);for(let c of[-1,1])for(let l of[-1,1]){if(!r(t.at(c*s,l*a)))continue;let u=ge(t.at(c*s,l*a),n),f=[u[0],u[1]+em*o,u[2]];ze(e,u,f,.02,Qf);let m=ut(Be(ge(t.at(c*(s+1),l*(a+1)),n),u)),h=[f[0]+m[0]*.4*o,f[1]-.14*o,f[2]+m[2]*.4*o],d=[f[0],f[1]-.28*o,f[2]];e.tri(f,h,d,ut(hn(Be(h,f),Be(d,f))),qf)}e.setMaterial(0)}function Ds(e,t,n,o,r){let i=Os(t);if(!i)return;let{at:s,lengthM:a}=i,c=Math.min(1.2,Math.max(.5,a/60)),l=a/2-Wn.fromEndBoards*c,u=Wn.width/2*c;for(let b of[-1,1]){let M=ge(s(b*l,-u),n),g=ge(s(b*l,u),n),S=ge(s(b*(l+1),0),n),_=ge(s(b*l,0),n);ir(e,M,g,ut(Be(S,_)),Wn.height*c,Wn.depth*c,.03,Jf,At)}let f=We(t,r/2/w);if(f.length<3)return;let m=o+tm;e.setMaterial(At);let h=or;for(let b=0;b<f.length;b++){let M=f[b],g=f[(b+1)%f.length],S=Math.hypot(g.x-M.x,g.y-M.y)*w,_=0;for(;h+(S-_)>=or;){_+=or-h,h=0;let I=S>0?_/S:0,y={x:M.x+(g.x-M.x)*I,y:M.y+(g.y-M.y)*I};ze(e,ge(y,o),ge(y,m),.025,tr)}h+=S-_}let d=We(t,(r/2-.03)/w),p=We(t,(r/2+.03)/w);d.length>=3&&p.length>=3&&$(e,d,[p.slice().reverse()],()=>m,m-.05,tr,Y(tr,.9),W),e.setMaterial(0)}function Gs(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}),s=d=>Math.hypot(d.x-n.x,d.y-n.y),a=s(i(t[0],t[1]))<=s(i(t[3],t[2])),[c,l,u]=a?[t[0],t[1],t[3]]:[t[3],t[2],t[0]],f=Math.hypot(u.x-c.x,u.y-c.y)*w;if(!(f>.05))return;let m=ge(c,o),h=ge(l,o);ir(e,m,h,ut(Be(ge(u,o),m)),r-o,f,.06,Ut,0)}var cm=[.12,.38,.16],lm=[.72,.62,.45],um=[.88,.93,.96],Hs=[.95,.95,.94],fm=[.66,.29,.22],sr={length:20.12,width:3.05},mm=.14,hm=9.76,Qe=[.93,.94,.95],Yn=[.1,.11,.13],dm=[.45,.85,1.25],pm=1.45,js=.012,Vs=.004,Us=1.07,zn=.15,Xs=[.93,.76,.18],ar={height:.2,proud:.02,buried:.03};function Ct(e,t,n,o,r,i){e.setMaterial(i),$(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,W)}var Xt=(e,t)=>We(e,t/w);function Ws(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 s=-r/i*n,a=o/i*n;return[{x:e.x+s,y:e.y+a},{x:t.x+s,y:t.y+a},{x:t.x-s,y:t.y-a},{x:e.x-s,y:e.y-a}]}function bm(e,t,n,o){let r=t.map(i=>[i.x*w,n,i.y*w]);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 Kt(e,t,n,o,r,i){let s=n/w,a=[{x:t.x-s,y:t.y-s},{x:t.x+s,y:t.y-s},{x:t.x+s,y:t.y+s},{x:t.x-s,y:t.y+s}];$(e,a,void 0,()=>r,o,i,Y(i,.85),W)}function Ne(e,t,n,o,r,i,s){let a=Ws(t,n,o/w);a&&$(e,a,void 0,()=>i,r,s,Y(s,.85),W)}function yn(e){let t=Ue(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},s={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+s.x*l)/w,y:n.y+(i.y*c+s.y*l)/w}),lengthM:o*w,widthM:r*w}}function cr(e){let t=1/0,n=-1/0,o=1/0,r=-1/0;for(let m of e.points??[])t=Math.min(t,m.x),n=Math.max(n,m.x),o=Math.min(o,m.y),r=Math.max(r,m.y);let i=(e.rotation??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),c=(t+n)/2,l=(o+r)/2,u=m=>i?{x:c+(m.x-c)*s-(m.y-l)*a,y:l+(m.x-c)*a+(m.y-l)*s}:m,f=(m,h,d,p)=>u({x:c+m/d*(n-t),y:l+h/p*(r-o)});return{turn:u,shortSideM:Math.min(n-t,r-o)*w,local:f,widthU:n-t}}function ym(e){let t=ko(e).find(n=>n.closed&&!n.fill&&n.points.length===4);return t?t.points.map(cr(e).turn):null}function Ys(e,t,n){let o=ko(t);if(!o.length)return;let{turn:r,shortSideM:i}=cr(t),s=Math.max(.04,Math.min(.3,i*.004))/w,a=0;e.setMaterial(0);for(let u of o){if(!u.fill)continue;let f=u.points.map(r);Ct(e,f,null,n+js+a*Vs,me(u.fill)??Qe,0),a++}let c=o.filter(u=>!(u.fill&&u.ink===u.fill)),l=[...new Set(c.map(u=>u.ink??vn))];for(let u of l){let f=n+js+a++*Vs,m=me(u)??Qe;for(let h of c){if((h.ink??vn)!==u)continue;let d=h.points.map(r),p=h.closed?d.length:d.length-1;for(let b=0;b<p;b++){let M=Ws(d[b],d[(b+1)%d.length],s);M&&bm(e,M,f,m)}}}}function zs(e,t,n,o,r,i){if(t.length<3)return!1;let s=o+.006,a=r??cm;if(n==="oval-cricket"){let c=t.reduce((y,x)=>y+x.x,0)/t.length,l=t.reduce((y,x)=>y+x.y,0)/t.length,u=y=>t.map(x=>({x:c+(x.x-c)*y,y:l+(x.y-l)*y})),f=8;for(let y=0;y<f;y++){let x=u(1-y/f),P=y===f-1?null:u(1-(y+1)/f);Ct(e,x,P,s,Y(a,y%2?1.04:.96),4)}let m=t[0];for(let y of t)Math.hypot(y.x-c,y.y-l)>Math.hypot(m.x-c,m.y-l)&&(m=y);let h=Math.hypot(m.x-c,m.y-l)||1,d=(m.x-c)/h,p=(m.y-l)/h,b=-p,M=d,g=Math.min(1,2*h*w*mm/sr.length),S=sr.length*g/2/w,_=sr.width*g/2/w,I=(i&&ym(i))??[[-S,-_],[S,-_],[S,_],[-S,_]].map(([y,x])=>({x:c+d*y+b*x,y:l+p*y+M*x}));return Ct(e,I,null,s+.004,lm,0),ks(e,I,s+.004),e.setMaterial(0),!0}if(n==="rink-hockey"){let c=Xt(t,zn);Ct(e,c,null,s,um,0),e.setMaterial(0),$(e,t,[c.slice().reverse()],()=>o+Us,o,Hs,Y(Hs,.9),W);let l=Xt(t,zn-ar.buried),u=Xt(t,zn+ar.proud);return l.length>=3&&u.length>=3&&$(e,l,[u.slice().reverse()],()=>o+ar.height,o,Xs,Y(Xs,.92),W),Ds(e,t,s,o+Us,zn),!0}if(n==="ring-boxing"&&t.length===4){let{at:c}=yn(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],Qe,[.17,.42,.69],Qe];e.setMaterial(0),l.forEach((f,m)=>Kt(e,f,.07,o,o+pm,u[m]));for(let f of dm)for(let m=0;m<4;m++)Ne(e,l[m],l[(m+1)%4],.025,o+f-.025,o+f+.025,Qe);return!0}if(n==="court-tennis"&&t.length===4){let{at:c}=yn(t);e.setMaterial(0),Ne(e,c(0,-6.4),c(0,6.4),.015,o,o+.95,Yn),Ne(e,c(0,-6.4),c(0,6.4),.03,o+.95,o+1,Qe);for(let l of[-1,1])Kt(e,c(0,l*6.4),.05,o,o+1.07,Yn);return!0}if(n==="court-basketball"&&t.length===4){let{at:c,lengthM:l}=yn(t),u=Math.min(14,l/2-.5);e.setMaterial(0);for(let f of[-1,1]){let m=c(f*(u+1.2),0),h=c(f*(u-1.2),0);Kt(e,m,.12,o,o+3.4,Yn),Ne(e,m,h,.06,o+3.25,o+3.4,Yn),Ne(e,c(f*(u-1.2),-.9),c(f*(u-1.2),.9),.03,o+2.9,o+3.95,Qe)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:c,lengthM:l}=yn(t),u=l*(50/120);e.setMaterial(0);for(let f of[-1,1]){for(let m of[-2.8,2.8])Kt(e,c(f*u,m),.07,o,o+12,Qe);Ne(e,c(f*u,-2.8),c(f*u,2.8),.06,o+2.94,o+3.06,Qe)}return!0}if(n==="track-athletics"){let c=Xt(t,hm);return c.length<3?!1:(Ct(e,t,c,s,fm,0),Ct(e,c,null,s,a,4),e.setMaterial(0),Bs(e,t,o),!0)}return!1}var dn=140,Ks=1.6,pn=[.9,.91,.93],Zn=[.15,.19,.3],bn=[.14,.15,.18],gm=[.1,.24,.18],$n=.9,xm=6,Mm={"pitch-football":105,"pitch-rugby":120,"court-tennis":23.77,"court-basketball":32},Sm={sidelineShare:15/19,fromSideline:1.35,tableHalfLength:4.5,tableHalfDepth:.38,tableHeight:.76,benchFrom:6,benchTo:12.5,benchHalfDepth:.25,benchHeight:.45,benchBackHeight:.85},Rm=[.13,.15,.2],Im=[.82,.84,.87];function Zs(e,t,n,o,r,i=!1,s=!1){let a=t.stageKind;if(!a||n.length<3)return;if(e.setMaterial(0),a==="diamond-baseball"){let{local:R,widthU:v}=cr(t);if(!(v>0))return;let T=R(0,0,dn,dn),k=r.filter(E=>Math.hypot(E.x-T.x,E.y-T.y)<=v),C=Math.min(1.2,Math.max(.5,v*w/dn));Ns(e,(E,A)=>R(E,A,dn,dn),o,C,E=>k.every(A=>Math.hypot(A.x-E.x,A.y-E.y)*w>=Ks),!s),e.setMaterial(0);return}if(a==="oval-cricket"){let R=Xt(n,2.85),v=Xt(n,3.1);R.length>=3&&v.length>=3&&Ct(e,R,v,o+.03,Qe,0),e.setMaterial(0);return}let c=Mm[a];if(!c||n.length!==4)return;let{at:l,lengthM:u,widthM:f}=yn(n),m=Math.min(1.2,Math.max(.5,u/c)),h=u/2,d=f/2,p=Math.max(h,d)+14,b=l(0,0),M=r.filter(R=>Math.hypot(R.x-b.x,R.y-b.y)*w<p),g=R=>M.every(v=>Math.hypot(v.x-R.x,v.y-R.y)*w>=Ks),S=(R,v)=>{let T=Math.max(1,Math.ceil(Math.hypot(v.x-R.x,v.y-R.y)*w));for(let k=0;k<=T;k++)if(!g({x:R.x+(v.x-R.x)*(k/T),y:R.y+(v.y-R.y)*(k/T)}))return!1;return!0},_=(R,v,T,k,C)=>{let E=Math.hypot(v[0]-R[0],v[1]-R[1]),A=Math.max(1,Math.round(E/xm));for(let O=0;O<A;O++){let F=O/A+.012,L=(O+1)/A-.012,B=l(R[0]+(v[0]-R[0])*F,R[1]+(v[1]-R[1])*F),D=l(R[0]+(v[0]-R[0])*L,R[1]+(v[1]-R[1])*L);S(B,D)&&Ne(e,B,D,.06,o,o+C,k&&O%2?k:T)}};if(a==="court-basketball"){let R=Sm;for(let v of[-1,1]){let T=v*(d*R.sidelineShare+R.fromSideline*m),k=T+v*R.tableHalfDepth*m,C=(F,L)=>S(l(F,T),l(L,T))&&S(l(F,k),l(L,k)),E=R.tableHalfLength*m;if(!C(-E,E))continue;let A=l(-E,T),O=l(E,T);Ne(e,A,O,R.tableHalfDepth*m,o,o+R.tableHeight-.04,Rm),Ne(e,A,O,R.tableHalfDepth*m+.04,o+R.tableHeight-.06,o+R.tableHeight,Im);for(let F of[-1,1]){let L=F*R.benchFrom*m,B=F*R.benchTo*m;if(!C(L,B))continue;Ne(e,l(L,T),l(B,T),R.benchHalfDepth,o,o+R.benchHeight,bn);let D=T+v*(R.benchHalfDepth+.04);Ne(e,l(L,D),l(B,D),.03,o,o+R.benchBackHeight,bn)}break}return}if(a==="court-tennis"){let R=h+6.4*m,v=d+3.66*m;for(let k of[-1,1])_([k*R,-v],[k*R,v],gm,null,1);let T=l(0,d+1.2*m);g(T)&&(Kt(e,T,.3,o,o+1.5,bn),Kt(e,T,.36,o+1.5,o+1.62,Qe));return}Fs(e,{at:l,lengthM:u,widthM:f},o,m,g,a==="pitch-football"&&!i);let I=d+3.2*m,y=h+4*m,x=3*m,P=15*m;_([-h+x,I],[h-x,I],pn,Zn,$n),_([-h+x,-I],[-P,-I],pn,Zn,$n),_([P,-I],[h-x,-I],pn,Zn,$n);for(let R of[-1,1])_([R*y,-d+x],[R*y,d-x],pn,Zn,$n);for(let R of s?[]:[-1,1]){let v=R*2.5*m,T=R*10.5*m,k=-(d+4.4*m),C=l(v,k),E=l(T,k);!S(C,E)||!S(l(v,k-.75*m),l(T,k-.75*m))||(Ne(e,C,E,.35,o,o+.45,bn),Ne(e,l(v,k-.75*m),l(T,k-.75*m),.05,o,o+1.9,bn),Ne(e,l(v,k-.2*m),l(T,k-.2*m),.62,o+1.9,o+1.98,pn))}}var pt=72,Pm=1.2,_m=5,wm=30,Em=4;function Am(e,t,n,o){let r=0;for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length],c=a.x-s.x,l=a.y-s.y,u=n*l-o*c;if(Math.abs(u)<1e-12)continue;let f=((s.x-t.x)*l-(s.y-t.y)*c)/u,m=((s.x-t.x)*o-(s.y-t.y)*n)/u;f>r&&m>=-1e-9&&m<=1+1e-9&&(r=f)}return r}function Cm(e,t){if(e.length<3)return null;let n={x:e.reduce((a,c)=>a+c.x,0)/e.length,y:e.reduce((a,c)=>a+c.y,0)/e.length},o=2*Math.PI/pt,r=new Float64Array(pt);for(let a=0;a<pt;a++)if(r[a]=Am(e,n,Math.cos(a*o),Math.sin(a*o)),!(r[a]>0))return null;let i=new Float64Array(pt).fill(1/0);for(let a of t){let c=a.x-n.x,l=a.y-n.y,u=Math.hypot(c,l),f=(Math.round(Math.atan2(l,c)/o)%pt+pt)%pt;u>r[f]&&u<i[f]&&(i[f]=u)}let s=[];for(let a=0;a<pt;a++){let l=Number.isFinite(i[a])&&i[a]-r[a]<=wm/w?i[a]+Pm/w:r[a]+_m/w;s.push({x:n.x+Math.cos(a*o)*l,y:n.y+Math.sin(a*o)*l})}return s}function vm(e){return fe(Y(e,.84),[.33,.36,.31],.22)}function $s(e,t,n,o,r){let i=Cm(t,o);if(!i)return;let s=n-.015;e.setMaterial(Em);let a=vm(r);$(e,i,void 0,()=>s,s-.004,a,a,W),e.setMaterial(0)}function Qs(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 km(e,t){let n=Qs(e),o=Qs(t);return Ce(t,n.x,n.y)||Ce(e,o.x,o.y)}function Qn(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 s of r.objects){if(s.type!=="shape"||s.role!=="stage")continue;let a=ce(s);!a||a.length<3||(o.some(c=>km(a,c))?t.add(s):i.push(a))}o.push(...i)}return t}var qn=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7"],qs="#a4508b";var W0={facilities:qs,"food-drink":qn[5],navigation:qn[2],accessibility:qn[4]};var Y0={minDiameterPx:12,glyphScale:.66,ringRatio:1/14,largeFromPx:24};var xe=e=>{let t=Math.round(e*100)/100;return Object.is(t,-0)?"0":String(t)},Zt=e=>`${xe(e[0])} ${xe(e[1])}`,zt=(e,t,n,o)=>[e+n*Math.cos(o*Math.PI/180),t+n*Math.sin(o*Math.PI/180)];function fa(e){let t=`M${Zt(e.from)}`;for(let n of e.segs)t+=n.arc?`A${xe(n.arc.r)} ${xe(n.arc.r)} 0 ${n.arc.large} ${n.arc.sweep} ${Zt(n.to)}`:`L${Zt(n.to)}`;return`${t}Z`}function Se(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 Re(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 ne(e,t,n,o,r){let i=Math.min(r,n/2,o/2),s={r:i,large:0,sweep:1};return i<=0?Pe([[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:s},{to:[e+n,t+o-i]},{to:[e+n-i,t+o],arc:s},{to:[e+i,t+o]},{to:[e,t+o-i],arc:s},{to:[e,t+i]},{to:[e+i,t],arc:s}]}}function Pe(e){let t=0;for(let o=0;o<e.length;o++){let[r,i]=e[o],[s,a]=e[(o+1)%e.length];t+=r*a-s*i}let n=t>0?e:[...e].reverse();return{from:n[0],segs:[...n.slice(1).map(o=>({to:o})),{to:n[0]}]}}function ye(e,t,n){let o=n/2,r=t[0]-e[0],i=t[1]-e[1],s=Math.hypot(r,i);if(s<1e-6)return Re(e[0],e[1],o);let a=[i/s*o,-r/s*o],c={r:o,large:0,sweep:1},l=[e[0]+a[0],e[1]+a[1]];return{from:l,segs:[{to:[t[0]+a[0],t[1]+a[1]]},{to:[t[0]-a[0],t[1]-a[1]],arc:c},{to:[e[0]-a[0],e[1]-a[1]]},{to:l,arc:c}]}}function Ie(e,t,n=!1){let o=[],r=n?e.length:e.length-1;for(let i=0;i<r;i++)o.push(ye(e[i],e[(i+1)%e.length],t));return o}function qe(e,t,n,o,r,i){let s=i/2,a=r-o>180?1:0,c={r:s,large:0,sweep:1},l=zt(e,t,n+s,o);return{from:l,segs:[{to:zt(e,t,n+s,r),arc:{r:n+s,large:a,sweep:1}},{to:zt(e,t,n-s,r),arc:c},{to:zt(e,t,n-s,o),arc:{r:n-s,large:a,sweep:0}},{to:l,arc:c}]}}var ie=(...e)=>e.flat().map(fa).join(" "),Fe=(e,t,n)=>`M${xe(e-n)} ${xe(t)}a${xe(n)} ${xe(n)} 0 1 0 ${xe(2*n)} 0a${xe(n)} ${xe(n)} 0 1 0 ${xe(-2*n)} 0`,it=(e,t,n,o,r)=>fa(ne(e,t,n,o,r)),eo=e=>`M${e.map(Zt).join("L")}`,Jn=(e,t,n,o,r)=>`M${Zt(zt(e,t,n,o))}A${xe(n)} ${xe(n)} 0 ${r-o>180?1:0} 1 ${Zt(zt(e,t,n,r))}`;function Wt(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,s,a,c,l])=>[i*o+t,s*o+n,a*o,c,l])}}function gn(e){return[Fe(e.head[0],e.head[1],e.head[2]),...e.limbs.map(eo),...(e.arcs??[]).map(([t,n,o,r,i])=>Jn(t,n,o,r,i))].join(" ")}function Yt(e,t=2.6){return[Re(e.head[0],e.head[1],e.head[2]+1),...e.limbs.flatMap(n=>Ie(n,t)),...(e.arcs??[]).map(([n,o,r,i,s])=>qe(n,o,r,i,s,t-.2))]}var vt={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]]},Js={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]]]},ea={cx:12,hr:1.9,arm:5,leg:3,r:2},ta={cx:12,hr:1.9,sh:2.2,hem:6,leg:3},na={cx:6.2,hr:1.8,arm:3.6,leg:2.2,r:1.4},oa={cx:17.8,hr:1.8,sh:1.4,hem:4.1,leg:2.2};function ra({cx:e,hr:t,arm:n,leg:o,r}){return[Fe(e,2+t,t),`M${xe(e-n+r)} 8.5H${xe(e+n-r)}a${r} ${r} 0 0 1 ${r} ${r}V15H${xe(e+o)}V22H${xe(e-o)}V15H${xe(e-n)}V${xe(8.5+r)}a${r} ${r} 0 0 1 ${r} ${-r}Z`,`M${xe(e)} 15V22`].join(" ")}function ia({cx:e,hr:t,arm:n,leg:o,r}){return[Re(e,2+t,t+1),ne(e-n-.5,7.8,2*n+1,7.7,r+.5),ne(e-o-.5,13,o,9.5,1),ne(e+.5,13,o,9.5,1)]}function sa({cx:e,hr:t,sh:n,hem:o,leg:r}){return[Fe(e,2+t,t),eo([[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${xe(e)} 16V22`].join(" ")}function aa({cx:e,hr:t,sh:n,hem:o,leg:r}){return[Re(e,2+t,t+1),Pe([[e-n-.6,7.8],[e+n+.6,7.8],[e+o+.9,16.8],[e-o-.9,16.8]]),ne(e-r-.1,15,r-.4,7.5,.9),ne(e+.5,15,r-.4,7.5,.9)]}var Om=[[14.6,1.5],[5.2,13.6],[11,13.6],[9.4,22.5],[18.8,10.4],[13,10.4]],Lm="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",Tm="M12 2.5S5 9.5 5 14.5a7 7 0 0 0 14 0c0-5-7-12-7-12Z",Bm="M2.5 21.5h19V3h-6v6.2H9.2v6.2H2.5Z",ca=[[9,3],[15,3],[15,9],[21,9],[21,15],[15,15],[15,21],[9,21],[9,15],[3,15],[3,9],[9,9]],Nm={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}}]},Fm={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 la(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 ua={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]]]},Dm=[[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]],Gm=[[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]],lr=[{key:"restroom-men",label:"Men's restroom",group:"facilities",path:ra(ea),solid:ie(ia(ea))},{key:"restroom-women",label:"Women's restroom",group:"facilities",path:sa(ta),solid:ie(aa(ta))},{key:"restroom-accessible",label:"Accessible restroom",group:"facilities",path:[it(2.5,2.5,19,19,3.5),gn(Wt(vt,4.6,4.3,.66))].join(" "),solid:ie(Yt(vt)),solidLarge:ie(ne(1.5,1.5,21,21,4.5),Se(ne(3.9,3.9,16.2,16.2,2.6)),Yt(Wt(vt,4.9,4.7,.62),2.2))},{key:"first-aid",label:"First aid",group:"facilities",path:eo(ca)+"Z",solid:ie(Pe(ca.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:ie(qe(12,6.2,2.2,180,450,2.3),ye([12,8.4],[12,10.5],2.3),Ie([[12,10.2],[3.2,18.8],[20.8,18.8]],2.8,!0))},{key:"atm",label:"ATM / cash",group:"facilities",path:[it(2,6,20,12,2),Fe(12,12,2.75),"M6 12h.01 M18 12h.01"].join(" "),solid:ie(ne(1.5,5.5,21,13,2.4),Se(Re(12,12,3.2)))},{key:"info",label:"Info point",group:"facilities",path:[Fe(12,12,9.5),"M10.8 11H12v5.8 M12 7.6h.01"].join(" "),solid:ie(Re(12,4.9,2.4),ne(10.3,9.2,3.4,12.3,1),ne(8.2,9.2,4,3,1),ne(8.2,18.5,7.6,3,1))},{key:"lost-found",label:"Lost & found",group:"facilities",path:[Fe(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:ie(qe(12,7.6,4.2,180,405,3.4),Ie([[14.97,10.57],[12,13],[12,15]],3.4),Re(12,20,2.1))},{key:"restrooms",label:"Toilets",group:"facilities",path:[ra(na),sa(oa)].join(" "),solid:ie(ia(na),aa(oa))},{key:"charging",label:"Charging point",group:"facilities",path:[it(6,2,12,20,2.5),"M13.2 6.2 9.6 12h4.8l-3.6 5.8"].join(" "),solid:ie(Pe(Om))},{key:"smoking",label:"Smoking area",group:"facilities",path:[it(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:ie(ne(1.5,14,4.2,5,1.2),ne(6.8,14,10.4,5,1.2),Ie([[15.9,11.4],[17.3,8.9],[15.9,6.4],[17.1,3.9]],2.2),Ie([[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:[Fe(12,12,9.5),"M5.3 5.3l13.4 13.4","M5.5 10.5h13v3h-13Z"].join(" "),solid:ie(Re(12,12,10.6),Se(Re(12,12,8)),ye([6,6],[18,18],2.8),ne(5,10.4,3,3.2,.6),ne(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:ie(Ie([[4.9,2.6],[4.9,8]],2.2),Ie([[10.1,2.6],[10.1,8]],2.2),Ie([[7.5,2.6],[7.5,8]],2.2),qe(7.5,8,2.6,0,180,2.2),ye([7.5,10],[7.5,21.4],3),Pe([[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]]),ye([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:ie(Pe([[2.8,3],[21.2,3],[12,13.6]]),ye([12,12],[12,20.6],2.8),ye([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:ie({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]}]},qe(17.2,13.25,2.5,270,450,2.4),ye([7.8,2.6],[7.8,5.6],2.4),ye([12.2,2.6],[12.2,5.6],2.4),ye([2.6,21.6],[17.4,21.6],2.6))},{key:"water",label:"Water / drinks",group:"food-drink",path:Tm,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:Lm,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:[it(2,3.5,20,13.5,2),"M12 17v3.5 M8 20.5h8","M10 7.8v5.9l5-2.95Z"].join(" "),solid:ie(ne(1.5,3,21,14.4,2.4),Se(Pe([[9.6,6.7],[16,10.2],[9.6,13.7]])),ne(10.6,16.5,2.8,4,0),ye([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",Fe(6,14,2),Fe(12,8,2),Fe(18,15,2)].join(" "),solid:ie(ye([6,2.8],[6,21.2],1.8),ye([12,2.8],[12,21.2],1.8),ye([18,2.8],[18,21.2],1.8),ne(3.2,11.6,5.6,4.8,1.4),ne(9.2,5.6,5.6,4.8,1.4),ne(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:ie(Ie([[11,6.5],[11,2.6],[21,2.6],[21,21.4],[11,21.4],[11,17.5]],2.6),ye([2.8,12],[13.5,12],3.2),Pe([[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:ie(Ie([[13,6.5],[13,2.6],[3,2.6],[3,21.4],[13,21.4],[13,17.5]],2.6),ye([7.2,12],[17,12],3.2),Pe([[16.2,7.8],[21.6,12],[16.2,16.2]]))},{key:"emergency-exit",label:"Emergency exit",group:"navigation",path:[gn(Wt(Js,-2,1.4,1.15)),"M15.5 13h6 M19 10.5l2.5 2.5-2.5 2.5"].join(" "),solid:ie(Yt(Wt(Js,-2,1.4,1.15),2.7),ye([15.6,13],[19.5,13],2.8),Pe([[18.4,9.4],[22.4,13],[18.4,16.6]]))},{key:"stairs",label:"Stairs",group:"navigation",path:Bm,solid:"M1.5 22.5h21V2h-7.8v6.4H8.4v6.4H1.5Z"},{key:"elevator",label:"Elevator",group:"navigation",path:[it(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:ie(Pe([[12,1.6],[19.6,10.2],[4.4,10.2]]),Pe([[4.4,13.8],[19.6,13.8],[12,22.4]]))},{key:"parking",label:"Parking",group:"navigation",path:[it(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:gn(vt),solid:ie(Yt(vt))},{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:ie(qe(10,9,6,180,380,3),Ie([[15.64,11.05],[12.8,14.3],[11.5,17.2]],3),qe(8.2,17.2,3.3,0,150,3),qe(10,9,2.2,180,400,2.4),qe(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:ie(Nm,Se(ne(14.1,7,1.8,2.2,.9)),Se(ne(14.1,10.9,1.8,2.2,.9)),Se(ne(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:ie(Pe([[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]]),Re(11,4.3,2.3),ye([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:ie(Pe([[1.6,20.4],[22.4,20.4],[22.4,8.6]]),ye([4.2,13.4],[13.2,8.6],2.6),Pe([[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",it(3.5,11,17,6,2),"M6.5 17v2.5 M17.5 17v2.5 M7 14h.01 M17 14h.01"].join(" "),solid:ie(ne(9,1.8,6,3.4,.8),Pe([[6,11.4],[7.6,6.4],[16.4,6.4],[18,11.4]]),ne(2.8,10.6,18.4,7,2.2),Se(Re(6.8,14,1.3)),Se(Re(17.2,14,1.3)),ne(4.8,16,3.6,5.2,1.2),ne(15.6,16,3.6,5.2,1.2))},{key:"transit",label:"Bus / transit",group:"navigation",path:[it(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:ie(ne(4,2,16,17,3.2),Se(ne(6.2,5.8,11.6,5,1)),Se(Re(8,14.5,1.3)),Se(Re(16,14.5,1.3)),ne(6,17,3.4,5,1.2),ne(14.6,17,3.4,5,1.2))},{key:"bike-parking",label:"Bike parking",group:"navigation",path:[Fe(6,14.5,4),Fe(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:ie(Re(6,14.5,4.9),Se(Re(6,14.5,2.7)),Re(18,14.5,4.9),Se(Re(18,14.5,2.7)),Ie([[6,14.5],[9,7.5],[15.5,7.5],[18,14.5]],2.2),Ie([[9,7.5],[11.5,14.5],[15.5,7.5]],2.2),ye([6,14.5],[11.5,14.5],2.2),ye([7.2,5.8],[10.6,5.8],2.2),Ie([[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",Fe(10,9.6,1.5),Fe(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:ie(Ie([[9.4,2.4],[12,5],[14.6,2.4]],2.6),Ie([[9.4,21.6],[12,19],[14.6,21.6]],2.6),Ie([[2.4,9.4],[5,12],[2.4,14.6]],2.6),Ie([[21.6,9.4],[19,12],[21.6,14.6]],2.6),Re(9.7,9.3,2.2),Re(14.3,9.3,2.2),la(9.7,16,3),la(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:ie(Fm,Se(Pe([[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:[it(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:ie(ne(3,2,8.4,20,1.4),Se(ne(5,5,4.4,1.7,.8)),Se(ne(8.6,10.8,1.5,3.8,.7)),ne(12.6,2,8.4,20,1.4),Se(ne(14.6,5,4.4,1.7,.8)),Se(ne(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:ie(Pe([[9.6,6.2],[10.6,1.8],[13.4,1.8],[14.4,6.2]]),ne(7.6,5.4,8.8,2.6,1),ne(7.8,7.4,8.4,15,2.6),Se(ne(7.8,11.8,3.4,1.5,0)),Se(ne(7.8,15.4,3.4,1.5,0)))},{key:"prayer-room",label:"Prayer room",group:"facilities",path:[gn(ua),"M3 21.5h18"].join(" "),solid:ie(Yt(ua),ne(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:ie(Pe([[2.6,8.4],[7.2,8.4],[13,3.6],[13,20.4],[7.2,15.6],[2.6,15.6]]),ye([15.4,9.2],[20.8,14.8],2.8),ye([20.8,9.2],[15.4,14.8],2.8))},{key:"wifi",label:"Wi-Fi",group:"facilities",path:[Jn(12,19,11.5,218,322),Jn(12,19,7.5,218,322),Jn(12,19,3.5,218,322),"M12 19h.01"].join(" "),solid:ie(qe(12,19.2,11,218,322,2.8),qe(12,19.2,6.9,218,322,2.8),Re(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:ie(ne(6,4,12,8.5,2.2),ne(2.4,9.6,4.6,9,2.2),ne(17,9.6,4.6,9,2.2),ne(6,13.2,12,5.4,.6),ye([5,18],[5,20.6],2.4),ye([19,18],[19,20.6],2.4))},{key:"accessible-entrance",label:"Accessible entrance",group:"accessibility",path:[gn(Wt(vt,.3,5,.62)),"M12.5 3.5H20a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1h-7.5"].join(" "),solid:ie(Yt(Wt(vt,.3,5,.62),2.2),Ie([[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:[eo(Dm)+"Z","M6 10.8 3.5 7.5","M10.5 10.5V6h4.5l1 2.5"].join(" "),solid:ie(Pe(Gm),ye([6.2,11],[3.2,7.2],2.4),Ie([[10.5,11],[10.5,5.6],[15.2,5.6],[16.2,8.2]],2.2))}],z0=new Map(lr.map(e=>[e.key,e]));var ma=lr;var Hm=new Map(ma.map(e=>[e.key,e]));function ur(e){return e?Hm.get(e):void 0}var Q0=ma.map(e=>e.key);function xn(e){if(e.length<3)return e.map(n=>({...n}));let t=Gt(e);return t.length>=3?t:[...e].sort((n,o)=>n.x-o.x||n.y-o.y).map(n=>({...n}))}var jm=.8,Vm=.6,Um=2;function bt(e,t){if(!t.length)return null;let n=[],o=0;for(let s of e.objects){if(s.type!=="shape"||s.role!=="wall")continue;let a=ce(s)??[],c=ha(a)/2;!(c>0)||Wm(a)/c*w>Um||(n.push(...a),o+=c)}if(n.length<3)return null;let r=xn(n);if(r.length<3||o<ha(r)*Vm)return null;let i=0;for(let s of t)Ym(s,r)&&(i+=1);return i>=t.length*jm?r:null}var to=6,Xm=5,Km=8;function da(e){return Math.max(Km,(Number.isFinite(e)?e:0)+Xm)}function $t(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r++){let i=e[r],s=e[(r+1)%e.length],a=i.x*s.y-s.x*i.y;t+=a,n+=(i.x+s.x)*a,o+=(i.y+s.y)*a}if(Math.abs(t)<1e-9){let r=0,i=0;for(let s of e)r+=s.x,i+=s.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 Wm(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 ha(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 Ym(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function pa(e,t,n,o=[],r){if(t<1)return null;let i=1/0,s=-1/0,a=1/0,c=-1/0,l=-1/0,u=(S,_)=>{S<i&&(i=S),S>s&&(s=S),_<a&&(a=_),_>c&&(c=_)};for(let S=0;S<t;S++)u(e[S*3],e[S*3+2]),e[S*3+1]>l&&(l=e[S*3+1]);for(let[S,_]of o)u(S,_);if(!Number.isFinite(i)||!Number.isFinite(l))return null;let f=(i+s)/2,m=(a+c)/2,h=Math.max(4,(s-i)/2),d=Math.max(4,(c-a)/2),p=1,b=(S,_)=>{let I=Math.hypot((S-f)/h,(_-m)/d);I>p&&(p=I)};for(let S=0;S<t;S++)b(e[S*3],e[S*3+2]);for(let[S,_]of o)b(S,_);let M=Math.min(9,Math.max(5,2*Math.max(h,d)*.1)),g=Math.max(n+8,l+M);return{centre:[f,m],radii:[h*p+6,d*p+6],floorY:n,ceilingY:r===void 0?g:Math.max(r,l+5)}}function zm(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 Zm(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 s=e[0],a=-1;for(let h of e){let d=Math.hypot(h.x-n,h.y-o);d>a&&(a=d,s=h)}let c=s.x-n,l=s.y-o,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let f=[...e].sort((h,d)=>(h.x-n)*c+(h.y-o)*l-((d.x-n)*c+(d.y-o)*l)),m=0;for(let h of f){let d=Math.hypot(h.x-n,h.y-o);d>m&&(m=d)}return{pts:f,cx:n,cy:o,radius:m,depth:r}}function ba(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 s=o[i],a=o[i+1],c=a.x-s.x,l=a.y-s.y,u=c*c+l*l,f=u>1e-12?((t-s.x)*c+(n-s.y)*l)/u:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(t-(s.x+f*c),n-(s.y+f*l));m<r&&(r=m)}return r}var no=8;function $m(e,t,n){let o=new Array(no).fill(1/0),r=new Array(no).fill(-1);for(let u=0;u<e.length;u++){let f=e[u],m=Math.hypot(t-f.cx,n-f.cy)-f.radius;for(let h=0;h<no;h++)if(m<o[h]){for(let d=no-1;d>h;d--)o[d]=o[d-1],r[d]=r[d-1];o[h]=m,r[h]=u;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let u of r){if(u<0)continue;let f=ba(e[u],t,n);for(let m=0;m<3;m++)if(f<i[m]){for(let h=2;h>m;h--)i[h]=i[h-1],s[h]=s[h-1];i[m]=f,s[m]=u;break}}if(s[0]<0)return 0;if(i[0]<1e-6)return e[s[0]].depth;let a=i[0]*2.2,c=0,l=0;for(let u=0;u<3;u++){let f=s[u];if(f<0||i[u]>a)continue;let m=1/(i[u]*i[u]);c+=m*e[f].depth,l+=m}return l>0?c/l:e[s[0]].depth}function Qm(e){let t=(o,r)=>$m(e,o,r),n=(o,r)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let c=e[a];if(Math.hypot(o-c.cx,r-c.cy)-c.radius>=i)continue;let l=ba(c,o,r);l<i&&(i=l,s=a)}return s};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,s=(t(o,r+.5)-t(o,r-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function ya(e,t){let n=[];for(let o of e){let r=Zm(o.points,t);r&&n.push(r)}return n.length<2?zm(t):(n.sort((o,r)=>o.depth-r.depth),Qm(n))}var yt=.06,qm=.05,xa=.05,ga=.15,fr=25;function Ma(e,t,n){let o=new Map,r=new Array(t.length).fill(null),i=new Float64Array(t.length),s=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0),c=new Map,l=[],u=new Set;for(let m=0;m<e.length;m+=1){let h=e[m];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=ot(d.outline,Ye);c.set(d.id,{section:d,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:d.id,floorIndex:m,box:lt(p),section:d,unit:h,outline:p})}}let f=new Map;for(let m of l){let h=f.get(m.floorIndex);h?h.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let h=t[m],d=n?f.get(n[m])??[]:l,p=h.sectionId?d.find(M=>M.id===h.sectionId)??d.find(M=>M.section.logicalSectionId===h.sectionId&&Ee({x:h.x,y:h.y},M.outline,M.section.holes)):void 0,b=p?[p]:d;for(let M of b){if(n&&M.floorIndex!==n[m]||!p&&(h.x<M.box.minX||h.x>M.box.maxX||h.y<M.box.minY||h.y>M.box.maxY||!Ee({x:h.x,y:h.y},M.outline,M.section.holes)))continue;r[m]=M.id;let g=c.get(M.id);g.hasSeats=!0;let S=h.focalPoint??M.unit.focal,_=Math.hypot(h.x-S.x,h.y-S.y);_<g.frontU&&(g.frontU=_),g.seatIndices.push(m);let I=h.rowId||`__seat-${m}`,y=g.rows.get(I);y?y.push({x:h.x,y:h.y}):g.rows.set(I,[{x:h.x,y:h.y}]);break}}for(let[m,h]of c){let d=mt(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,b=d.rake>0?Math.tan(d.rake*Math.PI/180):0,M=d.rake<=.01&&d.height<=p+.001,g=h.section.surfaceKind,S=g==="flat"?!0:g==="rakedRows"&&d.rake>.01?!1:M,_=h.hasSeats?Cn(m,t,h.seatIndices,h.unit.focal):{sectionId:m,rows:[],blockCount:0},y=_.rows.length<2?ya([...h.rows.values()].map(L=>({points:L})),h.unit.focal):null,x=1/0;if(y){if(h.hasSeats)for(let L of h.rows.values())for(let B of L){let D=y.depthAt(B.x,B.y);D<x&&(x=D)}if(!h.hasSeats||!Number.isFinite(x)){x=1/0;for(let L of h.section.outline){let B=y.depthAt(L.x,L.y);B<x&&(x=B)}}}let P=p+qm,R=Math.max(P,d.height),v=L=>{let B=Math.max(0,L-x)*ee,D=Math.min(B*b,fr);return Math.max(P,d.height+D)},T=L=>{let B=Math.max(0,L)*ee,D=Math.min(B*b,fr);return Math.max(P,d.height+D)},k=S?[]:_.rows.map(L=>({pts:L.pts,y:T(L.blockDepth),depth:L.blockDepth,blockId:L.blockId,...u.has(L.id)?{patch:ls(L.pts,Ye)}:{}})),C=k.length?k[0].y:R,E=k.map(L=>{let B=L.patch&&L.patch.length>=3?L.patch:L.pts,D=0,j=0;for(let U of B)D+=U.x,j+=U.y;let G=B.length||1;D/=G,j/=G;let V=0;for(let U of B){let z=Math.hypot(U.x-D,U.y-j);z>V&&(V=z)}return{cx:D,cy:j,rad:V}}),A=S?()=>R:k.length>=2?(L,B)=>{let D=1/0,j=C;for(let G=0;G<k.length;G++){let V=E[G];if(Math.hypot(L-V.cx,B-V.cy)-V.rad>=D)continue;let U=k[G].patch,z=U&&U.length>=3?Ce(U,L,B)?0:Tt(U,L,B):Tt(k[G].pts,L,B);z<D&&(D=z,j=k[G].y)}return j}:(L,B)=>y?v(y.depthAt(L,B)):R,O=[0,1,0],F=k.length>=2||S?()=>O:(L,B)=>{if(!y)return O;let D=y.depthAt(L,B);if(D<=x)return O;let j=(D-x)*ee;if(j*b>=fr||d.height+j*b<=P)return O;let[G,V]=y.gradientAt(L,B);if(G===0&&V===0)return O;let U=1/Math.hypot(b,1);return[-G*b*U,U,-V*b*U]};if(!S)for(let L of _.rows){let B=T(L.blockDepth);for(let D of L.seatIndices)s[D]=B}for(let L of _.rows){let B=[];for(let U=1;U<L.pts.length;U++){let z=Math.hypot(L.pts[U].x-L.pts[U-1].x,L.pts[U].y-L.pts[U-1].y);z>1e-6&&B.push(z)}B.sort((U,z)=>U-z);let D=B.length?B[Math.floor(B.length/2)]:1/0,j=1/0,G=L.pts[Math.floor(L.pts.length/2)];if(G)for(let U of _.rows){if(U===L||U.blockId!==L.blockId)continue;let z=Tt(U.pts,G.x,G.y);z>1e-6&&z<j&&(j=z)}let V=Math.min(D,Math.max(j,D*.5));if(Number.isFinite(V)&&V>0)for(let U of L.seatIndices)a[U]=V}o.set(m,{sectionId:m,deckAt:A,normalAt:F,flat:S,bottomY:p,rowLevels:k,landingY:C})}for(let m=0;m<t.length;m++){let h=r[m],d=t[m];if(h){let M=s[m];i[m]=(M??o.get(h).deckAt(d.x,d.y))+ga;continue}let p=d.eyeHeightM,b=Number.isFinite(p)?Math.max(0,p-tt):0;i[m]=d.kind==="booth"?b+yt+ga:b}return{bySection:o,seatOwner:r,seatDeckY:m=>i[m],seatPitchU:m=>a[m]}}function Qt(e,t,n){if(e.length!==4||n<=t)return null;let o=Ue(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*w,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*w;if(r<1e-6||i<1e-6)return null;let s=Math.min(.22/r,.16),a=Math.min(.28,(n-t)*.13),c=Math.min(.065/i,.2);return{quad:o,side:s,face:c,opening:Te(o,s,1-s),openingTop:n-a}}function mr(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=Ue(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*w;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),s=i/r,a=Te(o,s,1-s);return{quad:o,side:s,trim:i,inner:a,panel:fn(a,.15,.85),bottom:t+i,top:n-i}}function Sa(e,t,n,o){let r=mr(e,t,n);if(!r)return;let{panel:i}=r,s=(g,S)=>({x:(g.x+S.x)/2,y:(g.y+S.y)/2}),a=s(i[0],i[1]),c=s(i[3],i[2]),l=Math.hypot(a.x-o.x,a.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[u,f]=l?[i[0],i[1]]:[i[3],i[2]],m=l?{x:a.x-c.x,y:a.y-c.y}:{x:c.x-a.x,y:c.y-a.y},h=Math.hypot(m.x,m.y);if(h<1e-6)return;-(f.y-u.y)*m.x+(f.x-u.x)*m.y<0&&([u,f]=[f,u]);let d=Math.min(.006,h*w*.05),p=m.x/h*d,b=m.y/h*d,M=(g,S)=>[g.x*w+p,S,g.y*w+b];return[M(u,r.bottom),M(f,r.bottom),M(u,r.top),M(f,r.top)]}var Ia=et(require("polygon-clipping"),1);var Ra=et(require("polygon-clipping"),1);function ft(e,t,n,o,r,i,s,a={}){let c=lt(t),l=a.ao??W,u=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let b=ce(p);if(!b||b.length!==4||!Dt(c,lt(b)))return[];let M=a.portalBase??n,g=Qt(b,M,M+$e(p).heightM);if(!g)return[];let S=Math.min(o,g.openingTop);return S<=n?[]:[{poly:g.opening,height:S}]});if(!u.length)return!1;let f=p=>p.map(b=>[b.x,b.y]),m=[f(t),...(a.holes??[]).map(f)],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],M=h[p];if(M-b<1e-6)continue;let g=u.filter(_=>_.height>b+1e-6).map(_=>[f(_.poly)]),S=g.length?Ra.default.difference(m,...g):[m];d.push({low:b,high:M,polys:S})}}catch{return!1}for(let p of d)for(let b of p.polys){let[M,...g]=b.map(_=>_.map(([I,y])=>({x:I,y}))),S=_=>l.wallBottom+(l.top-l.wallBottom)*(_-n)/(o-n);$(e,M,g,()=>p.high,p.low,i,s,{...l,top:S(p.high),wallBottom:S(p.low)})}return!0}var hr={depthM:1.6,thicknessM:.35,minWallM:6};function oo(e,t,n,o,r,i,s,a,c){let l=o-n;if(l<=0)return;let u=a&&(c??l)>=hr.minWallM?Jm(t,a):null,f=u?o-hr.thicknessM:o,m=f-n,h=m<1.5?[[n,f,1]]:u?[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),f,1]]:[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),f-.1,1],[f-.1,f,1.1]],d=p=>W.wallBottom+(W.top-W.wallBottom)*(p-n)/l;for(let[p,b,M]of h){let g={...W,top:d(b),wallBottom:d(p)},S=Y(i,M),_=Y(s,M);ft(e,t,p,b,r,S,_,{portalBase:n,ao:g})||$(e,t,void 0,()=>b,p,S,_,g)}for(let[p,...b]of u??[])$(e,p,b.length?b:void 0,()=>o,f,Y(i,1.12),Y(s,.78),W)}function Jm(e,t){let n=hr.depthM/w,o=e.map(s=>{let a=t.x-s.x,c=t.y-s.y,l=Math.hypot(a,c)||1;return{x:s.x+a/l*n,y:s.y+c/l*n}}),r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=[[r(e)],[r(o)]];for(let s=0;s<e.length;s++){let a=(s+1)%e.length;i.push([r([e[s],e[a],o[a],o[s]])])}try{let[s,...a]=i,c=Ia.default.union(s,...a);return c.length?c.map(l=>l.map(u=>u.slice(0,-1).map(([f,m])=>({x:f,y:m})))):null}catch{return null}}function Pa(e){return e.route?.stepFree===!0&&(e.kind==="line"||e.kind==="polyline")}function _a(e){let t=Number.isFinite(e)&&e>0?e:4;return[Math.max(6,t*2.6),Math.max(4,t*1.7)]}function wa(e,t,n){let o=[];if(e.length<2||!(t>0)||!(n>=0))return o;let r=!0,i=t;for(let s=0;s<e.length-1;s+=1){let a=e[s],c=e[s+1],l=Math.hypot(c.x-a.x,c.y-a.y);if(l<1e-9)continue;let u=(c.x-a.x)/l,f=(c.y-a.y)/l,m=0;for(;m<l-1e-9;){let h=Math.min(i,l-m);r&&o.push([{x:a.x+u*m,y:a.y+f*m},{x:a.x+u*(m+h),y:a.y+f*(m+h)}]),m+=h,i-=h,i<=1e-9&&(r=!r,i=r?t:n)}}return o}function Mn(e,t,n){let o=me(t.stroke?.color),r=t.stroke?.width??0;if(!o||!Number.isFinite(r)||r<=0)return;let i=t.kind==="line"||t.kind==="polyline",s=i?jt(t.points??[],t.rotation):ce(t);if(!s||s.length<2)return;let a=r*.5,c=Pa(t)?wa(s,..._a(r)):Array.from({length:i?s.length-1:s.length},(l,u)=>[s[u],s[(u+1)%s.length]]);for(let[l,u]of c){let f=Math.hypot(u.x-l.x,u.y-l.y);if(f<1e-6)continue;let m=-(u.y-l.y)/f*a,h=(u.x-l.x)/f*a,d=[(l.x+m)*w,n,(l.y+h)*w],p=[(u.x+m)*w,n,(u.y+h)*w],b=[(u.x-m)*w,n,(u.y-h)*w],M=[(l.x-m)*w,n,(l.y-h)*w];e.tri(d,p,b,[0,1,0],o),e.tri(d,b,M,[0,1,0],o)}}function Ea(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var qt=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function ro(e,t,n,o){let[r,i,s,a]=t?e:[e[3],e[2],e[1],e[0]];return[qt(r,a,n),qt(i,s,n),qt(i,s,o),qt(r,a,o)]}function Aa(e,t,n,o,r,i,s,a,c=!1){if(n.length!==4||r-o<.4)return!1;let l=P=>c?Math.min(P,r):P,u=Ue(n),f=Math.hypot(u[3].x-u[0].x,u[3].y-u[0].y)*w;if(f<.4)return!1;let m=qt(u[0],u[1],.5),h=qt(u[3],u[2],.5),d=Math.hypot(m.x-a.x,m.y-a.y)<=Math.hypot(h.x-a.x,h.y-a.y),p=fe(s,[.92,.9,.86],.35),b=Y(i,.72),M=r-o;if(t==="restroom"){let P=Math.min(.18,M*.08);return he(e,u,r-P,o,s,i),he(e,u,r,r-P,p,p),!0}let g=o+Math.min(1.1,M),S=t==="coat"?1:Math.min(.5,.75/f),_=ro(u,d,0,S);if(he(e,_,g-.05,o,b,i),he(e,_,g,g-.05,p,p),t==="coat"||f<1.2)return!0;if(t==="bar"){let P=ro(u,d,Math.max(S+.2,1-.45/f),1),R=l(o+Math.max(Math.min(2.2,M*2),g-o+.6));return he(e,P,R,o,s,b),!0}let I=ro(u,d,Math.max(S+.25,.55),1),y=l(o+Math.max(2.6,g-o+1.4));if(y-.14<=g)return!0;he(e,I,y-.14,o,s,i),he(e,u,y,y-.14,p,b);let x=Math.min(.08,.1/Math.max(.1,Math.hypot(u[1].x-u[0].x,u[1].y-u[0].y)*w));for(let[P,R]of[[0,x],[1-x,1]])he(e,ro(Te(u,P,R),d,0,Math.min(.08,.1/f)),y-.14,g,b,b);return!0}var ao=[.19,.4,.15],eh=.012,lo=2.4,th=1,nh=.75,oh=.15;function Je(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,s=Math.cos(i),a=Math.sin(i),c=n/2,l=o/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,f])=>({x:t.x+u*s-f*a,y:t.y+u*a+f*s}))}function Ta(e,t,n,o,r,i,s=!1){let a=Je(t);if(a){if(s){let c=Et(o,r.boothTop),l=nt([...a]);$(e,ot(l,rh/w),[l.slice().reverse()],()=>n+.03,n,c,Y(c,.8),W);return}if(!(!t.points&&i&&sh(e,a,n,o,i))){if(!t.points&&i&&a.length===4){ih(e,a,n,o,i);return}$(e,a,void 0,()=>n+lo,n,Et(o,r.boothTop),r.boothWall,W)}}}var dr=1.1,Ca=[.9,.9,.88],rh=.1,io=[.87,.87,.85],va=.08;function Ba(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]),s=(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,f)=>{let m=s(i[0],i[1],c),h=s(i[0],i[1],l),d=s(i[3],i[2],c),p=s(i[3],i[2],l);return[s(m,d,u),s(h,p,u),s(h,p,f),s(m,d,f)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*w,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*w}}function ih(e,t,n,o,r){let{q:i,part:s}=Ba(t,r),a=o??[.35,.42,.55],c=fe(a,[.78,.78,.77],.62),l=fe(a,[.95,.95,.94],.45);he(e,i,n+yt,n,c,Y(c,.8)),he(e,s(.05,.95,.72,.98),n+dr-.05,n+yt,l,Y(l,.8)),he(e,s(.03,.97,.7,1),n+dr,n+dr-.05,Ca,Y(Ca,.9))}function sh(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:s,depthM:a,widthM:c}=Ba(t,r);if(a<1||c<1)return!1;let l=o??[.35,.42,.55],u=fe(l,[.78,.78,.77],.62),f=n+lo,m=va/c,h=va/a;he(e,i,n+yt,n,u,Y(u,.8)),he(e,s(0,1,1-h,1),f,n+yt,io,Y(io,.9));for(let[b,M]of[[0,m],[1-m,1]])he(e,s(b,M,0,1-h),f,n+yt,io,Y(io,.9));he(e,s(m,1-m,0,Math.min(.5,.06/a)),f,f-.3,l,Y(l,.85));let d=Math.min(.4,.6/c),p=Math.min(.12,.3/a);return he(e,s(.5-d,.5+d,.72-p,.72+p),n+th,n+yt,fe(l,[.95,.95,.94],.7),Y(l,.75)),!0}function uo(e){if(e.shape==="round"){let u=e.radius;return u?Fn(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,s=Math.cos(i),a=Math.sin(i),c=t/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,f])=>({x:r.x+u*s-f*a,y:r.y+u*a+f*s}))}function Na(e,t,n,o,r,i=!0){let s=uo(t);if(!s)return;let a=s.reduce((d,p)=>d+p.x,0)/s.length,c=s.reduce((d,p)=>d+p.y,0)/s.length,l=d=>s.map(p=>({x:a+(p.x-a)*d,y:c+(p.y-c)*d})),u=wt(r)?1:lh,f=i&&o?Et(o,r.tableTop):Y(ah,u),m=Y(ch,u),h=n+nh;$(e,s,void 0,()=>h,n+uh,f,Y(f,.86),W),$(e,l(.12),void 0,()=>h+.12,h,m,Y(m,.8),W)}var ah=[.93,.92,.89],ch=[.78,.66,.42],lh=.62,uh=.25,Sn={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function fh(e,t,n){let o=e.reduce((M,g)=>M+g.x,0)/4,r=e.reduce((M,g)=>M+g.y,0)/4,i=e[3].x-e[0].x,s=e[3].y-e[0].y,a=Math.hypot(i,s)||1;i/=a,s/=a,i*(t.x-o)+s*(t.y-r)<0&&(i=-i,s=-s);let c=-s,l=i,u=Sn.armM/w,f=Sn.widthM/w,m=a/2+Sn.insideM/w,h=n?-1:1,d=o+i*(m+(n?0:u)),p=r+s*(m+(n?0:u)),b=(M,g)=>({x:d+i*M*h+c*g,y:p+s*M*h+l*g});return[b(0,0),b(-u,u),b(-u-f,u),b(-f,0),b(-u-f,-u),b(-u,-u)]}function mh(e,t,n,o,r){let i=[.94,.95,.96];$(e,fh(t,o,r),void 0,()=>n+Sn.high,n+Sn.low,i,i,W)}function co(e,t){let n=me(e);return n?{top:Y(rt(n,.12),.95),wall:Y(rt(n,.12),.85)}:{top:t.tierTop,wall:t.tierWall}}function Fa(e,t,n,o,r,i,s,a,c=[]){let l=ce(t),u=Ss(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!l){Mn(e,t,n+o+eh);return}let m=a?a.kind==="stage":t.role==="stage",h=a?a.kind==="screen":t.role==="screen",d=a?{kind:m?"stage":"solid",heightM:a.topY-a.baseY}:$e(t),p=a?.baseY??n,b=a?.topY??n+o,M=null;if(m&&s){let C=1/0,E=-1/0,A=1/0,O=-1/0;for(let F of l)F.x<C&&(C=F.x),F.x>E&&(E=F.x),F.y<A&&(A=F.y),F.y>O&&(O=F.y);M={cx:(C+E)/2*w,cz:(A+O)/2*w,y:b,halfX:Math.max((E-C)/2*w,.5),halfZ:Math.max((O-A)/2*w,.5)},s.push(M)}let g=me(t.fill),S=t.role==="wall"||t.role==="entrance"||t.role==="exit",_=S?co(t.fill,r).top:m&&g?fe(r.stageTop,Y(rt(g,.18),.9),.9):!t.role&&g?g:Et(g,m?r.stageTop:r.decorTop),I=h?g:null,y=S?co(t.fill,r).wall:m?g?fe(r.stageWall,Y(g,.58),.82):r.stageWall:h?I?fe(Y(I,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Et(me(t.fill),r.decorWall),x=m&&wt(r)?Ft(!0):null,P=x?La(_,x.stageTop):_,R=x?La(y,x.stageWall):y;if(M&&(M.top=P),t.role==="wall"&&!a){oo(e,l,p,b,c,P,R,i),Mn(e,t,b+.012);return}if(h&&l.length===4&&b-p>.2){let C=mr(l,p,b);if(!C)return;let{quad:E,side:A,trim:O,inner:F,panel:L}=C,B=[.12,.15,.18];for(let[D,j]of[[0,A],[1-A,1]])he(e,Te(E,D,j),b,p,B,B);he(e,F,p+O,p,B,B),he(e,F,b,b-O,B,B),he(e,L,b-O,p+O,R,R),Mn(e,t,b+.012);return}let v=g?Y(rt(g,.15),.82):R,T=g?Y(rt(g,.1),1.02):P;if(Ea(t.role)&&!a&&Aa(e,t.role,l,p,b,v,T,i,t.heightM!==void 0))return;if((t.role==="sound"||a?.kind==="sound_desk")&&l.length===4&&b-p>.3){let C=Ue(l),E=Math.hypot(C[1].x-C[0].x,C[1].y-C[0].y)*w,A=Math.min(.12,.09/Math.max(E,.001)),O=[.18,.21,.24],F=b-Math.min(.12,(b-p)*.15);for(let[L,B]of[[0,A],[1-A,1]])he(e,Te(C,L,B),F,p,O,O);he(e,C,b,F,P,O);return}if(t.role==="rail"&&l.length===4&&b>p){let C=Ue(l),E=Math.hypot(C[1].x-C[0].x,C[1].y-C[0].y)*w,A=Math.max(1,Math.min(128,Math.ceil(E/1.4))),O=Math.min(.08,.055/Math.max(.055,E)),F=[.58,.64,.66];for(let L=0;L<=A;L++){let B=L/A,D=Math.min(1-O,Math.max(0,B-O/2));he(e,Te(C,D,D+O),b,p,F,Y(F,.8))}for(let L of[.52,1]){let B=p+(b-p)*L;he(e,C,B,Math.max(p,B-.055),F,Y(F,.8))}return}if(t.role==="goal"&&l.length===4){Gs(e,Ue(l),i,p,b),e.setMaterial(0);return}if(d.kind==="portal"&&l.length===4){let C=Qt(l,p,b);if(!C)return;let{quad:E,side:A,face:O,openingTop:F}=C;for(let[L,B,D]of[[0,O,1],[O,1-O,.67],[1-O,1,1]]){let j=fn(E,L,B),G=Y(P,D),V=Y(R,D);for(let[U,z]of[[0,A],[1-A,1]])he(e,Te(j,U,z),F,p,G,V);he(e,j,b,F,G,V)}(t.role==="entrance"||t.role==="exit")&&mh(e,E,p,i,t.role==="exit");return}if(d.kind==="suite"&&l.length===4){let C=l.map((O,F)=>{let L=l[(F+1)%4],B=(O.x+L.x)/2,D=(O.y+L.y)/2;return Math.hypot(B-i.x,D-i.y)}),E=C.indexOf(Math.min(...C)),A=[0,1,2,3].map(O=>l[(E+O)%4]);he(e,Te(A,0,.08),b,p,P,R),he(e,Te(A,.92,1),b,p,P,R),he(e,fn(A,.88,1),b,p,P,R),he(e,A,b,Math.max(p,b-.18),P,R);return}if(m&&!t.stageKind?.startsWith("pitch-")&&b-p>.12){let C=b-Math.min(.06,(b-p)*.15);he(e,l,C,p,P,R,u),he(e,l,b,C,P,fe(P,R,.2),u)}else he(e,l,b,p,P,R,u);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&l.length===4){e.setMaterial(4);let C=Ue(l),E=fe(g??ao,ao,g?.45:0);for(let A=0;A<12;A++){let O=Te(C,A/12,(A+1)/12),F=Y(E,A%2?1.09:.91),L=O.map(B=>[B.x*w,b+.006,B.y*w]);e.tri(L[0],L[1],L[2],[0,1,0],F),e.tri(L[0],L[2],L[3],[0,1,0],F)}}t.stageKind&&t.stageKind!=="pitch-football"&&zs(e,l,t.stageKind,b,g,t),m&&Ze(t.stageKind)&&Ys(e,t,b),e.setMaterial(h?1:0),Mn(e,t,b+.012)}function fo(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,s=n+r/2,a=(e.rotation??0)*Math.PI/180,c=Math.cos(a),l=Math.sin(a),u=o/2,f=r/2;return[[-u,-f],[u,-f],[u,f],[-u,f]].map(([m,h])=>({x:i+m*c-h*l,y:s+m*l+h*c}))}function hh(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 me(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 s=[];for(let a of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=me(a[1].trim());c&&s.push(c)}return s.length?s.reduce((a,c,l)=>fe(a,c,1/(l+1)),s[0]):null}function Da(e,t,n,o){if(t.layer==="foreground")return;let r=fo(t);if(!r)return;let i=n+oh,s=Et(hh(t.href),o.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=fe(o.ground,s,a)),$(e,r,void 0,()=>i,n,s,fe(s,o.decorWall,.5),W)}function Ga(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=Xi(o,r.gaTop);$(e,t.points,t.holes,()=>n+ka,n,i,r.gaWall,W),bh(e,t.points,n+ka)}var ka=.15,so=[.72,.74,.76],pr=1.1,Oa=.12,br=.05,dh=.06,ph=2.4;function bh(e,t,n){let o=nt([...t]),r=We(o,Oa/w),i=We(o,(Oa+br)/w);if(r.length<3||i.length<3)return;for(let a of[n+pr,n+pr*.5])$(e,r,[i.slice().reverse()],()=>a,a-br,so,Y(so,.85),W);let s=dh/2/w;for(let a=0;a<r.length;a++){let c=r[a],l=r[(a+1)%r.length],u=Math.hypot(l.x-c.x,l.y-c.y)*w,f=Math.max(1,Math.round(u/ph));for(let m=0;m<f;m++){let h=m/f,d=c.x+(l.x-c.x)*h,p=c.y+(l.y-c.y)*h,b=[{x:d-s,y:p-s},{x:d+s,y:p-s},{x:d+s,y:p+s},{x:d-s,y:p+s}];$(e,b,void 0,()=>n+pr-br,n,so,Y(so,.8),W)}}}function La(e,t){return Dn(e)<t?_t(e,t):e}var yr=.6,Ha=3,yh=.25;function gh(e,t){if(Ce(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],s=t[o],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c||1,u=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/l));n=Math.min(n,Math.hypot(e.x-(i.x+u*a),e.y-(i.y+u*c)))}return n}function ja(e,t){let n=e.map(s=>({booth:s,ring:Je(s)})).filter(s=>!!s.ring&&s.ring.length===4&&!s.booth.points),o=n.map(({ring:s})=>({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))})),r=(Ha+yr)/w,i=new Map;return n.forEach(({booth:s,ring:a},c)=>{let l={x:a.reduce((h,d)=>h+d.x,0)/4,y:a.reduce((h,d)=>h+d.y,0)/4},u=[0,1,2,3].map(h=>{let d=a[h],p=a[(h+1)%4],b={x:(d.x+p.x)/2,y:(d.y+p.y)/2},M=b.x-l.x,g=b.y-l.y,S=Math.hypot(M,g)||1,_={x:b.x+M/S*yr/w,y:b.y+g/S*yr/w},I=Ha/w;return o.forEach((y,x)=>{x===c||_.x<y.minX-r||_.x>y.maxX+r||_.y<y.minY-r||_.y>y.maxY+r||(I=Math.min(I,gh(_,n[x].ring)))}),{open:I*w,toward:{x:b.x+M/S*10/w,y:b.y+g/S*10/w},focal:Math.hypot(b.x-t.x,b.y-t.y)}}),f=Math.max(...u.map(h=>h.open)),m=u.filter(h=>h.open>=f-yh).sort((h,d)=>h.focal-d.focal)[0];i.set(s.id,m.toward)}),i}var Va=et(require("polygon-clipping"),1);var xh=.45,Mh=1500,Sh=200;function Ua(e,t){if(e.role!=="stage"||Ze(e.stageKind))return e;let n=ce(e);if(!n||n.length<3||Math.abs(je(n))*w*w>Mh)return e;let o=t.filter(s=>Ce(n,s.x,s.y));if(!o.length||o.length>Sh)return e;let r=xh/w,i=o.map(s=>[[[s.x-r,s.y-r],[s.x+r,s.y-r],[s.x+r,s.y+r],[s.x-r,s.y+r],[s.x-r,s.y-r]]]);try{let s=Va.default.difference([[...n.map(l=>[l.x,l.y]),[n[0].x,n[0].y]]],...i),a=null,c=0;for(let l of s){let u=l[0].slice(0,-1).map(([m,h])=>({x:m,y:h})),f=Math.abs(je(u));f>c&&(c=f,a=u)}return!a||a.length<3?e:{...e,kind:"polygon",points:a,rotation:0}}catch{return e}}var Rh=Math.PI/180,be=96,Ih=6,Ph=60,_h=150,Xa=.2,wh=.35;function Eh(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Rh;return n<0?n+360:n}function mo(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function ho(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let s=0,a=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;s+=e[l],a++}r[i]=s/a}return r}function Ka(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let o=[],r=0,i=0,s=0;for(let m of n)for(let h of m.rows){for(let d of h.pts)r+=d.x,i+=d.y,s++;if(h.pts.length>=4){let d=Co(h.pts);d&&Number.isFinite(d.cx)&&Number.isFinite(d.cy)&&o.push({x:d.cx,y:d.cy})}}if(!s)return null;let a={x:r/s,y:i/s},c=a;if(o.length>=8){let m=mo(o.map(M=>M.x)),h=mo(o.map(M=>M.y)),d=0;for(let M of n)for(let g of M.rows)for(let S of g.pts){let _=Math.hypot(S.x-a.x,S.y-a.y);_>d&&(d=_)}let p=0,b=d*.2;for(let M of n)for(let g of M.rows)for(let S of g.pts)Math.hypot(S.x-m,S.y-h)<b&&p++;Math.hypot(m-a.x,h-a.y)<=d&&p/s<.01&&(c={x:m,y:h})}let l=[];for(let m of n){let h={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of m.rows)for(let p of d.pts){let b=Math.hypot(p.x-c.x,p.y-c.y),M=Math.min(be-1,Math.floor(Eh(c,p)/(360/be)));h.samples.push({r:b,bin:M,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((m,h)=>m.rMin+m.rMax-(h.rMin+h.rMax));let u=[];for(let m of l){let h=!1;for(let d of u){let p=Math.min(m.rMax,d.rMax)-Math.max(m.rMin,d.rMin),b=Math.min(m.rMax-m.rMin,d.rMax-d.rMin);if(b>1e-9&&p>=wh*b){d.members.push(m),d.rMin=Math.min(d.rMin,m.rMin),d.rMax=Math.max(d.rMax,m.rMax),h=!0;break}}h||u.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let f=[];for(let m of u){let h=new Array(be).fill(null);for(let C of m.members)for(let E of C.samples){let A=h[E.bin];A||(A={samples:[]},h[E.bin]=A),A.samples.push({r:E.r,levelM:E.levelM})}let d=h.map(C=>!!C);if(!d.filter(Boolean).length)continue;let b=[],M=[];for(let C of h){if(!C)continue;let E=1/0,A=-1/0;for(let O of C.samples)O.r<E&&(E=O.r),O.r>A&&(A=O.r);b.push(E),M.push(A)}let g=mo(b),S=mo(M);if(!(g>=Xa*S)||!(S>0))continue;let _=[...b].sort((C,E)=>C-E);if(!(_[Math.floor(_.length*.1)]>=Xa*S))continue;let y=h.map(C=>{if(!C)return null;let E=[...C.samples].sort((G,V)=>G.r-V.r),A=E[0].r,O=E[E.length-1].r,F=E[0].levelM,L=-1/0;for(let G of E)G.levelM>L&&(L=G.levelM);let B=[];for(let G of E){let V={r:G.r,l:G.levelM};for(;B.length&&Math.abs(B[B.length-1].r-V.r)<1e-9;){if(B[B.length-1].l<=V.l){V.skip=!0;break}B.pop()}if(!V.skip){for(;B.length>=2;){let U=B[B.length-2],z=B[B.length-1];if((z.r-U.r)*(V.l-U.l)-(z.l-U.l)*(V.r-U.r)<=0)B.pop();else break}B.push(V)}}let D=B.map(G=>G.r),j=B.map(G=>G.l);return{inner:A,outer:O,front:F,top:L,profile:{rs:D,ls:j}}}),x=d.slice();for(let C=0;C<be;C++){if(x[C])continue;let E=-1,A=-1,O=0;for(let X=1;X<=be;X++){let Q=(C-X+be*2)%be;if(x[Q]){E=Q;break}}for(let X=1;X<=be;X++){let Q=(C+X)%be;if(x[Q]){A=Q,O=X;break}}if(E<0||A<0)continue;let F=0;for(let X=1;X<=be;X++){let Q=(C-X+be*2)%be;if(d[Q]){F=X;break}}if(F-1+O>Ih)continue;let B=y[E],D=y[A],j=F/(F+O),G=B.inner+(D.inner-B.inner)*j,V=B.outer+(D.outer-B.outer)*j,U=B.front+(D.front-B.front)*j,z=B.top+(D.top-B.top)*j;y[C]={inner:G,outer:V,front:U,top:z,profile:{rs:[G,V],ls:[U,z]}}}for(let C=0;C<be;C++)y[C]&&(x[C]=!0);let P=360/be,R=[],v=x.filter(Boolean).length,T=[];if(v===be)T.push({start:0,len:be});else{let C=0;for(;x[C];)C=(C+1)%be;let E=-1;for(let A=0;A<=be;A++){let O=(C+A)%be,F=A<be&&x[O];if(F&&E<0)E=O;else if(!F&&E>=0){let L=(O-E+be)%be||be;T.push({start:E,len:L}),E=-1}}}for(let C of T){if(C.len*P<Ph&&C.len<be)continue;let E=C.len===be,A=new Float64Array(C.len),O=new Float64Array(C.len),F=new Float64Array(C.len),L=new Float64Array(C.len),B=[];for(let X=0;X<C.len;X++){let Q=y[(C.start+X)%be];A[X]=Q.inner,O[X]=Q.outer,F[X]=Q.front,L[X]=Q.top,B.push(Q.profile??{rs:[Q.inner,Q.outer],ls:[Q.front,Q.top]})}let D=ho(A,E),j=ho(O,E),G=ho(F,E),V=ho(L,E);for(let X=0;X<C.len;X++)D[X]>A[X]&&(D[X]=A[X]),j[X]<O[X]&&(j[X]=O[X]),D[X]>j[X]-1e-6&&(D[X]=Math.max(0,j[X]-1e-6)),V[X]<G[X]&&(V[X]=G[X]);let U={startBin:C.start,binCount:C.len,closed:E,innerR:D,outerR:j,frontLevelM:G,topLevelM:V,profiles:B},z=(X,Q,q)=>{let oe=B[X],se=oe.rs,le=oe.ls;if(Q<=se[0]){le[0]>q&&(le[0]=q);return}if(Q>=se[se.length-1]){le[le.length-1]>q&&(le[le.length-1]=q);return}for(let de=0;de+1<se.length;de++)if(Q<=se[de+1]){le[de]>q&&(le[de]=q),le[de+1]>q&&(le[de+1]=q);return}};for(let X=0;X<C.len;X++){let Q=h[(C.start+X)%be];if(Q)for(let q of Q.samples){z(X,q.r,q.levelM);let oe=E?(X-1+C.len)%C.len:X-1,se=E?(X+1)%C.len:X+1;oe>=0&&z(oe,q.r,q.levelM),se<C.len&&z(se,q.r,q.levelM)}}R.push(U)}R.reduce((C,E)=>C+E.binCount*P,0)<_h||f.push({arcs:R,sectionIds:m.members.map(C=>C.sectionId),innerRMedian:g,outerRMedian:S})}if(!f.length)return null;if(f.sort((m,h)=>m.innerRMedian-h.innerRMedian),t){let m=f[f.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:be,binStepDeg:360/be,rings:f}}function Wa(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 s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),c=i-s,l=u=>{let f=t.profiles[u],m=f.rs,h=f.ls;if(o<=m[0])return h[0];if(o>=m[m.length-1])return h[h.length-1];for(let d=0;d+1<m.length;d++)if(o<=m[d+1]){let p=m[d+1]-m[d],b=p>1e-9?(o-m[d])/p:0;return h[d]+(h[d+1]-h[d])*b}return h[h.length-1]};return l(s)*(1-c)+l(a)*c}function gr(e,t,n,o,r,i,s,a,c,l=[],u=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let f=(p,b,M)=>{ft(e,p,b,M,l,s,a,{portalBase:u,ao:c})||$(e,p,void 0,()=>M,b,s,a,c)},m=(p,b,M)=>({x:p.x+(b.x-p.x)*M,y:p.y+(b.y-p.y)*M}),h=o?t.length:t.length-1,d=0;for(let p=0;p<h;p++){let b=(p+1)%t.length,M=Math.hypot(n[b].x-n[p].x,n[b].y-n[p].y)*ee;if(M<1e-5)continue;let g=(y,x)=>[m(t[p],t[b],y),m(t[p],t[b],x),m(n[p],n[b],x),m(n[p],n[b],y)];f(g(0,1),r,r+.95),f(g(0,1),i-.22,i);let S=Math.ceil((d-.32)/6)*6,_=!1,I=!1;for(let y=S;y<d+M;y+=6){let x=Math.max(0,(y-d)/M),P=Math.min(1,(y+.32-d)/M);P<=x||(f(g(x,P),r+.95,i-.22),_||=x<1e-6,I||=P>1-1e-6)}if(!o&&(p===0&&!_||p===h-1&&!I)){let y=Math.min(1,.32/M);f(g(p===0?0:1-y,p===0?y:1),r+.95,i-.22)}d+=M}}var gt=et(require("polygon-clipping"),1),In=.65;function xr(e,t){let n=1/0;for(let o of t)for(let r=0;r<o.length;r++){let i=o[r],s=o[(r+1)%o.length],a=s.x-i.x,c=s.y-i.y,l=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/(a*a+c*c||1)));n=Math.min(n,Math.hypot(e.x-i.x-l*a,e.y-i.y-l*c))}return n}var Mr=.01;function Ya(e,t,n,o,r,i,s,a=[],c=!0,l={bays:[],walls:[]}){if(o-r<=1e-5)return;let u=o-r>=3,f=u?o-In:r;e.setMaterial(5);let m=u?[]:a.filter(y=>{if(y.role!=="entrance"&&y.role!=="exit")return!1;let x=ce(y);if(!x)return!1;let P=Qt(x,r,r+$e(y).heightM);return P!==null&&P.openingTop<=o-.12});if((!m.length||!ft(e,t,f,o,m,i,s,{holes:n,portalBase:r}))&&$(e,t,n,()=>o,f,i,s,W,void 0,()=>[0,1,0]),!u){e.setMaterial(0);return}let h=c&&l.bays.length?Ah(t,n,We(t,Rn/w),l):null,d=6/w,p=.22/w,b=a.flatMap(y=>{if(y.role!=="entrance"&&y.role!=="exit")return[];let x=ce(y);return x?.length?[{minX:Math.min(...x.map(P=>P.x)),maxX:Math.max(...x.map(P=>P.x)),minY:Math.min(...x.map(P=>P.y)),maxY:Math.max(...x.map(P=>P.y))}]:[]}),M=Math.min(...t.map(y=>y.x)),g=Math.max(...t.map(y=>y.x)),S=Math.min(...t.map(y=>y.y)),_=Math.max(...t.map(y=>y.y));for(let y=M+d/2;y<g;y+=d)for(let x=S+d/2;x<_;x+=d){if(b.some(R=>y+p>=R.minX&&y-p<=R.maxX&&x+p>=R.minY&&x-p<=R.maxY))continue;let P=[{x:y-p,y:x-p},{x:y+p,y:x-p},{x:y+p,y:x+p},{x:y-p,y:x+p}];!Ee({x:y,y:x},t,n)||xr({x:y,y:x},[t,...n??[]])<p*Math.SQRT2+(c?Rn/w:0)||h&&xr({x:y,y:x},h.flat())<p*Math.SQRT2+Rn/w||$(e,P,void 0,()=>f,r,i,s,W)}if(h){for(let[y,...x]of h)$(e,y,x,()=>f,r-Mr,i,s,W);e.setMaterial(0);return}let I=We(t,Rn/w);if(c&&I.length>=3){let y=a.filter(R=>{if(R.role!=="entrance"&&R.role!=="exit")return!1;let v=ce(R);return!!v&&v.some(T=>!Ee(T,t,void 0)||xr(T,[t])<=Rn/w)}),x=[I.slice().reverse()],P=r-Mr;(!y.length||!ft(e,t,P,f,y,i,s,{holes:x,portalBase:r+Mr}))&&$(e,t,x,()=>f,P,i,s,W)}e.setMaterial(0)}var Sr=.25,Rn=Sr;function Ah(e,t,n,o){if(n.length<3)return null;let r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=s=>{let[a,...c]=s.map(l=>[r(l)]);return gt.default.union(a,...c)};try{let s=[r(e),...(t??[]).map(r)],a=gt.default.difference(s,[r(n)]),c=gt.default.intersection(s,i(o.bays));if(!c.length)return null;let l=gt.default.difference(gt.default.intersection(s,i(o.walls)),c);return gt.default.union(gt.default.difference(a,c),l).map(f=>f.map(m=>m.slice(0,-1).map(([h,d])=>({x:h,y:d}))))}catch{return null}}var Ch=.02,vh=.25,kh=1.2,Oh=.6,Lh=.45,Th=2.3,Bh=Math.PI/180,za=.005;function st(e,t,n){let o=n*Bh;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function Nh(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 s=0;for(let a of i)Math.hypot(a.x-t.centre.x,a.y-t.centre.y)>=o&&s++;if(s>=i.length/2)return!0}return!1}var Fh=24,Dh=.01;function Gh(e,t,n,o,r,i,s,a,c){let l=n.binCount,u=Fh,f=ee,m=i+.02,h=i-Dh,d=[];for(let E=0;E<l;E++){let A=(n.startBin+E+.5)*t.binStepDeg,O=new Float64Array(u+1);for(let F=0;F<=u;F++){let L=o[E]+(r[E]-o[E])*F/u;O[F]=Math.max(m,Wa(t,n,A,L)-vh)}d.push(O)}if(c){let E=0;for(let A=0;A+1<l;A++)for(let O=0;O<u;O++){let F=st(t.centre,o[A]+(r[A]-o[A])*O/u,(n.startBin+A+.5)*t.binStepDeg),L=st(t.centre,o[A+1]+(r[A+1]-o[A+1])*(O+1)/u,(n.startBin+A+1.5)*t.binStepDeg);E=Math.max(E,Math.hypot(L.x-F.x,L.y-F.y))}for(let A=0;A<l;A++){let O=(n.startBin+A+.5)*t.binStepDeg;for(let F=0;F<=u;F++){let L=st(t.centre,o[A]+(r[A]-o[A])*F/u,O),B=c(L.x,L.y,E*1.01);B!==null&&(d[A][F]=Math.min(d[A][F],Math.max(h+za,B-za)))}}}let p=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],b=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],M=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],g=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],S=(E,A)=>{let O=(n.startBin+E+.5)*t.binStepDeg,F=o[E]+(r[E]-o[E])*A/u,L=st(t.centre,F,O);return[L.x*f,d[E][A],L.y*f]};{let E=Math.tan(12*Math.PI/180);for(let A=0;A<6;A++){let O=!1;for(let L=0;L<l;L++)for(let B=u-1;B>=0;B--)d[L][B]>d[L][B+1]&&(d[L][B]=d[L][B+1],O=!0);let F=n.closed?l:l-1;for(let L=0;L<F;L++){let B=(L+1)%l;for(let D=0;D<=u;D++){let j=d[B][D]-d[L][D];if(Math.abs(j)>1)continue;let G=o[L]+(r[L]-o[L])*D/u,V=o[B]+(r[B]-o[B])*D/u,U=st(t.centre,G,(n.startBin+L+.5)*t.binStepDeg),z=st(t.centre,V,(n.startBin+B+.5)*t.binStepDeg),X=E*Math.hypot(z.x-U.x,z.y-U.y)*f;j>X?(d[B][D]=d[L][D]+X,O=!0):-j>X&&(d[L][D]=d[B][D]+X,O=!0)}}if(!O)break}}let _=1,I=(E,A)=>{for(let O=0;O<=u;O+=4)if(Math.abs(d[E][O]-d[A][O])>_)return!0;return Math.abs(d[E][u]-d[A][u])>_},y=Math.tan(38*Math.PI/180),x=E=>(r[E]-o[E])/u*f,P=(E,A)=>d[E][A+1]-d[E][A]>y*Math.max(1e-6,x(E)),R=(E,A)=>{let O=n.closed?(E-1+l)%l:Math.max(0,E-1),F=n.closed?(E+1)%l:Math.min(l-1,E+1);Math.abs(d[O][A]-d[E][A])>_&&(O=E),Math.abs(d[F][A]-d[E][A])>_&&(F=E);let L=Math.max(0,A-1),B=Math.min(u,A+1);L<A&&P(E,L)&&(L=A),B>A&&P(E,A)&&(B=A);let D=S(O,A),j=S(F,A),G=S(E,L),V=S(E,B),U=j[0]-D[0],z=j[1]-D[1],X=j[2]-D[2],Q=V[0]-G[0],q=V[1]-G[1],oe=V[2]-G[2],se=z*oe-X*q,le=X*Q-U*oe,de=U*q-z*Q,pe=Math.hypot(se,le,de);return pe>1e-12?(se/=pe,le/=pe,de/=pe,le<0&&(se=-se,le=-le,de=-de),[se,le,de]):[0,1,0]},v=(E,A,O=!1)=>{let F=O&&Math.min(E[1],A[1])-i>=3,L=[E[0],F?E[1]-In:h,E[2]],B=[A[0],F?A[1]-In:h,A[2]],D=A[0]-E[0],j=A[2]-E[2],G=Math.hypot(D,j);if(!(G>1e-12))return;let V=[j/G,0,-D/G];e.tri(E,A,B,V,M,M,g),e.tri(E,B,L,V,M,g,g)},T=.05*Ke,k=E=>r[E]-o[E]<T,C=n.closed?l:l-1;for(let E=0;E<C;E++){let A=(E+1)%l;if(k(E)||k(A))continue;if(I(E,A)){let j=(n.startBin+E+1)*t.binStepDeg,G=(q,oe)=>{let se=(o[E]+o[A])/2,le=(r[E]+r[A])/2,de=se+(le-se)*oe/u,pe=st(t.centre,de,j);return[pe.x*f,d[q][oe],pe.y*f]};for(let q=0;q<u;q++){let oe=S(E,q),se=S(E,q+1),le=G(E,q),de=G(E,q+1),pe=R(E,q),_e=R(E,q+1);e.triN(oe,le,de,pe,pe,_e,p),e.triN(oe,de,se,pe,_e,_e,p);let Oe=S(A,q),Ge=S(A,q+1),He=G(A,q),ve=G(A,q+1),H=R(A,q),N=R(A,q+1);e.triN(He,Oe,Ge,H,H,N,p),e.triN(He,Ge,ve,H,N,N,p);let K=G(E,q),Z=G(E,q+1),te=G(A,q+1),re=G(A,q),ue=Z[0]-K[0],ae=Z[2]-K[2],Le=Math.hypot(ue,ae);if(Le>1e-12){let J=[ae/Le,0,-ue/Le];e.tri(K,Z,te,J,M),e.tri(K,te,re,J,M)}}let V=S(E,0),U=S(A,0),z=S(A,u),X=S(E,u),Q=q=>[q[0],h,q[2]];Math.min(V[1],U[1])-i<3&&(e.tri(Q(V),Q(z),Q(U),[0,-1,0],b),e.tri(Q(V),Q(X),Q(z),[0,-1,0],b)),v(V,U,!0),v(X,z,!0);continue}for(let j=0;j<u;j++){let G=R(E,j),V=R(A,j),U=R(A,j+1),z=R(E,j+1);if(P(E,j)||P(A,j)){let se=(Z,te)=>{let re=(n.startBin+Z+.5)*t.binStepDeg,ue=o[Z]+(r[Z]-o[Z])*(j+.5)/u,ae=st(t.centre,ue,re);return[ae.x*f,te,ae.y*f]},le=S(E,j),de=S(A,j),pe=se(E,d[E][j]),_e=se(A,d[A][j]);e.triN(le,de,_e,G,V,V,p),e.triN(le,_e,pe,G,V,G,p);let Oe=S(A,j+1),Ge=S(E,j+1),He=se(E,d[E][j+1]),ve=se(A,d[A][j+1]);e.triN(He,ve,Oe,z,U,U,p),e.triN(He,Oe,Ge,z,U,z,p);let H=_e[0]-pe[0],N=_e[2]-pe[2],K=Math.hypot(H,N);if(K>1e-12){let Z=[-N/K,0,H/K];e.tri(pe,_e,ve,Z,M),e.tri(pe,ve,He,Z,M)}continue}let X=S(E,j),Q=S(A,j),q=S(A,j+1),oe=S(E,j+1);e.triN(X,Q,q,G,V,U,p),e.triN(X,q,oe,G,U,z,p)}let O=S(E,0),F=S(A,0),L=S(A,u),B=S(E,u),D=j=>[j[0],h,j[2]];Math.min(O[1],F[1])-i<3&&(e.tri(D(O),D(L),D(F),[0,-1,0],b),e.tri(D(O),D(B),D(L),[0,-1,0],b)),v(O,F,!0),v(B,L,!0)}if(!n.closed)for(let E of[0,l-1])for(let A=0;A<u;A++)v(S(E,A),S(E,A+1))}function Za(e,t,n){let{bottomY:o,colors:r,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let f of u.arcs){let m=new Float64Array(f.binCount),h=new Float64Array(f.binCount);for(let p=0;p<f.binCount;p++){let b=(f.startBin+p)%t.binCount,M=Math.max(0,f.innerR[p]-Ye);m[p]=Math.max(M,s[b]+.001),h[p]=Math.max(m[p]+.001,f.outerR[p]+Ye)}let d=0;for(let p=0;p<f.binCount;p++){let b=f.topLevelM[p]-o;b>d&&(d=b)}d>=kh&&Gh(e,t,f,m,h,o,r,i,n.standTopNear);for(let p=0;p<f.binCount;p++){let b=(f.startBin+p)%t.binCount;h[p]>s[b]&&(s[b]=h[p])}}if(n.deriveShell===!1||Nh(n.shapes,t))return;let a=t.rings[t.rings.length-1],c=Oh*Ke,l=Lh*Ke;for(let u of a.arcs){let f=[],m=[];for(let R=0;R<u.binCount;R++){let v=(u.startBin+R+.5)*t.binStepDeg,T=u.outerR[R]+Ye+c;f.push(st(t.centre,T,v)),m.push(st(t.centre,T+l,v))}let h=-1/0;for(let R=0;R<u.binCount;R++)u.topLevelM[R]>h&&(h=u.topLevelM[R]);let d=h+Th,p=u.closed?m:[...m,...f.slice().reverse()],b=u.closed?[f.slice().reverse()]:void 0,M=fe(r.shellWall,[.66,.71,.72],.62),g=(R,v,T,k,C)=>{let E=Math.abs(k-h)<1e-6?k-Ch:k;ft(e,R,T,E,n.shapes,r.shellTop,C,{holes:v,portalBase:o,ao:i})||$(e,R,v,()=>E,T,r.shellTop,C,i)},S=Math.max(1,Math.ceil((h-o)/4.5)),_=(h-o)/S,I=new Set,y=n.tierFrontLevels??t.rings.map(R=>{let v=R.arcs.flatMap(T=>Array.from(T.frontLevelM)).filter(Number.isFinite).sort((T,k)=>T-k);return v[Math.floor(v.length/2)]});for(let R of y)Number.isFinite(R)&&R-o>=3&&R<h&&I.add(Math.max(0,Math.min(S-1,Math.floor((R-o)/_))));let x=Math.min(...y.filter(R=>Number.isFinite(R)&&R-o>=3&&R<h));for(let R=0;R<S;R++)o+(R+1)*_<=x-In&&Number.isFinite(x)&&I.add(R);for(let R=0;R<S;R++){let v=o+(h-o)*R/S,T=o+(h-o)*(R+1)/S;I.has(R)&&T-v>=3.2?(g(p,b,v,v+.45,M),gr(e,f,m,u.closed,v+.45,T-.16,r.shellTop,M,i,n.shapes,o)):g(p,b,v,T-.16,M),g(p,b,T-.16,T,Y(M,.62))}gr(e,f,m,u.closed,h,d,r.shellTop,M,i,n.shapes,o);let P=8;for(let R=1;R<m.length;R++){if(P+=Math.hypot(m[R].x-m[R-1].x,m[R].y-m[R-1].y)*ee,P<8)continue;P=0;let v=m[R],T=m[R-1],k=v.x-T.x,C=v.y-T.y,E=Math.max(1,Math.hypot(k,C)),A=k/E*.16*Ke,O=C/E*.16*Ke,F=Math.max(1,Math.hypot(v.x-t.centre.x,v.y-t.centre.y)),L=(v.x-t.centre.x)/F*.24*Ke,B=(v.y-t.centre.y)/F*.24*Ke,D=[{x:v.x-A,y:v.y-O},{x:v.x+A,y:v.y+O},{x:v.x+A+L,y:v.y+O+B},{x:v.x-A+L,y:v.y-O+B}];g(D,void 0,o,h,Y(M,1.12))}}}var Hh=2.5,$a=.65,jh=2,Vh=.03;function Uh(e,t){let n=()=>{let o=t;for(;e.length>2;){let r=e[0],i=e[1],s=Math.hypot(i.x-r.x,i.y-r.y);if(s>o){e[0]={x:r.x+(i.x-r.x)/s*o,y:r.y+(i.y-r.y)/s*o};return}o-=s,e.shift()}};n(),e.reverse(),n(),e.reverse()}function Pr(e,t,n){let o=new Map;for(let i of e){let s=o.get(i.blockId);(!s||i.depth<s.depth)&&o.set(i.blockId,i)}let r=[];for(let[i,s]of o){if(s.y-n<Hh||s.pts.length<2)continue;let a=s.pts.map(u=>{let f=u.x-t.x,m=u.y-t.y,h=Math.max(1,Math.hypot(f,m));return{x:u.x-f/h*$a/w,y:u.y-m/h*$a/w}}),c=[],l=[a[0]];for(let u=1;u<a.length;u++){let f=a[u-1],m=a[u];Math.hypot(m.x-f.x,m.y-f.y)*w>jh?(l.length>=2&&c.push(l),l=[m]):l.push(m)}l.length>=2&&c.push(l);for(let u of c)Uh(u,Vh/w);c.length&&r.push({blockId:i,y:s.y,runs:c})}return r}var Qa=.1,Xh=1.1,Kh=.22,Rr=.95,Ir=.05,qa=1.8;function Ja(e,t,n,o){let r=[.72,.72,.69],i=[.48,.55,.57];for(let s of Pr(t,n,o)){let a=s.y;for(let c of s.runs){let l=qa;for(let u=1;u<c.length;u++){let f=c[u-1],m=c[u],h=m.x-f.x,d=m.y-f.y,p=Math.hypot(h,d);if(p<1e-5)continue;let b=M=>{let g=-d/p*M/w/2,S=h/p*M/w/2;return[{x:f.x+g,y:f.y+S},{x:m.x+g,y:m.y+S},{x:m.x-g,y:m.y-S},{x:f.x-g,y:f.y-S}]};if($(e,b(Kh),void 0,()=>a+Qa,a-Xh,r,r,W),$(e,b(Ir),void 0,()=>a+Rr,a+Rr-Ir,i,i,W),l+=p*w,l>=qa||u===c.length-1){l=0;let M=.028/w,g=[{x:f.x-M,y:f.y-M},{x:f.x+M,y:f.y-M},{x:f.x+M,y:f.y+M},{x:f.x-M,y:f.y+M}];$(e,g,void 0,()=>a+Rr-Ir,a+Qa,i,i,W)}}}}}var Wh=.9,Yh=1.5,zh=.3;function ec(e,t,n){let o=[],r=[],i=Wh/w,s=Yh/w,a=zh/w;for(let c of e)for(let l of c.runs){if(l.length<2)continue;let u=l.slice(),f=(b,M)=>{let g=u[b],S=u[M],_=Math.hypot(g.x-S.x,g.y-S.y)||1;u[b]={x:g.x+(g.x-S.x)/_*a,y:g.y+(g.y-S.y)/_*a}};f(0,1),f(u.length-1,u.length-2);let m=u.map((b,M)=>{let g=u[Math.max(0,M-1)],S=u[Math.min(u.length-1,M+1)],_=S.x-g.x,I=S.y-g.y,y=Math.hypot(_,I)||1,x=-I/y,P=_/y;return x*(b.x-t.x)+P*(b.y-t.y)<0&&(x=-x,P=-P),{nx:x,ny:P}}),h=u.map((b,M)=>({x:b.x-m[M].nx*s,y:b.y-m[M].ny*s})),d=u.map((b,M)=>({x:b.x+m[M].nx*i,y:b.y+m[M].ny*i})),p=u.map((b,M)=>({x:b.x+m[M].nx*(i+n/w),y:b.y+m[M].ny*(i+n/w)}));o.push([...h,...d.slice().reverse()]),r.push([...d,...p.reverse()])}return{bays:o,walls:r}}var _r=.88,po=.27,Zh=1.2,$h=.01,Qh=7,qh=.05,Jh=.25;function tc(e,t,n,o,r){let i=[.67,.71,.68],s=[i[0]*_r,i[1]*_r,i[2]*_r],a=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 f=l.pts[u],m=l.pts[u===0?1:u-1],h=f.x-m.x,d=f.y-m.y,p=Math.hypot(h,d);if(p<1e-5)continue;h/=p,d/=p;let b=1/0;for(let A=0;A<n.length;A++){let O=n[A],F=n[(A+1)%n.length],L=F.x-O.x,B=F.y-O.y,D=h*B-d*L;if(Math.abs(D)<1e-8)continue;let j=O.x-f.x,G=O.y-f.y,V=(j*B-G*L)/D,U=(j*d-G*h)/D;V>0&&U>=0&&U<=1&&(b=Math.min(b,V))}let M=.3/w,g=b-.04/w;if(!Number.isFinite(b)||b*w>2||g-M<.12/w)continue;let S=!!o&&a(c),_=r?.[c]?.pitch,I=S&&_&&Number.isFinite(_)?Math.min(Zh/w,Math.max(po/w,_-po/w-$h/w)):po/w,y=-d,x=h;o&&y*(o.x-f.x)+x*(o.y-f.y)<0&&(y=-y,x=-x);let P=po/w,R=[{x:f.x+h*M+y*P,y:f.y+d*M+x*P},{x:f.x+h*g+y*P,y:f.y+d*g+x*P},{x:f.x+h*g-y*I,y:f.y+d*g-x*I},{x:f.x+h*M-y*I,y:f.y+d*M-x*I}];if(!R.every(A=>Ce(n,A.x,A.y)))continue;let v=r?.[c]?.belowY,T=v==null?0:l.y-v,k=!!o&&T>.03&&T<=.65;if(k&&o){let A=(O,F)=>Math.hypot((O.x+F.x)/2-o.x,(O.y+F.y)/2-o.y);A(R[0],R[1])>A(R[3],R[2])&&(R=[R[3],R[2],R[1],R[0]])}let C=k?Math.ceil((T-1e-8)/.2):1,E=(A,O,F)=>({x:A.x+(O.x-A.x)*F,y:A.y+(O.y-A.y)*F});for(let A=0;A<C;A++){let O=A/C,F=(A+1)/C,L=[E(R[0],R[3],O),E(R[1],R[2],O),E(R[1],R[2],F),E(R[0],R[3],F)],B=l.y+.008-(k?T*(1-F):0);if($(e,L,void 0,()=>B,B-(k?T/C+.1:.16),i,s,W),!k)continue;let D=Math.hypot(L[3].x-L[0].x,L[3].y-L[0].y)*w;if(D<1e-4)continue;let j=Math.min(qh/D,Jh),G=E(L[0],L[3],j),V=E(L[1],L[2],j),U=X=>[X.x*w,B+.004,X.y*w],z=[.8,.67,.3];e.setMaterial(Qh),e.tri(U(L[0]),U(L[1]),U(V),[0,1,0],z),e.tri(U(L[0]),U(V),U(G),[0,1,0],z),e.setMaterial(0)}}}}var ed=.02,td=.012,nd=.01,od=.3,rd=.5;function id(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],s=e[r+1],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c,u=l>1e-12?((t-i.x)*a+(n-i.y)*c)/l:0;u=Math.max(0,Math.min(1,u)),o=Math.min(o,Math.hypot(t-(i.x+u*a),n-(i.y+u*c)))}return o}function sd(e,t,n,o){let r=1/0,i=Number.NaN;for(let s=0;s<e.length;s++){let a=t[s];if(Math.hypot(n-a.cx,o-a.cy)-a.rad>=r)continue;let c=id(e[s].pts,n,o);c<r&&(r=c,i=e[s].y)}return i}function nc(e,t,n,o,r,i,s){let a=o.filter(m=>m.pts.length>0);if(a.length<2||t.length<3)return;let c=a.map(m=>{let h=0,d=0;for(let b of m.pts)h+=b.x,d+=b.y;h/=m.pts.length,d/=m.pts.length;let p=0;for(let b of m.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(m=>[...m]),f=ed/w;for(let m of[l,...u])for(let h=0;h<m.length;h++){let d=m[h],p=m[(h+1)%m.length],b=p.x-d.x,M=p.y-d.y,g=Math.hypot(b,M);if(g*w<.05)continue;let S=(d.x+p.x)/2,_=(d.y+p.y)/2,I=M/g,y=-b/g;Ee({x:S+I*f,y:_+y*f},l,u)&&(I=-I,y=-y);let x=r.x-S,P=r.y-_,R=Math.hypot(x,P)||1;if((I*x+y*P)/R>rd)continue;let v=1/0;for(let L of[.2,.5,.8]){let B=sd(a,c,d.x+b*L-I*f*2,d.y+M*L-y*f*2);Number.isFinite(B)&&(v=Math.min(v,B))}if(!Number.isFinite(v)||v-i<od)continue;let T=i-nd,k=v-td,C={x:(d.x-I*f)*w,z:(d.y-y*f)*w},E={x:(p.x-I*f)*w,z:(p.y-y*f)*w},A=[I,0,y],O=Y(s,W.wallBottom),F=Y(s,W.top);e.tri([C.x,k,C.z],[E.x,k,E.z],[E.x,T,E.z],A,F,F,O),e.tri([C.x,k,C.z],[E.x,T,E.z],[C.x,T,C.z],A,F,O,O)}}function oc(e,t,n,o,r,i,s,a,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")),f=Ki(o,a.tierTop);if(!r)return;let m=g=>r.deckAt(g.x,g.y),h=gs(t,s),d=h[0]??t.outline;if(r.rowLevels.length>=2){let g=Xn(r.rowLevels),S=xs(hs(r.rowLevels,n.focal,g),h),_=ec(Pr(r.rowLevels,n.focal,l),n.focal,Sr);for(let y of S){let x=Math.max(l,y.topY-rc);for(let P of i.subtract(y.outline,x))Ya(e,P,y.holes,x,l,a.tierTop,a.tierWall,u,!c,_);e.setMaterial(5),nc(e,y.outline,y.holes,r.rowLevels,n.focal,x,a.tierWall),e.setMaterial(0)}S.length||$(e,d,t.holes,()=>r.landingY,l,f,a.tierWall,W);let I={tread:[f[0]*W.top,f[1]*W.top,f[2]*W.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let y of h.length?h:[d])ps(e,r.rowLevels,n.focal,r.landingY,I,y,g);Ja(e,r.rowLevels,n.focal,l),tc(e,r.rowLevels,t.outline,n.focal,g);return}let p=r.flat?1/0:xa,b=g=>r.normalAt(g.x,g.y),M=r.flat?r.landingY:void 0;for(let g of i.subtract(d,M))$(e,g,t.holes,m,l,f,a.tierWall,W,p,b)}function ad(e,t,n){let o=new Set;for(let s of e.objects)s.type==="section"&&o.add(s.id);let r=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!o.has(a))continue;let c=n.bySection.get(a);if(c&&c.rowLevels.length>=2)continue;let l=t[s];if(l.kind==="booth")continue;let u=r.get(a);u||(u=new Map,r.set(a,u));let f=l.rowId||`__seat-${s}`,m=u.get(f);m||(m={pts:[],levelM:0,n:0},u.set(f,m)),m.pts.push({x:l.x,y:l.y}),m.levelM+=n.seatDeckY(s),m.n++}let i=[];for(let s of e.objects){if(s.type!=="section")continue;let a=n.bySection.get(s.id);if(a&&a.rowLevels.length>=2){let l=a.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));l.length>=2&&i.push({sectionId:s.id,rows:l});continue}let c=r.get(s.id);c&&i.push({sectionId:s.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function cd(e,t){let n=1/0;for(let o=0;o<t.length;o++){let r=t[o],i=t[(o+1)%t.length],s=i.x-r.x,a=i.y-r.y,c=Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*a)/(s*s+a*a||1)));n=Math.min(n,Math.hypot(e.x-r.x-c*s,e.y-r.y-c*a))}return n}var rc=.02;function ld(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,s=-1/0,a=1/0,c=-1/0;for(let u of o.outline)u.x<i&&(i=u.x),u.x>s&&(s=u.x),u.y<a&&(a=u.y),u.y>c&&(c=u.y);let l=r.landingY;for(let u of r.rowLevels)l=Math.min(l,u.y-rc);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:l,minX:i,maxX:s,minY:a,maxY:c}]});return(o,r,i)=>{let s=null;for(let a of n){if(o<a.minX-i||o>a.maxX+i||r<a.minY-i||r>a.maxY+i)continue;let c={x:o,y:r};if(!Ee(c,a.outline,a.holes)&&cd(c,a.outline)>i)continue;let l=Math.min(a.surface.deckAt(o,r),a.floorTop);(s===null||l<s)&&(s=l)}return s}}var ud=3,fd=.4;function ic(e,t,n,o,r,i,s=!0){let a=ad(t,n,o);if(a.length<ud)return;let c=Ka(a,t.focal);if(!c)return;let l=Math.max(0,...c.rings.map(u=>u.arcs.reduce((f,m)=>f+m.binCount,0)))/c.binCount;e.setMaterial(5),Za(e,c,{bottomY:t.baseHeightM,tierFrontLevels:a.map(u=>Math.min(...u.rows.map(f=>f.levelM))),colors:{bandTop:Y(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??Y(r.tierWall,1.15),shellWall:i??r.tierWall},ao:W,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:s&&l>=fd,standTopNear:ld(t,o)}),e.setMaterial(0)}var sc=4;var md=[[/\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"]],hd=1.2,dd=12;function ac(e){if(e.heightM!==void 0)return!1;let t=ce(e);if(!t||t.length<3)return!1;let n=0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length];n+=Math.hypot(s.x-i.x,s.y-i.y)}return n*ee<dd*2?!1:2*Pn(t)/n*ee<=hd}function wr(e){if(!e)return null;for(let[t,n]of md)if(t.test(e))return n;return null}var lc="auto-rows-";function uc(e){return e.id.startsWith(lc)&&!e.label}var pd=1.15,bd=.09,fc=6,yd=34,gd=.35,xd=6,Md=.35,Sd=.75,Rd=12,Id=2.5,Pd=40,_d=[18,24],wd=[12,16],cc=14,Ed=.8,Ad=.6,Cd=5,vd=.3,mc=.4,hc=2,kd=400,Od=2.6,Ld=.8,Td=4,Bd=26,Nd=.7,Fd=.5,Dd=.985,Gd=1.5,Hd=2.2,jd=3,Vd=25,Ud=.985,Xd=2,Kd=6,Wd=3,Yd=.1,zd=1.5,Zd=1.6,$d=6e3,Qd=.6,qd="#c3c7cd",Er=300,Jd=240;function ep(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=Cr([...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<Jd)return null;let{h:s,s:a,l:c}=vi(Ci(e.fill));return s<70/360||s>170/360||a<.2||c<.08||c>.75||n.some(u=>u!==e&&u.type==="shape"&&ce(u)?.some(f=>Or(f,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var tp="Estimated from the drawing; confirm with the venue.",vr=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},Cr=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),Pn=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 np(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function kr(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 Or(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function Lr(e,t){let n=t[0],o=1/0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c,u=l>0?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/l)):0,f={x:i.x+a*u,y:i.y+c*u},m=Math.hypot(e.x-f.x,e.y-f.y);m<o&&(o=m,n=f)}return n}function dc(e,t){let n=0,o=0;for(let r of e.values()){if(r.length<3)continue;let i=r[0],s=r[r.length-1],a=s.x-i.x,c=s.y-i.y,l=Math.hypot(a,c);if(l<1e-6)continue;let u={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=Lr(u,t),m=f.x-u.x,h=f.y-u.y,d=Math.hypot(m,h);d<1e-6||(o+=Math.abs((-c*m+a*h)/(l*d))*r.length,n+=r.length)}return n?o/n:0}function op(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=ce(r);return p?{shape:r,centre:Cr(p),outline:p,inferred:!1}:null}if(!n.length)return null;let i=1/0,s=-1/0,a=1/0,c=-1/0;for(let p of n)i=Math.min(i,p.x),s=Math.max(s,p.x),a=Math.min(a,p.y),c=Math.max(c,p.y);let l=(s-i)*(c-a),u=[];for(let p of o){if(p.role)continue;let b=ce(p);if(!b)continue;let M=Pn(b);if(M*ee*ee<6||M>l)continue;let g=Math.min(...b.map(R=>R.x)),S=Math.max(...b.map(R=>R.x)),_=Math.min(...b.map(R=>R.y)),I=Math.max(...b.map(R=>R.y)),y=0;for(let R of n)R.x>g&&R.x<S&&R.y>_&&R.y<I&&Or(R,b)&&y++;if(y>n.length*.05)continue;let x=Cr(b),P=dc(t,b);P>=Ed&&u.push({shape:p,centre:x,outline:b,score:P,area:M,box:[g,_,S,I]})}let f=(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,m=u.filter(p=>!u.some(b=>f(p,b))),h=Math.max(0,...m.map(p=>p.score)),d=m.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 rp(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=Lr(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function pc(e){return e.length<3?[...e].sort((t,n)=>t.x-n.x||t.y-n.y):Gt(e)}function ip(e){if(!e.length||e.length>$d)return[];let t=[...kr(e).values()],n=t.map((a,c)=>c),o=a=>n[a]===a?a:n[a]=o(n[a]),r=Zd/ee,i=t.map(a=>({minX:Math.min(...a.map(c=>c.x))-r,maxX:Math.max(...a.map(c=>c.x))+r,minY:Math.min(...a.map(c=>c.y))-r,maxY:Math.max(...a.map(c=>c.y))+r}));for(let a=0;a<t.length;a++)for(let c=a+1;c<t.length;c++){let l=i[a],u=i[c];if(l.maxX<u.minX||u.maxX<l.minX||l.maxY<u.minY||u.maxY<l.minY)continue;t[a].some(m=>t[c].some(h=>Math.hypot(m.x-h.x,m.y-h.y)<=r))&&(n[o(a)]=o(c))}let s=new Map;return t.forEach((a,c)=>{let l=o(c),u=s.get(l);u?u.push(...a):s.set(l,[...a])}),[...s.values()].filter(a=>new Set(a.map(c=>c.rowId)).size>=2)}function sp(e,t,n){if(!t.length)return null;let o=t.filter(P=>n.tableIds.has(P.rowId)||P.kind==="booth").length>t.length/2,r=kr(t),i=!n.outline||dc(r,n.outline)>=Ad,s=0,a=0;for(let P of r.values()){if(P.length<2)continue;let R=P[0],v=P[P.length-1],T=v.x-R.x,k=v.y-R.y,C=Math.hypot(T,k);if(C<1e-6)continue;let E={x:(R.x+v.x)/2,y:(R.y+v.y)/2},A=i?n.outline?Lr(E,n.outline):n.focal:n.middle,O=-k/C,F=T/C;O*(A.x-E.x)+F*(A.y-E.y)<0&&(O=-O,F=-F),s+=O*P.length,a+=F*P.length}let c={x:t.reduce((P,R)=>P+R.x,0)/t.length,y:t.reduce((P,R)=>P+R.y,0)/t.length};if(Math.hypot(s,a)<1e-9){let P=i?n.focal:n.middle;s=P.x-c.x,a=P.y-c.y}let l=Math.hypot(s,a)||1,u={x:s/l,y:a/l},f=P=>-(P.x*u.x+P.y*u.y),m=P=>-P.x*u.y+P.y*u.x,h=1/0,d=-1/0,p=1/0,b=-1/0,M=1/0,g=new Map;for(let P of t){let R=f(P),v=m(P);h=Math.min(h,R),d=Math.max(d,R),p=Math.min(p,v),b=Math.max(b,v),i&&(M=Math.min(M,rp(P,n.focal,n.outline)));let T=P.logicalRowId??P.rowId,k=g.get(T);k?k.push(R):g.set(T,[R])}i||(M=Math.max(0,h-f(n.middle)));let S=[...g.values()].map(P=>vr(P)).sort((P,R)=>P-R),_=[];if(!o)for(let P of S)_.length&&P-_[_.length-1]<Md/ee||_.push(P);let I=np(e),y=mt(e,{floorBaseHeightM:n.baseHeightM}),x={id:e.id,section:e,authored:I,plane:n,facing:u,facesAction:i,hull:pc(t),sample:t.filter((P,R)=>R%Math.ceil(t.length/kd)===0),frontD:h,backD:d,latMin:p,latMax:b,frontDistance:M,rowDepths:_,rowCount:_.length,level:0,height:y.height,rake:I?y.rake:0,backHeight:0};return x.backHeight=x.height+(d-h)*ee*Math.tan(x.rake*Math.PI/180),x}function ap(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*ee),i=n+pd-o,s=0,a=0;for(let l=1;l<e.length;l++){let u=Math.max(Sd,(e[l]-e[l-1])*ee),f=(i+bd)*(r+u)/r;s+=f-i,a+=u,i=f,r+=u}let c=Math.atan(s/a)*180/Math.PI;return Math.round(Math.max(fc,Math.min(yd,c))*10)/10}function cp(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<vd)return null;let o=-1/0,r=1/0,i=-1/0;for(let m of t.hull){o=Math.max(o,-(m.x*e.facing.x+m.y*e.facing.y));let h=-m.x*e.facing.y+m.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:mc*(e.latMax-e.latMin)))return null;let a=hc/ee,c=new Map,l=new Map;for(let m of e.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);c.set(h,Math.min(c.get(h)??1/0,d))}for(let m of t.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);l.set(h,Math.max(l.get(h)??-1/0,d))}let u=[];for(let[m,h]of c){let d=l.get(m);d!==void 0&&u.push(h-d)}let f=u.length?vr(u):e.frontD-o;return f<-1/ee?null:f}function lp(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 s=Math.min(e.latMax,i)-Math.max(e.latMin,r),a=Math.min(e.backD,n)-Math.max(e.frontD,o);return s>mc*(e.latMax-e.latMin)&&a>1/ee}function up(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 fp(e,t){let n=1/0,o=-1/0;for(let i of t.hull){let s=-(i.x*e.facing.x+i.y*e.facing.y);n=Math.min(n,s),o=Math.max(o,s)}let r=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+r*ee*Math.tan(t.rake*Math.PI/180)}function mp(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=hc/ee,r=Math.max(1,Math.ceil((e.backD-e.frontD)/o)),i={left:new Map,right:new Map};for(let a of t)if(!(a===e||a.plane.floorIndex!==e.plane.floorIndex)&&!(a.facing.x*e.facing.x+a.facing.y*e.facing.y>=Dd))for(let c of a.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,f=u<e.latMin?"left":u>e.latMax?"right":null;if(!f)return!1;let m=Math.min(r-1,Math.floor((l-e.frontD)/o)),h=f==="left"?e.latMin-u:u-e.latMax;h<(i[f].get(m)?.gap??1/0)&&i[f].set(m,{gap:h,other:a})}let s=a=>{let c=a==="left"?e.latMin:e.latMax,l=0;for(let[u,{other:f}]of i[a]){if((f.facing.x*n.x+f.facing.y*n.y)*(a==="left"?1:-1)<Nd)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*f.facing.x+d.y*f.facing.y),b=-d.x*f.facing.y+d.y*f.facing.x;p<f.frontD&&b>=f.latMin&&b<=f.latMax&&l++}return l/r>=Fd};return s("left")&&s("right")}function hp(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<Ud)return!1;let n=1/0,o=-1/0,r=1/0;for(let a of t.hull){let c=-a.x*e.facing.y+a.y*e.facing.x;n=Math.min(n,c),o=Math.max(o,c),r=Math.min(r,-(a.x*e.facing.x+a.y*e.facing.y))}let i=(e.frontD-r)*ee;if(i<-Xd||i>Kd)return!1;let s=Math.max(n-e.latMax,e.latMin-o);return s*ee<=Wd&&s*ee>=-Yd}function dp(e,t=!1,n=!1,o){let r=t?wd:_d,i=new Set(n?[]:e.filter(p=>!p.authored&&mp(p,e))),s=[...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 a=(p,b,M)=>{let g=new Map,S=[],_=new Map,I=y=>{if(y.plane.floorIndex===0||y.plane.baseHeightM>0)return y.plane.baseHeightM;let x=_.get(y.plane.floorIndex-1);return x===void 0?y.plane.baseHeightM:x+sc};for(let y of s){if(i.has(y))y.height=I(y),y.level=0,y.rake=0,y.backHeight=y.height,g.set(y.id,void 0);else if(!y.authored){let P=I(y),R;for(let E of S){if(E.plane.floorIndex>y.plane.floorIndex)continue;if(lp(y,E)){let L=fp(y,E)+Od;L>P&&(P=L,R=E);continue}let A=cp(y,E,i.has(E));if(A==null)continue;let O=n&&!!y.plane.stageDeck&&E.level===0&&E.plane.floorIndex===y.plane.floorIndex&&Math.max(0,A)*ee<=Td,F=i.has(E)?E.height+Gd:O?E.backHeight:E.backHeight+gd+Math.min(xd,Math.max(0,A)*ee)*Math.tan(E.rake*Math.PI/180);F>P&&(P=F,R=E)}let v=p.get(y);v&&v.height>P+.01?(P=v.height,R=void 0):v=void 0,y.height=Math.round(Math.min(P,y.plane.baseHeightM+Pd)*100)/100;let T=!R&&!v&&y.height>y.plane.baseHeightM;if(y.level=R?R.level+1:v?v.level:T?1:0,y.rake=ap(y.rowDepths,y.frontDistance,y.height,y.plane.focalHeightM),!y.facesAction&&y.rowCount<Cd)y.rake=0;else if(y.level===0){let E=Math.max(1e-6,(y.backD-y.frontD)*ee);y.rake=Math.min(y.rake,Rd,Math.round(Math.atan(Id/E)*1800/Math.PI)/10)}else y.rowCount>=2&&(y.rake=Math.max(y.rake,r[Math.min(y.level,r.length)-1]));let k=(y.backD-y.frontD)*ee,C=R&&i.has(R)||v&&M?.has(v.id);if(b!==void 0&&C&&y.rowCount>=2&&(y.rake=b),t&&k>0&&y.height+k*Math.tan(y.rake*Math.PI/180)>y.plane.baseHeightM+cc){let E=Math.max(0,y.plane.baseHeightM+cc-y.height);y.rake=Math.max(fc,Math.round(Math.atan(E/k)*1800/Math.PI)/10)}n&&y.plane.stageDeck&&y.level>0&&(y.rake=Math.min(y.rake,Bd)),y.backHeight=y.height+k*Math.tan(y.rake*Math.PI/180),g.set(y.id,R?.id??(v?g.get(v.id):void 0))}let x=y.plane.floorIndex;_.set(x,Math.min(_.get(x)??1/0,y.height)),S.push(y)}return g},c=a(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 M of e)if(!(M.authored||i.has(M)))for(let g of e){let S=l.get(g)??g;g===M||S.height-S.plane.baseHeightM<zd||S.height<=u(M)+.01||hp(M,g)&&(l.set(M,S),p=!0)}}let f=new Map(e.map(p=>[p.id,p])),m=e.filter(p=>!p.authored&&p.rowCount>=2&&i.has(f.get(c.get(p.id)??""))),h=m.length?vr(m.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 a(new Map([...l].map(([p,b])=>[p,d.get(b)])),h,new Set(m.map(p=>p.id)))}var Ar=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function bc(e,t={x:0,y:-40}){let n=Nt(e),o=new Map;for(let M of n){if(!M.sectionId)continue;let g=o.get(M.sectionId);g?g.push(M):o.set(M.sectionId,[M])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((M,g)=>({objects:M.objects,floorIndex:g,floorId:M.id,baseHeightM:M.baseHeightM??0,focal:M.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],s=new Set(i.flatMap(M=>M.objects.filter(g=>g.type==="table").map(g=>g.id))),a=[],c,l=new Set,u=i.map(M=>{let g=C=>!e.floors?.length||C.floorId===M.floorId,S=ip(n.filter(C=>!C.sectionId&&C.kind!=="booth"&&!s.has(C.rowId)&&g(C))),_=[];for(let C of S){let E=ot(nt(pc(C)),Qd/ee);if(n.some(O=>!g(O)&&Or(O,E)))continue;let A=`${lc}${M.floorIndex}-${_.length}`;l.add(A),o.set(A,C),_.push({type:"section",id:A,label:"",color:qd,outline:E})}let I=_.length?{...M,objects:[...M.objects,..._]}:M,y=new Set(I.objects.filter(C=>C.type==="section").map(C=>C.logicalSectionId??C.id)),x=[...o.entries()].filter(([C])=>y.has(C)).flatMap(([,C])=>C),P=op(I.objects,kr(x),x),R=I.focal;(P||I.focal&&!Ar(I.focal,t))&&(r.confident=!0),P&&(r.stage??={id:P.shape.id,inferred:P.inferred,...I.floorId?{floorId:I.floorId}:{}},(P.inferred||Ar(I.focal,t))&&(R=P.centre,r.focalInferred=!0));let v=P&&(!P.inferred||Pn(P.outline)*ee*ee<=Er),T=P?void 0:c,k={tableIds:s,floorIndex:I.floorIndex,floorId:I.floorId,baseHeightM:I.baseHeightM,focal:T?.focal??R,outline:P?.outline??T?.outline,focalHeightM:T?.focalHeightM??I.baseHeightM+(P&&v?$e({...P.shape,role:"stage"}).heightM:0),stageDeck:T?.stageDeck??!!(P&&v&&Pn(P.outline)*ee*ee<=Er),middle:x.length?{x:x.reduce((C,E)=>C+E.x,0)/x.length,y:x.reduce((C,E)=>C+E.y,0)/x.length}:R};for(let C of I.objects){if(C.type!=="section")continue;let E=sp(C,o.get(C.logicalSectionId??C.id)??[],k);E&&a.push(E)}return k.outline&&(c=k),Ar(I.focal,k.focal)||(r.focal??=[]).push({...I.floorId?{floorId:I.floorId}:{},point:{...k.focal}}),{unit:I,plane:k,stage:P,planeSeats:x}}),f=i.flatMap(M=>M.objects).map(M=>M.type==="shape"&&!M.role&&(wr(M.label)==="wall"||!wr(M.label)&&ac(M))?{...M,role:"wall"}:M),m=bt({objects:f},n)!==null;m&&(r.indoor=!0);let h=new Set,d=dp(a,m,up(n,u[0]?.plane.focal??t)<Ld,h),p=new Map(a.filter(M=>!M.authored).map(M=>[M.id,M])),b=u.map(({unit:M,plane:g,stage:S,planeSeats:_})=>M.objects.map(I=>{let y=I.type==="shape"&&!I.role&&I.id!==S?.shape.id?wr(I.label):null;if(I.type==="shape"&&!I.role&&I.id!==S?.shape.id&&(y==="wall"||!y&&ac(I))&&I.type==="shape"){(r.roles??=[]).push({id:I.id,...g.floorId?{floorId:g.floorId}:{},role:"wall"});let{fill:E,...A}=I;return{...A,role:"wall"}}if(y&&I.type==="shape")return(r.roles??=[]).push({id:I.id,...g.floorId?{floorId:g.floorId}:{},role:y}),{...I,role:y};let P=S?.inferred&&I.id===S.shape.id&&I.type==="shape"?ep(I,S.outline,M.objects,_):null;if(P&&I.type==="shape")return r.stage?.id===I.id&&(r.stage.field=P),{...I,role:"stage",stageKind:P};let R=I.type==="shape"&&I.id===S?.shape.id&&I.heightM===void 0&&!I.stageKind&&a.some(E=>E.plane===g&&(h.has(E.id)||E.level===0&&E.facesAction&&E.rake<=jd&&(E.frontDistance+E.backD-E.frontD)*ee>=Vd)),v=R?{heightM:Hd}:{};if(S?.inferred&&I.id===S.shape.id&&I.type==="shape"&&Pn(S.outline)*ee*ee<=Er)return r.stage?.id===I.id&&(r.stage.deck=!0),{...I,role:"stage",...v};if(R&&I.type==="shape"&&I.role==="stage")return{...I,...v};let T=I.type==="section"?p.get(I.id):void 0;if(!T||I.type!=="section")return I;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 C={status:"inferred",source:"public-2d-topology",note:tp};return{...I,height:T.height,rake:T.rake,surfaceKind:k?"rakedRows":"flat",physical3dProvenance:{height:C,rake:C,surfaceKind:C}}}));if(e.floors?.length){let M=e.floors.map((g,S)=>({...g,objects:b[S],focalPoint:u[S].plane.focal}));return{doc:{...e,floors:M,objects:M[0].objects,focalPoint:M[0].focalPoint},report:r}}return{doc:{...e,objects:b[0],focalPoint:u[0].plane.focal},report:r}}var yc=/^[\p{L}\p{N}]{1,4}$/u,pp=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function gc(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 s=e.slice(n.length).trim();if(yc.test(s))return s}let i=pp.exec(e);if(i){let s=i[1].toLocaleLowerCase("en-US"),a=i[2].trim();if((r.startsWith(s)||s.startsWith(r))&&yc.test(a))return a}return e}var xc={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"},bp=new Map(zo.map(e=>[e.key,e.label]));function yp(e){return`picker.access.${e}`}function Mc(e){let t=[],n=e.boothType;n&&Object.prototype.hasOwnProperty.call(xc,n)&&t.push({key:`booth:${n}`,icon:"booth",titleKey:`picker.boothType.${n}`,titleFallback:xc[n],tone:"place"});let o=e.wheelchairSpaceType;for(let a of e.accessibility??[]){if(a==="wheelchair"&&o)continue;let c=bp.get(a);c&&t.push({key:`access:${a}`,icon:a,titleKey:yp(a),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 a=t.find(c=>c.tone==="warn"||c.tone==="premium");a?a.note=i:t.push({key:"note",icon:"note",titleKey:"picker.organizerNote",titleFallback:"Organizer note",tone:"note",note:i})}let s=typeof e.entrance=="string"?e.entrance.trim():"";return s&&t.push({key:"place:entrance",icon:"entrance",titleKey:"picker.entrance",titleFallback:"Entrance",tone:"place",note:s}),t}var gp=1.5,xp=30,Mp=4,Sp=3.6,Rp=6,Tr=15,Ip=3,Pp=1;function _p(e){return Math.max(Sp,Math.min(Rp,2.4+.15*e))}var _n=Math.PI*2;function wp(e,t){let n=0,o=0;for(let f of e)n+=f.x,o+=f.y;let r=Math.atan2(o/e.length-t.y,n/e.length-t.x),i=e.map(f=>{let m=Math.atan2(f.y-t.y,f.x-t.x)-r;for(;m>Math.PI;)m-=_n;for(;m<-Math.PI;)m+=_n;return m+r}),s=i.map((f,m)=>m).sort((f,m)=>i[f]-i[m]),a=i[s[0]],c=i[s[s.length-1]];if(c-a>Math.PI)return null;let l=f=>Math.hypot(f.x-t.x,f.y-t.y),u=f=>{let m=e[f],h=(f+e.length-1)%e.length,d=(f+1)%e.length,p=Math.abs(i[h]-i[f])<=Math.abs(i[d]-i[f])?h:d,b=e[p];return l(m)<=l(b)?[m,b]:[b,m]};return{start:a,end:c,startEdge:u(s[0]),endEdge:u(s[s.length-1])}}function Sc(e){return e.type==="shape"&&e.role==="wall"&&e.heightM===void 0}function Br(e,t,n=()=>!0){let o=[];for(let c of e){if(!Sc(c)||!n(c))continue;let l=ce(c);if(!l||l.length<3)continue;let u=wp(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=ce(c);if(!l?.length)return[];let u=0,f=0;for(let m of l)u+=m.x,f+=m.y;return[{x:u/l.length,y:f/l.length}]}),i=c=>(c%_n+_n)%_n;o.sort((c,l)=>i(c.start)-i(l.start));let s=c=>Math.hypot(c.x-t.x,c.y-t.y),a=[];for(let c=0;c<o.length;c++){let l=o[c],u=o[(c+1)%o.length],f=i(u.start-l.end);if(f<=0||f>=Math.PI/2)continue;let m=y=>i(y-l.end)<f;if(o.some(y=>y!==l&&y!==u&&(m(y.start)||m(y.end)||i(l.end-y.start)<y.end-y.start)))continue;let[d,p]=l.endEdge,[b,M]=u.startEdge,g={x:(d.x+p.x)/2,y:(d.y+p.y)/2},S={x:(b.x+M.x)/2,y:(b.y+M.y)/2},_=Math.hypot(S.x-g.x,S.y-g.y)*w;if(_<gp||_>xp||Math.abs(s(g)-s(S))*w>Mp+.2*_)continue;let I={x:(g.x+S.x)/2,y:(g.y+S.y)/2};r.some(y=>m(Math.atan2(y.y-t.y,y.x-t.x))&&Math.abs(s(y)-s(I))*w<=Ip)||a.push({quad:[d,p,M,b],mid:I,widthM:_,openingM:_p(_)})}return a}function Rc(e,t){let n=[];for(let i of t)if(i.text?.trim())for(let s of e){let a=Math.hypot(i.position.x-s.mid.x,i.position.y-s.mid.y)*w;a<=Tr&&n.push({text:i,gate:s,d:a})}n.sort((i,s)=>i.d-s.d);let o=new Map,r=new Set;for(let{text:i,gate:s}of n)o.has(i.id)||r.has(s)||(o.set(i.id,s),r.add(s));return o}function Ic(e,t,n,o,r,i,s,a=()=>!0){let c=Br(t,$t(n),a);if(!c.length)return;let l=t.find(f=>Sc(f)&&a(f)),u=co(l?.fill,s);e.setMaterial(to);for(let f of c)r-f.openingM<Pp||oo(e,f.quad,o+f.openingM,o+r,[],u.top,u.wall,i,r);e.setMaterial(0)}var Ep=6,Ap=2.2,bo=.1,Cp=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,vp=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),kp=.3,Op=1.8,Lp=.9,Tp=.55,Bp=1,Pc=4e3,Np=6,_c="#d8a425",Fp="#e8c15a",Nr="#1c1608";function wc(e){let t=Dp(e);if(!t)return null;let n=Mc(e).find(o=>o.icon===t.icon);return{...t,name:n?.titleFallback??t.icon}}function Dp(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:Vn(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:_c,ink:Nr}:n?.restrictedView?{icon:"restrictedView",color:_c,ink:Nr}:n?.premium?{icon:"premium",color:Fp,ink:Nr}:null}function Gp(e,t){if(!e)return;let n,o=0;for(let[i,s]of e)s>o&&(o=s,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 Hp=6e3,jp=.25,Ec=[-90,90,-135,135,-45,45];function Vp(e,t,n,o){let r=e.flatMap(({id:s,a,members:c})=>{let l=(a.minX+a.maxX)/2,u=(a.minY+a.maxY)/2,f=.5*Math.hypot(a.maxX-a.minX,a.maxY-a.minY),m=1/0;for(let h of c)m=Math.min(m,Math.hypot(t[h].x-l,t[h].y-u));return c.length&&m>=f*jp?[{id:s,cx:l,cy:u,half:f,members:c}]:[]}).sort((s,a)=>s.half-a.half),i=new Map;return r.forEach(({id:s,cx:a,cy:c,members:l},u)=>{let f=o.x-a,m=o.y-c,p=(Math.hypot(f,m)>1e-6?Math.atan2(m,f):0)+Ec[u%Ec.length]*Math.PI/180,b=Math.cos(p),M=Math.sin(p),g=-1,S=-1/0;for(let _ of l){let I=(t[_].x-a)*b+(t[_].y-c)*M;I>S&&(S=I,g=_)}i.set(s,[t[g].x*w,n.seatDeckY(g),t[g].y*w])}),i}function Cc(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,s=t.zones??[],a=[];if(s.length){let c=new Map;for(let m of n)for(let h of m.objects)h.type==="section"&&h.zone&&c.set(h.id,h.zone);let l=new Map,u=new Map;for(let m=0;m<o.length;m++){let h=o[m],d=r.seatOwner[m],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 M=u.get(p);M||u.set(p,M=[]),M.push(m),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(m)}let f=Vp(s.flatMap(m=>{let h=l.get(m.id);return h?[{id:m.id,a:h,members:u.get(m.id)??[]}]:[]}),o,r,i);for(let m of s){let h=l.get(m.id),d=[];for(let[p,b]of c)b===m.id&&d.push(p);if(!h||h.n===0){a.push({id:m.id,label:m.label,color:me(m.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(m.focalPoint??i).x*w,1.5,(m.focalPoint??i).y*w]});continue}a.push({id:m.id,label:m.label,color:me(m.color),sectionIds:d,seatCount:h.n,...f.has(m.id)?{labelAt:f.get(m.id)}:{},center:[(h.minX+h.maxX)/2*w,h.sumY/h.n,(h.minY+h.maxY)/2*w],radius:.5*Math.hypot((h.maxX-h.minX)*w,(h.maxY-h.minY)*w)||1,focalWorld:[(m.focalPoint??i).x*w,1.5,(m.focalPoint??i).y*w]})}}return a}function vc(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:s,zones:a,focal:c}=e,l=[],u=[],f=[],m=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 M=t.floors?.[d.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&M===b)continue;let g=m.get(p.zone);g||m.set(p.zone,g=new Set),g.add(b)}for(let d of a)d.seatCount!==0&&(m.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]+Ep,(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,M=new Map;for(let g=0;g<o.length;g++){let S=r.seatOwner[g];if(!S)continue;let _=d.get(S);_||(_={n:0,x:0,y:0,deck:0},d.set(S,_)),_.n++,_.x+=o[g].x,_.y+=o[g].y,_.deck+=r.seatDeckY(g);let I=o[g].categoryKey;if(I){let x=p.get(S);x||(x=new Map,p.set(S,x)),x.set(I,(x.get(I)??0)+1)}if(o[g].accessibility?.includes("wheelchair")){let x=b.get(S);x?x.push(g):b.set(S,[g])}let y=M.get(S);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},M.set(S,y)),y.minDeck=Math.min(y.minDeck,r.seatDeckY(g)),y.maxDeck=Math.max(y.maxDeck,r.seatDeckY(g)),o[g].x<y.minX&&(y.minX=o[g].x),o[g].x>y.maxX&&(y.maxX=o[g].x),o[g].y<y.minY&&(y.minY=o[g].y),o[g].y>y.maxY&&(y.maxY=o[g].y)}for(let g of n)for(let S of g.objects){if(S.type!=="section"||uc(S))continue;let _=d.get(S.id);if(!_||_.n===0)continue;let I=M.get(S.id),y=[_.x/_.n*w,_.deck/_.n,_.y/_.n*w],x=S.displayLabel||S.label||S.id;u.push({id:S.id,floorIndex:g.index,label:x,seatCount:_.n,center:y,radius:Math.max(1,Math.hypot(I.maxX-I.minX,I.maxY-I.minY)*.5*w),box:{min:[I.minX*w-.4,I.minDeck,I.minY*w-.4],max:[I.maxX*w+.4,I.maxDeck+1,I.maxY*w+.4]},focalWorld:[g.focal.x*w,g.baseHeightM+1.5,g.focal.y*w]});let P=t.floors?.[g.index]?.name?.trim().toLocaleLowerCase();if(!(n.length>1&&P===x.trim().toLocaleLowerCase())){let R=Gp(p.get(S.id),t),v=b.get(S.id);l.push({id:`section:${S.id}`,kind:"section",text:x,anchor:[y[0],y[1]+Ap,y[2]],floorIndex:g.index,...R?{tint:R}:{},...v?{wheelchairSeats:v}:{}})}}}{for(let y of n)for(let x of y.objects){if(x.type!=="gaArea")continue;let P=kt(x.points);if(!P)continue;let R=x.labelPresentation?.visible===!1?"":x.displayLabel||x.label||x.id,v=x.capacity>0?[R,x.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):R;v&&l.push({id:`ga:${x.id}`,kind:"ga",text:v,anchor:[P.x*w,y.baseHeightM+Op,P.y*w],floorIndex:y.index})}let d=new Map,p=new Map;for(let y of n)for(let x of y.objects)if(x.type==="section"&&d.set(x.id,x.displayLabel||x.label||x.id),x.type==="row"){let P=x.displayLabel?.trim()||x.segmentedRow?.displayLabel?.trim();P&&p.set(x.id,P)}let b=new Map;for(let y=0;y<o.length;y++){let x=o[y],P=Math.hypot(x.x-c.x,x.y-c.y),R=b.get(x.rowId);(!R||P>R.far)&&b.set(x.rowId,{seat:x,index:y,far:P})}for(let[y,x]of b){let P=r.seatOwner[x.index]??x.seat.sectionId,R=Ac(x.seat.label,y,d.get(P??""),p.get(y));R&&l.push({id:`row:${y}`,kind:"row",text:R,anchor:[x.seat.x*w,r.seatDeckY(x.index)+Lp,x.seat.y*w],floorIndex:s[x.index]})}let M=new Map;for(let y=0;y<o.length;y++){let x=o[y],P=M.get(x.rowId);P||(P={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:Ac(x.label,x.rowId,d.get(r.seatOwner[y]??x.sectionId??""),p.get(x.rowId)),sectionId:r.seatOwner[y]??x.sectionId},M.set(x.rowId,P));let R=y*3,v=i.iPosition[R],T=i.iPosition[R+1],k=i.iPosition[R+2];P.n++,P.x+=v,P.y+=T,P.z+=k,P.minX=Math.min(P.minX,v),P.maxX=Math.max(P.maxX,v),P.minZ=Math.min(P.minZ,k),P.maxZ=Math.max(P.maxZ,k)}for(let[y,x]of M)f.push({id:y,label:x.label,sectionId:x.sectionId,seatCount:x.n,center:[x.x/x.n,x.y/x.n,x.z/x.n],radius:Math.max(.8,Math.hypot(x.maxX-x.minX,x.maxZ-x.minZ)*.5)});let g=0,S=(y,x)=>{g++,l.push({id:`access:${o[y].id}`,kind:"access",text:x.name,icon:x.icon,color:x.color,...x.ink?{ink:x.ink}:{},seatWidthM:i.iChairWidth[y]*2,anchor:[o[y].x*w,r.seatDeckY(y)+Bp,o[y].y*w],floorIndex:s[y],rowId:o[y].rowId})},_=null,I=()=>{if(_){let y=wc(o[_.seats[0]]),x=_.seats.length,P=Math.max(1,Math.round(x/Np));for(let R=0;R<P&&g<Pc;R++)S(_.seats[Math.min(x-1,Math.floor((R+.5)*x/P))],y)}_=null};for(let y=0;y<o.length&&g<Pc;y++){let x=wc(o[y]);if(x&&o[y].accessibility?.length){I(),S(y,x);continue}if(!x){I();continue}_&&_.rowId===o[y].rowId&&_.icon===x.icon?_.seats.push(y):(I(),_={rowId:o[y].rowId,icon:x.icon,seats:[y]})}if(I(),o.length<=Hp)for(let y=0;y<o.length;y++){let x=o[y],P=Up(x.displayLabel||x.label);P&&l.push({id:`seat:${x.id}`,kind:"seat",seatWidthM:i.iChairWidth[y]*2,text:P,anchor:[x.x*w,r.seatDeckY(y)+Tp,x.y*w],floorIndex:s[y],rowId:x.rowId})}}let h=Qn(n);for(let d of n){let p=bt(d,n.length===1?o:o.filter((g,S)=>s[S]===d.index)),b=p?Rc(Br(d.objects,$t(p)),d.objects.filter(g=>g.type==="text")):new Map,M=[...b.values()];for(let g of d.objects){let S=g.type==="text"?b.get(g.id):void 0;if(g.type==="shape"&&(g.role==="entrance"||g.role==="exit")&&Cp.test(g.label?.trim()??"")){let _=ce(g),I=_?kt(_):null;if(I&&M.some(y=>Math.hypot(I.x-y.mid.x,I.y-y.mid.y)*w<=Tr+y.widthM))continue}if(S&&g.type==="text")l.push({id:`text:${g.id}`,kind:"gate",text:g.text,icon:"entrance",anchor:[S.mid.x*w,d.baseHeightM+S.openingM+bo,S.mid.y*w],color:g.color,floorIndex:d.index});else if(g.type==="shape"&&g.role&&vp.has(g.role)){if(h.has(g))continue;let _=ce(g),I=_?kt(_):null;if(!I||!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:[I.x*w,d.baseHeightM+$e(g).heightM+bo,I.y*w],color:g.fill,floorIndex:d.index})}else if(g.type==="text"){let _=g.semanticKind==="icon"?ur(g.iconKey)?.key:void 0,I=g.text||(_?ur(_).label:"");if(!I)continue;l.push({id:`text:${g.id}`,kind:"annotation",text:I,..._?{venueIcon:_}:{},anchor:_?[(g.position.x+g.fontSize/2)*w,d.baseHeightM+bo,(g.position.y+g.fontSize/2)*w]:[g.position.x*w,d.baseHeightM+bo,g.position.y*w],color:g.color,rotation:g.rotation,floorIndex:d.index})}else if(g.type==="booth"){if(g.labelPresentation?.visible===!1)continue;let _=Je(g);if(!_)continue;let I=kt(_);if(!I)continue;l.push({id:`booth:${g.id}`,kind:"booth",text:g.displayLabel||g.label||g.id,anchor:[I.x*w,d.baseHeightM+lo+kp,I.y*w],floorIndex:d.index})}}}return{labels:l,sections:u,rows:f}}function kc(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 Up(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Ac(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&&gc(i,n)}function Oc(e){let{doc:t,units:n,seats:o,surfaces:r,solids:i,hintedSeatFloor:s,seatFloor:a}=e,c=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let h=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),d=m*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 m=0;m<n.length;m++)for(let h of n[m].objects)h.type==="section"&&u.set(h.id,m);let f=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<o.length;m++){let h=r.seatOwner[m],d=(h!==null?u.get(h):void 0)??s[m];if(d===void 0)continue;let p=f[d],b=o[m];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 M=r.seatDeckY(m);p.sumX+=b.x*w,p.sumDeck+=M,p.sumZ+=b.y*w,p.minDeck=Math.min(p.minDeck,M),p.maxDeck=Math.max(p.maxDeck,M+1.6),a[m]=d}for(let m=0;m<n.length;m++){let h=f[m],d=t.floors?.[m],p=l[m],b=Math.min(h.n?h.minX*w:n[m].focal.x*w-1,Number.isFinite(p.minX)?p.minX:1/0),M=Math.max(h.n?h.maxX*w:n[m].focal.x*w+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(h.n?h.minY*w:n[m].focal.y*w-1,Number.isFinite(p.minZ)?p.minZ:1/0),S=Math.max(h.n?h.maxY*w:n[m].focal.y*w+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),_=Math.min(h.n?Math.min(n[m].baseHeightM,h.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),I=Math.max(h.n?Math.max(h.maxDeck,_+.5):_+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),y=[h.n?h.sumX/h.n:(b+M)/2,h.n?h.sumDeck/h.n:(_+I)/2,h.n?h.sumZ/h.n:(g+S)/2],x=Math.max(1,.5*Math.hypot(M-b,I-_,S-g));c.push({index:m,id:d?.id??`floor-${m}`,label:d?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:y,radius:x,box:{min:[b,_,g],max:[M,I,S]},focalWorld:[n[m].focal.x*w,n[m].baseHeightM+1.5,n[m].focal.y*w]})}}return c}function Hr(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,s=(a,c)=>{a<n&&(n=a),c<o&&(o=c),a>r&&(r=a),c>i&&(i=c)};for(let a of t)s(a.x,a.y);for(let a of e)for(let c of a.objects)if(c.type==="section")for(let l of c.outline)s(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)s(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)s(l.x,l.y);else if(c.type==="booth"){let l=Je(c);if(l)for(let u of l)s(u.x,u.y)}else if(c.type==="table"){let l=uo(c);if(l)for(let u of l)s(u.x,u.y)}else if(c.type==="decorImage"){let l=fo(c);if(l)for(let u of l)s(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 Gc(e,t,n,o,r,i){if(t.length===1){let s=n.map(f=>({x:f.x,y:f.y}));for(let f of t[0].objects)f.type==="section"?s.push(...f.outline):f.type==="shape"?s.push(...ce(f)??f.points??[]):f.type==="gaArea"?s.push(...f.points):f.type==="booth"?s.push(...Je(f)??[]):f.type==="table"?s.push(...uo(f)??[]):f.type==="decorImage"&&s.push(...fo(f)??[]);if(Nc(e,t[0],n,i)||Dc(e,t[0],n,s,i))return!1;if(Bc(e,t[0].baseHeightM,s,i))return!0;let a=xn(s),c=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,u=a.length>=3?a.map(f=>{let m=f.x-c,h=f.y-l,d=Math.max(1,Math.hypot(m,h));return{x:f.x+m/d*80,y:f.y+h/d*80}}):sn(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return $(e,u,void 0,()=>-.04,-.22,i.ground,i.ground,W),!1}else{let s=t.reduce((p,b)=>b.baseHeightM<p.baseHeightM?b:p);e.setFloor(s.index);let a={...s,objects:t.flatMap(p=>p.objects)},c=n.map(p=>({x:p.x,y:p.y}));for(let p of a.objects)p.type==="section"&&c.push(...p.outline);if(Nc(e,a,n,i)||Dc(e,a,n,c,i))return!1;if(Bc(e,s.baseHeightM,c,i))return!0;let l=n.filter((p,b)=>o[b]===s.index),u=Hr([s],l),f=Math.hypot(u.maxX-u.minX,u.maxY-u.minY),m=Math.max(28,Math.min(80,f*.04)),h=sn(u.minX-m,u.minY-m,u.maxX-u.minX+m*2,u.maxY-u.minY+m*2),d=s.baseHeightM-.03;return $(e,h,void 0,()=>d,d-.22,i.ground,i.ground,W),!1}}function jr(e,t,n,o){let{cx:r,cz:i,radius:s}=n,a=1/0,c=1/0,l=1/0,u=-1/0,f=-1/0,m=-1/0,h=(b,M,g)=>{a=Math.min(a,b),u=Math.max(u,b),c=Math.min(c,M),f=Math.max(f,M),l=Math.min(l,g),m=Math.max(m,g)};for(let b=0;b<e.position.length;b+=3){let M=b/3;o&&M>=o[0]&&M<o[1]||h(e.position[b],e.position[b+1],e.position[b+2])}for(let b=0;b<t.count;b++){let M=b*3,g=t.iPosition[M],S=t.iPosition[M+1],_=t.iPosition[M+2],I=Math.max(.35,t.iMaxRadius[b]??.35);h(g-I,S,_-I),h(g+I,S+1.6,_+I)}Number.isFinite(a)||(a=r-s,u=r+s,c=0,f=s*.16,l=i-s,m=i+s);let d=[(a+u)/2,(c+f)/2,(l+m)/2],p=Math.max(1,.5*Math.hypot(u-a,f-c,m-l));return{center:d,radius:p,minY:c,maxY:f}}var Xp=4096;function Hc(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/Xp)),r=Math.ceil(e.count/o),i=new Float32Array((r*2+t.length*4+n.length)*3),s=0;for(let a=0;a<e.count;a+=o){let c=e.iPosition[a*3],l=e.iPosition[a*3+1],u=e.iPosition[a*3+2];i[s++]=c,i[s++]=l,i[s++]=u,i[s++]=c,i[s++]=0,i[s++]=u}for(let[a,c,l]of n)i[s++]=a,i[s++]=c,i[s++]=l;for(let a of t)for(let[c,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])i[s++]=a.cx+c*a.halfX,i[s++]=a.y,i[s++]=a.cz+l*a.halfZ;return i.subarray(0,s)}function jc(e,t,n,o,r,i,s=[]){let a=1/0,c=1/0,l=-1/0,u=-1/0;for(let I=0;I<e.count;I++){let y=I*3,x=e.iPosition[y],P=e.iPosition[y+2];x<a&&(a=x),x>l&&(l=x),P<c&&(c=P),P>u&&(u=P)}for(let[I,,y]of s)I<a&&(a=I),I>l&&(l=I),y<c&&(c=y),y>u&&(u=y);for(let I of t)a=Math.min(a,I.cx-I.halfX),l=Math.max(l,I.cx+I.halfX),c=Math.min(c,I.cz-I.halfZ),u=Math.max(u,I.cz+I.halfZ);let f=n.minX*w,m=n.maxX*w,h=n.minY*w,d=n.maxY*w,p=f,b=m,M=h,g=d;if(Number.isFinite(a)){let I=Math.max(2,.06*Math.hypot(l-a,u-c));p=Math.max(f,a-I),b=Math.min(m,l+I),M=Math.max(h,c-I),g=Math.min(d,u+I)}let S=Math.min(0,o),_=Math.max(r,i*.05);return{min:[p,S,M],max:[b,_,g]}}var Fr=12,Kp=.5,Wp=6,Dr=.8,Lc=5,Yp=.6,zp=40,Gr=0,Tc=8;function Bc(e,t,n,o){let r=xn([...n]);if(r.length<3)return!1;let i=1/0,s=1/0,a=-1/0,c=-1/0;for(let I of r)i=Math.min(i,I.x),a=Math.max(a,I.x),s=Math.min(s,I.y),c=Math.max(c,I.y);let l=Math.hypot(a-i,c-s)*w,u=Math.max(zp,l*Yp),f=I=>ot(r,I/w,1.2),m=f(Kp),h=[m,f(Wp),f(Fr),f(Fr+Lc),f(Fr+Lc+u)];if(h.some(I=>I.length!==m.length))return!1;let d=fe(o.ground,[.78,.76,.72],.35),p=fe(o.ground,[.56,.62,.52],.3),b=[d[0]*Dr,d[1]*Dr,d[2]*Dr],M=t-.04;e.setMaterial(Gr),$(e,m,void 0,()=>M,t-.22,b,b,W);let g=[0,1,0],S=(I,y,x,P,R)=>{let v=I.map(E=>[E.x*w,M,E.y*w]),T=y.map(E=>[E.x*w,M,E.y*w]),[k,C]=R;for(let E=0;E<v.length;E++){let A=(E+1)%v.length;e.tri(v[E],T[A],T[E],g,x,P,P,[k,C,C]),e.tri(v[E],v[A],T[A],g,x,x,P,[k,k,C])}},_=[Gr,Gr];return S(h[0],h[1],b,d,_),S(h[1],h[2],d,d,_),S(h[2],h[3],d,p,_),S(h[3],h[4],p,p,[Tc,Tc+1]),e.setMaterial(0),!0}function Nc(e,t,n,o){let r=bt(t,n);if(!r)return!1;let i=t.baseHeightM,s=fe(o.ground,[.62,.55,.47],.4);return $(e,r,void 0,()=>i-.04,i-.22,s,s,W),!0}var Zp=3e3,$p=20,Fc=1.5,Qp=1.2,qp=.25;function Dc(e,t,n,o,r){if(!n.length||n.length>Zp||o.length<3)return!1;for(let R of t.objects){if(R.type==="shape"&&St(R.stageKind))return!1;if(R.type==="section"){let{height:v}=mt(R,{floorBaseHeightM:t.baseHeightM});if(v-t.baseHeightM>$p)return!1}}let i=0,s=0;for(let R of o)i+=R.x,s+=R.y;i/=o.length,s/=o.length;let a=0,c=0,l=0;for(let R of o){let v=R.x-i,T=R.y-s;a+=v*v,c+=T*T,l+=v*T}let u=.5*Math.atan2(2*l,a-c),f=Math.cos(u),m=Math.sin(u),h=-m,d=f,p=1/0,b=-1/0,M=1/0,g=-1/0;for(let R of o){let v=(R.x-i)*f+(R.y-s)*m,T=(R.x-i)*h+(R.y-s)*d;p=Math.min(p,v),b=Math.max(b,v),M=Math.min(M,T),g=Math.max(g,T)}let S=R=>[[p-R,M-R],[b+R,M-R],[b+R,g+R],[p-R,g+R]].map(([v,T])=>({x:i+f*v+h*T,y:s+m*v+d*T})),_=S(Fc/w),I=S((Fc+qp)/w),y=t.baseHeightM,x=fe(r.ground,[.62,.55,.47],.4),P=fe(r.ground,[.86,.86,.84],.55);return $(e,I,void 0,()=>y-.04,y-.22,x,x,W),$(e,I,[_.slice().reverse()],()=>y+Qp,y-.04,fe(P,[1,1,1],.2),P,W),!0}function Vc(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=pi(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let f of n)for(let m of f.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:f});let s=new Set,a=new Set,c=new Map((t.overlay.productionElements??[]).map(f=>{let m=f.runtimeContentImageUrl;return[f.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),l=[];for(let f of r.value.overlay.productionElements??[]){let m=i.get(f.objectId),h=m?ce(m.shape):null,d=f.baseElevationM??0;if(!m||!h||h.length<3||!f.id||s.has(f.id)||a.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();s.add(f.id),a.add(f.objectId);let p=h.map(P=>P.x*w),b=h.map(P=>P.y*w),M=m.unit.baseHeightM+d,g=Math.min(...p),S=Math.max(...p),_=Math.min(...b),I=Math.max(...b),y,x=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&x&&(y=Sa(h,M,M+f.heightM,m.unit.focal),!y))if(S-g>=I-_){let P=Math.abs(_-m.unit.focal.y*w)<=Math.abs(I-m.unit.focal.y*w)?_-.006:I+.006;y=[[g,M,P],[S,M,P],[g,M+f.heightM,P],[S,M+f.heightM,P]]}else{let P=Math.abs(g-m.unit.focal.x*w)<=Math.abs(S-m.unit.focal.x*w)?g-.006:S+.006;y=[[P,M,_],[P,M,I],[P,M+f.heightM,_],[P,M+f.heightM,I]]}l.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:M,topY:M+f.heightM,bounds:{min:[g,M,_],max:[S,M+f.heightM,I]},occlusion:f.occlusion,...x?{contentImageUrl:x}:{},...y?{contentPlane:y}:{}})}let u=l.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(u.map(f=>[f.objectId,f])),elements:u}}function Jp(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 ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function De(e){return Array.isArray(e)?e:[]}function eb(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ke(n))continue;let o=ke(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 wn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function tb(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function nb(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 ob(e){let t=wn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:wn(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:wn(e.rotation,4),r=e.scale===void 0?[1,1,1]:wn(e.scale,3);if(!n||!o||!r)return null;let[i,s,a,c]=o,l=Math.hypot(i,s,a,c);if(!(l>1e-8))return null;let u=i/l,f=s/l,m=a/l,h=c/l,d=u+u,p=f+f,b=m+m,M=u*d,g=u*p,S=u*b,_=f*p,I=f*b,y=m*b,x=h*d,P=h*p,R=h*b;return[(1-(_+y))*r[0],(g+R)*r[0],(S-P)*r[0],0,(g-R)*r[1],(1-(M+y))*r[1],(I+x)*r[1],0,(S+P)*r[2],(I-x)*r[2],(1-(M+_))*r[2],0,n[0],n[1],n[2],1]}function rb(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 ib(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],s=e[9],a=e[2],c=e[6],l=e[10],u=i*l-s*c,f=s*a-r*l,m=r*c-i*a,h=t*u+n*f+o*m;if(Math.abs(h)<1e-12)return null;let d=1/h;return[u*d,f*d,m*d,(o*c-n*l)*d,(t*l-o*a)*d,(n*a-t*c)*d,(n*s-o*i)*d,(o*r-t*s)*d,(t*i-n*r)*d]}function Uc(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,s=e[6]*t+e[7]*n+e[8]*o,a=Math.hypot(r,i,s)||1;return r/=a,i/=a,s/=a,[r,i,s]}function sb(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),s=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let a=e.subarray(n,n+i);if(s===1313821514&&!o)try{let c=JSON.parse(new TextDecoder().decode(a).replace(/[\u0000 ]+$/g,""));if(!ke(c))return null;o=c}catch{return null}else if(s===5130562&&!r)r=a;else return null;n+=i}return n===e.byteLength&&o&&r?{json:o,bin:r}:null}function ab(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function cb(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function lb(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 ub(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=sb(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!ke(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=De(o.extensionsUsed).filter(P=>typeof P=="string");if(i.includes("KHR_draco_mesh_compression")||eb(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||De(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(De(o.images).length||De(o.textures).length)return{ok:!1,issue:"external_resource"};let s=De(o.buffers);if(s.length!==1||!ke(s[0])||s[0].uri!==void 0||typeof s[0].byteLength!="number"||!Number.isInteger(s[0].byteLength)||s[0].byteLength<0||s[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let a=De(o.accessors),c=De(o.bufferViews),l=De(o.meshes),u=De(o.nodes),f=De(o.scenes),m=typeof o.scene=="number"?o.scene:0;if(!ke(f[m]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(r.buffer,r.byteOffset,r.byteLength),d=(P,R,v,T=!1)=>{if(typeof P!="number"||!Number.isInteger(P)||!ke(a[P]))return null;let k=a[P],C=typeof R=="string"?k.type===R:R.includes(k.type),E=k.componentType!==5126,A=T&&E?k.normalized===!0:k.normalized!==!0;if(!C||k.sparse!==void 0||!A||typeof k.count!="number"||!Number.isInteger(k.count)||k.count<1||typeof k.componentType!="number"||!v.includes(k.componentType)||typeof k.bufferView!="number")return null;let O=c[k.bufferView];if(!ke(O)||O.buffer!==0||typeof O.byteLength!="number"||!Number.isInteger(O.byteLength)||O.byteLength<0)return null;let F=cb(k.type),L=ab(k.componentType),B=typeof O.byteStride=="number"?O.byteStride:F*L,D=typeof O.byteOffset=="number"?O.byteOffset:0,j=typeof k.byteOffset=="number"?k.byteOffset:0,G=D+j,V=j+(k.count-1)*B+F*L;if(!Number.isInteger(B)||!Number.isInteger(D)||!Number.isInteger(j)||B<F*L||D<0||j<0||D+O.byteLength>r.byteLength||V>O.byteLength)return null;let U=[];for(let z=0;z<k.count;z++){let X=[];for(let Q=0;Q<F;Q++){let q=lb(h,G+z*B+Q*L,k.componentType);if(!Number.isFinite(q))return null;X.push(q)}U.push(X)}return U},p=[],b=[],M=[],g=!1,S=De(o.materials),_=P=>{if(P===void 0)return null;if(typeof P!="number"||!Number.isInteger(P)||!ke(S[P]))return!1;let R=S[P].pbrMetallicRoughness;if(R===void 0)return null;if(!ke(R))return!1;if(R.baseColorFactor===void 0)return null;let v=wn(R.baseColorFactor,4);return!v||v.some(T=>T<0||T>1)?!1:[v[0],v[1],v[2]]},I=0,y=new Set,x=(P,R)=>{if(typeof P!="number"||!Number.isInteger(P)||!ke(u[P])||y.has(P))return!1;y.add(P);let v=u[P],T=ob(v);if(!T)return!1;let k=nb(R,T),C=ib(k);if(!C)return!1;if(v.mesh!==void 0){if(typeof v.mesh!="number")return!1;let E=l[v.mesh];if(!ke(E))return!1;for(let A of De(E.primitives)){if(!ke(A)||A.mode!==void 0&&A.mode!==4||!ke(A.attributes))return!1;let O=d(A.attributes.POSITION,"VEC3",[5126]),F=A.attributes.NORMAL===void 0?null:d(A.attributes.NORMAL,"VEC3",[5126]);if(!O||A.attributes.NORMAL!==void 0&&!F)return!1;let L=_(A.material);if(L===!1)return!1;let B=A.attributes.COLOR_0===void 0?null:d(A.attributes.COLOR_0,["VEC3","VEC4"],[5126,5121,5123],!0);if(A.attributes.COLOR_0!==void 0&&(!B||B.length!==O.length))return!1;let D=B?a[A.attributes.COLOR_0]:null,j=!D||D.componentType===5126?1:D.componentType===5121?1/255:1/65535,G=L!==null||B!==null;G&&(g=!0);let V=O.length;if(A.indices!==void 0){let z=typeof A.indices=="number"?a[A.indices]:null;V=ke(z)?z.count:void 0}if(typeof V!="number"||!Number.isInteger(V)||V%3!==0||(I+=V/3,I>1e5))return!1;let U=A.indices===void 0?O.map((z,X)=>[X]):d(A.indices,"SCALAR",[5121,5123,5125]);if(!U||U.length%3!==0||U.length!==V)return!1;for(let z=0;z<U.length;z+=3){let X=[U[z][0],U[z+1][0],U[z+2][0]];if(X.some(oe=>!Number.isInteger(oe)||oe<0||oe>=O.length))return!1;let Q=X.map(oe=>rb(k,...O[oe])),q=null;if(!F){let oe=Q[1][0]-Q[0][0],se=Q[1][1]-Q[0][1],le=Q[1][2]-Q[0][2],de=Q[2][0]-Q[0][0],pe=Q[2][1]-Q[0][1],_e=Q[2][2]-Q[0][2];q=Uc([1,0,0,0,1,0,0,0,1],se*_e-le*pe,le*de-oe*_e,oe*pe-se*de)}for(let oe=0;oe<3;oe++){if(p.push(...Q[oe]),b.push(...F?Uc(C,...F[X[oe]]):q),!G){M.push(-1,-1,-1);continue}let se=B?B[X[oe]]:null;for(let le=0;le<3;le++)M.push(Jp((L?L[le]:1)*(se?se[le]*j:1)))}}}}for(let E of De(v.children))if(!x(E,k))return!1;return y.delete(P),!0};for(let P of De(f[m].nodes))if(!x(P,tb()))return{ok:!1,issue:I>1e5?"triangle_limit":"unsupported_glb"};return!I||p.length!==I*9||b.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:I,position:new Float32Array(p),normal:new Float32Array(b),color:g?new Float32Array(M):null}}function Xc(e){try{return ub(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Kc(e){let{doc:t}=e,n=ys(t,e.eventConfigurationId??t.eventConfigurationId),o=ji(t.theme,_s(n,e.seats)),r=o.structure,i=Vc(e.eventConfigurationId,e.eventConfiguration,n),s=e.seats,a=new Nn,c=null;if(e.registeredShellGlb){let H=Xc(e.registeredShellGlb);if(H.ok){let N=H.position.length/3,K=new Float32Array(H.position.length),Z=o.materials.shell??r.tierWall,te=H.color;for(let re=0;re<N;re++){let ue=H.normal[re*3+1],ae=ue<-.25?.4:.62+.38*Math.max(0,ue),Le=!!te&&te[re*3]!==-1;K[re*3]=(Le?te[re*3]:Z[0])*ae,K[re*3+1]=(Le?te[re*3+1]:Z[1])*ae,K[re*3+2]=(Le?te[re*3+2]:Z[2])*ae}c={position:H.position,normal:H.normal,color:K,floor:new Float32Array(N).fill(-2),material:new Float32Array(N),count:N}}}let l=new Map;for(let H of n)for(let N of H.objects)l.set(N.id,H.index),N.type==="section"&&l.set(N.logicalSectionId??N.id,H.index);let u=s.map(H=>l.get(H.sectionId??"")??l.get(H.rowId??"")??0),f=Hr(n,s),m=a.vertexCount,d=Gc(a,n,s,u,f,r)?a.vertexCount:m,p=Wi(t,s),b=new Map,M=new Map;for(let H of t.categories??[])b.set(H.key,H.color),H.seatGlyph&&M.set(H.key,H.seatGlyph);let g=[],S=Ma(n,s,u),_=new Map;s.forEach((H,N)=>{let K=S.seatDeckY(N);Number.isFinite(K)&&_.set(H.rowId,Math.min(_.get(H.rowId)??1/0,K))});let I=new Float32Array(s.length),y=[],x=new Map((t.floors??[]).map((H,N)=>[H.id,N])),P=n.map(()=>[]);for(let H of s){let N=H.floorId?x.get(H.floorId)??0:0;P[Math.min(N,P.length-1)]?.push(H)}let R=(H,N)=>{if(!N||N.length<3)return!1;let K=Math.min(...N.map(ue=>ue.x)),Z=Math.max(...N.map(ue=>ue.x)),te=Math.min(...N.map(ue=>ue.y)),re=Math.max(...N.map(ue=>ue.y));for(let ue=0;ue<H;ue++)for(let ae of P[ue])if(!(ae.x<K||ae.x>Z||ae.y<te||ae.y>re)&&Ee(ae,N,void 0))return!0;return!1},v=Qn(n),T=null,k=H=>n.length===1?s:s.filter((N,K)=>u[K]===H),C=(H,N)=>{let K=Je(H);if(!K)return!1;let Z=1/0,te=1/0,re=-1/0,ue=-1/0;for(let ae of K)Z=Math.min(Z,ae.x),re=Math.max(re,ae.x),te=Math.min(te,ae.y),ue=Math.max(ue,ae.y);return s.some((ae,Le)=>ae.kind!=="booth"&&(n.length===1||u[Le]===N)&&ae.x>Z&&ae.x<re&&ae.y>te&&ae.y<ue&&Ce(K,ae.x,ae.y))},E,A=[],O;for(let H=0;H<n.length;H++){let N=n[H];a.setFloor(H);let K=bt(N,k(H)),Z=0;if(K){let J=0;for(let Me of N.objects)if(Me.type==="section")for(let at of S.bySection.get(Me.id)?.rowLevels??[])J=Math.max(J,at.y-N.baseHeightM);Z=da(J);for(let Me of K)A.push([Me.x*w,Me.y*w]);if(O=Math.max(O??-1/0,N.baseHeightM+Z),!E){let Me=$t(K);E={centre:[Me.x*w,Me.y*w]}}}let te=new Kn,re=[],ue=N.objects.filter(J=>J.type==="shape"&&(J.role==="entrance"||J.role==="exit")),ae=N.objects.filter(J=>J.type==="section"&&!!J.outline&&J.outline.length>=3),Le=ja(N.objects.filter(J=>J.type==="booth"),N.focal);for(let J of N.objects)if(J.type==="section"){let Me=a.vertexCount;oc(a,J,N,Yi(J,p),S.bySection.get(J.id),te,ae,r,H>0&&R(H,J.outline));let at=a.vertexCount-Me;at>0&&y.push({sectionId:J.id,start:Me,count:at})}else if(J.type==="shape"){let Me=i.byObjectId.get(J.id);if(v.has(J)&&!Me)continue;let at=g.length,xt=K!==null&&J.role==="wall"&&!Me;a.setMaterial(xt?to:(Me?.kind??J.role)==="screen"?1:0);let Xe=J.role==="stage"&&!Me?Ua(J,k(H)):xt&&J.heightM===void 0?{...J,heightM:Z}:J,yo=Rs(Xe,re);if(Fa(a,Xe,N.baseHeightM+yo.supportOffsetM,yo.topOffsetM-yo.supportOffsetM,r,N.focal,g,Me,ue),a.setMaterial(0),J.role==="stage"&&!Me&&g.length>at&&(T??H)===H){T=H;let Vr=t.floors?.[H]?.id,go=n.length>1&&Vr?s.filter(Mt=>Mt.floorId===Vr):s;Ps(a,Xe,g[g.length-1].y,go,{deck:g[g.length-1].top,night:!wt(r)});let En=Ze(Xe.stageKind)?ce(Xe):null;En&&Zs(a,Xe,En,g[g.length-1].y,go,N.objects.some(Mt=>Mt.type==="shape"&&Mt.role==="goal"),N.objects.some(Mt=>Mt.type==="shape"&&Mt.role==="dugout")),En&&St(Xe.stageKind)&&$s(a,En,g[g.length-1].y,go,ao),a.setMaterial(0)}}else J.type==="gaArea"?Ga(a,J,N.baseHeightM,me(b.get(J.categoryKey)),r):J.type==="booth"?Ta(a,J,N.baseHeightM,me(b.get(J.categoryKey)),r,Le.get(J.id)??N.focal,C(J,H)):J.type==="table"?Na(a,J,Math.max(N.baseHeightM,_.get(J.id)??N.baseHeightM),me(J.fill??t.theme?.decorFill??"#232c40"),r,!!(J.fill??t.theme?.decorFill)):J.type==="decorImage"&&Da(a,J,N.baseHeightM,r);K&&Ic(a,N.objects,K,N.baseHeightM,Z,N.focal,r,J=>!i.byObjectId.has(J.id)),ic(a,N,s,S,r,o.materials.shell,!c)}let F=n.length>1?{x:n.reduce((H,N)=>H+N.focal.x,0)/n.length,y:n.reduce((H,N)=>H+N.focal.y,0)/n.length}:t.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},L=Ei(c?[a.build(),c]:[a.build()]),B=new Map;for(let H of n)for(let N of H.objects)N.type==="table"&&B.set(N.id,N.center);let D=rs(s,e.initialState,S,I,b,M,new Set(B.keys())),j=Cc({doc:t,units:n,seats:s,surfaces:S,focal:F}),{labels:G,sections:V,rows:U}=vc({doc:t,units:n,seats:s,surfaces:S,seatData:D,hintedSeatFloor:u,zones:j,focal:F}),z=new Map(V.map((H,N)=>[H.id,N]));S.seatOwner.forEach((H,N)=>{D.iSection[N]=H?z.get(H)??-1:-1});let X=Oc({doc:t,units:n,seats:s,surfaces:S,solids:L,hintedSeatFloor:u,seatFloor:I});kc(G,X),D.iYaw=ns(D.iPosition,s.length,H=>s[H].rowId,H=>{let N=n[I[H]]?.focal??F;return[N.x*w,N.y*w]},H=>{let N=B.get(s[H].rowId);return N?[N.x*w,N.y*w]:void 0});let Q=(f.minX+f.maxX)/2*w,q=(f.minY+f.maxY)/2*w,oe=.5*Math.hypot((f.maxX-f.minX)*w,(f.maxY-f.minY)*w)||10,se=jr(L,D,{cx:Q,cz:q,radius:oe},[m,d]),le=jr(L,D,{cx:Q,cz:q,radius:oe}),de=mb(n),pe=jc(D,g,f,se.minY,se.maxY,oe,de),_e=!E&&n.some(H=>H.objects.some(N=>N.type==="shape"&&St(N.stageKind))),Oe=!!o.house&&!_e&&!c&&(!!E||o.house.indoor),Ge=g.flatMap(H=>[[H.cx-H.halfX,H.cz-H.halfZ],[H.cx+H.halfX,H.cz-H.halfZ],[H.cx+H.halfX,H.cz+H.halfZ],[H.cx-H.halfX,H.cz+H.halfZ]]),He=Oe?pa(D.iPosition,s.length,n[0]?.baseHeightM??0,[...Ge,...A],O):null;return{sharedAisles:Ai(n.flatMap(H=>H.objects.flatMap(N=>{if(N.type!=="section")return[];let K=S.bySection.get(N.id);return K?[{sectionId:N.id,floorIndex:H.index,rows:K.rowLevels}]:[]}))),solids:L,sectionSolidRanges:y,seats:D,seatSectionIds:S.seatOwner,bounds:{center:[(pe.min[0]+pe.max[0])/2,(pe.min[1]+pe.max[1])/2,(pe.min[2]+pe.max[2])/2],radius:oe,groundY:0,box:pe,fitPoints:Hc(D,g,de)},...E?{room:E}:{},..._e?{outdoor:!0}:{},...He?{house:He}:{},renderBounds:{center:se.center,radius:se.radius},clipBounds:{center:le.center,radius:le.radius},stateColorLUT:Vi(o,Hn),theme:o,seatCount:s.length,focalWorld:[F.x*w,1.5,F.y*w],zones:j,stages:g,productionElements:i.elements,sections:V,rows:U,labels:G,floors:X}}function mb(e){let t=[];for(let n of e)for(let o of n.objects){let r=o.type==="gaArea"?o.points:o.type==="booth"?Je(o):null;for(let i of r??[])t.push([i.x*w,n.baseHeightM,i.y*w])}return t}function hb(e,t){let{doc:n,report:o}=bc(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)})),f=new Float64Array(t.length).fill(Number.NaN),m=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((h,d)=>{h.eyeHeightM!==void 0&&(f[d]=h.eyeHeightM),h.focalPoint&&(m[d*2]=h.focalPoint.x,m[d*2+1]=h.focalPoint.y)}),{doc:{...e,objects:u?.[0]?.objects??l(e.objects),...u?{floors:u}:{}},report:o,eyeHeightM:f,focal:m}}let i=new Map(Nt(n).map(c=>[c.id,c])),s=new Float64Array(t.length).fill(Number.NaN),a=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,l)=>{let u=i.get(c.id)??c;u.eyeHeightM!==void 0&&(s[l]=u.eyeHeightM),u.focalPoint&&(a[l*2]=u.focalPoint.x,a[l*2+1]=u.focalPoint.y)}),{doc:n,report:o,eyeHeightM:s,focal:a}}function db(e,t){return e.map((n,o)=>{let r=t.eyeHeightM[o],i=t.focal[o*2],s=t.focal[o*2+1],a={...n};return Number.isNaN(r)?delete a.eyeHeightM:a.eyeHeightM=r,Number.isNaN(i)?delete a.focalPoint:a.focalPoint={x:i,y:s},a})}function Wc(e){let t=e.estimate===!1?null:hb(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:db(e.seats,t)},estimate:t}:{input:e}}function pb(e){return[e.solids.position,e.solids.normal,e.solids.color,e.solids.floor,e.solids.material,e.seats.iPosition,e.seats.iState,e.seats.iCategory,e.seats.iMaxRadius,e.seats.iRing,e.seats.iFloor,e.seats.iYaw,e.seats.iChairWidth,e.seats.iGlyph,e.seats.iPhysicalSeat,e.seats.iArmrests].map(n=>n.buffer)}var Yc=self;Yc.onmessage=e=>{let t=performance.now(),n=!e.data.seats,o=e.data.seats??Nt(e.data.doc),{input:r,estimate:i}=Wc({doc:e.data.doc,seats:o,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb,estimate:e.data.estimate}),s=Kc(r),a=pb(s);i&&a.push(i.eyeHeightM.buffer,i.focal.buffer),Yc.postMessage({model:s,buildMs:performance.now()-t,...n?{seats:o}:{},...i?{estimate:i}:{}},a)};