@seatlayer/core 0.69.0 → 0.71.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 (140) hide show
  1. package/dist/ar-R52D47QC.js +1 -0
  2. package/dist/be-P34NRZPF.js +1 -0
  3. package/dist/bg-4TEE6DSQ.js +1 -0
  4. package/dist/ca-V4A6DRPR.js +1 -0
  5. package/dist/{categoryInventory-DLDU-RSw.d.ts → categoryInventory-BiUDSvBt.d.ts} +1 -1
  6. package/dist/{categoryInventory-DZapeGK6.d.cts → categoryInventory-DBqgM5in.d.cts} +1 -1
  7. package/dist/{chunk-6JWYLLWU.js → chunk-5AHUGRHH.js} +1 -1
  8. package/dist/{chunk-RMNTGICO.js → chunk-652LV66L.js} +1 -1
  9. package/dist/{chunk-BV6FHURE.js → chunk-7OJ6SB6V.js} +1 -1
  10. package/dist/{chunk-HZT2U5IY.js → chunk-A27USMF7.js} +1 -1
  11. package/dist/{chunk-YYRUKI7A.js → chunk-AWPHGLTU.js} +1 -1
  12. package/dist/{chunk-WZ6ZNPNT.js → chunk-UHPX2P7O.js} +1 -1
  13. package/dist/{chunk-QYZ3P5L6.js → chunk-WXWJZ5DO.js} +1 -1
  14. package/dist/chunk-WYXHD6J2.js +1 -0
  15. package/dist/chunk-X3K36XZM.js +1 -0
  16. package/dist/core/chart-ops/index.cjs +1 -1
  17. package/dist/core/chart-ops/index.d.cts +4 -4
  18. package/dist/core/chart-ops/index.d.ts +4 -4
  19. package/dist/core/chart-ops/index.js +1 -1
  20. package/dist/core/inventory/index.d.cts +4 -4
  21. package/dist/core/inventory/index.d.ts +4 -4
  22. package/dist/core/inventory/index.js +1 -1
  23. package/dist/core/layout/index.cjs +1 -1
  24. package/dist/core/layout/index.d.cts +4 -4
  25. package/dist/core/layout/index.d.ts +4 -4
  26. package/dist/core/layout/index.js +1 -1
  27. package/dist/core/quality/index.d.cts +3 -3
  28. package/dist/core/quality/index.d.ts +3 -3
  29. package/dist/core/render-assets/index.d.cts +1 -1
  30. package/dist/core/render-assets/index.d.ts +1 -1
  31. package/dist/core/render-assets/index.js +1 -1
  32. package/dist/core/seatConfidence.d.cts +1 -1
  33. package/dist/core/seatConfidence.d.ts +1 -1
  34. package/dist/core/sections/index.d.cts +5 -5
  35. package/dist/core/sections/index.d.ts +5 -5
  36. package/dist/core/sections/index.js +1 -1
  37. package/dist/cs-GR5H3ZRU.js +1 -0
  38. package/dist/cy-XWYNMRNE.js +1 -0
  39. package/dist/da-NOYMEVP6.js +1 -0
  40. package/dist/de-LFHFC2XO.js +1 -0
  41. package/dist/el-AS3436E6.js +1 -0
  42. package/dist/es-IWBWYUHH.js +1 -0
  43. package/dist/et-VV7YGFEV.js +1 -0
  44. package/dist/{eventConfigurations-kZpADDdx.d.ts → eventConfigurations-CA2XhDig.d.ts} +1 -1
  45. package/dist/{eventConfigurations-C_dst7Ro.d.cts → eventConfigurations-Csdxe89O.d.cts} +1 -1
  46. package/dist/fa-JYLN4BIM.js +1 -0
  47. package/dist/fi-TXRN726I.js +1 -0
  48. package/dist/fr-PKEU6NKI.js +1 -0
  49. package/dist/he-H53ZPEAF.js +1 -0
  50. package/dist/hr-AIG6RMUY.js +1 -0
  51. package/dist/hu-KE64252D.js +1 -0
  52. package/dist/index.cjs +1 -1
  53. package/dist/index.d.cts +225 -102
  54. package/dist/index.d.ts +225 -102
  55. package/dist/index.js +1 -1
  56. package/dist/it-GVT7VIKV.js +1 -0
  57. package/dist/ja-WMRRUDVD.js +1 -0
  58. package/dist/ku-77V6NTW7.js +1 -0
  59. package/dist/{labeling-Br0U7E-5.d.ts → labeling-CxZWjZBN.d.ts} +1 -1
  60. package/dist/{labeling-B07AFOvn.d.cts → labeling-DG-Sc8VW.d.cts} +1 -1
  61. package/dist/{layout-D2zJUmzs.d.ts → layout-BxJIZjPm.d.cts} +19 -5
  62. package/dist/{layout-CpnMRaZF.d.cts → layout-C6YaCOnZ.d.ts} +19 -5
  63. package/dist/localeLoaders-EMBA3SWS.js +1 -0
  64. package/dist/lt-7ICKT4ED.js +1 -0
  65. package/dist/lv-NTO2456Y.js +1 -0
  66. package/dist/nl-IYEEWC4A.js +1 -0
  67. package/dist/no-CKH6R5N2.js +1 -0
  68. package/dist/pl-ALK57HKB.js +1 -0
  69. package/dist/pt-EYFSXBVZ.js +1 -0
  70. package/dist/{renderedQuality-TApmHr3Q.d.ts → renderedQuality-CWwy14lb.d.ts} +1 -1
  71. package/dist/{renderedQuality-sc_d2CfA.d.cts → renderedQuality-CgBQYezj.d.cts} +1 -1
  72. package/dist/{renderer-BiCXjFCG.d.ts → renderer-DIcDImOu.d.ts} +56 -1
  73. package/dist/{renderer-CXwpt_qs.d.cts → renderer-DmG3C8vD.d.cts} +56 -1
  74. package/dist/ro-EUFVCBVY.js +1 -0
  75. package/dist/ru-XAIYWENX.js +1 -0
  76. package/dist/{sections-DCRfHaw4.d.ts → sections-87qiciyN.d.ts} +1 -1
  77. package/dist/{sections-BjzyfqGZ.d.cts → sections-Bb0L9lDT.d.cts} +1 -1
  78. package/dist/{segmentedRowModel-jfYcGWPd.d.cts → segmentedRowModel-BqiM0U65.d.cts} +1 -1
  79. package/dist/{segmentedRowModel-DQggl3UO.d.ts → segmentedRowModel-CEP6crcl.d.ts} +1 -1
  80. package/dist/sk-QIOFO4TV.js +1 -0
  81. package/dist/sl-37I57K2X.js +1 -0
  82. package/dist/sr-HE5DILFD.js +1 -0
  83. package/dist/sv-7SVBFLY3.js +1 -0
  84. package/dist/{ticketRestrictions-BjEP4hnD.d.ts → ticketRestrictions-B_qXQobd.d.ts} +2 -2
  85. package/dist/{ticketRestrictions-ChYdOguf.d.cts → ticketRestrictions-Bj8PBX_x.d.cts} +2 -2
  86. package/dist/tr-JNA4YJEJ.js +1 -0
  87. package/dist/{types-BjTzKc2D.d.cts → types-DNztpn7q.d.cts} +9 -0
  88. package/dist/{types-BjTzKc2D.d.ts → types-DNztpn7q.d.ts} +9 -0
  89. package/dist/uk-2723G7DI.js +1 -0
  90. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  91. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  92. package/dist/view3d/index.cjs +31 -31
  93. package/dist/view3d/index.d.cts +86 -4
  94. package/dist/view3d/index.d.ts +86 -4
  95. package/dist/view3d/index.js +29 -29
  96. package/dist/view3d/scene/scene.worker.cjs +1 -0
  97. package/dist/view3d/scene/scene.worker.d.cts +2 -0
  98. package/dist/view3d/scene/scene.worker.d.ts +2 -0
  99. package/dist/view3d/scene/scene.worker.js +1 -0
  100. package/dist/zh-Hans-ONBXTDHV.js +1 -0
  101. package/dist/zh-Hant-LVTMHA6P.js +1 -0
  102. package/package.json +1 -1
  103. package/dist/ar-QWMSVFMH.js +0 -1
  104. package/dist/be-3GMEVW5Q.js +0 -1
  105. package/dist/bg-W46PKTS7.js +0 -1
  106. package/dist/ca-FS3NR6VL.js +0 -1
  107. package/dist/chunk-I6DNJFRF.js +0 -1
  108. package/dist/cs-I4AKSFRV.js +0 -1
  109. package/dist/cy-ABRR65RX.js +0 -1
  110. package/dist/da-HNKK3PNG.js +0 -1
  111. package/dist/de-QUOPPJF7.js +0 -1
  112. package/dist/el-DUXSH2LY.js +0 -1
  113. package/dist/es-57EA3CTI.js +0 -1
  114. package/dist/et-RBSHG6OS.js +0 -1
  115. package/dist/fa-MJIJUBSS.js +0 -1
  116. package/dist/fi-HKF3AVOV.js +0 -1
  117. package/dist/fr-4U5K5VNS.js +0 -1
  118. package/dist/he-MIVDM6KS.js +0 -1
  119. package/dist/hr-G7RZP6DQ.js +0 -1
  120. package/dist/hu-QZE26B6N.js +0 -1
  121. package/dist/it-L2XL6VR7.js +0 -1
  122. package/dist/ja-Q64SRIIE.js +0 -1
  123. package/dist/ku-OG466MA5.js +0 -1
  124. package/dist/localeLoaders-V5HTIO2J.js +0 -1
  125. package/dist/lt-P2CZWZZL.js +0 -1
  126. package/dist/lv-IRHTS7ME.js +0 -1
  127. package/dist/nl-6WSAK5IB.js +0 -1
  128. package/dist/no-3G67YZZR.js +0 -1
  129. package/dist/pl-DUYWY7BZ.js +0 -1
  130. package/dist/pt-FNIRQMIZ.js +0 -1
  131. package/dist/ro-BBYEYZIK.js +0 -1
  132. package/dist/ru-NMG7W5QE.js +0 -1
  133. package/dist/sk-HI2H44DR.js +0 -1
  134. package/dist/sl-RBLBICUL.js +0 -1
  135. package/dist/sr-SNARC3RS.js +0 -1
  136. package/dist/sv-R7ZWBQIL.js +0 -1
  137. package/dist/tr-2JJXM4IM.js +0 -1
  138. package/dist/uk-GTBKSNLF.js +0 -1
  139. package/dist/zh-Hans-4V7ZG3GP.js +0 -1
  140. package/dist/zh-Hant-XWV277CF.js +0 -1
