@seatlayer/core 0.110.0 → 0.110.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/ar-C5PA2DVE.js +1 -0
  2. package/dist/be-TMKSMYPN.js +1 -0
  3. package/dist/bg-V6HTEDUB.js +1 -0
  4. package/dist/ca-CTZMHWW4.js +1 -0
  5. package/dist/{categoryInventory-BfvwE3nC.d.cts → categoryInventory-BE1AThTx.d.cts} +1 -1
  6. package/dist/{categoryInventory-ClZ-68jI.d.ts → categoryInventory-DxciZQK_.d.ts} +1 -1
  7. package/dist/{chunk-6VOUTNRV.js → chunk-2VYFNNYC.js} +1 -1
  8. package/dist/{chunk-YE4NP3XB.js → chunk-3V32MDJI.js} +1 -1
  9. package/dist/chunk-4AGC7B64.js +1 -0
  10. package/dist/{chunk-ZYQXT5JP.js → chunk-5IADCFUU.js} +1 -1
  11. package/dist/{chunk-2JFCDE27.js → chunk-6CBJBESS.js} +1 -1
  12. package/dist/{chunk-WUNZCUE6.js → chunk-DLHW3UDD.js} +1 -1
  13. package/dist/{chunk-UUIZHJYL.js → chunk-GVVZR3YS.js} +1 -1
  14. package/dist/{chunk-MRLWH6RC.js → chunk-GWGWNBGU.js} +1 -1
  15. package/dist/chunk-JQBJZMLG.js +1 -0
  16. package/dist/{chunk-OJSGMXJS.js → chunk-NVAF2E7Q.js} +1 -1
  17. package/dist/{chunk-FBXZWNND.js → chunk-YRDOE3N7.js} +1 -1
  18. package/dist/{chunk-BNLANXXZ.js → chunk-ZY6WTPTI.js} +1 -1
  19. package/dist/core/chart-ops/index.cjs +1 -1
  20. package/dist/core/chart-ops/index.d.cts +6 -4
  21. package/dist/core/chart-ops/index.d.ts +6 -4
  22. package/dist/core/chart-ops/index.js +1 -1
  23. package/dist/core/inventory/index.d.cts +4 -4
  24. package/dist/core/inventory/index.d.ts +4 -4
  25. package/dist/core/inventory/index.js +1 -1
  26. package/dist/core/layout/index.d.cts +5 -5
  27. package/dist/core/layout/index.d.ts +5 -5
  28. package/dist/core/layout/index.js +1 -1
  29. package/dist/core/quality/index.cjs +1 -1
  30. package/dist/core/quality/index.d.cts +3 -3
  31. package/dist/core/quality/index.d.ts +3 -3
  32. package/dist/core/render-assets/index.cjs +1 -1
  33. package/dist/core/render-assets/index.d.cts +2 -2
  34. package/dist/core/render-assets/index.d.ts +2 -2
  35. package/dist/core/render-assets/index.js +1 -1
  36. package/dist/core/seatConfidence.d.cts +1 -1
  37. package/dist/core/seatConfidence.d.ts +1 -1
  38. package/dist/core/sections/index.d.cts +5 -5
  39. package/dist/core/sections/index.d.ts +5 -5
  40. package/dist/core/sections/index.js +1 -1
  41. package/dist/cs-FUDGOUFL.js +1 -0
  42. package/dist/cy-5RRARIAP.js +1 -0
  43. package/dist/da-PONPPWKY.js +1 -0
  44. package/dist/de-PKG7AAB5.js +1 -0
  45. package/dist/el-H7OFU4QQ.js +1 -0
  46. package/dist/es-QSW5IZ6U.js +1 -0
  47. package/dist/et-GTMPSS72.js +1 -0
  48. package/dist/{eventConfigurations-DsW5Mj2e.d.ts → eventConfigurations-Cdt-e0uD.d.ts} +1 -1
  49. package/dist/{eventConfigurations-dmn9FClw.d.cts → eventConfigurations-D0us5j0K.d.cts} +1 -1
  50. package/dist/fa-SGLTFGJF.js +1 -0
  51. package/dist/fi-7YTEAVDM.js +1 -0
  52. package/dist/fr-ECCQ24MZ.js +1 -0
  53. package/dist/he-YHMMDOX7.js +1 -0
  54. package/dist/hi-GRAQX2E6.js +1 -0
  55. package/dist/hr-MN33LRIJ.js +1 -0
  56. package/dist/hu-NW3SMQVM.js +1 -0
  57. package/dist/id-3OPRAUF7.js +1 -0
  58. package/dist/index.cjs +1 -1
  59. package/dist/index.d.cts +13 -13
  60. package/dist/index.d.ts +13 -13
  61. package/dist/index.js +1 -1
  62. package/dist/it-RYM74YWO.js +1 -0
  63. package/dist/ja-4NI6DG5D.js +1 -0
  64. package/dist/{ko-6YCWWHFQ.js → ko-C4F6UEMK.js} +1 -1
  65. package/dist/ku-DMSBMWTC.js +1 -0
  66. package/dist/{labeling-Bn41ByDd.d.ts → labeling-DXgkxMoi.d.ts} +1 -1
  67. package/dist/{labeling-BmEjVxFt.d.cts → labeling-eYKVPLMb.d.cts} +1 -1
  68. package/dist/localeLoaders-G3GCGLPW.js +1 -0
  69. package/dist/lt-3EXKKZFG.js +1 -0
  70. package/dist/lv-4EWNRDCG.js +1 -0
  71. package/dist/ms-7LJBSAEJ.js +1 -0
  72. package/dist/nl-GWTIWXRW.js +1 -0
  73. package/dist/no-T3FW2WLX.js +1 -0
  74. package/dist/pl-OG5OBRHR.js +1 -0
  75. package/dist/pt-YQ6VES5R.js +1 -0
  76. package/dist/{renderedQuality-MDkNe8GA.d.ts → renderedQuality-Dzo2_8f4.d.ts} +1 -1
  77. package/dist/{renderedQuality-Bt2d0uq1.d.cts → renderedQuality-Frgw6jdx.d.cts} +1 -1
  78. package/dist/{renderer-DH0yI32q.d.cts → renderer-DM2sv1un.d.cts} +1 -1
  79. package/dist/{renderer-BJrpMV6U.d.ts → renderer-DuieD7jP.d.ts} +1 -1
  80. package/dist/ro-VK5MASYF.js +1 -0
  81. package/dist/ru-YU5CYR6T.js +1 -0
  82. package/dist/{seatTypeIcons-CG_Uzpaw.d.ts → seatTypeIcons-Bz0OJtEi.d.ts} +1 -1
  83. package/dist/{seatTypeIcons-Ck7oEFei.d.cts → seatTypeIcons-Cm8tjLYl.d.cts} +1 -1
  84. package/dist/{sections-C-UAqr1x.d.ts → sections-Bf_DV0oG.d.ts} +1 -1
  85. package/dist/{sections-C8HApYxd.d.cts → sections-PbQiqN0i.d.cts} +1 -1
  86. package/dist/{segmentedRowModel-DR1w9M13.d.ts → segmentedRowModel-CO7DD803.d.ts} +1 -1
  87. package/dist/{segmentedRowModel-CeoMsBnt.d.cts → segmentedRowModel-Co9LqS4i.d.cts} +1 -1
  88. package/dist/sk-CE7PXAYL.js +1 -0
  89. package/dist/sl-EYUPV4BG.js +1 -0
  90. package/dist/sr-PPXCN4IK.js +1 -0
  91. package/dist/sv-WR2BJBCJ.js +1 -0
  92. package/dist/{tableSizing-RRmpxOXl.d.ts → tableSizing-BDePQyPD.d.ts} +3 -3
  93. package/dist/{tableSizing-Bz-hxLza.d.cts → tableSizing-C6EjKNnk.d.cts} +3 -3
  94. package/dist/th-JUB2DODR.js +1 -0
  95. package/dist/{ticketRestrictions-lq4dH4k6.d.cts → ticketRestrictions-CgYwHQOf.d.cts} +2 -2
  96. package/dist/{ticketRestrictions-C7KUrulv.d.ts → ticketRestrictions-D5wgOq4P.d.ts} +2 -2
  97. package/dist/tr-GFHA7FT6.js +1 -0
  98. package/dist/{types-DM-OneoD.d.ts → types-CGOr0BpE.d.cts} +40 -16
  99. package/dist/{types-DM-OneoD.d.cts → types-CGOr0BpE.d.ts} +40 -16
  100. package/dist/uk-3FTS2SRK.js +1 -0
  101. package/dist/vi-7OTXPOQV.js +1 -0
  102. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  103. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  104. package/dist/view3d/index.cjs +410 -169
  105. package/dist/view3d/index.d.cts +100 -4
  106. package/dist/view3d/index.d.ts +100 -4
  107. package/dist/view3d/index.js +408 -167
  108. package/dist/view3d/scene/scene.worker.cjs +1 -1
  109. package/dist/view3d/scene/scene.worker.js +1 -1
  110. package/dist/zh-Hans-FD4XNYUA.js +1 -0
  111. package/dist/zh-Hant-7TXVJKJQ.js +1 -0
  112. package/package.json +1 -1
  113. package/dist/ar-O3RHQRH3.js +0 -1
  114. package/dist/be-SXFCG3F5.js +0 -1
  115. package/dist/bg-W7YBNYB2.js +0 -1
  116. package/dist/ca-FA7WHACR.js +0 -1
  117. package/dist/chunk-4N5CHKHD.js +0 -1
  118. package/dist/chunk-4QQG5EEP.js +0 -1
  119. package/dist/cs-RR3VIKRC.js +0 -1
  120. package/dist/cy-U4JJ5C47.js +0 -1
  121. package/dist/da-ATULGB2M.js +0 -1
  122. package/dist/de-VB543CPC.js +0 -1
  123. package/dist/el-7Y2KXU6N.js +0 -1
  124. package/dist/es-GUV5XIYC.js +0 -1
  125. package/dist/et-SZ6I4Z44.js +0 -1
  126. package/dist/fa-FM6ELEN7.js +0 -1
  127. package/dist/fi-6QQ2M5JI.js +0 -1
  128. package/dist/fr-2SEQSVLR.js +0 -1
  129. package/dist/he-V3EVB7IW.js +0 -1
  130. package/dist/hi-I4QIBK5Q.js +0 -1
  131. package/dist/hr-I5DNEVUU.js +0 -1
  132. package/dist/hu-KTFWBQMF.js +0 -1
  133. package/dist/id-RZWUH426.js +0 -1
  134. package/dist/it-CNQP36V4.js +0 -1
  135. package/dist/ja-JQZOYIHI.js +0 -1
  136. package/dist/ku-33PM4OWG.js +0 -1
  137. package/dist/localeLoaders-VFQOZMUH.js +0 -1
  138. package/dist/lt-24JO2B7V.js +0 -1
  139. package/dist/lv-HTSDEEAB.js +0 -1
  140. package/dist/ms-PUEZJJ3R.js +0 -1
  141. package/dist/nl-NQPDRSCW.js +0 -1
  142. package/dist/no-3N3MUMSA.js +0 -1
  143. package/dist/pl-YHBEO6ZF.js +0 -1
  144. package/dist/pt-5RPESNZB.js +0 -1
  145. package/dist/ro-XDFXIMHX.js +0 -1
  146. package/dist/ru-BIIALOM5.js +0 -1
  147. package/dist/sk-LHSFRUFT.js +0 -1
  148. package/dist/sl-MPE5TPI3.js +0 -1
  149. package/dist/sr-T3N67KTP.js +0 -1
  150. package/dist/sv-LJWWYUIY.js +0 -1
  151. package/dist/th-E5POGG37.js +0 -1
  152. package/dist/tr-2DCWQ2CY.js +0 -1
  153. package/dist/uk-C3VJP6EA.js +0 -1
  154. package/dist/vi-XVMTKCOL.js +0 -1
  155. package/dist/zh-Hans-RG4CQGBY.js +0 -1
  156. package/dist/zh-Hant-YHNTYPFS.js +0 -1