@@ -1 +1 @@
1
- var x="seatmap.chart";var c=[{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"}],l=new Map(c.map(e=>[e.key,e]));function w(e){return l.get(e)}var d={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 R(e){let t=e?.[0];return t&&d[t]||"#3b82f6"}var u=[{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"}],g=new Map(u.map(e=>[e.key,e]));function I(e){return g.get(e)}var A=8,E=24,b=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],m=new Set(b);function k(e){switch(e.type){case"row":case"table":case"gaArea":case"booth":case"section":return"interactive";case"decorImage":return e.layer==="foreground"?"foreground":"background";case"shape":return e.role&&m.has(e.role)?"surroundings":"background";case"text":return"background";default:return"interactive"}}var T=2e6,p=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,y=/[\s"'<>`\\]/;function f(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return p.test(e);if(y.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function O(e){let t=e.trim();return f(t)?t:null}function S(e){let t=0;for(let r=0,i=e.length;r<i;r+=1){let o=e[r],a=e[(r+1)%i];t+=o.x*a.y-a.x*o.y}return t/2}function V(e){return S(e)*2}function _(e,t,r){let i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let n=e[o],s=e[a];n.y>r!=s.y>r&&t<(s.x-n.x)*(r-n.y)/(s.y-n.y)+n.x&&(i=!i)}return i}function v(e){let t=1/0,r=1/0,i=-1/0,o=-1/0,a=!1;for(let n of e)!Number.isFinite(n.x)||!Number.isFinite(n.y)||(a=!0,n.x<t&&(t=n.x),n.y<r&&(r=n.y),n.x>i&&(i=n.x),n.y>o&&(o=n.y));return a?{minX:t,minY:r,maxX:i,maxY:o}:null}function G(e){let t=v(e);return t?h(t):null}function h(e){return{x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY}}function X(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}export{x as a,c as b,w as c,d,R as e,u as f,I as g,A as h,E as i,b as j,k,T as l,f as m,O as n,S as o,V as p,_ as q,v as r,G as s,X as t};
1
+ var x="seatmap.chart";var c=[{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"}],l=new Map(c.map(e=>[e.key,e]));function w(e){return l.get(e)}var d={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 R(e){let t=e?.[0];return t&&d[t]||"#3b82f6"}var u=[{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"}],g=new Map(u.map(e=>[e.key,e]));function I(e){return g.get(e)}var A=8,k=24,b=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],m=new Set(b);function E(e){switch(e.type){case"row":case"table":case"gaArea":case"booth":case"section":return"interactive";case"decorImage":return e.layer==="foreground"?"foreground":"background";case"shape":return e.role&&m.has(e.role)?"surroundings":"background";case"text":return"background";default:return"interactive"}}var T=2e6,p=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,y=/[\s"'<>`\\]/;function f(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return p.test(e);if(y.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function O(e){let t=e.trim();return f(t)?t:null}function S(e){let t=0;for(let r=0,i=e.length;r<i;r+=1){let o=e[r],a=e[(r+1)%i];t+=o.x*a.y-a.x*o.y}return t/2}function V(e){return S(e)*2}function _(e,t,r){let i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let n=e[o],s=e[a];n.y>r!=s.y>r&&t<(s.x-n.x)*(r-n.y)/(s.y-n.y)+n.x&&(i=!i)}return i}function v(e){let t=1/0,r=1/0,i=-1/0,o=-1/0,a=!1;for(let n of e)!Number.isFinite(n.x)||!Number.isFinite(n.y)||(a=!0,n.x<t&&(t=n.x),n.y<r&&(r=n.y),n.x>i&&(i=n.x),n.y>o&&(o=n.y));return a?{minX:t,minY:r,maxX:i,maxY:o}:null}function G(e){let t=v(e);return t?h(t):null}function h(e){return{x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY}}function X(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}export{x as a,c as b,w as c,d,R as e,u as f,I as g,A as h,k as i,b as j,E as k,T as l,f as m,O as n,v as o,G as p,X as q,S as r,V as s,_ as t};
@@ -1 +1 @@
1
- import{n as b}from"./chunk-YYRUKI7A.js";var l="seatlayer.event-configuration/1",p="seatlayer.event-configuration-export/1",c=100,_=120,S=1e5,k=1e4,y=/^[a-f0-9]{64}$/,x=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function d(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function u(e,n){return typeof e=="string"&&e.length>=1&&e.length<=n&&e.normalize("NFKC").trim()===e}function E(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function v(e){return!Array.isArray(e)||e.length>S||!e.every(n=>u(n,c))?null:[...new Set(e)].sort()}function C(e){return!d(e)||!u(e.chartId,c)||!u(e.version,c)||e.sha256!==void 0&&(typeof e.sha256!="string"||!y.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function m(e,n,t){return typeof e=="number"&&Number.isFinite(e)&&e>=n&&e<=t}function V(e){return d(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&m(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function j(e,n){if(e===void 0)return;if(!Array.isArray(e)||e.length>k)return null;let t=new Set(n),s=new Set,i=new Set,r=0,a=[];for(let o of e){if(!d(o)||!u(o.id,c)||!u(o.objectId,c)||!t.has(o.objectId)||!x.has(String(o.kind))||!m(o.heightM,.05,50)||o.baseElevationM!==void 0&&!m(o.baseElevationM,-10,100))return null;let f=V(o.occlusion);if(!f||s.has(o.id)||i.has(o.objectId))return null;let g=o.contentImageUrl===void 0?void 0:typeof o.contentImageUrl=="string"?b(o.contentImageUrl):null;if(o.contentImageUrl!==void 0&&(!g||o.kind!=="screen"||++r>1))return null;s.add(o.id),i.add(o.objectId),a.push({id:o.id,objectId:o.objectId,kind:o.kind,heightM:o.heightM,...o.baseElevationM!==void 0?{baseElevationM:o.baseElevationM}:{},occlusion:f,...g?{contentImageUrl:g}:{}})}return a.sort((o,f)=>o.id.localeCompare(f.id))}function I(e){let n=[];if(!d(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==l&&n.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${l}`}),u(e.id,c)||n.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),u(e.label,_)||n.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),E(e.version)||n.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let t=C(e.baseVenue);t||n.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let s=d(e.overlay)?e.overlay:null,i=v(s?.objectIds),r=v(s?.productionKillSeatIds),a=i?j(s?.productionElements,i):null;return(!s||!i||!r)&&n.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&n.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),n.length||!t||!i||!r||a===null?{issues:n}:{issues:n,value:{schema:l,id:e.id,label:e.label,version:e.version,baseVenue:t,overlay:{objectIds:i,productionKillSeatIds:r,...a!==void 0?{productionElements:a}:{}}}}}function R(e){let n=I(e);return n.value?{ok:!0,value:n.value}:{ok:!1,issues:n.issues}}function P(e){if(!d(e))return{ok:!1,issues:[{code:"invalid_export",path:"",message:"Export must be an object"}]};let n=[];e.schema!==p&&n.push({code:"unsupported_schema",path:"schema",message:`Export schema must be ${p}`}),(typeof e.contentSha256!="string"||!y.test(e.contentSha256))&&n.push({code:"invalid_checksum",path:"contentSha256",message:"Export checksum must be a lowercase SHA-256 digest"});let t=I(e.configuration);return n.push(...t.issues),n.length||!t.value||typeof e.contentSha256!="string"?{ok:!1,issues:n}:{ok:!0,value:{schema:p,configuration:t.value,contentSha256:e.contentSha256}}}function A(e){return JSON.stringify({schema:l,id:e.id,label:e.label,version:e.version,baseVenue:{chartId:e.baseVenue.chartId,version:e.baseVenue.version,...e.baseVenue.sha256?{sha256:e.baseVenue.sha256}:{}},overlay:{objectIds:[...new Set(e.overlay.objectIds)].sort(),productionKillSeatIds:[...new Set(e.overlay.productionKillSeatIds)].sort(),...e.overlay.productionElements!==void 0?{productionElements:[...e.overlay.productionElements].sort((n,t)=>n.id.localeCompare(t.id)).map(n=>({id:n.id,objectId:n.objectId,kind:n.kind,heightM:n.heightM,...n.baseElevationM!==void 0?{baseElevationM:n.baseElevationM}:{},occlusion:n.occlusion,...n.contentImageUrl?{contentImageUrl:n.contentImageUrl}:{}}))}:{}}})}function N(e,n){let t=[];e.baseVenue.chartId!==n.chartId&&t.push({code:"base_venue_mismatch",message:"Configuration belongs to a different base venue"}),e.baseVenue.version!==n.version&&t.push({code:"base_venue_version_mismatch",message:"Configuration was authored against a different venue version"}),e.baseVenue.sha256&&!n.sha256?t.push({code:"base_venue_checksum_missing",message:"Venue checksum is required for this configuration"}):e.baseVenue.sha256&&e.baseVenue.sha256!==n.sha256&&t.push({code:"base_venue_checksum_mismatch",message:"Venue bytes do not match the configuration base"});let s=new Set(n.objectIds);for(let r of e.overlay.objectIds)s.has(r)||t.push({code:"overlay_object_missing",message:`Production object ${r} is missing from the base venue`,targetId:r});if(n.objectTypes)for(let r of e.overlay.productionElements??[])n.objectTypes.get(r.objectId)!=="shape"&&t.push({code:"production_element_not_shape",message:`Production element ${r.id} must reference base-venue shape geometry`,targetId:r.objectId});let i=new Set(n.seatIds);for(let r of e.overlay.productionKillSeatIds)i.has(r)||t.push({code:"production_kill_seat_missing",message:`Production-kill seat ${r} is missing from the base venue`,targetId:r});return{compatible:t.length===0,issues:t}}var w={draft:new Set(["review","archived"]),review:new Set(["draft","approved","archived"]),approved:new Set(["published","archived"]),published:new Set(["archived"]),archived:new Set};function T(e,n){return e===n||w[e].has(n)}function L(e,n,t){return!E(t)||t>=n.version?null:e.find(s=>s.id===n.id&&s.version===t&&s.status==="published")??null}function O(e){return e.floors?.length?e.floors.flatMap(n=>n.objects):e.objects}function h(e,n,t){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let s of e)h(s,n,t);return}for(let[s,i]of Object.entries(e)){if(s==="eventConfigurationId"){u(i,c)?n.add(i):i!==void 0&&t.add(String(i));continue}if(s==="eventConfigurationIds"){if(!Array.isArray(i))t.add(String(i));else for(let r of i)u(r,c)?n.add(r):t.add(String(r));continue}h(i,n,t)}}}function U(e,n){let t=C(n);if(!t)return{ok:!1,invalidIds:["baseVenue"]};let s=new Set,i=new Set;if(h(e,s,i),i.size)return{ok:!1,invalidIds:[...i].sort()};let r=O(e);return{ok:!0,configurations:[...s].sort().map(a=>({schema:l,id:a,label:a,version:1,baseVenue:t,overlay:{objectIds:r.filter(o=>o.type==="shape"&&o.eventConfigurationIds?.includes(a)).map(o=>o.id).sort(),productionKillSeatIds:[]}}))}}export{l as a,p as b,R as c,P as d,A as e,N as f,T as g,L as h,U as i};
1
+ import{n as b}from"./chunk-AWPHGLTU.js";var l="seatlayer.event-configuration/1",p="seatlayer.event-configuration-export/1",c=100,_=120,S=1e5,k=1e4,y=/^[a-f0-9]{64}$/,x=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function d(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function u(e,n){return typeof e=="string"&&e.length>=1&&e.length<=n&&e.normalize("NFKC").trim()===e}function E(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function v(e){return!Array.isArray(e)||e.length>S||!e.every(n=>u(n,c))?null:[...new Set(e)].sort()}function C(e){return!d(e)||!u(e.chartId,c)||!u(e.version,c)||e.sha256!==void 0&&(typeof e.sha256!="string"||!y.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function m(e,n,t){return typeof e=="number"&&Number.isFinite(e)&&e>=n&&e<=t}function V(e){return d(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&m(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function j(e,n){if(e===void 0)return;if(!Array.isArray(e)||e.length>k)return null;let t=new Set(n),s=new Set,i=new Set,r=0,a=[];for(let o of e){if(!d(o)||!u(o.id,c)||!u(o.objectId,c)||!t.has(o.objectId)||!x.has(String(o.kind))||!m(o.heightM,.05,50)||o.baseElevationM!==void 0&&!m(o.baseElevationM,-10,100))return null;let f=V(o.occlusion);if(!f||s.has(o.id)||i.has(o.objectId))return null;let g=o.contentImageUrl===void 0?void 0:typeof o.contentImageUrl=="string"?b(o.contentImageUrl):null;if(o.contentImageUrl!==void 0&&(!g||o.kind!=="screen"||++r>1))return null;s.add(o.id),i.add(o.objectId),a.push({id:o.id,objectId:o.objectId,kind:o.kind,heightM:o.heightM,...o.baseElevationM!==void 0?{baseElevationM:o.baseElevationM}:{},occlusion:f,...g?{contentImageUrl:g}:{}})}return a.sort((o,f)=>o.id.localeCompare(f.id))}function I(e){let n=[];if(!d(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==l&&n.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${l}`}),u(e.id,c)||n.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),u(e.label,_)||n.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),E(e.version)||n.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let t=C(e.baseVenue);t||n.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let s=d(e.overlay)?e.overlay:null,i=v(s?.objectIds),r=v(s?.productionKillSeatIds),a=i?j(s?.productionElements,i):null;return(!s||!i||!r)&&n.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&n.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),n.length||!t||!i||!r||a===null?{issues:n}:{issues:n,value:{schema:l,id:e.id,label:e.label,version:e.version,baseVenue:t,overlay:{objectIds:i,productionKillSeatIds:r,...a!==void 0?{productionElements:a}:{}}}}}function R(e){let n=I(e);return n.value?{ok:!0,value:n.value}:{ok:!1,issues:n.issues}}function P(e){if(!d(e))return{ok:!1,issues:[{code:"invalid_export",path:"",message:"Export must be an object"}]};let n=[];e.schema!==p&&n.push({code:"unsupported_schema",path:"schema",message:`Export schema must be ${p}`}),(typeof e.contentSha256!="string"||!y.test(e.contentSha256))&&n.push({code:"invalid_checksum",path:"contentSha256",message:"Export checksum must be a lowercase SHA-256 digest"});let t=I(e.configuration);return n.push(...t.issues),n.length||!t.value||typeof e.contentSha256!="string"?{ok:!1,issues:n}:{ok:!0,value:{schema:p,configuration:t.value,contentSha256:e.contentSha256}}}function A(e){return JSON.stringify({schema:l,id:e.id,label:e.label,version:e.version,baseVenue:{chartId:e.baseVenue.chartId,version:e.baseVenue.version,...e.baseVenue.sha256?{sha256:e.baseVenue.sha256}:{}},overlay:{objectIds:[...new Set(e.overlay.objectIds)].sort(),productionKillSeatIds:[...new Set(e.overlay.productionKillSeatIds)].sort(),...e.overlay.productionElements!==void 0?{productionElements:[...e.overlay.productionElements].sort((n,t)=>n.id.localeCompare(t.id)).map(n=>({id:n.id,objectId:n.objectId,kind:n.kind,heightM:n.heightM,...n.baseElevationM!==void 0?{baseElevationM:n.baseElevationM}:{},occlusion:n.occlusion,...n.contentImageUrl?{contentImageUrl:n.contentImageUrl}:{}}))}:{}}})}function N(e,n){let t=[];e.baseVenue.chartId!==n.chartId&&t.push({code:"base_venue_mismatch",message:"Configuration belongs to a different base venue"}),e.baseVenue.version!==n.version&&t.push({code:"base_venue_version_mismatch",message:"Configuration was authored against a different venue version"}),e.baseVenue.sha256&&!n.sha256?t.push({code:"base_venue_checksum_missing",message:"Venue checksum is required for this configuration"}):e.baseVenue.sha256&&e.baseVenue.sha256!==n.sha256&&t.push({code:"base_venue_checksum_mismatch",message:"Venue bytes do not match the configuration base"});let s=new Set(n.objectIds);for(let r of e.overlay.objectIds)s.has(r)||t.push({code:"overlay_object_missing",message:`Production object ${r} is missing from the base venue`,targetId:r});if(n.objectTypes)for(let r of e.overlay.productionElements??[])n.objectTypes.get(r.objectId)!=="shape"&&t.push({code:"production_element_not_shape",message:`Production element ${r.id} must reference base-venue shape geometry`,targetId:r.objectId});let i=new Set(n.seatIds);for(let r of e.overlay.productionKillSeatIds)i.has(r)||t.push({code:"production_kill_seat_missing",message:`Production-kill seat ${r} is missing from the base venue`,targetId:r});return{compatible:t.length===0,issues:t}}var w={draft:new Set(["review","archived"]),review:new Set(["draft","approved","archived"]),approved:new Set(["published","archived"]),published:new Set(["archived"]),archived:new Set};function T(e,n){return e===n||w[e].has(n)}function L(e,n,t){return!E(t)||t>=n.version?null:e.find(s=>s.id===n.id&&s.version===t&&s.status==="published")??null}function O(e){return e.floors?.length?e.floors.flatMap(n=>n.objects):e.objects}function h(e,n,t){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let s of e)h(s,n,t);return}for(let[s,i]of Object.entries(e)){if(s==="eventConfigurationId"){u(i,c)?n.add(i):i!==void 0&&t.add(String(i));continue}if(s==="eventConfigurationIds"){if(!Array.isArray(i))t.add(String(i));else for(let r of i)u(r,c)?n.add(r):t.add(String(r));continue}h(i,n,t)}}}function U(e,n){let t=C(n);if(!t)return{ok:!1,invalidIds:["baseVenue"]};let s=new Set,i=new Set;if(h(e,s,i),i.size)return{ok:!1,invalidIds:[...i].sort()};let r=O(e);return{ok:!0,configurations:[...s].sort().map(a=>({schema:l,id:a,label:a,version:1,baseVenue:t,overlay:{objectIds:r.filter(o=>o.type==="shape"&&o.eventConfigurationIds?.includes(a)).map(o=>o.id).sort(),productionKillSeatIds:[]}}))}}export{l as a,p as b,R as c,P as d,A as e,N as f,T as g,L as h,U as i};
@@ -1 +1 @@
1
- import{x as X}from"./chunk-I6DNJFRF.js";var Y=9;function E(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let e=t.width/2,o=t.height/2,n=t.rotation??0;if(!n)return{hx:e,hy:o};let r=n*Math.PI/180,s=Math.abs(Math.cos(r)),c=Math.abs(Math.sin(r));return{hx:e*s+o*c,hy:e*c+o*s}}function B(t,e,o){let n=e-t.seat.x,r=o-t.seat.y;if(t.shape.kind==="circle")return n*n+r*r<=t.shape.r*t.shape.r;let s=t.shape.rotation??0,c=n,d=r;if(s){let u=-s*Math.PI/180,m=Math.cos(u),y=Math.sin(u);c=n*m-r*y,d=n*y+r*m}return Math.abs(c)<=t.shape.width/2&&Math.abs(d)<=t.shape.height/2}function L(t,e,o,n,r){if(t.shape.kind==="circle"){let h=Math.min(Math.max(t.seat.x,e),n),l=Math.min(Math.max(t.seat.y,o),r),x=t.seat.x-h,p=t.seat.y-l;return x*x+p*p<=t.shape.r*t.shape.r}let s=t.shape.rotation??0;if(!s)return t.seat.x-t.hx<=n&&t.seat.x+t.hx>=e&&t.seat.y-t.hy<=r&&t.seat.y+t.hy>=o;let c=s*Math.PI/180,d=Math.cos(c),u=Math.sin(c),m=t.shape.width/2,y=t.shape.height/2,f=[[-m,-y],[m,-y],[m,y],[-m,y]].map(([h,l])=>[t.seat.x+h*d-l*u,t.seat.y+h*u+l*d]),P=[[e,o],[n,o],[n,r],[e,r]],A=[[1,0],[0,1],[d,u],[-u,d]];for(let[h,l]of A){let x=1/0,p=-1/0;for(let[I,D]of f){let a=I*h+D*l;a<x&&(x=a),a>p&&(p=a)}let M=1/0,S=-1/0;for(let[I,D]of P){let a=I*h+D*l;a<M&&(M=a),a>S&&(S=a)}if(p<M||S<x)return!1}return!0}function j(t,e={}){let o=e.seatRadius??Y,n=t.length,r=new Array(n),s=1/0,c=1/0,d=-1/0,u=-1/0,m=0;for(let a=0;a<n;a++){let i=t[a],R=e.shapeOf?.(i)??{kind:"circle",r:o},{hx:w,hy:b}=E(R);r[a]={seat:i,shape:R,hx:w,hy:b},i.x-w<s&&(s=i.x-w),i.y-b<c&&(c=i.y-b),i.x+w>d&&(d=i.x+w),i.y+b>u&&(u=i.y+b),w>m&&(m=w),b>m&&(m=b)}n===0&&(s=0,c=0,d=0,u=0);let y=m>0?m*4:1,f=Math.max(d-s,0),P=Math.max(u-c,0),A=Math.max(64,e.maxCells??n*4),h=y,l=Math.max(1,Math.ceil(f/h)||1),x=Math.max(1,Math.ceil(P/h)||1);for(;l*x>A&&(l>1||x>1);)h*=2,l=Math.max(1,Math.ceil(f/h)||1),x=Math.max(1,Math.ceil(P/h)||1);let p=l*x,M=new Int32Array(p+1),S=0;for(let a=0;a<n;a++){let i=r[a],R=X(Math.floor((i.seat.x-i.hx-s)/h),0,l-1),w=X(Math.floor((i.seat.x+i.hx-s)/h),0,l-1),b=X(Math.floor((i.seat.y-i.hy-c)/h),0,x-1),k=X(Math.floor((i.seat.y+i.hy-c)/h),0,x-1);for(let C=b;C<=k;C++)for(let g=R;g<=w;g++)M[C*l+g+1]++,S++}for(let a=0;a<p;a++)M[a+1]+=M[a];let I=new Int32Array(S),D=M.slice(0,p);for(let a=0;a<n;a++){let i=r[a],R=X(Math.floor((i.seat.x-i.hx-s)/h),0,l-1),w=X(Math.floor((i.seat.x+i.hx-s)/h),0,l-1),b=X(Math.floor((i.seat.y-i.hy-c)/h),0,x-1),k=X(Math.floor((i.seat.y+i.hy-c)/h),0,x-1);for(let C=b;C<=k;C++)for(let g=R;g<=w;g++){let v=C*l+g;I[D[v]++]=a}}return{seats:t,entries:r,minX:s,minY:c,cell:h,cols:l,rows:x,cellStart:M,items:I,stamp:new Int32Array(n),epoch:0}}function q(t,e,o={}){let{cols:n,rows:r,cell:s,minX:c,minY:d,cellStart:u,items:m,entries:y}=t,f=Math.floor((e.x-c)/s),P=Math.floor((e.y-d)/s);if(f<0||P<0||f>=n||P>=r)return null;let A=P*n+f,h=u[A+1],l=-1,x=1/0;for(let p=u[A];p<h;p++){let M=m[p],S=y[M];if(o.filter&&!o.filter(S.seat.id,S.seat)||!B(S,e.x,e.y))continue;let I=e.x-S.seat.x,D=e.y-S.seat.y,a=I*I+D*D;(a<x||a===x&&M<l)&&(x=a,l=M)}return l<0?null:y[l].seat.id}function F(t,e,o,n={}){if(!(o>0))return null;let{cols:r,rows:s,cell:c,minX:d,minY:u,cellStart:m,items:y,entries:f}=t,P=Math.max(0,Math.floor((e.x-o-d)/c)),A=Math.min(r-1,Math.floor((e.x+o-d)/c)),h=Math.max(0,Math.floor((e.y-o-u)/c)),l=Math.min(s-1,Math.floor((e.y+o-u)/c));if(P>A||h>l)return null;let x=-1,p=o*o,M=t.stamp,S=++t.epoch;for(let I=h;I<=l;I++){let D=I*r;for(let a=P;a<=A;a++){let i=D+a,R=m[i+1];for(let w=m[i];w<R;w++){let b=y[w];if(M[b]===S)continue;M[b]=S;let k=f[b];if(n.filter&&!n.filter(k.seat.id,k.seat))continue;let C=e.x-k.seat.x,g=e.y-k.seat.y,v=C*C+g*g;(v<p||v===p&&b<x)&&(p=v,x=b)}}}return x<0?null:f[x].seat.id}function U(t,e,o={}){let n=Math.min(e.x,e.x+e.width),r=Math.max(e.x,e.x+e.width),s=Math.min(e.y,e.y+e.height),c=Math.max(e.y,e.y+e.height),d=o.mode??"center",{cols:u,rows:m,cell:y,minX:f,minY:P,cellStart:A,items:h,entries:l}=t,x=Math.max(0,Math.floor((n-f)/y)),p=Math.min(u-1,Math.floor((r-f)/y)),M=Math.max(0,Math.floor((s-P)/y)),S=Math.min(m-1,Math.floor((c-P)/y));if(x>p||M>S)return[];let I=[],D=t.stamp,a=++t.epoch;for(let i=M;i<=S;i++){let R=i*u;for(let w=x;w<=p;w++){let b=R+w,k=A[b+1];for(let C=A[b];C<k;C++){let g=h[C];if(D[g]===a)continue;D[g]=a;let v=l[g];if(o.filter&&!o.filter(v.seat.id,v.seat))continue;(d==="center"?v.seat.x>=n&&v.seat.x<=r&&v.seat.y>=s&&v.seat.y<=c:L(v,n,s,r,c))&&I.push(g)}}}return I.sort((i,R)=>i-R),I.map(i=>l[i].seat.id)}function _(t){let e=t.cols*t.rows,o=0,n=0;for(let s=0;s<e;s++){let c=t.cellStart[s+1]-t.cellStart[s];c>0&&o++,c>n&&(n=c)}let r=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:e,occupiedCells:o,refs:r,maxPerCell:n,meanPerOccupiedCell:o?r/o:0}}function N(t,e=0){let o=Math.max(1,t.width,t.height),n={x:t.x+t.width/2,y:t.y+t.height/2},r=o*1.55,s=Math.max(o*.82,Math.max(0,e)+o*.45);return{target:n,distance:r,height:s,focalLength:Math.hypot(r,s),yawRad:-8*Math.PI/180}}function O(t,e,o=0){let n=e.x-t.target.x,r=e.y-t.target.y,s=Math.cos(t.yawRad),c=Math.sin(t.yawRad),d=n*s-r*c,m=n*c+r*s-t.distance,y=o-t.height,f=Math.hypot(t.distance,t.height),P=(-t.distance*m-t.height*y)/f,A=(-t.height*m+t.distance*y)/f,h=Math.max(f*.08,P),l=t.focalLength/h;return{x:t.target.x+d*l,y:t.target.y-A*l,depth:h,scale:l}}function W(t,e){return{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function Z(t){let e=t.a*t.d-t.b*t.c;if(!Number.isFinite(e)||Math.abs(e)<1e-9)throw new Error("perspective projection produced a singular affine");let o=t.d/e,n=-t.b/e,r=-t.c/e,s=t.a/e;return{a:o,b:n,c:r,d:s,e:-(o*t.e+r*t.f),f:-(n*t.e+s*t.f)}}function z(t,e){return{a:t.a*e.a+t.c*e.b,b:t.b*e.a+t.d*e.b,c:t.a*e.c+t.c*e.d,d:t.b*e.c+t.d*e.d,e:t.a*e.e+t.c*e.f+t.e,f:t.b*e.e+t.d*e.f+t.f}}function G(t,e,o=()=>0){let n=O(t,e,o(e)),r={x:e.x+1,y:e.y},s={x:e.x,y:e.y+1},c=O(t,r,o(r)),d=O(t,s,o(s)),u=c.x-n.x,m=c.y-n.y,y=d.x-n.x,f=d.y-n.y;return{a:u,b:m,c:y,d:f,e:n.x-u*e.x-y*e.y,f:n.y-m*e.x-f*e.y}}function J(t){let e=Math.hypot(t.a,t.b),o=t.a*t.d-t.b*t.c;return{rotationDeg:Math.atan2(t.b,t.a)*180/Math.PI,scaleX:e,scaleY:o/Math.max(e,1e-9),skewX:(t.a*t.c+t.b*t.d)/Math.max(o,1e-9)}}export{Y as a,j as b,q as c,F as d,U as e,_ as f,N as g,O as h,W as i,Z as j,z as k,G as l,J as m};
1
+ import{x as X}from"./chunk-X3K36XZM.js";var Y=9;function E(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let e=t.width/2,o=t.height/2,n=t.rotation??0;if(!n)return{hx:e,hy:o};let r=n*Math.PI/180,s=Math.abs(Math.cos(r)),c=Math.abs(Math.sin(r));return{hx:e*s+o*c,hy:e*c+o*s}}function B(t,e,o){let n=e-t.seat.x,r=o-t.seat.y;if(t.shape.kind==="circle")return n*n+r*r<=t.shape.r*t.shape.r;let s=t.shape.rotation??0,c=n,d=r;if(s){let u=-s*Math.PI/180,m=Math.cos(u),y=Math.sin(u);c=n*m-r*y,d=n*y+r*m}return Math.abs(c)<=t.shape.width/2&&Math.abs(d)<=t.shape.height/2}function L(t,e,o,n,r){if(t.shape.kind==="circle"){let h=Math.min(Math.max(t.seat.x,e),n),l=Math.min(Math.max(t.seat.y,o),r),x=t.seat.x-h,p=t.seat.y-l;return x*x+p*p<=t.shape.r*t.shape.r}let s=t.shape.rotation??0;if(!s)return t.seat.x-t.hx<=n&&t.seat.x+t.hx>=e&&t.seat.y-t.hy<=r&&t.seat.y+t.hy>=o;let c=s*Math.PI/180,d=Math.cos(c),u=Math.sin(c),m=t.shape.width/2,y=t.shape.height/2,f=[[-m,-y],[m,-y],[m,y],[-m,y]].map(([h,l])=>[t.seat.x+h*d-l*u,t.seat.y+h*u+l*d]),P=[[e,o],[n,o],[n,r],[e,r]],A=[[1,0],[0,1],[d,u],[-u,d]];for(let[h,l]of A){let x=1/0,p=-1/0;for(let[I,D]of f){let a=I*h+D*l;a<x&&(x=a),a>p&&(p=a)}let M=1/0,S=-1/0;for(let[I,D]of P){let a=I*h+D*l;a<M&&(M=a),a>S&&(S=a)}if(p<M||S<x)return!1}return!0}function j(t,e={}){let o=e.seatRadius??Y,n=t.length,r=new Array(n),s=1/0,c=1/0,d=-1/0,u=-1/0,m=0;for(let a=0;a<n;a++){let i=t[a],R=e.shapeOf?.(i)??{kind:"circle",r:o},{hx:w,hy:b}=E(R);r[a]={seat:i,shape:R,hx:w,hy:b},i.x-w<s&&(s=i.x-w),i.y-b<c&&(c=i.y-b),i.x+w>d&&(d=i.x+w),i.y+b>u&&(u=i.y+b),w>m&&(m=w),b>m&&(m=b)}n===0&&(s=0,c=0,d=0,u=0);let y=m>0?m*4:1,f=Math.max(d-s,0),P=Math.max(u-c,0),A=Math.max(64,e.maxCells??n*4),h=y,l=Math.max(1,Math.ceil(f/h)||1),x=Math.max(1,Math.ceil(P/h)||1);for(;l*x>A&&(l>1||x>1);)h*=2,l=Math.max(1,Math.ceil(f/h)||1),x=Math.max(1,Math.ceil(P/h)||1);let p=l*x,M=new Int32Array(p+1),S=0;for(let a=0;a<n;a++){let i=r[a],R=X(Math.floor((i.seat.x-i.hx-s)/h),0,l-1),w=X(Math.floor((i.seat.x+i.hx-s)/h),0,l-1),b=X(Math.floor((i.seat.y-i.hy-c)/h),0,x-1),k=X(Math.floor((i.seat.y+i.hy-c)/h),0,x-1);for(let C=b;C<=k;C++)for(let g=R;g<=w;g++)M[C*l+g+1]++,S++}for(let a=0;a<p;a++)M[a+1]+=M[a];let I=new Int32Array(S),D=M.slice(0,p);for(let a=0;a<n;a++){let i=r[a],R=X(Math.floor((i.seat.x-i.hx-s)/h),0,l-1),w=X(Math.floor((i.seat.x+i.hx-s)/h),0,l-1),b=X(Math.floor((i.seat.y-i.hy-c)/h),0,x-1),k=X(Math.floor((i.seat.y+i.hy-c)/h),0,x-1);for(let C=b;C<=k;C++)for(let g=R;g<=w;g++){let v=C*l+g;I[D[v]++]=a}}return{seats:t,entries:r,minX:s,minY:c,cell:h,cols:l,rows:x,cellStart:M,items:I,stamp:new Int32Array(n),epoch:0}}function q(t,e,o={}){let{cols:n,rows:r,cell:s,minX:c,minY:d,cellStart:u,items:m,entries:y}=t,f=Math.floor((e.x-c)/s),P=Math.floor((e.y-d)/s);if(f<0||P<0||f>=n||P>=r)return null;let A=P*n+f,h=u[A+1],l=-1,x=1/0;for(let p=u[A];p<h;p++){let M=m[p],S=y[M];if(o.filter&&!o.filter(S.seat.id,S.seat)||!B(S,e.x,e.y))continue;let I=e.x-S.seat.x,D=e.y-S.seat.y,a=I*I+D*D;(a<x||a===x&&M<l)&&(x=a,l=M)}return l<0?null:y[l].seat.id}function F(t,e,o,n={}){if(!(o>0))return null;let{cols:r,rows:s,cell:c,minX:d,minY:u,cellStart:m,items:y,entries:f}=t,P=Math.max(0,Math.floor((e.x-o-d)/c)),A=Math.min(r-1,Math.floor((e.x+o-d)/c)),h=Math.max(0,Math.floor((e.y-o-u)/c)),l=Math.min(s-1,Math.floor((e.y+o-u)/c));if(P>A||h>l)return null;let x=-1,p=o*o,M=t.stamp,S=++t.epoch;for(let I=h;I<=l;I++){let D=I*r;for(let a=P;a<=A;a++){let i=D+a,R=m[i+1];for(let w=m[i];w<R;w++){let b=y[w];if(M[b]===S)continue;M[b]=S;let k=f[b];if(n.filter&&!n.filter(k.seat.id,k.seat))continue;let C=e.x-k.seat.x,g=e.y-k.seat.y,v=C*C+g*g;(v<p||v===p&&b<x)&&(p=v,x=b)}}}return x<0?null:f[x].seat.id}function U(t,e,o={}){let n=Math.min(e.x,e.x+e.width),r=Math.max(e.x,e.x+e.width),s=Math.min(e.y,e.y+e.height),c=Math.max(e.y,e.y+e.height),d=o.mode??"center",{cols:u,rows:m,cell:y,minX:f,minY:P,cellStart:A,items:h,entries:l}=t,x=Math.max(0,Math.floor((n-f)/y)),p=Math.min(u-1,Math.floor((r-f)/y)),M=Math.max(0,Math.floor((s-P)/y)),S=Math.min(m-1,Math.floor((c-P)/y));if(x>p||M>S)return[];let I=[],D=t.stamp,a=++t.epoch;for(let i=M;i<=S;i++){let R=i*u;for(let w=x;w<=p;w++){let b=R+w,k=A[b+1];for(let C=A[b];C<k;C++){let g=h[C];if(D[g]===a)continue;D[g]=a;let v=l[g];if(o.filter&&!o.filter(v.seat.id,v.seat))continue;(d==="center"?v.seat.x>=n&&v.seat.x<=r&&v.seat.y>=s&&v.seat.y<=c:L(v,n,s,r,c))&&I.push(g)}}}return I.sort((i,R)=>i-R),I.map(i=>l[i].seat.id)}function _(t){let e=t.cols*t.rows,o=0,n=0;for(let s=0;s<e;s++){let c=t.cellStart[s+1]-t.cellStart[s];c>0&&o++,c>n&&(n=c)}let r=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:e,occupiedCells:o,refs:r,maxPerCell:n,meanPerOccupiedCell:o?r/o:0}}function N(t,e=0){let o=Math.max(1,t.width,t.height),n={x:t.x+t.width/2,y:t.y+t.height/2},r=o*1.55,s=Math.max(o*.82,Math.max(0,e)+o*.45);return{target:n,distance:r,height:s,focalLength:Math.hypot(r,s),yawRad:-8*Math.PI/180}}function O(t,e,o=0){let n=e.x-t.target.x,r=e.y-t.target.y,s=Math.cos(t.yawRad),c=Math.sin(t.yawRad),d=n*s-r*c,m=n*c+r*s-t.distance,y=o-t.height,f=Math.hypot(t.distance,t.height),P=(-t.distance*m-t.height*y)/f,A=(-t.height*m+t.distance*y)/f,h=Math.max(f*.08,P),l=t.focalLength/h;return{x:t.target.x+d*l,y:t.target.y-A*l,depth:h,scale:l}}function W(t,e){return{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function Z(t){let e=t.a*t.d-t.b*t.c;if(!Number.isFinite(e)||Math.abs(e)<1e-9)throw new Error("perspective projection produced a singular affine");let o=t.d/e,n=-t.b/e,r=-t.c/e,s=t.a/e;return{a:o,b:n,c:r,d:s,e:-(o*t.e+r*t.f),f:-(n*t.e+s*t.f)}}function z(t,e){return{a:t.a*e.a+t.c*e.b,b:t.b*e.a+t.d*e.b,c:t.a*e.c+t.c*e.d,d:t.b*e.c+t.d*e.d,e:t.a*e.e+t.c*e.f+t.e,f:t.b*e.e+t.d*e.f+t.f}}function G(t,e,o=()=>0){let n=O(t,e,o(e)),r={x:e.x+1,y:e.y},s={x:e.x,y:e.y+1},c=O(t,r,o(r)),d=O(t,s,o(s)),u=c.x-n.x,m=c.y-n.y,y=d.x-n.x,f=d.y-n.y;return{a:u,b:m,c:y,d:f,e:n.x-u*e.x-y*e.y,f:n.y-m*e.x-f*e.y}}function J(t){let e=Math.hypot(t.a,t.b),o=t.a*t.d-t.b*t.c;return{rotationDeg:Math.atan2(t.b,t.a)*180/Math.PI,scaleX:e,scaleY:o/Math.max(e,1e-9),skewX:(t.a*t.c+t.b*t.d)/Math.max(o,1e-9)}}export{Y as a,j as b,q as c,F as d,U as e,_ as f,N as g,O as h,W as i,Z as j,z as k,G as l,J as m};
@@ -0,0 +1 @@
1
+ import{a as Rn,c as An,d as Pn}from"./chunk-7OJ6SB6V.js";import{c as bn}from"./chunk-UHPX2P7O.js";import{d as Sn}from"./chunk-T2LWVOQ3.js";import{e as hn,o as xn,q as Nt,r as ft,t as It}from"./chunk-AWPHGLTU.js";import{e as gn,k as Mn}from"./chunk-UL5OIGIF.js";import{W as ut,X as lt,ea as Gt,ga as dn,ha as Dt,ja as yn,l as pn,m as At,va as qt}from"./chunk-X3K36XZM.js";import{d as H,x as nt,z as Pt}from"./chunk-CXF32VPG.js";import Se from"earcut";import Re from"polygon-clipping";var g=ut,Ae=.002;function Pe(t,n,e){let i=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=Math.max(i,o,a);if(r<1e-9)return!0;let s=(i+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-i)*(s-o)*(s-a)))/r<Ae}var ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,i){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=i}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let i=new Float32Array(e);i.set(this.buf.subarray(0,this.len)),this.buf=i}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Yt=class{constructor(){this.pos=new ht;this.nor=new ht;this.col=new ht;this.flr=new ht;this.mat=new ht;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,i,o,a,r=a,s=a){Pe(n,e,i)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(r[0],r[1],r[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(n,e,i,o,a,r,s,l=s,c=s){[...n,...e,...i].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[2]),this.col.push3(c[0],c[1],c[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 Ie(t,n,e){let i=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],r=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=o*l-a*s,f=a*r-i*l,m=i*s-o*r,u=Math.hypot(c,f,m)||1;return c/=u,f/=u,m/=u,[c,f,m]}function we(t,n){let e=[...t],i=[];for(let r of t)i.push(r.x,r.y);let o=[];if(n){for(let r of n)if(!(r.length<3)){o.push(e.length);for(let s of r)e.push(s),i.push(s.x,s.y)}}let a=Se(i,o.length?o:void 0,2);return{pts:e,tris:a}}function Jt(t){return ft(t)<0?[...t].reverse():t}var Te=3;function _e(t,n,e,i){let o=i(t),a=i(n),r=i(e),s=(h,b,p,y)=>Math.abs(i({x:(h.x+b.x)/2,y:(h.y+b.y)/2})-(p+y)/2),l=(t.x+n.x+e.x)/3,c=(t.y+n.y+e.y)/3,f=(o+a+r)/3,m=Math.max(s(t,n,o,a),s(n,e,a,r),s(e,t,r,o),Math.abs(i({x:l,y:c})-f)),u=(h,b,p)=>{let y=Math.abs(i({x:(h+l)/2,y:(b+c)/2})-(p+f)/2);y>m&&(m=y)};return u((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),u((n.x+e.x)/2,(n.y+e.y)/2,(a+r)/2),u((e.x+t.x)/2,(e.y+t.y)/2,(r+o)/2),m}function wt(t,n,e,i,o){if(o<=0)return _e(t,n,e,i);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},r={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max(wt(t,a,s,i,o-1),wt(a,n,r,i,o-1),wt(s,r,e,i,o-1),wt(a,r,s,i,o-1))}function Tt(t,n,e,i,o,a,r,s){if(r>0){let u={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+i.x)/2,y:(e.y+i.y)/2},b={x:(i.x+n.x)/2,y:(i.y+n.y)/2};Tt(t,n,u,b,o,a,r-1,s),Tt(t,u,e,h,o,a,r-1,s),Tt(t,b,h,i,o,a,r-1,s),Tt(t,u,h,b,o,a,r-1,s);return}let l=[n.x*g,o(n),n.y*g],c=[e.x*g,o(e),e.y*g],f=[i.x*g,o(i),i.y*g];if(s){t.triN(l,c,f,s(n),s(e),s(i),a);return}let m=Ie(l,c,f);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(l,c,f,m,a)}var Be=8;function In(t,n,e){if(!Number.isFinite(e))return t;let i=[],o=(a,r,s,l,c)=>{if(c>0){let f={x:(a.x+r.x)/2,y:(a.y+r.y)/2},m=n(f);if(Math.abs(m-(s+l)/2)>e){o(a,f,s,m,c-1),o(f,r,m,l,c-1);return}}i.push(a)};for(let a=0;a<t.length;a++){let r=t[a],s=t[(a+1)%t.length];o(r,s,n(r),n(s),Be)}return i}function Xt(t,n){if(t.length<3)return t;let e=[];for(let o of t){let a=e[e.length-1];a&&Math.hypot(o.x-a.x,o.y-a.y)<n||e.push(o)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<n;)e.pop();if(e.length<3)return t;let i=[];for(let o=0;o<e.length;o++){let a=i.length?i[i.length-1]:e[(o-1+e.length)%e.length],r=e[o],s=e[(o+1)%e.length],l=s.x-a.x,c=s.y-a.y,f=Math.hypot(l,c);f>n&&Math.abs((r.x-a.x)*c-(r.y-a.y)*l)/f<n||i.push(r)}return i.length>=3?i:e}var Ut=.001*lt*.1;function K(t,n,e,i,o,a,r,s,l=1/0,c){if(!n||n.length<3||(l===void 0&&(l=1/0),Math.abs(ft(n))<1e-4))return;let f=Xt(In(Xt(Jt(n),Ut),i,l),Ut),m=e?.map(A=>Xt(In(Xt(Jt(A),Ut),i,l),Ut)).filter(A=>A.length>=3&&Math.abs(ft(A))>=1e-4),{pts:u,tris:h}=we(f,m),b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],p=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],y=[r[0]*s.top,r[1]*s.top,r[2]*s.top],d=[r[0]*s.wallBottom,r[1]*s.wallBottom,r[2]*s.wallBottom],x=0;if(Number.isFinite(l))for(;x<Te;x++){let A=0;for(let P=0;P<h.length;P+=3){let F=wt(u[h[P]],u[h[P+1]],u[h[P+2]],i,x);F>A&&(A=F)}if(A<=l)break}for(let A=0;A<h.length;A+=3){let P=u[h[A]],F=u[h[A+1]],v=u[h[A+2]];Tt(t,P,F,v,i,b,x,c);let G=[P.x*g,o,P.y*g],N=[F.x*g,o,F.y*g],M=[v.x*g,o,v.y*g];t.tri(G,M,N,[0,-1,0],p)}let T=A=>{if(x<=0)return A;let P=1<<x,F=[];for(let v=0;v<A.length;v++){let G=A[v],N=A[(v+1)%A.length];for(let M=0;M<P;M++){let B=M/P;F.push({x:G.x+(N.x-G.x)*B,y:G.y+(N.y-G.y)*B})}}return F},S=pn(f),C=[{ring:T(f),flip:!1}];if(m)for(let A of m)A.length>=3&&C.push({ring:T(A),flip:!0});for(let{ring:A,flip:P}of C)for(let F=0;F<A.length;F++){let v=A[F],G=A[(F+1)%A.length],N=(G.x-v.x)*g,B=(G.y-v.y)*g,O=-N,E=Math.hypot(B,O)||1;B/=E,O/=E;let I=(v.x+G.x)/2-S.x,k=(v.y+G.y)/2-S.y,R=B*I+O*k;P&&(R=-R),R<0&&(B=-B,O=-O);let _=[B,0,O],w=[v.x*g,i(v),v.y*g],D=[G.x*g,i(G),G.y*g],X=[v.x*g,o,v.y*g],U=[G.x*g,o,G.y*g];t.tri(w,D,U,_,y,y,d),t.tri(w,U,X,_,y,d,d)}}function wn(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),i=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),r=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),i.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),r.set(l.material,s),s+=l.count;return{position:e,normal:i,color:o,floor:a,material:r,count:n}}function jt(t,n,e=2.5){if(n<=0||t.length<3)return t;let i=Jt(t),o=i.length,a=[];for(let s=0;s<o;s++){let l=i[s],c=i[(s+1)%o],f=c.x-l.x,m=c.y-l.y,u=Math.hypot(f,m)||1;a.push({x:m/u,y:-f/u})}let r=[];for(let s=0;s<o;s++){let l=i[s],c=a[(s-1+o)%o],f=a[s],m=c.x+f.x,u=c.y+f.y,h=Math.hypot(m,u),b=()=>{r.push([l.x+c.x*n,l.y+c.y*n]),r.push([l.x+f.x*n,l.y+f.y*n])};if(h<1e-9){b();continue}m/=h,u/=h;let p=m*c.x+u*c.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>e){b();continue}r.push([l.x+m*n*y,l.y+u*n*y])}if(r.length<3)return t;try{let s=Re.union([[...r,r[0]]]),l=null,c=-1/0;for(let m of s){let u=Math.abs(ft(m[0].map(([h,b])=>({x:h,y:b}))));u>c&&(c=u,l=m[0])}if(!l)return t;let f=l.map(([m,u])=>({x:m,y:u}));if(f.length>1){let m=f[0],u=f[f.length-1];Math.abs(m.x-u.x)<1e-9&&Math.abs(m.y-u.y)<1e-9&&f.pop()}return f.length>=3?f:t}catch{return t}}function Ht(t,n,e,i,o=28){let a=[];for(let r=0;r<o;r++){let s=r/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+i*Math.sin(s)})}return a}function _t(t,n,e,i){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+i},{x:t,y:n+i}]}var Bt=["available","held","sold","selected","dimmed"];function Qt(t){let n=Bt.indexOf(t);return n<0?0:n}var Tn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function rr(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.42,i=.62;return[(n+(t[0]-n)*e)*i,(n+(t[1]-n)*e)*i,(n+(t[2]-n)*e)*i]}var tn={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]},nn={top:[.05,.06,.08],bottom:[.1,.12,.15]};function et(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}var V={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Ee=.44,Fe=.15,Ce=.3,ve=.24;function _n(t){return t===void 0||!Number.isFinite(t)||t<=0?ve:Math.min(Ce,Math.max(Fe,t*Ee))}var sr=.21,ke=.05,en=.45,Oe=en+ke,Le=[{part:V.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:V.pad,min:[-1,.36,-.95],max:[1,en,1]},{part:V.back,min:[-1,Oe,-1],max:[1,.92,-.72]},{part:V.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:V.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:V.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:V.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:V.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:V.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:V.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Ge=[{part:V.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:V.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:V.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:V.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:V.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],De=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function ar(){let t=[],n=[],e=[],i=[],o=(E,I,k)=>{let R=e.length,[_,w,D]=E,X=[w[0]-_[0],w[1]-_[1],w[2]-_[2]],U=[D[0]-_[0],D[1]-_[1],D[2]-_[2]],L=X[1]*U[2]-X[2]*U[1],Y=X[2]*U[0]-X[0]*U[2],j=X[0]*U[1]-X[1]*U[0],$=Math.hypot(L,Y,j);$>1e-9?(L/=$,Y/=$,j/=$):[L,Y,j]=I,L*I[0]+Y*I[1]+j*I[2]<0&&(L=-L,Y=-Y,j=-j);for(let z of E)t.push(...z),n.push(L,Y,j),e.push(k);i.push(R,R+1,R+2,R,R+2,R+3)},a=E=>{for(let I of De){let k=I.c.map(R=>R.map((_,w)=>_?E.max[w]:E.min[w]));o(k,I.n,E.part)}};for(let E of Le)a(E);for(let E of Ge)a(E);let r=en,s=1.08,l=.47,c=.69,f=-.55,m=.08,u=-.48,h=.01,b=[-l,r,f],p=[l,r,f],y=[-l,r,m],d=[l,r,m],x=[-c,s,u],T=[c,s,u],S=[-c,s,h],C=[c,s,h];o([p,T,C,d],[1,0,0],V.body),o([y,S,x,b],[-1,0,0],V.body),o([S,C,T,x],[0,1,0],V.body),o([b,p,d,y],[0,-1,0],V.body),o([d,C,S,y],[0,0,1],V.body),o([b,x,T,p],[0,0,-1],V.body);let A=10,P=8,F=[0,1.205,-.23],v=[.42,.115,.38],G=e.length;for(let E=0;E<=P;E++){let I=Math.PI*E/P,k=Math.cos(I),R=Math.sin(I);for(let _=0;_<=A;_++){let w=Math.PI*2*_/A,D=R*Math.cos(w),X=R*Math.sin(w);t.push(F[0]+v[0]*D,F[1]+v[1]*k,F[2]+v[2]*X);let U=D/v[0],L=k/v[1],Y=X/v[2],j=Math.hypot(U,L,Y)||1;U/=j,L/=j,Y/=j,n.push(U,L,Y),e.push(V.head)}}for(let E=0;E<P;E++)for(let I=0;I<A;I++){let k=G+E*(A+1)+I,R=k+A+1;i.push(k,R,k+1,k+1,R,R+1)}let N=new Float32Array(t),M=new Float32Array(n),B=new Float32Array(e),O=new Uint16Array(i);return{position:N,normal:M,part:B,index:O,vertexCount:e.length,indexCount:i.length}}function Bn(t,n,e,i){let o=new Float32Array(n),a=c=>t[c*3],r=c=>t[c*3+2],s=0,l=(c,f)=>{let m=f-c;for(let u=c;u<f;u++){let[h,b]=i(u),p=h-a(u),y=b-r(u);if(m>=2){let d=Math.max(c,u-1),x=Math.min(f-1,u+1),T=a(x)-a(d),S=r(x)-r(d),C=Math.hypot(T,S);if(C>1e-6){let A=-S/C,P=T/C;A*p+P*y<0&&(A=-A,P=-P),p=A,y=P}}o[u]=p===0&&y===0?0:Math.atan2(p,y)}};for(let c=1;c<=n;c++)(c===n||e(c)!==e(s))&&(l(s,c),s=c);return o}var Vt=.22;function dr(t,n){let e=Bt[t];if(e!=="sold"&&e!=="held")return-1;let i=(n+1)*2654435761;return i^=i>>>15,i=Math.imul(i,2246822519),i^=i>>>13,(i>>>0)%1e5/1e5}var Ne=.42;function Xe(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let i=1/0,o=1/0,a=-1/0,r=-1/0;for(let b of t)b.x<i&&(i=b.x),b.y<o&&(o=b.y),b.x>a&&(a=b.x),b.y>r&&(r=b.y);let s=Math.max(a-i,1e-6),l=Math.max(r-o,1e-6),c=Math.max(Math.sqrt(s*l/n),1e-6),f=Math.max(1,Math.ceil(s/c)+1),m=Math.max(1,Math.ceil(l/c)+1),u=new Map,h=(b,p)=>{let y=Math.min(f-1,Math.max(0,Math.floor((b-i)/c)));return Math.min(m-1,Math.max(0,Math.floor((p-o)/c)))*f+y};for(let b=0;b<n;b++){let p=h(t[b].x,t[b].y),y=u.get(p);y?y.push(b):u.set(p,[b])}for(let b=0;b<n;b++){let p=t[b],y=Math.min(f-1,Math.max(0,Math.floor((p.x-i)/c))),d=Math.min(m-1,Math.max(0,Math.floor((p.y-o)/c))),x=1/0;for(let T=1;T<=4;T++){for(let S=d-T;S<=d+T;S++)if(!(S<0||S>=m))for(let C=y-T;C<=y+T;C++){if(C<0||C>=f||T>1&&Math.abs(S-d)<T&&Math.abs(C-y)<T)continue;let A=u.get(S*f+C);if(A)for(let P of A){if(P===b)continue;let F=Math.hypot(t[P].x-p.x,t[P].y-p.y);F<x&&(x=F)}}if(Number.isFinite(x)&&x<=T*c)break}e[b]=x}return e}function Ue(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Gt):0}function En(t,n,e,i,o,a){let r=t.length,s=new Float32Array(r*3),l=new Float32Array(r),c=new Float32Array(r*3),f=new Float32Array(r),m=new Float32Array(r),u=new Float32Array(r),h=new Float32Array(r),b=new Float32Array(r*3),p=new Map,y=Xe(t);for(let d=0;d<r;d++){let x=t[d],S=(e?.seatPitchU(d)??y[d])*g;f[d]=Number.isFinite(S)?Math.max(.06,Math.min(Vt,S*Ne)):Vt,m[d]=_n(Number.isFinite(S)?S:void 0);let C=Mn(x.glyph,{seatGlyph:a?.get(x.categoryKey)});u[d]=gn.indexOf(C),h[d]=x.wheelchairSpaceType==="no-seat"?0:1,s[d*3]=x.x*g,s[d*3+1]=e?e.seatDeckY(d):Ue(x),s[d*3+2]=x.y*g,l[d]=Qt(n?n(x):"available");let A=H(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[d*3]=A[0],c[d*3+1]=A[1],c[d*3+2]=A[2],x.accessibility?.length){let P=H(hn(x.accessibility));P&&(b[d*3]=P[0],b[d*3+1]=P[1],b[d*3+2]=P[2])}p.set(x.id,d)}return{count:r,iPosition:s,iState:l,iCategory:c,iMaxRadius:f,iRing:b,idToIndex:p,iChairWidth:m,iGlyph:u,iPhysicalSeat:h,iFloor:i??new Float32Array(r),iYaw:new Float32Array(r)}}var Ye=64;function yr(t,n){let e=[];for(let r of n){let s=t.idToIndex.get(r.seatId);if(s===void 0)continue;let l=Qt(r.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((r,s)=>r-s);let i=[],o=e[0],a=e[0];for(let r=1;r<e.length;r++){let s=e[r];if(s!==a){if(s<=a+Ye){a=s;continue}i.push({start:o,length:a-o+1}),o=s,a=s}}return i.push({start:o,length:a-o+1}),i}function Mr(t,n,e){return e<0?n>1?t.filter(i=>i.kind==="floor"):[...t]:t.filter(i=>i.floorIndex===void 0||i.floorIndex===e)}function Sr(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),i=[];for(let o of e){let a=i.find(r=>r.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):i.push([o])}return i.flatMap(o=>o.length<2?o:o.map((a,r)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(r-(o.length-1)/2)*104))}})))}var je=1.15,He=3.25,Ve=4.5,We=.85,ze=.5,Ze=.26;function Rr(t,n,e){let i=Math.max(1e-6,n),o=t/i,a=e?.hasZoneLabels??!0,r=new Set;return o>=.75&&r.add("floor"),o>=je&&r.add("zone"),o<=(a?He:Ve)&&(r.add("section"),r.add("ga")),o<=We&&(r.add("annotation"),r.add("booth")),o<=ze&&r.add("row"),o<=Ze&&r.add("seat"),r}function Ar(t,n,e,i){let o=t,a=n[0],r=n[1],s=n[2],l=o[0]*a+o[4]*r+o[8]*s+o[12],c=o[1]*a+o[5]*r+o[9]*s+o[13],f=o[2]*a+o[6]*r+o[10]*s+o[14],m=o[3]*a+o[7]*r+o[11]*s+o[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let u=l/m,h=c/m,b=f/m,p=u>=-1.05&&u<=1.05&&h>=-1.05&&h<=1.05&&b<=1;return{x:(u*.5+.5)*e,y:(1-(h*.5+.5))*i,depth:b,visible:p}}function Pr(t,n,e=n){let i=[],o=[...t].sort((a,r)=>a.screen.depth-r.screen.depth);for(let a of o){let r=!1;for(let s of i)if(on(a,s,n,e)){r=!0;break}r||i.push(a)}return i}var Ke=6;function on(t,n,e,i){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),r=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+Ke):e;return o<r&&a<i}function Ir(t,n,e){return t.length*n*.58+(e?14:0)}var wr={row:8,seat:14};function Tr(t,n,e,i){let o=Math.max(1,Math.min(e,i)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-i/2)/o);return n*(1+1.5*a)}function _r(t,n,e,i,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),r=[];for(let s of a){if(r.length>=i)break;let l=!1;for(let c of o)if(on(s,c,n,e)){l=!0;break}if(!l){for(let c of r)if(on(s,c,n,e)){l=!0;break}}l||r.push(s)}return r}var $e=.15,qe=.9,Je=1.76,Qe=.7,to=1.6;function no(){return{background:{top:[...nn.top],bottom:[...nn.bottom]},structure:tn,seatStates:{...Tn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Fn(t){let n=no();if(!t)return n;let e=H(t.background);if(e){n.background={top:et(e,qe),bottom:et(e,Je)};let r={};for(let[s,l]of Object.entries(tn))r[s]=nt(l,e,$e);n.structure=r}let i=H(t.selectionColor)??H(t.accent);i&&(n.seatStates={...n.seatStates,selected:i});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=Math.min(to,Math.max(Qe,o)));let a=t.venue3d;if(a){let r=H(a.deck),s=H(a.fascia);r&&(n.structure={...n.structure,tierTop:r,gaTop:r}),s&&(n.structure={...n.structure,tierWall:s,gaWall:s}),n.materials.seat=H(a.seat),n.materials.shell=H(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return n}function Cn(t,n){let e=[];for(let i of n)e.push(...t.seatStates[i]);return e}import Ln from"polygon-clipping";import eo from"earcut";var oo=.58,vn=.01,ot=Vt*1.5*lt,ro=.5,io=.6;function so(t,n){let e=t.length,i=[];for(let r=0;r<e;r++){let s=t[Math.max(0,r-1)],l=t[Math.min(e-1,r+1)],c=l.x-s.x,f=l.y-s.y,m=Math.hypot(c,f);if(m<1e-9){i.push([0,0]);continue}c/=m,f/=m,i.push([-f,c])}let o=0;for(let r=0;r<e;r++)o+=(t[r].x-n.x)*i[r][0]+(t[r].y-n.y)*i[r][1];return o<0?i.map(([r,s])=>[-r,-s]):i}function ao(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],i=(r,s)=>{let l=s.x-r.x,c=s.y-r.y,f=Math.hypot(l,c)||1;return{x:l/f,y:c/f}},o=i(e[1],e[0]),a=i(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var kn=Math.PI/12;function co(t){if(t.length<3)return[...t];let n=[...t].sort((a,r)=>a.x-r.x||a.y-r.y),e=(a,r,s)=>(r.x-a.x)*(s.y-a.y)-(r.y-a.y)*(s.x-a.x),i=a=>{let r=[];for(let s of a){for(;r.length>=2&&e(r[r.length-2],r[r.length-1],s)<=0;)r.pop();r.push(s)}return r.pop(),r},o=[...i(n),...i([...n].reverse())];return o.length>=3?o:[...t]}function Gn(t,n){if(!t.length||!(n>0))return[];let e=co(t),i=(s,l,c,f)=>{let m=c-l;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let u=Math.max(1,Math.ceil(m/kn)),h=n/Math.cos(m/u/2);for(let b=0;b<=u;b++){let p=l+m*b/u;f.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(e.length<3){let s=0,l=0;for(let h of e)s+=h.x,l+=h.y;s/=e.length||1,l/=e.length||1;let c=0;for(let h of e)c=Math.max(c,Math.hypot(h.x-s,h.y-l));let f=[],m=Math.max(3,Math.ceil(Math.PI*2/kn)),u=(c+n)/Math.cos(Math.PI/m);for(let h=0;h<m;h++){let b=h/m*Math.PI*2;f.push({x:s+Math.cos(b)*u,y:l+Math.sin(b)*u})}return f}let o=e.length,a=[];for(let s=0;s<o;s++){let l=e[s],c=e[(s+1)%o];a.push(Math.atan2(-(c.x-l.x),c.y-l.y))}let r=[];for(let s=0;s<o;s++)i(e[s],a[(s+o-1)%o],a[s],r);return Yn(r)}function uo(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let i=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],r=t[o+1],s=r.x-a.x,l=r.y-a.y,c=s*s+l*l,f=c>1e-12?((n-a.x)*s+(e-a.y)*l)/c:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(n-(a.x+f*s),e-(a.y+f*l));m<i&&(i=m)}return i}function Wt(t){let n=t.map(o=>{let a=0,r=0;for(let c of o.pts)a+=c.x,r+=c.y;let s=o.pts.length||1;a/=s,r/=s;let l=0;for(let c of o.pts){let f=Math.hypot(c.x-a,c.y-r);f>l&&(l=f)}return{cx:a,cy:r,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},i=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),r=[],s=1/0,l=null;for(let f of a){let m=1/0;for(let u=0;u<t.length;u++){if(u===o||Math.abs(t[u].y-t[o].y)<.001)continue;let h=n[u],b=Math.hypot(f.x-h.cx,f.y-h.cy)-h.rad;if(b>=m&&b>=s)continue;let p=uo(t[u].pts,f.x,f.y);p<m&&(m=p),t[u].depth<t[o].depth&&p<s&&(s=p,l=t[u].y)}Number.isFinite(m)&&m>0&&r.push(m)}r.sort((f,m)=>f-m);let c=r.length?r[Math.floor(r.length/2)]:1;i.push({pitch:c,belowY:l})}return i}function Dn(t,n,e,i){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],m=f.x-i.x,u=f.y-i.y,h=Math.hypot(m,u)||1;m/=h,u/=h;let b=Math.max(e[n].pitch,.001)*.5;return[{x:f.x+u*b,y:f.y-m*b},{x:f.x-u*b,y:f.y+m*b}]})():[];if(a.length<2)return null;let r=0,s=0;for(let f=1;f<a.length;f++){let m=Math.hypot(a[f].x-a[f-1].x,a[f].y-a[f-1].y);m>1e-6&&(r+=m,s++)}let l=s>0?r/s:0,c=ao(a,Math.max(l*io,ot));return{pts:c,nrm:so(c,i),front:Math.max(e[n].pitch*oo,ot),back:Math.max(e[n].pitch*ro,ot)}}var gt=1.5,Nn=.3;function rn(t,n){if(t.length<3)return t;let e=t[0],i=t[t.length-1],o=i.x-e.x,a=i.y-e.y,r=Math.hypot(o,a),s=-1,l=-1;for(let m=1;m<t.length-1;m++){let u=t[m],h=r>1e-12?Math.abs((u.x-e.x)*a-(u.y-e.y)*o)/r:Math.hypot(u.x-e.x,u.y-e.y);h>s&&(s=h,l=m)}if(s<=n||l<0)return[e,i];let c=rn(t.slice(0,l+1),n),f=rn(t.slice(l),n);return[...c.slice(0,-1),...f]}function Xn(t,n){if(t.length<4)return t;let e=rn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function Un(t,n,e){if(t.length<2)return[];let i=e??Wt(t),o=new Map;for(let r=0;r<t.length;r++){let s=o.get(t[r].blockId);s?s.push(r):o.set(t[r].blockId,[r])}let a=[];for(let[,r]of o){let s=[];for(let x of r){let T=t[x].patch;T&&T.length>=3?a.push({outline:[...T],holes:[],topY:t[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,T)=>t[x].depth-t[T].depth);let c=s.map(x=>Dn(t,x,i,n)).filter(x=>x!==null);if(!c.length)continue;let f=(x,T)=>({x:x.pts[T].x-x.nrm[T][0]*(x.front+gt),y:x.pts[T].y-x.nrm[T][1]*(x.front+gt)}),m=(x,T)=>({x:x.pts[T].x+x.nrm[T][0]*(x.back+gt),y:x.pts[T].y+x.nrm[T][1]*(x.back+gt)}),u=c[0],h=c[c.length-1],b=[];for(let x=0;x<u.pts.length;x++)b.push(f(u,x));for(let x of c)b.push(m(x,x.pts.length-1));for(let x=h.pts.length-1;x>=0;x--)b.push(m(h,x));for(let x=c.length-1;x>=0;x--)b.push(f(c[x],0));let p=Yn(b),y=1/0;for(let x of s)t[x].y<y&&(y=t[x].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(ft(p))>1e-6&&c.every(x=>{let T=x.pts[Math.floor(x.pts.length/2)];return It(p,T.x,T.y)})){a.push({outline:Xn(p,Nn),holes:[],topY:y});continue}for(let x of lo(c))a.push({outline:x,holes:[],topY:y})}return a}function lo(t){let n=[];for(let e of t){let i=[],o=[],a=e.front+gt,r=e.back+gt;for(let l=0;l<e.pts.length;l++){let c=e.pts[l],f=e.nrm[l];i.push([c.x-f[0]*a,c.y-f[1]*a]),o.push([c.x+f[0]*r,c.y+f[1]*r])}let s=[...i,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Ln.union(n[0],...n.slice(1)),i=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,c])=>({x:l,y:c})),r=a[0],s=a[a.length-1];a.length>1&&Math.abs(r.x-s.x)<1e-9&&Math.abs(r.y-s.y)<1e-9&&a.pop(),a.length>=3&&i.push(Xn(a,Nn))}return i}catch{return[]}}function Yn(t){let n=[];for(let e of t){let i=n[n.length-1];i&&Math.hypot(e.x-i.x,e.y-i.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var sn=class{constructor(n){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=n;for(let e of n)for(let i of e)i.x<this.minX&&(this.minX=i.x),i.y<this.minY&&(this.minY=i.y),i.x>this.maxX&&(this.maxX=i.x),i.y>this.maxY&&(this.maxY=i.y)}containsAll(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let i=!0;for(let o of n)if(!It(e,o.x,o.y)){i=!1;break}if(i)return!0}return!1}};function On(t,n,e,i,o,a){if(i.length<3)return;if(e.containsAll(i)){let c=[0,1,0],f=i[0];for(let m=1;m+1<i.length;m++){let u=i[m],h=i[m+1];t.tri([f.x*g,o,f.y*g],[u.x*g,o,u.y*g],[h.x*g,o,h.y*g],c,a)}return}let r=i.map(c=>[c.x,c.y]);r.push(r[0]);let s;try{s=Ln.intersection([r],n)}catch{return}let l=[0,1,0];for(let c of s){if(!c.length||c[0].length<4)continue;let f=c[0],m=[],u=[];for(let b=0;b<f.length-1;b++)m.push(f[b][0],f[b][1]),u.push([f[b][0],f[b][1]]);if(u.length<3)continue;let h=eo(m,void 0,2);for(let b=0;b<h.length;b+=3){let p=u[h[b]],y=u[h[b+1]],d=u[h[b+2]];t.tri([p[0]*g,o,p[1]*g],[y[0]*g,o,y[1]*g],[d[0]*g,o,d[1]*g],l,a)}}}function jn(t,n,e,i,o,a,r){if(n.length<2)return;let s=r??Wt(n),l=[0,1,0],c=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,f=a&&a.length>=3?new sn([[...a]]):null,m=h=>{t.setMaterial(2),h(),t.setMaterial(0)},u=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let b=n[h];if(b.patch&&b.patch.length>=3){let C=[...b.patch],A=s[h].belowY??i;if(u(()=>{if(c&&f)On(t,c,f,C,b.y,o.tread);else{let P=C[0];for(let F=1;F+1<C.length;F++){let v=C[F],G=C[F+1];t.tri([P.x*g,b.y,P.y*g],[v.x*g,b.y,v.y*g],[G.x*g,b.y,G.y*g],l,o.tread)}}}),b.y>A+vn){let P=0,F=0;for(let v of C)P+=v.x,F+=v.y;P/=C.length,F/=C.length,m(()=>{for(let v=0;v<C.length;v++){let G=C[v],N=C[(v+1)%C.length],M=N.x-G.x,B=N.y-G.y,O=Math.hypot(M,B);if(O<1e-6)continue;let E=B/O,I=-M/O;(G.x-P)*E+(G.y-F)*I<0&&(E=-E,I=-I);let k=[E,0,I],R=[G.x*g,b.y,G.y*g],_=[N.x*g,b.y,N.y*g],w=[G.x*g,A,G.y*g],D=[N.x*g,A,N.y*g];t.tri(R,_,D,k,o.riser),t.tri(R,D,w,k,o.riser)}})}continue}let p=Dn(n,h,s,e);if(!p)continue;let{pts:y,nrm:d,front:x,back:T}=p,S=s[h].belowY??i;for(let C=0;C+1<y.length;C++){let A=y[C],P=y[C+1],F=d[C],v=d[C+1];if(Math.hypot(P.x-A.x,P.y-A.y)<1e-6||F[0]===0&&F[1]===0||v[0]===0&&v[1]===0)continue;let G=[(A.x-F[0]*x)*g,b.y,(A.y-F[1]*x)*g],N=[(P.x-v[0]*x)*g,b.y,(P.y-v[1]*x)*g],M=[(A.x+F[0]*T)*g,b.y,(A.y+F[1]*T)*g],B=[(P.x+v[0]*T)*g,b.y,(P.y+v[1]*T)*g];if(u(()=>{c&&f?On(t,c,f,[{x:A.x-F[0]*x,y:A.y-F[1]*x},{x:P.x-v[0]*x,y:P.y-v[1]*x},{x:P.x+v[0]*T,y:P.y+v[1]*T},{x:A.x+F[0]*T,y:A.y+F[1]*T}],b.y,o.tread):(t.tri(G,N,B,l,o.tread),t.tri(G,B,M,l,o.tread))}),b.y>S+vn){let O=[G[0],S,G[2]],E=[N[0],S,N[2]],I=[-F[0],0,-F[1]];m(()=>{t.tri(G,N,E,I,o.riser),t.tri(G,E,O,I,o.riser)})}}}}import Vn from"polygon-clipping";function mo(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Hn(t,n){return t.filter(e=>e.type!=="shape"||mo(e,n))}function Wn(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((i,o)=>({objects:Hn(i.objects,n),focal:{x:(i.focalPoint??e).x,y:(i.focalPoint??e).y},baseHeightM:i.baseHeightM??0,index:o})):[{objects:Hn(t.objects,n),focal:e,baseHeightM:0,index:0}]}var fo={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Mt(t){return xn(t)??fo}function zn(t,n){let e=jt(t.outline,ot),i=Mt(e),o=n.filter(r=>r!==t&&r.outline&&r.outline.length>=3&&Nt(i,Mt(r.outline)));if(!o.length)return[e];let a=r=>{let s=r.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let r=Vn.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s.length?s:[e]}catch{return[e]}}function Zn(t,n){if(!n.length)return t;let e=a=>{let r=a.map(s=>[s.x,s.y]);return r.push(r[0]),r},i=n.map(a=>[e(a)]),o=[];for(let a of t){let r;try{r=Vn.intersection([e(a.outline)],i.flat())}catch{o.push(a);continue}for(let s of r){if(!s.length)continue;let l=s[0].map(([c,f])=>({x:c,y:f}));if(l.length>1){let c=l[0],f=l[l.length-1];Math.abs(c.x-f.x)<1e-9&&Math.abs(c.y-f.y)<1e-9&&l.pop()}l.length>=3&&o.push({outline:l,holes:[],topY:a.topY})}}return o.length?o:t}var ho=.05,Kn=.05,bo=.15,an=25;function $n(t,n,e){let i=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),r=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,c=[],f=new Set;for(let u=0;u<t.length;u+=1){let h=t[u];for(let b of h.objects){if(b.type==="table"&&f.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let p=jt(b.outline,ot);l.set(b.id,{section:b,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),c.push({id:b.id,floorIndex:u,box:Mt(p),section:b,unit:h,outline:p})}}let m=new Map;for(let u of c){let h=m.get(u.floorIndex);h?h.push(u):m.set(u.floorIndex,[u])}for(let u=0;u<n.length;u++){let h=n[u],b=e?m.get(e[u])??[]:c,p=h.sectionId?b.find(d=>d.id===h.sectionId)??b.find(d=>d.section.logicalSectionId===h.sectionId&&qt({x:h.x,y:h.y},d.outline,d.section.holes)):void 0,y=p?[p]:b;for(let d of y){if(e&&d.floorIndex!==e[u]||!p&&(h.x<d.box.minX||h.x>d.box.maxX||h.y<d.box.minY||h.y>d.box.maxY||!qt({x:h.x,y:h.y},d.outline,d.section.holes)))continue;o[u]=d.id;let x=l.get(d.id);x.hasSeats=!0;let T=h.focalPoint??d.unit.focal,S=Math.hypot(h.x-T.x,h.y-T.y);S<x.frontU&&(x.frontU=S),x.seatIndices.push(u);let C=h.rowId||`__seat-${u}`,A=x.rows.get(C);A?A.push({x:h.x,y:h.y}):x.rows.set(C,[{x:h.x,y:h.y}]);break}}for(let[u,h]of l){let b=dn(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,y=b.rake>0?Math.tan(b.rake*Math.PI/180):0,d=b.rake<=.01&&b.height<=p+.001,x=h.section.surfaceKind,T=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:d,S=h.hasSeats?yn(u,n,h.seatIndices,h.unit.focal):{sectionId:u,rows:[],blockCount:0},A=S.rows.length<2?Rn([...h.rows.values()].map(R=>({points:R})),h.unit.focal):null,P=1/0;if(A){if(h.hasSeats)for(let R of h.rows.values())for(let _ of R){let w=A.depthAt(_.x,_.y);w<P&&(P=w)}if(!h.hasSeats||!Number.isFinite(P)){P=1/0;for(let R of h.section.outline){let _=A.depthAt(R.x,R.y);_<P&&(P=_)}}}let F=p+ho,v=Math.max(F,b.height),G=R=>{let _=Math.max(0,R-P)*ut,w=Math.min(_*y,an);return Math.max(F,b.height+w)},N=R=>{let _=Math.max(0,R)*ut,w=Math.min(_*y,an);return Math.max(F,b.height+w)},M=T?[]:S.rows.map(R=>({pts:R.pts,y:N(R.blockDepth),depth:R.blockDepth,blockId:R.blockId,...f.has(R.id)?{patch:Gn(R.pts,ot)}:{}})),B=M.length?M[0].y:v,O=M.map(R=>{let _=R.patch&&R.patch.length>=3?R.patch:R.pts,w=0,D=0;for(let L of _)w+=L.x,D+=L.y;let X=_.length||1;w/=X,D/=X;let U=0;for(let L of _){let Y=Math.hypot(L.x-w,L.y-D);Y>U&&(U=Y)}return{cx:w,cy:D,rad:U}}),E=T?()=>v:M.length>=2?(R,_)=>{let w=1/0,D=B;for(let X=0;X<M.length;X++){let U=O[X];if(Math.hypot(R-U.cx,_-U.cy)-U.rad>=w)continue;let L=M[X].patch,Y=L&&L.length>=3?It(L,R,_)?0:Dt(L,R,_):Dt(M[X].pts,R,_);Y<w&&(w=Y,D=M[X].y)}return D}:(R,_)=>A?G(A.depthAt(R,_)):v,I=[0,1,0],k=M.length>=2||T?()=>I:(R,_)=>{if(!A)return I;let w=A.depthAt(R,_);if(w<=P)return I;let D=(w-P)*ut;if(D*y>=an||b.height+D*y<=F)return I;let[X,U]=A.gradientAt(R,_);if(X===0&&U===0)return I;let L=1/Math.hypot(y,1);return[-X*y*L,L,-U*y*L]};if(!T)for(let R of S.rows){let _=N(R.blockDepth);for(let w of R.seatIndices)r[w]=_}for(let R of S.rows){let _=[];for(let L=1;L<R.pts.length;L++){let Y=Math.hypot(R.pts[L].x-R.pts[L-1].x,R.pts[L].y-R.pts[L-1].y);Y>1e-6&&_.push(Y)}_.sort((L,Y)=>L-Y);let w=_.length?_[Math.floor(_.length/2)]:1/0,D=1/0,X=R.pts[Math.floor(R.pts.length/2)];if(X)for(let L of S.rows){if(L===R||L.blockId!==R.blockId)continue;let Y=Dt(L.pts,X.x,X.y);Y>1e-6&&Y<D&&(D=Y)}let U=Math.min(w,Math.max(D,w*.5));if(Number.isFinite(U)&&U>0)for(let L of R.seatIndices)s[L]=U}i.set(u,{sectionId:u,deckAt:E,normalAt:k,flat:T,bottomY:p,rowLevels:M,landingY:B})}for(let u=0;u<n.length;u++){let h=o[u],b=n[u];if(h){let y=r[u];a[u]=(y??i.get(h).deckAt(b.x,b.y))+bo;continue}let p=b.eyeHeightM;a[u]=Number.isFinite(p)?Math.max(0,p-Gt):0}return{bySection:i,seatOwner:o,seatDeckY:u=>a[u],seatPitchU:u=>s[u]}}var W={top:1,wallBottom:.5,bottomCap:.4};function st(t,n){if(!t)return n;let e=et(Pt(t,.4),.62);return nt(n,e,.72)}function qn(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let i=new Map;for(let a of n){if(!a.sectionId)continue;let r=i.get(a.sectionId);r||(r=new Map,i.set(a.sectionId,r)),r.set(a.categoryKey,(r.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,r]of i){let s=0,l=0,c=0,f=0;for(let[m,u]of r){let h=H(e.get(m));h&&(s+=h[0]*u,l+=h[1]*u,c+=h[2]*u,f+=u)}f>0&&o.set(a,[s/f,l/f,c/f])}return o}function Jn(t,n){return H(t.color)??n.get(t.logicalSectionId??t.id)??null}import po from"polygon-clipping";function yo(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var zt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let i=n.map(l=>[l.x,l.y]);if(i.length<3)return[];i.push(i[0]);let o=Mt(n),a=this.rings.filter((l,c)=>Nt(o,this.boxes[c])&&yo(e,this.levels[c])),r=[[i]];if(a.length)try{r=po.difference([i],...a).map(c=>c.map(f=>f.map(([m,u])=>[m,u])))}catch{r=[[i]]}this.rings.push([i]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s}};function xo(t,n){if(!n)return t;let e=1/0,i=-1/0,o=1/0,a=-1/0;for(let m of t)e=Math.min(e,m.x),i=Math.max(i,m.x),o=Math.min(o,m.y),a=Math.max(a,m.y);let r=(e+i)/2,s=(o+a)/2,l=n*Math.PI/180,c=Math.cos(l),f=Math.sin(l);return t.map(m=>{let u=m.x-r,h=m.y-s;return{x:r+u*c-h*f,y:s+u*f+h*c}})}function bt(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(n=t.points),t.kind==="rect"&&t.width&&t.height&&(n=_t(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let e=(t.x??0)+t.width/2,i=(t.y??0)+t.height/2;n=Ht(e,i,t.width/2,t.height/2)}return n?xo(n,t.rotation):null}function Et(t){let n=t.role??"",e={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}},i=n==="stage"&&Sn(t.stageKind)?{kind:"stage",heightM:.06}:e[n]??{kind:"plate",heightM:.25};return{...i,heightM:t.heightM??i.heightM}}var go=.08;function Qn(t,n){let e=bt(t),i=Et(t),o=i.heightM;if(!e||i.kind!=="plate"&&i.kind!=="stage")return o;let a=1/0,r=1/0,s=-1/0,l=-1/0;for(let f of e)a=Math.min(a,f.x),r=Math.min(r,f.y),s=Math.max(s,f.x),l=Math.max(l,f.y);let c=o;for(let f of n)s>f.minX&&a<f.maxX&&l>f.minY&&r<f.maxY&&c<=f.topOffsetM+1e-6&&(c=f.topOffsetM+go);return n.push({minX:a,minY:r,maxX:s,maxY:l,topOffsetM:c}),c}function mt(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function te(t){if(t.length!==4)return t;let n=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),e=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return n>=e?t:[t[1],t[2],t[3],t[0]]}function Ft(t,n,e){return[mt(t[0],t[1],n),mt(t[0],t[1],e),mt(t[3],t[2],e),mt(t[3],t[2],n)]}function ne(t,n,e){return[mt(t[0],t[3],n),mt(t[1],t[2],n),mt(t[1],t[2],e),mt(t[0],t[3],e)]}function at(t,n,e,i,o,a){K(t,n,void 0,()=>e,i,o,a,W)}var cn=2.4,Mo=.75,So=.15;function Ct(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:i,rotation:o}=t;if(!e||!i)return null;let a=(o??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=e/2,c=i/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:n.x+f*r-m*s,y:n.y+f*s+m*r}))}function ee(t,n,e,i,o){let a=Ct(n);a&&K(t,a,void 0,()=>e+cn,e,st(i,o.boothTop),o.boothWall,W)}function un(t){if(t.shape==="round"){let f=t.radius;return f?Ht(t.center.x,t.center.y,f,f,24):null}let{width:n,height:e,rotation:i,center:o}=t;if(!n||!e)return null;let a=(i??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=n/2,c=e/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:o.x+f*r-m*s,y:o.y+f*s+m*r}))}function oe(t,n,e,i,o){let a=un(n);a&&K(t,a,void 0,()=>e+Mo,e,st(i,o.tableTop),o.tableWall,W)}function re(t,n,e,i,o,a,r,s){let l=bt(n);if(!l)return;let c=s?s.kind==="stage":n.role==="stage",f=s?s.kind==="screen":n.role==="screen",m=s?{kind:c?"stage":"solid",heightM:s.topY-s.baseY}:Et(n),u=s?.baseY??e,h=s?.topY??e+i;if(c&&r){let x=1/0,T=-1/0,S=1/0,C=-1/0;for(let A of l)A.x<x&&(x=A.x),A.x>T&&(T=A.x),A.y<S&&(S=A.y),A.y>C&&(C=A.y);r.push({cx:(x+T)/2*g,cz:(S+C)/2*g,y:h,halfX:Math.max((T-x)/2*g,.5),halfZ:Math.max((C-S)/2*g,.5)})}let b=H(n.fill),p=c&&b?nt(o.stageTop,et(Pt(b,.18),.9),.9):st(b,c?o.stageTop:o.decorTop),y=f?b:null,d=c?b?nt(o.stageWall,et(b,.58),.82):o.stageWall:f?y?nt(et(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:st(H(n.fill),o.decorWall);if(m.kind==="portal"&&l.length===4){let x=te(l);at(t,Ft(x,0,.16),h,u,p,d),at(t,Ft(x,.84,1),h,u,p,d),at(t,x,h,Math.max(u,h-.35),p,d);return}if(m.kind==="suite"&&l.length===4){let x=l.map((C,A)=>{let P=l[(A+1)%4],F=(C.x+P.x)/2,v=(C.y+P.y)/2;return Math.hypot(F-a.x,v-a.y)}),T=x.indexOf(Math.min(...x)),S=[0,1,2,3].map(C=>l[(T+C)%4]);at(t,Ft(S,0,.08),h,u,p,d),at(t,Ft(S,.92,1),h,u,p,d),at(t,ne(S,.88,1),h,u,p,d),at(t,S,h,Math.max(u,h-.18),p,d);return}at(t,l,h,u,p,d)}function ln(t){let{x:n,y:e,width:i,height:o}=t;if(!i||!o)return null;let a=n+i/2,r=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),f=i/2,m=o/2;return[[-f,-m],[f,-m],[f,m],[-f,m]].map(([u,h])=>({x:a+u*l-h*c,y:r+u*c+h*l}))}function Ro(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let i=e[1].trim();if(i==="none"||i==="transparent")return null;let o=i.match(/^url\(#([^)]+)\)$/);if(!o)return H(i);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let r=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=H(s[1].trim());l&&r.push(l)}return r.length?r.reduce((s,l,c)=>nt(s,l,1/(c+1)),r[0]):null}function ie(t,n,e,i){if(n.layer==="foreground")return;let o=ln(n);if(!o)return;let a=e+So,r=st(Ro(n.href),i.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(r=nt(i.ground,r,s)),K(t,o,void 0,()=>a,e,r,nt(r,i.decorWall,.5),W)}function se(t,n,e,i,o){if(!n.points||n.points.length<3)return;let a=st(i,o.gaTop);K(t,n.points,n.holes,()=>e+.15,e,a,o.gaWall,W)}var Ao=.25,Po=1.2,Io=.6,wo=.45,To=2.3,_o=Math.PI/180;function pt(t,n,e){let i=e*_o;return{x:t.x+n*Math.sin(i),y:t.y+n*Math.cos(i)}}function Bo(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let i=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(a.length<2)continue;let r=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=i&&r++;if(r>=a.length/2)return!0}return!1}var Eo=24;function Fo(t,n,e,i,o,a,r,s){let l=e.binCount,c=Eo,f=ut,m=a+.02,u=[];for(let M=0;M<l;M++){let B=(e.startBin+M+.5)*n.binStepDeg,O=new Float64Array(c+1);for(let E=0;E<=c;E++){let I=i[M]+(o[M]-i[M])*E/c;O[E]=Math.max(m,Pn(n,e,B,I)-Ao)}u.push(O)}let h=[r.bandTop[0]*s.top,r.bandTop[1]*s.top,r.bandTop[2]*s.top],b=[r.bandTop[0]*s.bottomCap,r.bandTop[1]*s.bottomCap,r.bandTop[2]*s.bottomCap],p=[r.bandWall[0]*s.top,r.bandWall[1]*s.top,r.bandWall[2]*s.top],y=[r.bandWall[0]*s.wallBottom,r.bandWall[1]*s.wallBottom,r.bandWall[2]*s.wallBottom],d=(M,B)=>{let O=(e.startBin+M+.5)*n.binStepDeg,E=i[M]+(o[M]-i[M])*B/c,I=pt(n.centre,E,O);return[I.x*f,u[M][B],I.y*f]};{let M=Math.tan(12*Math.PI/180);for(let B=0;B<6;B++){let O=!1;for(let I=0;I<l;I++)for(let k=c-1;k>=0;k--)u[I][k]>u[I][k+1]&&(u[I][k]=u[I][k+1],O=!0);let E=e.closed?l:l-1;for(let I=0;I<E;I++){let k=(I+1)%l;for(let R=0;R<=c;R++){let _=u[k][R]-u[I][R];if(Math.abs(_)>1)continue;let w=i[I]+(o[I]-i[I])*R/c,D=i[k]+(o[k]-i[k])*R/c,X=pt(n.centre,w,(e.startBin+I+.5)*n.binStepDeg),U=pt(n.centre,D,(e.startBin+k+.5)*n.binStepDeg),L=M*Math.hypot(U.x-X.x,U.y-X.y)*f;_>L?(u[k][R]=u[I][R]+L,O=!0):-_>L&&(u[I][R]=u[k][R]+L,O=!0)}}if(!O)break}}let x=1,T=(M,B)=>{for(let O=0;O<=c;O+=4)if(Math.abs(u[M][O]-u[B][O])>x)return!0;return Math.abs(u[M][c]-u[B][c])>x},S=Math.tan(38*Math.PI/180),C=M=>(o[M]-i[M])/c*f,A=(M,B)=>u[M][B+1]-u[M][B]>S*Math.max(1e-6,C(M)),P=(M,B)=>{let O=e.closed?(M-1+l)%l:Math.max(0,M-1),E=e.closed?(M+1)%l:Math.min(l-1,M+1);Math.abs(u[O][B]-u[M][B])>x&&(O=M),Math.abs(u[E][B]-u[M][B])>x&&(E=M);let I=Math.max(0,B-1),k=Math.min(c,B+1);I<B&&A(M,I)&&(I=B),k>B&&A(M,B)&&(k=B);let R=d(O,B),_=d(E,B),w=d(M,I),D=d(M,k),X=_[0]-R[0],U=_[1]-R[1],L=_[2]-R[2],Y=D[0]-w[0],j=D[1]-w[1],$=D[2]-w[2],z=U*$-L*j,q=L*Y-X*$,tt=X*j-U*Y,Z=Math.hypot(z,q,tt);return Z>1e-12?(z/=Z,q/=Z,tt/=Z,q<0&&(z=-z,q=-q,tt=-tt),[z,q,tt]):[0,1,0]},F=(M,B)=>{let O=[M[0],a,M[2]],E=[B[0],a,B[2]],I=B[0]-M[0],k=B[2]-M[2],R=Math.hypot(I,k);if(!(R>1e-12))return;let _=[k/R,0,-I/R];t.tri(M,B,E,_,p,p,y),t.tri(M,E,O,_,p,y,y)},v=.05*lt,G=M=>o[M]-i[M]<v,N=e.closed?l:l-1;for(let M=0;M<N;M++){let B=(M+1)%l;if(G(M)||G(B))continue;if(T(M,B)){let _=(e.startBin+M+1)*n.binStepDeg,w=(j,$)=>{let z=(i[M]+i[B])/2,q=(o[M]+o[B])/2,tt=z+(q-z)*$/c,Z=pt(n.centre,tt,_);return[Z.x*f,u[j][$],Z.y*f]};for(let j=0;j<c;j++){let $=d(M,j),z=d(M,j+1),q=w(M,j),tt=w(M,j+1),Z=P(M,j),it=P(M,j+1);t.triN($,q,tt,Z,Z,it,h),t.triN($,tt,z,Z,it,it,h);let vt=d(B,j),kt=d(B,j+1),dt=w(B,j),St=w(B,j+1),yt=P(B,j),xt=P(B,j+1);t.triN(dt,vt,kt,yt,yt,xt,h),t.triN(dt,kt,St,yt,xt,xt,h);let ct=w(M,j),rt=w(M,j+1),Ot=w(B,j+1),Kt=w(B,j),Lt=rt[0]-ct[0],Rt=rt[2]-ct[2],$t=Math.hypot(Lt,Rt);if($t>1e-12){let fn=[Rt/$t,0,-Lt/$t];t.tri(ct,rt,Ot,fn,p),t.tri(ct,Ot,Kt,fn,p)}}let D=d(M,0),X=d(B,0),U=d(B,c),L=d(M,c),Y=j=>[j[0],a,j[2]];t.tri(Y(D),Y(U),Y(X),[0,-1,0],b),t.tri(Y(D),Y(L),Y(U),[0,-1,0],b),F(D,X),F(L,U);continue}for(let _=0;_<c;_++){let w=P(M,_),D=P(B,_),X=P(B,_+1),U=P(M,_+1);if(A(M,_)||A(B,_)){let z=(rt,Ot)=>{let Kt=(e.startBin+rt+.5)*n.binStepDeg,Lt=i[rt]+(o[rt]-i[rt])*(_+.5)/c,Rt=pt(n.centre,Lt,Kt);return[Rt.x*f,Ot,Rt.y*f]},q=d(M,_),tt=d(B,_),Z=z(M,u[M][_]),it=z(B,u[B][_]);t.triN(q,tt,it,w,D,D,h),t.triN(q,it,Z,w,D,w,h);let vt=d(B,_+1),kt=d(M,_+1),dt=z(M,u[M][_+1]),St=z(B,u[B][_+1]);t.triN(dt,St,vt,U,X,X,h),t.triN(dt,vt,kt,U,X,U,h);let yt=it[0]-Z[0],xt=it[2]-Z[2],ct=Math.hypot(yt,xt);if(ct>1e-12){let rt=[-xt/ct,0,yt/ct];t.tri(Z,it,St,rt,p),t.tri(Z,St,dt,rt,p)}continue}let L=d(M,_),Y=d(B,_),j=d(B,_+1),$=d(M,_+1);t.triN(L,Y,j,w,D,X,h),t.triN(L,j,$,w,X,U,h)}let O=d(M,0),E=d(B,0),I=d(B,c),k=d(M,c),R=_=>[_[0],a,_[2]];t.tri(R(O),R(I),R(E),[0,-1,0],b),t.tri(R(O),R(k),R(I),[0,-1,0],b),F(O,E),F(k,I)}if(!e.closed)for(let M of[0,l-1])for(let B=0;B<c;B++)F(d(M,B),d(M,B+1))}function ae(t,n,e){let{bottomY:i,colors:o,ao:a}=e,r=new Float64Array(n.binCount).fill(-1/0);for(let f of n.rings)for(let m of f.arcs){let u=new Float64Array(m.binCount),h=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount,d=Math.max(0,m.innerR[p]-ot);u[p]=Math.max(d,r[y]+.001),h[p]=Math.max(u[p]+.001,m.outerR[p]+ot)}let b=0;for(let p=0;p<m.binCount;p++){let y=m.topLevelM[p]-i;y>b&&(b=y)}b>=Po&&Fo(t,n,m,u,h,i,o,a);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount;h[p]>r[y]&&(r[y]=h[p])}}if(e.deriveShell===!1||Bo(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=Io*lt,c=wo*lt;for(let f of s.arcs){let m=[],u=[];for(let p=0;p<f.binCount;p++){let y=(f.startBin+p+.5)*n.binStepDeg,d=f.outerR[p]+ot+l;m.push(pt(n.centre,d,y)),u.push(pt(n.centre,d+c,y))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let b=()=>h+To;f.closed?K(t,u,[m.slice().reverse()],b,i,o.shellTop,o.shellWall,a):K(t,[...u,...m.slice().reverse()],void 0,b,i,o.shellTop,o.shellWall,a)}}function ce(t,n,e,i,o,a,r,s){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,c=st(i,s.tierTop);if(!o)return;let f=y=>o.deckAt(y.x,y.y),m=zn(n,r),u=m[0]??n.outline;if(o.rowLevels.length>=2){let y=Wt(o.rowLevels),d=Zn(Un(o.rowLevels,e.focal,y),m),x=()=>[0,1,0];for(let S of d){let C=Math.max(l,S.topY-.02);for(let A of a.subtract(S.outline,C))K(t,A,S.holes,()=>C,l,c,s.tierWall,W,void 0,x)}d.length||K(t,u,n.holes,()=>o.landingY,l,c,s.tierWall,W);let T={tread:[c[0]*W.top,c[1]*W.top,c[2]*W.top],riser:[c[0]*.72,c[1]*.72,c[2]*.72]};for(let S of m.length?m:[u])jn(t,o.rowLevels,e.focal,o.landingY,T,S,y);return}let h=o.flat?1/0:Kn,b=y=>o.normalAt(y.x,y.y),p=o.flat?o.landingY:void 0;for(let y of a.subtract(u,p))K(t,y,n.holes,f,l,c,s.tierWall,W,h,b)}function Co(t,n,e){let i=new Set;for(let r of t.objects)r.type==="section"&&i.add(r.id);let o=new Map;for(let r=0;r<n.length;r++){let s=e.seatOwner[r];if(!s||!i.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let c=n[r],f=o.get(s);f||(f=new Map,o.set(s,f));let m=c.rowId||`__seat-${r}`,u=f.get(m);u||(u={pts:[],levelM:0,n:0},f.set(m,u)),u.pts.push({x:c.x,y:c.y}),u.levelM+=e.seatDeckY(r),u.n++}let a=[];for(let r of t.objects){if(r.type!=="section")continue;let s=e.bySection.get(r.id);if(s&&s.rowLevels.length>=2){let c=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));c.length>=2&&a.push({sectionId:r.id,rows:c});continue}let l=o.get(r.id);l&&a.push({sectionId:r.id,rows:[...l.values()].map(c=>({pts:c.pts,levelM:c.levelM/c.n}))})}return a}function ue(t,n,e,i,o,a,r=!0){let s=Co(n,e,i);if(!s.length)return;let l=An(s,n.focal);l&&(t.setMaterial(0),ae(t,l,{bottomY:n.baseHeightM,colors:{bandTop:et(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??et(o.tierWall,1.15),shellWall:a??o.tierWall},ao:W,shapes:n.objects.filter(c=>c.type==="shape"),deriveShell:r}))}var vo=6,ko=2.2,le=.1,Oo=.3,Lo=1.8,Go=.9,Do=.55,No=6e3;function me(t){let{doc:n,units:e,seats:i,surfaces:o,focal:a}=t,r=n.zones??[],s=[];if(r.length){let l=new Map;for(let f of e)for(let m of f.objects)m.type==="section"&&m.zone&&l.set(m.id,m.zone);let c=new Map;for(let f=0;f<i.length;f++){let m=i[f],u=o.seatOwner[f],h=m.zoneId??(u?l.get(u):void 0);if(!h)continue;let b=c.get(h);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},c.set(h,b)),b.n++,m.x<b.minX&&(b.minX=m.x),m.y<b.minY&&(b.minY=m.y),m.x>b.maxX&&(b.maxX=m.x),m.y>b.maxY&&(b.maxY=m.y),b.sumY+=o.seatDeckY(f)}for(let f of r){let m=c.get(f.id),u=[];for(let[h,b]of l)b===f.id&&u.push(h);if(!m||m.n===0){s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]});continue}s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:m.n,center:[(m.minX+m.maxX)/2*g,m.sumY/m.n,(m.minY+m.maxY)/2*g],radius:.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||1,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]})}}return s}function fe(t){let{doc:n,units:e,seats:i,surfaces:o,seatData:a,hintedSeatFloor:r,zones:s,focal:l}=t,c=[],f=[],m=[];for(let u of s)u.seatCount!==0&&c.push({id:`zone:${u.id}`,kind:"zone",text:u.label,anchor:[u.center[0],u.center[1]+vo,u.center[2]],color:n.zones?.find(h=>h.id===u.id)?.color});{let u=new Map,h=new Map;for(let b=0;b<i.length;b++){let p=o.seatOwner[b];if(!p)continue;let y=u.get(p);y||(y={n:0,x:0,y:0,deck:0},u.set(p,y)),y.n++,y.x+=i[b].x,y.y+=i[b].y,y.deck+=o.seatDeckY(b);let d=h.get(p);d||(d={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,d)),i[b].x<d.minX&&(d.minX=i[b].x),i[b].x>d.maxX&&(d.maxX=i[b].x),i[b].y<d.minY&&(d.minY=i[b].y),i[b].y>d.maxY&&(d.maxY=i[b].y)}for(let b of e)for(let p of b.objects){if(p.type!=="section")continue;let y=u.get(p.id);if(!y||y.n===0)continue;let d=h.get(p.id),x=[y.x/y.n*g,y.deck/y.n,y.y/y.n*g],T=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:b.index,label:T,seatCount:y.n,center:x,radius:Math.max(1,Math.hypot(d.maxX-d.minX,d.maxY-d.minY)*.5*g),focalWorld:[b.focal.x*g,b.baseHeightM+1.5,b.focal.y*g]});let S=n.floors?.[b.index]?.name?.trim().toLocaleLowerCase();e.length>1&&S===T.trim().toLocaleLowerCase()||c.push({id:`section:${p.id}`,kind:"section",text:T,anchor:[x[0],x[1]+ko,x[2]],floorIndex:b.index})}}{for(let b of e)for(let p of b.objects){if(p.type!=="gaArea")continue;let y=At(p.points);if(!y)continue;let d=p.displayLabel||p.label||p.id;c.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${d} \xB7 ${p.capacity.toLocaleString()}`:d,anchor:[y.x*g,b.baseHeightM+Lo,y.y*g],floorIndex:b.index})}let u=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=Math.hypot(p.x-l.x,p.y-l.y),d=u.get(p.rowId);(!d||y>d.far)&&u.set(p.rowId,{seat:p,index:b,far:y})}for(let[b,p]of u){let y=p.seat.label?p.seat.label.lastIndexOf("-"):-1,d=y>0?p.seat.label.slice(0,y):b;d&&c.push({id:`row:${b}`,kind:"row",text:d,anchor:[p.seat.x*g,o.seatDeckY(p.index)+Go,p.seat.y*g],floorIndex:r[p.index]})}let h=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=p.label?p.label.lastIndexOf("-"):-1,d=h.get(p.rowId);d||(d={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?p.label.slice(0,y):p.rowId,sectionId:p.sectionId},h.set(p.rowId,d));let x=b*3,T=a.iPosition[x],S=a.iPosition[x+1],C=a.iPosition[x+2];d.n++,d.x+=T,d.y+=S,d.z+=C,d.minX=Math.min(d.minX,T),d.maxX=Math.max(d.maxX,T),d.minZ=Math.min(d.minZ,C),d.maxZ=Math.max(d.maxZ,C)}for(let[b,p]of h)m.push({id:b,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(i.length<=No)for(let b=0;b<i.length;b++){let p=i[b],y=p.displayLabel||p.label;y&&c.push({id:`seat:${p.id}`,kind:"seat",text:y,anchor:[p.x*g,o.seatDeckY(b)+Do,p.y*g],floorIndex:r[b]})}}for(let u of e)for(let h of u.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let b=bt(h),p=b?At(b):null;if(!p||!h.label)continue;c.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*g,u.baseHeightM+Et(h).heightM+le,p.y*g],color:h.fill,floorIndex:u.index})}else if(h.type==="text"){if(!h.text)continue;c.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*g,u.baseHeightM+le,h.position.y*g],color:h.color,rotation:h.rotation,floorIndex:u.index})}else if(h.type==="booth"){let b=Ct(h);if(!b)continue;let p=At(b);if(!p)continue;c.push({id:`booth:${h.id}`,kind:"booth",text:h.displayLabel||h.label||h.id,anchor:[p.x*g,u.baseHeightM+cn+Oo,p.y*g],floorIndex:u.index})}return{labels:c,sections:f,rows:m}}function he(t,n){if(n.length>1)for(let e of n)t.push({id:`floor:${e.id}`,kind:"floor",text:e.label,anchor:[e.center[0],e.box.max[1]+1.2,e.center[2]],floorIndex:e.index})}function be(t){let{doc:n,units:e,seats:i,surfaces:o,solids:a,hintedSeatFloor:r,seatFloor:s}=t,l=[];{let c=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let u=0;u<a.floor.length;u+=1){let h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[u]))),b=u*3,p=c[h];p.minX=Math.min(p.minX,a.position[b]),p.minY=Math.min(p.minY,a.position[b+1]),p.minZ=Math.min(p.minZ,a.position[b+2]),p.maxX=Math.max(p.maxX,a.position[b]),p.maxY=Math.max(p.maxY,a.position[b+1]),p.maxZ=Math.max(p.maxZ,a.position[b+2])}let f=new Map;for(let u=0;u<e.length;u++)for(let h of e[u].objects)h.type==="section"&&f.set(h.id,u);let m=e.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 u=0;u<i.length;u++){let h=o.seatOwner[u],b=(h!==null?f.get(h):void 0)??r[u];if(b===void 0)continue;let p=m[b],y=i[u];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 d=o.seatDeckY(u);p.sumX+=y.x*g,p.sumDeck+=d,p.sumZ+=y.y*g,p.minDeck=Math.min(p.minDeck,d),p.maxDeck=Math.max(p.maxDeck,d+1.6),s[u]=b}for(let u=0;u<e.length;u++){let h=m[u],b=n.floors?.[u],p=c[u],y=Math.min(h.n?h.minX*g:e[u].focal.x*g-1,Number.isFinite(p.minX)?p.minX:1/0),d=Math.max(h.n?h.maxX*g:e[u].focal.x*g+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(h.n?h.minY*g:e[u].focal.y*g-1,Number.isFinite(p.minZ)?p.minZ:1/0),T=Math.max(h.n?h.maxY*g:e[u].focal.y*g+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),S=Math.min(h.n?Math.min(e[u].baseHeightM,h.minDeck):e[u].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),C=Math.max(h.n?Math.max(h.maxDeck,S+.5):S+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),A=[h.n?h.sumX/h.n:(y+d)/2,h.n?h.sumDeck/h.n:(S+C)/2,h.n?h.sumZ/h.n:(x+T)/2],P=Math.max(1,.5*Math.hypot(d-y,C-S,T-x));l.push({index:u,id:b?.id??`floor-${u}`,label:b?.name??(e.length>1?`Floor ${u+1}`:"Venue"),seatCount:h.n,center:A,radius:P,box:{min:[y,S,x],max:[d,C,T]},focalWorld:[e[u].focal.x*g,e[u].baseHeightM+1.5,e[u].focal.y*g]})}}return l}function mn(t,n){let e=1/0,i=1/0,o=-1/0,a=-1/0,r=(s,l)=>{s<e&&(e=s),l<i&&(i=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)r(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let c of l.outline)r(c.x,c.y);else if(l.type==="shape"&&l.points)for(let c of l.points)r(c.x,c.y);else if(l.type==="gaArea")for(let c of l.points)r(c.x,c.y);else if(l.type==="booth"){let c=Ct(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="table"){let c=un(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="decorImage"){let c=ln(l);if(c)for(let f of c)r(f.x,f.y)}return Number.isFinite(e)||(e=-100,i=-100,o=100,a=100),{minX:e,minY:i,maxX:o,maxY:a}}function pe(t,n,e,i,o,a){if(n.length===1){let r=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=_t(o.minX-r,o.minY-r,o.maxX-o.minX+r*2,o.maxY-o.minY+r*2);K(t,s,void 0,()=>0,-.4,a.ground,a.ground,W)}else{let r=n.reduce((h,b)=>b.baseHeightM<h.baseHeightM?b:h);t.setFloor(r.index);let s=e.filter((h,b)=>i[b]===r.index),l=mn([r],s),c=Math.hypot(l.maxX-l.minX,l.maxY-l.minY),f=Math.max(28,Math.min(80,c*.04)),m=_t(l.minX-f,l.minY-f,l.maxX-l.minX+f*2,l.maxY-l.minY+f*2),u=r.baseHeightM-.03;K(t,m,void 0,()=>u,u-.22,a.ground,a.ground,W)}}function de(t,n,e){let{cx:i,cz:o,radius:a}=e,r=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,m=-1/0,u=(p,y,d)=>{r=Math.min(r,p),c=Math.max(c,p),s=Math.min(s,y),f=Math.max(f,y),l=Math.min(l,d),m=Math.max(m,d)};for(let p=0;p<t.position.length;p+=3)u(t.position[p],t.position[p+1],t.position[p+2]);for(let p=0;p<n.count;p++){let y=p*3,d=n.iPosition[y],x=n.iPosition[y+1],T=n.iPosition[y+2],S=Math.max(.35,n.iMaxRadius[p]??.35);u(d-S,x,T-S),u(d+S,x+1.6,T+S)}Number.isFinite(r)||(r=i-a,c=i+a,s=0,f=a*.16,l=o-a,m=o+a);let h=[(r+c)/2,(s+f)/2,(l+m)/2],b=Math.max(1,.5*Math.hypot(c-r,f-s,m-l));return{center:h,radius:b,minY:s,maxY:f}}function ye(t,n,e,i,o,a){let r=1/0,s=1/0,l=-1/0,c=-1/0;for(let S=0;S<t.count;S++){let C=S*3,A=t.iPosition[C],P=t.iPosition[C+2];A<r&&(r=A),A>l&&(l=A),P<s&&(s=P),P>c&&(c=P)}for(let S of n)r=Math.min(r,S.cx-S.halfX),l=Math.max(l,S.cx+S.halfX),s=Math.min(s,S.cz-S.halfZ),c=Math.max(c,S.cz+S.halfZ);let f=e.minX*g,m=e.maxX*g,u=e.minY*g,h=e.maxY*g,b=f,p=m,y=u,d=h;if(Number.isFinite(r)){let S=Math.max(2,.06*Math.hypot(l-r,c-s));b=Math.max(f,r-S),p=Math.min(m,l+S),y=Math.max(u,s-S),d=Math.min(h,c+S)}let x=Math.min(0,i),T=Math.max(o,a*.05);return{min:[b,x,y],max:[p,T,d]}}function xe(t,n,e){let i=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return i();let o=bn(n);if(!o.ok||o.value.id!==t)return i();let a=new Map;for(let m of e)for(let u of m.objects)u.type==="shape"&&a.set(u.id,{shape:u,unit:m});let r=new Set,s=new Set,l=new Map((n.overlay.productionElements??[]).map(m=>{let u=m.runtimeContentImageUrl;return[m.id,typeof u=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(u)?u:void 0]})),c=[];for(let m of o.value.overlay.productionElements??[]){let u=a.get(m.objectId),h=u?bt(u.shape):null,b=m.baseElevationM??0;if(!u||!h||h.length<3||!m.id||r.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(b)||b<-10||b>100)return i();r.add(m.id),s.add(m.objectId);let p=h.map(F=>F.x*g),y=h.map(F=>F.y*g),d=u.unit.baseHeightM+b,x=Math.min(...p),T=Math.max(...p),S=Math.min(...y),C=Math.max(...y),A,P=l.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&P)if(T-x>=C-S){let F=Math.abs(S-u.unit.focal.y*g)<=Math.abs(C-u.unit.focal.y*g)?S-.006:C+.006;A=[[x,d,F],[T,d,F],[x,d+m.heightM,F],[T,d+m.heightM,F]]}else{let F=Math.abs(x-u.unit.focal.x*g)<=Math.abs(T-u.unit.focal.x*g)?x-.006:T+.006;A=[[F,d,S],[F,d,C],[F,d+m.heightM,S],[F,d+m.heightM,C]]}c.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:u.unit.index,baseY:d,topY:d+m.heightM,bounds:{min:[x,d,S],max:[T,d+m.heightM,C]},occlusion:m.occlusion,...P?{contentImageUrl:P}:{},...A?{contentPlane:A}:{}})}let f=c.sort((m,u)=>m.id.localeCompare(u.id));return{byObjectId:new Map(f.map(m=>[m.objectId,m])),elements:f}}function Q(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function J(t){return Array.isArray(t)?t:[]}function Xo(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Q(e))continue;let i=Q(e.extensions)?e.extensions:null;if(i&&Object.prototype.hasOwnProperty.call(i,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Zt(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Uo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Yo(t,n){let e=new Array(16).fill(0);for(let i=0;i<4;i++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[i*4+o]+=t[a*4+o]*n[i*4+a];return e}function jo(t){let n=Zt(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:Zt(t.translation,3),i=t.rotation===void 0?[0,0,0,1]:Zt(t.rotation,4),o=t.scale===void 0?[1,1,1]:Zt(t.scale,3);if(!e||!i||!o)return null;let[a,r,s,l]=i,c=Math.hypot(a,r,s,l);if(!(c>1e-8))return null;let f=a/c,m=r/c,u=s/c,h=l/c,b=f+f,p=m+m,y=u+u,d=f*b,x=f*p,T=f*y,S=m*p,C=m*y,A=u*y,P=h*b,F=h*p,v=h*y;return[(1-(S+A))*o[0],(x+v)*o[0],(T-F)*o[0],0,(x-v)*o[1],(1-(d+A))*o[1],(C+P)*o[1],0,(T+F)*o[2],(C-P)*o[2],(1-(d+S))*o[2],0,e[0],e[1],e[2],1]}function Ho(t,n,e,i){return[t[0]*n+t[4]*e+t[8]*i+t[12],t[1]*n+t[5]*e+t[9]*i+t[13],t[2]*n+t[6]*e+t[10]*i+t[14]]}function Vo(t){let n=t[0],e=t[4],i=t[8],o=t[1],a=t[5],r=t[9],s=t[2],l=t[6],c=t[10],f=a*c-r*l,m=r*s-o*c,u=o*l-a*s,h=n*f+e*m+i*u;if(Math.abs(h)<1e-12)return null;let b=1/h;return[f*b,m*b,u*b,(i*l-e*c)*b,(n*c-i*s)*b,(e*s-n*l)*b,(e*r-i*a)*b,(i*o-n*r)*b,(n*a-e*o)*b]}function ge(t,n,e,i){let o=t[0]*n+t[1]*e+t[2]*i,a=t[3]*n+t[4]*e+t[5]*i,r=t[6]*n+t[7]*e+t[8]*i,s=Math.hypot(o,a,r)||1;return o/=s,a/=s,r/=s,[o,a,r]}function Wo(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,i=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),r=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(r===1313821514&&!i)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Q(l))return null;i=l}catch{return null}else if(r===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&i&&o?{json:i,bin:o}:null}function zo(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function Zo(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function Ko(t,n,e){return e===5120?t.getInt8(n):e===5121?t.getUint8(n):e===5122?t.getInt16(n,!0):e===5123?t.getUint16(n,!0):e===5125?t.getUint32(n,!0):t.getFloat32(n,!0)}function $o(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Wo(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:i,bin:o}=e;if(!Q(i.asset)||i.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=J(i.extensionsUsed).filter(S=>typeof S=="string");if(a.includes("KHR_draco_mesh_compression")||Xo(i))return{ok:!1,issue:"draco_not_allowed"};if(a.length||J(i.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(J(i.images).length||J(i.textures).length)return{ok:!1,issue:"external_resource"};let r=J(i.buffers);if(r.length!==1||!Q(r[0])||r[0].uri!==void 0||typeof r[0].byteLength!="number"||!Number.isInteger(r[0].byteLength)||r[0].byteLength<0||r[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=J(i.accessors),l=J(i.bufferViews),c=J(i.meshes),f=J(i.nodes),m=J(i.scenes),u=typeof i.scene=="number"?i.scene:0;if(!Q(m[u]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(S,C,A)=>{if(typeof S!="number"||!Number.isInteger(S)||!Q(s[S]))return null;let P=s[S];if(P.type!==C||P.sparse!==void 0||P.normalized===!0||typeof P.count!="number"||!Number.isInteger(P.count)||P.count<1||typeof P.componentType!="number"||!A.includes(P.componentType)||typeof P.bufferView!="number")return null;let F=l[P.bufferView];if(!Q(F)||F.buffer!==0||typeof F.byteLength!="number"||!Number.isInteger(F.byteLength)||F.byteLength<0)return null;let v=Zo(P.type),G=zo(P.componentType),N=typeof F.byteStride=="number"?F.byteStride:v*G,M=typeof F.byteOffset=="number"?F.byteOffset:0,B=typeof P.byteOffset=="number"?P.byteOffset:0,O=M+B,E=B+(P.count-1)*N+v*G;if(!Number.isInteger(N)||!Number.isInteger(M)||!Number.isInteger(B)||N<v*G||M<0||B<0||M+F.byteLength>o.byteLength||E>F.byteLength)return null;let I=[];for(let k=0;k<P.count;k++){let R=[];for(let _=0;_<v;_++){let w=Ko(h,O+k*N+_*G,P.componentType);if(!Number.isFinite(w))return null;R.push(w)}I.push(R)}return I},p=[],y=[],d=0,x=new Set,T=(S,C)=>{if(typeof S!="number"||!Number.isInteger(S)||!Q(f[S])||x.has(S))return!1;x.add(S);let A=f[S],P=jo(A);if(!P)return!1;let F=Yo(C,P),v=Vo(F);if(!v)return!1;if(A.mesh!==void 0){if(typeof A.mesh!="number")return!1;let G=c[A.mesh];if(!Q(G))return!1;for(let N of J(G.primitives)){if(!Q(N)||N.mode!==void 0&&N.mode!==4||!Q(N.attributes))return!1;let M=b(N.attributes.POSITION,"VEC3",[5126]),B=N.attributes.NORMAL===void 0?null:b(N.attributes.NORMAL,"VEC3",[5126]);if(!M||N.attributes.NORMAL!==void 0&&!B)return!1;let O=M.length;if(N.indices!==void 0){let I=typeof N.indices=="number"?s[N.indices]:null;O=Q(I)?I.count:void 0}if(typeof O!="number"||!Number.isInteger(O)||O%3!==0||(d+=O/3,d>1e5))return!1;let E=N.indices===void 0?M.map((I,k)=>[k]):b(N.indices,"SCALAR",[5121,5123,5125]);if(!E||E.length%3!==0||E.length!==O)return!1;for(let I=0;I<E.length;I+=3){let k=[E[I][0],E[I+1][0],E[I+2][0]];if(k.some(w=>!Number.isInteger(w)||w<0||w>=M.length))return!1;let R=k.map(w=>Ho(F,...M[w])),_=null;if(!B){let w=R[1][0]-R[0][0],D=R[1][1]-R[0][1],X=R[1][2]-R[0][2],U=R[2][0]-R[0][0],L=R[2][1]-R[0][1],Y=R[2][2]-R[0][2];_=ge([1,0,0,0,1,0,0,0,1],D*Y-X*L,X*U-w*Y,w*L-D*U)}for(let w=0;w<3;w++)p.push(...R[w]),y.push(...B?ge(v,...B[k[w]]):_)}}}for(let G of J(A.children))if(!T(G,F))return!1;return x.delete(S),!0};for(let S of J(m[u].nodes))if(!T(S,Uo()))return{ok:!1,issue:d>1e5?"triangle_limit":"unsupported_glb"};return!d||p.length!==d*9||y.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:d,position:new Float32Array(p),normal:new Float32Array(y)}}function Me(t){try{return $o(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function hs(t){let{doc:n}=t,e=Fn(n.theme),i=e.structure,o=Wn(n,t.eventConfigurationId??n.eventConfigurationId),a=xe(t.eventConfigurationId,t.eventConfiguration,o),r=t.seats,s=new Yt,l=null;if(t.registeredShellGlb){let E=Me(t.registeredShellGlb);if(E.ok){let I=E.position.length/3,k=new Float32Array(E.position.length),R=e.materials.shell??i.tierWall;for(let _=0;_<I;_++){let w=E.normal[_*3+1],D=w<-.25?.4:.62+.38*Math.max(0,w);k[_*3]=R[0]*D,k[_*3+1]=R[1]*D,k[_*3+2]=R[2]*D}l={position:E.position,normal:E.normal,color:k,floor:new Float32Array(I).fill(-2),material:new Float32Array(I),count:I}}}let c=new Map;for(let E of o)for(let I of E.objects)c.set(I.id,E.index),I.type==="section"&&c.set(I.logicalSectionId??I.id,E.index);let f=r.map(E=>c.get(E.sectionId??"")??c.get(E.rowId??"")??0),m=mn(o,r);pe(s,o,r,f,m,i);let u=qn(n,r),h=new Map,b=new Map;for(let E of n.categories??[])h.set(E.key,E.color),E.seatGlyph&&b.set(E.key,E.seatGlyph);let p=[],y=$n(o,r,f),d=new Float32Array(r.length);for(let E=0;E<o.length;E++){let I=o[E];s.setFloor(E);let k=new zt,R=[],_=I.objects.filter(w=>w.type==="section"&&!!w.outline&&w.outline.length>=3);for(let w of I.objects)if(w.type==="section")ce(s,w,I,Jn(w,u),y.bySection.get(w.id),k,_,i);else if(w.type==="shape"){let D=a.byObjectId.get(w.id);s.setMaterial((D?.kind??w.role)==="screen"?1:0),re(s,w,I.baseHeightM,Qn(w,R),i,I.focal,p,D),s.setMaterial(0)}else w.type==="gaArea"?se(s,w,I.baseHeightM,H(h.get(w.categoryKey)),i):w.type==="booth"?ee(s,w,I.baseHeightM,H(h.get(w.categoryKey)),i):w.type==="table"?oe(s,w,I.baseHeightM,H(h.get(w.categoryKey)),i):w.type==="decorImage"&&ie(s,w,I.baseHeightM,i);ue(s,I,r,y,i,e.materials.shell,!l)}let x=o.length>1?{x:o.reduce((E,I)=>E+I.focal.x,0)/o.length,y:o.reduce((E,I)=>E+I.focal.y,0)/o.length}:n.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},T=wn(l?[s.build(),l]:[s.build()]),S=En(r,t.initialState,y,d,h,b),C=me({doc:n,units:o,seats:r,surfaces:y,focal:x}),{labels:A,sections:P,rows:F}=fe({doc:n,units:o,seats:r,surfaces:y,seatData:S,hintedSeatFloor:f,zones:C,focal:x}),v=be({doc:n,units:o,seats:r,surfaces:y,solids:T,hintedSeatFloor:f,seatFloor:d});he(A,v),S.iYaw=Bn(S.iPosition,r.length,E=>r[E].rowId,E=>{let I=o[d[E]]?.focal??x;return[I.x*g,I.y*g]});let G=(m.minX+m.maxX)/2*g,N=(m.minY+m.maxY)/2*g,M=.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||10,B=de(T,S,{cx:G,cz:N,radius:M}),O=ye(S,p,m,B.minY,B.maxY,M);return{solids:T,seats:S,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:M,groundY:0,box:O},renderBounds:{center:B.center,radius:B.radius},stateColorLUT:Cn(e,Bt),theme:e,seatCount:r.length,focalWorld:[x.x*g,1.5,x.y*g],zones:C,stages:p,productionElements:a.elements,sections:P,rows:F,labels:A,floors:v}}export{Bt as a,Qt as b,rr as c,nn as d,g as e,sr as f,Oe as g,ar as h,Vt as i,dr as j,yr as k,Mr as l,Sr as m,Rr as n,Ar as o,Pr as p,Ir as q,wr as r,Tr as s,_r as t,hs as u};
@@ -0,0 +1 @@
1
+ import{c as le}from"./chunk-CRCGO52K.js";var Xt=40,zt=1200,Kt=.8,Vt=3,$t=-2,Wt=20,Yt=.1,qt=40,Jt=40,ue=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function $e(e,t){let n=e.text.split(/\r?\n/);if(!e.width)return Math.max(1,n.length);let o=Math.max(1,Math.floor(t/ue(e))),r=0;for(let i of n){if(!i.length){r+=1;continue}let c=0;for(let u of i.split(/\s+/)){let s=u.length;c&&c+1+s<=o?c+=1+s:(r+=Math.max(1,Math.ceil(s/o)),c=s%o)}}return Math.max(1,r)}function fe(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),o=Math.max(1,...n.map(u=>u.length))*ue(e),r=e.width??o+t*2,i=Math.max(1,r-t*2),c=$e(e,i);return{width:r,height:c*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:c,padding:t}}var We=Math.PI/180;function I(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Ye(e,t,n){let o=Math.cos(n),r=Math.sin(n),i=e.x-t.x,c=e.y-t.y;return{x:t.x+i*o-c*r,y:t.y+i*r+c*o}}function Zt(e,t){return Ye(e,{x:0,y:0},t*We)}function O(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function qe(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 en(e){return e.length?qe(e):null}function Y(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,c=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+c*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+c*e.end.y}}function on(e,t,n){let o={x:(e.x+t.x)/2,y:(e.y+t.y)/2},r={x:(n.x-o.x)*4/3,y:(n.y-o.y)*4/3};return{start:{...e},control1:{x:e.x+(t.x-e.x)/3+r.x,y:e.y+(t.y-e.y)/3+r.y},control2:{x:e.x+(t.x-e.x)*2/3+r.x,y:e.y+(t.y-e.y)*2/3+r.y},end:{...t}}}function me(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[Y(e,.5)];let o=Array.from({length:n+1},(s,f)=>Y(e,f/n)),r=new Float64Array(o.length);for(let s=1;s<o.length;s+=1){let f=o[s].x-o[s-1].x,a=o[s].y-o[s-1].y;r[s]=r[s-1]+Math.hypot(f,a)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let c=[],u=1;for(let s=0;s<t;s+=1){let f=i*s/(t-1);for(;u<r.length-1&&r[u]<f;)u+=1;let a=r[u-1],m=r[u],d=m===a?0:(f-a)/(m-a);c.push({x:o[u-1].x+(o[u].x-o[u-1].x)*d,y:o[u-1].y+(o[u].y-o[u-1].y)*d})}return c}function T(e,t){return{x:e.x+t.x,y:e.y+t.y}}function F(e,t){return{x:e.x-t.x,y:e.y-t.y}}function R(e,t){return{x:e.x*t,y:e.y*t}}function B(e,t=13){return Array.from({length:t},(n,o)=>Y(e,o/(t-1)))}function de(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),o=Math.min(e.length-2,Math.floor(n));return O(e[o],e[o+1],n-o)}function he(e,t,n){let o=Math.max(0,Math.min(1,t)),r=Math.max(o,Math.min(1,n)),i=[de(e,o)];for(let c=1;c<e.length-1;c+=1){let u=c/(e.length-1);u>o+1e-9&&u<r-1e-9&&i.push(e[c])}return i.push(de(e,r)),i}function pe(e,t){let n=[[0,1],[1,2],[2,3],[3,0]],o=0,r=Number.POSITIVE_INFINITY;n.forEach(([d,x],p)=>{let y=I(O(e[d],e[x],.5),t);y<r&&(r=y,o=p)});let i=e[o],c=e[(o+1)%4],u=e[(o+2)%4],s=e[(o+3)%4],f=O(i,c,.5),a=F(t,f),m=Math.max(1e-9,Math.hypot(a.x,a.y));return{p0:i,p1:c,p2:u,p3:s,normal:R(a,1/m),depth:(I(i,s)+I(c,u))/2}}function ye(e){let{p0:t,p1:n,p2:o,p3:r,normal:i,depth:c}=e,u=F(n,t),s=F(o,r),f=c*.22,a=c*.12;return{nearPath:{start:t,control1:T(T(t,R(u,1/3)),R(i,f)),control2:T(T(t,R(u,2/3)),R(i,f)),end:n},farPath:{start:o,control1:T(T(r,R(s,2/3)),R(i,a)),control2:T(T(r,R(s,1/3)),R(i,a)),end:r}}}function rn(e,t,n){if(e.length!==4)throw new Error("A section shell requires four mapped bounds corners");let o=e.reduce((p,y)=>T(p,y),{x:0,y:0});o.x/=4,o.y/=4;let r=I(e[0],e[1]),i=I(e[0],e[3]),c=n==="auto"?r>i*1.25&&I(o,t)>i?"bezier":"tapered":n;if(c==="rectangle")return{mode:c,outline:e.map(p=>({...p}))};let u=pe(e,t),{p0:s,p1:f,p2:a,p3:m}=u;if(c==="tapered")return{mode:c,outline:[T(s,R(F(f,s),.14)),T(s,R(F(f,s),1-.14)),a,m]};let{nearPath:d,farPath:x}=ye(u);return{mode:c,outline:[...B(d),...B(x).slice(1)]}}function sn(e,t,n,o){if(e.length!==4)throw new Error("Aisle generation requires four mapped bounds corners");if(!Number.isInteger(n)||n<0||n>3)throw new Error("Aisle count must be an integer from 0 to 3");if(n===0)return[];let r=pe(e,t),{p0:i,p1:c,p2:u,p3:s}=r,f=o==="bezier"?ye(r):null,a=f?B(f.nearPath):null,m=f?B(f.farPath).reverse():null,d=Math.min(.055,.18/(n+1));return Array.from({length:n},(x,p)=>{let y=(p+1)/(n+1),h=y-d/2,b=y+d/2;return a&&m?[...he(a,h,b),...he(m,h,b).reverse()]:[O(i,c,h),O(i,c,b),O(s,u,b),O(s,u,h)]})}function Je(e,t,n){let o=n.x-t.x,r=n.y-t.y,i=o*o+r*r,c=i?Math.max(0,Math.min(1,((e.x-t.x)*o+(e.y-t.y)*r)/i)):0;return Math.hypot(e.x-(t.x+c*o),e.y-(t.y+c*r))}function Qe(e,t){let n=1/0;for(let o of t)if(!(o.length<2))for(let r=0,i=o.length-1;r<o.length;i=r++){let c=Je(e,o[i],o[r]);c<n&&(n=c)}return n}function xe(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,c=t[o].y,u=t[r].x,s=t[r].y;c>e.y!=s>e.y&&e.x<(u-i)*(e.y-c)/(s-c)+i&&(n=!n)}return n}function Ze(e,t,n){let o=xe(e,t)&&!n.some(i=>xe(e,i)),r=Qe(e,[t,...n]);return o?r:-r}function L(e,t,n,o,r){let i=Ze({x:e,y:t},o,r);return{x:e,y:t,h:n,d:i,max:i+n*Math.SQRT2}}var q=class{constructor(){this.items=[]}get size(){return this.items.length}push(t){let n=this.items;n.push(t);let o=n.length-1;for(;o>0;){let r=o-1>>1;if(n[r].max>=n[o].max)break;[n[r],n[o]]=[n[o],n[r]],o=r}}pop(){let t=this.items,n=t[0],o=t.pop();if(t.length&&o){t[0]=o;let r=0;for(;;){let i=r*2+1,c=i+1,u=r;if(i<t.length&&t[i].max>t[u].max&&(u=i),c<t.length&&t[c].max>t[u].max&&(u=c),u===r)break;[t[u],t[r]]=[t[r],t[u]],r=u}}return n}};function be(e){if(e.length<3)return 0;let t=0;for(let n=0,o=e.length-1;n<e.length;o=n++)t+=(e[o].x+e[n].x)*(e[o].y-e[n].y);return Math.abs(t)/2}function an(e,t){return Math.max(0,be(e)-(t??[]).reduce((n,o)=>n+be(o),0))}function ge(e,t){let n=t??[];if(!e.length)return{point:{x:0,y:0},radius:0};if(e.length<3){let y=e.reduce((b,S)=>b+S.x,0)/e.length,h=e.reduce((b,S)=>b+S.y,0)/e.length;return{point:{x:y,y:h},radius:0}}let o=1/0,r=1/0,i=-1/0,c=-1/0;for(let y of e)y.x<o&&(o=y.x),y.y<r&&(r=y.y),y.x>i&&(i=y.x),y.y>c&&(c=y.y);let u=i-o,s=c-r,f=Math.min(u,s);if(!(f>0))return{point:{x:(o+i)/2,y:(r+c)/2},radius:0};let a=Math.max(u,s)/150,m=new q,d=f/2;for(let y=o;y<i;y+=f)for(let h=r;h<c;h+=f)m.push(L(y+d,h+d,d,e,n));let x=L(o+u/2,r+s/2,0,e,n),p=0;for(;m.size;){let y=m.pop();if(!y)break;y.d>x.d&&(x=y),!(y.max-x.d<=a)&&(p>=4e3||(p+=1,d=y.h/2,m.push(L(y.x-d,y.y-d,d,e,n)),m.push(L(y.x+d,y.y-d,d,e,n)),m.push(L(y.x-d,y.y+d,d,e,n)),m.push(L(y.x+d,y.y+d,d,e,n))))}return{point:{x:x.x,y:x.y},radius:Math.max(0,x.d)}}function et(e,t,n){return Math.max(t,Math.min(n,e))}function un(e,t,n){return e<t?t:e>n?n:e}function tt(e){return et(e,0,1)}function we(e){let t=tt(e);return t*t*(3-2*t)}var k=Math.PI*2;function j(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function nt(e,t,n){let o=t-e;if(n){for(;o<0;)o+=k;for(;o>=k;)o-=k}else{for(;o>0;)o-=k;for(;o<=-k;)o+=k}return o}function mn(e){return e.end}function Pe(e){if(e.version!==1||e.closed!==!0||!j(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||!j(n.end))return!1;if(n.kind==="line"){if(I(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!j(n.control1)||!j(n.control2)||I(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!j(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(I(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(I(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||I(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return I(t,e.start)<=1e-4}function ot(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 pn(e,t=2){if(!Pe(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 c=Math.atan2(r.y-i.center.y,r.x-i.center.x),u=Math.atan2(i.end.y-i.center.y,i.end.x-i.center.x),s=nt(c,u,i.clockwise),f=Math.max(2,Math.ceil(Math.abs(s)*i.radius/n));for(let a=1;a<=f;a+=1){let m=c+s*a/f;o.push({x:i.center.x+Math.cos(m)*i.radius,y:i.center.y+Math.sin(m)*i.radius})}}else{let c=I(r,i.control1)+I(i.control1,i.control2)+I(i.control2,i.end),u=Math.max(2,Math.ceil(c/n));for(let s=1;s<=u;s+=1)o.push(ot(r,i,s/u))}r=i.end}return I(o[o.length-1],o[0])<=1e-4&&o.pop(),o}function ve(e,t,n){return rt(e,r=>({x:r.x+t,y:r.y+n}))}function rt(e,t,n=1,o=!1){return{...e,start:t(e.start),segments:e.segments.map(r=>r.kind==="line"?{...r,end:t(r.end)}:r.kind==="arc"?{...r,center:t(r.center),radius:r.radius*Math.abs(n),clockwise:o?!r.clockwise:r.clockwise,end:t(r.end)}:{...r,control1:t(r.control1),control2:t(r.control2),end:t(r.end)})}}var it=45,J=150,st=60;function ct(e){let t=it/100;if(e<=t)return J;let n=Math.min(1,(e-t)/(1-t));return J-n*(J-st)}var Se=.5523;function Me(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function at(e){let t=[],n=[];for(e.forEach((o,r)=>{j(o)&&(t.length&&Me(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&Me(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}function yn(e,t,n){return dt(e,{cornerSmoothing:t,...n})}var lt=.5,ut=4/3;function ft(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 c=-r/i,u=o/i,s=n*ut;return{kind:"bezier",control1:{x:e.x+o/3+c*s,y:e.y+r/3+u*s},control2:{x:e.x+o*2/3+c*s,y:e.y+r*2/3+u*s},end:{...t}}}function dt(e,t){let{points:n,sourceIndex:o}=at(e),r=n.length;if(r<3)return null;let i=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,c=t.edgeCurvature,u=new Array(r).fill(0);if(c?.length)for(let l=0;l<r;l+=1){let M=c[o[l]];u[l]=Number.isFinite(M)?Math.min(100,Math.max(-100,M))/100:0}let s=u.some(l=>Math.abs(l)>1e-6);if(i<=0&&!s)return null;let f=t.wideAngleThresholdDeg??ct(i),a=[];for(let l=0;l<r;l+=1)a[l]=I(n[l],n[(l+1)%r]);let m=new Array(r).fill(0);for(let l=0;l<r;l+=1){let M=n[(l-1+r)%r],w=n[l],P=n[(l+1)%r],C={x:M.x-w.x,y:M.y-w.y},E={x:P.x-w.x,y:P.y-w.y},A=Math.hypot(C.x,C.y),_=Math.hypot(E.x,E.y);if(A<=1e-9||_<=1e-9)continue;let H=Math.min(1,Math.max(-1,(C.x*E.x+C.y*E.y)/(A*_))),N=Math.acos(H)*180/Math.PI;if(N<f)continue;let W=we((N-f)/(180-f));m[l]=i*W*.5*Math.min(A,_)}for(let l=0;l<r;l+=1){let M=(l+1)%r,w=m[l]+m[M];if(w>a[l]&&w>1e-9){let P=a[l]/w;m[l]*=P,m[M]*=P}}let d=new Array(r),x=new Array(r);for(let l=0;l<r;l+=1){let M=n[(l-1+r)%r],w=n[l],P=n[(l+1)%r];if(m[l]<=1e-6){d[l]={...w},x[l]={...w};continue}let C=I(w,M)||1,E=I(w,P)||1;d[l]={x:w.x+(M.x-w.x)/C*m[l],y:w.y+(M.y-w.y)/C*m[l]},x[l]={x:w.x+(P.x-w.x)/E*m[l],y:w.y+(P.y-w.y)/E*m[l]}}if(m.every(l=>l<=1e-6)&&!s)return null;let p=[],y={...x[0]},h=y,b=(l,M)=>{if(I(h,l)<=1e-9)return;let w=u[M];Math.abs(w)>1e-6?p.push(ft(h,l,w*lt*a[M])):p.push({kind:"line",end:{...l}}),h=l};for(let l=1;l<=r;l+=1){let M=l%r,w=n[M];b(d[M],(l-1)%r),m[M]>1e-6&&I(d[M],x[M])>1e-9&&(p.push({kind:"bezier",control1:O(d[M],w,Se),control2:O(x[M],w,Se),end:{...x[M]}}),h=x[M])}if(!p.length)return null;let S=p[p.length-1];I(S.end,y)>1e-9&&(S.kind==="line"?S.end={...y}:p.push({kind:"line",end:{...y}}));let g={version:1,closed:!0,start:y,segments:p};return Pe(g)?g:null}function xn(e){let t=[],n=e.start;for(let r of e.segments)t.push(n),n=r.end;let o=[];for(let r=e.segments.length-1;r>=0;r-=1){let i=e.segments[r],c=t[r];i.kind==="line"?o.push({kind:"line",end:{...c}}):i.kind==="arc"?o.push({kind:"arc",center:{...i.center},radius:i.radius,clockwise:!i.clockwise,end:{...c}}):o.push({kind:"bezier",control1:{...i.control2},control2:{...i.control1},end:{...c}})}return{version:1,closed:!0,start:{...e.start},segments:o}}function gn(e,t,n){let o=[];for(let r=0;r<e.length-1;r+=1){let i=e[r],c=e[r+1],u=Math.hypot(c.x-i.x,c.y-i.y);if(u<=0)continue;let s=Math.max(1,Math.round(u/n)),f=u/s,a=Math.atan2(c.y-i.y,c.x-i.x),m=r===0,x=(r>0?t[r-1]:void 0)==="break"?2:1,p=m?{...i}:{x:i.x+Math.cos(a)*f*x,y:i.y+Math.sin(a)*f*x},y=m?s+1:Math.max(1,s-(x-1));o.push({origin:p,rotation:a*180/Math.PI,seatCount:y,seatSpacing:f})}return o}function wn(e){let t=e.rotation*Math.PI/180,n={x:Math.cos(t),y:Math.sin(t)};return Array.from({length:e.seatCount},(o,r)=>({x:e.origin.x+n.x*r*e.seatSpacing,y:e.origin.y+n.y*r*e.seatSpacing}))}function Sn(e){return e.reduce((t,n)=>t+n.seatCount,0)}function Ie(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((d,x)=>d.segmentedRow.componentIndex-x.segmentedRow.componentIndex),c=i[0]?.segmentedRow?.componentCount??0,u=i[0]?.segmentedRow;if(!u||!(c>=2&&i.length===c&&u?.boundaryBefore==="start"&&i.every((d,x)=>d.segmentedRow?.kind==="segmented-row-v1"&&d.segmentedRow.groupId===o&&d.segmentedRow.componentCount===c&&d.segmentedRow.componentIndex===x&&d.segmentedRow.repeatLabelOnComponents===u.repeatLabelOnComponents&&(x===0?d.segmentedRow.boundaryBefore==="start":d.segmentedRow.boundaryBefore!=="start")&&d.segmentedRow.displayLabel===u.displayLabel)))continue;let f=i.reduce((d,x)=>d+x.seatCount,0),a=0,m=0;for(let d of i)d.segmentedRow.boundaryBefore==="break"&&(a+=1),t.set(d.id,{groupId:o,adjacencyOffset:a,displayOffset:m,displayLabel:u.displayLabel,totalSeats:f,canonical:i[0],viewFromSeatUrl:u.viewFromSeatUrl,viewFromSeatMeta:u.viewFromSeatMeta,confidenceEvidence:u.confidenceEvidence}),a+=d.seatCount,m+=d.seatCount}return t}var Ce="ABCDEFGHIJKLMNOPQRSTUVWXYZ",ht="ABCDEFGHJKLMNPQRSTUVWXYZ",mt="abcdefghijklmnopqrstuvwxyz";function Ee(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 pt(e,t){let n=t.startAt-1,o=e+n;if(t.scheme==="numbers")return String(o+1);let r=t.skipAmbiguous?ht:Ce;return Ee(o,r)}function Q(e,t=!1){let n=t?mt:Ce;return Ee(Math.max(0,Math.floor(e)-1),n)}var yt=[[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 Oe(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of yt)for(;t>=o;)n+=r,t-=o;return n}function Pn(e,t){let n=e.length;return e.map((o,r)=>{let i=t.reverse?n-1-r:r;return{...o,label:pt(i,t)}})}function xt(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 Z(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",c=e.seatNumbering?.prefix??"",u=e.seatNumbering?.endAt,s=e.seatCount;if(i==="updown"||i==="updown-descending"){let x=Math.ceil(s/2),p=i==="updown"?t<x?n+2*t:n-1+2*(s-t):t<x?n+2*(x-1-t):n+1+2*(t-x);return`${c}${p}`}let f=i==="odd"||i==="even"?2:r,a=u!=null&&Number.isFinite(u)?u-(s-1)*f:n,m=o==="center"?xt(s)[t]:o==="rtl"?s-1-t:t,d;switch(i){case"odd":{let x=a%2===1?a:a+1;d=String(x+m*2);break}case"even":{let x=a%2===0?a:a+1;d=String(x+m*2);break}case"roman":d=Oe(a+m*r);break;case"letters-upper":d=Q(a+m*r,!1);break;case"letters-lower":d=Q(a+m*r,!0);break;default:d=String(a+m*r);break}return`${c}${d}`}function bt(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Te(e,t,n){return n?.label??`${e.label}-${Z(e,t)}`}function ee(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(!n)return`${e.displayLabel??e.label}-${Z(e,t)}`;let r=bt(n),i=n.displayOffset+t;return`${n.displayLabel}-${Z(r,i)}`}var G=.02291666666666667,En=1/G,gt=58,wt=gt*G,Re=0,_e=3,Ae=0,te=120,St=0,Mt=45,Pt=7,X=1.2;function ne(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function On(e){return Number.isFinite(e)?Math.max(Re,Math.min(_e,Math.round(e))):Re}function vt(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Pt?e:_e}function Le(e,t={}){let n=ne(t.floorBaseHeightM,Ae,te,0),o=Math.min(te,n+vt(e.elevation)*wt),r=e.height===void 0?o:ne(e.height,Ae,te,o),i=ne(e.rake,St,Mt,0);return{height:r,rake:i}}function ke(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 je(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],c=e[r+1],u=c.x-i.x,s=c.y-i.y,f=u*u+s*s,a=f>1e-12?((t-i.x)*u+(n-i.y)*s)/f:0;a<0?a=0:a>1&&(a=1);let m=Math.hypot(t-(i.x+a*u),n-(i.y+a*s));m<o&&(o=m)}return o}function It(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 c=Math.hypot(i.x-t,i.y-n);c>r&&(r=c)}return{cx:t,cy:n,r}}function De(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function oe(e,t){let n=1/0;for(let o of ke(e)){let r=je(t,o.x,o.y);r<n&&(n=r)}for(let o of ke(t)){let r=je(e,o.x,o.y);r<n&&(n=r)}return n}function Ct(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let a of e)n+=a.x,o+=a.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let a of e){let m=Math.hypot(a.x-n,a.y-o);m>r&&(r=m,i=a)}let c=i.x-n,u=i.y-o,s=Math.hypot(c,u);s>1e-9?(c/=s,u/=s):(c=1,u=0);let f=e.map((a,m)=>({p:a,i:m,t:(a.x-n)*c+(a.y-o)*u})).sort((a,m)=>a.t-m.t);return{pts:f.map(a=>a.p),seatIndices:f.map(a=>t[a.i])}}function Et(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let S of e)n+=S.x,o+=S.y;n/=t,o/=t;let r=0,i=0,c=0,u=0,s=0,f=0,a=0;for(let S of e){let g=S.x-n,l=S.y-o;r+=g*g,c+=l*l,i+=g*l,u+=g*g*g,s+=l*l*l,f+=g*l*l,a+=l*g*g}let m=r*c-i*i;if(Math.abs(m)<1e-9)return null;let d=(u+f)/2,x=(s+a)/2,p=(d*c-x*i)/m,y=(x*r-d*i)/m,h=p+n,b=y+o;return!Number.isFinite(h)||!Number.isFinite(b)?null:{cx:h,cy:b}}var Ot=.15;function Tt(e){if(e.length<2)return null;let t=e.map(S=>{let g=0,l=0;for(let M of S.pts)g+=M.x,l+=M.y;return{x:g/S.pts.length,y:l/S.pts.length}}),n=0,o=0;for(let S of t)n+=S.x,o+=S.y;n/=t.length,o/=t.length;let r=0,i=0,c=0;for(let S of t){let g=S.x-n,l=S.y-o;r+=g*g,i+=g*l,c+=l*l}let u=r+c,s=r*c-i*i,f=u/2+Math.sqrt(Math.max(0,u*u/4-s)),a,m;Math.abs(i)>1e-12?(a=f-c,m=i):r>=c?(a=1,m=0):(a=0,m=1);let d=Math.hypot(a,m);if(!(d>1e-12))return null;a/=d,m/=d;let x=1/0,p=-1/0,y=[];for(let S of e){let g=1/0,l=-1/0;for(let M of S.pts){let w=M.x*a+M.y*m;w<g&&(g=w),w>l&&(l=w),w<x&&(x=w),w>p&&(p=w)}y.push(l-g)}let h=p-x;return h>1e-9?(y.sort((S,g)=>S-g),y[Math.min(y.length-1,Math.floor(y.length*.9))]/h<=Rt?{x:a,y:m}:null):null}var Rt=.35;function Ne(e,t,n,o){let r=new Map;for(let h of n){let b=t[h],S=b.rowId||`__seat-${h}`,g=r.get(S);g||(g={pts:[],idx:[]},r.set(S,g)),g.pts.push({x:b.x,y:b.y}),g.idx.push(h)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[h,b]of r){let S=Ct(b.pts,b.idx),g=0;for(let l of S.pts)g+=Math.hypot(l.x-o.x,l.y-o.y);i.push({id:h,pts:S.pts,seatIndices:S.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:g/S.pts.length})}let c=i.map(h=>It(h.pts)),u=[];for(let h=0;h<i.length;h++){let b=1/0;for(let S=0;S<i.length;S++){if(h===S||De(c[h],c[S])>=b)continue;let g=oe(i[h].pts,i[S].pts);g<b&&(b=g)}Number.isFinite(b)&&u.push(b)}u.sort((h,b)=>h-b);let s=u.length?u[Math.floor(u.length/2)]:1,f=Math.max(s*1.8,1e-6),a=i.map(()=>[]);for(let h=0;h<i.length;h++)for(let b=h+1;b<i.length;b++)De(c[h],c[b])>f||oe(i[h].pts,i[b].pts)<=f&&(a[h].push(b),a[b].push(h));let m=0;for(let h=0;h<i.length;h++){if(i[h].blockId!==-1)continue;let b=m++,S=[h];for(i[h].blockId=b;S.length;){let g=S.pop();for(let l of a[g])i[l].blockId===-1&&(i[l].blockId=b,S.push(l))}}let d=new Map;for(let h of i){let b=d.get(h.blockId)??[];b.push(h),d.set(h.blockId,b)}let x=[];for(let h of i){if(h.pts.length<4)continue;let b=Et(h.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||x.push({x:b.cx,y:b.cy}))}let p=x.length>=2?(()=>{let h=x.map(g=>g.x).sort((g,l)=>g-l),b=x.map(g=>g.y).sort((g,l)=>g-l),S=Math.floor(x.length/2);return{cx:h[S],cy:b[S]}})():null;if(p){let h=w=>Math.hypot(w.x-p.cx,w.y-p.cy),b=1/0,S=-1/0,g=[];for(let w of i){let P=1/0,C=-1/0;for(let E of w.pts){let A=h(E);A<P&&(P=A),A>C&&(C=A)}g.push(C-P),P<b&&(b=P),C>S&&(S=C)}let l=S-b;g.sort((w,P)=>w-P);let M=g[Math.min(g.length-1,Math.floor(g.length*.9))];if(l>1e-9&&M/l<=Ot){let w=i.map(v=>{let U=0;for(let Ve of v.pts)U+=h(Ve);return{row:v,radius:U/v.pts.length}}),P=0,C=0;for(let v of w)P+=v.radius,C+=v.row.focalDistance;P/=w.length,C/=w.length;let E=0;for(let v of w)E+=(v.radius-P)*(v.row.focalDistance-C);if(E<0)for(let v of w)v.radius=-v.radius;let _=1/0;for(let v of w)v.radius<_&&(_=v.radius);w.sort((v,U)=>v.radius-U.radius);let H=-1,N=-1/0,W=l/Math.max(1,w.length)*.5,ae=[];for(let v of w)v.radius-N>W&&(H++,N=v.radius),v.row.ordinal=H,v.row.blockDepth=v.radius-_,ae.push(v.row);return{sectionId:e,rows:ae,blockCount:m}}}let y=[];for(let[,h]of d){let b=Tt(h);if(b){let S=l=>{let M=0;for(let w of l.pts)M+=w.x*b.x+w.y*b.y;return M/l.pts.length};h.sort((l,M)=>S(l)-S(M)),h.length>=2&&h[0].focalDistance>h[h.length-1].focalDistance&&h.reverse();let g=0;for(let l=0;l<h.length;l++)l>0&&(g+=oe(h[l-1].pts,h[l].pts)),h[l].ordinal=l,h[l].blockDepth=g,y.push(h[l])}else{let S=1/0;for(let g of h)g.focalDistance<S&&(S=g.focalDistance);h.sort((g,l)=>g.focalDistance-l.focalDistance);for(let g=0;g<h.length;g++)h[g].ordinal=g,h[g].blockDepth=Math.max(0,h[g].focalDistance-S),y.push(h[g])}}return{sectionId:e,rows:y,blockCount:m}}function Ge(e){return e?e.accessibility&&e.accessibility.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var K=Math.PI/180,At=9,D=16;function ie(e,t,n,o){let r=n*K,i=Math.cos(r),c=Math.sin(r);return{x:o.x+e*i-t*c,y:o.y+e*c+t*i}}function Xe(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,c=[];if(e.path)return me(e.path,t);if(t<=1)return t===1&&c.push({x:i.x,y:i.y}),c;if(o===0){for(let f=0;f<t;f++)c.push(ie(f*n,0,r,i));return c}let u=o/(t-1)*K,s=n/(2*Math.sin(Math.abs(u)/2));for(let f=0;f<t;f++){let a=f*u,m=s*Math.sin(a),d=-s+s*Math.cos(a);c.push(ie(m,d,r,i))}return c}function _t(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Un(e){let t=new Set((e.overrides??[]).filter(n=>n.skip&&Number.isInteger(n.index)&&n.index>=0&&n.index<e.seatCount).map(n=>n.index));return Math.max(0,e.seatCount-t.size)}function Lt(e,t){let n=_t(e);return Xe(e).map((o,r)=>{let i=n.get(r),c=Ge(i),u=Te(e,r,i),s={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:u,displayLabel:ee(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:c.length>0,accessibility:c,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(s).some(f=>f!==void 0&&f!==!1&&f!=="")?s:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function ze(e){let t=[];for(let n of Lt(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 kt(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 Ke(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(a=>[a.index,a])),r=(a,m,d,x)=>{let p=o.get(a),y=Ge(p),h=p?.label??`${e.label}-${a+1}`,b=e.displayLabel??e.label;return{index:a,label:h,displayLabel:p?.displayLabel??`${b}-${a+1}`,x:m+(p?.dx??0),y:d+(p?.dy??0),categoryKey:p?.categoryKey??e.categoryKey,skipped:!!p?.skip,accessible:y.length>0,accessibility:y,wheelchairSpaceType:p?.wheelchairSpaceType,commercial:p?.commercial,glyph:p?.glyph,viewUrl:p?.viewFromSeatUrl,viewMeta:p?.viewFromSeatUrl?p.viewFromSeatMeta:void 0,labelStyle:p?.labelStyle,...x?{side:x}:{}}};if(e.shape==="round"){let a=(e.radius??40)+D,m=e.rotation*K,d=Math.max(0,Math.min(360,e.seatArc??360));if(d>=360||n===1){for(let h=0;h<n;h++){let b=m+h/n*2*Math.PI;t.push(r(h,e.center.x+a*Math.cos(b),e.center.y+a*Math.sin(b)))}return t}let x=d*K,p=(2*Math.PI-x)/2,y=m+p;for(let h=0;h<n;h++){let b=y+h/(n-1)*x;t.push(r(h,e.center.x+a*Math.cos(b),e.center.y+a*Math.sin(b)))}return t}let i=e.width??80,c=e.height??50,u=kt(e),s=["top","bottom","left","right"],f=0;for(let a of s){let m=u[a];for(let d=0;d<m;d++){let x,p;a==="top"?(x=-i/2+(d+.5)*i/m,p=-c/2-D):a==="bottom"?(x=-i/2+(d+.5)*i/m,p=c/2+D):a==="left"?(x=-i/2-D,p=-c/2+(d+.5)*c/m):(x=i/2+D,p=-c/2+(d+.5)*c/m);let y=ie(x,p,e.rotation,e.center);t.push(r(f++,y.x,y.y,a))}}return t}function Bn(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):Ke(e).filter(t=>!t.skipped).length}function jt(e){return Ke(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 Dt(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"}]}function Fe(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,c=t[o].y,u=t[r].x,s=t[r].y;c>e.y!=s>e.y&&e.x<(u-i)*(e.y-c)/(s-c)+i&&(n=!n)}return n}function Nt(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 c=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),u=(r.x-n.x)**2+(r.y-n.y)**2;return c>=-1e-7&&c<=u+1e-7})}function V(e,t,n){return Fe(e,t)&&!(n??[]).some(o=>Fe(e,o)||Nt(e,o))}function Gn(e,t){return ge(e,t).point}function re(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 $(e){switch(e.type){case"row":{let t=ze(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,o=0;for(let r of t)n+=r.x,o+=r.y;return{x:n/t.length,y:o/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return re(e.points);case"section":return re(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?re(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 He(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function Ft(e,t){if(e.type!=="gaArea"||!He(e.points,t.outline))return!1;let n=e.holes??[],o=t.holes??[];return n.length===o.length&&n.every((r,i)=>He(r,o[i]))}function Ht(e,t){let n=e.filter(c=>c.type==="section"),o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,r=$(t);return(o?n.find(c=>(c.logicalSectionId??c.id)===o&&(Ft(t,c)||V(r,c.outline,c.holes))):void 0)??n.find(c=>V(r,c.outline,c.holes))}function Ut(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 Xn(e,t){let n=Ut(e);return(t?n.find(o=>o.id===t):n[0])?.objects??[]}function Bt(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function se(e,t,n){let o=i=>({x:i.x+t,y:i.y+n}),r=i=>i.map(o);switch(e.type){case"row":return{...e,origin:o(e.origin)};case"table":case"booth":return{...e,center:o(e.center)};case"gaArea":return{...e,points:r(e.points),...e.holes?{holes:e.holes.map(r)}:{}};case"section":return{...e,outline:r(e.outline),...e.outlinePath?{outlinePath:ve(e.outlinePath,t,n)}:{},...e.holes?{holes:e.holes.map(r)}:{}};case"text":return{...e,position:o(e.position)};case"shape":return{...e,...e.points?{points:r(e.points)}:{},...e.x!=null?{x:e.x+t}:{},...e.y!=null?{y:e.y+n}:{}};case"decorImage":return{...e,x:e.x+t,y:e.y+n}}}function zn(e,t=900){if(!e.floors||e.floors.length<2)return e;let n=[];return e.floors.forEach((o,r)=>{let i=-r*t;for(let c of o.objects)n.push(i===0?c:se(c,0,i))}),{...e,objects:n,floors:void 0}}function Kn(e){let t=e.floors;if(!t||t.length<2)return e;let n=Gt(e),o=[];return t.forEach((r,i)=>{let{x:c,y:u}=n[i];for(let s of r.objects)o.push(se(s,c,u))}),{...e,objects:o,floors:void 0,referenceImage:void 0,backgroundImage:void 0}}function Vn(e){let t=e.floors;if(!t||t.length<2)return!1;let n=t.map(s=>ce({...e,objects:s.objects,floors:void 0,focalPoint:s.focalPoint,referenceImage:void 0,backgroundImage:void 0}));if(n.some(s=>s.width<=0||s.height<=0))return!1;let[o,...r]=n;if(!r.every(s=>{let f=Math.min(o.x+o.width,s.x+s.width)-Math.max(o.x,s.x),a=Math.min(o.y+o.height,s.y+s.height)-Math.max(o.y,s.y);return f<=0||a<=0?!1:f>=Math.min(o.width,s.width)*.7&&a>=Math.min(o.height,s.height)*.7}))return!1;let c={x:o.x+o.width/2,y:o.y+o.height/2},u=Math.hypot(o.width,o.height)/2;return t.every(s=>s.objects.length?s.objects.filter(a=>{let m=$(a);return Math.hypot(m.x-c.x,m.y-c.y)>=u*.25}).length>=s.objects.length*.6:!1)}function $n(e){let t=e.floors;if(!t||t.length<2)return e;let n=t.map((s,f)=>({floor:s,index:f,height:s.baseHeightM??0})).sort((s,f)=>s.height-f.height||s.index-f.index),o=ce({...e,objects:n[0].floor.objects,floors:void 0,focalPoint:n[0].floor.focalPoint,referenceImage:void 0,backgroundImage:void 0}),r={x:o.x+o.width/2,y:o.y+o.height/2},i=Math.max(48,Math.min(200,Math.max(o.width,o.height)*.06)),c=[],u=0;return n.forEach((s,f)=>{let a=s.floor.objects.map(y=>{let h=$(y);return Math.hypot(h.x-r.x,h.y-r.y)}),m=a.filter(y=>Number.isFinite(y)),d=m.length?Math.min(...m):0,x=m.length?Math.max(...m):0,p=f===0?0:Math.max(0,u+i-d);u=x+p,s.floor.objects.forEach((y,h)=>{if(f>0&&y.type==="shape"&&y.role==="stage")return;if(p===0){c.push(y);return}let b=a[h];if(!Number.isFinite(b)||b<1e-6){c.push(y);return}let S=$(y);c.push(se(y,(S.x-r.x)/b*p,(S.y-r.y)/b*p))})}),{...e,objects:c,floors:void 0,referenceImage:void 0,backgroundImage:void 0}}function Gt(e){let t=e.floors;if(!t?.length)return[{x:0,y:0}];if(t.length<2)return t.map(()=>({x:0,y:0}));let n=t.map(d=>ce({...e,objects:d.objects,floors:void 0,focalPoint:d.focalPoint,referenceImage:void 0,backgroundImage:void 0})),o=Math.max(1,...n.map(d=>Math.max(d.width,d.height))),r=Math.max(64,Math.min(240,o*.08)),i=16/10,c=null;for(let d=1;d<=t.length;d+=1){let x=Math.ceil(t.length/d),p=new Array(d).fill(0),y=new Array(x).fill(0);n.forEach((l,M)=>{let w=M%d,P=Math.floor(M/d);p[w]=Math.max(p[w],l.width),y[P]=Math.max(y[P],l.height)});let h=p.reduce((l,M)=>l+M,0)+r*(d-1),b=y.reduce((l,M)=>l+M,0)+r*(x-1),S=d*x-t.length,g=Math.abs(Math.log(h/Math.max(1,b)/i))+S*.04;(!c||g<c.score)&&(c={columns:d,columnWidths:p,rowHeights:y,score:g})}let{columns:u,columnWidths:s,rowHeights:f}=c,a=[],m=[];return s.reduce((d,x,p)=>(a[p]=d,d+x+r),0),f.reduce((d,x,p)=>(m[p]=d,d+x+r),0),t.map((d,x)=>{let p=n[x],y=x%u,h=Math.floor(x/u),b=a[y]+(s[y]-p.width)/2,S=m[h]+(f[h]-p.height)/2;return{x:b-p.x,y:S-p.y}})}function Ue(e,t,n,o,r,i,c,u,s){let f=[],a=Ie(e),m=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===s),d=p=>le(p,{activeConfigurationId:o,activeConfigurationVersion:s,activeBasisSha256:r,now:u}),x=(p,y)=>d(p)?{...p,coverage:y}:void 0;for(let p of e){let y=[];if(p.type==="row"?y=ze(p):p.type==="table"?y=jt(p):p.type==="booth"&&(y=Dt(p)),!y.length)continue;for(let l of y)l.viewUrl&&!m(l.viewMeta)&&(l.viewUrl=void 0,l.viewMeta=void 0);if(p.type==="row"){let l=a.get(p.id);if(l){let M=new Map((p.overrides??[]).map(w=>[w.index,w]));for(let w of y){let P=Number(w.id.slice(w.id.lastIndexOf(":")+1));if(!Number.isInteger(P))continue;w.logicalRowId=l.groupId,w.logicalSeatIndex=l.adjacencyOffset+P,M.get(P)?.displayLabel||(w.displayLabel=ee(p,P,l)),!w.viewUrl&&l.viewFromSeatUrl&&m(l.viewFromSeatMeta)&&(w.viewUrl=l.viewFromSeatUrl,w.viewMeta=l.viewFromSeatMeta);let C=M.get(P)?.confidenceEvidence;w.confidenceEvidence=x(C,"exact-seat")??x(p.confidenceEvidence,"row-representative")??x(l.confidenceEvidence,"row-representative")}}}let h=Ht(e,p),b=h?.viewFromSeatUrl,g=(h?.zone?t?.find(l=>l.id===h.zone):void 0)?.focalPoint??n;for(let l of y){if(!l.confidenceEvidence){let M=Number(l.id.slice(l.id.lastIndexOf(":")+1)),w=(p.type==="row"||p.type==="table")&&Number.isInteger(M)?p.overrides?.find(P=>P.index===M)?.confidenceEvidence:void 0;l.confidenceEvidence=x(w,"exact-seat")??(p.type==="row"?x(p.confidenceEvidence,"row-representative"):void 0)}l.confidenceEvidence??=x(h?.confidenceEvidence,"section-representative")??(c?x(c.evidence,c.coverage):void 0),!l.viewUrl&&b&&m(h?.viewFromSeatMeta)&&(l.viewUrl=b,l.viewMeta=h?.viewFromSeatMeta),!l.viewUrl&&i&&m(i.meta)&&(l.viewUrl=i.url,l.viewMeta=i.meta),h&&(l.sectionId=h.logicalSectionId??h.id),h?.zone&&(l.zoneId=h.zone),g&&(l.focalPoint={...g})}f.push(...y)}return f}function Wn(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,c=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,u=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,s=Ue(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,c,u,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Be(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,s);for(let f of s)f.floorId=r.id;o.push(...s)}return o}let n=Ue(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&&Be(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),n}function Be(e,t,n,o){let r=e.filter(a=>a.type==="section"),i=n>0||r.some(a=>a.height!==void 0||a.rake!==void 0||(a.elevation??0)>0);if(!r.length||!i||!t){for(let a of o)a.eyeHeightM=n+X;return}let c=new Array(o.length),u=new Map,s=new Map;for(let a=0;a<o.length;a++){let m=o[a],x=(m.sectionId?r.find(y=>y.id===m.sectionId)??r.find(y=>y.logicalSectionId===m.sectionId&&V({x:m.x,y:m.y},y.outline,y.holes)):void 0)??r.find(y=>V({x:m.x,y:m.y},y.outline,y.holes))??null;if(c[a]=x,!x)continue;u.has(x.id)||u.set(x.id,Le(x,{floorBaseHeightM:n}));let p=s.get(x.id);p?p.push(a):s.set(x.id,[a])}let f=new Array(o.length).fill(void 0);for(let[a,m]of s){let d=u.get(a);if(!d)continue;let x=d.rake>0?Math.tan(d.rake*Math.PI/180):0,p=Ne(a,o,m,t);for(let y of p.rows){let h=y.blockDepth*G*x,b=d.height+h;for(let S of y.seatIndices)f[S]=b}}for(let a=0;a<o.length;a++){let m=o[a],d=c[a];if(!d){m.eyeHeightM=n+X;continue}let x=u.get(d.id);m.eyeHeightM=(f[a]??x.height)+X}}var z=40;function ce(e,t){let n=t?.freeText==="exclude",o=1/0,r=1/0,i=-1/0,c=-1/0,u=(s,f)=>{s<o&&(o=s),f<r&&(r=f),s>i&&(i=s),f>c&&(c=f)};for(let s of Bt(e))if(s.type==="row"){let f=new Map((s.overrides??[]).map(a=>[a.index,a]));Xe(s).forEach((a,m)=>{let d=f.get(m);d?.skip||u(a.x+(d?.dx??0),a.y+(d?.dy??0))})}else if(s.type==="gaArea")for(let f of s.points)u(f.x,f.y);else if(s.type==="section")for(let f of s.outline)u(f.x,f.y);else if(s.type==="decorImage")u(s.x,s.y),u(s.x+s.width,s.y+s.height);else if(s.type==="shape")if(s.points&&s.points.length)for(let f of s.points)u(f.x,f.y);else s.x!=null&&s.y!=null&&s.width!=null&&s.height!=null&&(u(s.x,s.y),u(s.x+s.width,s.y+s.height));else if(s.type==="table"){let f=D+At,a=s.shape==="round"?(s.radius??40)+f:Math.max((s.width??80)/2,(s.height??50)/2)+f;u(s.center.x-a,s.center.y-a),u(s.center.x+a,s.center.y+a)}else if(s.type==="booth"){let f=Math.max(s.width,s.height)/2;u(s.center.x-f,s.center.y-f),u(s.center.x+f,s.center.y+f)}else if(s.type==="text"){if(n)continue;let f=fe(s);u(s.position.x,s.position.y),u(s.position.x+f.width,s.position.y+f.height)}for(let s of[e.referenceImage,e.backgroundImage]){if(!s)continue;let{center:f,width:a}=s,m=a*3/4;u(f.x-a/2,f.y-m/2),u(f.x+a/2,f.y+m/2)}if(!isFinite(o)){let s=e.focalPoint??{x:0,y:0};return{x:s.x-200,y:s.y-200,width:400,height:400}}return{x:o-z,y:r-z,width:i-o+z*2,height:c-r+z*2}}export{Xt as a,zt as b,Kt as c,Vt as d,$t as e,Wt as f,Yt as g,qt as h,Jt as i,fe as j,Zt as k,qe as l,en as m,Y as n,on as o,me as p,rn as q,sn as r,Qe as s,be as t,an as u,ge as v,et as w,un as x,mn as y,Pe as z,pn as A,ve as B,rt as C,it as D,ct as E,yn as F,lt as G,dt as H,xn as I,gn as J,wn as K,Sn as L,Ie as M,Ee as N,pt as O,Q as P,Oe as Q,Pn as R,Z as S,bt as T,Te as U,ee as V,G as W,En as X,wt as Y,Re as Z,_e as _,Ae as $,te as aa,St as ba,Mt as ca,Pt as da,X as ea,On as fa,Le as ga,je as ha,Et as ia,Ne as ja,D as ka,Xe as la,Un as ma,Lt as na,ze as oa,kt as pa,Ke as qa,Bn as ra,jt as sa,Dt as ta,Fe as ua,V as va,Gn as wa,$ as xa,Ht as ya,Ut as za,Xn as Aa,Bt as Ba,se as Ca,zn as Da,Kn as Ea,Vn as Fa,$n as Ga,Gt as Ha,Wn as Ia,ce as Ja};