@@ -1 +1 @@
1
- import{h as Ne,j as me,n as Le,p as je}from"./chunk-S3VH7IDA.js";import{c as Fe}from"./chunk-CRCGO52K.js";var ho=2e6,Tt=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,At=/[\s"'<>`\\]/;function Nt(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Tt.test(e);if(At.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function De(e){let t=e.trim();return Nt(t)?t:null}var Lt=2e5,po=1e5,jt="large_venue_inventory";function yo(e){return e?.includes(jt)?2e5:1e5}var te="seatlayer.event-configuration/1",pe="seatlayer.event-configuration-export/1",G=100,Ft=120,Dt=2e5,Vt=1e4,He=/^[a-f0-9]{64}$/,Ht=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function z(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function H(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Ue(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Ve(e){return!Array.isArray(e)||e.length>Dt||!e.every(t=>H(t,G))?null:[...new Set(e)].sort()}function Ge(e){return!z(e)||!H(e.chartId,G)||!H(e.version,G)||e.sha256!==void 0&&(typeof e.sha256!="string"||!He.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function ye(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Ut(e){return z(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&ye(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Gt(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Vt)return null;let n=new Set(t),i=new Set,o=new Set,r=0,s=[];for(let l of e){if(!z(l)||!H(l.id,G)||!H(l.objectId,G)||!n.has(l.objectId)||!Ht.has(String(l.kind))||!ye(l.heightM,.05,50)||l.baseElevationM!==void 0&&!ye(l.baseElevationM,-10,100))return null;let h=Ut(l.occlusion);if(!h||i.has(l.id)||o.has(l.objectId))return null;let a=l.contentImageUrl===void 0?void 0:typeof l.contentImageUrl=="string"?De(l.contentImageUrl):null;if(l.contentImageUrl!==void 0&&(!a||l.kind!=="screen"||++r>1))return null;i.add(l.id),o.add(l.objectId),s.push({id:l.id,objectId:l.objectId,kind:l.kind,heightM:l.heightM,...l.baseElevationM!==void 0?{baseElevationM:l.baseElevationM}:{},occlusion:h,...a?{contentImageUrl:a}:{}})}return s.sort((l,h)=>l.id.localeCompare(h.id))}function Xe(e){let t=[];if(!z(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==te&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${te}`}),H(e.id,G)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),H(e.label,Ft)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Ue(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Ge(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let i=z(e.overlay)?e.overlay:null,o=Ve(i?.objectIds),r=Ve(i?.productionKillSeatIds),s=o?Gt(i?.productionElements,o):null;return(!i||!o||!r)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!r||s===null?{issues:t}:{issues:t,value:{schema:te,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:r,...s!==void 0?{productionElements:s}:{}}}}}function xo(e){let t=Xe(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function So(e){if(!z(e))return{ok:!1,issues:[{code:"invalid_export",path:"",message:"Export must be an object"}]};let t=[];e.schema!==pe&&t.push({code:"unsupported_schema",path:"schema",message:`Export schema must be ${pe}`}),(typeof e.contentSha256!="string"||!He.test(e.contentSha256))&&t.push({code:"invalid_checksum",path:"contentSha256",message:"Export checksum must be a lowercase SHA-256 digest"});let n=Xe(e.configuration);return t.push(...n.issues),t.length||!n.value||typeof e.contentSha256!="string"?{ok:!1,issues:t}:{ok:!0,value:{schema:pe,configuration:n.value,contentSha256:e.contentSha256}}}function Mo(e){return JSON.stringify({schema:te,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((t,n)=>t.id.localeCompare(n.id)).map(t=>({id:t.id,objectId:t.objectId,kind:t.kind,heightM:t.heightM,...t.baseElevationM!==void 0?{baseElevationM:t.baseElevationM}:{},occlusion:t.occlusion,...t.contentImageUrl?{contentImageUrl:t.contentImageUrl}:{}}))}:{}}})}function Po(e,t){let n=[];e.baseVenue.chartId!==t.chartId&&n.push({code:"base_venue_mismatch",message:"Configuration belongs to a different base venue"}),e.baseVenue.version!==t.version&&n.push({code:"base_venue_version_mismatch",message:"Configuration was authored against a different venue version"}),e.baseVenue.sha256&&!t.sha256?n.push({code:"base_venue_checksum_missing",message:"Venue checksum is required for this configuration"}):e.baseVenue.sha256&&e.baseVenue.sha256!==t.sha256&&n.push({code:"base_venue_checksum_mismatch",message:"Venue bytes do not match the configuration base"});let i=new Set(t.objectIds);for(let r of e.overlay.objectIds)i.has(r)||n.push({code:"overlay_object_missing",message:`Production object ${r} is missing from the base venue`,targetId:r});if(t.objectTypes)for(let r of e.overlay.productionElements??[])t.objectTypes.get(r.objectId)!=="shape"&&n.push({code:"production_element_not_shape",message:`Production element ${r.id} must reference base-venue shape geometry`,targetId:r.objectId});let o=new Set(t.seatIds);for(let r of e.overlay.productionKillSeatIds)o.has(r)||n.push({code:"production_kill_seat_missing",message:`Production-kill seat ${r} is missing from the base venue`,targetId:r});return{compatible:n.length===0,issues:n}}var Xt={draft:new Set(["review","archived"]),review:new Set(["draft","approved","archived"]),approved:new Set(["published","archived"]),published:new Set(["archived"]),archived:new Set};function vo(e,t){return e===t||Xt[e].has(t)}function Eo(e,t,n){return!Ue(n)||n>=t.version?null:e.find(i=>i.id===t.id&&i.version===n&&i.status==="published")??null}function Kt(e){return e.floors?.length?e.floors.flatMap(t=>t.objects):e.objects}function be(e,t,n){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let i of e)be(i,t,n);return}for(let[i,o]of Object.entries(e)){if(i==="eventConfigurationId"){H(o,G)?t.add(o):o!==void 0&&n.add(String(o));continue}if(i==="eventConfigurationIds"){if(!Array.isArray(o))n.add(String(o));else for(let r of o)H(r,G)?t.add(r):n.add(String(r));continue}be(o,t,n)}}}function Io(e,t){let n=Ge(t);if(!n)return{ok:!1,invalidIds:["baseVenue"]};let i=new Set,o=new Set;if(be(e,i,o),o.size)return{ok:!1,invalidIds:[...o].sort()};let r=Kt(e);return{ok:!0,configurations:[...i].sort().map(s=>({schema:te,id:s,label:s,version:1,baseVenue:n,overlay:{objectIds:r.filter(l=>l.type==="shape"&&l.eventConfigurationIds?.includes(s)).map(l=>l.id).sort(),productionKillSeatIds:[]}}))}}var Co=40,_o=1200,Oo=.8,ko=3,Ro=-2,To=20,Ao=.1,No=40,Lo=40,Ke=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function Bt(e,t){let n=e.text.split(/\r?\n/);if(!e.width)return Math.max(1,n.length);let i=Math.max(1,Math.floor(t/Ke(e))),o=0;for(let r of n){if(!r.length){o+=1;continue}let s=0;for(let l of r.split(/\s+/)){let h=l.length;s&&s+1+h<=i?s+=1+h:(o+=Math.max(1,Math.ceil(h/i)),s=h%i)}}return Math.max(1,o)}function Be(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),i=Math.max(1,...n.map(l=>l.length))*Ke(e),o=e.width??i+t*2,r=Math.max(1,o-t*2),s=Bt(e,r);return{width:o,height:s*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:s,padding:t}}var Ye=Math.PI/180;function R(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function ze(e,t,n){let i=Math.cos(n),o=Math.sin(n),r=e.x-t.x,s=e.y-t.y;return{x:t.x+r*i-s*o,y:t.y+r*o+s*i}}function Fo(e,t,n){return n?ze(e,t,n*Ye):e}function Do(e,t){return ze(e,{x:0,y:0},t*Ye)}function j(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Yt(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let i=e.length||1;return{x:t/i,y:n/i}}function Vo(e){return e.length?Yt(e):null}function ge(e,t){let n=1-t,i=n*n*n,o=3*n*n*t,r=3*n*t*t,s=t*t*t;return{x:i*e.start.x+o*e.control1.x+r*e.control2.x+s*e.end.x,y:i*e.start.y+o*e.control1.y+r*e.control2.y+s*e.end.y}}function Go(e,t,n){let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},o={x:(n.x-i.x)*4/3,y:(n.y-i.y)*4/3};return{start:{...e},control1:{x:e.x+(t.x-e.x)/3+o.x,y:e.y+(t.y-e.y)/3+o.y},control2:{x:e.x+(t.x-e.x)*2/3+o.x,y:e.y+(t.y-e.y)*2/3+o.y},end:{...t}}}function qe(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[ge(e,.5)];let i=Array.from({length:n+1},(h,a)=>ge(e,a/n)),o=new Float64Array(i.length);for(let h=1;h<i.length;h+=1){let a=i[h].x-i[h-1].x,c=i[h].y-i[h-1].y;o[h]=o[h-1]+Math.hypot(a,c)}let r=o[o.length-1];if(r<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],l=1;for(let h=0;h<t;h+=1){let a=r*h/(t-1);for(;l<o.length-1&&o[l]<a;)l+=1;let c=o[l-1],u=o[l],m=u===c?0:(a-c)/(u-c);s.push({x:i[l-1].x+(i[l].x-i[l-1].x)*m,y:i[l-1].y+(i[l].y-i[l-1].y)*m})}return s}function F(e,t){return{x:e.x+t.x,y:e.y+t.y}}function ne(e,t){return{x:e.x-t.x,y:e.y-t.y}}function D(e,t){return{x:e.x*t,y:e.y*t}}function ae(e,t=13){return Array.from({length:t},(n,i)=>ge(e,i/(t-1)))}function We(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),i=Math.min(e.length-2,Math.floor(n));return j(e[i],e[i+1],n-i)}function $e(e,t,n){let i=Math.max(0,Math.min(1,t)),o=Math.max(i,Math.min(1,n)),r=[We(e,i)];for(let s=1;s<e.length-1;s+=1){let l=s/(e.length-1);l>i+1e-9&&l<o-1e-9&&r.push(e[s])}return r.push(We(e,o)),r}function Qe(e,t){let n=[[0,1],[1,2],[2,3],[3,0]],i=0,o=Number.POSITIVE_INFINITY;n.forEach(([m,d],p)=>{let f=R(j(e[m],e[d],.5),t);f<o&&(o=f,i=p)});let r=e[i],s=e[(i+1)%4],l=e[(i+2)%4],h=e[(i+3)%4],a=j(r,s,.5),c=ne(t,a),u=Math.max(1e-9,Math.hypot(c.x,c.y));return{p0:r,p1:s,p2:l,p3:h,normal:D(c,1/u),depth:(R(r,h)+R(s,l))/2}}function Je(e){let{p0:t,p1:n,p2:i,p3:o,normal:r,depth:s}=e,l=ne(n,t),h=ne(i,o),a=s*.22,c=s*.12;return{nearPath:{start:t,control1:F(F(t,D(l,1/3)),D(r,a)),control2:F(F(t,D(l,2/3)),D(r,a)),end:n},farPath:{start:i,control1:F(F(o,D(h,2/3)),D(r,c)),control2:F(F(o,D(h,1/3)),D(r,c)),end:o}}}function Xo(e,t,n){if(e.length!==4)throw new Error("A section shell requires four mapped bounds corners");let i=e.reduce((p,f)=>F(p,f),{x:0,y:0});i.x/=4,i.y/=4;let o=R(e[0],e[1]),r=R(e[0],e[3]),s=n==="auto"?o>r*1.25&&R(i,t)>r?"bezier":"tapered":n;if(s==="rectangle")return{mode:s,outline:e.map(p=>({...p}))};let l=Qe(e,t),{p0:h,p1:a,p2:c,p3:u}=l;if(s==="tapered")return{mode:s,outline:[F(h,D(ne(a,h),.14)),F(h,D(ne(a,h),1-.14)),c,u]};let{nearPath:m,farPath:d}=Je(l);return{mode:s,outline:[...ae(m),...ae(d).slice(1)]}}function Ko(e,t,n,i){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 o=Qe(e,t),{p0:r,p1:s,p2:l,p3:h}=o,a=i==="bezier"?Je(o):null,c=a?ae(a.nearPath):null,u=a?ae(a.farPath).reverse():null,m=Math.min(.055,.18/(n+1));return Array.from({length:n},(d,p)=>{let f=(p+1)/(n+1),g=f-m/2,v=f+m/2;return c&&u?[...$e(c,g,v),...$e(u,g,v).reverse()]:[j(r,s,g),j(r,s,v),j(h,l,v),j(h,l,g)]})}function zt(e,t,n){let i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,s=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return Math.hypot(e.x-(t.x+s*i),e.y-(t.y+s*o))}function Wt(e,t){let n=1/0;for(let i of t)if(!(i.length<2))for(let o=0,r=i.length-1;o<i.length;r=o++){let s=zt(e,i[r],i[o]);s<n&&(n=s)}return n}function Ze(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,h=t[o].y;s>e.y!=h>e.y&&e.x<(l-r)*(e.y-s)/(h-s)+r&&(n=!n)}return n}function tt(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function $t(e,t,n){let i=Ze(e,t)&&!n.some(r=>Ze(e,r)),o=Wt(e,[t,...n]);return i?o:-o}function W(e,t,n,i,o){let r=$t({x:e,y:t},i,o);return{x:e,y:t,h:n,d:r,max:r+n*Math.SQRT2}}var xe=class{constructor(){this.items=[]}get size(){return this.items.length}push(t){let n=this.items;n.push(t);let i=n.length-1;for(;i>0;){let o=i-1>>1;if(n[o].max>=n[i].max)break;[n[o],n[i]]=[n[i],n[o]],i=o}}pop(){let t=this.items,n=t[0],i=t.pop();if(t.length&&i){t[0]=i;let o=0;for(;;){let r=o*2+1,s=r+1,l=o;if(r<t.length&&t[r].max>t[l].max&&(l=r),s<t.length&&t[s].max>t[l].max&&(l=s),l===o)break;[t[l],t[o]]=[t[o],t[l]],o=l}}return n}};function et(e){if(e.length<3)return 0;let t=0;for(let n=0,i=e.length-1;n<e.length;i=n++)t+=(e[i].x+e[n].x)*(e[i].y-e[n].y);return Math.abs(t)/2}function Yo(e,t){return Math.max(0,et(e)-tt(t).reduce((n,i)=>n+et(i),0))}function nt(e,t){let n=tt(t);if(!e.length)return{point:{x:0,y:0},radius:0};if(e.length<3){let f=e.reduce((v,E)=>v+E.x,0)/e.length,g=e.reduce((v,E)=>v+E.y,0)/e.length;return{point:{x:f,y:g},radius:0}}let i=1/0,o=1/0,r=-1/0,s=-1/0;for(let f of e)f.x<i&&(i=f.x),f.y<o&&(o=f.y),f.x>r&&(r=f.x),f.y>s&&(s=f.y);let l=r-i,h=s-o,a=Math.min(l,h);if(!(a>0))return{point:{x:(i+r)/2,y:(o+s)/2},radius:0};let c=Math.max(l,h)/150,u=new xe,m=a/2;for(let f=i;f<r;f+=a)for(let g=o;g<s;g+=a)u.push(W(f+m,g+m,m,e,n));let d=W(i+l/2,o+h/2,0,e,n),p=0;for(;u.size;){let f=u.pop();if(!f)break;f.d>d.d&&(d=f),!(f.max-d.d<=c)&&(p>=4e3||(p+=1,m=f.h/2,u.push(W(f.x-m,f.y-m,m,e,n)),u.push(W(f.x+m,f.y-m,m,e,n)),u.push(W(f.x-m,f.y+m,m,e,n)),u.push(W(f.x+m,f.y+m,m,e,n))))}return{point:{x:d.x,y:d.y},radius:Math.max(0,d.d)}}function qt(e,t,n){return Math.max(t,Math.min(n,e))}function Wo(e,t,n){return e<t?t:e>n?n:e}function Qt(e){return qt(e,0,1)}function ot(e){let t=Qt(e);return t*t*(3-2*t)}var $=Math.PI*2;function q(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Jt(e,t,n){let i=t-e;if(n){for(;i<0;)i+=$;for(;i>=$;)i-=$}else{for(;i>0;)i-=$;for(;i<=-$;)i+=$}return i}function Jo(e){return e.end}function st(e){if(e.version!==1||e.closed!==!0||!q(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||!q(n.end))return!1;if(n.kind==="line"){if(R(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!q(n.control1)||!q(n.control2)||R(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!q(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(R(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(R(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||R(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return R(t,e.start)<=1e-4}function Zt(e,t,n){let i=1-n;return{x:i**3*e.x+3*i**2*n*t.control1.x+3*i*n**2*t.control2.x+n**3*t.end.x,y:i**3*e.y+3*i**2*n*t.control1.y+3*i*n**2*t.control2.y+n**3*t.end.y}}function at(e,t=2){if(!st(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),i=[{...e.start}],o=e.start;for(let r of e.segments){if(r.kind==="line")i.push({...r.end});else if(r.kind==="arc"){let s=Math.atan2(o.y-r.center.y,o.x-r.center.x),l=Math.atan2(r.end.y-r.center.y,r.end.x-r.center.x),h=Jt(s,l,r.clockwise),a=Math.max(2,Math.ceil(Math.abs(h)*r.radius/n));for(let c=1;c<=a;c+=1){let u=s+h*c/a;i.push({x:r.center.x+Math.cos(u)*r.radius,y:r.center.y+Math.sin(u)*r.radius})}}else{let s=R(o,r.control1)+R(r.control1,r.control2)+R(r.control2,r.end),l=Math.max(2,Math.ceil(s/n));for(let h=1;h<=l;h+=1)i.push(Zt(o,r,h/l))}o=r.end}return R(i[i.length-1],i[0])<=1e-4&&i.pop(),i}function ct(e,t,n){return en(e,o=>({x:o.x+t,y:o.y+n}))}function en(e,t,n=1,i=!1){return{...e,start:t(e.start),segments:e.segments.map(o=>o.kind==="line"?{...o,end:t(o.end)}:o.kind==="arc"?{...o,center:t(o.center),radius:o.radius*Math.abs(n),clockwise:i?!o.clockwise:o.clockwise,end:t(o.end)}:{...o,control1:t(o.control1),control2:t(o.control2),end:t(o.end)})}}function Zo(e){return e.map(t=>t===0?0:-t)}var tn=45,Se=150,nn=60;function on(e){let t=tn/100;if(e<=t)return Se;let n=Math.min(1,(e-t)/(1-t));return Se-n*(Se-nn)}var it=.5523;function rt(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function rn(e){let t=[],n=[];for(e.forEach((i,o)=>{q(i)&&(t.length&&rt(t[t.length-1],i)||(t.push({x:i.x,y:i.y}),n.push(o)))});t.length>1&&rt(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}function ei(e,t,n){return Me(e,{cornerSmoothing:t,...n})}var sn=.5,an=4/3;function cn(e,t,n){let i=t.x-e.x,o=t.y-e.y,r=Math.hypot(i,o);if(r<=1e-9)return{kind:"line",end:{...t}};let s=-o/r,l=i/r,h=n*an;return{kind:"bezier",control1:{x:e.x+i/3+s*h,y:e.y+o/3+l*h},control2:{x:e.x+i*2/3+s*h,y:e.y+o*2/3+l*h},end:{...t}}}function Me(e,t){let{points:n,sourceIndex:i}=rn(e),o=n.length;if(o<3)return null;let r=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,l=new Array(o).fill(0);if(s?.length)for(let x=0;x<o;x+=1){let S=s[i[x]];l[x]=Number.isFinite(S)?Math.min(100,Math.max(-100,S))/100:0}let h=l.some(x=>Math.abs(x)>1e-6);if(r<=0&&!h)return null;let a=t.wideAngleThresholdDeg??on(r),c=[];for(let x=0;x<o;x+=1)c[x]=R(n[x],n[(x+1)%o]);let u=new Array(o).fill(0);for(let x=0;x<o;x+=1){let S=n[(x-1+o)%o],y=n[x],b=n[(x+1)%o],P={x:S.x-y.x,y:S.y-y.y},M={x:b.x-y.x,y:b.y-y.y},_=Math.hypot(P.x,P.y),T=Math.hypot(M.x,M.y);if(_<=1e-9||T<=1e-9)continue;let I=Math.min(1,Math.max(-1,(P.x*M.x+P.y*M.y)/(_*T))),C=Math.acos(I)*180/Math.PI;if(C<a)continue;let O=ot((C-a)/(180-a));u[x]=r*O*.5*Math.min(_,T)}for(let x=0;x<o;x+=1){let S=(x+1)%o,y=u[x]+u[S];if(y>c[x]&&y>1e-9){let b=c[x]/y;u[x]*=b,u[S]*=b}}let m=new Array(o),d=new Array(o);for(let x=0;x<o;x+=1){let S=n[(x-1+o)%o],y=n[x],b=n[(x+1)%o];if(u[x]<=1e-6){m[x]={...y},d[x]={...y};continue}let P=R(y,S)||1,M=R(y,b)||1;m[x]={x:y.x+(S.x-y.x)/P*u[x],y:y.y+(S.y-y.y)/P*u[x]},d[x]={x:y.x+(b.x-y.x)/M*u[x],y:y.y+(b.y-y.y)/M*u[x]}}if(u.every(x=>x<=1e-6)&&!h)return null;let p=[],f={...d[0]},g=f,v=(x,S)=>{if(R(g,x)<=1e-9)return;let y=l[S];Math.abs(y)>1e-6?p.push(cn(g,x,y*sn*c[S])):p.push({kind:"line",end:{...x}}),g=x};for(let x=1;x<=o;x+=1){let S=x%o,y=n[S];v(m[S],(x-1)%o),u[S]>1e-6&&R(m[S],d[S])>1e-9&&(p.push({kind:"bezier",control1:j(m[S],y,it),control2:j(d[S],y,it),end:{...d[S]}}),g=d[S])}if(!p.length)return null;let E=p[p.length-1];R(E.end,f)>1e-9&&(E.kind==="line"?E.end={...f}:p.push({kind:"line",end:{...f}}));let w={version:1,closed:!0,start:f,segments:p};return st(w)?w:null}function ti(e){let t=[],n=e.start;for(let o of e.segments)t.push(n),n=o.end;let i=[];for(let o=e.segments.length-1;o>=0;o-=1){let r=e.segments[o],s=t[o];r.kind==="line"?i.push({kind:"line",end:{...s}}):r.kind==="arc"?i.push({kind:"arc",center:{...r.center},radius:r.radius,clockwise:!r.clockwise,end:{...s}}):i.push({kind:"bezier",control1:{...r.control2},control2:{...r.control1},end:{...s}})}return{version:1,closed:!0,start:{...e.start},segments:i}}function oi(e,t,n){let i=[];for(let o=0;o<e.length-1;o+=1){let r=e[o],s=e[o+1],l=Math.hypot(s.x-r.x,s.y-r.y);if(l<=0)continue;let h=Math.max(1,Math.round(l/n)),a=l/h,c=Math.atan2(s.y-r.y,s.x-r.x),u=o===0,d=(o>0?t[o-1]:void 0)==="break"?2:1,p=u?{...r}:{x:r.x+Math.cos(c)*a*d,y:r.y+Math.sin(c)*a*d},f=u?h+1:Math.max(1,h-(d-1));i.push({origin:p,rotation:c*180/Math.PI,seatCount:f,seatSpacing:a})}return i}function ii(e){let t=e.rotation*Math.PI/180,n={x:Math.cos(t),y:Math.sin(t)};return Array.from({length:e.seatCount},(i,o)=>({x:e.origin.x+n.x*o*e.seatSpacing,y:e.origin.y+n.y*o*e.seatSpacing}))}function ri(e){return e.reduce((t,n)=>t+n.seatCount,0)}function lt(e){let t=new Map,n=new Map;for(let i of e){if(i.type!=="row"||!i.segmentedRow)continue;let o=n.get(i.segmentedRow.groupId)??[];o.push(i),n.set(i.segmentedRow.groupId,o)}for(let[i,o]of n){let r=o.slice().sort((m,d)=>m.segmentedRow.componentIndex-d.segmentedRow.componentIndex),s=r[0]?.segmentedRow?.componentCount??0,l=r[0]?.segmentedRow;if(!l||!(s>=2&&r.length===s&&l?.boundaryBefore==="start"&&r.every((m,d)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===i&&m.segmentedRow.componentCount===s&&m.segmentedRow.componentIndex===d&&m.segmentedRow.repeatLabelOnComponents===l.repeatLabelOnComponents&&(d===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===l.displayLabel)))continue;let a=r.reduce((m,d)=>m+d.seatCount,0),c=0,u=0;for(let m of r)m.segmentedRow.boundaryBefore==="break"&&(c+=1),t.set(m.id,{groupId:i,adjacencyOffset:c,displayOffset:u,displayLabel:l.displayLabel,totalSeats:a,canonical:r[0],viewFromSeatUrl:l.viewFromSeatUrl,viewFromSeatMeta:l.viewFromSeatMeta,confidenceEvidence:l.confidenceEvidence}),c+=m.seatCount,u+=m.seatCount}return t}var Q=.02291666666666667,Ee=1/Q,ln=58,un=ln*Q,ai=0,dn=3,ut=0,Pe=120,fn=0,hn=45,mn=7,J=1.2;function ve(e,t,n,i){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):i}function pn(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=mn?e:dn}function dt(e,t={}){let n=ve(t.floorBaseHeightM,ut,Pe,0),i=Math.min(Pe,n+pn(e.elevation)*un),o=e.height===void 0?i:ve(e.height,ut,Pe,i),r=ve(e.rake,fn,hn,0);return{height:o,rake:r}}function ft(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 ht(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 i=1/0;for(let o=0;o+1<e.length;o++){let r=e[o],s=e[o+1],l=s.x-r.x,h=s.y-r.y,a=l*l+h*h,c=a>1e-12?((t-r.x)*l+(n-r.y)*h)/a:0;c<0?c=0:c>1&&(c=1);let u=t-(r.x+c*l),m=n-(r.y+c*h);if(Math.abs(u)>=i||Math.abs(m)>=i)continue;let d=Math.hypot(u,m);d<i&&(i=d)}return i}function yn(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let i=e.length||1;t/=i,n/=i;let o=0;for(let r of e){let s=Math.hypot(r.x-t,r.y-n);s>o&&(o=s)}return{cx:t,cy:n,r:o}}function mt(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Ie(e,t){let n=1/0;for(let i of ft(e)){let o=ht(t,i.x,i.y);o<n&&(n=o)}for(let i of ft(t)){let o=ht(e,i.x,i.y);o<n&&(n=o)}return n}function bn(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,i=0;for(let c of e)n+=c.x,i+=c.y;n/=e.length,i/=e.length;let o=-1,r=e[0];for(let c of e){let u=Math.hypot(c.x-n,c.y-i);u>o&&(o=u,r=c)}let s=r.x-n,l=r.y-i,h=Math.hypot(s,l);h>1e-9?(s/=h,l/=h):(s=1,l=0);let a=e.map((c,u)=>({p:c,i:u,t:(c.x-n)*s+(c.y-i)*l})).sort((c,u)=>c.t-u.t);return{pts:a.map(c=>c.p),seatIndices:a.map(c=>t[c.i])}}function gn(e){let t=e.length;if(t<3)return null;let n=0,i=0;for(let E of e)n+=E.x,i+=E.y;n/=t,i/=t;let o=0,r=0,s=0,l=0,h=0,a=0,c=0;for(let E of e){let w=E.x-n,x=E.y-i;o+=w*w,s+=x*x,r+=w*x,l+=w*w*w,h+=x*x*x,a+=w*x*x,c+=x*w*w}let u=o*s-r*r;if(Math.abs(u)<1e-9)return null;let m=(l+a)/2,d=(h+c)/2,p=(m*s-d*r)/u,f=(d*o-m*r)/u,g=p+n,v=f+i;return!Number.isFinite(g)||!Number.isFinite(v)?null:{cx:g,cy:v}}var xn=.15,Sn=.001;function Mn(e){let t=e[0],n=e[e.length-1],i=n.x-t.x,o=n.y-t.y,r=Math.hypot(i,o);if(!(r>1e-9))return 0;let s=0;for(let l of e){let h=Math.abs((l.x-t.x)*o-(l.y-t.y)*i)/r;h>s&&(s=h)}return s/r}function Pn(e){if(e.length<2)return null;let t=e.map(S=>{let y=0,b=0;for(let P of S.pts)y+=P.x,b+=P.y;return{x:y/S.pts.length,y:b/S.pts.length}}),n=0,i=0;for(let S of t)n+=S.x,i+=S.y;n/=t.length,i/=t.length;let o=0,r=0,s=0;for(let S of t){let y=S.x-n,b=S.y-i;o+=y*y,r+=y*b,s+=b*b}let l=o+s,h=o*s-r*r,a=l/2+Math.sqrt(Math.max(0,l*l/4-h)),c,u;Math.abs(r)>1e-12?(c=a-s,u=r):o>=s?(c=1,u=0):(c=0,u=1);let m=Math.hypot(c,u);if(!(m>1e-12))return null;c/=m,u/=m;let d=0,p=0,f=0;for(let S of e){if(S.pts.length<2)continue;let y=S.pts[0],b=S.pts[S.pts.length-1],P=b.x-y.x,M=b.y-y.y,_=Math.hypot(P,M);if(!(_>1e-9))continue;let T=P/_,I=M/_;d+=(T*T-I*I)*_,p+=2*T*I*_,f+=_}if(f>0&&Math.hypot(d,p)>=En*f){let S=Math.atan2(p,d)/2;c=-Math.sin(S),u=Math.cos(S)}let g=1/0,v=-1/0,E=[];for(let S of e){let y=1/0,b=-1/0;for(let P of S.pts){let M=P.x*c+P.y*u;M<y&&(y=M),M>b&&(b=M),M<g&&(g=M),M>v&&(v=M)}E.push(b-y)}let w=v-g;return w>1e-9?(E.sort((S,y)=>S-y),E[Math.min(E.length-1,Math.floor(E.length*.9))]/w<=vn?{x:c,y:u}:null):null}var vn=.35,En=.8;function pt(e,t,n,i){let o=new Map;for(let y of n){let b=t[y],P=b.rowId||`__seat-${y}`,M=o.get(P);M||(M={pts:[],idx:[]},o.set(P,M)),M.pts.push({x:b.x,y:b.y}),M.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let r=[];for(let[y,b]of o){let P=bn(b.pts,b.idx),M=0;for(let _ of P.pts)M+=Math.hypot(_.x-i.x,_.y-i.y);r.push({id:y,pts:P.pts,seatIndices:P.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:M/P.pts.length})}let s=r.map(y=>yn(y.pts)),l=r.length<=256?r.length*(r.length-1)/2:0,h=l?new Float64Array(l):null;h?.fill(Number.NaN);let a=h?new Map(r.map((y,b)=>[y,b])):null,c=(y,b)=>(y>b&&([y,b]=[b,y]),y*(2*r.length-y-1)/2+(b-y-1)),u=(y,b)=>{if(!h)return Ie(r[y].pts,r[b].pts);let P=c(y,b),M=h[P];if(!Number.isNaN(M))return M;let _=Ie(r[y].pts,r[b].pts);return h[P]=_,_},m=(y,b)=>a?u(a.get(y),a.get(b)):Ie(y.pts,b.pts),d=[];for(let y=0;y<r.length;y++){let b=1/0;for(let P=0;P<r.length;P++){if(y===P||mt(s[y],s[P])>=b)continue;let M=u(y,P);M<b&&(b=M)}Number.isFinite(b)&&d.push(b)}d.sort((y,b)=>y-b);let p=d.length?d[Math.floor(d.length/2)]:1,f=Math.max(p*1.8,1e-6),g=r.map(()=>[]);for(let y=0;y<r.length;y++)for(let b=y+1;b<r.length;b++)mt(s[y],s[b])>f||u(y,b)<=f&&(g[y].push(b),g[b].push(y));let v=0;for(let y=0;y<r.length;y++){if(r[y].blockId!==-1)continue;let b=v++,P=[y];for(r[y].blockId=b;P.length;){let M=P.pop();for(let _ of g[M])r[_].blockId===-1&&(r[_].blockId=b,P.push(_))}}let E=new Map;for(let y of r){let b=E.get(y.blockId)??[];b.push(y),E.set(y.blockId,b)}let w=[];for(let y of r){if(y.pts.length<4||Mn(y.pts)<Sn)continue;let b=gn(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||w.push({x:b.cx,y:b.cy}))}let x=w.length>=2?(()=>{let y=w.map(M=>M.x).sort((M,_)=>M-_),b=w.map(M=>M.y).sort((M,_)=>M-_),P=Math.floor(w.length/2);return{cx:y[P],cy:b[P]}})():null;if(x){let y=I=>Math.hypot(I.x-x.cx,I.y-x.cy),b=1/0,P=-1/0,M=[];for(let I of r){let C=1/0,O=-1/0;for(let N of I.pts){let A=y(N);A<C&&(C=A),A>O&&(O=A)}M.push(O-C),C<b&&(b=C),O>P&&(P=O)}let _=P-b;M.sort((I,C)=>I-C);let T=M[Math.min(M.length-1,Math.floor(M.length*.9))];if(_>1e-9&&T/_<=xn){let I=r.map(k=>{let se=0;for(let Rt of k.pts)se+=y(Rt);return{row:k,radius:se/k.pts.length}}),C=0,O=0;for(let k of I)C+=k.radius,O+=k.row.focalDistance;C/=I.length,O/=I.length;let N=0;for(let k of I)N+=(k.radius-C)*(k.row.focalDistance-O);if(N<0)for(let k of I)k.radius=-k.radius;let L=1/0;for(let k of I)k.radius<L&&(L=k.radius);I.sort((k,se)=>k.radius-se.radius);let V=-1,Y=-1/0,kt=_/Math.max(1,I.length)*.5,Ae=[];for(let k of I)k.radius-Y>kt&&(V++,Y=k.radius),k.row.ordinal=V,k.row.blockDepth=k.radius-L,Ae.push(k.row);return{sectionId:e,rows:Ae,blockCount:v}}}let S=[];for(let[,y]of E){let b=Pn(y);if(b){let P=I=>{let C=0;for(let O of I.pts)C+=O.x*b.x+O.y*b.y;return C/I.pts.length};y.sort((I,C)=>P(I)-P(C)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let M=[],_=p*.5;for(let I of y){let C=M[M.length-1];C&&Math.abs(P(I)-P(C[0]))<_?C.push(I):M.push([I])}let T=0;for(let I=0;I<M.length;I++){if(I>0){let C=1/0;for(let O of M[I-1])for(let N of M[I])C=Math.min(C,m(O,N));C=Math.min(C,Math.abs(P(M[I][0])-P(M[I-1][0]))),T+=C}for(let C of M[I])C.ordinal=I,C.blockDepth=T,S.push(C)}}else{let P=1/0;for(let M of y)M.focalDistance<P&&(P=M.focalDistance);y.sort((M,_)=>M.focalDistance-_.focalDistance);for(let M=0;M<y.length;M++)y[M].ordinal=M,y[M].blockDepth=Math.max(0,y[M].focalDistance-P),S.push(y[M])}}return{sectionId:e,rows:S,blockCount:v}}function In(e,t){return Math.abs(e.x-t.x)<=1e-7&&Math.abs(e.y-t.y)<=1e-7}function oe(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)}function ce(e,t,n){let i=oe(t,n,e);return Math.abs(i)>1e-7?!1:e.x>=Math.min(t.x,n.x)-1e-7&&e.x<=Math.max(t.x,n.x)+1e-7&&e.y>=Math.min(t.y,n.y)-1e-7&&e.y<=Math.max(t.y,n.y)+1e-7}function wn(e,t,n,i){let o=oe(e,t,n),r=oe(e,t,i),s=oe(n,i,e),l=oe(n,i,t);return(o>1e-7&&r<-1e-7||o<-1e-7&&r>1e-7)&&(s>1e-7&&l<-1e-7||s<-1e-7&&l>1e-7)?!0:Math.abs(o)<=1e-7&&ce(n,e,t)||Math.abs(r)<=1e-7&&ce(i,e,t)||Math.abs(s)<=1e-7&&ce(e,n,i)||Math.abs(l)<=1e-7&&ce(t,n,i)}function Cn(e){return e.reduce((t,n,i)=>{let o=e[(i+1)%e.length];return t+n.x*o.y-o.x*n.y},0)}function _n(e){for(let t=0;t<e.length;t+=1){let n=(t+1)%e.length;for(let i=t+1;i<e.length;i+=1){let o=(i+1)%e.length;if(!(t===i||n===i||o===t)&&wn(e[t],e[n],e[i],e[o]))return!0}}return!1}function ui(e){return e.length<3?{ok:!1,code:"too_few_vertices",message:"Add at least three vertices to create a polygon."}:e.length>256?{ok:!1,code:"too_many_vertices",message:"A polygon can contain at most 256 vertices."}:e.some(t=>!Number.isFinite(t.x)||!Number.isFinite(t.y)||Math.abs(t.x)>1e7||Math.abs(t.y)>1e7)?{ok:!1,code:"invalid_coordinate",message:"Every polygon vertex must use a finite coordinate inside the safe chart range."}:e.some((t,n)=>In(t,e[(n+1)%e.length]))?{ok:!1,code:"duplicate_vertex",message:"Move or remove duplicate neighbouring vertices."}:Math.abs(Cn(e))<2?{ok:!1,code:"degenerate_polygon",message:"The polygon needs a visible enclosed area."}:_n(e)?{ok:!1,code:"self_intersection",message:"Polygon edges cannot cross or touch each other."}:{ok:!0}}var mi=64;function On(e){let t=e.points??[];if(e.kind!=="polygon"||t.length<3||!Array.isArray(e.edgeCurvature))return[];let n=t.map((i,o)=>{let r=e.edgeCurvature[o];return Number.isFinite(r)?Math.min(100,Math.max(-100,r)):0});return n.some(i=>Math.abs(i)>.5)?n:[]}function kn(e){let t=On(e);return t.length?Me(e.points,{edgeCurvature:t}):null}function ie(e,t=2){let n=kn(e);return n?at(n,t):e.points??[]}function pi(e){return e.kind==="polygon"?X(e.holes):[]}function yi(e,t){let n=ie(e);return n.length<3||t.length<3||!t.flatMap((o,r)=>{let s=t[(r+1)%t.length];return[o,{x:(o.x+s.x)/2,y:(o.y+s.y)/2}]}).every(o=>Z(o,n)||we(o,n))?!1:!t.some((o,r)=>{let s=t[(r+1)%t.length];return n.some((l,h)=>yt(o,s,l,n[(h+1)%n.length]))})}function yt(e,t,n,i){let o=(a,c,u)=>(c.x-a.x)*(u.y-a.y)-(c.y-a.y)*(u.x-a.x),r=o(e,t,n),s=o(e,t,i),l=o(n,i,e),h=o(n,i,t);return r*s<-1e-9&&l*h<-1e-9}function bi(e,t){return Z(e[0],t)||Z(t[0],e)?!0:e.some((n,i)=>{let o=e[(i+1)%e.length];return t.some((r,s)=>yt(n,o,r,t[(s+1)%t.length]))})}var Si=[{key:"rect",label:"Flat stage",blurb:"Classic proscenium box."},{key:"rounded",label:"Rounded",blurb:"Softened corners."},{key:"arc",label:"Curved front",blurb:"Front edge bows toward the audience."},{key:"thrust",label:"Thrust (T)",blurb:"Central tongue projects into the crowd."},{key:"runway",label:"Runway",blurb:"Long catwalk into the audience."},{key:"round",label:"In the round",blurb:"Central platform, audience all around."},{key:"pitch-football",label:"Football pitch",blurb:"105 \xD7 68 m pitch with centre circle and penalty boxes."},{key:"rink-hockey",label:"Hockey rink",blurb:"60 \xD7 30 m ice rink with blue lines and faceoff circles."},{key:"track-athletics",label:"Athletics track",blurb:"400 m track: two straights, two semicircles, eight lanes."},{key:"oval-cricket",label:"Cricket oval",blurb:"~150 \xD7 140 m oval with boundary rope and pitch strip."},{key:"pitch-rugby",label:"Rugby pitch",blurb:"100 \xD7 70 m field of play with in-goal areas, 22 m and 10 m lines."},{key:"diamond-baseball",label:"Baseball field",blurb:"Diamond, infield, mound and foul lines out to 99 m poles."},{key:"court-basketball",label:"Basketball court",blurb:"28 \xD7 15 m court with keys and three-point lines."},{key:"court-tennis",label:"Tennis court",blurb:"23.77 \xD7 10.97 m doubles court with run-off and net."},{key:"ring-boxing",label:"Boxing ring",blurb:"Raised ring, 6.1 m inside the ropes, coloured corners."}],Rn=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Tn=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function An(e){return!!e&&Rn.has(e)}function Mi(e){return!!e&&Tn.has(e)}var _e=1.1;function Pi(e){return le(e)?e==="ring-boxing"?_e:.06:1}var bt={round:{width:6,height:6},"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8}},gt={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f"};function vi(e){let t=bt[e];return t?{width:t.width*Ee,height:t.height*Ee}:{width:300,height:70}}var Nn="#232c40",xt=Math.PI*2;function St(e,t,n,i,o,r){return{x:o+e*n-t*i,y:r+e*i+t*n}}function Ln(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),h=Math.sin(s),a=o/2,c=r/2,u=[],m=(d,p)=>{u.push({x:d,y:p})};switch(t){case"rect":{m(-a,-c),m(a,-c),m(a,c),m(-a,c);break}case"rounded":{let d=Math.min(o,r)*.18,p=5,f=(g,v,E)=>{for(let w=0;w<=p;w++){let x=E+w/p*(Math.PI/2);m(g+d*Math.cos(x),v+d*Math.sin(x))}};f(a-d,-c+d,-Math.PI/2),f(a-d,c-d,0),f(-a+d,c-d,Math.PI/2),f(-a+d,-c+d,Math.PI);break}case"arc":{let d=r*.45;m(-a,-c),m(a,-c);let p=24;for(let f=0;f<=p;f++){let g=f/p,v=a-g*o,E=c+d*(1-Math.pow(2*v/o,2));m(v,E)}break}case"thrust":{let d=o*.18,p=r*1.1;m(-a,-c),m(a,-c),m(a,c),m(d,c),m(d,c+p),m(-d,c+p),m(-d,c),m(-a,c);break}case"runway":{let d=o*.1,p=r*3;m(-a,-c),m(a,-c),m(a,c),m(d,c),m(d,c+p),m(-d,c+p),m(-d,c),m(-a,c);break}case"round":case"oval-cricket":{for(let p=0;p<40;p++){let f=p/40*xt;m(a*Math.cos(f),c*Math.sin(f))}break}case"pitch-football":case"pitch-rugby":case"court-basketball":case"court-tennis":case"ring-boxing":{m(-a,-c),m(a,-c),m(a,c),m(-a,c);break}case"diamond-baseball":{for(let d of Fn(a,c))m(d.x,d.y);break}case"rink-hockey":{for(let d of jn(a,c,a*(8.5/60),c*(8.5/30)))m(d.x,d.y);break}case"track-athletics":{for(let d of Ce(a,c))m(d.x,d.y);break}}return u.map(d=>St(d.x,d.y,l,h,n,i))}function Ei(e,t="stage"){return{type:"shape",id:t,kind:"polygon",points:Ln(e),fill:e.fill??gt[e.kind]??Nn,label:e.label??"STAGE",role:"stage",stageKind:e.kind}}function jn(e,t,n,i){let o=[],s=(l,h,a)=>{for(let c=0;c<=8;c++){let u=a+c/8*(Math.PI/2);o.push({x:l+n*Math.cos(u),y:h+i*Math.sin(u)})}};return s(e-n,-t+i,-Math.PI/2),s(e-n,t-i,0),s(-e+n,t-i,Math.PI/2),s(-e+n,-t+i,Math.PI),o}function Ce(e,t){let n=Math.max(0,e-t),i=[],o=20;for(let r=0;r<=o;r++){let s=-Math.PI/2+r/o*Math.PI;i.push({x:n+t*Math.cos(s),y:t*Math.sin(s)})}for(let r=0;r<=o;r++){let s=Math.PI/2+r/o*Math.PI;i.push({x:-n+t*Math.cos(s),y:t*Math.sin(s)})}return i}var B=(()=>{let t={x:0,y:52},n=25,i={x:70,y:t.y-70},o=(i.x*i.x+i.y*i.y-4900)/(2*(i.y+70)),r=o+70,s=[],l=Math.atan2(i.y-o,i.x),h=Math.atan2(i.y-o,-i.x);for(let a=0;a<=24;a++){let c=l+(h-l)*a/24;s.push({x:r*Math.cos(c),y:o+r*Math.sin(c)})}return{half:70,home:t,backstop:n,fence:s}})();function Fn(e,t){let n=e/B.half,i=t/B.half;return[{x:-B.backstop*n,y:t},{x:B.backstop*n,y:t},...B.fence.map(o=>({x:o.x*n,y:o.y*i}))]}var Dn="#f1f5f9";function Ii(e){switch(e){case"pitch-football":return"PITCH";case"rink-hockey":return"RINK";case"track-athletics":return"TRACK";case"oval-cricket":return"OVAL";case"pitch-rugby":return"PITCH";case"diamond-baseball":return"FIELD";case"court-basketball":case"court-tennis":return"COURT";case"ring-boxing":return"RING";default:return"STAGE"}}function le(e){return An(e)}function K(e,t,n,i,o=32){let r=[];for(let s=0;s<o;s++){let l=s/o*xt;r.push({x:e+n*Math.cos(l),y:t+i*Math.sin(l)})}return r}function U(e,t,n,i){return[{x:e-n,y:t-i},{x:e+n,y:t-i},{x:e+n,y:t+i},{x:e-n,y:t+i}]}function Vn(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),h=Math.sin(s),a=o/2,c=r/2,u=[],m=bt[t],d=f=>m?f/m.width*o:0,p=f=>m?f/m.height*r:0;switch(t){case"pitch-football":{u.push({points:[{x:0,y:-c},{x:0,y:c}],closed:!1}),u.push({points:K(0,0,d(9.15),p(9.15)),closed:!0});for(let f of[-1,1])u.push({points:U(f*(a-d(16.5)/2),0,d(16.5)/2,p(40.32)/2),closed:!0}),u.push({points:U(f*(a-d(5.5)/2),0,d(5.5)/2,p(18.32)/2),closed:!0});break}case"rink-hockey":{u.push({points:[{x:0,y:-c},{x:0,y:c}],closed:!1,ink:"#d63b3b"});for(let f of[-1,1]){u.push({points:[{x:f*d(7.5),y:-c},{x:f*d(7.5),y:c}],closed:!1,ink:"#2f6ecb"}),u.push({points:[{x:f*(a-d(4)),y:-p(11)},{x:f*(a-d(4)),y:p(11)}],closed:!1,ink:"#d63b3b"});for(let g of[-1,1])u.push({points:K(f*d(20.5),g*p(7),d(4.5),p(4.5)),closed:!0,ink:"#2f6ecb"})}u.push({points:K(0,0,d(4.5),p(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let g=c-p(1.22)*8;g>0&&u.push({points:Ce(a-d(1.22)*8,g),closed:!0,fill:"#2f7d4f"});for(let v=1;v<8;v++){let E=p(1.22)*v,w=c-E;if(w<=0)break;u.push({points:Ce(a-d(1.22)*v,w),closed:!0})}break}case"oval-cricket":{u.push({points:K(0,0,d(27.4),p(27.4+20.12/2),40),closed:!0}),u.push({points:U(0,0,d(3.05)/2,p(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let f=g=>({points:[{x:d(g),y:-c},{x:d(g),y:c}],closed:!1});u.push(f(0));for(let g of[-1,1]){u.push(f(g*50),f(g*28));for(let v=-35;v<35;v+=4)u.push({points:[{x:d(g*10),y:p(v)},{x:d(g*10),y:p(Math.min(35,v+2))}],closed:!1})}break}case"diamond-baseball":{let f=(A,L)=>({x:d(A),y:p(L)}),{home:g}=B,v=27.43,E=v/Math.SQRT2,w={x:g.x+E,y:g.y-E},x={x:g.x,y:g.y-2*E},S={x:g.x-E,y:g.y-E},y={x:g.x,y:g.y-18.44},b="#b98a59",P=gt["diamond-baseball"],M=38.94,_=[f(g.x,g.y)],T=Math.atan2(g.y-M/Math.SQRT2-y.y,M/Math.SQRT2),I=Math.PI-T;for(let A=0;A<=16;A++){let L=T-(T+Math.PI*2-I)%(Math.PI*2)*(A/16);_.push(f(y.x+29*Math.cos(L),y.y+29*Math.sin(L)))}u.push({points:_,closed:!0,fill:b,ink:b});let C={x:g.x,y:g.y-E},O=[{x:g.x,y:g.y},w,x,S].map(A=>f(C.x+(A.x-C.x)*.84,C.y+(A.y-C.y)*.84));u.push({points:O,closed:!0,fill:P,ink:P}),u.push({points:K(d(y.x),p(y.y),d(2.74),p(2.74),20),closed:!0,fill:b,ink:b}),u.push({points:K(d(g.x),p(g.y),d(3.96),p(3.96),20),closed:!0,fill:b,ink:b});let N=B.fence;u.push({points:[f(g.x,g.y),f(N[0].x,N[0].y)],closed:!1}),u.push({points:[f(g.x,g.y),f(N[N.length-1].x,N[N.length-1].y)],closed:!1});for(let A of[w,x,S])u.push({points:U(d(A.x),p(A.y),d(.3),p(.3)),closed:!0,fill:Dn});break}case"court-basketball":{u.push({points:U(0,0,d(14),p(7.5)),closed:!0}),u.push({points:[{x:0,y:-p(7.5)},{x:0,y:p(7.5)}],closed:!1}),u.push({points:K(0,0,d(1.8),p(1.8),24),closed:!0});for(let f of[-1,1]){let g=f*14,v=f*(14-5.8),E=f*(14-1.575);u.push({points:U(d((g+v)/2),0,d(2.9),p(2.45)),closed:!0,fill:"#2f5d8a"}),u.push({points:K(d(v),0,d(1.8),p(1.8),24),closed:!0});let w=Math.sqrt(6.75*6.75-6.6*6.6),x=[{x:d(g),y:-p(6.6)}],S=Math.atan2(-6.6,-f*w),y=2*Math.atan2(6.6,w);for(let b=0;b<=16;b++){let P=S-f*y*(b/16);x.push({x:d(E+6.75*Math.cos(P)),y:p(6.75*Math.sin(P))})}x.push({x:d(g),y:p(6.6)}),u.push({points:x,closed:!1})}break}case"court-tennis":{u.push({points:U(0,0,d(11.885),p(5.485)),closed:!0,fill:"#2b5f99"});for(let f of[-1,1])u.push({points:[{x:-d(11.885),y:f*p(4.115)},{x:d(11.885),y:f*p(4.115)}],closed:!1}),u.push({points:[{x:f*d(6.4),y:-p(4.115)},{x:f*d(6.4),y:p(4.115)}],closed:!1});u.push({points:[{x:-d(6.4),y:0},{x:d(6.4),y:0}],closed:!1}),u.push({points:[{x:0,y:-p(6.4)},{x:0,y:p(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{u.push({points:U(0,0,d(3.05),p(3.05)),closed:!0});let v=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[E,w,x]of v)u.push({points:U(E*d(3.05),w*p(3.05),d(.3),p(.3)),closed:!0,fill:x,ink:x});break}default:return[]}return u.map(f=>({...f,points:f.points.map(g=>St(g.x,g.y,l,h,n,i))}))}function wi(e){if(e.role!=="stage"||!le(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(c=>c.x),i=e.points.map(c=>c.y),o=Math.min(...n),r=Math.max(...n),s=Math.min(...i),l=Math.max(...i),h=Math.max(1,r-o),a=Math.max(1,l-s);t={cx:o+h/2,cy:s+a/2,width:h,height:a}}return t?Vn({kind:e.stageKind,...t}):[]}function Hn(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?ie(e,6):e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,i=e.width,o=e.height;return[{x:t,y:n},{x:t+i,y:n},{x:t+i,y:n+o},{x:t,y:n+o}]}function Un(e,t,n){let i=n*Math.PI/180,o=Math.cos(i),r=Math.sin(i),s=e.x-t.x,l=e.y-t.y;return{x:t.x+s*o-l*r,y:t.y+s*r+l*o}}function Mt(e){let t=Hn(e);if(!t||t.length<2)return null;let n=e.rotation??0,i=Math.abs(n)<1e-6?t:t.map(h=>Un(h,{x:t.reduce((a,c)=>a+c.x,0)/t.length,y:t.reduce((a,c)=>a+c.y,0)/t.length},n)),o=1/0,r=1/0,s=-1/0,l=-1/0;for(let h of i)o=Math.min(o,h.x),r=Math.min(r,h.y),s=Math.max(s,h.x),l=Math.max(l,h.y);return!Number.isFinite(o)||s-o<1e-6||l-r<1e-6?null:{minX:o,minY:r,maxX:s,maxY:l}}var Gn=5,Xn=3,Kn=.92,Bn=1.9,Yn=2,zn=.6,Wn=1,$n=.06;function qn(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?_e:le(e.stageKind)?$n:Wn}function Pt(e){let t=1/0,n=1/0,i=-1/0,o=-1/0,r=-1/0;for(let s of Oe(e)){let l=s.baseHeightM??0;for(let h of s.objects){if(h.type!=="shape"||h.role!=="stage")continue;let a=Mt(h);a&&(t=Math.min(t,a.minX),n=Math.min(n,a.minY),i=Math.max(i,a.maxX),o=Math.max(o,a.maxY),r=Math.max(r,l+qn(h)))}}return!Number.isFinite(t)||!Number.isFinite(r)?null:{minX:t,minY:n,maxX:i,maxY:o,deckTopM:r}}function Qn(e,t,n,i){let o=1/0,r=1/0,s=-1/0,l=-1/0;for(let d of e)Number.isFinite(d.eyeHeightM)&&(o=Math.min(o,d.x),s=Math.max(s,d.x),r=Math.min(r,d.y),l=Math.max(l,d.y));if(!Number.isFinite(o))return null;let h=o*t,a=r*t,c=Math.max(1,Math.ceil((s-o)*t/n)+1),u=Math.max(1,Math.ceil((l-r)*t/n)+1),m=new Float64Array(c*u).fill(-1/0);for(let d of e){if(!Number.isFinite(d.eyeHeightM))continue;let p=d.eyeHeightM-J,f=Math.min(c-1,Math.max(0,Math.floor((d.x*t-h)/n))),v=Math.min(u-1,Math.max(0,Math.floor((d.y*t-a)/n)))*c+f,E=p+i;E>m[v]&&(m[v]=E)}return{cellM:n,minX:h,minY:a,cols:c,rows:u,top:m}}function Jn(e,t,n){let i=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return i<0||o<0||i>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+i]}function vt(e,t,n={}){let i=new Map;if(!t||!e.length)return i;let o=n.metresPerChartUnit??Q,r=n.cellM??zn,s=n.chairBackM??Kn,l=n.selfRowSkipM??Yn,h=n.clearThreshold??.9,a=n.partialThreshold??.25,c=Math.max(1,n.columns??Gn),u=Math.max(1,n.rows??Xn),m=Qn(e,o,r,s);if(!m)return i;let d=(t.maxX-t.minX)*o,p=(t.maxY-t.minY)*o,f=d>=p,g=(t.minX+t.maxX)/2*o,v=(t.minY+t.maxY)/2*o,E=[];for(let x=0;x<c;x++){let S=(x+.5)/c-.5,y=f?g+S*d:g,b=f?v:v+S*p;for(let P=0;P<u;P++){let M=t.deckTopM+(u===1?0:P/(u-1)*Bn);E.push({x:y,y:b,z:M})}}let w=r/2;for(let x of e){if(!Number.isFinite(x.eyeHeightM))continue;let S=x.x*o,y=x.y*o,b=x.eyeHeightM,P=0,M=1/0;for(let T of E){let I=T.x-S,C=T.y-y,O=Math.hypot(I,C);if(!(O>l)){P++;continue}let N=I/O,A=C/O,L=0;for(let V=l;V<O;V+=w){let Y=Jn(m,S+N*V,y+A*V);if(!(!Number.isFinite(Y)||Y>=b)&&Y>b+(T.z-b)*V/O){L=V;break}}L?M=Math.min(M,L):P++}let _=P/E.length;_>=h||i.set(x.id,{seatId:x.id,mark:_<a?"obstructedView":"restrictedView",visibleFraction:_,totalRays:E.length,atDistanceM:Number.isFinite(M)?M:0})}return i}function Et(e,t){if(!t.size)return 0;let n=0;for(let i of e){let o=t.get(i.id);if(!o)continue;let r=i.commercial;r?.restrictedView!==void 0||r?.obstructedView!==void 0||(i.commercial={...r,[o.mark]:!0},n++)}return n}function ke(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var fe=Math.PI/180,Zn=9,ee=16;function Re(e,t,n,i){let o=n*fe,r=Math.cos(o),s=Math.sin(o);return{x:i.x+e*r-t*s,y:i.y+e*s+t*r}}function he(e){let{seatCount:t,seatSpacing:n,curve:i,rotation:o,origin:r}=e,s=[];if(e.path)return qe(e.path,t);if(t<=1)return t===1&&s.push({x:r.x,y:r.y}),s;if(i===0){for(let a=0;a<t;a++)s.push(Re(a*n,0,o,r));return s}let l=i/(t-1)*fe,h=n/(2*Math.sin(Math.abs(l)/2));for(let a=0;a<t;a++){let c=a*l,u=h*Math.sin(c),m=-h+h*Math.cos(c);s.push(Re(u,m,o,r))}return s}function Te(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Qi(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 eo(e,t){let n=Te(e);return he(e).map((i,o)=>{let r=n.get(o),s=ke(r),l=Ne(e,o,r),h={...e.commercial,...r?.commercial};return{index:o,x:i.x+(r?.dx??0),y:i.y+(r?.dy??0),label:l,displayLabel:me(e,o,t,r),categoryKey:r?.categoryKey??e.categoryKey,skipped:!!r?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:r?.wheelchairSpaceType,commercial:Object.values(h).some(a=>a!==void 0&&a!==!1&&a!=="")?h:void 0,glyph:r?.glyph,viewUrl:r?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:r?.viewFromSeatUrl?r.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:r?.labelStyle??e.seatLabelStyle}})}function to(e){let t=[];for(let n of eo(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 no(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(r=>t.includes(r)),i={top:0,bottom:0,left:0,right:0};if(!n.length)return i;let o=Math.max(0,Math.round(e.seatCount));for(let r=0;r<o;r++)i[n[r%n.length]]+=1;return i}function _t(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let i=new Map((e.overrides??[]).map(c=>[c.index,c])),o=(c,u,m,d)=>{let p=i.get(c),f=ke(p),g=p?.label??Le(e,c);return{index:c,label:g,displayLabel:p?.displayLabel??je(e,c),x:u+(p?.dx??0),y:m+(p?.dy??0),categoryKey:p?.categoryKey??e.categoryKey,skipped:!!p?.skip,accessible:f.length>0,accessibility:f,wheelchairSpaceType:p?.wheelchairSpaceType,commercial:p?.commercial,glyph:p?.glyph,viewUrl:p?.viewFromSeatUrl,viewMeta:p?.viewFromSeatUrl?p.viewFromSeatMeta:void 0,labelStyle:p?.labelStyle,...d?{side:d}:{}}};if(e.shape==="round"){let c=(e.radius??40)+ee,u=e.rotation*fe,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let g=0;g<n;g++){let v=u+g/n*2*Math.PI;t.push(o(g,e.center.x+c*Math.cos(v),e.center.y+c*Math.sin(v)))}return t}let d=m*fe,p=(2*Math.PI-d)/2,f=u+p;for(let g=0;g<n;g++){let v=f+g/(n-1)*d;t.push(o(g,e.center.x+c*Math.cos(v),e.center.y+c*Math.sin(v)))}return t}let r=e.width??80,s=e.height??50,l=no(e),h=["top","bottom","left","right"],a=0;for(let c of h){let u=l[c];for(let m=0;m<u;m++){let d,p;c==="top"?(d=-r/2+(m+.5)*r/u,p=-s/2-ee):c==="bottom"?(d=-r/2+(m+.5)*r/u,p=s/2+ee):c==="left"?(d=-r/2-ee,p=-s/2+(m+.5)*s/u):(d=r/2+ee,p=-s/2+(m+.5)*s/u);let f=Re(d,p,e.rotation,e.center);t.push(o(a++,f.x,f.y,c))}}return t}function Ji(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):_t(e).filter(t=>!t.skipped).length}function oo(e){return _t(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 io(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth",...e.commercial?.note?{commercial:{note:e.commercial.note}}:{}}]}function Z(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,h=t[o].y;s>e.y!=h>e.y&&e.x<(l-r)*(e.y-s)/(h-s)+r&&(n=!n)}return n}function we(e,t){return t.some((n,i)=>{let o=t[(i+1)%t.length],r=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(r)>1e-7)return!1;let s=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),l=(o.x-n.x)**2+(o.y-n.y)**2;return s>=-1e-7&&s<=l+1e-7})}function X(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function re(e,t,n){return Z(e,t)&&!X(n).some(i=>Z(e,i)||we(e,i))}function Zi(e,t){return nt(e,t).point}function de(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;return{x:t/e.length,y:n/e.length}}function Ot(e){switch(e.type){case"row":{let t=he(e),n=Te(e),i=0,o=0,r=0;for(let s=0;s<t.length;s++){let l=n.get(s);l?.skip||(i+=t[s].x+(l?.dx??0),o+=t[s].y+(l?.dy??0),r++)}return r?{x:i/r,y:o/r}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return de(e.points);case"section":return de(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?de(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 It(e,t){return e.length===t.length&&e.every((n,i)=>n.x===t[i].x&&n.y===t[i].y)}function ro(e,t){if(e.type!=="gaArea"||!It(e.points,t.outline))return!1;let n=X(e.holes),i=X(t.holes);return n.length===i.length&&n.every((o,r)=>It(o,i[r]))}function so(e,t,n=e.filter(o=>o.type==="section"),i=Ot(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(ro(t,s)||re(i,s.outline,s.holes))):void 0)??n.find(s=>re(i,s.outline,s.holes))??(t.type==="row"&&ao(t)?co(t,n):void 0)}function ao(e){return(e.overrides??[]).some(t=>t.skip===!0)}function co(e,t){let n=he(e),i=Te(e),o,r=0;for(let s of t){let l=0;for(let h=0;h<n.length;h++){let a=i.get(h);if(a?.skip)continue;let c={x:n[h].x+(a?.dx??0),y:n[h].y+(a?.dy??0)};re(c,s.outline,s.holes)&&l++}l>r&&(o=s,r=l)}return o}function Oe(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 er(e,t){let n=Oe(e);return(t?n.find(i=>i.id===t):n[0])?.objects??[]}function lo(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function uo(e,t,n){let i=r=>({x:r.x+t,y:r.y+n}),o=r=>r.map(i);switch(e.type){case"row":return{...e,origin:i(e.origin)};case"table":case"booth":return{...e,center:i(e.center)};case"gaArea":return{...e,points:o(e.points),...e.holes?{holes:X(e.holes).map(o)}:{}};case"section":return{...e,outline:o(e.outline),...e.outlinePath?{outlinePath:ct(e.outlinePath,t,n)}:{},...e.holes?{holes:X(e.holes).map(o)}:{}};case"text":return{...e,position:i(e.position)};case"shape":return{...e,...e.points?{points:o(e.points)}:{},...e.holes?{holes:X(e.holes).map(o)}:{},...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 tr(e,t=900){if(!e.floors||e.floors.length<2)return e;let n=[];return e.floors.forEach((i,o)=>{let r=-o*t;for(let s of i.objects)n.push(r===0?s:uo(s,0,r))}),{...e,objects:n,floors:void 0}}function wt(e,t,n,i,o,r,s,l,h){let a=[],c=e.filter(f=>f.type==="section"),u=lt(e),m=f=>!f?.eventConfigurationId||f.eventConfigurationId===i&&(f.eventConfigurationVersion===void 0||f.eventConfigurationVersion===h),d=f=>Fe(f,{activeConfigurationId:i,activeConfigurationVersion:h,activeBasisSha256:o,now:l}),p=(f,g)=>d(f)?{...f,coverage:g}:void 0;for(let f of e){let g=[];if(f.type==="row"?g=to(f):f.type==="table"?g=oo(f):f.type==="booth"&&(g=io(f)),!g.length)continue;for(let S of g)S.viewUrl&&!m(S.viewMeta)&&(S.viewUrl=void 0,S.viewMeta=void 0);if(f.type==="row"){let S=u.get(f.id);if(S){let y=new Map((f.overrides??[]).map(b=>[b.index,b]));for(let b of g){let P=Number(b.id.slice(b.id.lastIndexOf(":")+1));if(!Number.isInteger(P))continue;b.logicalRowId=S.groupId,b.logicalSeatIndex=S.adjacencyOffset+P,y.get(P)?.displayLabel||(b.displayLabel=me(f,P,S)),!b.viewUrl&&S.viewFromSeatUrl&&m(S.viewFromSeatMeta)&&(b.viewUrl=S.viewFromSeatUrl,b.viewMeta=S.viewFromSeatMeta);let M=y.get(P)?.confidenceEvidence;b.confidenceEvidence=p(M,"exact-seat")??p(f.confidenceEvidence,"row-representative")??p(S.confidenceEvidence,"row-representative")}}}let v=so(e,f,c,f.type==="row"?de(g):Ot(f)),E=v?.viewFromSeatUrl,x=(v?.zone?t?.find(S=>S.id===v.zone):void 0)?.focalPoint??n;for(let S of g){if(!S.confidenceEvidence){let y=Number(S.id.slice(S.id.lastIndexOf(":")+1)),b=(f.type==="row"||f.type==="table")&&Number.isInteger(y)?f.overrides?.find(P=>P.index===y)?.confidenceEvidence:void 0;S.confidenceEvidence=p(b,"exact-seat")??(f.type==="row"?p(f.confidenceEvidence,"row-representative"):void 0)}S.confidenceEvidence??=p(v?.confidenceEvidence,"section-representative")??(s?p(s.evidence,s.coverage):void 0),!S.viewUrl&&E&&m(v?.viewFromSeatMeta)&&(S.viewUrl=E,S.viewMeta=v?.viewFromSeatMeta),!S.viewUrl&&r&&m(r.meta)&&(S.viewUrl=r.url,S.viewMeta=r.meta),v&&(S.sectionId=v.logicalSectionId??v.id),v?.zone&&(S.zoneId=v.zone),x&&(S.focalPoint={...x})}a.push(...g)}return a}function nr(e,t={}){if(e.floors?.length){let i=[];for(let o of e.floors){let r=o.focalPoint??e.focalPoint,s=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,l=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,h=wt(o.objects,e.zones,r,e.eventConfigurationId,e.confidenceBasisSha256,s,l,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Ct(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,h);for(let a of h)a.floorId=o.id;for(let a of h)i.push(a)}return i}let n=wt(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&&Ct(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),fo(e,n,t)}function fo(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Et(t,vt(t,Pt(e))),t}function Ct(e,t,n,i){let o=e.filter(u=>u.type==="section"),r=n>0||o.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!o.length||!r||!t){for(let u of i)u.eyeHeightM=n+J;return}let s=new Array(i.length),l=new Map;for(let u of o)l.has(u.id)||l.set(u.id,u);let h=new Map,a=new Map;for(let u=0;u<i.length;u++){let m=i[u],p=(m.sectionId?l.get(m.sectionId)??o.find(g=>g.logicalSectionId===m.sectionId&&re({x:m.x,y:m.y},g.outline,g.holes)):void 0)??o.find(g=>re({x:m.x,y:m.y},g.outline,g.holes))??null;if(s[u]=p,!p)continue;h.has(p.id)||h.set(p.id,dt(p,{floorBaseHeightM:n}));let f=a.get(p.id);f?f.push(u):a.set(p.id,[u])}let c=new Array(i.length).fill(void 0);for(let[u,m]of a){let d=h.get(u);if(!d)continue;let p=d.rake>0?Math.tan(d.rake*Math.PI/180):0,f=pt(u,i,m,t);for(let g of f.rows){let v=g.blockDepth*Q*p,E=d.height+v;for(let w of g.seatIndices)c[w]=E}}for(let u=0;u<i.length;u++){let m=i[u],d=s[u];if(!d){m.eyeHeightM=n+J;continue}let p=h.get(d.id);m.eyeHeightM=(c[u]??p.height)+J}}var ue=40;function or(e,t){let n=t?.freeText==="exclude",i=1/0,o=1/0,r=-1/0,s=-1/0,l=(a,c)=>{a<i&&(i=a),c<o&&(o=c),a>r&&(r=a),c>s&&(s=c)},h=a=>{if(Array.isArray(a))for(let c of a)!c||typeof c!="object"||l(c.x,c.y)};for(let a of lo(e))if(a.type==="row"){let c=new Map((a.overrides??[]).map(u=>[u.index,u]));he(a).forEach((u,m)=>{let d=c.get(m);d?.skip||l(u.x+(d?.dx??0),u.y+(d?.dy??0))})}else if(a.type==="gaArea")h(a.points);else if(a.type==="section")h(a.outline);else if(a.type==="decorImage")l(a.x,a.y),l(a.x+a.width,a.y+a.height);else if(a.type==="shape")a.points&&a.points.length?h(ie(a)):a.x!=null&&a.y!=null&&a.width!=null&&a.height!=null&&(l(a.x,a.y),l(a.x+a.width,a.y+a.height));else if(a.type==="table"){let c=ee+Zn,u=a.shape==="round"?(a.radius??40)+c:Math.max((a.width??80)/2,(a.height??50)/2)+c;l(a.center.x-u,a.center.y-u),l(a.center.x+u,a.center.y+u)}else if(a.type==="booth"){let c=Math.max(a.width,a.height)/2;l(a.center.x-c,a.center.y-c),l(a.center.x+c,a.center.y+c)}else if(a.type==="text"){if(n)continue;let c=Be(a);l(a.position.x,a.position.y),l(a.position.x+c.width,a.position.y+c.height)}for(let a of[e.referenceImage,e.backgroundImage]){if(!a)continue;let{center:c,width:u}=a;if(!c||!Number.isFinite(c.x)||!Number.isFinite(c.y)||!Number.isFinite(u))continue;let m=u*3/4;l(c.x-u/2,c.y-m/2),l(c.x+u/2,c.y+m/2)}if(!isFinite(i)){let a=e.focalPoint??{x:0,y:0};return{x:a.x-200,y:a.y-200,width:400,height:400}}return{x:i-ue,y:o-ue,width:r-i+ue*2,height:s-o+ue*2}}export{ho as a,Nt as b,De as c,Lt as d,po as e,jt as f,yo as g,te as h,pe as i,xo as j,So as k,Mo as l,Po as m,vo as n,Eo as o,Io as p,Co as q,_o as r,Oo as s,ko as t,Ro as u,To as v,Ao as w,No as x,Lo as y,Be as z,Fo as A,Do as B,Yt as C,Vo as D,ge as E,Go as F,qe as G,Xo as H,Ko as I,Wt as J,et as K,Yo as L,nt as M,qt as N,Wo as O,Jo as P,st as Q,at as R,ct as S,en as T,Zo as U,tn as V,on as W,ei as X,sn as Y,Me as Z,ti as _,ui as $,mi as aa,kn as ba,ie as ca,pi as da,yi as ea,bi as fa,oi as ga,ii as ha,ri as ia,lt as ja,Q as ka,Ee as la,un as ma,ai as na,dn as oa,ut as pa,Pe as qa,fn as ra,hn as sa,mn as ta,J as ua,dt as va,ht as wa,gn as xa,pt as ya,Si as za,An as Aa,Mi as Ba,Pi as Ca,vi as Da,Ln as Ea,Ei as Fa,Dn as Ga,Ii as Ha,wi as Ia,ke as Ja,ee as Ka,he as La,Qi as Ma,eo as Na,to as Oa,no as Pa,_t as Qa,Ji as Ra,oo as Sa,io as Ta,Z as Ua,we as Va,X as Wa,re as Xa,Zi as Ya,Ot as Za,so as _a,Oe as $a,er as ab,lo as bb,uo as cb,tr as db,nr as eb,or as fb};
1
+ import{h as Ne,j as me,n as Le,p as je}from"./chunk-S3VH7IDA.js";import{c as Fe}from"./chunk-CRCGO52K.js";var mo=2e6,Tt=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,At=/[\s"'<>`\\]/;function Nt(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Tt.test(e);if(At.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function De(e){let t=e.trim();return Nt(t)?t:null}var Lt=2e5,yo=1e5,jt="large_venue_inventory";function bo(e){return e?.includes(jt)?2e5:1e5}var te="seatlayer.event-configuration/1",pe="seatlayer.event-configuration-export/1",G=100,Ft=120,Dt=2e5,Vt=1e4,He=/^[a-f0-9]{64}$/,Ht=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function z(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function H(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Ue(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Ve(e){return!Array.isArray(e)||e.length>Dt||!e.every(t=>H(t,G))?null:[...new Set(e)].sort()}function Ge(e){return!z(e)||!H(e.chartId,G)||!H(e.version,G)||e.sha256!==void 0&&(typeof e.sha256!="string"||!He.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function ye(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Ut(e){return z(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&ye(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Gt(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Vt)return null;let n=new Set(t),i=new Set,o=new Set,r=0,s=[];for(let l of e){if(!z(l)||!H(l.id,G)||!H(l.objectId,G)||!n.has(l.objectId)||!Ht.has(String(l.kind))||!ye(l.heightM,.05,50)||l.baseElevationM!==void 0&&!ye(l.baseElevationM,-10,100))return null;let h=Ut(l.occlusion);if(!h||i.has(l.id)||o.has(l.objectId))return null;let a=l.contentImageUrl===void 0?void 0:typeof l.contentImageUrl=="string"?De(l.contentImageUrl):null;if(l.contentImageUrl!==void 0&&(!a||l.kind!=="screen"||++r>1))return null;i.add(l.id),o.add(l.objectId),s.push({id:l.id,objectId:l.objectId,kind:l.kind,heightM:l.heightM,...l.baseElevationM!==void 0?{baseElevationM:l.baseElevationM}:{},occlusion:h,...a?{contentImageUrl:a}:{}})}return s.sort((l,h)=>l.id.localeCompare(h.id))}function Xe(e){let t=[];if(!z(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==te&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${te}`}),H(e.id,G)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),H(e.label,Ft)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Ue(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Ge(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let i=z(e.overlay)?e.overlay:null,o=Ve(i?.objectIds),r=Ve(i?.productionKillSeatIds),s=o?Gt(i?.productionElements,o):null;return(!i||!o||!r)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!r||s===null?{issues:t}:{issues:t,value:{schema:te,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:r,...s!==void 0?{productionElements:s}:{}}}}}function So(e){let t=Xe(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Mo(e){if(!z(e))return{ok:!1,issues:[{code:"invalid_export",path:"",message:"Export must be an object"}]};let t=[];e.schema!==pe&&t.push({code:"unsupported_schema",path:"schema",message:`Export schema must be ${pe}`}),(typeof e.contentSha256!="string"||!He.test(e.contentSha256))&&t.push({code:"invalid_checksum",path:"contentSha256",message:"Export checksum must be a lowercase SHA-256 digest"});let n=Xe(e.configuration);return t.push(...n.issues),t.length||!n.value||typeof e.contentSha256!="string"?{ok:!1,issues:t}:{ok:!0,value:{schema:pe,configuration:n.value,contentSha256:e.contentSha256}}}function Po(e){return JSON.stringify({schema:te,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((t,n)=>t.id.localeCompare(n.id)).map(t=>({id:t.id,objectId:t.objectId,kind:t.kind,heightM:t.heightM,...t.baseElevationM!==void 0?{baseElevationM:t.baseElevationM}:{},occlusion:t.occlusion,...t.contentImageUrl?{contentImageUrl:t.contentImageUrl}:{}}))}:{}}})}function vo(e,t){let n=[];e.baseVenue.chartId!==t.chartId&&n.push({code:"base_venue_mismatch",message:"Configuration belongs to a different base venue"}),e.baseVenue.version!==t.version&&n.push({code:"base_venue_version_mismatch",message:"Configuration was authored against a different venue version"}),e.baseVenue.sha256&&!t.sha256?n.push({code:"base_venue_checksum_missing",message:"Venue checksum is required for this configuration"}):e.baseVenue.sha256&&e.baseVenue.sha256!==t.sha256&&n.push({code:"base_venue_checksum_mismatch",message:"Venue bytes do not match the configuration base"});let i=new Set(t.objectIds);for(let r of e.overlay.objectIds)i.has(r)||n.push({code:"overlay_object_missing",message:`Production object ${r} is missing from the base venue`,targetId:r});if(t.objectTypes)for(let r of e.overlay.productionElements??[])t.objectTypes.get(r.objectId)!=="shape"&&n.push({code:"production_element_not_shape",message:`Production element ${r.id} must reference base-venue shape geometry`,targetId:r.objectId});let o=new Set(t.seatIds);for(let r of e.overlay.productionKillSeatIds)o.has(r)||n.push({code:"production_kill_seat_missing",message:`Production-kill seat ${r} is missing from the base venue`,targetId:r});return{compatible:n.length===0,issues:n}}var Xt={draft:new Set(["review","archived"]),review:new Set(["draft","approved","archived"]),approved:new Set(["published","archived"]),published:new Set(["archived"]),archived:new Set};function Eo(e,t){return e===t||Xt[e].has(t)}function Io(e,t,n){return!Ue(n)||n>=t.version?null:e.find(i=>i.id===t.id&&i.version===n&&i.status==="published")??null}function Kt(e){return e.floors?.length?e.floors.flatMap(t=>t.objects):e.objects}function be(e,t,n){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let i of e)be(i,t,n);return}for(let[i,o]of Object.entries(e)){if(i==="eventConfigurationId"){H(o,G)?t.add(o):o!==void 0&&n.add(String(o));continue}if(i==="eventConfigurationIds"){if(!Array.isArray(o))n.add(String(o));else for(let r of o)H(r,G)?t.add(r):n.add(String(r));continue}be(o,t,n)}}}function wo(e,t){let n=Ge(t);if(!n)return{ok:!1,invalidIds:["baseVenue"]};let i=new Set,o=new Set;if(be(e,i,o),o.size)return{ok:!1,invalidIds:[...o].sort()};let r=Kt(e);return{ok:!0,configurations:[...i].sort().map(s=>({schema:te,id:s,label:s,version:1,baseVenue:n,overlay:{objectIds:r.filter(l=>l.type==="shape"&&l.eventConfigurationIds?.includes(s)).map(l=>l.id).sort(),productionKillSeatIds:[]}}))}}var _o=40,Oo=1200,ko=.8,Ro=3,To=-2,Ao=20,No=.1,Lo=40,jo=40,Ke=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function Bt(e,t){let n=e.text.split(/\r?\n/);if(!e.width)return Math.max(1,n.length);let i=Math.max(1,Math.floor(t/Ke(e))),o=0;for(let r of n){if(!r.length){o+=1;continue}let s=0;for(let l of r.split(/\s+/)){let h=l.length;s&&s+1+h<=i?s+=1+h:(o+=Math.max(1,Math.ceil(h/i)),s=h%i)}}return Math.max(1,o)}function Be(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),i=Math.max(1,...n.map(l=>l.length))*Ke(e),o=e.width??i+t*2,r=Math.max(1,o-t*2),s=Bt(e,r);return{width:o,height:s*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:s,padding:t}}var Ye=Math.PI/180;function R(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function ze(e,t,n){let i=Math.cos(n),o=Math.sin(n),r=e.x-t.x,s=e.y-t.y;return{x:t.x+r*i-s*o,y:t.y+r*o+s*i}}function Do(e,t,n){return n?ze(e,t,n*Ye):e}function Vo(e,t){return ze(e,{x:0,y:0},t*Ye)}function j(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Yt(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let i=e.length||1;return{x:t/i,y:n/i}}function Ho(e){return e.length?Yt(e):null}function ge(e,t){let n=1-t,i=n*n*n,o=3*n*n*t,r=3*n*t*t,s=t*t*t;return{x:i*e.start.x+o*e.control1.x+r*e.control2.x+s*e.end.x,y:i*e.start.y+o*e.control1.y+r*e.control2.y+s*e.end.y}}function Xo(e,t,n){let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},o={x:(n.x-i.x)*4/3,y:(n.y-i.y)*4/3};return{start:{...e},control1:{x:e.x+(t.x-e.x)/3+o.x,y:e.y+(t.y-e.y)/3+o.y},control2:{x:e.x+(t.x-e.x)*2/3+o.x,y:e.y+(t.y-e.y)*2/3+o.y},end:{...t}}}function qe(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[ge(e,.5)];let i=Array.from({length:n+1},(h,a)=>ge(e,a/n)),o=new Float64Array(i.length);for(let h=1;h<i.length;h+=1){let a=i[h].x-i[h-1].x,c=i[h].y-i[h-1].y;o[h]=o[h-1]+Math.hypot(a,c)}let r=o[o.length-1];if(r<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],l=1;for(let h=0;h<t;h+=1){let a=r*h/(t-1);for(;l<o.length-1&&o[l]<a;)l+=1;let c=o[l-1],u=o[l],m=u===c?0:(a-c)/(u-c);s.push({x:i[l-1].x+(i[l].x-i[l-1].x)*m,y:i[l-1].y+(i[l].y-i[l-1].y)*m})}return s}function F(e,t){return{x:e.x+t.x,y:e.y+t.y}}function ne(e,t){return{x:e.x-t.x,y:e.y-t.y}}function D(e,t){return{x:e.x*t,y:e.y*t}}function ae(e,t=13){return Array.from({length:t},(n,i)=>ge(e,i/(t-1)))}function We(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),i=Math.min(e.length-2,Math.floor(n));return j(e[i],e[i+1],n-i)}function $e(e,t,n){let i=Math.max(0,Math.min(1,t)),o=Math.max(i,Math.min(1,n)),r=[We(e,i)];for(let s=1;s<e.length-1;s+=1){let l=s/(e.length-1);l>i+1e-9&&l<o-1e-9&&r.push(e[s])}return r.push(We(e,o)),r}function Qe(e,t){let n=[[0,1],[1,2],[2,3],[3,0]],i=0,o=Number.POSITIVE_INFINITY;n.forEach(([m,d],p)=>{let f=R(j(e[m],e[d],.5),t);f<o&&(o=f,i=p)});let r=e[i],s=e[(i+1)%4],l=e[(i+2)%4],h=e[(i+3)%4],a=j(r,s,.5),c=ne(t,a),u=Math.max(1e-9,Math.hypot(c.x,c.y));return{p0:r,p1:s,p2:l,p3:h,normal:D(c,1/u),depth:(R(r,h)+R(s,l))/2}}function Je(e){let{p0:t,p1:n,p2:i,p3:o,normal:r,depth:s}=e,l=ne(n,t),h=ne(i,o),a=s*.22,c=s*.12;return{nearPath:{start:t,control1:F(F(t,D(l,1/3)),D(r,a)),control2:F(F(t,D(l,2/3)),D(r,a)),end:n},farPath:{start:i,control1:F(F(o,D(h,2/3)),D(r,c)),control2:F(F(o,D(h,1/3)),D(r,c)),end:o}}}function Ko(e,t,n){if(e.length!==4)throw new Error("A section shell requires four mapped bounds corners");let i=e.reduce((p,f)=>F(p,f),{x:0,y:0});i.x/=4,i.y/=4;let o=R(e[0],e[1]),r=R(e[0],e[3]),s=n==="auto"?o>r*1.25&&R(i,t)>r?"bezier":"tapered":n;if(s==="rectangle")return{mode:s,outline:e.map(p=>({...p}))};let l=Qe(e,t),{p0:h,p1:a,p2:c,p3:u}=l;if(s==="tapered")return{mode:s,outline:[F(h,D(ne(a,h),.14)),F(h,D(ne(a,h),1-.14)),c,u]};let{nearPath:m,farPath:d}=Je(l);return{mode:s,outline:[...ae(m),...ae(d).slice(1)]}}function Bo(e,t,n,i){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 o=Qe(e,t),{p0:r,p1:s,p2:l,p3:h}=o,a=i==="bezier"?Je(o):null,c=a?ae(a.nearPath):null,u=a?ae(a.farPath).reverse():null,m=Math.min(.055,.18/(n+1));return Array.from({length:n},(d,p)=>{let f=(p+1)/(n+1),g=f-m/2,v=f+m/2;return c&&u?[...$e(c,g,v),...$e(u,g,v).reverse()]:[j(r,s,g),j(r,s,v),j(h,l,v),j(h,l,g)]})}function zt(e,t,n){let i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,s=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return Math.hypot(e.x-(t.x+s*i),e.y-(t.y+s*o))}function Wt(e,t){let n=1/0;for(let i of t)if(!(i.length<2))for(let o=0,r=i.length-1;o<i.length;r=o++){let s=zt(e,i[r],i[o]);s<n&&(n=s)}return n}function Ze(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,h=t[o].y;s>e.y!=h>e.y&&e.x<(l-r)*(e.y-s)/(h-s)+r&&(n=!n)}return n}function tt(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function $t(e,t,n){let i=Ze(e,t)&&!n.some(r=>Ze(e,r)),o=Wt(e,[t,...n]);return i?o:-o}function W(e,t,n,i,o){let r=$t({x:e,y:t},i,o);return{x:e,y:t,h:n,d:r,max:r+n*Math.SQRT2}}var xe=class{constructor(){this.items=[]}get size(){return this.items.length}push(t){let n=this.items;n.push(t);let i=n.length-1;for(;i>0;){let o=i-1>>1;if(n[o].max>=n[i].max)break;[n[o],n[i]]=[n[i],n[o]],i=o}}pop(){let t=this.items,n=t[0],i=t.pop();if(t.length&&i){t[0]=i;let o=0;for(;;){let r=o*2+1,s=r+1,l=o;if(r<t.length&&t[r].max>t[l].max&&(l=r),s<t.length&&t[s].max>t[l].max&&(l=s),l===o)break;[t[l],t[o]]=[t[o],t[l]],o=l}}return n}};function et(e){if(e.length<3)return 0;let t=0;for(let n=0,i=e.length-1;n<e.length;i=n++)t+=(e[i].x+e[n].x)*(e[i].y-e[n].y);return Math.abs(t)/2}function zo(e,t){return Math.max(0,et(e)-tt(t).reduce((n,i)=>n+et(i),0))}function nt(e,t){let n=tt(t);if(!e.length)return{point:{x:0,y:0},radius:0};if(e.length<3){let f=e.reduce((v,E)=>v+E.x,0)/e.length,g=e.reduce((v,E)=>v+E.y,0)/e.length;return{point:{x:f,y:g},radius:0}}let i=1/0,o=1/0,r=-1/0,s=-1/0;for(let f of e)f.x<i&&(i=f.x),f.y<o&&(o=f.y),f.x>r&&(r=f.x),f.y>s&&(s=f.y);let l=r-i,h=s-o,a=Math.min(l,h);if(!(a>0))return{point:{x:(i+r)/2,y:(o+s)/2},radius:0};let c=Math.max(l,h)/150,u=new xe,m=a/2;for(let f=i;f<r;f+=a)for(let g=o;g<s;g+=a)u.push(W(f+m,g+m,m,e,n));let d=W(i+l/2,o+h/2,0,e,n),p=0;for(;u.size;){let f=u.pop();if(!f)break;f.d>d.d&&(d=f),!(f.max-d.d<=c)&&(p>=4e3||(p+=1,m=f.h/2,u.push(W(f.x-m,f.y-m,m,e,n)),u.push(W(f.x+m,f.y-m,m,e,n)),u.push(W(f.x-m,f.y+m,m,e,n)),u.push(W(f.x+m,f.y+m,m,e,n))))}return{point:{x:d.x,y:d.y},radius:Math.max(0,d.d)}}function qt(e,t,n){return Math.max(t,Math.min(n,e))}function $o(e,t,n){return e<t?t:e>n?n:e}function Qt(e){return qt(e,0,1)}function ot(e){let t=Qt(e);return t*t*(3-2*t)}var $=Math.PI*2;function q(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Jt(e,t,n){let i=t-e;if(n){for(;i<0;)i+=$;for(;i>=$;)i-=$}else{for(;i>0;)i-=$;for(;i<=-$;)i+=$}return i}function Zo(e){return e.end}function st(e){if(e.version!==1||e.closed!==!0||!q(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||!q(n.end))return!1;if(n.kind==="line"){if(R(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!q(n.control1)||!q(n.control2)||R(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!q(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(R(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(R(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||R(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return R(t,e.start)<=1e-4}function Zt(e,t,n){let i=1-n;return{x:i**3*e.x+3*i**2*n*t.control1.x+3*i*n**2*t.control2.x+n**3*t.end.x,y:i**3*e.y+3*i**2*n*t.control1.y+3*i*n**2*t.control2.y+n**3*t.end.y}}function at(e,t=2){if(!st(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),i=[{...e.start}],o=e.start;for(let r of e.segments){if(r.kind==="line")i.push({...r.end});else if(r.kind==="arc"){let s=Math.atan2(o.y-r.center.y,o.x-r.center.x),l=Math.atan2(r.end.y-r.center.y,r.end.x-r.center.x),h=Jt(s,l,r.clockwise),a=Math.max(2,Math.ceil(Math.abs(h)*r.radius/n));for(let c=1;c<=a;c+=1){let u=s+h*c/a;i.push({x:r.center.x+Math.cos(u)*r.radius,y:r.center.y+Math.sin(u)*r.radius})}}else{let s=R(o,r.control1)+R(r.control1,r.control2)+R(r.control2,r.end),l=Math.max(2,Math.ceil(s/n));for(let h=1;h<=l;h+=1)i.push(Zt(o,r,h/l))}o=r.end}return R(i[i.length-1],i[0])<=1e-4&&i.pop(),i}function ct(e,t,n){return en(e,o=>({x:o.x+t,y:o.y+n}))}function en(e,t,n=1,i=!1){return{...e,start:t(e.start),segments:e.segments.map(o=>o.kind==="line"?{...o,end:t(o.end)}:o.kind==="arc"?{...o,center:t(o.center),radius:o.radius*Math.abs(n),clockwise:i?!o.clockwise:o.clockwise,end:t(o.end)}:{...o,control1:t(o.control1),control2:t(o.control2),end:t(o.end)})}}function ei(e){return e.map(t=>t===0?0:-t)}var tn=45,Se=150,nn=60;function on(e){let t=tn/100;if(e<=t)return Se;let n=Math.min(1,(e-t)/(1-t));return Se-n*(Se-nn)}var it=.5523;function rt(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function rn(e){let t=[],n=[];for(e.forEach((i,o)=>{q(i)&&(t.length&&rt(t[t.length-1],i)||(t.push({x:i.x,y:i.y}),n.push(o)))});t.length>1&&rt(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}function ti(e,t,n){return Me(e,{cornerSmoothing:t,...n})}var sn=.5,an=4/3;function cn(e,t,n){let i=t.x-e.x,o=t.y-e.y,r=Math.hypot(i,o);if(r<=1e-9)return{kind:"line",end:{...t}};let s=-o/r,l=i/r,h=n*an;return{kind:"bezier",control1:{x:e.x+i/3+s*h,y:e.y+o/3+l*h},control2:{x:e.x+i*2/3+s*h,y:e.y+o*2/3+l*h},end:{...t}}}function Me(e,t){let{points:n,sourceIndex:i}=rn(e),o=n.length;if(o<3)return null;let r=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,l=new Array(o).fill(0);if(s?.length)for(let x=0;x<o;x+=1){let S=s[i[x]];l[x]=Number.isFinite(S)?Math.min(100,Math.max(-100,S))/100:0}let h=l.some(x=>Math.abs(x)>1e-6);if(r<=0&&!h)return null;let a=t.wideAngleThresholdDeg??on(r),c=[];for(let x=0;x<o;x+=1)c[x]=R(n[x],n[(x+1)%o]);let u=new Array(o).fill(0);for(let x=0;x<o;x+=1){let S=n[(x-1+o)%o],y=n[x],b=n[(x+1)%o],P={x:S.x-y.x,y:S.y-y.y},M={x:b.x-y.x,y:b.y-y.y},_=Math.hypot(P.x,P.y),T=Math.hypot(M.x,M.y);if(_<=1e-9||T<=1e-9)continue;let I=Math.min(1,Math.max(-1,(P.x*M.x+P.y*M.y)/(_*T))),C=Math.acos(I)*180/Math.PI;if(C<a)continue;let O=ot((C-a)/(180-a));u[x]=r*O*.5*Math.min(_,T)}for(let x=0;x<o;x+=1){let S=(x+1)%o,y=u[x]+u[S];if(y>c[x]&&y>1e-9){let b=c[x]/y;u[x]*=b,u[S]*=b}}let m=new Array(o),d=new Array(o);for(let x=0;x<o;x+=1){let S=n[(x-1+o)%o],y=n[x],b=n[(x+1)%o];if(u[x]<=1e-6){m[x]={...y},d[x]={...y};continue}let P=R(y,S)||1,M=R(y,b)||1;m[x]={x:y.x+(S.x-y.x)/P*u[x],y:y.y+(S.y-y.y)/P*u[x]},d[x]={x:y.x+(b.x-y.x)/M*u[x],y:y.y+(b.y-y.y)/M*u[x]}}if(u.every(x=>x<=1e-6)&&!h)return null;let p=[],f={...d[0]},g=f,v=(x,S)=>{if(R(g,x)<=1e-9)return;let y=l[S];Math.abs(y)>1e-6?p.push(cn(g,x,y*sn*c[S])):p.push({kind:"line",end:{...x}}),g=x};for(let x=1;x<=o;x+=1){let S=x%o,y=n[S];v(m[S],(x-1)%o),u[S]>1e-6&&R(m[S],d[S])>1e-9&&(p.push({kind:"bezier",control1:j(m[S],y,it),control2:j(d[S],y,it),end:{...d[S]}}),g=d[S])}if(!p.length)return null;let E=p[p.length-1];R(E.end,f)>1e-9&&(E.kind==="line"?E.end={...f}:p.push({kind:"line",end:{...f}}));let w={version:1,closed:!0,start:f,segments:p};return st(w)?w:null}function ni(e){let t=[],n=e.start;for(let o of e.segments)t.push(n),n=o.end;let i=[];for(let o=e.segments.length-1;o>=0;o-=1){let r=e.segments[o],s=t[o];r.kind==="line"?i.push({kind:"line",end:{...s}}):r.kind==="arc"?i.push({kind:"arc",center:{...r.center},radius:r.radius,clockwise:!r.clockwise,end:{...s}}):i.push({kind:"bezier",control1:{...r.control2},control2:{...r.control1},end:{...s}})}return{version:1,closed:!0,start:{...e.start},segments:i}}function ii(e,t,n){let i=[];for(let o=0;o<e.length-1;o+=1){let r=e[o],s=e[o+1],l=Math.hypot(s.x-r.x,s.y-r.y);if(l<=0)continue;let h=Math.max(1,Math.round(l/n)),a=l/h,c=Math.atan2(s.y-r.y,s.x-r.x),u=o===0,d=(o>0?t[o-1]:void 0)==="break"?2:1,p=u?{...r}:{x:r.x+Math.cos(c)*a*d,y:r.y+Math.sin(c)*a*d},f=u?h+1:Math.max(1,h-(d-1));i.push({origin:p,rotation:c*180/Math.PI,seatCount:f,seatSpacing:a})}return i}function ri(e){let t=e.rotation*Math.PI/180,n={x:Math.cos(t),y:Math.sin(t)};return Array.from({length:e.seatCount},(i,o)=>({x:e.origin.x+n.x*o*e.seatSpacing,y:e.origin.y+n.y*o*e.seatSpacing}))}function si(e){return e.reduce((t,n)=>t+n.seatCount,0)}function lt(e){let t=new Map,n=new Map;for(let i of e){if(i.type!=="row"||!i.segmentedRow)continue;let o=n.get(i.segmentedRow.groupId)??[];o.push(i),n.set(i.segmentedRow.groupId,o)}for(let[i,o]of n){let r=o.slice().sort((m,d)=>m.segmentedRow.componentIndex-d.segmentedRow.componentIndex),s=r[0]?.segmentedRow?.componentCount??0,l=r[0]?.segmentedRow;if(!l||!(s>=2&&r.length===s&&l?.boundaryBefore==="start"&&r.every((m,d)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===i&&m.segmentedRow.componentCount===s&&m.segmentedRow.componentIndex===d&&m.segmentedRow.repeatLabelOnComponents===l.repeatLabelOnComponents&&(d===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===l.displayLabel)))continue;let a=r.reduce((m,d)=>m+d.seatCount,0),c=0,u=0;for(let m of r)m.segmentedRow.boundaryBefore==="break"&&(c+=1),t.set(m.id,{groupId:i,adjacencyOffset:c,displayOffset:u,displayLabel:l.displayLabel,totalSeats:a,canonical:r[0],viewFromSeatUrl:l.viewFromSeatUrl,viewFromSeatMeta:l.viewFromSeatMeta,confidenceEvidence:l.confidenceEvidence}),c+=m.seatCount,u+=m.seatCount}return t}var Q=.02291666666666667,Ee=1/Q,ln=58,un=ln*Q,ci=0,dn=3,ut=0,Pe=120,fn=0,hn=45,mn=7,J=1.2;function ve(e,t,n,i){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):i}function pn(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=mn?e:dn}function dt(e,t={}){let n=ve(t.floorBaseHeightM,ut,Pe,0),i=Math.min(Pe,n+pn(e.elevation)*un),o=e.height===void 0?i:ve(e.height,ut,Pe,i),r=ve(e.rake,fn,hn,0);return{height:o,rake:r}}function ft(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 ht(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 i=1/0;for(let o=0;o+1<e.length;o++){let r=e[o],s=e[o+1],l=s.x-r.x,h=s.y-r.y,a=l*l+h*h,c=a>1e-12?((t-r.x)*l+(n-r.y)*h)/a:0;c<0?c=0:c>1&&(c=1);let u=t-(r.x+c*l),m=n-(r.y+c*h);if(Math.abs(u)>=i||Math.abs(m)>=i)continue;let d=Math.hypot(u,m);d<i&&(i=d)}return i}function yn(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let i=e.length||1;t/=i,n/=i;let o=0;for(let r of e){let s=Math.hypot(r.x-t,r.y-n);s>o&&(o=s)}return{cx:t,cy:n,r:o}}function mt(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Ie(e,t){let n=1/0;for(let i of ft(e)){let o=ht(t,i.x,i.y);o<n&&(n=o)}for(let i of ft(t)){let o=ht(e,i.x,i.y);o<n&&(n=o)}return n}function bn(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,i=0;for(let c of e)n+=c.x,i+=c.y;n/=e.length,i/=e.length;let o=-1,r=e[0];for(let c of e){let u=Math.hypot(c.x-n,c.y-i);u>o&&(o=u,r=c)}let s=r.x-n,l=r.y-i,h=Math.hypot(s,l);h>1e-9?(s/=h,l/=h):(s=1,l=0);let a=e.map((c,u)=>({p:c,i:u,t:(c.x-n)*s+(c.y-i)*l})).sort((c,u)=>c.t-u.t);return{pts:a.map(c=>c.p),seatIndices:a.map(c=>t[c.i])}}function gn(e){let t=e.length;if(t<3)return null;let n=0,i=0;for(let E of e)n+=E.x,i+=E.y;n/=t,i/=t;let o=0,r=0,s=0,l=0,h=0,a=0,c=0;for(let E of e){let w=E.x-n,x=E.y-i;o+=w*w,s+=x*x,r+=w*x,l+=w*w*w,h+=x*x*x,a+=w*x*x,c+=x*w*w}let u=o*s-r*r;if(Math.abs(u)<1e-9)return null;let m=(l+a)/2,d=(h+c)/2,p=(m*s-d*r)/u,f=(d*o-m*r)/u,g=p+n,v=f+i;return!Number.isFinite(g)||!Number.isFinite(v)?null:{cx:g,cy:v}}var xn=.15,Sn=.001;function Mn(e){let t=e[0],n=e[e.length-1],i=n.x-t.x,o=n.y-t.y,r=Math.hypot(i,o);if(!(r>1e-9))return 0;let s=0;for(let l of e){let h=Math.abs((l.x-t.x)*o-(l.y-t.y)*i)/r;h>s&&(s=h)}return s/r}function Pn(e){if(e.length<2)return null;let t=e.map(S=>{let y=0,b=0;for(let P of S.pts)y+=P.x,b+=P.y;return{x:y/S.pts.length,y:b/S.pts.length}}),n=0,i=0;for(let S of t)n+=S.x,i+=S.y;n/=t.length,i/=t.length;let o=0,r=0,s=0;for(let S of t){let y=S.x-n,b=S.y-i;o+=y*y,r+=y*b,s+=b*b}let l=o+s,h=o*s-r*r,a=l/2+Math.sqrt(Math.max(0,l*l/4-h)),c,u;Math.abs(r)>1e-12?(c=a-s,u=r):o>=s?(c=1,u=0):(c=0,u=1);let m=Math.hypot(c,u);if(!(m>1e-12))return null;c/=m,u/=m;let d=0,p=0,f=0;for(let S of e){if(S.pts.length<2)continue;let y=S.pts[0],b=S.pts[S.pts.length-1],P=b.x-y.x,M=b.y-y.y,_=Math.hypot(P,M);if(!(_>1e-9))continue;let T=P/_,I=M/_;d+=(T*T-I*I)*_,p+=2*T*I*_,f+=_}if(f>0&&Math.hypot(d,p)>=En*f){let S=Math.atan2(p,d)/2;c=-Math.sin(S),u=Math.cos(S)}let g=1/0,v=-1/0,E=[];for(let S of e){let y=1/0,b=-1/0;for(let P of S.pts){let M=P.x*c+P.y*u;M<y&&(y=M),M>b&&(b=M),M<g&&(g=M),M>v&&(v=M)}E.push(b-y)}let w=v-g;return w>1e-9?(E.sort((S,y)=>S-y),E[Math.min(E.length-1,Math.floor(E.length*.9))]/w<=vn?{x:c,y:u}:null):null}var vn=.35,En=.8;function pt(e,t,n,i){let o=new Map;for(let y of n){let b=t[y],P=b.rowId||`__seat-${y}`,M=o.get(P);M||(M={pts:[],idx:[]},o.set(P,M)),M.pts.push({x:b.x,y:b.y}),M.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let r=[];for(let[y,b]of o){let P=bn(b.pts,b.idx),M=0;for(let _ of P.pts)M+=Math.hypot(_.x-i.x,_.y-i.y);r.push({id:y,pts:P.pts,seatIndices:P.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:M/P.pts.length})}let s=r.map(y=>yn(y.pts)),l=r.length<=256?r.length*(r.length-1)/2:0,h=l?new Float64Array(l):null;h?.fill(Number.NaN);let a=h?new Map(r.map((y,b)=>[y,b])):null,c=(y,b)=>(y>b&&([y,b]=[b,y]),y*(2*r.length-y-1)/2+(b-y-1)),u=(y,b)=>{if(!h)return Ie(r[y].pts,r[b].pts);let P=c(y,b),M=h[P];if(!Number.isNaN(M))return M;let _=Ie(r[y].pts,r[b].pts);return h[P]=_,_},m=(y,b)=>a?u(a.get(y),a.get(b)):Ie(y.pts,b.pts),d=[];for(let y=0;y<r.length;y++){let b=1/0;for(let P=0;P<r.length;P++){if(y===P||mt(s[y],s[P])>=b)continue;let M=u(y,P);M<b&&(b=M)}Number.isFinite(b)&&d.push(b)}d.sort((y,b)=>y-b);let p=d.length?d[Math.floor(d.length/2)]:1,f=Math.max(p*1.8,1e-6),g=r.map(()=>[]);for(let y=0;y<r.length;y++)for(let b=y+1;b<r.length;b++)mt(s[y],s[b])>f||u(y,b)<=f&&(g[y].push(b),g[b].push(y));let v=0;for(let y=0;y<r.length;y++){if(r[y].blockId!==-1)continue;let b=v++,P=[y];for(r[y].blockId=b;P.length;){let M=P.pop();for(let _ of g[M])r[_].blockId===-1&&(r[_].blockId=b,P.push(_))}}let E=new Map;for(let y of r){let b=E.get(y.blockId)??[];b.push(y),E.set(y.blockId,b)}let w=[];for(let y of r){if(y.pts.length<4||Mn(y.pts)<Sn)continue;let b=gn(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||w.push({x:b.cx,y:b.cy}))}let x=w.length>=2?(()=>{let y=w.map(M=>M.x).sort((M,_)=>M-_),b=w.map(M=>M.y).sort((M,_)=>M-_),P=Math.floor(w.length/2);return{cx:y[P],cy:b[P]}})():null;if(x){let y=I=>Math.hypot(I.x-x.cx,I.y-x.cy),b=1/0,P=-1/0,M=[];for(let I of r){let C=1/0,O=-1/0;for(let N of I.pts){let A=y(N);A<C&&(C=A),A>O&&(O=A)}M.push(O-C),C<b&&(b=C),O>P&&(P=O)}let _=P-b;M.sort((I,C)=>I-C);let T=M[Math.min(M.length-1,Math.floor(M.length*.9))];if(_>1e-9&&T/_<=xn){let I=r.map(k=>{let se=0;for(let Rt of k.pts)se+=y(Rt);return{row:k,radius:se/k.pts.length}}),C=0,O=0;for(let k of I)C+=k.radius,O+=k.row.focalDistance;C/=I.length,O/=I.length;let N=0;for(let k of I)N+=(k.radius-C)*(k.row.focalDistance-O);if(N<0)for(let k of I)k.radius=-k.radius;let L=1/0;for(let k of I)k.radius<L&&(L=k.radius);I.sort((k,se)=>k.radius-se.radius);let V=-1,Y=-1/0,kt=_/Math.max(1,I.length)*.5,Ae=[];for(let k of I)k.radius-Y>kt&&(V++,Y=k.radius),k.row.ordinal=V,k.row.blockDepth=k.radius-L,Ae.push(k.row);return{sectionId:e,rows:Ae,blockCount:v}}}let S=[];for(let[,y]of E){let b=Pn(y);if(b){let P=I=>{let C=0;for(let O of I.pts)C+=O.x*b.x+O.y*b.y;return C/I.pts.length};y.sort((I,C)=>P(I)-P(C)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let M=[],_=p*.5;for(let I of y){let C=M[M.length-1];C&&Math.abs(P(I)-P(C[0]))<_?C.push(I):M.push([I])}let T=0;for(let I=0;I<M.length;I++){if(I>0){let C=1/0;for(let O of M[I-1])for(let N of M[I])C=Math.min(C,m(O,N));C=Math.min(C,Math.abs(P(M[I][0])-P(M[I-1][0]))),T+=C}for(let C of M[I])C.ordinal=I,C.blockDepth=T,S.push(C)}}else{let P=1/0;for(let M of y)M.focalDistance<P&&(P=M.focalDistance);y.sort((M,_)=>M.focalDistance-_.focalDistance);for(let M=0;M<y.length;M++)y[M].ordinal=M,y[M].blockDepth=Math.max(0,y[M].focalDistance-P),S.push(y[M])}}return{sectionId:e,rows:S,blockCount:v}}function In(e,t){return Math.abs(e.x-t.x)<=1e-7&&Math.abs(e.y-t.y)<=1e-7}function oe(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)}function ce(e,t,n){let i=oe(t,n,e);return Math.abs(i)>1e-7?!1:e.x>=Math.min(t.x,n.x)-1e-7&&e.x<=Math.max(t.x,n.x)+1e-7&&e.y>=Math.min(t.y,n.y)-1e-7&&e.y<=Math.max(t.y,n.y)+1e-7}function wn(e,t,n,i){let o=oe(e,t,n),r=oe(e,t,i),s=oe(n,i,e),l=oe(n,i,t);return(o>1e-7&&r<-1e-7||o<-1e-7&&r>1e-7)&&(s>1e-7&&l<-1e-7||s<-1e-7&&l>1e-7)?!0:Math.abs(o)<=1e-7&&ce(n,e,t)||Math.abs(r)<=1e-7&&ce(i,e,t)||Math.abs(s)<=1e-7&&ce(e,n,i)||Math.abs(l)<=1e-7&&ce(t,n,i)}function Cn(e){return e.reduce((t,n,i)=>{let o=e[(i+1)%e.length];return t+n.x*o.y-o.x*n.y},0)}function _n(e){for(let t=0;t<e.length;t+=1){let n=(t+1)%e.length;for(let i=t+1;i<e.length;i+=1){let o=(i+1)%e.length;if(!(t===i||n===i||o===t)&&wn(e[t],e[n],e[i],e[o]))return!0}}return!1}function di(e){return e.length<3?{ok:!1,code:"too_few_vertices",message:"Add at least three vertices to create a polygon."}:e.length>256?{ok:!1,code:"too_many_vertices",message:"A polygon can contain at most 256 vertices."}:e.some(t=>!Number.isFinite(t.x)||!Number.isFinite(t.y)||Math.abs(t.x)>1e7||Math.abs(t.y)>1e7)?{ok:!1,code:"invalid_coordinate",message:"Every polygon vertex must use a finite coordinate inside the safe chart range."}:e.some((t,n)=>In(t,e[(n+1)%e.length]))?{ok:!1,code:"duplicate_vertex",message:"Move or remove duplicate neighbouring vertices."}:Math.abs(Cn(e))<2?{ok:!1,code:"degenerate_polygon",message:"The polygon needs a visible enclosed area."}:_n(e)?{ok:!1,code:"self_intersection",message:"Polygon edges cannot cross or touch each other."}:{ok:!0}}var pi=64;function On(e){let t=e.points??[];if(e.kind!=="polygon"||t.length<3||!Array.isArray(e.edgeCurvature))return[];let n=t.map((i,o)=>{let r=e.edgeCurvature[o];return Number.isFinite(r)?Math.min(100,Math.max(-100,r)):0});return n.some(i=>Math.abs(i)>.5)?n:[]}function kn(e){let t=On(e);return t.length?Me(e.points,{edgeCurvature:t}):null}function ie(e,t=2){let n=kn(e);return n?at(n,t):e.points??[]}function yi(e){return e.kind==="polygon"?X(e.holes):[]}function bi(e,t){let n=ie(e);return n.length<3||t.length<3||!t.flatMap((o,r)=>{let s=t[(r+1)%t.length];return[o,{x:(o.x+s.x)/2,y:(o.y+s.y)/2}]}).every(o=>Z(o,n)||we(o,n))?!1:!t.some((o,r)=>{let s=t[(r+1)%t.length];return n.some((l,h)=>yt(o,s,l,n[(h+1)%n.length]))})}function yt(e,t,n,i){let o=(a,c,u)=>(c.x-a.x)*(u.y-a.y)-(c.y-a.y)*(u.x-a.x),r=o(e,t,n),s=o(e,t,i),l=o(n,i,e),h=o(n,i,t);return r*s<-1e-9&&l*h<-1e-9}function gi(e,t){return Z(e[0],t)||Z(t[0],e)?!0:e.some((n,i)=>{let o=e[(i+1)%e.length];return t.some((r,s)=>yt(n,o,r,t[(s+1)%t.length]))})}var Mi=[{key:"rect",label:"Flat stage",blurb:"Classic proscenium box."},{key:"rounded",label:"Rounded",blurb:"Softened corners."},{key:"arc",label:"Curved front",blurb:"Front edge bows toward the audience."},{key:"thrust",label:"Thrust (T)",blurb:"Central tongue projects into the crowd."},{key:"runway",label:"Runway",blurb:"Long catwalk into the audience."},{key:"round",label:"In the round",blurb:"Central platform, audience all around."},{key:"pitch-football",label:"Football pitch",blurb:"105 \xD7 68 m pitch with centre circle and penalty boxes."},{key:"rink-hockey",label:"Hockey rink",blurb:"60 \xD7 30 m ice rink with blue lines and faceoff circles."},{key:"track-athletics",label:"Athletics track",blurb:"400 m track: two straights, two semicircles, eight lanes."},{key:"oval-cricket",label:"Cricket oval",blurb:"~150 \xD7 140 m oval with boundary rope and pitch strip."},{key:"pitch-rugby",label:"Rugby pitch",blurb:"100 \xD7 70 m field of play with in-goal areas, 22 m and 10 m lines."},{key:"diamond-baseball",label:"Baseball field",blurb:"Diamond, infield, mound and foul lines out to 99 m poles."},{key:"court-basketball",label:"Basketball court",blurb:"28 \xD7 15 m court with keys and three-point lines."},{key:"court-tennis",label:"Tennis court",blurb:"23.77 \xD7 10.97 m doubles court with run-off and net."},{key:"ring-boxing",label:"Boxing ring",blurb:"Raised ring, 6.1 m inside the ropes, coloured corners."}],Rn=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Tn=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function An(e){return!!e&&Rn.has(e)}function Pi(e){return!!e&&Tn.has(e)}var Nn=new Set(["court-basketball","rink-hockey","ring-boxing"]);function vi(e){return!!e&&Nn.has(e)}var _e=1.1;function Ei(e){return le(e)?e==="ring-boxing"?_e:.06:1}var bt={round:{width:6,height:6},"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8}},gt={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f"};function Ii(e){let t=bt[e];return t?{width:t.width*Ee,height:t.height*Ee}:{width:300,height:70}}var Ln="#232c40",xt=Math.PI*2;function St(e,t,n,i,o,r){return{x:o+e*n-t*i,y:r+e*i+t*n}}function jn(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),h=Math.sin(s),a=o/2,c=r/2,u=[],m=(d,p)=>{u.push({x:d,y:p})};switch(t){case"rect":{m(-a,-c),m(a,-c),m(a,c),m(-a,c);break}case"rounded":{let d=Math.min(o,r)*.18,p=5,f=(g,v,E)=>{for(let w=0;w<=p;w++){let x=E+w/p*(Math.PI/2);m(g+d*Math.cos(x),v+d*Math.sin(x))}};f(a-d,-c+d,-Math.PI/2),f(a-d,c-d,0),f(-a+d,c-d,Math.PI/2),f(-a+d,-c+d,Math.PI);break}case"arc":{let d=r*.45;m(-a,-c),m(a,-c);let p=24;for(let f=0;f<=p;f++){let g=f/p,v=a-g*o,E=c+d*(1-Math.pow(2*v/o,2));m(v,E)}break}case"thrust":{let d=o*.18,p=r*1.1;m(-a,-c),m(a,-c),m(a,c),m(d,c),m(d,c+p),m(-d,c+p),m(-d,c),m(-a,c);break}case"runway":{let d=o*.1,p=r*3;m(-a,-c),m(a,-c),m(a,c),m(d,c),m(d,c+p),m(-d,c+p),m(-d,c),m(-a,c);break}case"round":case"oval-cricket":{for(let p=0;p<40;p++){let f=p/40*xt;m(a*Math.cos(f),c*Math.sin(f))}break}case"pitch-football":case"pitch-rugby":case"court-basketball":case"court-tennis":case"ring-boxing":{m(-a,-c),m(a,-c),m(a,c),m(-a,c);break}case"diamond-baseball":{for(let d of Dn(a,c))m(d.x,d.y);break}case"rink-hockey":{for(let d of Fn(a,c,a*(8.5/60),c*(8.5/30)))m(d.x,d.y);break}case"track-athletics":{for(let d of Ce(a,c))m(d.x,d.y);break}}return u.map(d=>St(d.x,d.y,l,h,n,i))}function wi(e,t="stage"){return{type:"shape",id:t,kind:"polygon",points:jn(e),fill:e.fill??gt[e.kind]??Ln,label:e.label??"STAGE",role:"stage",stageKind:e.kind}}function Fn(e,t,n,i){let o=[],s=(l,h,a)=>{for(let c=0;c<=8;c++){let u=a+c/8*(Math.PI/2);o.push({x:l+n*Math.cos(u),y:h+i*Math.sin(u)})}};return s(e-n,-t+i,-Math.PI/2),s(e-n,t-i,0),s(-e+n,t-i,Math.PI/2),s(-e+n,-t+i,Math.PI),o}function Ce(e,t){let n=Math.max(0,e-t),i=[],o=20;for(let r=0;r<=o;r++){let s=-Math.PI/2+r/o*Math.PI;i.push({x:n+t*Math.cos(s),y:t*Math.sin(s)})}for(let r=0;r<=o;r++){let s=Math.PI/2+r/o*Math.PI;i.push({x:-n+t*Math.cos(s),y:t*Math.sin(s)})}return i}var B=(()=>{let t={x:0,y:52},n=25,i={x:70,y:t.y-70},o=(i.x*i.x+i.y*i.y-4900)/(2*(i.y+70)),r=o+70,s=[],l=Math.atan2(i.y-o,i.x),h=Math.atan2(i.y-o,-i.x);for(let a=0;a<=24;a++){let c=l+(h-l)*a/24;s.push({x:r*Math.cos(c),y:o+r*Math.sin(c)})}return{half:70,home:t,backstop:n,fence:s}})();function Dn(e,t){let n=e/B.half,i=t/B.half;return[{x:-B.backstop*n,y:t},{x:B.backstop*n,y:t},...B.fence.map(o=>({x:o.x*n,y:o.y*i}))]}var Vn="#f1f5f9";function Ci(e){switch(e){case"pitch-football":return"PITCH";case"rink-hockey":return"RINK";case"track-athletics":return"TRACK";case"oval-cricket":return"OVAL";case"pitch-rugby":return"PITCH";case"diamond-baseball":return"FIELD";case"court-basketball":case"court-tennis":return"COURT";case"ring-boxing":return"RING";default:return"STAGE"}}function le(e){return An(e)}function K(e,t,n,i,o=32){let r=[];for(let s=0;s<o;s++){let l=s/o*xt;r.push({x:e+n*Math.cos(l),y:t+i*Math.sin(l)})}return r}function U(e,t,n,i){return[{x:e-n,y:t-i},{x:e+n,y:t-i},{x:e+n,y:t+i},{x:e-n,y:t+i}]}function Hn(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),h=Math.sin(s),a=o/2,c=r/2,u=[],m=bt[t],d=f=>m?f/m.width*o:0,p=f=>m?f/m.height*r:0;switch(t){case"pitch-football":{u.push({points:[{x:0,y:-c},{x:0,y:c}],closed:!1}),u.push({points:K(0,0,d(9.15),p(9.15)),closed:!0});for(let f of[-1,1])u.push({points:U(f*(a-d(16.5)/2),0,d(16.5)/2,p(40.32)/2),closed:!0}),u.push({points:U(f*(a-d(5.5)/2),0,d(5.5)/2,p(18.32)/2),closed:!0});break}case"rink-hockey":{u.push({points:[{x:0,y:-c},{x:0,y:c}],closed:!1,ink:"#d63b3b"});for(let f of[-1,1]){u.push({points:[{x:f*d(7.5),y:-c},{x:f*d(7.5),y:c}],closed:!1,ink:"#2f6ecb"}),u.push({points:[{x:f*(a-d(4)),y:-p(11)},{x:f*(a-d(4)),y:p(11)}],closed:!1,ink:"#d63b3b"});for(let g of[-1,1])u.push({points:K(f*d(20.5),g*p(7),d(4.5),p(4.5)),closed:!0,ink:"#2f6ecb"})}u.push({points:K(0,0,d(4.5),p(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let g=c-p(1.22)*8;g>0&&u.push({points:Ce(a-d(1.22)*8,g),closed:!0,fill:"#2f7d4f"});for(let v=1;v<8;v++){let E=p(1.22)*v,w=c-E;if(w<=0)break;u.push({points:Ce(a-d(1.22)*v,w),closed:!0})}break}case"oval-cricket":{u.push({points:K(0,0,d(27.4),p(27.4+20.12/2),40),closed:!0}),u.push({points:U(0,0,d(3.05)/2,p(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let f=g=>({points:[{x:d(g),y:-c},{x:d(g),y:c}],closed:!1});u.push(f(0));for(let g of[-1,1]){u.push(f(g*50),f(g*28));for(let v=-35;v<35;v+=4)u.push({points:[{x:d(g*10),y:p(v)},{x:d(g*10),y:p(Math.min(35,v+2))}],closed:!1})}break}case"diamond-baseball":{let f=(A,L)=>({x:d(A),y:p(L)}),{home:g}=B,v=27.43,E=v/Math.SQRT2,w={x:g.x+E,y:g.y-E},x={x:g.x,y:g.y-2*E},S={x:g.x-E,y:g.y-E},y={x:g.x,y:g.y-18.44},b="#b98a59",P=gt["diamond-baseball"],M=38.94,_=[f(g.x,g.y)],T=Math.atan2(g.y-M/Math.SQRT2-y.y,M/Math.SQRT2),I=Math.PI-T;for(let A=0;A<=16;A++){let L=T-(T+Math.PI*2-I)%(Math.PI*2)*(A/16);_.push(f(y.x+29*Math.cos(L),y.y+29*Math.sin(L)))}u.push({points:_,closed:!0,fill:b,ink:b});let C={x:g.x,y:g.y-E},O=[{x:g.x,y:g.y},w,x,S].map(A=>f(C.x+(A.x-C.x)*.84,C.y+(A.y-C.y)*.84));u.push({points:O,closed:!0,fill:P,ink:P}),u.push({points:K(d(y.x),p(y.y),d(2.74),p(2.74),20),closed:!0,fill:b,ink:b}),u.push({points:K(d(g.x),p(g.y),d(3.96),p(3.96),20),closed:!0,fill:b,ink:b});let N=B.fence;u.push({points:[f(g.x,g.y),f(N[0].x,N[0].y)],closed:!1}),u.push({points:[f(g.x,g.y),f(N[N.length-1].x,N[N.length-1].y)],closed:!1});for(let A of[w,x,S])u.push({points:U(d(A.x),p(A.y),d(.3),p(.3)),closed:!0,fill:Vn});break}case"court-basketball":{u.push({points:U(0,0,d(14),p(7.5)),closed:!0}),u.push({points:[{x:0,y:-p(7.5)},{x:0,y:p(7.5)}],closed:!1}),u.push({points:K(0,0,d(1.8),p(1.8),24),closed:!0});for(let f of[-1,1]){let g=f*14,v=f*(14-5.8),E=f*(14-1.575);u.push({points:U(d((g+v)/2),0,d(2.9),p(2.45)),closed:!0,fill:"#2f5d8a"}),u.push({points:K(d(v),0,d(1.8),p(1.8),24),closed:!0});let w=Math.sqrt(6.75*6.75-6.6*6.6),x=[{x:d(g),y:-p(6.6)}],S=Math.atan2(-6.6,-f*w),y=2*Math.atan2(6.6,w);for(let b=0;b<=16;b++){let P=S-f*y*(b/16);x.push({x:d(E+6.75*Math.cos(P)),y:p(6.75*Math.sin(P))})}x.push({x:d(g),y:p(6.6)}),u.push({points:x,closed:!1})}break}case"court-tennis":{u.push({points:U(0,0,d(11.885),p(5.485)),closed:!0,fill:"#2b5f99"});for(let f of[-1,1])u.push({points:[{x:-d(11.885),y:f*p(4.115)},{x:d(11.885),y:f*p(4.115)}],closed:!1}),u.push({points:[{x:f*d(6.4),y:-p(4.115)},{x:f*d(6.4),y:p(4.115)}],closed:!1});u.push({points:[{x:-d(6.4),y:0},{x:d(6.4),y:0}],closed:!1}),u.push({points:[{x:0,y:-p(6.4)},{x:0,y:p(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{u.push({points:U(0,0,d(3.05),p(3.05)),closed:!0});let v=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[E,w,x]of v)u.push({points:U(E*d(3.05),w*p(3.05),d(.3),p(.3)),closed:!0,fill:x,ink:x});break}default:return[]}return u.map(f=>({...f,points:f.points.map(g=>St(g.x,g.y,l,h,n,i))}))}function _i(e){if(e.role!=="stage"||!le(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(c=>c.x),i=e.points.map(c=>c.y),o=Math.min(...n),r=Math.max(...n),s=Math.min(...i),l=Math.max(...i),h=Math.max(1,r-o),a=Math.max(1,l-s);t={cx:o+h/2,cy:s+a/2,width:h,height:a}}return t?Hn({kind:e.stageKind,...t}):[]}function Un(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?ie(e,6):e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,i=e.width,o=e.height;return[{x:t,y:n},{x:t+i,y:n},{x:t+i,y:n+o},{x:t,y:n+o}]}function Gn(e,t,n){let i=n*Math.PI/180,o=Math.cos(i),r=Math.sin(i),s=e.x-t.x,l=e.y-t.y;return{x:t.x+s*o-l*r,y:t.y+s*r+l*o}}function Mt(e){let t=Un(e);if(!t||t.length<2)return null;let n=e.rotation??0,i=Math.abs(n)<1e-6?t:t.map(h=>Gn(h,{x:t.reduce((a,c)=>a+c.x,0)/t.length,y:t.reduce((a,c)=>a+c.y,0)/t.length},n)),o=1/0,r=1/0,s=-1/0,l=-1/0;for(let h of i)o=Math.min(o,h.x),r=Math.min(r,h.y),s=Math.max(s,h.x),l=Math.max(l,h.y);return!Number.isFinite(o)||s-o<1e-6||l-r<1e-6?null:{minX:o,minY:r,maxX:s,maxY:l}}var Xn=5,Kn=3,Bn=.92,Yn=1.9,zn=2,Wn=.6,$n=1,qn=.06;function Qn(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?_e:le(e.stageKind)?qn:$n}function Pt(e){let t=1/0,n=1/0,i=-1/0,o=-1/0,r=-1/0;for(let s of Oe(e)){let l=s.baseHeightM??0;for(let h of s.objects){if(h.type!=="shape"||h.role!=="stage")continue;let a=Mt(h);a&&(t=Math.min(t,a.minX),n=Math.min(n,a.minY),i=Math.max(i,a.maxX),o=Math.max(o,a.maxY),r=Math.max(r,l+Qn(h)))}}return!Number.isFinite(t)||!Number.isFinite(r)?null:{minX:t,minY:n,maxX:i,maxY:o,deckTopM:r}}function Jn(e,t,n,i){let o=1/0,r=1/0,s=-1/0,l=-1/0;for(let d of e)Number.isFinite(d.eyeHeightM)&&(o=Math.min(o,d.x),s=Math.max(s,d.x),r=Math.min(r,d.y),l=Math.max(l,d.y));if(!Number.isFinite(o))return null;let h=o*t,a=r*t,c=Math.max(1,Math.ceil((s-o)*t/n)+1),u=Math.max(1,Math.ceil((l-r)*t/n)+1),m=new Float64Array(c*u).fill(-1/0);for(let d of e){if(!Number.isFinite(d.eyeHeightM))continue;let p=d.eyeHeightM-J,f=Math.min(c-1,Math.max(0,Math.floor((d.x*t-h)/n))),v=Math.min(u-1,Math.max(0,Math.floor((d.y*t-a)/n)))*c+f,E=p+i;E>m[v]&&(m[v]=E)}return{cellM:n,minX:h,minY:a,cols:c,rows:u,top:m}}function Zn(e,t,n){let i=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return i<0||o<0||i>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+i]}function vt(e,t,n={}){let i=new Map;if(!t||!e.length)return i;let o=n.metresPerChartUnit??Q,r=n.cellM??Wn,s=n.chairBackM??Bn,l=n.selfRowSkipM??zn,h=n.clearThreshold??.9,a=n.partialThreshold??.25,c=Math.max(1,n.columns??Xn),u=Math.max(1,n.rows??Kn),m=Jn(e,o,r,s);if(!m)return i;let d=(t.maxX-t.minX)*o,p=(t.maxY-t.minY)*o,f=d>=p,g=(t.minX+t.maxX)/2*o,v=(t.minY+t.maxY)/2*o,E=[];for(let x=0;x<c;x++){let S=(x+.5)/c-.5,y=f?g+S*d:g,b=f?v:v+S*p;for(let P=0;P<u;P++){let M=t.deckTopM+(u===1?0:P/(u-1)*Yn);E.push({x:y,y:b,z:M})}}let w=r/2;for(let x of e){if(!Number.isFinite(x.eyeHeightM))continue;let S=x.x*o,y=x.y*o,b=x.eyeHeightM,P=0,M=1/0;for(let T of E){let I=T.x-S,C=T.y-y,O=Math.hypot(I,C);if(!(O>l)){P++;continue}let N=I/O,A=C/O,L=0;for(let V=l;V<O;V+=w){let Y=Zn(m,S+N*V,y+A*V);if(!(!Number.isFinite(Y)||Y>=b)&&Y>b+(T.z-b)*V/O){L=V;break}}L?M=Math.min(M,L):P++}let _=P/E.length;_>=h||i.set(x.id,{seatId:x.id,mark:_<a?"obstructedView":"restrictedView",visibleFraction:_,totalRays:E.length,atDistanceM:Number.isFinite(M)?M:0})}return i}function Et(e,t){if(!t.size)return 0;let n=0;for(let i of e){let o=t.get(i.id);if(!o)continue;let r=i.commercial;r?.restrictedView!==void 0||r?.obstructedView!==void 0||(i.commercial={...r,[o.mark]:!0},n++)}return n}function ke(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var fe=Math.PI/180,eo=9,ee=16;function Re(e,t,n,i){let o=n*fe,r=Math.cos(o),s=Math.sin(o);return{x:i.x+e*r-t*s,y:i.y+e*s+t*r}}function he(e){let{seatCount:t,seatSpacing:n,curve:i,rotation:o,origin:r}=e,s=[];if(e.path)return qe(e.path,t);if(t<=1)return t===1&&s.push({x:r.x,y:r.y}),s;if(i===0){for(let a=0;a<t;a++)s.push(Re(a*n,0,o,r));return s}let l=i/(t-1)*fe,h=n/(2*Math.sin(Math.abs(l)/2));for(let a=0;a<t;a++){let c=a*l,u=h*Math.sin(c),m=-h+h*Math.cos(c);s.push(Re(u,m,o,r))}return s}function Te(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Zi(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 to(e,t){let n=Te(e);return he(e).map((i,o)=>{let r=n.get(o),s=ke(r),l=Ne(e,o,r),h={...e.commercial,...r?.commercial};return{index:o,x:i.x+(r?.dx??0),y:i.y+(r?.dy??0),label:l,displayLabel:me(e,o,t,r),categoryKey:r?.categoryKey??e.categoryKey,skipped:!!r?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:r?.wheelchairSpaceType,commercial:Object.values(h).some(a=>a!==void 0&&a!==!1&&a!=="")?h:void 0,glyph:r?.glyph,viewUrl:r?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:r?.viewFromSeatUrl?r.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:r?.labelStyle??e.seatLabelStyle}})}function no(e){let t=[];for(let n of to(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 oo(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(r=>t.includes(r)),i={top:0,bottom:0,left:0,right:0};if(!n.length)return i;let o=Math.max(0,Math.round(e.seatCount));for(let r=0;r<o;r++)i[n[r%n.length]]+=1;return i}function _t(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let i=new Map((e.overrides??[]).map(c=>[c.index,c])),o=(c,u,m,d)=>{let p=i.get(c),f=ke(p),g=p?.label??Le(e,c);return{index:c,label:g,displayLabel:p?.displayLabel??je(e,c),x:u+(p?.dx??0),y:m+(p?.dy??0),categoryKey:p?.categoryKey??e.categoryKey,skipped:!!p?.skip,accessible:f.length>0,accessibility:f,wheelchairSpaceType:p?.wheelchairSpaceType,commercial:p?.commercial,glyph:p?.glyph,viewUrl:p?.viewFromSeatUrl,viewMeta:p?.viewFromSeatUrl?p.viewFromSeatMeta:void 0,labelStyle:p?.labelStyle,...d?{side:d}:{}}};if(e.shape==="round"){let c=(e.radius??40)+ee,u=e.rotation*fe,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let g=0;g<n;g++){let v=u+g/n*2*Math.PI;t.push(o(g,e.center.x+c*Math.cos(v),e.center.y+c*Math.sin(v)))}return t}let d=m*fe,p=(2*Math.PI-d)/2,f=u+p;for(let g=0;g<n;g++){let v=f+g/(n-1)*d;t.push(o(g,e.center.x+c*Math.cos(v),e.center.y+c*Math.sin(v)))}return t}let r=e.width??80,s=e.height??50,l=oo(e),h=["top","bottom","left","right"],a=0;for(let c of h){let u=l[c];for(let m=0;m<u;m++){let d,p;c==="top"?(d=-r/2+(m+.5)*r/u,p=-s/2-ee):c==="bottom"?(d=-r/2+(m+.5)*r/u,p=s/2+ee):c==="left"?(d=-r/2-ee,p=-s/2+(m+.5)*s/u):(d=r/2+ee,p=-s/2+(m+.5)*s/u);let f=Re(d,p,e.rotation,e.center);t.push(o(a++,f.x,f.y,c))}}return t}function er(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):_t(e).filter(t=>!t.skipped).length}function io(e){return _t(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 ro(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth",...e.commercial?.note?{commercial:{note:e.commercial.note}}:{}}]}function Z(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,h=t[o].y;s>e.y!=h>e.y&&e.x<(l-r)*(e.y-s)/(h-s)+r&&(n=!n)}return n}function we(e,t){return t.some((n,i)=>{let o=t[(i+1)%t.length],r=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(r)>1e-7)return!1;let s=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),l=(o.x-n.x)**2+(o.y-n.y)**2;return s>=-1e-7&&s<=l+1e-7})}function X(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function re(e,t,n){return Z(e,t)&&!X(n).some(i=>Z(e,i)||we(e,i))}function tr(e,t){return nt(e,t).point}function de(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;return{x:t/e.length,y:n/e.length}}function Ot(e){switch(e.type){case"row":{let t=he(e),n=Te(e),i=0,o=0,r=0;for(let s=0;s<t.length;s++){let l=n.get(s);l?.skip||(i+=t[s].x+(l?.dx??0),o+=t[s].y+(l?.dy??0),r++)}return r?{x:i/r,y:o/r}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return de(e.points);case"section":return de(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?de(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 It(e,t){return e.length===t.length&&e.every((n,i)=>n.x===t[i].x&&n.y===t[i].y)}function so(e,t){if(e.type!=="gaArea"||!It(e.points,t.outline))return!1;let n=X(e.holes),i=X(t.holes);return n.length===i.length&&n.every((o,r)=>It(o,i[r]))}function ao(e,t,n=e.filter(o=>o.type==="section"),i=Ot(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(so(t,s)||re(i,s.outline,s.holes))):void 0)??n.find(s=>re(i,s.outline,s.holes))??(t.type==="row"&&co(t)?lo(t,n):void 0)}function co(e){return(e.overrides??[]).some(t=>t.skip===!0)}function lo(e,t){let n=he(e),i=Te(e),o,r=0;for(let s of t){let l=0;for(let h=0;h<n.length;h++){let a=i.get(h);if(a?.skip)continue;let c={x:n[h].x+(a?.dx??0),y:n[h].y+(a?.dy??0)};re(c,s.outline,s.holes)&&l++}l>r&&(o=s,r=l)}return o}function Oe(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 nr(e,t){let n=Oe(e);return(t?n.find(i=>i.id===t):n[0])?.objects??[]}function uo(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function fo(e,t,n){let i=r=>({x:r.x+t,y:r.y+n}),o=r=>r.map(i);switch(e.type){case"row":return{...e,origin:i(e.origin)};case"table":case"booth":return{...e,center:i(e.center)};case"gaArea":return{...e,points:o(e.points),...e.holes?{holes:X(e.holes).map(o)}:{}};case"section":return{...e,outline:o(e.outline),...e.outlinePath?{outlinePath:ct(e.outlinePath,t,n)}:{},...e.holes?{holes:X(e.holes).map(o)}:{}};case"text":return{...e,position:i(e.position)};case"shape":return{...e,...e.points?{points:o(e.points)}:{},...e.holes?{holes:X(e.holes).map(o)}:{},...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 or(e,t=900){if(!e.floors||e.floors.length<2)return e;let n=[];return e.floors.forEach((i,o)=>{let r=-o*t;for(let s of i.objects)n.push(r===0?s:fo(s,0,r))}),{...e,objects:n,floors:void 0}}function wt(e,t,n,i,o,r,s,l,h){let a=[],c=e.filter(f=>f.type==="section"),u=lt(e),m=f=>!f?.eventConfigurationId||f.eventConfigurationId===i&&(f.eventConfigurationVersion===void 0||f.eventConfigurationVersion===h),d=f=>Fe(f,{activeConfigurationId:i,activeConfigurationVersion:h,activeBasisSha256:o,now:l}),p=(f,g)=>d(f)?{...f,coverage:g}:void 0;for(let f of e){let g=[];if(f.type==="row"?g=no(f):f.type==="table"?g=io(f):f.type==="booth"&&(g=ro(f)),!g.length)continue;for(let S of g)S.viewUrl&&!m(S.viewMeta)&&(S.viewUrl=void 0,S.viewMeta=void 0);if(f.type==="row"){let S=u.get(f.id);if(S){let y=new Map((f.overrides??[]).map(b=>[b.index,b]));for(let b of g){let P=Number(b.id.slice(b.id.lastIndexOf(":")+1));if(!Number.isInteger(P))continue;b.logicalRowId=S.groupId,b.logicalSeatIndex=S.adjacencyOffset+P,y.get(P)?.displayLabel||(b.displayLabel=me(f,P,S)),!b.viewUrl&&S.viewFromSeatUrl&&m(S.viewFromSeatMeta)&&(b.viewUrl=S.viewFromSeatUrl,b.viewMeta=S.viewFromSeatMeta);let M=y.get(P)?.confidenceEvidence;b.confidenceEvidence=p(M,"exact-seat")??p(f.confidenceEvidence,"row-representative")??p(S.confidenceEvidence,"row-representative")}}}let v=ao(e,f,c,f.type==="row"?de(g):Ot(f)),E=v?.viewFromSeatUrl,x=(v?.zone?t?.find(S=>S.id===v.zone):void 0)?.focalPoint??n;for(let S of g){if(!S.confidenceEvidence){let y=Number(S.id.slice(S.id.lastIndexOf(":")+1)),b=(f.type==="row"||f.type==="table")&&Number.isInteger(y)?f.overrides?.find(P=>P.index===y)?.confidenceEvidence:void 0;S.confidenceEvidence=p(b,"exact-seat")??(f.type==="row"?p(f.confidenceEvidence,"row-representative"):void 0)}S.confidenceEvidence??=p(v?.confidenceEvidence,"section-representative")??(s?p(s.evidence,s.coverage):void 0),!S.viewUrl&&E&&m(v?.viewFromSeatMeta)&&(S.viewUrl=E,S.viewMeta=v?.viewFromSeatMeta),!S.viewUrl&&r&&m(r.meta)&&(S.viewUrl=r.url,S.viewMeta=r.meta),v&&(S.sectionId=v.logicalSectionId??v.id),v?.zone&&(S.zoneId=v.zone),x&&(S.focalPoint={...x})}a.push(...g)}return a}function ir(e,t={}){if(e.floors?.length){let i=[];for(let o of e.floors){let r=o.focalPoint??e.focalPoint,s=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,l=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,h=wt(o.objects,e.zones,r,e.eventConfigurationId,e.confidenceBasisSha256,s,l,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Ct(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,h);for(let a of h)a.floorId=o.id;for(let a of h)i.push(a)}return i}let n=wt(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&&Ct(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),ho(e,n,t)}function ho(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Et(t,vt(t,Pt(e))),t}function Ct(e,t,n,i){let o=e.filter(u=>u.type==="section"),r=n>0||o.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!o.length||!r||!t){for(let u of i)u.eyeHeightM=n+J;return}let s=new Array(i.length),l=new Map;for(let u of o)l.has(u.id)||l.set(u.id,u);let h=new Map,a=new Map;for(let u=0;u<i.length;u++){let m=i[u],p=(m.sectionId?l.get(m.sectionId)??o.find(g=>g.logicalSectionId===m.sectionId&&re({x:m.x,y:m.y},g.outline,g.holes)):void 0)??o.find(g=>re({x:m.x,y:m.y},g.outline,g.holes))??null;if(s[u]=p,!p)continue;h.has(p.id)||h.set(p.id,dt(p,{floorBaseHeightM:n}));let f=a.get(p.id);f?f.push(u):a.set(p.id,[u])}let c=new Array(i.length).fill(void 0);for(let[u,m]of a){let d=h.get(u);if(!d)continue;let p=d.rake>0?Math.tan(d.rake*Math.PI/180):0,f=pt(u,i,m,t);for(let g of f.rows){let v=g.blockDepth*Q*p,E=d.height+v;for(let w of g.seatIndices)c[w]=E}}for(let u=0;u<i.length;u++){let m=i[u],d=s[u];if(!d){m.eyeHeightM=n+J;continue}let p=h.get(d.id);m.eyeHeightM=(c[u]??p.height)+J}}var ue=40;function rr(e,t){let n=t?.freeText==="exclude",i=1/0,o=1/0,r=-1/0,s=-1/0,l=(a,c)=>{a<i&&(i=a),c<o&&(o=c),a>r&&(r=a),c>s&&(s=c)},h=a=>{if(Array.isArray(a))for(let c of a)!c||typeof c!="object"||l(c.x,c.y)};for(let a of uo(e))if(a.type==="row"){let c=new Map((a.overrides??[]).map(u=>[u.index,u]));he(a).forEach((u,m)=>{let d=c.get(m);d?.skip||l(u.x+(d?.dx??0),u.y+(d?.dy??0))})}else if(a.type==="gaArea")h(a.points);else if(a.type==="section")h(a.outline);else if(a.type==="decorImage")l(a.x,a.y),l(a.x+a.width,a.y+a.height);else if(a.type==="shape")a.points&&a.points.length?h(ie(a)):a.x!=null&&a.y!=null&&a.width!=null&&a.height!=null&&(l(a.x,a.y),l(a.x+a.width,a.y+a.height));else if(a.type==="table"){let c=ee+eo,u=a.shape==="round"?(a.radius??40)+c:Math.max((a.width??80)/2,(a.height??50)/2)+c;l(a.center.x-u,a.center.y-u),l(a.center.x+u,a.center.y+u)}else if(a.type==="booth"){let c=Math.max(a.width,a.height)/2;l(a.center.x-c,a.center.y-c),l(a.center.x+c,a.center.y+c)}else if(a.type==="text"){if(n)continue;let c=Be(a);l(a.position.x,a.position.y),l(a.position.x+c.width,a.position.y+c.height)}for(let a of[e.referenceImage,e.backgroundImage]){if(!a)continue;let{center:c,width:u}=a;if(!c||!Number.isFinite(c.x)||!Number.isFinite(c.y)||!Number.isFinite(u))continue;let m=u*3/4;l(c.x-u/2,c.y-m/2),l(c.x+u/2,c.y+m/2)}if(!isFinite(i)){let a=e.focalPoint??{x:0,y:0};return{x:a.x-200,y:a.y-200,width:400,height:400}}return{x:i-ue,y:o-ue,width:r-i+ue*2,height:s-o+ue*2}}export{mo as a,Nt as b,De as c,Lt as d,yo as e,jt as f,bo as g,te as h,pe as i,So as j,Mo as k,Po as l,vo as m,Eo as n,Io as o,wo as p,_o as q,Oo as r,ko as s,Ro as t,To as u,Ao as v,No as w,Lo as x,jo as y,Be as z,Do as A,Vo as B,Yt as C,Ho as D,ge as E,Xo as F,qe as G,Ko as H,Bo as I,Wt as J,et as K,zo as L,nt as M,qt as N,$o as O,Zo as P,st as Q,at as R,ct as S,en as T,ei as U,tn as V,on as W,ti as X,sn as Y,Me as Z,ni as _,di as $,pi as aa,kn as ba,ie as ca,yi as da,bi as ea,gi as fa,ii as ga,ri as ha,si as ia,lt as ja,Q as ka,Ee as la,un as ma,ci as na,dn as oa,ut as pa,Pe as qa,fn as ra,hn as sa,mn as ta,J as ua,dt as va,ht as wa,gn as xa,pt as ya,Mi as za,An as Aa,Pi as Ba,vi as Ca,Ei as Da,Ii as Ea,jn as Fa,wi as Ga,Vn as Ha,Ci as Ia,_i as Ja,ke as Ka,ee as La,he as Ma,Zi as Na,to as Oa,no as Pa,oo as Qa,_t as Ra,er as Sa,io as Ta,ro as Ua,Z as Va,we as Wa,X as Xa,re as Ya,tr as Za,Ot as _a,ao as $a,Oe as ab,nr as bb,uo as cb,fo as db,or as eb,ir as fb,rr as gb};