@needle-tools/engine 4.7.3-next.65e7878 → 4.7.3

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 (33) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/gltf-progressive-BMJtMiwp.js +1204 -0
  3. package/dist/gltf-progressive-DMJSXxbo.umd.cjs +8 -0
  4. package/dist/gltf-progressive-zQ2CaD2H.min.js +8 -0
  5. package/dist/{needle-engine.bundle-B0QYYufM.js → needle-engine.bundle-BxHtcHHV.js} +37 -11
  6. package/dist/{needle-engine.bundle-BCAZfCyl.min.js → needle-engine.bundle-DItBuJY3.min.js} +7 -7
  7. package/dist/{needle-engine.bundle-C6yScKUU.umd.cjs → needle-engine.bundle-DM_LxEPT.umd.cjs} +8 -8
  8. package/dist/needle-engine.js +3 -3
  9. package/dist/needle-engine.min.js +1 -1
  10. package/dist/needle-engine.umd.cjs +1 -1
  11. package/dist/{postprocessing-TkXiVrjY.min.js → postprocessing-BzY0H7ry.min.js} +8 -8
  12. package/dist/{postprocessing-CNCT892s.umd.cjs → postprocessing-Dw2OCMp4.umd.cjs} +8 -8
  13. package/dist/{postprocessing-qvgDnYKK.js → postprocessing-vKBVFpSz.js} +9 -9
  14. package/lib/engine/engine_lods.js +1 -1
  15. package/lib/engine/engine_lods.js.map +1 -1
  16. package/lib/engine-components/OrbitControls.d.ts +19 -1
  17. package/lib/engine-components/OrbitControls.js +30 -1
  18. package/lib/engine-components/OrbitControls.js.map +1 -1
  19. package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
  20. package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
  21. package/lib/engine-components/postprocessing/Volume.d.ts +3 -1
  22. package/lib/engine-components/postprocessing/Volume.js +2 -0
  23. package/lib/engine-components/postprocessing/Volume.js.map +1 -1
  24. package/package.json +3 -3
  25. package/plugins/vite/logger.client.js +68 -30
  26. package/plugins/vite/logger.js +5 -5
  27. package/src/engine/engine_lods.ts +3 -3
  28. package/src/engine-components/OrbitControls.ts +34 -2
  29. package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
  30. package/src/engine-components/postprocessing/Volume.ts +2 -1
  31. package/dist/gltf-progressive-BCZdu3Gc.min.js +0 -8
  32. package/dist/gltf-progressive-C6QbvrB4.umd.cjs +0 -8
  33. package/dist/gltf-progressive-CCddD-3B.js +0 -1159
@@ -1,4 +1,4 @@
1
- "use strict";var Hx=Object.defineProperty;var i_=o=>{throw TypeError(o)};var qx=(o,t,e)=>t in o?Hx(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var r=(o,t,e)=>qx(o,typeof t!="symbol"?t+"":t,e),zf=(o,t,e)=>t.has(o)||i_("Cannot "+e);var ce=(o,t,e)=>(zf(o,t,"read from private field"),e?e.call(o):t.get(o)),on=(o,t,e)=>t.has(o)?i_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),rn=(o,t,e,i)=>(zf(o,t,"write to private field"),i?i.call(o,e):t.set(o,e),e),Ol=(o,t,e)=>(zf(o,t,"access private method"),e);const d=require("./three-B_hneGZr.umd.cjs"),le=require("./gltf-progressive-C6QbvrB4.umd.cjs"),H=require("./three-examples-DUcCNw9s.umd.cjs"),ae=require("./vendor-Cavtu3CP.umd.cjs"),ne=require("./three-mesh-ui-CQiIQIlA.umd.cjs"),Xx=require("./postprocessing-CNCT892s.umd.cjs");var Nf=typeof document<"u"?document.currentScript:null;const $f=new Map;function Kt(o=(t=>(t=globalThis.location)==null?void 0:t.hostname)()){if($f.has(o))return $f.get(o);const e=/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|localhost/.test(o);return $f.set(o,e),e===!0}function s0(){return window.location.hostname.includes("glitch.me")}const Qx='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 160 187.74"><defs><linearGradient id="a" x1="89.64" y1="184.81" x2="90.48" y2="21.85" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#62d399"/><stop offset=".51" stop-color="#acd842"/><stop offset=".9" stop-color="#d7db0a"/></linearGradient><linearGradient id="b" x1="69.68" y1="178.9" x2="68.08" y2="16.77" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0ba398"/><stop offset=".5" stop-color="#4ca352"/><stop offset="1" stop-color="#76a30a"/></linearGradient><linearGradient id="c" x1="36.6" y1="152.17" x2="34.7" y2="84.19" gradientUnits="userSpaceOnUse"><stop offset=".19" stop-color="#36a382"/><stop offset=".54" stop-color="#49a459"/><stop offset="1" stop-color="#76a30b"/></linearGradient><linearGradient id="d" x1="15.82" y1="153.24" x2="18" y2="90.86" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#267880"/><stop offset=".51" stop-color="#457a5c"/><stop offset="1" stop-color="#717516"/></linearGradient><linearGradient id="e" x1="135.08" y1="135.43" x2="148.93" y2="63.47" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b0d939"/><stop offset="1" stop-color="#eadb04"/></linearGradient><linearGradient id="f" x1="-4163.25" y1="2285.12" x2="-4160.81" y2="2215.34" gradientTransform="rotate(20 4088.49 13316.712)" gradientUnits="userSpaceOnUse"><stop offset=".17" stop-color="#74af52"/><stop offset=".48" stop-color="#99be32"/><stop offset="1" stop-color="#c0c40a"/></linearGradient><symbol id="g" viewBox="0 0 160 187.74"><path style="fill:url(#a)" d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75z"/><path style="fill:url(#b)" d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98z"/><path style="fill:url(#c)" d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z"/><path style="fill:url(#d)" d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04z"/><path style="fill:#9c3" d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5z"/><path style="fill:url(#e)" d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59z"/><path style="fill:url(#f)" d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z"/><path style="fill:#ffe113" d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1z"/><path style="fill:#f3e600" d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75z"/></symbol></defs><use width="160" height="187.74" xlink:href="#g"/></svg>',Yx=btoa(Qx),Kx="data:image/svg+xml;base64,"+Yx,o0=Kx,Zx=`<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'> <svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" version="1.1" viewBox="0 0 1014 282" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m665.95 132.73v44.88l-10.56-8.4c-0.8-0.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18 0.4-6.06 1.2s-3.54 1.8-4.98 3-2.56 2.5-3.36 3.9-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c0.32 0.24 0.56 0.44 0.72 0.6s0.36 0.32 0.6 0.48c0.96-1.2 2.14-2.28 3.54-3.24s2.92-1.76 4.56-2.4 3.34-1.14 5.1-1.5 3.44-0.54 5.04-0.54c1.44 0 2.92 0.04 4.44 0.12s2.84 0.28 3.96 0.6c4.56 1.12 7.8 3.12 9.72 6s2.88 6.56 2.88 11.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m732.38 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m795.93 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m858.57 97.21c0.64 0.48 0.96 1.16 0.96 2.04v74.88c-0.08 1.04-0.12 2.12-0.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18s-2.06-1.66-2.46-1.98c-1.76 2.48-4.26 4.44-7.5 5.88s-7.02 2.16-11.34 2.16c-3.84 0-7.4-0.7-10.68-2.1s-6.14-3.44-8.58-6.12-4.34-5.94-5.7-9.78-2.04-8.16-2.04-12.96c0-4.32 0.78-8.34 2.34-12.06s3.6-6.92 6.12-9.6 5.38-4.78 8.58-6.3 6.48-2.28 9.84-2.28c2.56 0 4.82 0.22 6.78 0.66s3.68 1.06 5.16 1.86 2.78 1.74 3.9 2.82 2.16 2.22 3.12 3.42v-35.04l10.68 8.64zm-27.96 67.92c3.6 0 6.52-0.68 8.76-2.04s3.98-3.06 5.22-5.1 2.1-4.22 2.58-6.54 0.72-4.44 0.72-6.36v-1.2c0-1.12-0.22-2.7-0.66-4.74s-1.28-4.06-2.52-6.06-3-3.7-5.28-5.1-5.22-2.02-8.82-1.86c-3.44 0-6.26 0.74-8.46 2.22s-3.96 3.26-5.28 5.34-2.24 4.2-2.76 6.36-0.78 3.92-0.78 5.28c0 1.84 0.24 3.92 0.72 6.24s1.36 4.48 2.64 6.48 3.04 3.68 5.28 5.04 5.12 2.04 8.64 2.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m882.81 97.09c0.64 0.48 0.96 1.12 0.96 1.92l-0.12 41.04v37.08l-10.56-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-77.88l10.8 8.64z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m950.36 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.8559 0 0 .7642 45.348 36.475)"> <g transform="translate(2.7114)"> <path d="m3.935 173.02c-0.331 0-0.497-0.402-0.497-1.207v-51.002c0-0.738 0.138-1.107 0.414-1.107h1.781c0.277 0 0.415 0.335 0.415 1.006v5.935c0 0.336 0.027 0.553 0.083 0.654 0.055 0.101 0.151-0.017 0.289-0.352 0.912-1.744 1.754-3.236 2.527-4.477 0.773-1.24 1.554-2.179 2.341-2.816s1.65-0.956 2.588-0.956c1.685 0 3.011 0.922 3.977 2.766 0.967 1.845 1.602 3.84 1.905 5.986 0.056 0.268 0.139 0.369 0.249 0.302s0.221-0.235 0.331-0.503c0.939-1.811 1.802-3.353 2.589-4.628 0.787-1.274 1.581-2.246 2.382-2.917s1.671-1.006 2.61-1.006c2.016 0 3.569 1.392 4.66 4.175 1.09 2.783 1.636 6.421 1.636 10.915v37.925c0 0.871-0.18 1.307-0.539 1.307h-1.739c-0.138 0-0.249-0.1-0.332-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.338-6.321-1.015-8.3-0.676-1.978-1.76-2.967-3.251-2.967-0.884 0-1.726 0.386-2.527 1.157s-1.519 1.727-2.154 2.867-1.201 2.213-1.699 3.219c-0.248 0.469-0.421 0.905-0.517 1.308-0.097 0.402-0.145 0.972-0.145 1.71v37.221c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.166 0-0.29-0.1-0.373-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.332-6.321-0.994-8.3-0.663-1.978-1.754-2.967-3.273-2.967-1.242 0-2.375 0.704-3.396 2.112-1.022 1.409-2.223 3.555-3.604 6.439v39.031c0 0.805-0.18 1.207-0.539 1.207h-1.698z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m53.642 166.28c-1.077 2.549-2.237 4.477-3.479 5.785-1.243 1.307-2.61 1.961-4.101 1.961-2.154 0-3.853-1.324-5.095-3.973-1.243-2.649-1.864-6.187-1.864-10.613 0-3.488 0.4-6.489 1.201-9.004s1.988-4.51 3.562-5.985c1.574-1.476 3.521-2.414 5.841-2.817l3.686-0.704c0.221-0.067 0.394-0.218 0.518-0.453 0.124-0.234 0.187-0.587 0.187-1.056v-2.917c0-3.89-0.504-6.975-1.512-9.255s-2.354-3.42-4.039-3.42c-1.298 0-2.472 0.72-3.521 2.162s-2.002 3.572-2.858 6.388c-0.083 0.268-0.159 0.453-0.228 0.554-0.069 0.1-0.172 0.083-0.311-0.051l-1.698-1.71c-0.083-0.134-0.138-0.285-0.166-0.453-0.027-0.167 0.014-0.452 0.125-0.855 0.856-3.353 2.009-6.052 3.459-8.098 1.449-2.045 3.224-3.068 5.322-3.068 1.74 0 3.211 0.687 4.412 2.062s2.112 3.37 2.734 5.986c0.621 2.615 0.932 5.7 0.932 9.255v35.712c0 0.536-0.035 0.888-0.104 1.056s-0.2 0.251-0.393 0.251h-1.533c-0.166 0-0.29-0.117-0.373-0.352-0.083-0.234-0.124-0.553-0.124-0.955l-0.083-5.231c-0.055-0.939-0.221-1.006-0.497-0.202zm0.456-19.314c0-1.14-0.194-1.643-0.58-1.509l-3.107 0.603c-1.436 0.202-2.686 0.638-3.749 1.308-1.063 0.671-1.953 1.543-2.671 2.616s-1.257 2.33-1.616 3.772-0.538 3.102-0.538 4.98c0 3.152 0.455 5.616 1.367 7.393 0.911 1.778 2.14 2.666 3.686 2.666 0.939 0 1.85-0.419 2.734-1.257s1.671-1.895 2.361-3.169c0.663-1.408 1.181-2.85 1.553-4.326 0.373-1.475 0.56-2.883 0.56-4.225v-8.852z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m79.034 173.02c-0.166 0-0.297-0.117-0.394-0.352-0.096-0.234-0.145-0.553-0.145-0.955v-4.628c0-0.536-0.041-0.838-0.124-0.905s-0.207 0.1-0.373 0.503c-0.276 0.67-0.69 1.593-1.242 2.766-0.553 1.174-1.271 2.23-2.154 3.169-0.884 0.939-1.961 1.408-3.231 1.408-1.74 0-3.314-0.989-4.722-2.967-1.409-1.979-2.534-4.963-3.376-8.953-0.843-3.991-1.264-8.937-1.264-14.838 0-5.701 0.415-10.68 1.243-14.939s1.988-7.595 3.479-10.009c1.492-2.415 3.204-3.622 5.137-3.622 1.436 0 2.616 0.57 3.541 1.71 0.926 1.14 1.719 2.381 2.382 3.722 0.249 0.47 0.414 0.637 0.497 0.503s0.125-0.536 0.125-1.207v-23.841c0-0.805 0.151-1.208 0.455-1.208h1.864c0.276 0 0.414 0.369 0.414 1.107v72.128c0 0.537-0.041 0.905-0.124 1.107-0.083 0.201-0.235 0.301-0.455 0.301h-1.533zm-0.621-42.049c-0.939-2.213-1.885-3.94-2.838-5.181s-2.009-1.861-3.169-1.861c-1.463 0-2.768 0.889-3.914 2.666s-2.044 4.376-2.693 7.796-0.973 7.578-0.973 12.474c0 5.097 0.338 9.272 1.015 12.524 0.676 3.253 1.567 5.651 2.672 7.193 1.104 1.543 2.305 2.314 3.603 2.314 1.188 0 2.258-0.704 3.211-2.113 0.952-1.408 1.705-3.118 2.257-5.13s0.829-3.957 0.829-5.835v-24.847z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m89.514 149.38c0 3.42 0.345 6.606 1.035 9.557 0.691 2.951 1.609 5.315 2.755 7.092s2.437 2.666 3.873 2.666c1.519 0 2.837-0.738 3.956-2.213 1.118-1.476 2.064-3.655 2.837-6.539 0.083-0.336 0.166-0.52 0.249-0.554 0.083-0.033 0.179 0.017 0.29 0.151l1.408 1.912c0.221 0.268 0.235 0.67 0.041 1.207-0.69 2.548-1.47 4.661-2.34 6.337-0.87 1.677-1.857 2.935-2.962 3.773-1.104 0.838-2.319 1.257-3.645 1.257-2.043 0-3.838-1.14-5.385-3.42-1.546-2.28-2.761-5.482-3.645-9.607-0.884-4.124-1.325-8.836-1.325-14.134 0-5.901 0.455-10.931 1.367-15.089 0.911-4.158 2.14-7.377 3.686-9.658 1.547-2.28 3.3-3.42 5.261-3.42 1.988 0 3.714 1.073 5.178 3.219 1.463 2.146 2.595 5.231 3.396 9.255s1.201 8.886 1.201 14.587c0 0.469-0.02 0.939-0.062 1.408-0.041 0.469-0.214 0.704-0.517 0.704h-16.362c-0.083 0-0.152 0.151-0.207 0.453-0.056 0.302-0.083 0.654-0.083 1.056zm13.752-6.237c0.304 0 0.497-0.1 0.58-0.302 0.083-0.201 0.124-0.57 0.124-1.106 0-3.219-0.283-6.187-0.849-8.903s-1.367-4.896-2.402-6.539c-1.036-1.643-2.272-2.464-3.708-2.464-1.629 0-2.996 0.955-4.101 2.867-1.104 1.911-1.94 4.342-2.506 7.293s-0.849 6.002-0.849 9.154h13.711z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m148.54 119.7c0.165 0 0.283 0.117 0.352 0.352s0.076 0.52 0.02 0.855l-6.254 50.902c-0.028 0.47-0.104 0.788-0.228 0.956s-0.297 0.251-0.518 0.251h-1.615c-0.442 0-0.718-0.402-0.829-1.207l-5.26-40.138c-0.111-0.604-0.201-0.905-0.27-0.905s-0.131 0.301-0.186 0.905l-5.012 40.138c-0.028 0.47-0.097 0.788-0.207 0.956-0.111 0.168-0.277 0.251-0.497 0.251h-1.74c-0.442 0-0.718-0.402-0.829-1.207l-6.503-50.801c-0.055-0.403-0.048-0.721 0.021-0.956s0.2-0.352 0.393-0.352h1.823c0.166 0 0.297 0.067 0.393 0.201 0.097 0.134 0.159 0.403 0.187 0.805l5.302 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.219-41.949c0.055-0.268 0.124-0.47 0.207-0.604s0.193-0.201 0.331-0.201h1.533c0.138 0 0.262 0.067 0.373 0.201 0.11 0.134 0.179 0.403 0.207 0.805l5.468 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.053-41.849c0.055-0.335 0.138-0.57 0.249-0.704 0.11-0.134 0.234-0.201 0.373-0.201h1.284z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m156.49 171.51c0 0.604-0.042 1.006-0.125 1.208-0.082 0.201-0.262 0.301-0.538 0.301h-1.533c-0.221 0-0.366-0.083-0.435-0.251s-0.103-0.486-0.103-0.956v-50.902c0-0.805 0.152-1.207 0.456-1.207h1.822c0.304 0 0.456 0.402 0.456 1.207v50.6zm0.165-63.979c0 1.207-0.207 1.811-0.621 1.811h-1.905c-0.221 0-0.366-0.135-0.435-0.403s-0.104-0.67-0.104-1.207v-7.847c0-1.006 0.18-1.509 0.539-1.509h1.988c0.359 0 0.538 0.47 0.538 1.409v7.746z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m168.3 124.83c-0.221 0-0.331 0.269-0.331 0.805v33.801c0 3.42 0.221 5.667 0.663 6.74 0.441 1.073 1.09 1.609 1.946 1.609h3.024c0.138 0 0.242 0.084 0.311 0.252 0.069 0.167 0.103 0.419 0.103 0.754v2.716c0 0.537-0.138 0.906-0.414 1.107-0.248 0.067-0.614 0.134-1.098 0.201-0.483 0.067-0.959 0.118-1.429 0.151-0.469 0.034-0.828 0.05-1.077 0.05-1.712 0-2.934-0.955-3.665-2.867-0.732-1.911-1.098-5.013-1.098-9.305v-35.108c0-0.604-0.124-0.906-0.373-0.906h-3.521c-0.248 0-0.373-0.268-0.373-0.804v-3.521c0-0.537 0.111-0.805 0.332-0.805h3.686c0.166 0 0.263-0.268 0.29-0.805l0.415-16.095c0-0.805 0.124-1.207 0.372-1.207h1.492c0.303 0 0.455 0.436 0.455 1.307v15.995c0 0.537 0.097 0.805 0.29 0.805h5.468c0.221 0 0.331 0.268 0.331 0.805v3.521c0 0.536-0.124 0.804-0.373 0.804h-5.426z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m179.4 173.02c-0.331 0-0.497-0.402-0.497-1.207v-72.329c0-0.738 0.138-1.107 0.414-1.107h1.782c0.276 0 0.414 0.336 0.414 1.006v27.162c0 0.335 0.034 0.536 0.103 0.603s0.159-0.033 0.27-0.302c0.994-1.81 1.898-3.319 2.713-4.526 0.814-1.208 1.629-2.113 2.444-2.717 0.814-0.603 1.691-0.905 2.63-0.905 2.182 0 3.839 1.375 4.971 4.125 1.132 2.749 1.698 6.404 1.698 10.965v37.925c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.165 0-0.29-0.1-0.373-0.301-0.082-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.366-6.321-1.097-8.3-0.732-1.978-1.899-2.967-3.501-2.967-0.883 0-1.705 0.318-2.464 0.956-0.76 0.637-1.526 1.576-2.299 2.816-0.773 1.241-1.643 2.834-2.61 4.779v39.031c0 0.805-0.179 1.207-0.538 1.207h-1.699z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> </g> <g transform="matrix(.80638 0 0 .80638 452.53 65.421)" fill-rule="nonzero"> <path d="m79.32 36.98v150.76l15.68-13.2 6.59-156.31-22.27 18.75z" fill="url(#f)"/> <path d="m79.32 36.98-22.27-18.75 6.59 156.31 15.68 13.2v-150.76z" fill="url(#e)"/> <path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z" fill="url(#d)"/> <path d="m25.19 104.83-25.19-14.59 16.97 53.86 16.85 9.77-8.63-49.04z" fill="url(#c)"/> <path d="M43.86,82.5L18.69,67.98L0,90.24L25.18,104.83L43.86,82.5Z" fill="#9c3"/> <path d="m134.82 78.69-9.97 56.5 15.58-9.04 19.57-62.05-25.18 14.59z" fill="url(#b)"/> <path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z" fill="url(#a)"/> <path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33 25.19-14.59z" fill="#ffe113"/> <path d="M101.59,18.23L79.32,0L57.05,18.23L79.32,36.98L101.59,18.23Z" fill="#f3e600"/> </g> <defs> <linearGradient id="f" x2="1" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)" gradientUnits="userSpaceOnUse"><stop stop-color="#62d399" offset="0"/><stop stop-color="#acd842" offset=".51"/><stop stop-color="#d7db0a" offset=".9"/><stop stop-color="#d7db0a" offset="1"/></linearGradient> <linearGradient id="e" x2="1" gradientTransform="matrix(-1.6,-162.13,162.13,-1.6,69.68,178.9)" gradientUnits="userSpaceOnUse"><stop stop-color="#0ba398" offset="0"/><stop stop-color="#4ca352" offset=".5"/><stop stop-color="#76a30a" offset="1"/></linearGradient> <linearGradient id="d" x2="1" gradientTransform="matrix(-1.9,-67.98,67.98,-1.9,36.6,152.17)" gradientUnits="userSpaceOnUse"><stop stop-color="#36a382" offset="0"/><stop stop-color="#36a382" offset=".19"/><stop stop-color="#49a459" offset=".54"/><stop stop-color="#76a30b" offset="1"/></linearGradient> <linearGradient id="c" x2="1" gradientTransform="matrix(2.18,-62.38,62.38,2.18,15.82,153.24)" gradientUnits="userSpaceOnUse"><stop stop-color="#267880" offset="0"/><stop stop-color="#457a5c" offset=".51"/><stop stop-color="#717516" offset="1"/></linearGradient> <linearGradient id="b" x2="1" gradientTransform="matrix(13.85,-71.96,71.96,13.85,135.08,135.43)" gradientUnits="userSpaceOnUse"><stop stop-color="#b0d939" offset="0"/><stop stop-color="#eadb04" offset="1"/></linearGradient> <linearGradient id="a" x2="1" gradientTransform="matrix(26.159 -64.737 64.737 26.159 107.42 128.14)" gradientUnits="userSpaceOnUse"><stop stop-color="#74af52" offset="0"/><stop stop-color="#74af52" offset=".17"/><stop stop-color="#99be32" offset=".48"/><stop stop-color="#c0c40a" offset="1"/></linearGradient> </defs> </svg>`;btoa(Zx);const Jx='<svg viewBox="0 0 509 154" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M665.95 132.73v44.88l-10.56-8.4c-.8-.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18.4-6.06 1.2-1.88.8-3.54 1.8-4.98 3-1.44 1.2-2.56 2.5-3.36 3.9-.8 1.4-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-.72-.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c.32.24.56.44.72.6.16.16.36.32.6.48.96-1.2 2.14-2.28 3.54-3.24 1.4-.96 2.92-1.76 4.56-2.4 1.64-.64 3.34-1.14 5.1-1.5 1.76-.36 3.44-.54 5.04-.54 1.44 0 2.92.04 4.44.12 1.52.08 2.84.28 3.96.6 4.56 1.12 7.8 3.12 9.72 6 1.92 2.88 2.88 6.56 2.88 11.04ZM732.38 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM795.93 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM858.57 97.21c.64.48.96 1.16.96 2.04v74.88c-.08 1.04-.12 2.12-.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18-1.24-1-2.06-1.66-2.46-1.98-1.76 2.48-4.26 4.44-7.5 5.88-3.24 1.44-7.02 2.16-11.34 2.16-3.84 0-7.4-.7-10.68-2.1-3.28-1.4-6.14-3.44-8.58-6.12-2.44-2.68-4.34-5.94-5.7-9.78-1.36-3.84-2.04-8.16-2.04-12.96 0-4.32.78-8.34 2.34-12.06 1.56-3.72 3.6-6.92 6.12-9.6 2.52-2.68 5.38-4.78 8.58-6.3 3.2-1.52 6.48-2.28 9.84-2.28 2.56 0 4.82.22 6.78.66 1.96.44 3.68 1.06 5.16 1.86s2.78 1.74 3.9 2.82a35.92 35.92 0 0 1 3.12 3.42V88.57l10.68 8.64Zm-27.96 67.92c3.6 0 6.52-.68 8.76-2.04 2.24-1.36 3.98-3.06 5.22-5.1a20.5 20.5 0 0 0 2.58-6.54c.48-2.32.72-4.44.72-6.36v-1.2c0-1.12-.22-2.7-.66-4.74-.44-2.04-1.28-4.06-2.52-6.06s-3-3.7-5.28-5.1c-2.28-1.4-5.22-2.02-8.82-1.86-3.44 0-6.26.74-8.46 2.22-2.2 1.48-3.96 3.26-5.28 5.34-1.32 2.08-2.24 4.2-2.76 6.36-.52 2.16-.78 3.92-.78 5.28 0 1.84.24 3.92.72 6.24.48 2.32 1.36 4.48 2.64 6.48s3.04 3.68 5.28 5.04c2.24 1.36 5.12 2.04 8.64 2.04ZM882.81 97.09c.64.48.96 1.12.96 1.92l-.12 41.04v37.08l-10.56-8.4c-.72-.64-1.08-1.44-1.08-2.4V88.45l10.8 8.64ZM950.36 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14Z" style="fill-rule:nonzero" transform="translate(-452.406 -63.709) scale(1.00797)"/><path d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75Z" style="fill:url(#a);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98Z" style="fill:url(#b);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33Z" style="fill:url(#c);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04Z" style="fill:url(#d);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5Z" style="fill:#9c3;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59Z" style="fill:url(#e);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5Z" style="fill:url(#f);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1Z" style="fill:#ffe113;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75Z" style="fill:#f3e600;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><defs><linearGradient id="a" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)"><stop offset="0" style="stop-color:#62d399;stop-opacity:1"/><stop offset=".51" style="stop-color:#acd842;stop-opacity:1"/><stop offset=".9" style="stop-color:#d7db0a;stop-opacity:1"/><stop offset="1" style="stop-color:#d7db0a;stop-opacity:1"/></linearGradient><linearGradient id="b" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-90.565 123.412 54.953) scale(162.14)"><stop offset="0" style="stop-color:#0ba398;stop-opacity:1"/><stop offset=".5" style="stop-color:#4ca352;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30a;stop-opacity:1"/></linearGradient><linearGradient id="c" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="scale(-68) rotate(88.4 .881 -1.396)"><stop offset="0" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".19" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".54" style="stop-color:#49a459;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30b;stop-opacity:1"/></linearGradient><linearGradient id="d" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-88 87.255 68.431) scale(62.42)"><stop offset="0" style="stop-color:#267880;stop-opacity:1"/><stop offset=".51" style="stop-color:#457a5c;stop-opacity:1"/><stop offset="1" style="stop-color:#717516;stop-opacity:1"/></linearGradient><linearGradient id="e" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-79.1 149.53 -14.065) scale(73.28)"><stop offset="0" style="stop-color:#b0d939;stop-opacity:1"/><stop offset="1" style="stop-color:#eadb04;stop-opacity:1"/></linearGradient><linearGradient id="f" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-67.997 148.705 -15.558) scale(69.8226)"><stop offset="0" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".17" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".48" style="stop-color:#99be32;stop-opacity:1"/><stop offset="1" style="stop-color:#c0c40a;stop-opacity:1"/></linearGradient></defs></svg>',eS=btoa(Jx),tS="data:image/svg+xml;charset=utf-8;base64,"+eS,iS=tS,n_=typeof window!==void 0?window.location.search.includes("debugcontext"):!1;var he=(o=>(o.ContextRegistered="ContextRegistered",o.ContextCreationStart="ContextCreationStart",o.ContextCreated="ContextCreated",o.ContextFirstFrameRendered="ContextFirstFrameRendered",o.ContextDestroying="ContextDestroying",o.ContextDestroyed="ContextDestroyed",o.MissingCamera="MissingCamera",o.ContextClearing="ContextClearing",o.ContextCleared="ContextCleared",o))(he||{});class re{static get Current(){return globalThis["NeedleEngine.Context.Current"]}static set Current(t){globalThis["NeedleEngine.Context.Current"]=t}static get All(){return this.Registered}static register(t){this.Registered.indexOf(t)===-1&&(n_&&console.warn("Registering context"),this.Registered.push(t),this.dispatchCallback("ContextRegistered",t))}static unregister(t){const e=this.Registered.indexOf(t);e!==-1&&(n_&&console.warn("Unregistering context"),this.Registered.splice(e,1))}static registerCallback(t,e){this._callbacks[t]||(this._callbacks[t]=[]),this._callbacks[t].push(e)}static unregisterCallback(t,e){if(!this._callbacks[t])return;const i=this._callbacks[t].indexOf(e);i!==-1&&this._callbacks[t].splice(i,1)}static dispatchCallback(t,e,i){if(!this._callbacks[t])return!0;const n={event:t,context:e};if(i)for(const a in i)n[a]=i[a];const s=new Array;return this._callbacks[t].forEach(a=>{const l=a(n);l instanceof Promise&&s.push(l)}),Promise.all(s)}static addContextCreatedCallback(t){this.registerCallback("ContextCreated",t)}static addContextDestroyedCallback(t){this.registerCallback("ContextDestroyed",t)}}r(re,"Registered",[]),r(re,"_callbacks",{});const r0=()=>o=>o;function nS(o){return r0()(o)}function sS(){return!!S("debug")}class ki{constructor(t,e){r(this,"_factory");r(this,"_cache",[]);r(this,"_maxSize");r(this,"_index",0);this._factory=t,this._maxSize=e}get(){const t=this._index%this._maxSize;return this._index++,this._cache.length<=t&&(this._cache[t]=this._factory()),this._cache[t]}}let Jo=!1;const qp=new Array;typeof window<"u"&&setTimeout(()=>{if(Jo){const o={},t=new URL(window.location.href),e=new URL(t);e.searchParams.append("console","");const i=e.toString().replace(/=$|=(?=&)/g,"");for(const s of qp){const a=new URL(t);a.searchParams.append(s,""),o[s]=a.toString().replace(/=$|=(?=&)/g,"")}console.log(`🌵 ?help: Debug Options for Needle Engine.
1
+ "use strict";var Hx=Object.defineProperty;var i_=o=>{throw TypeError(o)};var qx=(o,t,e)=>t in o?Hx(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var r=(o,t,e)=>qx(o,typeof t!="symbol"?t+"":t,e),zf=(o,t,e)=>t.has(o)||i_("Cannot "+e);var ce=(o,t,e)=>(zf(o,t,"read from private field"),e?e.call(o):t.get(o)),on=(o,t,e)=>t.has(o)?i_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),rn=(o,t,e,i)=>(zf(o,t,"write to private field"),i?i.call(o,e):t.set(o,e),e),Ol=(o,t,e)=>(zf(o,t,"access private method"),e);const d=require("./three-B_hneGZr.umd.cjs"),le=require("./gltf-progressive-DMJSXxbo.umd.cjs"),H=require("./three-examples-DUcCNw9s.umd.cjs"),ae=require("./vendor-Cavtu3CP.umd.cjs"),ne=require("./three-mesh-ui-CQiIQIlA.umd.cjs"),Xx=require("./postprocessing-Dw2OCMp4.umd.cjs");var Nf=typeof document<"u"?document.currentScript:null;const $f=new Map;function Kt(o=(t=>(t=globalThis.location)==null?void 0:t.hostname)()){if($f.has(o))return $f.get(o);const e=/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|localhost/.test(o);return $f.set(o,e),e===!0}function s0(){return window.location.hostname.includes("glitch.me")}const Qx='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 160 187.74"><defs><linearGradient id="a" x1="89.64" y1="184.81" x2="90.48" y2="21.85" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#62d399"/><stop offset=".51" stop-color="#acd842"/><stop offset=".9" stop-color="#d7db0a"/></linearGradient><linearGradient id="b" x1="69.68" y1="178.9" x2="68.08" y2="16.77" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0ba398"/><stop offset=".5" stop-color="#4ca352"/><stop offset="1" stop-color="#76a30a"/></linearGradient><linearGradient id="c" x1="36.6" y1="152.17" x2="34.7" y2="84.19" gradientUnits="userSpaceOnUse"><stop offset=".19" stop-color="#36a382"/><stop offset=".54" stop-color="#49a459"/><stop offset="1" stop-color="#76a30b"/></linearGradient><linearGradient id="d" x1="15.82" y1="153.24" x2="18" y2="90.86" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#267880"/><stop offset=".51" stop-color="#457a5c"/><stop offset="1" stop-color="#717516"/></linearGradient><linearGradient id="e" x1="135.08" y1="135.43" x2="148.93" y2="63.47" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b0d939"/><stop offset="1" stop-color="#eadb04"/></linearGradient><linearGradient id="f" x1="-4163.25" y1="2285.12" x2="-4160.81" y2="2215.34" gradientTransform="rotate(20 4088.49 13316.712)" gradientUnits="userSpaceOnUse"><stop offset=".17" stop-color="#74af52"/><stop offset=".48" stop-color="#99be32"/><stop offset="1" stop-color="#c0c40a"/></linearGradient><symbol id="g" viewBox="0 0 160 187.74"><path style="fill:url(#a)" d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75z"/><path style="fill:url(#b)" d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98z"/><path style="fill:url(#c)" d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z"/><path style="fill:url(#d)" d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04z"/><path style="fill:#9c3" d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5z"/><path style="fill:url(#e)" d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59z"/><path style="fill:url(#f)" d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z"/><path style="fill:#ffe113" d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1z"/><path style="fill:#f3e600" d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75z"/></symbol></defs><use width="160" height="187.74" xlink:href="#g"/></svg>',Yx=btoa(Qx),Kx="data:image/svg+xml;base64,"+Yx,o0=Kx,Zx=`<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'> <svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" version="1.1" viewBox="0 0 1014 282" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m665.95 132.73v44.88l-10.56-8.4c-0.8-0.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18 0.4-6.06 1.2s-3.54 1.8-4.98 3-2.56 2.5-3.36 3.9-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c0.32 0.24 0.56 0.44 0.72 0.6s0.36 0.32 0.6 0.48c0.96-1.2 2.14-2.28 3.54-3.24s2.92-1.76 4.56-2.4 3.34-1.14 5.1-1.5 3.44-0.54 5.04-0.54c1.44 0 2.92 0.04 4.44 0.12s2.84 0.28 3.96 0.6c4.56 1.12 7.8 3.12 9.72 6s2.88 6.56 2.88 11.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m732.38 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m795.93 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m858.57 97.21c0.64 0.48 0.96 1.16 0.96 2.04v74.88c-0.08 1.04-0.12 2.12-0.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18s-2.06-1.66-2.46-1.98c-1.76 2.48-4.26 4.44-7.5 5.88s-7.02 2.16-11.34 2.16c-3.84 0-7.4-0.7-10.68-2.1s-6.14-3.44-8.58-6.12-4.34-5.94-5.7-9.78-2.04-8.16-2.04-12.96c0-4.32 0.78-8.34 2.34-12.06s3.6-6.92 6.12-9.6 5.38-4.78 8.58-6.3 6.48-2.28 9.84-2.28c2.56 0 4.82 0.22 6.78 0.66s3.68 1.06 5.16 1.86 2.78 1.74 3.9 2.82 2.16 2.22 3.12 3.42v-35.04l10.68 8.64zm-27.96 67.92c3.6 0 6.52-0.68 8.76-2.04s3.98-3.06 5.22-5.1 2.1-4.22 2.58-6.54 0.72-4.44 0.72-6.36v-1.2c0-1.12-0.22-2.7-0.66-4.74s-1.28-4.06-2.52-6.06-3-3.7-5.28-5.1-5.22-2.02-8.82-1.86c-3.44 0-6.26 0.74-8.46 2.22s-3.96 3.26-5.28 5.34-2.24 4.2-2.76 6.36-0.78 3.92-0.78 5.28c0 1.84 0.24 3.92 0.72 6.24s1.36 4.48 2.64 6.48 3.04 3.68 5.28 5.04 5.12 2.04 8.64 2.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m882.81 97.09c0.64 0.48 0.96 1.12 0.96 1.92l-0.12 41.04v37.08l-10.56-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-77.88l10.8 8.64z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m950.36 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.8559 0 0 .7642 45.348 36.475)"> <g transform="translate(2.7114)"> <path d="m3.935 173.02c-0.331 0-0.497-0.402-0.497-1.207v-51.002c0-0.738 0.138-1.107 0.414-1.107h1.781c0.277 0 0.415 0.335 0.415 1.006v5.935c0 0.336 0.027 0.553 0.083 0.654 0.055 0.101 0.151-0.017 0.289-0.352 0.912-1.744 1.754-3.236 2.527-4.477 0.773-1.24 1.554-2.179 2.341-2.816s1.65-0.956 2.588-0.956c1.685 0 3.011 0.922 3.977 2.766 0.967 1.845 1.602 3.84 1.905 5.986 0.056 0.268 0.139 0.369 0.249 0.302s0.221-0.235 0.331-0.503c0.939-1.811 1.802-3.353 2.589-4.628 0.787-1.274 1.581-2.246 2.382-2.917s1.671-1.006 2.61-1.006c2.016 0 3.569 1.392 4.66 4.175 1.09 2.783 1.636 6.421 1.636 10.915v37.925c0 0.871-0.18 1.307-0.539 1.307h-1.739c-0.138 0-0.249-0.1-0.332-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.338-6.321-1.015-8.3-0.676-1.978-1.76-2.967-3.251-2.967-0.884 0-1.726 0.386-2.527 1.157s-1.519 1.727-2.154 2.867-1.201 2.213-1.699 3.219c-0.248 0.469-0.421 0.905-0.517 1.308-0.097 0.402-0.145 0.972-0.145 1.71v37.221c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.166 0-0.29-0.1-0.373-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.332-6.321-0.994-8.3-0.663-1.978-1.754-2.967-3.273-2.967-1.242 0-2.375 0.704-3.396 2.112-1.022 1.409-2.223 3.555-3.604 6.439v39.031c0 0.805-0.18 1.207-0.539 1.207h-1.698z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m53.642 166.28c-1.077 2.549-2.237 4.477-3.479 5.785-1.243 1.307-2.61 1.961-4.101 1.961-2.154 0-3.853-1.324-5.095-3.973-1.243-2.649-1.864-6.187-1.864-10.613 0-3.488 0.4-6.489 1.201-9.004s1.988-4.51 3.562-5.985c1.574-1.476 3.521-2.414 5.841-2.817l3.686-0.704c0.221-0.067 0.394-0.218 0.518-0.453 0.124-0.234 0.187-0.587 0.187-1.056v-2.917c0-3.89-0.504-6.975-1.512-9.255s-2.354-3.42-4.039-3.42c-1.298 0-2.472 0.72-3.521 2.162s-2.002 3.572-2.858 6.388c-0.083 0.268-0.159 0.453-0.228 0.554-0.069 0.1-0.172 0.083-0.311-0.051l-1.698-1.71c-0.083-0.134-0.138-0.285-0.166-0.453-0.027-0.167 0.014-0.452 0.125-0.855 0.856-3.353 2.009-6.052 3.459-8.098 1.449-2.045 3.224-3.068 5.322-3.068 1.74 0 3.211 0.687 4.412 2.062s2.112 3.37 2.734 5.986c0.621 2.615 0.932 5.7 0.932 9.255v35.712c0 0.536-0.035 0.888-0.104 1.056s-0.2 0.251-0.393 0.251h-1.533c-0.166 0-0.29-0.117-0.373-0.352-0.083-0.234-0.124-0.553-0.124-0.955l-0.083-5.231c-0.055-0.939-0.221-1.006-0.497-0.202zm0.456-19.314c0-1.14-0.194-1.643-0.58-1.509l-3.107 0.603c-1.436 0.202-2.686 0.638-3.749 1.308-1.063 0.671-1.953 1.543-2.671 2.616s-1.257 2.33-1.616 3.772-0.538 3.102-0.538 4.98c0 3.152 0.455 5.616 1.367 7.393 0.911 1.778 2.14 2.666 3.686 2.666 0.939 0 1.85-0.419 2.734-1.257s1.671-1.895 2.361-3.169c0.663-1.408 1.181-2.85 1.553-4.326 0.373-1.475 0.56-2.883 0.56-4.225v-8.852z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m79.034 173.02c-0.166 0-0.297-0.117-0.394-0.352-0.096-0.234-0.145-0.553-0.145-0.955v-4.628c0-0.536-0.041-0.838-0.124-0.905s-0.207 0.1-0.373 0.503c-0.276 0.67-0.69 1.593-1.242 2.766-0.553 1.174-1.271 2.23-2.154 3.169-0.884 0.939-1.961 1.408-3.231 1.408-1.74 0-3.314-0.989-4.722-2.967-1.409-1.979-2.534-4.963-3.376-8.953-0.843-3.991-1.264-8.937-1.264-14.838 0-5.701 0.415-10.68 1.243-14.939s1.988-7.595 3.479-10.009c1.492-2.415 3.204-3.622 5.137-3.622 1.436 0 2.616 0.57 3.541 1.71 0.926 1.14 1.719 2.381 2.382 3.722 0.249 0.47 0.414 0.637 0.497 0.503s0.125-0.536 0.125-1.207v-23.841c0-0.805 0.151-1.208 0.455-1.208h1.864c0.276 0 0.414 0.369 0.414 1.107v72.128c0 0.537-0.041 0.905-0.124 1.107-0.083 0.201-0.235 0.301-0.455 0.301h-1.533zm-0.621-42.049c-0.939-2.213-1.885-3.94-2.838-5.181s-2.009-1.861-3.169-1.861c-1.463 0-2.768 0.889-3.914 2.666s-2.044 4.376-2.693 7.796-0.973 7.578-0.973 12.474c0 5.097 0.338 9.272 1.015 12.524 0.676 3.253 1.567 5.651 2.672 7.193 1.104 1.543 2.305 2.314 3.603 2.314 1.188 0 2.258-0.704 3.211-2.113 0.952-1.408 1.705-3.118 2.257-5.13s0.829-3.957 0.829-5.835v-24.847z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m89.514 149.38c0 3.42 0.345 6.606 1.035 9.557 0.691 2.951 1.609 5.315 2.755 7.092s2.437 2.666 3.873 2.666c1.519 0 2.837-0.738 3.956-2.213 1.118-1.476 2.064-3.655 2.837-6.539 0.083-0.336 0.166-0.52 0.249-0.554 0.083-0.033 0.179 0.017 0.29 0.151l1.408 1.912c0.221 0.268 0.235 0.67 0.041 1.207-0.69 2.548-1.47 4.661-2.34 6.337-0.87 1.677-1.857 2.935-2.962 3.773-1.104 0.838-2.319 1.257-3.645 1.257-2.043 0-3.838-1.14-5.385-3.42-1.546-2.28-2.761-5.482-3.645-9.607-0.884-4.124-1.325-8.836-1.325-14.134 0-5.901 0.455-10.931 1.367-15.089 0.911-4.158 2.14-7.377 3.686-9.658 1.547-2.28 3.3-3.42 5.261-3.42 1.988 0 3.714 1.073 5.178 3.219 1.463 2.146 2.595 5.231 3.396 9.255s1.201 8.886 1.201 14.587c0 0.469-0.02 0.939-0.062 1.408-0.041 0.469-0.214 0.704-0.517 0.704h-16.362c-0.083 0-0.152 0.151-0.207 0.453-0.056 0.302-0.083 0.654-0.083 1.056zm13.752-6.237c0.304 0 0.497-0.1 0.58-0.302 0.083-0.201 0.124-0.57 0.124-1.106 0-3.219-0.283-6.187-0.849-8.903s-1.367-4.896-2.402-6.539c-1.036-1.643-2.272-2.464-3.708-2.464-1.629 0-2.996 0.955-4.101 2.867-1.104 1.911-1.94 4.342-2.506 7.293s-0.849 6.002-0.849 9.154h13.711z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m148.54 119.7c0.165 0 0.283 0.117 0.352 0.352s0.076 0.52 0.02 0.855l-6.254 50.902c-0.028 0.47-0.104 0.788-0.228 0.956s-0.297 0.251-0.518 0.251h-1.615c-0.442 0-0.718-0.402-0.829-1.207l-5.26-40.138c-0.111-0.604-0.201-0.905-0.27-0.905s-0.131 0.301-0.186 0.905l-5.012 40.138c-0.028 0.47-0.097 0.788-0.207 0.956-0.111 0.168-0.277 0.251-0.497 0.251h-1.74c-0.442 0-0.718-0.402-0.829-1.207l-6.503-50.801c-0.055-0.403-0.048-0.721 0.021-0.956s0.2-0.352 0.393-0.352h1.823c0.166 0 0.297 0.067 0.393 0.201 0.097 0.134 0.159 0.403 0.187 0.805l5.302 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.219-41.949c0.055-0.268 0.124-0.47 0.207-0.604s0.193-0.201 0.331-0.201h1.533c0.138 0 0.262 0.067 0.373 0.201 0.11 0.134 0.179 0.403 0.207 0.805l5.468 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.053-41.849c0.055-0.335 0.138-0.57 0.249-0.704 0.11-0.134 0.234-0.201 0.373-0.201h1.284z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m156.49 171.51c0 0.604-0.042 1.006-0.125 1.208-0.082 0.201-0.262 0.301-0.538 0.301h-1.533c-0.221 0-0.366-0.083-0.435-0.251s-0.103-0.486-0.103-0.956v-50.902c0-0.805 0.152-1.207 0.456-1.207h1.822c0.304 0 0.456 0.402 0.456 1.207v50.6zm0.165-63.979c0 1.207-0.207 1.811-0.621 1.811h-1.905c-0.221 0-0.366-0.135-0.435-0.403s-0.104-0.67-0.104-1.207v-7.847c0-1.006 0.18-1.509 0.539-1.509h1.988c0.359 0 0.538 0.47 0.538 1.409v7.746z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m168.3 124.83c-0.221 0-0.331 0.269-0.331 0.805v33.801c0 3.42 0.221 5.667 0.663 6.74 0.441 1.073 1.09 1.609 1.946 1.609h3.024c0.138 0 0.242 0.084 0.311 0.252 0.069 0.167 0.103 0.419 0.103 0.754v2.716c0 0.537-0.138 0.906-0.414 1.107-0.248 0.067-0.614 0.134-1.098 0.201-0.483 0.067-0.959 0.118-1.429 0.151-0.469 0.034-0.828 0.05-1.077 0.05-1.712 0-2.934-0.955-3.665-2.867-0.732-1.911-1.098-5.013-1.098-9.305v-35.108c0-0.604-0.124-0.906-0.373-0.906h-3.521c-0.248 0-0.373-0.268-0.373-0.804v-3.521c0-0.537 0.111-0.805 0.332-0.805h3.686c0.166 0 0.263-0.268 0.29-0.805l0.415-16.095c0-0.805 0.124-1.207 0.372-1.207h1.492c0.303 0 0.455 0.436 0.455 1.307v15.995c0 0.537 0.097 0.805 0.29 0.805h5.468c0.221 0 0.331 0.268 0.331 0.805v3.521c0 0.536-0.124 0.804-0.373 0.804h-5.426z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m179.4 173.02c-0.331 0-0.497-0.402-0.497-1.207v-72.329c0-0.738 0.138-1.107 0.414-1.107h1.782c0.276 0 0.414 0.336 0.414 1.006v27.162c0 0.335 0.034 0.536 0.103 0.603s0.159-0.033 0.27-0.302c0.994-1.81 1.898-3.319 2.713-4.526 0.814-1.208 1.629-2.113 2.444-2.717 0.814-0.603 1.691-0.905 2.63-0.905 2.182 0 3.839 1.375 4.971 4.125 1.132 2.749 1.698 6.404 1.698 10.965v37.925c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.165 0-0.29-0.1-0.373-0.301-0.082-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.366-6.321-1.097-8.3-0.732-1.978-1.899-2.967-3.501-2.967-0.883 0-1.705 0.318-2.464 0.956-0.76 0.637-1.526 1.576-2.299 2.816-0.773 1.241-1.643 2.834-2.61 4.779v39.031c0 0.805-0.179 1.207-0.538 1.207h-1.699z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> </g> <g transform="matrix(.80638 0 0 .80638 452.53 65.421)" fill-rule="nonzero"> <path d="m79.32 36.98v150.76l15.68-13.2 6.59-156.31-22.27 18.75z" fill="url(#f)"/> <path d="m79.32 36.98-22.27-18.75 6.59 156.31 15.68 13.2v-150.76z" fill="url(#e)"/> <path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z" fill="url(#d)"/> <path d="m25.19 104.83-25.19-14.59 16.97 53.86 16.85 9.77-8.63-49.04z" fill="url(#c)"/> <path d="M43.86,82.5L18.69,67.98L0,90.24L25.18,104.83L43.86,82.5Z" fill="#9c3"/> <path d="m134.82 78.69-9.97 56.5 15.58-9.04 19.57-62.05-25.18 14.59z" fill="url(#b)"/> <path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z" fill="url(#a)"/> <path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33 25.19-14.59z" fill="#ffe113"/> <path d="M101.59,18.23L79.32,0L57.05,18.23L79.32,36.98L101.59,18.23Z" fill="#f3e600"/> </g> <defs> <linearGradient id="f" x2="1" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)" gradientUnits="userSpaceOnUse"><stop stop-color="#62d399" offset="0"/><stop stop-color="#acd842" offset=".51"/><stop stop-color="#d7db0a" offset=".9"/><stop stop-color="#d7db0a" offset="1"/></linearGradient> <linearGradient id="e" x2="1" gradientTransform="matrix(-1.6,-162.13,162.13,-1.6,69.68,178.9)" gradientUnits="userSpaceOnUse"><stop stop-color="#0ba398" offset="0"/><stop stop-color="#4ca352" offset=".5"/><stop stop-color="#76a30a" offset="1"/></linearGradient> <linearGradient id="d" x2="1" gradientTransform="matrix(-1.9,-67.98,67.98,-1.9,36.6,152.17)" gradientUnits="userSpaceOnUse"><stop stop-color="#36a382" offset="0"/><stop stop-color="#36a382" offset=".19"/><stop stop-color="#49a459" offset=".54"/><stop stop-color="#76a30b" offset="1"/></linearGradient> <linearGradient id="c" x2="1" gradientTransform="matrix(2.18,-62.38,62.38,2.18,15.82,153.24)" gradientUnits="userSpaceOnUse"><stop stop-color="#267880" offset="0"/><stop stop-color="#457a5c" offset=".51"/><stop stop-color="#717516" offset="1"/></linearGradient> <linearGradient id="b" x2="1" gradientTransform="matrix(13.85,-71.96,71.96,13.85,135.08,135.43)" gradientUnits="userSpaceOnUse"><stop stop-color="#b0d939" offset="0"/><stop stop-color="#eadb04" offset="1"/></linearGradient> <linearGradient id="a" x2="1" gradientTransform="matrix(26.159 -64.737 64.737 26.159 107.42 128.14)" gradientUnits="userSpaceOnUse"><stop stop-color="#74af52" offset="0"/><stop stop-color="#74af52" offset=".17"/><stop stop-color="#99be32" offset=".48"/><stop stop-color="#c0c40a" offset="1"/></linearGradient> </defs> </svg>`;btoa(Zx);const Jx='<svg viewBox="0 0 509 154" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M665.95 132.73v44.88l-10.56-8.4c-.8-.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18.4-6.06 1.2-1.88.8-3.54 1.8-4.98 3-1.44 1.2-2.56 2.5-3.36 3.9-.8 1.4-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-.72-.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c.32.24.56.44.72.6.16.16.36.32.6.48.96-1.2 2.14-2.28 3.54-3.24 1.4-.96 2.92-1.76 4.56-2.4 1.64-.64 3.34-1.14 5.1-1.5 1.76-.36 3.44-.54 5.04-.54 1.44 0 2.92.04 4.44.12 1.52.08 2.84.28 3.96.6 4.56 1.12 7.8 3.12 9.72 6 1.92 2.88 2.88 6.56 2.88 11.04ZM732.38 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM795.93 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM858.57 97.21c.64.48.96 1.16.96 2.04v74.88c-.08 1.04-.12 2.12-.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18-1.24-1-2.06-1.66-2.46-1.98-1.76 2.48-4.26 4.44-7.5 5.88-3.24 1.44-7.02 2.16-11.34 2.16-3.84 0-7.4-.7-10.68-2.1-3.28-1.4-6.14-3.44-8.58-6.12-2.44-2.68-4.34-5.94-5.7-9.78-1.36-3.84-2.04-8.16-2.04-12.96 0-4.32.78-8.34 2.34-12.06 1.56-3.72 3.6-6.92 6.12-9.6 2.52-2.68 5.38-4.78 8.58-6.3 3.2-1.52 6.48-2.28 9.84-2.28 2.56 0 4.82.22 6.78.66 1.96.44 3.68 1.06 5.16 1.86s2.78 1.74 3.9 2.82a35.92 35.92 0 0 1 3.12 3.42V88.57l10.68 8.64Zm-27.96 67.92c3.6 0 6.52-.68 8.76-2.04 2.24-1.36 3.98-3.06 5.22-5.1a20.5 20.5 0 0 0 2.58-6.54c.48-2.32.72-4.44.72-6.36v-1.2c0-1.12-.22-2.7-.66-4.74-.44-2.04-1.28-4.06-2.52-6.06s-3-3.7-5.28-5.1c-2.28-1.4-5.22-2.02-8.82-1.86-3.44 0-6.26.74-8.46 2.22-2.2 1.48-3.96 3.26-5.28 5.34-1.32 2.08-2.24 4.2-2.76 6.36-.52 2.16-.78 3.92-.78 5.28 0 1.84.24 3.92.72 6.24.48 2.32 1.36 4.48 2.64 6.48s3.04 3.68 5.28 5.04c2.24 1.36 5.12 2.04 8.64 2.04ZM882.81 97.09c.64.48.96 1.12.96 1.92l-.12 41.04v37.08l-10.56-8.4c-.72-.64-1.08-1.44-1.08-2.4V88.45l10.8 8.64ZM950.36 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14Z" style="fill-rule:nonzero" transform="translate(-452.406 -63.709) scale(1.00797)"/><path d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75Z" style="fill:url(#a);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98Z" style="fill:url(#b);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33Z" style="fill:url(#c);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04Z" style="fill:url(#d);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5Z" style="fill:#9c3;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59Z" style="fill:url(#e);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5Z" style="fill:url(#f);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1Z" style="fill:#ffe113;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75Z" style="fill:#f3e600;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><defs><linearGradient id="a" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)"><stop offset="0" style="stop-color:#62d399;stop-opacity:1"/><stop offset=".51" style="stop-color:#acd842;stop-opacity:1"/><stop offset=".9" style="stop-color:#d7db0a;stop-opacity:1"/><stop offset="1" style="stop-color:#d7db0a;stop-opacity:1"/></linearGradient><linearGradient id="b" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-90.565 123.412 54.953) scale(162.14)"><stop offset="0" style="stop-color:#0ba398;stop-opacity:1"/><stop offset=".5" style="stop-color:#4ca352;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30a;stop-opacity:1"/></linearGradient><linearGradient id="c" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="scale(-68) rotate(88.4 .881 -1.396)"><stop offset="0" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".19" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".54" style="stop-color:#49a459;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30b;stop-opacity:1"/></linearGradient><linearGradient id="d" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-88 87.255 68.431) scale(62.42)"><stop offset="0" style="stop-color:#267880;stop-opacity:1"/><stop offset=".51" style="stop-color:#457a5c;stop-opacity:1"/><stop offset="1" style="stop-color:#717516;stop-opacity:1"/></linearGradient><linearGradient id="e" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-79.1 149.53 -14.065) scale(73.28)"><stop offset="0" style="stop-color:#b0d939;stop-opacity:1"/><stop offset="1" style="stop-color:#eadb04;stop-opacity:1"/></linearGradient><linearGradient id="f" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-67.997 148.705 -15.558) scale(69.8226)"><stop offset="0" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".17" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".48" style="stop-color:#99be32;stop-opacity:1"/><stop offset="1" style="stop-color:#c0c40a;stop-opacity:1"/></linearGradient></defs></svg>',eS=btoa(Jx),tS="data:image/svg+xml;charset=utf-8;base64,"+eS,iS=tS,n_=typeof window!==void 0?window.location.search.includes("debugcontext"):!1;var he=(o=>(o.ContextRegistered="ContextRegistered",o.ContextCreationStart="ContextCreationStart",o.ContextCreated="ContextCreated",o.ContextFirstFrameRendered="ContextFirstFrameRendered",o.ContextDestroying="ContextDestroying",o.ContextDestroyed="ContextDestroyed",o.MissingCamera="MissingCamera",o.ContextClearing="ContextClearing",o.ContextCleared="ContextCleared",o))(he||{});class re{static get Current(){return globalThis["NeedleEngine.Context.Current"]}static set Current(t){globalThis["NeedleEngine.Context.Current"]=t}static get All(){return this.Registered}static register(t){this.Registered.indexOf(t)===-1&&(n_&&console.warn("Registering context"),this.Registered.push(t),this.dispatchCallback("ContextRegistered",t))}static unregister(t){const e=this.Registered.indexOf(t);e!==-1&&(n_&&console.warn("Unregistering context"),this.Registered.splice(e,1))}static registerCallback(t,e){this._callbacks[t]||(this._callbacks[t]=[]),this._callbacks[t].push(e)}static unregisterCallback(t,e){if(!this._callbacks[t])return;const i=this._callbacks[t].indexOf(e);i!==-1&&this._callbacks[t].splice(i,1)}static dispatchCallback(t,e,i){if(!this._callbacks[t])return!0;const n={event:t,context:e};if(i)for(const a in i)n[a]=i[a];const s=new Array;return this._callbacks[t].forEach(a=>{const l=a(n);l instanceof Promise&&s.push(l)}),Promise.all(s)}static addContextCreatedCallback(t){this.registerCallback("ContextCreated",t)}static addContextDestroyedCallback(t){this.registerCallback("ContextDestroyed",t)}}r(re,"Registered",[]),r(re,"_callbacks",{});const r0=()=>o=>o;function nS(o){return r0()(o)}function sS(){return!!S("debug")}class ki{constructor(t,e){r(this,"_factory");r(this,"_cache",[]);r(this,"_maxSize");r(this,"_index",0);this._factory=t,this._maxSize=e}get(){const t=this._index%this._maxSize;return this._index++,this._cache.length<=t&&(this._cache[t]=this._factory()),this._cache[t]}}let Jo=!1;const qp=new Array;typeof window<"u"&&setTimeout(()=>{if(Jo){const o={},t=new URL(window.location.href),e=new URL(t);e.searchParams.append("console","");const i=e.toString().replace(/=$|=(?=&)/g,"");for(const s of qp){const a=new URL(t);a.searchParams.append(s,""),o[s]=a.toString().replace(/=$|=(?=&)/g,"")}console.log(`🌵 ?help: Debug Options for Needle Engine.
2
2
  Append any of these parameters to the URL to enable specific debug options.
3
3
  Example: ${i} will show an onscreen console window.`);const n=Jo===!0?"":` (containing "${Jo}")`;console.group("Available URL parameters:"+n);for(const s of Object.keys(o).sort())typeof Jo=="string"&&!s.toLowerCase().includes(Jo.toLowerCase())||(console.groupCollapsed(s),console.log("Reload with this flag enabled:"),console.log(o[s]),console.groupEnd());console.groupEnd()}},100);function Zc(){var o;return new URLSearchParams((o=globalThis.location)==null?void 0:o.search)}function S(o){Jo&&!qp.includes(o)&&qp.push(o);const t=Zc();if(t.has(o)){const e=t.get(o);if(e){const i=Number(e);return isNaN(i)?e:i}else return!0}return!1}Jo=S("help");function oS(o,t){const e=Zc();e.has(o)?e.set(o,t):e.append(o,t),document.location.search=e.toString()}function Oc(o,t,e=!0){const i=Zc();i.has(o)?t===null?i.delete(o):i.set(o,t):t!==null&&i.append(o,t),e?a0(o,i):Vm(o,i)}function Xp(o,t,e){o.has(t)?o.set(t,e.toString()):o.append(t,e.toString())}function a0(o,t,e){window.history.pushState(e,o,"?"+t.toString())}function Vm(o,t,e){window.history.replaceState(e,o,"?"+t.toString())}function rS(o){for(var t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=e.length,n=0;n<o;n++)t+=e.charAt(Math.floor(Math.random()*i));return t}function aS(o,t){return Math.floor(Math.random()*(t-o+1))+o}const s_=["smol","tiny","giant","interesting","smart","bright","dull","extreme","beautiful","pretty","dark","epic","salty","silly","funny","lame","lazy","loud","lucky","mad","mean","mighty","mysterious","nasty","odd","old","powerful","quiet","rapid","scary","shiny","shy","silly","smooth","sour","spicy","stupid","sweet","tasty","terrible","ugly","unusual","vast","wet","wild","witty","wrong","zany","zealous","zippy","zombie","zorro"],o_=["cat","dog","mouse","pig","cow","horse","sheep","chicken","duck","goat","panda","tiger","lion","elephant","monkey","bird","fish","snake","frog","turtle","hamster","penguin","kangaroo","whale","dolphin","crocodile","snail","ant","bee","beetle","butterfly","dragon","eagle","fish","giraffe","lizard","panda","penguin","rabbit","snake","spider","tiger","zebra"];function l0(){const o=s_[Math.floor(Math.random()*s_.length)],t=o_[Math.floor(Math.random()*o_.length)];return o+"_"+t}function c0(o){return o=o.replace(/[^a-z0-9áéíóúñü \.,_-]/gim,""),o.trim()}function za(o,t,e=!0,i=!1){var n;if(t==null)return null;if(t.userData&&t.userData.guid===o)return t;if(t.guid==o)return t;if(i&&(n=t.userData)!=null&&n.components){for(const s of t.userData.components)if(s.guid===o)return s}if(e){if(t.scenes)for(const s in t.scenes){const a=t.scenes[s],l=za(o,a,e,i);if(l)return l}if(t.children)for(const s in t.children){const a=t.children[s],l=za(o,a,e,i);if(l)return l}}}function Jc(o,t){if(o!=null&&typeof o=="object"){let e;Array.isArray(o)?e=[]:(e=Object.create(o),Object.assign(e,o));for(const i of Object.keys(o)){const n=o[i];t&&!t(o,i,n)?e[i]=n:(n==null?void 0:n.clone)!==void 0&&typeof n.clone=="function"?e[i]=n.clone():e[i]=Jc(n,t)}return e}return o}function Jn(o){return new Promise((t,e)=>{setTimeout(t,o)})}function eh(o,t){if(o<=0)return Promise.resolve();if(t||(t=re.Current),!t)return Promise.reject("No context");const e=t.time.frameCount+o;return new Promise((i,n)=>{if(!t)return n("No context");const s=()=>{t.time.frameCount>=e&&(t.pre_update_callbacks.splice(t.pre_update_callbacks.indexOf(s),1),i())};t.pre_update_callbacks.push(s)})}const Kh=S("debugresolveurl"),h0="rel:";function lS(o,t){return Eo(o,t)}function Eo(o,t){if(t===void 0)return Kh&&console.warn("getPath: uri is undefined, returning uri",t),t;if(t.startsWith("./"))return t;if(t.startsWith("http"))return Kh&&console.warn("getPath: uri is absolute, returning uri",t),t;if(o===void 0)return Kh&&console.warn("getPath: source is undefined, returning uri",t),t;t.startsWith(h0)&&(t=t.substring(4));const e=o.lastIndexOf("/");if(e>=0){const i=o.substring(0,e+1);for(;i.endsWith("/")&&t.startsWith("/");)t=t.substring(1);const n=i+t;return Kh&&console.log("source:",o,`changed uri
4
4
  from`,t,`
@@ -142,7 +142,7 @@ Open this page to get the console: `+t.toString())}const o=exports.DeviceUtiliti
142
142
  #__vconsole .vc-mask {
143
143
  overflow: hidden;
144
144
  }
145
- `,wi==null||wi.prepend(i),o===!0&&Hm()<=0&&L0(),console.log("🌵 Debug console has loaded")}},t.onerror=()=>{console.warn("🌵 Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),Rl=!1,Xt=null},t.src="https://cdn.jsdelivr.net/npm/vconsole@3.9.1/dist/vconsole.min.js",document.body.appendChild(t)}function aC(){if(!globalThis.VConsole)return;const o=new VConsole.VConsolePlugin("needle-console","🌵 Inspect glTF"),t=()=>document.querySelector("#__vc_plug_"+o._id+" iframe");return o.on("renderTab",function(e){const i=globalThis["needle:codegen_files"];if(!i||i.length===0)return;let n=globalThis["needle:codegen_files"][0];const s=n.indexOf("?");s>-1&&(n=n.substring(0,s));const l=location.protocol+"//"+location.host+location.pathname+"/"+n,c=encodeURIComponent(l);o.fullUrl="https://viewer.needle.tools?inspect&file="+c;var h='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';e(h)}),o.on("show",function(){const e=t();e&&e.src!==o.fullUrl&&(e.src=o.fullUrl)}),o.on("hide",function(){const e=t();e&&(e.src="")}),o.on("addTopBar",function(e){var i=new Array;i.push({name:"Open in new window ↗",onClick:function(n){window.open(o.fullUrl,"_blank"),Xt==null||Xt.hide()}}),i.push({name:"Reload",onClick:function(n){const s=t();s&&(s.src=o.fullUrl)}}),i.push({name:"Fullscreen",onClick:function(n){const s=t();s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen instanceof Function&&s.webkitRequestFullscreen()}}),e(i)}),o}function lC(){const o=document.querySelector("#__vconsole .vc-switch");return o||null}function cC(){const o=document.querySelector("#__vconsole");return o||null}const j0=S("debugdefines");To('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";');To('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";');To('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";');To('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');To('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.7.3-alpha";');To('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');To('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon Aug 04 2025 16:09:39 GMT+0000 (Coordinated Universal Time)";');To('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const _n="4.7.3-alpha",Fu="undefined",tg="Mon Aug 04 2025 16:09:39 GMT+0000 (Coordinated Universal Time)";j0&&console.log(`Engine version: ${_n} (generator: ${Fu})
145
+ `,wi==null||wi.prepend(i),o===!0&&Hm()<=0&&L0(),console.log("🌵 Debug console has loaded")}},t.onerror=()=>{console.warn("🌵 Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),Rl=!1,Xt=null},t.src="https://cdn.jsdelivr.net/npm/vconsole@3.9.1/dist/vconsole.min.js",document.body.appendChild(t)}function aC(){if(!globalThis.VConsole)return;const o=new VConsole.VConsolePlugin("needle-console","🌵 Inspect glTF"),t=()=>document.querySelector("#__vc_plug_"+o._id+" iframe");return o.on("renderTab",function(e){const i=globalThis["needle:codegen_files"];if(!i||i.length===0)return;let n=globalThis["needle:codegen_files"][0];const s=n.indexOf("?");s>-1&&(n=n.substring(0,s));const l=location.protocol+"//"+location.host+location.pathname+"/"+n,c=encodeURIComponent(l);o.fullUrl="https://viewer.needle.tools?inspect&file="+c;var h='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';e(h)}),o.on("show",function(){const e=t();e&&e.src!==o.fullUrl&&(e.src=o.fullUrl)}),o.on("hide",function(){const e=t();e&&(e.src="")}),o.on("addTopBar",function(e){var i=new Array;i.push({name:"Open in new window ↗",onClick:function(n){window.open(o.fullUrl,"_blank"),Xt==null||Xt.hide()}}),i.push({name:"Reload",onClick:function(n){const s=t();s&&(s.src=o.fullUrl)}}),i.push({name:"Fullscreen",onClick:function(n){const s=t();s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen instanceof Function&&s.webkitRequestFullscreen()}}),e(i)}),o}function lC(){const o=document.querySelector("#__vconsole .vc-switch");return o||null}function cC(){const o=document.querySelector("#__vconsole");return o||null}const j0=S("debugdefines");To('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";');To('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";');To('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";');To('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');To('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.7.3";');To('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');To('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Aug 06 2025 12:10:59 GMT+0000 (Coordinated Universal Time)";');To('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const _n="4.7.3",Fu="undefined",tg="Wed Aug 06 2025 12:10:59 GMT+0000 (Coordinated Universal Time)";j0&&console.log(`Engine version: ${_n} (generator: ${Fu})
146
146
  Project built at ${tg}`);const ba=NEEDLE_PUBLIC_KEY,Es="needle_isActiveInHierarchy",er="builtin_components",cc="needle_editor_guid";function To(o){try{(0,eval)(o)}catch(t){j0&&console.error(t)}}let B0,m_=null;function bn(){return B0}function ig(o){if(o==null){console.warn("Oh no: someone tried registering a non-existend gltf-loader. When you see this log it might mean that needle-engine is being imported multiple times. Please check your project setup.");return}m_!==o&&(m_=o,B0=new o)}const Si=Symbol("shadowDomOwner"),hC=S("debugpatch");function Uu(o,t,e,i){const n=hC===t;if(!e&&!i)return;const s=t+"___needle";uC(o,t,e,i);const a=Object.getOwnPropertyDescriptor(o,t),l=o[t];n&&console.log("Patch",o.constructor.name,t,a,l),a?(n&&console.log("Apply patch with existing descriptor",o.constructor.name,t,a),typeof a.value=="function"&&(o[t]=y_(a.value,o,t))):(n&&console.log("Create patch with new property",o.constructor.name,t,a),Object.defineProperty(o,t,{set:function(c){if(typeof c=="function")this[s]=y_(c,o,t);else{const h=this[s];F0(o,t,this,h,c),this[s]=c,U0(o,t,this,h,c)}},get:function(){const c=this[s];return typeof c=="function"&&c[s]?c[s]:c}}))}function dC(o,t,e){const i=ng(o,t);if(i)for(let n=i.length-1;n>=0;n--){const s=i[n];s.prefix===e&&(s.prefix=null),s.postfix===e&&(s.postfix=null),!s.prefix&&!s.postfix&&i.splice(n,1)}}const g_=Symbol("Needle:Patches:WrappedFunction");function y_(o,t,e){if(o[g_])return o;const i=function(...n){F0(t,e,this,...n);const s=o.apply(this,n);return U0(t,e,this,s,...n),s};return i[g_]=!0,i}const Rd="Needle:Patches";function im(){return globalThis[Rd]||(globalThis[Rd]=new WeakMap),globalThis[Rd]}function ng(o,t){const e=im().get(o);return e?e.get(t):null}function uC(o,t,e,i){let n=im().get(o);n||(n=new Map,im().set(o,n));let s=n.get(t);s||(s=[],n.set(t,s)),s.push({prefix:e,postfix:i})}function F0(o,t,e,...i){var s;if(!e)return;const n=ng(o,t);if(n)for(const a of n)(s=a.prefix)==null||s.call(e,...i)}function U0(o,t,e,i,...n){var a;if(!e)return;const s=ng(o,t);if(s)for(const l of s)(a=l.postfix)==null||a.call(e,i,...n)}const $a=[];function zu(o){$a.indexOf(o)===-1&&$a.push(o)}function fC(o){const t=$a.indexOf(o);t!==-1&&$a.splice(t,1)}const Va=[];function sg(o){Va.indexOf(o)===-1&&Va.push(o)}function pC(o){const t=Va.indexOf(o);t!==-1&&Va.splice(t,1)}function z0(o){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-start",{detail:o}));for(let t=0;t<$a.length;t++)$a[t](o)}function N0(o){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-end",{detail:o}));for(let t=0;t<Va.length;t++)Va[t](o)}const et=S("debuginput");var Nu=(o=>(o.Mouse="mouse",o.Touch="touch",o.Controller="controller",o.Hand="hand",o))(Nu||{}),Re=(o=>(o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerMove="pointermove",o.KeyDown="keydown",o.KeyUp="keyup",o.KeyPressed="keypress",o))(Re||{});class ys extends PointerEvent{constructor(e,i,n){super(e,n);r(this,"clientZ");r(this,"deviceIndex");r(this,"origin");r(this,"source");r(this,"mode");r(this,"_ray");r(this,"space");r(this,"isClick",!1);r(this,"isDoubleClick",!1);r(this,"_used",!1);r(this,"_pointerid");r(this,"_pointerType");r(this,"_type");r(this,"metadata",{});r(this,"intersections",new Array);r(this,"_immediatePropagationStopped",!1);r(this,"_propagationStopped",!1);this.clientZ=n.clientZ,this._pointerid=n.pointerId,this._pointerType=n.pointerType,this._type=e,this.deviceIndex=n.deviceIndex,this.origin=n.origin,this.source=i,this.mode=n.mode,this._ray=n.ray,this.space=n.device}get isSpatial(){return this.mode!="screen"}get ray(){return this._ray||(this._ray=new d.Ray(this.space.worldPosition.clone(),this.space.worldForward.clone())),this._ray}set ray(e){this._ray=e}get hasRay(){return this._ray!==void 0}get used(){return this._used}use(){this._used=!0}get pointerId(){return this._pointerid}get pointerType(){return this._pointerType}get type(){return this._type}get immediatePropagationStopped(){return this._immediatePropagationStopped}get propagationStopped(){return this._immediatePropagationStopped||this._propagationStopped}stopImmediatePropagation(){var e;this._immediatePropagationStopped=!0,super.stopImmediatePropagation(),(e=this.source)==null||e.stopImmediatePropagation()}stopPropagation(){var e;this._propagationStopped=!0,super.stopPropagation(),(e=this.source)==null||e.stopPropagation(),et&&console.warn("Stop propagation...",this.pointerId,this.pointerType)}}class Xl extends KeyboardEvent{constructor(e,i,n){super(e,n);r(this,"source");this.source=i}stopImmediatePropagation(){var e;super.stopImmediatePropagation(),(e=this.source)==null||e.stopImmediatePropagation()}}class mC{constructor(t){r(this,"key");r(this,"keyType");r(this,"source");this.key=t.key,this.keyType=t.type,this.source=t}}var ri=(o=>(o[o.Early=-100]="Early",o[o.Default=0]="Default",o[o.Late=100]="Late",o))(ri||{});class $0{constructor(t){r(this,"_eventListeners",{});r(this,"_doubleClickTimeThreshold",.2);r(this,"_longPressTimeThreshold",1);r(this,"_setCursorTypes",[]);r(this,"context");r(this,"_pointerDown",[!1]);r(this,"_pointerUp",[!1]);r(this,"_pointerClick",[!1]);r(this,"_pointerDoubleClick",[!1]);r(this,"_pointerPressed",[!1]);r(this,"_pointerPositions",[new d.Vector2]);r(this,"_pointerPositionsLastFrame",[new d.Vector2]);r(this,"_pointerPositionsDelta",[new d.Vector2]);r(this,"_pointerPositionsRC",[new d.Vector2]);r(this,"_pointerPositionDown",[new d.Vector3]);r(this,"_pointerDownTime",[]);r(this,"_pointerUpTime",[]);r(this,"_pointerUpTimestamp",[]);r(this,"_pointerIds",[]);r(this,"_pointerTypes",[""]);r(this,"_mouseWheelChanged",[!1]);r(this,"_mouseWheelDeltaY",[0]);r(this,"_pointerEvent",[]);r(this,"_pointerEventsPressed",[]);r(this,"_pointerSpace",[]);r(this,"_pressedStack",new Map);r(this,"_htmlEventSource");r(this,"onLostFocus",()=>{for(const t in this.keysPressed)this.keysPressed[t].pressed=!1});r(this,"_receivedPointerMoveEventsThisFrame",new Array);r(this,"onEndOfFrame",()=>{this._receivedPointerMoveEventsThisFrame.length=0;for(let t=0;t<this._pointerUp.length;t++)this._pointerUp[t]=!1;for(let t=0;t<this._pointerDown.length;t++)this._pointerDown[t]=!1;for(let t=0;t<this._pointerClick.length;t++)this._pointerClick[t]=!1;for(let t=0;t<this._pointerDoubleClick.length;t++)this._pointerDoubleClick[t]=!1;for(const t of this._pointerPositionsDelta)t.set(0,0);for(let t=0;t<this._mouseWheelChanged.length;t++)this._mouseWheelChanged[t]=!1;for(let t=0;t<this._mouseWheelDeltaY.length;t++)this._mouseWheelDeltaY[t]=0});r(this,"onContextMenu",t=>{this.canReceiveInput(t)!==!1&&t instanceof PointerEvent&&t.pointerType});r(this,"keysPressed",{});r(this,"onKeyDown",t=>{if(et&&console.log(`key down ${t.code}, ${this.context.application.hasFocus}`,t),!this.context.application.hasFocus)return;const e=this.keysPressed[t.code];if(e&&e.pressed)return;this.keysPressed[t.code]={pressed:!0,frame:this.context.time.frameCount+1,startFrame:this.context.time.frameCount+1,key:t.key,code:t.code};const i=new Xl("keydown",t,t);this.onDispatchEvent(i)});r(this,"onKeyPressed",t=>{if(!this.context.application.hasFocus)return;const e=this.keysPressed[t.code];if(!e)return;e.pressed=!0,e.frame=this.context.time.frameCount+1;const i=new Xl("keypress",t,t);this.onDispatchEvent(i)});r(this,"onKeyUp",t=>{if(!this.context.application.hasFocus)return;const e=this.keysPressed[t.code];if(!e)return;e.pressed=!1,e.frame=this.context.time.frameCount+1;const i=new Xl("keyup",t,t);this.onDispatchEvent(i)});r(this,"onWheelWindow",t=>{document.pointerLockElement&&this.onMouseWheel(t)});r(this,"onMouseWheel",t=>{if(this.canReceiveInput(t)===!1)return;this._mouseWheelDeltaY.length<=0&&this._mouseWheelDeltaY.push(0),this._mouseWheelChanged.length<=0&&this._mouseWheelChanged.push(!1),this._mouseWheelChanged[0]=!0;const e=this._mouseWheelDeltaY[0];this._mouseWheelDeltaY[0]=e+t.deltaY});r(this,"onPointerDown",t=>{if(this.context.isInAR||this.canReceiveInput(t)===!1)return;t.target instanceof HTMLElement&&t.target.setPointerCapture(t.pointerId);const e=this.getPointerId(t);et&&Ee(`pointer down #${e}, identifier:${t.pointerId}`);const i=this.getAndUpdateSpatialObjectForScreenPosition(e,t.clientX,t.clientY),n=new ys("pointerdown",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:e,button:t.button,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:i,pressure:t.pressure});this.onDown(n)});r(this,"onPointerMove",t=>{if(this.context.isInAR||this._receivedPointerMoveEventsThisFrame.includes(t.pointerId))return;this._receivedPointerMoveEventsThisFrame.push(t.pointerId);let e=t.button;t.pointerType==="mouse"&&(e=this.getFirstPressedButtonForPointer(0)??0);const i=this.getPointerId(t,e);e===-1&&(e=i);const n=this.getAndUpdateSpatialObjectForScreenPosition(i,t.clientX,t.clientY),s=new ys("pointermove",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:i,button:e,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:n,pressure:t.pressure});this.onMove(s)});r(this,"onPointerCancel",t=>{this.context.isInAR||(et&&console.log("Pointer cancel",t),this.onPointerUp(t))});r(this,"onPointerUp",t=>{if(this.context.isInAR)return;t.target instanceof HTMLElement&&t.target.releasePointerCapture(t.pointerId);const e=this.getPointerId(t),i=new ys("pointerup",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:e,button:t.button,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:this.getAndUpdateSpatialObjectForScreenPosition(e,t.clientX,t.clientY),pressure:t.pressure});this.onUp(i),this._pointerIds[e]=-1,et&&console.log("ID="+e,"PointerId="+t.pointerId,"ALL:",[...this._pointerIds])});r(this,"onTouchStart",t=>{if(this.context.isInAR)for(let e=0;e<t.changedTouches.length;e++){const i=t.changedTouches[e],n=this.getPointerIndex(i.identifier),s=this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),a=new ys("pointerdown",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:s,pressure:i.force});this.onDown(a)}});r(this,"onTouchMove",t=>{if(this.context.isInAR)for(let e=0;e<t.changedTouches.length;e++){const i=t.changedTouches[e],n=this.getPointerIndex(i.identifier),s=this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),a=new ys("pointermove",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:s,pressure:i.force});this.onMove(a)}});r(this,"onTouchEnd",t=>{if(this.context.isInAR)for(let e=0;e<t.changedTouches.length;e++){const i=t.changedTouches[e],n=this.getPointerIndex(i.identifier),s=new ys("pointerup",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),pressure:i.force});this.onUp(s),this._pointerIds[n]=-1}});r(this,"tempNearPlaneVector",new d.Vector3);r(this,"tempFarPlaneVector",new d.Vector3);r(this,"tempLookMatrix",new d.Matrix4);this.context=t,this.context.post_render_callbacks.push(this.onEndOfFrame)}addEventListener(t,e,i){if(this._eventListeners[t]||(this._eventListeners[t]=[]),!e||typeof e!="function"){console.error("Invalid call to addEventListener: callback is required and must be a function!");return}i?i={...i}:i={};let n=0;(i==null?void 0:i.queue)!=null&&(n=i.queue);const s=this._eventListeners[t],a=s.find(l=>l.priority===n);a?a.listeners.push({callback:e,options:i}):(s.push({priority:n,listeners:[{callback:e,options:i}]}),s.sort((l,c)=>l.priority-c.priority))}removeEventListener(t,e,i){if(!this._eventListeners[t]||!e)return;const n=this._eventListeners[t];if((i==null?void 0:i.queue)!=null){const s=n.find(l=>l.priority===i.queue);if(!s)return;const a=s.listeners.findIndex(l=>l.callback===e);a>=0&&s.listeners.splice(a,1)}else for(const s of n){const a=s.listeners.findIndex(l=>l.callback===e);a>=0&&s.listeners.splice(a,1)}}dispatchEvent(t){var i,n,s,a;let e=!1;if(t instanceof Xl){const l=this._eventListeners[t.type];if(l)for(const c of l)for(let h=0;h<c.listeners.length;h++){const u=c.listeners[h];if((n=(i=u.options)==null?void 0:i.signal)!=null&&n.aborted){c.listeners.splice(h,1),h--;continue}u.options.once&&(c.listeners.splice(h,1),h--),u.callback(t)}}if(t instanceof ys){const l=this._eventListeners[t.type];if(l)for(const c of l){if(e)break;for(let h=0;h<c.listeners.length;h++){const u=c.listeners[h];if((a=(s=u.options)==null?void 0:s.signal)!=null&&a.aborted){c.listeners.splice(h,1),h--;continue}if(t.immediatePropagationStopped){e=!0,et&&console.log("immediatePropagationStopped",t.type);break}else t.propagationStopped&&(e=!0,et&&console.log("propagationStopped",t.type));u.options.once&&(c.listeners.splice(h,1),h--),u.callback(t)}}}}get mousePosition(){return this._pointerPositions[0]}get mousePositionRC(){return this._pointerPositionsRC[0]}get mouseDown(){return this._pointerDown[0]}get mouseUp(){return this._pointerUp[0]}get mouseClick(){return this._pointerClick[0]}get mouseDoubleClick(){return this._pointerDoubleClick[0]}get mousePressed(){return this._pointerPressed[0]}get mouseWheelChanged(){return this.getMouseWheelChanged(0)}get click(){return this._pointerClick[0]}get doubleClick(){return this._pointerDoubleClick[0]}getGamepad(t=0){return typeof navigator<"u"&&"getGamepads"in navigator&&navigator.getGamepads()[t]||null}setCursorPointer(){this.setCursor("pointer")}setCursorNormal(){this.unsetCursor("pointer")}setCursor(t){this._setCursorTypes.push(t),this._setCursorTypes.length>10&&this._setCursorTypes.shift(),this.updateCursor()}unsetCursor(t){for(let e=this._setCursorTypes.length-1;e>=0;e--)if(this._setCursorTypes[e]===t){this._setCursorTypes.splice(e,1),this.updateCursor();break}}updateCursor(){var t;((t=this._setCursorTypes)==null?void 0:t.length)==0?this.context.domElement.style.cursor="default":this.context.domElement.style.cursor=this._setCursorTypes[this._setCursorTypes.length-1]}getIsPointerIdInUse(t){for(const e of this._pointerEventsPressed)if(e.pointerId===t&&e.used)return!0;return!1}getPointerPressedCount(){let t=0;for(let e=0;e<this._pointerPressed.length;e++)this._pointerPressed[e]&&t++;return t}getPointerPosition(t){return t>=this._pointerPositions.length?null:this._pointerPositions[t]}getPointerPositionLastFrame(t){return t>=this._pointerPositionsLastFrame.length?null:this._pointerPositionsLastFrame[t]}getPointerPositionDelta(t){return t>=this._pointerPositionsDelta.length?null:this._pointerPositionsDelta[t]}getPointerPositionRC(t){return t>=this._pointerPositionsRC.length?null:this._pointerPositionsRC[t]}getPointerDown(t){return t>=this._pointerDown.length?!1:this._pointerDown[t]}getPointerUp(t){return t>=this._pointerUp.length?!1:this._pointerUp[t]}getPointerPressed(t){return t>=this._pointerPressed.length?!1:this._pointerPressed[t]}getPointerClicked(t){return t>=this._pointerClick.length?!1:this._pointerClick[t]}getPointerDoubleClicked(t){return t>=this._pointerDoubleClick.length?!1:this._pointerDoubleClick[t]}getPointerDownTime(t){return t>=this._pointerDownTime.length?-1:this._pointerDownTime[t]}getPointerUpTime(t){return t>=this._pointerUpTime.length?-1:this._pointerUpTime[t]}getPointerLongPress(t){return t>=this._pointerDownTime.length?!1:this.getPointerPressed(t)&&this.context.time.time-this._pointerDownTime[t]>this._longPressTimeThreshold}getIsMouse(t){return t<0||t>=this._pointerTypes.length?!1:this._pointerTypes[t]==="mouse"}getIsTouch(t){return t<0||t>=this._pointerTypes.length?!1:this._pointerTypes[t]==="touch"}getTouchesPressedCount(){let t=0;for(let e=0;e<this._pointerPressed.length;e++)this._pointerPressed[e]&&this.getIsTouch(e)&&t++;return t}getMouseWheelChanged(t=0){return t>=this._mouseWheelChanged.length?!1:this._mouseWheelChanged[t]}getMouseWheelDeltaY(t=0){return t>=this._mouseWheelDeltaY.length?0:this._mouseWheelDeltaY[t]}getPointerEvent(t){if(!(t>=this._pointerEvent.length))return this._pointerEvent[t]??void 0}*foreachPointerId(t){for(let e=0;e<this._pointerTypes.length;e++)if(this._pointerIsActive(e)){if(t!==void 0){const i=this._pointerTypes[e];if(Array.isArray(t)){let n=!1;for(const s of t)if(i===s){n=!0;break}if(!n)continue}else if(t!==i)continue}yield e}}*foreachTouchId(){for(let t=0;t<this._pointerTypes.length;t++)this._pointerTypes[t]==="touch"&&this._pointerIsActive[t]&&(yield t)}_pointerIsActive(t){return t<0?!1:this._pointerPressed[t]||this._pointerDown[t]||this._pointerUp[t]}onDownButton(t,e){let i=this._pressedStack.get(t);i||(i=[],this._pressedStack.set(t,i)),i.push(e)}onReleaseButton(t,e){const i=this._pressedStack.get(t);if(!i)return;const n=i.indexOf(e);n>=0&&i.splice(n,1)}getFirstPressedButtonForPointer(t){const e=this._pressedStack.get(t);if(e)return e[0]}getLatestPressedButtonForPointer(t){const e=this._pressedStack.get(t);if(e)return e[e.length-1]}getKeyDown(t){if(t!==void 0)return this.isKeyDown(t);for(const e in this.keysPressed){const i=this.keysPressed[e];if(i.startFrame===this.context.time.frameCount)return i.key}return null}getKeyPressed(t){if(t!==void 0)return this.isKeyPressed(t);for(const e in this.keysPressed){const i=this.keysPressed[e];if(i.pressed)return i.key}return null}getKeyUp(t){if(t!==void 0)return this.isKeyUp(t);for(const e in this.keysPressed){const i=this.keysPressed[e];return i.pressed===!1&&i.frame===this.context.time.frameCount}return null}isKeyDown(t){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const e=this.getCodeForCommonKeyName(t);if(e!==null){for(const n of e)if(this.isKeyDown(n))return!0;return!1}const i=this.keysPressed[t];return i?i.startFrame===this.context.time.frameCount&&i.pressed:!1}isKeyUp(t){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const e=this.getCodeForCommonKeyName(t);if(e!==null){for(const n of e)if(this.isKeyUp(n))return!0;return!1}const i=this.keysPressed[t];return i?i.frame===this.context.time.frameCount&&i.pressed===!1:!1}isKeyPressed(t){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const e=this.getCodeForCommonKeyName(t);if(e!==null){for(const n of e)if(this.isKeyPressed(n))return!0;return!1}const i=this.keysPressed[t];return i&&i.pressed||!1}getCodeForCommonKeyName(t){if(t.length===1){if(t>="0"&&t<="9")return["Digit"+t];if(t>="a"&&t<="z")return["Key"+t.toUpperCase()];if(t==" ")return["Space"]}switch(t){case"shift":case"Shift":return["ShiftLeft","ShiftRight"];case"control":case"Control":return["ControlLeft","ControlRight"];case"alt":case"Alt":return["AltLeft","AltRight"]}return null}createInputEvent(t){switch(t.type){case"pointerdown":et&&Ee("Create Pointer down"),this.onDownButton(t.deviceIndex,t.button),this.onDown(t);break;case"pointermove":et&&Ee("Create Pointer move"),this.onMove(t);break;case"pointerup":et&&Ee("Create Pointer up"),this.onUp(t),this.onReleaseButton(t.deviceIndex,t.button);break}}convertScreenspaceToRaycastSpace(t){return t.x=(t.x-this.context.domX)/this.context.domWidth*2-1,t.y=-((t.y-this.context.domY)/this.context.domHeight)*2+1,t}bindEvents(){this.unbindEvents(),this._htmlEventSource=this.context.renderer.domElement,window.addEventListener("contextmenu",this.onContextMenu),this._htmlEventSource.addEventListener("pointerdown",this.onPointerDown,{passive:!0}),window.addEventListener("pointermove",this.onPointerMove,{passive:!0,capture:!0}),window.addEventListener("pointerup",this.onPointerUp,{passive:!0}),window.addEventListener("pointercancel",this.onPointerCancel,{passive:!0}),window.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),this._htmlEventSource.addEventListener("wheel",this.onMouseWheel,{passive:!0}),window.addEventListener("wheel",this.onWheelWindow,{passive:!0}),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keypress",this.onKeyPressed,!1),window.addEventListener("keyup",this.onKeyUp,!1),window.addEventListener("blur",this.onLostFocus)}unbindEvents(){var t,e;for(const i in this._eventListeners)this._eventListeners[i].length=0;window.removeEventListener("contextmenu",this.onContextMenu),(t=this._htmlEventSource)==null||t.removeEventListener("pointerdown",this.onPointerDown),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerCancel),window.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),(e=this._htmlEventSource)==null||e.removeEventListener("wheel",this.onMouseWheel,!1),window.removeEventListener("wheel",this.onWheelWindow,!1),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keypress",this.onKeyPressed,!1),window.removeEventListener("keyup",this.onKeyUp,!1),window.removeEventListener("blur",this.onLostFocus)}dispose(){const t=this.context.post_render_callbacks.indexOf(this.onEndOfFrame);t>=0&&this.context.post_render_callbacks.splice(t,1),this.unbindEvents()}canReceiveInput(t){var e;return t.target===((e=this.context.renderer)==null?void 0:e.domElement)||t.target===this.context.domElement||this.context.isInAR||this.context.isInAR&&t.target===document.body&&exports.DeviceUtilities.isMozillaXR()?!0:(et&&console.warn("CanReceiveInput:False for",t.target),!1)}getPointerId(t,e){return t.pointerType==="mouse"?0+(e??t.button):this.getPointerIndex(t.pointerId)}getButtonName(t){const e=t.button;if(t.pointerType==="mouse")switch(e){case 0:return"left";case 1:return"middle";case 2:return"right"}return"unknown"}getAndUpdateSpatialObjectForScreenPosition(t,e,i){let n=this._pointerSpace[t];n||(n=new d.Object3D,this._pointerSpace[t]=n),this._pointerSpace[t]=n;const s=this.context.mainCamera;if(s){const a=this.tempNearPlaneVector.set(e,i,-1);this.convertScreenspaceToRaycastSpace(a);const l=this.tempFarPlaneVector.set(a.x,a.y,1);a.unproject(s),l.unproject(s);const c=s.worldUp||V(0,1,0).applyQuaternion(_e(s));this.tempLookMatrix.lookAt(l,a,c),n.position.set(a.x,a.y,a.z),n.quaternion.setFromRotationMatrix(this.tempLookMatrix)}return n}isInRect(t){if(this.context.isInXR)return!0;const e=this.context.domElement.getBoundingClientRect(),i=t.clientX,n=t.clientY,s=i>=e.x&&i<=e.right&&n>=e.y&&n<=e.bottom;return et&&!s&&console.log("Not in rect",e,i,n),s}onDown(t){const e=t.pointerId;if(this.getPointerPressed(e)&&console.warn(`Received pointerDown for pointerId that is already pressed: ${e}`,et?t:""),et&&console.log(t.pointerType,"DOWN",e),!!this.isInRect(t)){for(this.setPointerState(e,this._pointerPressed,!0),this.setPointerState(e,this._pointerDown,!0),this.setPointerStateT(e,this._pointerEvent,t.source);e>=this._pointerTypes.length;)this._pointerTypes.push(t.pointerType);for(this._pointerTypes[e]=t.pointerType;e>=this._pointerPositionDown.length;)this._pointerPositionDown.push(new d.Vector3);for(this._pointerPositionDown[e].set(t.clientX,t.clientY,t.clientZ??0);e>=this._pointerPositions.length;)this._pointerPositions.push(new d.Vector2);this._pointerPositions[e].set(t.clientX,t.clientY),e>=this._pointerDownTime.length&&this._pointerDownTime.push(0),this._pointerDownTime[e]=this.context.time.realtimeSinceStartup,this.updatePointerPosition(t),this._pointerEventsPressed.push(t),this.onDispatchEvent(t)}}onMove(t){const e=t.pointerId,i=this.getPointerPressed(e);i===!1&&!this.isInRect(t)||t.pointerType==="touch"&&!i||(this.updatePointerPosition(t),this.setPointerStateT(e,this._pointerEvent,t.source),this.onDispatchEvent(t))}onUp(t){const e=t.pointerId;if(!this.getPointerPressed(e)){et&&console.log(t.pointerType,"UP",e,"was not down");return}et&&console.log(t.pointerType,"UP",e),this.setPointerState(e,this._pointerPressed,!1),this.setPointerStateT(e,this._pointerEvent,t.source),this.setPointerState(e,this._pointerUp,!0),this.updatePointerPosition(t);for(let c=this._pointerEventsPressed.length-1;c>=0;c--)if(this._pointerEventsPressed[c].pointerId===e){this._pointerEventsPressed.splice(c,1);break}if(!this._pointerPositionDown[e]){et&&me("Received pointer up event without matching down event for button: "+e),console.warn("Received pointer up event without matching down event for button: "+e);return}const n=this._pointerUpTime[e],s=this._pointerDownTime[e],a=this.context.time.realtimeSinceStartup,l=a-s;if(e>=this._pointerUpTime.length&&this._pointerUpTime.push(-99),this._pointerUpTime[e]=a,l<1){let c=t.clientX-this._pointerPositionDown[e].x,h=t.clientY-this._pointerPositionDown[e].y,u=0;if(t.isSpatial&&t.clientZ!=null&&(u=t.clientZ-this._pointerPositionDown[e].z,c*=200,h*=200,u*=200),Math.abs(c)<5&&Math.abs(h)<5&&Math.abs(u)<5){this.setPointerState(e,this._pointerClick,!0),t.isClick=!0;const f=a-n;et&&console.log("CLICK",e,c,h,u,f),f<this._doubleClickTimeThreshold&&f>0&&(this.setPointerState(e,this._pointerDoubleClick,!0),t.isDoubleClick=!0)}}this.onDispatchEvent(t)}updatePointerPosition(t){const e=t.pointerId;for(;e>=this._pointerPositions.length;)this._pointerPositions.push(new d.Vector2);for(;e>=this._pointerPositionsLastFrame.length;)this._pointerPositionsLastFrame.push(new d.Vector2);for(;e>=this._pointerPositionsDelta.length;)this._pointerPositionsDelta.push(new d.Vector2);const i=this._pointerPositionsLastFrame[e];i.copy(this._pointerPositions[e]);const n=this._pointerPositionsDelta[e];let s=t.clientX-i.x,a=t.clientY-i.y;if(t.source instanceof MouseEvent||t.source instanceof TouchEvent){const u=t.source;s===0&&u.movementX!==0&&(s=u.movementX||0),a===0&&u.movementY!==0&&(a=u.movementY||0)}n.x+=s,n.y+=a,this._pointerPositions[e].x=t.clientX,this._pointerPositions[e].y=t.clientY;const l=t.clientX,c=t.clientY;for(;e>=this._pointerPositionsRC.length;)this._pointerPositionsRC.push(new d.Vector2);const h=this._pointerPositionsRC[e];h.set(l,c),this.convertScreenspaceToRaycastSpace(h)}getPointerIndex(t){let e=-1;for(let i=0;i<this._pointerIds.length;i++){if(this._pointerIds[i]===t)return i;e===-1&&this._pointerIds[i]===-1&&(e=i)}return e!==-1?(this._pointerIds[e]=t,e):(et&&console.log("PUSH pointerId:",t),this._pointerIds.push(t),this._pointerIds.length-1)}setPointerState(t,e,i){e[t]=i}setPointerStateT(t,e,i){return e[t]=i,i}onDispatchEvent(t){const e=X.Current;try{X.Current=this.context,this.dispatchEvent(t)}finally{X.Current=e}}}const Aa=new d.Matrix4().makeRotationY(Math.PI),Ni=new d.Quaternion().setFromAxisAngle(new d.Vector3(0,1,0),Math.PI),gC=S("debugwebxr");class yC{constructor(){r(this,"priority",-1e5);r(this,"gameObject");if(this.gameObject=new d.Object3D,this.gameObject.name="Implicit XR Rig",gC){const t=dg(16733661);t.position.y+=.5,this.gameObject.add(t)}}isXRRig(){return!0}get isActive(){return this.gameObject.visible}}const hs=S("debugwebxr"),Jh=S("debugcustomgesture"),_C="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",bC="generic-trigger",vC=new d.Quaternion().setFromEuler(new d.Euler(d.MathUtils.degToRad(0),d.MathUtils.degToRad(-90),d.MathUtils.degToRad(-90))),wC=new d.Vector3(.04,-.04,0);class og{constructor(t,e,i){r(this,"xr");r(this,"inputSource");r(this,"index",0);r(this,"emitEvents",!0);r(this,"_connected",!0);r(this,"_isTracking",!1);r(this,"__gamepad");r(this,"__hand");r(this,"__side");r(this,"_hitTestSource");r(this,"_hasSelectEvent",!1);r(this,"_isMxInk",!1);r(this,"_isMetaQuestTouchController",!1);r(this,"_handJointPoses",new Map);r(this,"_gripMatrix",new d.Matrix4);r(this,"_gripPosition",new d.Vector3);r(this,"_gripQuaternion",new d.Quaternion);r(this,"_linearVelocity",new d.Vector3);r(this,"_rayPositionRaw",new d.Vector3);r(this,"_rayRotationRaw",new d.Quaternion);r(this,"_rayMatrix",new d.Matrix4);r(this,"_rayPosition",new d.Vector3);r(this,"_rayQuaternion",new d.Quaternion);r(this,"_gripWorldPosition",new d.Vector3);r(this,"_gripWorldQuaternion",new d.Quaternion);r(this,"_rayWorldPosition",new d.Vector3);r(this,"_rayWorldQuaternion",new d.Quaternion);r(this,"_pinchPosition",new d.Vector3);r(this,"_ray");r(this,"_hand_wristDotUp");r(this,"_object");r(this,"_gripSpaceObject");r(this,"_raySpaceObject");r(this,"model",null);r(this,"_debugAxesHelper",new d.AxesHelper(.15));r(this,"_debugGripAxesHelper",new d.AxesHelper(.07));r(this,"_debugRayAxesHelper",new d.AxesHelper(.07));r(this,"_hitTestSourcePromise",null);r(this,"onPointerHits",t=>{});r(this,"_needleGamepadButtons",{});r(this,"_buttonMap",new Map);r(this,"_motioncontroller");r(this,"_layout");r(this,"getMotionController");r(this,"emitPointerDownEvent",!0);r(this,"emitPointerUpEvent",!0);r(this,"emitPointerMoveEvent",!0);r(this,"pointerMoveDistanceThreshold",.03);r(this,"pointerMoveAngleThreshold",.05);r(this,"_selectButtonIndex");r(this,"_squeezeButtonIndex");r(this,"onSelectStart",t=>{var n,s,a,l;if(!this.emitPointerDownEvent||this.inputSource!==t.inputSource)return;this.onUpdateFrame(t.frame),this._hasSelectEvent=!0;const e=(n=this._layout)==null?void 0:n.selectComponentId,i=(l=(a=(s=this._layout)==null?void 0:s.components[e])==null?void 0:a.gamepadIndices)==null?void 0:l.button;i!==void 0&&(this._selectButtonIndex=i),!Jh&&(hs&&$.DrawDirection(this.rayWorldPosition,V(0,.01,1).applyQuaternion(this.rayWorldQuaternion),16711680,10),this.emitPointerEvent(Re.PointerDown,this._selectButtonIndex||0,"xr-standard-trigger",!0,t))});r(this,"onSelectEnd",t=>{this.emitPointerUpEvent&&(Jh||this.inputSource===t.inputSource&&this.emitPointerEvent(Re.PointerUp,this._selectButtonIndex||0,"xr-standard-trigger",!0,t))});r(this,"onSequeezeStart",t=>{var e,i,n;this.emitPointerDownEvent&&this.inputSource===t.inputSource&&(this._squeezeButtonIndex=(n=(i=(e=this._layout)==null?void 0:e.components["xr-standard-squeeze"])==null?void 0:i.gamepadIndices)==null?void 0:n.button,this._squeezeButtonIndex!==void 0&&(hs&&$.DrawDirection(this.rayWorldPosition,V(0,.01,1).applyQuaternion(this.rayWorldQuaternion),255,10),this.emitPointerEvent(Re.PointerDown,this._squeezeButtonIndex||0,"xr-standard-squeeze",!0,t)))});r(this,"onSequeezeEnd",t=>{this.emitPointerUpEvent&&this.inputSource===t.inputSource&&this._squeezeButtonIndex!==void 0&&this.emitPointerEvent(Re.PointerUp,this._squeezeButtonIndex||0,"xr-standard-squeeze",!0,t)});r(this,"states",{});r(this,"_didMoveLastFrame",!1);r(this,"_lastPointerMovePosition",new d.Vector3);r(this,"_lastPointerMoveQuaternion",new d.Quaternion);r(this,"pointerInit");this.xr=t,this.inputSource=e,this.index=i,this._object=new d.Object3D,this._object.name=`NeedleXRController_${i}`,hs&&(this._object.add(this._debugAxesHelper),this._gripSpaceObject=new d.Object3D,this._raySpaceObject=new d.Object3D,this._gripSpaceObject.name=`NeedleXRController_${i}_gripSpace`,this._raySpaceObject.name=`NeedleXRController_${i}_raySpace`,this._gripSpaceObject.add(this._debugGripAxesHelper),this._raySpaceObject.add(this._debugRayAxesHelper),this.xr.context.scene.add(this._gripSpaceObject),this.xr.context.scene.add(this._raySpaceObject)),this.xr.context.scene.add(this._object),this._ray=new d.Ray,this.pointerInit={origin:this,pointerType:this.hand?"hand":"controller",deviceIndex:this.index,pointerId:-1,mode:this.inputSource.targetRayMode,ray:this._ray,device:this._object,buttonName:"none"},this.initialize(),this.subscribeEvents()}get context(){return this.xr.context}get connected(){return this._connected}get isTracking(){return this._isTracking}get gamepad(){return this.__gamepad??(this.__gamepad=this.inputSource.gamepad)}get isHand(){return this.hand!=null}get hand(){return this.__hand??(this.__hand=this.inputSource.hand)}get handObject(){return this.context.renderer.xr.getHand(this.index)}get profiles(){return this.inputSource.profiles}get layout(){return this._layout}get targetRayMode(){return this.inputSource.targetRayMode}get targetRaySpace(){return this.inputSource.targetRaySpace}get gripSpace(){return this.inputSource.gripSpace}get side(){return this.__side??(this.__side=this.inputSource.handedness)}get isRight(){return this.side==="right"}get isLeft(){return this.side==="left"}get isStylus(){return this._isMxInk}getHitTestSource(){return this._hitTestSource||this._requestHitTestSource(),this._hitTestSource}get hasHitTestSource(){return this._hitTestSource}cancelHitTestSource(){this._hitTestSource&&(this._hitTestSource.cancel(),this._hitTestSource=void 0)}get hasSelectEvent(){return this._hasSelectEvent}getHitTest(){return this.xr.getHitTest(this)}getHandJointPose(t,e){var n;if(e=e||this.xr.frame,!this.hand||!(e!=null&&e.getJointPose)||!this.xr.referenceSpace)return null;let i=(n=this._handJointPoses)==null?void 0:n.get(t);return i||(i=e.getJointPose(t,this.xr.referenceSpace),i&&this._handJointPoses.set(t,i),i)}get gripPosition(){return V(this._gripPosition)}get gripQuaternion(){return un(this._gripQuaternion)}get gripMatrix(){return this._gripMatrix}get gripLinearVelocity(){return V(this._linearVelocity).applyQuaternion(Ni)}get rayPosition(){return V(this._rayPosition)}get rayQuaternion(){return un(this._rayQuaternion)}get gripWorldPosition(){return V(this._gripWorldPosition)}get gripWorldQuaternion(){return un(this._gripWorldQuaternion)}get rayWorldPosition(){return V(this._rayWorldPosition)}updateRayWorldPosition(){var e;const t=(e=this.xr.context.mainCamera)==null?void 0:e.parent;this._rayWorldPosition.copy(this._rayPositionRaw),t&&this._rayWorldPosition.applyMatrix4(t.matrixWorld)}get rayWorldQuaternion(){return un(this._rayWorldQuaternion)}get pinchPosition(){return V(this._pinchPosition)}updateRayWorldQuaternion(){var i;const t=(i=this.xr.context.mainCamera)==null?void 0:i.parent,e=t?_e(t):void 0;this._rayWorldQuaternion.copy(this._rayRotationRaw).multiply(Ni),e&&this._rayWorldQuaternion.premultiply(e)}get ray(){return this._ray.origin.copy(this.rayWorldPosition),this._ray.direction.copy(V(0,0,1).applyQuaternion(this.rayWorldQuaternion)),this._ray}get handWristDotUp(){var e;if(this._hand_wristDotUp!==void 0)return this._hand_wristDotUp;const t=(e=this.handObject)==null?void 0:e.joints.wrist;if(t){const i=V(0,1,0).applyQuaternion(t.quaternion),n=V(0,1,0).dot(i);return this._hand_wristDotUp=n}}get isHandUpsideDown(){return this.handWristDotUp!==void 0?this.handWristDotUp<-.7:!1}get isTeleportGesture(){var t;return this.isHandUpsideDown&&((t=this.getGesture("pinch"))==null?void 0:t.isDown)}get object(){return this._object}async getModelUrl(){var t;return(t=this.getMotionController)==null?void 0:t.then(e=>(e==null?void 0:e.assetUrl)||null)}_requestHitTestSource(){var t;return this._hitTestSourcePromise?this._hitTestSourcePromise:this.xr.mode==="immersive-ar"&&this.inputSource.targetRayMode==="tracked-pointer"&&this.xr.session.requestHitTestSourceForTransientInput?this._hitTestSourcePromise=((t=this.xr.session.requestHitTestSourceForTransientInput({profile:this.inputSource.profiles[0],offsetRay:new XRRay}))==null?void 0:t.then(e=>(this._hitTestSourcePromise=null,this.connected?this._hitTestSource=e:(e.cancel(),null))))??null:null}onUpdate(t){this.onUpdateFrame(t),this.updateInputEvents(),this.onUpdateMove()}onRenderDebug(){var s;$.DrawSphere(this.rayWorldPosition,.003),$.DrawDirection(this.rayWorldPosition,V(0,0,10).applyQuaternion(this.rayWorldQuaternion));const e=(this.inputSource.gripSpace?this.gripWorldPosition:this.object.worldPosition).sub(this.object.worldForward.multiplyScalar(.1)),i=this.inputSource.profiles.join(`
147
147
  `);let n=`Controller[${this.index}] (${this.inputSource.targetRayMode}, ${this.side})
148
148
  C:${this.connected?"x":"-"} T:${this.isTracking?"x":"-"} Hand:${this.inputSource.hand?"x":"-"} Pen: ${this._isMxInk?"x":"-"}`;if(this.inputSource.hand&&(n+=`
@@ -211,7 +211,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
211
211
  irradiance += 0.;
212
212
  #else
213
213
  irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
214
- #endif`);d.UniformsLib.lightmap.lightmapScaleOffset={value:new d.Vector4(1,1,0,0)};const sp=S("debugprogressive"),sd=new d.Box3,od=new d.Sphere;class L1{constructor(t){r(this,"context");r(this,"_lodsManager");r(this,"_settings",{});this.context=t}get manager(){return this._lodsManager}get skinnedMeshAutoUpdateBoundsInterval(){var t;return((t=this._lodsManager)==null?void 0:t.skinnedMeshAutoUpdateBoundsInterval)||this._settings.skinnedMeshAutoUpdateBoundsInterval||0}set skinnedMeshAutoUpdateBoundsInterval(t){this._settings.skinnedMeshAutoUpdateBoundsInterval=t,this.applySettings()}get targetTriangleDensity(){var t;return((t=this._lodsManager)==null?void 0:t.targetTriangleDensity)||this._settings.targetTriangleDensity||2e5}set targetTriangleDensity(t){this._settings.targetTriangleDensity=t,this.applySettings()}applySettings(){if(this._lodsManager)for(const t in this._settings)this._lodsManager[t]=this._settings[t]}setRenderer(t){var e;(e=this._lodsManager)==null||e.disable(),le.LODsManager.removePlugin(this),le.LODsManager.addPlugin(this),le.LODsManager.debugDrawLine=$.DrawLine,this._lodsManager=le.LODsManager.get(t),this.applySettings(),this._lodsManager.enable()}disable(){var t;(t=this._lodsManager)==null||t.disable(),le.LODsManager.removePlugin(this)}onAfterUpdatedLOD(t,e,i,n,s){sp&&this.onRenderDebug(i,n,s)}onRenderDebug(t,e,i){var l,c,h;if(!e.geometry||!le.NEEDLE_progressive.hasLODLevelAvailable(e.geometry)&&!le.NEEDLE_progressive.hasLODLevelAvailable(e.material))return;const n=le.LODsManager.getObjectLODState(e);if(!n)return;let s=i.mesh_lod;const a=i.mesh_lod!=n.lastLodLevel_Mesh||i.texture_lod!=n.lastLodLevel_Texture;if(sp&&e.geometry.boundingSphere){const u=e.geometry.boundingSphere;od.copy(u),od.applyMatrix4(e.matrixWorld);const f=od.center,p=od.radius,g=["#76c43e","#bcc43e","#c4ac3e","#c4673e","#ff3e3e"];if(a)$.DrawWireSphere(f,p,g[s],.1);else{const y=((l=e.geometry.index)==null?void 0:l.count)??0,b=(c=le.NEEDLE_progressive.getMeshLODExtension(e.geometry))==null?void 0:c.lods;s=b?Math.min((b==null?void 0:b.length)-1,s):0;let _="";if(b&&n.lastScreenCoverage>0)for(let x=0;x<b.length;x++){const O=b[x].density,E=x==b.length-1;_+=O.toFixed(0)+">"+(O/n.lastScreenCoverage).toFixed(0)+(E?"":",")}const v=b?(h=b[s])==null?void 0:h.density:-1;let w="LOD "+i.mesh_lod+`
214
+ #endif`);d.UniformsLib.lightmap.lightmapScaleOffset={value:new d.Vector4(1,1,0,0)};const sp=S("debugprogressive"),sd=new d.Box3,od=new d.Sphere;class L1{constructor(t){r(this,"context");r(this,"_lodsManager");r(this,"_settings",{});this.context=t}get manager(){return this._lodsManager}get skinnedMeshAutoUpdateBoundsInterval(){var t;return((t=this._lodsManager)==null?void 0:t.skinnedMeshAutoUpdateBoundsInterval)||this._settings.skinnedMeshAutoUpdateBoundsInterval||0}set skinnedMeshAutoUpdateBoundsInterval(t){this._settings.skinnedMeshAutoUpdateBoundsInterval=t,this.applySettings()}get targetTriangleDensity(){var t;return((t=this._lodsManager)==null?void 0:t.targetTriangleDensity)||this._settings.targetTriangleDensity||2e5}set targetTriangleDensity(t){this._settings.targetTriangleDensity=t,this.applySettings()}applySettings(){if(this._lodsManager)for(const t in this._settings)this._lodsManager[t]=this._settings[t]}setRenderer(t){var e;(e=this._lodsManager)==null||e.disable(),le.LODsManager.removePlugin(this),le.LODsManager.addPlugin(this),le.LODsManager.debugDrawLine=$.DrawLine,this._lodsManager=le.LODsManager.get(t,{engine:"needle-engine"}),this.applySettings(),this._lodsManager.enable()}disable(){var t;(t=this._lodsManager)==null||t.disable(),le.LODsManager.removePlugin(this)}onAfterUpdatedLOD(t,e,i,n,s){sp&&this.onRenderDebug(i,n,s)}onRenderDebug(t,e,i){var l,c,h;if(!e.geometry||!le.NEEDLE_progressive.hasLODLevelAvailable(e.geometry)&&!le.NEEDLE_progressive.hasLODLevelAvailable(e.material))return;const n=le.LODsManager.getObjectLODState(e);if(!n)return;let s=i.mesh_lod;const a=i.mesh_lod!=n.lastLodLevel_Mesh||i.texture_lod!=n.lastLodLevel_Texture;if(sp&&e.geometry.boundingSphere){const u=e.geometry.boundingSphere;od.copy(u),od.applyMatrix4(e.matrixWorld);const f=od.center,p=od.radius,g=["#76c43e","#bcc43e","#c4ac3e","#c4673e","#ff3e3e"];if(a)$.DrawWireSphere(f,p,g[s],.1);else{const y=((l=e.geometry.index)==null?void 0:l.count)??0,b=(c=le.NEEDLE_progressive.getMeshLODExtension(e.geometry))==null?void 0:c.lods;s=b?Math.min((b==null?void 0:b.length)-1,s):0;let _="";if(b&&n.lastScreenCoverage>0)for(let x=0;x<b.length;x++){const O=b[x].density,E=x==b.length-1;_+=O.toFixed(0)+">"+(O/n.lastScreenCoverage).toFixed(0)+(E?"":",")}const v=b?(h=b[s])==null?void 0:h.density:-1;let w="LOD "+i.mesh_lod+`
215
215
  TEX `+i.texture_lod;if(sp=="density"&&(w+=`
216
216
  `+y+` tris
217
217
  `+(v/n.lastScreenCoverage).toFixed(0)+` dens
@@ -925,7 +925,7 @@ Exit Time: `+u,a.hasExitTime)}this.transitionTo(a.destinationState,a.duration,a.
925
925
  // Uncomment to visualize blur amount
926
926
  // gl_FragColor = vec4(blurAmount, 0.0, 0.0, 1.0);
927
927
  }
928
- `;var OP=Object.defineProperty,Rg=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&OP(t,e,n),n};class Ur extends I{constructor(){super(...arguments);r(this,"constraintActive",!0);r(this,"locked",!1);r(this,"sources",[])}}Rg([m()],Ur.prototype,"constraintActive");Rg([m()],Ur.prototype,"locked");Rg([m(d.Object3D)],Ur.prototype,"sources");let Sr=class{constructor(){r(this,"bb",null);r(this,"bb_pos",0)}__init(t,e){return this.bb_pos=t,this.bb=e,this}x(){return this.bb.readFloat32(this.bb_pos)}y(){return this.bb.readFloat32(this.bb_pos+4)}z(){return this.bb.readFloat32(this.bb_pos+8)}static sizeOf(){return 12}static createVec3(t,e,i,n){return t.prep(4,12),t.writeFloat32(n),t.writeFloat32(i),t.writeFloat32(e),t.offset()}};class aw{constructor(){r(this,"bb",null);r(this,"bb_pos",0)}__init(t,e){return this.bb_pos=t,this.bb=e,this}position(t){return(t||new Sr).__init(this.bb_pos,this.bb)}rotation(t){return(t||new Sr).__init(this.bb_pos+12,this.bb)}scale(t){return(t||new Sr).__init(this.bb_pos+24,this.bb)}static sizeOf(){return 36}static createTransform(t,e,i,n,s,a,l,c,h,u){return t.prep(4,36),t.prep(4,12),t.writeFloat32(u),t.writeFloat32(h),t.writeFloat32(c),t.prep(4,12),t.writeFloat32(l),t.writeFloat32(a),t.writeFloat32(s),t.prep(4,12),t.writeFloat32(n),t.writeFloat32(i),t.writeFloat32(e),t.offset()}}class Ss{constructor(){r(this,"bb",null);r(this,"bb_pos",0)}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSyncedTransformModel(t,e){return(e||new Ss).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSyncedTransformModel(t,e){return t.setPosition(t.position()+ae.SIZE_PREFIX_LENGTH),(e||new Ss).__init(t.readInt32(t.position())+t.position(),t)}guid(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}fast(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}transform(t){const e=this.bb.__offset(this.bb_pos,8);return e?(t||new aw).__init(this.bb_pos+e,this.bb):null}dontSave(){const t=this.bb.__offset(this.bb_pos,10);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startSyncedTransformModel(t){t.startObject(4)}static addGuid(t,e){t.addFieldOffset(0,e,0)}static addFast(t,e){t.addFieldInt8(1,+e,0)}static addTransform(t,e){t.addFieldStruct(2,e,0)}static addDontSave(t,e){t.addFieldInt8(3,+e,0)}static endSyncedTransformModel(t){return t.endObject()}static finishSyncedTransformModelBuffer(t,e){t.finish(e)}static finishSizePrefixedSyncedTransformModelBuffer(t,e){t.finish(e,void 0,!0)}}exports.MODULES=void 0;(o=>{(t=>{t.MAYBEMODULE=null;const e=[];function i(){return t.MODULE?Promise.resolve(t.MODULE):new Promise(s=>{e.push(s)})}t.ready=i;async function n(){if(t.MODULE)return t.MODULE;const s=await Promise.resolve().then(()=>require("./rapier-CUe6_xwE.umd.cjs"));return t.MODULE=s,t.MAYBEMODULE=s,e.forEach(a=>a(s)),e.length=0,s}t.load=n})(o.RAPIER_PHYSICS||(o.RAPIER_PHYSICS={})),(t=>{t.MAYBEMODULE=null;const e=[];function i(){return t.MODULE?Promise.resolve(t.MODULE):new Promise(s=>{e.push(s)})}t.ready=i;async function n(){if(t.MODULE)return t.MODULE;const s=await Promise.resolve().then(()=>require("./postprocessing-CNCT892s.umd.cjs")).then(a=>a.index);return t.MODULE=s,t.MAYBEMODULE=s,e.forEach(a=>a(s)),e.length=0,s}t.load=n})(o.POSTPROCESSING||(o.POSTPROCESSING={})),(t=>{t.MAYBEMODULE=null;const e=[];function i(){return t.MODULE?Promise.resolve(t.MODULE):new Promise(s=>{e.push(s)})}t.ready=i;async function n(){if(t.MODULE)return t.MODULE;const s=await Promise.resolve().then(()=>require("./postprocessing-CNCT892s.umd.cjs")).then(a=>a.N8AO);return t.MODULE=s,t.MAYBEMODULE=s,e.forEach(a=>a(s)),e.length=0,s}t.load=n})(o.POSTPROCESSING_AO||(o.POSTPROCESSING_AO={}))})(exports.MODULES||(exports.MODULES={}));var ht=(o=>(o[o.Average=0]="Average",o[o.Multiply=1]="Multiply",o[o.Minimum=2]="Minimum",o[o.Maximum=3]="Maximum",o))(ht||{}),Qu=(o=>(o[o.Discrete=0]="Discrete",o[o.Continuous=1]="Continuous",o))(Qu||{}),Ne=(o=>(o[o.None=0]="None",o[o.FreezePositionX=2]="FreezePositionX",o[o.FreezePositionY=4]="FreezePositionY",o[o.FreezePositionZ=8]="FreezePositionZ",o[o.FreezePosition=14]="FreezePosition",o[o.FreezeRotationX=16]="FreezeRotationX",o[o.FreezeRotationY=32]="FreezeRotationY",o[o.FreezeRotationZ=64]="FreezeRotationZ",o[o.FreezeRotation=112]="FreezeRotation",o[o.FreezeAll=126]="FreezeAll",o))(Ne||{}),xa=(o=>(o[o.None=0]="None",o[o.X=2]="X",o[o.Y=4]="Y",o[o.Z=8]="Z",o[o.All=-1]="All",o))(xa||{});const St=function(o,t){return function(e,i,n){kP(e,i,n,o,t)}};function kP(o,t,e,i,n){if(!n&&!i&&!o.onValidate)return;if(e!==void 0){console.error("Invalid usage of validate decorator. Only fields can be validated.",o,t,e),Ee("Invalid usage of validate decorator. Only fields can be validated. Property: "+t,Mi.Error);return}let s="";if(typeof t=="string"?s=t:s=t.name,o.__internalAwake){const a=Symbol(s),l=o.__internalAwake;o.__internalAwake=function(){var c;if(!this.onValidate){j()&&console.warn('Usage of @validate decorate detected but there is no onValidate method in your class: "'+((c=o.constructor)==null?void 0:c.name)+'"');return}if(this[a]===void 0){this[a]=this[s];const h=this[s];if(h instanceof d.Vector2||h instanceof d.Vector3||h instanceof d.Vector4||h instanceof d.Quaternion){const u=this[s];ju(u,()=>{this.onValidate(s)})}Object.defineProperty(this,s,{set:function(u){var f;if(this[fm]===!0)this[a]=u;else{i==null||i.call(this,u);const p=this[a];this[a]=u,(f=this.onValidate)==null||f.call(this,s,p)}},get:function(){return n==null||n.call(this),this[a]}})}l.call(this)}}}const RP=function(o){return function(t,e,i){let n="";typeof e=="string"?n=e:n=e.name;const s=o.prototype,a=Object.getOwnPropertyDescriptor(s,n);if(!(a!=null&&a.value)){console.warn("Can not apply prefix: type does not have method named",e,o);return}const l=a.value,c=t[n];Object.defineProperty(s,n,{value:function(...h){const u=c==null?void 0:c.call(this,...h);if(u instanceof Promise){u.then(f=>{if(f!==!1)return l.call(this,...h)});return}if(u!==!1)return l.call(this,...h)}})}};var EP=Object.defineProperty,TP=Object.getOwnPropertyDescriptor,Li=(o,t,e,i)=>{for(var n=i>1?void 0:i?TP(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&EP(t,e,n),n};class AP{constructor(t,e){r(this,"positionChanged",!1);r(this,"rotationChanged",!1);r(this,"position");r(this,"quaternion");r(this,"_positionKeys",["x","y","z"]);r(this,"_quaternionKeys",["_x","_y","_z","_w"]);r(this,"mute",!1);r(this,"context");r(this,"obj");r(this,"_positionWatch");r(this,"_rotationWatch");this.context=e,this.obj=t}get isDirty(){return this.positionChanged||this.rotationChanged}reset(t=!1){if(this.positionChanged=!1,this.rotationChanged=!1,this.mute=!1,t){if(this.position)for(const e of this._positionKeys)delete this.position[e];if(this.quaternion)for(const e of this._quaternionKeys)delete this.quaternion[e]}}syncValues(){for(const t of this._positionKeys)this.position[t]=this.obj.position[t];for(const t of this._quaternionKeys)this.quaternion[t]=this.obj.quaternion[t]}applyValues(){if(this.positionChanged&&this.position)for(const t of this._positionKeys){const e=this.position[t];e!==void 0&&(this.obj.position[t]=e)}if(this.rotationChanged&&this.quaternion)for(const t of this._quaternionKeys){const e=this.quaternion[t];e!==void 0&&(this.obj.quaternion[t]=e)}}start(t,e){this.reset(),t&&(this._positionWatch||(this._positionWatch=new Rs(this.obj.position,["x","y","z"])),this._positionWatch.apply(),this.position={},this._positionWatch.subscribeWrite((s,a)=>{var c;if((c=this.context.physics.engine)!=null&&c.isUpdating||this.mute)return;const l=this.position[a];Math.abs(l-s)<1e-5||(this.position[a]=s,this.positionChanged=!0)})),e&&(this._rotationWatch||(this._rotationWatch=new Rs(this.obj.quaternion,["_x","_y","_z","_w"])),this._rotationWatch.apply(),this.quaternion={},this._rotationWatch.subscribeWrite((s,a)=>{var c;if((c=this.context.physics.engine)!=null&&c.isUpdating||this.mute)return;const l=this.quaternion[a];Math.abs(l-s)<1e-5||(this.quaternion[a]=s,this.rotationChanged=!0)}));const i=this.obj.matrixWorld.multiplyMatrices.bind(this.obj.matrixWorld),n=new d.Matrix4;this.obj.matrixWorld.multiplyMatrices=(s,a)=>{var l;return(l=this.context.physics.engine)!=null&&l.isUpdating||this.mute||n.equals(s)||(this.positionChanged=!0,this.rotationChanged=!0,n.copy(s)),i(s,a)}}stop(){var t,e;(t=this._positionWatch)==null||t.revoke(),(e=this._rotationWatch)==null||e.revoke()}}var Os;const hi=(Os=class extends I{constructor(){super(...arguments);r(this,"autoMass",!0);r(this,"_mass",0);r(this,"useGravity",!0);r(this,"centerOfMass",new d.Vector3(0,0,0));r(this,"constraints",Ne.None);r(this,"isKinematic",!1);r(this,"drag",0);r(this,"angularDrag",1);r(this,"detectCollisions",!0);r(this,"sleepThreshold",.01);r(this,"collisionDetectionMode",Qu.Discrete);r(this,"_gravityScale",1);r(this,"dominanceGroup",0);r(this,"_propertiesChanged",!1);r(this,"_currentVelocity",new d.Vector3);r(this,"_smoothedVelocity",new d.Vector3);r(this,"_smoothedVelocityGetter",new d.Vector3);r(this,"_lastPosition",new d.Vector3);r(this,"_watch")}get isRigidbody(){return!0}set mass(e){e!==this._mass&&(this._mass=e,this._propertiesChanged=!0,this.__didAwake&&(this.autoMass=!1))}get mass(){var e,i;return this.autoMass?((i=(e=this.context.physics.engine)==null?void 0:e.getBody(this))==null?void 0:i.mass())??-1:this._mass}get lockPositionX(){return(this.constraints&Ne.FreezePositionX)!==0}get lockPositionY(){return(this.constraints&Ne.FreezePositionY)!==0}get lockPositionZ(){return(this.constraints&Ne.FreezePositionZ)!==0}get lockRotationX(){return(this.constraints&Ne.FreezeRotationX)!==0}get lockRotationY(){return(this.constraints&Ne.FreezeRotationY)!==0}get lockRotationZ(){return(this.constraints&Ne.FreezeRotationZ)!==0}set lockPositionX(e){e?this.constraints|=Ne.FreezePositionX:this.constraints&=~Ne.FreezePositionX}set lockPositionY(e){e?this.constraints|=Ne.FreezePositionY:this.constraints&=~Ne.FreezePositionY}set lockPositionZ(e){e?this.constraints|=Ne.FreezePositionZ:this.constraints&=~Ne.FreezePositionZ}set lockRotationX(e){e?this.constraints|=Ne.FreezeRotationX:this.constraints&=~Ne.FreezeRotationX}set lockRotationY(e){e?this.constraints|=Ne.FreezeRotationY:this.constraints&=~Ne.FreezeRotationY}set lockRotationZ(e){e?this.constraints|=Ne.FreezeRotationZ:this.constraints&=~Ne.FreezeRotationZ}set gravityScale(e){this._gravityScale=e}get gravityScale(){return this._gravityScale}awake(){this._watch=void 0,this._propertiesChanged=!1}onEnable(){this._watch||(this._watch=new AP(this.gameObject,this.context)),this._watch.start(!0,!0),this.startCoroutine(this.beforePhysics(),we.LateUpdate),j()&&(globalThis.NEEDLE_USE_RAPIER?exports.MODULES.RAPIER_PHYSICS.ready().then(async()=>{var e;await eh(3),(e=this.context.physics.engine)!=null&&e.getBody(this)||console.warn(`Rigidbody could not be created. Ensure "${this.name}" has a Collider component.`)}):console.warn("Rigidbody could not be created: Rapier physics are explicitly disabled."))}onDisable(){var e,i;(e=this._watch)==null||e.stop(),(i=this.context.physics.engine)==null||i.removeBody(this)}onDestroy(){var e;(e=this.context.physics.engine)==null||e.removeBody(this)}onValidate(){this._propertiesChanged=!0}*beforePhysics(){var e,i,n,s;for(;;)this._propertiesChanged&&(this._propertiesChanged=!1,(e=this.context.physics.engine)==null||e.updateProperties(this)),(i=this._watch)!=null&&i.isDirty?(this._watch.mute=!0,this._watch.applyValues(),(n=this.context.physics.engine)==null||n.updateBody(this,this._watch.positionChanged,this._watch.rotationChanged),this._watch.reset()):(s=this._watch)==null||s.syncValues(),this.captureVelocity(),yield}teleport(e,i=!0){var n;(n=this._watch)==null||n.reset(!0),i?this.gameObject.position.set(e.x,e.y,e.z):this.setWorldPosition(e.x,e.y,e.z),this.resetForcesAndTorques(),this.resetVelocities()}resetForces(e=!0){var i;(i=this.context.physics.engine)==null||i.resetForces(this,e)}resetTorques(e=!0){var i;(i=this.context.physics.engine)==null||i.resetTorques(this,e)}resetVelocities(){this.setVelocity(0,0,0),this.setAngularVelocity(0,0,0)}resetForcesAndTorques(){this.resetForces(),this.resetTorques()}wakeUp(){var e;(e=this.context.physics.engine)==null||e.wakeup(this)}get isSleeping(){var e;return(e=this.context.physics.engine)==null?void 0:e.isSleeping(this)}updateProperties(){var e;return this._propertiesChanged=!1,(e=this.context.physics.engine)==null?void 0:e.updateProperties(this)}applyForce(e,i,n=!0){var s;this._propertiesChanged&&this.updateProperties(),(s=this.context.physics.engine)==null||s.addForce(this,e,n)}applyImpulse(e,i=!0){var n;this._propertiesChanged&&this.updateProperties(),(n=this.context.physics.engine)==null||n.applyImpulse(this,e,i)}setForce(e,i,n,s=!0){var a,l,c;(a=this.context.physics.engine)==null||a.resetForces(this,s),typeof e=="number"?(i??(i=0),n??(n=0),(l=this.context.physics.engine)==null||l.addForce(this,{x:e,y:i,z:n},s)):(c=this.context.physics.engine)==null||c.addForce(this,e,s)}getVelocity(){var i;const e=(i=this.context.physics.engine)==null?void 0:i.getLinearVelocity(this);return e?(this._currentVelocity.x=e.x,this._currentVelocity.y=e.y,this._currentVelocity.z=e.z,this._currentVelocity):this._currentVelocity.set(0,0,0)}setVelocity(e,i,n,s=!0){var a,l;if(e instanceof d.Vector3){const c=e;(a=this.context.physics.engine)==null||a.setLinearVelocity(this,c,s);return}i===void 0||n===void 0||(l=this.context.physics.engine)==null||l.setLinearVelocity(this,{x:e,y:i,z:n},s)}getAngularVelocity(){var i;const e=(i=this.context.physics.engine)==null?void 0:i.getAngularVelocity(this);return e?(this._currentVelocity.x=e.x,this._currentVelocity.y=e.y,this._currentVelocity.z=e.z,this._currentVelocity):this._currentVelocity.set(0,0,0)}setAngularVelocity(e,i,n,s=!0){var a,l;if(typeof e=="object"){const c=e;(a=this.context.physics.engine)==null||a.setAngularVelocity(this,c,s);return}if(i===void 0||n===void 0||typeof i=="boolean"){console.warn("setAngularVelocity expects either a Vec3 or 3 numbers");return}(l=this.context.physics.engine)==null||l.setAngularVelocity(this,{x:e,y:i,z:n},s)}setTorque(e,i,n){typeof e=="number"?this.setAngularVelocity(e,i,n):this.setAngularVelocity(e)}get smoothedVelocity(){return this._smoothedVelocityGetter.copy(this._smoothedVelocity),this._smoothedVelocityGetter.multiplyScalar(1/this.context.time.deltaTime)}setBodyFromGameObject(e=null){}captureVelocity(){const e=this.gameObject.matrixWorld;Os.tempPosition.setFromMatrixPosition(e);const i=Os.tempPosition.sub(this._lastPosition);this._lastPosition.copy(Os.tempPosition),this._smoothedVelocity.lerp(i,this.context.time.deltaTime/.1)}},r(Os,"tempPosition",new d.Vector3),Os);Li([St()],hi.prototype,"autoMass",2);Li([m()],hi.prototype,"mass",1);Li([St(),m()],hi.prototype,"useGravity",2);Li([m(d.Vector3)],hi.prototype,"centerOfMass",2);Li([St(),m()],hi.prototype,"constraints",2);Li([St(),m()],hi.prototype,"isKinematic",2);Li([St(),m()],hi.prototype,"drag",2);Li([St(),m()],hi.prototype,"angularDrag",2);Li([St(),m()],hi.prototype,"detectCollisions",2);Li([St(),m()],hi.prototype,"sleepThreshold",2);Li([St(),m()],hi.prototype,"collisionDetectionMode",2);Li([St()],hi.prototype,"_gravityScale",2);Li([St()],hi.prototype,"dominanceGroup",2);let ot=hi;new d.Vector3;new d.Vector3;const to=S("debugsync"),Bc="STRS";ag(Bc,Ss.getRootAsSyncedTransformModel);const En=new ae.Builder;function lw(o,t,e=!0){En.clear();const i=En.createString(o);Ss.startSyncedTransformModel(En),Ss.addGuid(En,i),Ss.addFast(En,e);const n=t.worldPosition,s=t.worldEuler,a=t.gameObject.scale;Ss.addTransform(En,aw.createTransform(En,n.x,n.y,n.z,s.x,s.y,s.z,a.x,a.y,a.z));const l=Ss.endSyncedTransformModel(En);return En.finish(l,Bc),En.asUint8Array()}let Sm=0,mc=0;ew(o=>{var i;const e=((i=o.connection.currentServerUrl)==null?void 0:i.includes("glitch"))?10:40;mc=Math.floor(Sm/e),Sm=0,to&&mc>0&&console.log("Sync Transform Fast Interval",mc)});class es extends I{constructor(){super(...arguments);r(this,"overridePhysics",!0);r(this,"interpolatePosition",!0);r(this,"interpolateRotation",!0);r(this,"fastMode",!1);r(this,"syncDestroy",!1);r(this,"_model",null);r(this,"_needsUpdate",!0);r(this,"rb",null);r(this,"_wasKinematic",!1);r(this,"_receivedDataBefore",!1);r(this,"_targetPosition");r(this,"_targetRotation");r(this,"_receivedFastUpdate",!1);r(this,"_shouldRequestOwnership",!1);r(this,"joinedRoomCallback",null);r(this,"receivedDataCallback",null);r(this,"tempEuler",new d.Euler);r(this,"receivedUpdate",!1);r(this,"lastPosition");r(this,"lastRotation");r(this,"lastScale")}requestOwnership(){to&&console.log("Request ownership"),this._model?this._model.requestOwnership():(this._shouldRequestOwnership=!0,this._needsUpdate=!0)}freeOwnership(){var e;(e=this._model)==null||e.freeOwnership()}hasOwnership(){var e;return((e=this._model)==null?void 0:e.hasOwnership)??void 0}isOwned(){var e;return(e=this._model)==null?void 0:e.isOwned}awake(){to&&console.log("new instance",this.guid,this),this._receivedDataBefore=!1,this._targetPosition=new d.Vector3,this._targetRotation=new d.Quaternion,this.lastPosition=new d.Vector3,this.lastRotation=new d.Quaternion,this.lastScale=new d.Vector3,this.rb=C.getComponentInChildren(this.gameObject,ot),this.rb&&(this._wasKinematic=this.rb.isKinematic),this.receivedUpdate=!0,this._model=new cg(this.context.connection,this.guid),this.context.connection.isConnected&&this.tryGetLastState(),this.joinedRoomCallback=this.tryGetLastState.bind(this),this.context.connection.beginListen(ee.JoinedRoom,this.joinedRoomCallback),this.receivedDataCallback=this.onReceivedData.bind(this),this.context.connection.beginListenBinary(Bc,this.receivedDataCallback)}onDestroy(){this.syncDestroy&&gg(this.guid,this.context.connection),this._model=null,this.context.connection.stopListen(ee.JoinedRoom,this.joinedRoomCallback),this.context.connection.stopListenBinary(Bc,this.receivedDataCallback)}tryGetLastState(){const e=this.context.connection.tryGetState(this.guid);e&&this.onReceivedData(e)}onReceivedData(e){var i;if(!this.destroyed&&typeof e.guid=="function"&&e.guid()===this.guid){to&&console.log("new data",this.context.connection.connectionId,this.context.time.frameCount,this.guid,e),this.receivedUpdate=!0,this._receivedFastUpdate=e.fast();const n=e.transform();if(n){Wi.markDirty(this.gameObject,!0);const s=n.position();s&&(this.interpolatePosition&&((i=this._targetPosition)==null||i.set(s.x(),s.y(),s.z())),(!this.interpolatePosition||!this._receivedDataBefore)&&this.setWorldPosition(s.x(),s.y(),s.z()));const a=n.rotation();a&&(this.tempEuler.set(a.x(),a.y(),a.z()),this.interpolateRotation&&this._targetRotation.setFromEuler(this.tempEuler),(!this.interpolateRotation||!this._receivedDataBefore)&&Km(this.gameObject,this.tempEuler));const l=n.scale();l&&this.gameObject.scale.set(l.x(),l.y(),l.z())}this._receivedDataBefore=!0}}onEnable(){this.lastPosition.copy(this.worldPosition),this.lastRotation.copy(this.worldQuaternion),this.lastScale.copy(this.gameObject.scale),this._needsUpdate=!0,this._model&&this._model.updateIsOwned()}onDisable(){this._model&&this._model.freeOwnership()}onBeforeRender(){if(!this.activeAndEnabled||!this.context.connection.isConnected)return;if(!this.context.connection.isInRoom||!this._model){to&&console.log("no model or room",this.name,this.guid,this.context.connection.isInRoom);return}this._shouldRequestOwnership&&(this._shouldRequestOwnership=!1,this._model.requestOwnership());const e=this.worldPosition,i=this.worldQuaternion,n=this.gameObject.scale;if(this._model.isOwned&&!this.receivedUpdate){const l=this._model.hasOwnership||this.fastMode?1e-4:.001;(e.distanceTo(this.lastPosition)>l||i.angleTo(this.lastRotation)>l||n.distanceTo(this.lastScale)>l)&&(this._model.hasOwnership?this._needsUpdate=!0:(to&&console.log(this.guid,"reset because not owned but",this.gameObject.name,this.lastPosition),this.worldPosition=this.lastPosition,e.copy(this.lastPosition),this.worldQuaternion=this.lastRotation,i.copy(this.lastRotation),this.gameObject.scale.copy(this.lastScale),Wi.markDirty(this.gameObject,!0),this._needsUpdate=!1))}if(this._model&&!this._model.hasOwnership&&this._model.isOwned&&this._receivedDataBefore){const l=this._receivedFastUpdate||this.fastMode?.5:.3;let c=!1;if(this.interpolatePosition&&this._targetPosition){const h=this.worldPosition;h.lerp(this._targetPosition,l),this.worldPosition=h,c=!0}if(this.interpolateRotation&&this._targetRotation){const h=this.worldQuaternion;h.slerp(this._targetRotation,l),this.worldQuaternion=h,c=!0}c&&Wi.markDirty(this.gameObject,!0)}if(this.receivedUpdate=!1,this.lastPosition.copy(e),this.lastRotation.copy(i),this.lastScale.copy(n),!this._model||!this._model||this._model.hasOwnership===void 0||!this._model.hasOwnership)return;this.rb&&this.overridePhysics&&this._wasKinematic!==void 0&&(to&&console.log("reset kinematic",this.rb.name,this._wasKinematic),this.rb.isKinematic=this._wasKinematic);const s=10,a=this.rb||this.fastMode;if(this._needsUpdate&&(this.context.time.frameCount%s===0||a)){if(Sm++,a&&mc>0&&this.context.time.frameCount%mc!==0)return;to&&console.debug("[SyncedTransform] Send update",this.context.connection.connectionId,this.guid,this.gameObject.name,this.gameObject.guid),this._needsUpdate=!1;const l=lw(this.guid,this,!!a);this.context.connection.sendBinary(l)}}}class mh{constructor(t,e){r(this,"event");r(this,"button");r(this,"buttonName");r(this,"_used",!1);r(this,"_propagationStopped",!1);r(this,"z__pointer_ctured",!1);r(this,"z__pointer_cture_rleased",!1);r(this,"inputSource");r(this,"object");r(this,"point");r(this,"normal");r(this,"face");r(this,"distance");r(this,"instanceId");r(this,"intersection");r(this,"isDown");r(this,"isUp");r(this,"isPressed");r(this,"isClick");r(this,"isDoubleClick");r(this,"input");this.event=e,this.input=t,this.button=e.button}get deviceIndex(){return this.event.deviceIndex}get pointerId(){return this.event.pointerId}get pressure(){return this.event.pressure}get used(){return this._used}use(){this._used||(this._used=!0,this.event.use())}get propagationStopped(){return this._propagationStopped}stopPropagation(){this._propagationStopped=!0,this.event.stopImmediatePropagation()}stopImmediatePropagation(){this._propagationStopped=!0,this.event.stopImmediatePropagation()}setPointerCapture(){this.z__pointer_ctured=!0}releasePointerCapture(){this.z__pointer_cture_rleased=!0}get mode(){return this.event.mode}clone(){const t=new mh(this.input,this.event);return Object.assign(t,this),t}Use(){this.use()}StopPropagation(){this.event.stopImmediatePropagation()}}function cu(o,t){return C.foreachComponent(o,i=>{if(!i.enabled)return;const n=i;if(t)switch(t){case"pointerdown":if(n.onPointerDown)return!0;break;case"pointerup":if(n.onPointerUp||n.onPointerClick)return!0;break;case"pointermove":if(n.onPointerEnter||n.onPointerExit||n.onPointerMove)return!0;break}else if(n.onPointerDown||n.onPointerUp||n.onPointerEnter||n.onPointerExit||n.onPointerClick)return!0},!1)===!0}const ds=new Array;class Cs{constructor(t,e,i,n){r(this,"enabled",!0);r(this,"target");r(this,"methodName");r(this,"arguments");this.target=t,this.methodName=e||null,this.arguments=i,n!=null&&(this.enabled=n)}get canClone(){return this.target instanceof Object}invoke(...t){if(this.enabled!==!1){if(typeof this.target=="function")this.arguments?(ds.length=0,t!==void 0&&t.length>0&&ds.push(...t),ds.push(...this.arguments),this.target(...this.arguments),ds.length=0):this.target(...t);else if(this.methodName!=null){const e=this.target[this.methodName];typeof e=="function"?this.arguments?(ds.length=0,t!==void 0&&t.length>0&&ds.push(...t),ds.push(...this.arguments),e.call(this.target,...ds),ds.length=0):e.call(this.target,...t):this.arguments?this.target[this.methodName]=this.arguments[0]||t[0]:this.target[this.methodName]=t[0]}}}}const LP=o=>/^[A-Z]*$/.test(o);class Yu extends Event{constructor(){super(...arguments);r(this,"args")}}class ye{constructor(t){r(this,"isEventList",!0);r(this,"target");r(this,"key");r(this,"_isInvoking",!1);r(this,"methods",[]);r(this,"_methodsCopy",[]);if(this.methods=[],Array.isArray(t))for(const e of t)e instanceof Cs?this.methods.push(e):typeof e=="function"&&this.methods.push(new Cs(e));else typeof t=="function"&&this.methods.push(new Cs(t))}__internalOnInstantiate(t){var n;const e=new Array;for(let s=0;s<this.methods.length;s++){const a=this.methods[s];if(!(a.target instanceof Function)){const l=a.target;let c=l==null?void 0:l.uuid;if(l&&(c=l.guid),c){const h=t[c];if(h){const u=(n=a.arguments)==null?void 0:n.map(f=>f instanceof Object&&f.uuid?t[f.uuid]:f!=null&&f.isComponent?t[f.guid]:f);e.push(new Cs(h.clone,a.methodName,u,a.enabled))}else j()&&console.warn("Could not find target for event listener")}}}return new ye(e)}setEventTarget(t,e){if(this.key=t,this.target=e,this.key!==void 0){let i="",n=!1;for(const s of this.key)n&&LP(s)&&(i+="-"),n=!0,i+=s.toLowerCase();this.key=i}}get listenerCount(){var t;return((t=this.methods)==null?void 0:t.length)??0}get isInvoking(){return this._isInvoking}static from(...t){return new ye(t)}invoke(...t){var e;if(this._isInvoking)return console.warn("Circular event invocation detected. Please check your event listeners for circular references.",this),!1;if(((e=this.methods)==null?void 0:e.length)<=0)return!1;this._isInvoking=!0;try{this._methodsCopy.length=0,this._methodsCopy.push(...this.methods);for(const i of this._methodsCopy)i.invoke(...t);if(typeof this.target=="object"&&typeof this.key=="string"){const i=this.target.dispatchEvent;if(typeof i=="function"){const n=new Yu(this.key);n.args=t,i.call(this.target,n)}}}finally{this._isInvoking=!1,this._methodsCopy.length=0}return!0}addEventListener(t){return this.methods.push(new Cs(t)),t}removeEventListener(t){if(t)for(let e=this.methods.length-1;e>=0;e--)this.methods[e].target===t&&(this.methods[e].enabled=!1,this.methods.splice(e,1))}removeAllEventListeners(){this.methods.length=0}}class DP extends Ki{constructor(){super([d.Color,ie],"ColorSerializer")}onDeserialize(t){if(t!=null)return t.a!==void 0?new ie(t.r,t.g,t.b,t.a):t.alpha!==void 0?new ie(t.r,t.g,t.b,t.alpha):new d.Color(t.r,t.g,t.b)}onSerialize(t){if(t!=null)return t.a!==void 0?{r:t.r,g:t.g,b:t.b,a:t.a}:{r:t.r,g:t.g,b:t.b}}}const IP=new DP;class jP extends Ki{constructor(){super([d.Euler],"EulerSerializer")}onDeserialize(t,e){if(t!=null){if(t.order)return new d.Euler(t.x,t.y,t.z,t.order);if(t.x!=null)return new d.Euler(t.x,t.y,t.z)}}onSerialize(t,e){return{x:t.x,y:t.y,z:t.z,order:t.order}}}const BP=new jP;class FP extends Ki{constructor(){super(d.Object3D,"ObjectSerializer")}onSerialize(t,e){if(e.objectToNode!==void 0&&t.uuid){const i=e.objectToNode[t.uuid];return dt&&console.log(i,t.name,t.uuid),{node:i}}}onDeserialize(t,e){var i,n,s;if(typeof t=="string"){if(t.endsWith(".glb")||t.endsWith(".gltf")){if(e.serializable instanceof Array&&e.serializable.includes(te))return;j()&&me("Detected wrong usage of @serializable with Object3D or GameObject. Instead you should use AssetReference here! Please see the console for details.");const a=(n=(i=e.target)==null?void 0:i.constructor)==null?void 0:n.name;console.warn(`Wrong usage of @serializable detected in your script "${a}"
928
+ `;var OP=Object.defineProperty,Rg=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&OP(t,e,n),n};class Ur extends I{constructor(){super(...arguments);r(this,"constraintActive",!0);r(this,"locked",!1);r(this,"sources",[])}}Rg([m()],Ur.prototype,"constraintActive");Rg([m()],Ur.prototype,"locked");Rg([m(d.Object3D)],Ur.prototype,"sources");let Sr=class{constructor(){r(this,"bb",null);r(this,"bb_pos",0)}__init(t,e){return this.bb_pos=t,this.bb=e,this}x(){return this.bb.readFloat32(this.bb_pos)}y(){return this.bb.readFloat32(this.bb_pos+4)}z(){return this.bb.readFloat32(this.bb_pos+8)}static sizeOf(){return 12}static createVec3(t,e,i,n){return t.prep(4,12),t.writeFloat32(n),t.writeFloat32(i),t.writeFloat32(e),t.offset()}};class aw{constructor(){r(this,"bb",null);r(this,"bb_pos",0)}__init(t,e){return this.bb_pos=t,this.bb=e,this}position(t){return(t||new Sr).__init(this.bb_pos,this.bb)}rotation(t){return(t||new Sr).__init(this.bb_pos+12,this.bb)}scale(t){return(t||new Sr).__init(this.bb_pos+24,this.bb)}static sizeOf(){return 36}static createTransform(t,e,i,n,s,a,l,c,h,u){return t.prep(4,36),t.prep(4,12),t.writeFloat32(u),t.writeFloat32(h),t.writeFloat32(c),t.prep(4,12),t.writeFloat32(l),t.writeFloat32(a),t.writeFloat32(s),t.prep(4,12),t.writeFloat32(n),t.writeFloat32(i),t.writeFloat32(e),t.offset()}}class Ss{constructor(){r(this,"bb",null);r(this,"bb_pos",0)}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSyncedTransformModel(t,e){return(e||new Ss).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSyncedTransformModel(t,e){return t.setPosition(t.position()+ae.SIZE_PREFIX_LENGTH),(e||new Ss).__init(t.readInt32(t.position())+t.position(),t)}guid(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}fast(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}transform(t){const e=this.bb.__offset(this.bb_pos,8);return e?(t||new aw).__init(this.bb_pos+e,this.bb):null}dontSave(){const t=this.bb.__offset(this.bb_pos,10);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startSyncedTransformModel(t){t.startObject(4)}static addGuid(t,e){t.addFieldOffset(0,e,0)}static addFast(t,e){t.addFieldInt8(1,+e,0)}static addTransform(t,e){t.addFieldStruct(2,e,0)}static addDontSave(t,e){t.addFieldInt8(3,+e,0)}static endSyncedTransformModel(t){return t.endObject()}static finishSyncedTransformModelBuffer(t,e){t.finish(e)}static finishSizePrefixedSyncedTransformModelBuffer(t,e){t.finish(e,void 0,!0)}}exports.MODULES=void 0;(o=>{(t=>{t.MAYBEMODULE=null;const e=[];function i(){return t.MODULE?Promise.resolve(t.MODULE):new Promise(s=>{e.push(s)})}t.ready=i;async function n(){if(t.MODULE)return t.MODULE;const s=await Promise.resolve().then(()=>require("./rapier-CUe6_xwE.umd.cjs"));return t.MODULE=s,t.MAYBEMODULE=s,e.forEach(a=>a(s)),e.length=0,s}t.load=n})(o.RAPIER_PHYSICS||(o.RAPIER_PHYSICS={})),(t=>{t.MAYBEMODULE=null;const e=[];function i(){return t.MODULE?Promise.resolve(t.MODULE):new Promise(s=>{e.push(s)})}t.ready=i;async function n(){if(t.MODULE)return t.MODULE;const s=await Promise.resolve().then(()=>require("./postprocessing-Dw2OCMp4.umd.cjs")).then(a=>a.index);return t.MODULE=s,t.MAYBEMODULE=s,e.forEach(a=>a(s)),e.length=0,s}t.load=n})(o.POSTPROCESSING||(o.POSTPROCESSING={})),(t=>{t.MAYBEMODULE=null;const e=[];function i(){return t.MODULE?Promise.resolve(t.MODULE):new Promise(s=>{e.push(s)})}t.ready=i;async function n(){if(t.MODULE)return t.MODULE;const s=await Promise.resolve().then(()=>require("./postprocessing-Dw2OCMp4.umd.cjs")).then(a=>a.N8AO);return t.MODULE=s,t.MAYBEMODULE=s,e.forEach(a=>a(s)),e.length=0,s}t.load=n})(o.POSTPROCESSING_AO||(o.POSTPROCESSING_AO={}))})(exports.MODULES||(exports.MODULES={}));var ht=(o=>(o[o.Average=0]="Average",o[o.Multiply=1]="Multiply",o[o.Minimum=2]="Minimum",o[o.Maximum=3]="Maximum",o))(ht||{}),Qu=(o=>(o[o.Discrete=0]="Discrete",o[o.Continuous=1]="Continuous",o))(Qu||{}),Ne=(o=>(o[o.None=0]="None",o[o.FreezePositionX=2]="FreezePositionX",o[o.FreezePositionY=4]="FreezePositionY",o[o.FreezePositionZ=8]="FreezePositionZ",o[o.FreezePosition=14]="FreezePosition",o[o.FreezeRotationX=16]="FreezeRotationX",o[o.FreezeRotationY=32]="FreezeRotationY",o[o.FreezeRotationZ=64]="FreezeRotationZ",o[o.FreezeRotation=112]="FreezeRotation",o[o.FreezeAll=126]="FreezeAll",o))(Ne||{}),xa=(o=>(o[o.None=0]="None",o[o.X=2]="X",o[o.Y=4]="Y",o[o.Z=8]="Z",o[o.All=-1]="All",o))(xa||{});const St=function(o,t){return function(e,i,n){kP(e,i,n,o,t)}};function kP(o,t,e,i,n){if(!n&&!i&&!o.onValidate)return;if(e!==void 0){console.error("Invalid usage of validate decorator. Only fields can be validated.",o,t,e),Ee("Invalid usage of validate decorator. Only fields can be validated. Property: "+t,Mi.Error);return}let s="";if(typeof t=="string"?s=t:s=t.name,o.__internalAwake){const a=Symbol(s),l=o.__internalAwake;o.__internalAwake=function(){var c;if(!this.onValidate){j()&&console.warn('Usage of @validate decorate detected but there is no onValidate method in your class: "'+((c=o.constructor)==null?void 0:c.name)+'"');return}if(this[a]===void 0){this[a]=this[s];const h=this[s];if(h instanceof d.Vector2||h instanceof d.Vector3||h instanceof d.Vector4||h instanceof d.Quaternion){const u=this[s];ju(u,()=>{this.onValidate(s)})}Object.defineProperty(this,s,{set:function(u){var f;if(this[fm]===!0)this[a]=u;else{i==null||i.call(this,u);const p=this[a];this[a]=u,(f=this.onValidate)==null||f.call(this,s,p)}},get:function(){return n==null||n.call(this),this[a]}})}l.call(this)}}}const RP=function(o){return function(t,e,i){let n="";typeof e=="string"?n=e:n=e.name;const s=o.prototype,a=Object.getOwnPropertyDescriptor(s,n);if(!(a!=null&&a.value)){console.warn("Can not apply prefix: type does not have method named",e,o);return}const l=a.value,c=t[n];Object.defineProperty(s,n,{value:function(...h){const u=c==null?void 0:c.call(this,...h);if(u instanceof Promise){u.then(f=>{if(f!==!1)return l.call(this,...h)});return}if(u!==!1)return l.call(this,...h)}})}};var EP=Object.defineProperty,TP=Object.getOwnPropertyDescriptor,Li=(o,t,e,i)=>{for(var n=i>1?void 0:i?TP(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&EP(t,e,n),n};class AP{constructor(t,e){r(this,"positionChanged",!1);r(this,"rotationChanged",!1);r(this,"position");r(this,"quaternion");r(this,"_positionKeys",["x","y","z"]);r(this,"_quaternionKeys",["_x","_y","_z","_w"]);r(this,"mute",!1);r(this,"context");r(this,"obj");r(this,"_positionWatch");r(this,"_rotationWatch");this.context=e,this.obj=t}get isDirty(){return this.positionChanged||this.rotationChanged}reset(t=!1){if(this.positionChanged=!1,this.rotationChanged=!1,this.mute=!1,t){if(this.position)for(const e of this._positionKeys)delete this.position[e];if(this.quaternion)for(const e of this._quaternionKeys)delete this.quaternion[e]}}syncValues(){for(const t of this._positionKeys)this.position[t]=this.obj.position[t];for(const t of this._quaternionKeys)this.quaternion[t]=this.obj.quaternion[t]}applyValues(){if(this.positionChanged&&this.position)for(const t of this._positionKeys){const e=this.position[t];e!==void 0&&(this.obj.position[t]=e)}if(this.rotationChanged&&this.quaternion)for(const t of this._quaternionKeys){const e=this.quaternion[t];e!==void 0&&(this.obj.quaternion[t]=e)}}start(t,e){this.reset(),t&&(this._positionWatch||(this._positionWatch=new Rs(this.obj.position,["x","y","z"])),this._positionWatch.apply(),this.position={},this._positionWatch.subscribeWrite((s,a)=>{var c;if((c=this.context.physics.engine)!=null&&c.isUpdating||this.mute)return;const l=this.position[a];Math.abs(l-s)<1e-5||(this.position[a]=s,this.positionChanged=!0)})),e&&(this._rotationWatch||(this._rotationWatch=new Rs(this.obj.quaternion,["_x","_y","_z","_w"])),this._rotationWatch.apply(),this.quaternion={},this._rotationWatch.subscribeWrite((s,a)=>{var c;if((c=this.context.physics.engine)!=null&&c.isUpdating||this.mute)return;const l=this.quaternion[a];Math.abs(l-s)<1e-5||(this.quaternion[a]=s,this.rotationChanged=!0)}));const i=this.obj.matrixWorld.multiplyMatrices.bind(this.obj.matrixWorld),n=new d.Matrix4;this.obj.matrixWorld.multiplyMatrices=(s,a)=>{var l;return(l=this.context.physics.engine)!=null&&l.isUpdating||this.mute||n.equals(s)||(this.positionChanged=!0,this.rotationChanged=!0,n.copy(s)),i(s,a)}}stop(){var t,e;(t=this._positionWatch)==null||t.revoke(),(e=this._rotationWatch)==null||e.revoke()}}var Os;const hi=(Os=class extends I{constructor(){super(...arguments);r(this,"autoMass",!0);r(this,"_mass",0);r(this,"useGravity",!0);r(this,"centerOfMass",new d.Vector3(0,0,0));r(this,"constraints",Ne.None);r(this,"isKinematic",!1);r(this,"drag",0);r(this,"angularDrag",1);r(this,"detectCollisions",!0);r(this,"sleepThreshold",.01);r(this,"collisionDetectionMode",Qu.Discrete);r(this,"_gravityScale",1);r(this,"dominanceGroup",0);r(this,"_propertiesChanged",!1);r(this,"_currentVelocity",new d.Vector3);r(this,"_smoothedVelocity",new d.Vector3);r(this,"_smoothedVelocityGetter",new d.Vector3);r(this,"_lastPosition",new d.Vector3);r(this,"_watch")}get isRigidbody(){return!0}set mass(e){e!==this._mass&&(this._mass=e,this._propertiesChanged=!0,this.__didAwake&&(this.autoMass=!1))}get mass(){var e,i;return this.autoMass?((i=(e=this.context.physics.engine)==null?void 0:e.getBody(this))==null?void 0:i.mass())??-1:this._mass}get lockPositionX(){return(this.constraints&Ne.FreezePositionX)!==0}get lockPositionY(){return(this.constraints&Ne.FreezePositionY)!==0}get lockPositionZ(){return(this.constraints&Ne.FreezePositionZ)!==0}get lockRotationX(){return(this.constraints&Ne.FreezeRotationX)!==0}get lockRotationY(){return(this.constraints&Ne.FreezeRotationY)!==0}get lockRotationZ(){return(this.constraints&Ne.FreezeRotationZ)!==0}set lockPositionX(e){e?this.constraints|=Ne.FreezePositionX:this.constraints&=~Ne.FreezePositionX}set lockPositionY(e){e?this.constraints|=Ne.FreezePositionY:this.constraints&=~Ne.FreezePositionY}set lockPositionZ(e){e?this.constraints|=Ne.FreezePositionZ:this.constraints&=~Ne.FreezePositionZ}set lockRotationX(e){e?this.constraints|=Ne.FreezeRotationX:this.constraints&=~Ne.FreezeRotationX}set lockRotationY(e){e?this.constraints|=Ne.FreezeRotationY:this.constraints&=~Ne.FreezeRotationY}set lockRotationZ(e){e?this.constraints|=Ne.FreezeRotationZ:this.constraints&=~Ne.FreezeRotationZ}set gravityScale(e){this._gravityScale=e}get gravityScale(){return this._gravityScale}awake(){this._watch=void 0,this._propertiesChanged=!1}onEnable(){this._watch||(this._watch=new AP(this.gameObject,this.context)),this._watch.start(!0,!0),this.startCoroutine(this.beforePhysics(),we.LateUpdate),j()&&(globalThis.NEEDLE_USE_RAPIER?exports.MODULES.RAPIER_PHYSICS.ready().then(async()=>{var e;await eh(3),(e=this.context.physics.engine)!=null&&e.getBody(this)||console.warn(`Rigidbody could not be created. Ensure "${this.name}" has a Collider component.`)}):console.warn("Rigidbody could not be created: Rapier physics are explicitly disabled."))}onDisable(){var e,i;(e=this._watch)==null||e.stop(),(i=this.context.physics.engine)==null||i.removeBody(this)}onDestroy(){var e;(e=this.context.physics.engine)==null||e.removeBody(this)}onValidate(){this._propertiesChanged=!0}*beforePhysics(){var e,i,n,s;for(;;)this._propertiesChanged&&(this._propertiesChanged=!1,(e=this.context.physics.engine)==null||e.updateProperties(this)),(i=this._watch)!=null&&i.isDirty?(this._watch.mute=!0,this._watch.applyValues(),(n=this.context.physics.engine)==null||n.updateBody(this,this._watch.positionChanged,this._watch.rotationChanged),this._watch.reset()):(s=this._watch)==null||s.syncValues(),this.captureVelocity(),yield}teleport(e,i=!0){var n;(n=this._watch)==null||n.reset(!0),i?this.gameObject.position.set(e.x,e.y,e.z):this.setWorldPosition(e.x,e.y,e.z),this.resetForcesAndTorques(),this.resetVelocities()}resetForces(e=!0){var i;(i=this.context.physics.engine)==null||i.resetForces(this,e)}resetTorques(e=!0){var i;(i=this.context.physics.engine)==null||i.resetTorques(this,e)}resetVelocities(){this.setVelocity(0,0,0),this.setAngularVelocity(0,0,0)}resetForcesAndTorques(){this.resetForces(),this.resetTorques()}wakeUp(){var e;(e=this.context.physics.engine)==null||e.wakeup(this)}get isSleeping(){var e;return(e=this.context.physics.engine)==null?void 0:e.isSleeping(this)}updateProperties(){var e;return this._propertiesChanged=!1,(e=this.context.physics.engine)==null?void 0:e.updateProperties(this)}applyForce(e,i,n=!0){var s;this._propertiesChanged&&this.updateProperties(),(s=this.context.physics.engine)==null||s.addForce(this,e,n)}applyImpulse(e,i=!0){var n;this._propertiesChanged&&this.updateProperties(),(n=this.context.physics.engine)==null||n.applyImpulse(this,e,i)}setForce(e,i,n,s=!0){var a,l,c;(a=this.context.physics.engine)==null||a.resetForces(this,s),typeof e=="number"?(i??(i=0),n??(n=0),(l=this.context.physics.engine)==null||l.addForce(this,{x:e,y:i,z:n},s)):(c=this.context.physics.engine)==null||c.addForce(this,e,s)}getVelocity(){var i;const e=(i=this.context.physics.engine)==null?void 0:i.getLinearVelocity(this);return e?(this._currentVelocity.x=e.x,this._currentVelocity.y=e.y,this._currentVelocity.z=e.z,this._currentVelocity):this._currentVelocity.set(0,0,0)}setVelocity(e,i,n,s=!0){var a,l;if(e instanceof d.Vector3){const c=e;(a=this.context.physics.engine)==null||a.setLinearVelocity(this,c,s);return}i===void 0||n===void 0||(l=this.context.physics.engine)==null||l.setLinearVelocity(this,{x:e,y:i,z:n},s)}getAngularVelocity(){var i;const e=(i=this.context.physics.engine)==null?void 0:i.getAngularVelocity(this);return e?(this._currentVelocity.x=e.x,this._currentVelocity.y=e.y,this._currentVelocity.z=e.z,this._currentVelocity):this._currentVelocity.set(0,0,0)}setAngularVelocity(e,i,n,s=!0){var a,l;if(typeof e=="object"){const c=e;(a=this.context.physics.engine)==null||a.setAngularVelocity(this,c,s);return}if(i===void 0||n===void 0||typeof i=="boolean"){console.warn("setAngularVelocity expects either a Vec3 or 3 numbers");return}(l=this.context.physics.engine)==null||l.setAngularVelocity(this,{x:e,y:i,z:n},s)}setTorque(e,i,n){typeof e=="number"?this.setAngularVelocity(e,i,n):this.setAngularVelocity(e)}get smoothedVelocity(){return this._smoothedVelocityGetter.copy(this._smoothedVelocity),this._smoothedVelocityGetter.multiplyScalar(1/this.context.time.deltaTime)}setBodyFromGameObject(e=null){}captureVelocity(){const e=this.gameObject.matrixWorld;Os.tempPosition.setFromMatrixPosition(e);const i=Os.tempPosition.sub(this._lastPosition);this._lastPosition.copy(Os.tempPosition),this._smoothedVelocity.lerp(i,this.context.time.deltaTime/.1)}},r(Os,"tempPosition",new d.Vector3),Os);Li([St()],hi.prototype,"autoMass",2);Li([m()],hi.prototype,"mass",1);Li([St(),m()],hi.prototype,"useGravity",2);Li([m(d.Vector3)],hi.prototype,"centerOfMass",2);Li([St(),m()],hi.prototype,"constraints",2);Li([St(),m()],hi.prototype,"isKinematic",2);Li([St(),m()],hi.prototype,"drag",2);Li([St(),m()],hi.prototype,"angularDrag",2);Li([St(),m()],hi.prototype,"detectCollisions",2);Li([St(),m()],hi.prototype,"sleepThreshold",2);Li([St(),m()],hi.prototype,"collisionDetectionMode",2);Li([St()],hi.prototype,"_gravityScale",2);Li([St()],hi.prototype,"dominanceGroup",2);let ot=hi;new d.Vector3;new d.Vector3;const to=S("debugsync"),Bc="STRS";ag(Bc,Ss.getRootAsSyncedTransformModel);const En=new ae.Builder;function lw(o,t,e=!0){En.clear();const i=En.createString(o);Ss.startSyncedTransformModel(En),Ss.addGuid(En,i),Ss.addFast(En,e);const n=t.worldPosition,s=t.worldEuler,a=t.gameObject.scale;Ss.addTransform(En,aw.createTransform(En,n.x,n.y,n.z,s.x,s.y,s.z,a.x,a.y,a.z));const l=Ss.endSyncedTransformModel(En);return En.finish(l,Bc),En.asUint8Array()}let Sm=0,mc=0;ew(o=>{var i;const e=((i=o.connection.currentServerUrl)==null?void 0:i.includes("glitch"))?10:40;mc=Math.floor(Sm/e),Sm=0,to&&mc>0&&console.log("Sync Transform Fast Interval",mc)});class es extends I{constructor(){super(...arguments);r(this,"overridePhysics",!0);r(this,"interpolatePosition",!0);r(this,"interpolateRotation",!0);r(this,"fastMode",!1);r(this,"syncDestroy",!1);r(this,"_model",null);r(this,"_needsUpdate",!0);r(this,"rb",null);r(this,"_wasKinematic",!1);r(this,"_receivedDataBefore",!1);r(this,"_targetPosition");r(this,"_targetRotation");r(this,"_receivedFastUpdate",!1);r(this,"_shouldRequestOwnership",!1);r(this,"joinedRoomCallback",null);r(this,"receivedDataCallback",null);r(this,"tempEuler",new d.Euler);r(this,"receivedUpdate",!1);r(this,"lastPosition");r(this,"lastRotation");r(this,"lastScale")}requestOwnership(){to&&console.log("Request ownership"),this._model?this._model.requestOwnership():(this._shouldRequestOwnership=!0,this._needsUpdate=!0)}freeOwnership(){var e;(e=this._model)==null||e.freeOwnership()}hasOwnership(){var e;return((e=this._model)==null?void 0:e.hasOwnership)??void 0}isOwned(){var e;return(e=this._model)==null?void 0:e.isOwned}awake(){to&&console.log("new instance",this.guid,this),this._receivedDataBefore=!1,this._targetPosition=new d.Vector3,this._targetRotation=new d.Quaternion,this.lastPosition=new d.Vector3,this.lastRotation=new d.Quaternion,this.lastScale=new d.Vector3,this.rb=C.getComponentInChildren(this.gameObject,ot),this.rb&&(this._wasKinematic=this.rb.isKinematic),this.receivedUpdate=!0,this._model=new cg(this.context.connection,this.guid),this.context.connection.isConnected&&this.tryGetLastState(),this.joinedRoomCallback=this.tryGetLastState.bind(this),this.context.connection.beginListen(ee.JoinedRoom,this.joinedRoomCallback),this.receivedDataCallback=this.onReceivedData.bind(this),this.context.connection.beginListenBinary(Bc,this.receivedDataCallback)}onDestroy(){this.syncDestroy&&gg(this.guid,this.context.connection),this._model=null,this.context.connection.stopListen(ee.JoinedRoom,this.joinedRoomCallback),this.context.connection.stopListenBinary(Bc,this.receivedDataCallback)}tryGetLastState(){const e=this.context.connection.tryGetState(this.guid);e&&this.onReceivedData(e)}onReceivedData(e){var i;if(!this.destroyed&&typeof e.guid=="function"&&e.guid()===this.guid){to&&console.log("new data",this.context.connection.connectionId,this.context.time.frameCount,this.guid,e),this.receivedUpdate=!0,this._receivedFastUpdate=e.fast();const n=e.transform();if(n){Wi.markDirty(this.gameObject,!0);const s=n.position();s&&(this.interpolatePosition&&((i=this._targetPosition)==null||i.set(s.x(),s.y(),s.z())),(!this.interpolatePosition||!this._receivedDataBefore)&&this.setWorldPosition(s.x(),s.y(),s.z()));const a=n.rotation();a&&(this.tempEuler.set(a.x(),a.y(),a.z()),this.interpolateRotation&&this._targetRotation.setFromEuler(this.tempEuler),(!this.interpolateRotation||!this._receivedDataBefore)&&Km(this.gameObject,this.tempEuler));const l=n.scale();l&&this.gameObject.scale.set(l.x(),l.y(),l.z())}this._receivedDataBefore=!0}}onEnable(){this.lastPosition.copy(this.worldPosition),this.lastRotation.copy(this.worldQuaternion),this.lastScale.copy(this.gameObject.scale),this._needsUpdate=!0,this._model&&this._model.updateIsOwned()}onDisable(){this._model&&this._model.freeOwnership()}onBeforeRender(){if(!this.activeAndEnabled||!this.context.connection.isConnected)return;if(!this.context.connection.isInRoom||!this._model){to&&console.log("no model or room",this.name,this.guid,this.context.connection.isInRoom);return}this._shouldRequestOwnership&&(this._shouldRequestOwnership=!1,this._model.requestOwnership());const e=this.worldPosition,i=this.worldQuaternion,n=this.gameObject.scale;if(this._model.isOwned&&!this.receivedUpdate){const l=this._model.hasOwnership||this.fastMode?1e-4:.001;(e.distanceTo(this.lastPosition)>l||i.angleTo(this.lastRotation)>l||n.distanceTo(this.lastScale)>l)&&(this._model.hasOwnership?this._needsUpdate=!0:(to&&console.log(this.guid,"reset because not owned but",this.gameObject.name,this.lastPosition),this.worldPosition=this.lastPosition,e.copy(this.lastPosition),this.worldQuaternion=this.lastRotation,i.copy(this.lastRotation),this.gameObject.scale.copy(this.lastScale),Wi.markDirty(this.gameObject,!0),this._needsUpdate=!1))}if(this._model&&!this._model.hasOwnership&&this._model.isOwned&&this._receivedDataBefore){const l=this._receivedFastUpdate||this.fastMode?.5:.3;let c=!1;if(this.interpolatePosition&&this._targetPosition){const h=this.worldPosition;h.lerp(this._targetPosition,l),this.worldPosition=h,c=!0}if(this.interpolateRotation&&this._targetRotation){const h=this.worldQuaternion;h.slerp(this._targetRotation,l),this.worldQuaternion=h,c=!0}c&&Wi.markDirty(this.gameObject,!0)}if(this.receivedUpdate=!1,this.lastPosition.copy(e),this.lastRotation.copy(i),this.lastScale.copy(n),!this._model||!this._model||this._model.hasOwnership===void 0||!this._model.hasOwnership)return;this.rb&&this.overridePhysics&&this._wasKinematic!==void 0&&(to&&console.log("reset kinematic",this.rb.name,this._wasKinematic),this.rb.isKinematic=this._wasKinematic);const s=10,a=this.rb||this.fastMode;if(this._needsUpdate&&(this.context.time.frameCount%s===0||a)){if(Sm++,a&&mc>0&&this.context.time.frameCount%mc!==0)return;to&&console.debug("[SyncedTransform] Send update",this.context.connection.connectionId,this.guid,this.gameObject.name,this.gameObject.guid),this._needsUpdate=!1;const l=lw(this.guid,this,!!a);this.context.connection.sendBinary(l)}}}class mh{constructor(t,e){r(this,"event");r(this,"button");r(this,"buttonName");r(this,"_used",!1);r(this,"_propagationStopped",!1);r(this,"z__pointer_ctured",!1);r(this,"z__pointer_cture_rleased",!1);r(this,"inputSource");r(this,"object");r(this,"point");r(this,"normal");r(this,"face");r(this,"distance");r(this,"instanceId");r(this,"intersection");r(this,"isDown");r(this,"isUp");r(this,"isPressed");r(this,"isClick");r(this,"isDoubleClick");r(this,"input");this.event=e,this.input=t,this.button=e.button}get deviceIndex(){return this.event.deviceIndex}get pointerId(){return this.event.pointerId}get pressure(){return this.event.pressure}get used(){return this._used}use(){this._used||(this._used=!0,this.event.use())}get propagationStopped(){return this._propagationStopped}stopPropagation(){this._propagationStopped=!0,this.event.stopImmediatePropagation()}stopImmediatePropagation(){this._propagationStopped=!0,this.event.stopImmediatePropagation()}setPointerCapture(){this.z__pointer_ctured=!0}releasePointerCapture(){this.z__pointer_cture_rleased=!0}get mode(){return this.event.mode}clone(){const t=new mh(this.input,this.event);return Object.assign(t,this),t}Use(){this.use()}StopPropagation(){this.event.stopImmediatePropagation()}}function cu(o,t){return C.foreachComponent(o,i=>{if(!i.enabled)return;const n=i;if(t)switch(t){case"pointerdown":if(n.onPointerDown)return!0;break;case"pointerup":if(n.onPointerUp||n.onPointerClick)return!0;break;case"pointermove":if(n.onPointerEnter||n.onPointerExit||n.onPointerMove)return!0;break}else if(n.onPointerDown||n.onPointerUp||n.onPointerEnter||n.onPointerExit||n.onPointerClick)return!0},!1)===!0}const ds=new Array;class Cs{constructor(t,e,i,n){r(this,"enabled",!0);r(this,"target");r(this,"methodName");r(this,"arguments");this.target=t,this.methodName=e||null,this.arguments=i,n!=null&&(this.enabled=n)}get canClone(){return this.target instanceof Object}invoke(...t){if(this.enabled!==!1){if(typeof this.target=="function")this.arguments?(ds.length=0,t!==void 0&&t.length>0&&ds.push(...t),ds.push(...this.arguments),this.target(...this.arguments),ds.length=0):this.target(...t);else if(this.methodName!=null){const e=this.target[this.methodName];typeof e=="function"?this.arguments?(ds.length=0,t!==void 0&&t.length>0&&ds.push(...t),ds.push(...this.arguments),e.call(this.target,...ds),ds.length=0):e.call(this.target,...t):this.arguments?this.target[this.methodName]=this.arguments[0]||t[0]:this.target[this.methodName]=t[0]}}}}const LP=o=>/^[A-Z]*$/.test(o);class Yu extends Event{constructor(){super(...arguments);r(this,"args")}}class ye{constructor(t){r(this,"isEventList",!0);r(this,"target");r(this,"key");r(this,"_isInvoking",!1);r(this,"methods",[]);r(this,"_methodsCopy",[]);if(this.methods=[],Array.isArray(t))for(const e of t)e instanceof Cs?this.methods.push(e):typeof e=="function"&&this.methods.push(new Cs(e));else typeof t=="function"&&this.methods.push(new Cs(t))}__internalOnInstantiate(t){var n;const e=new Array;for(let s=0;s<this.methods.length;s++){const a=this.methods[s];if(!(a.target instanceof Function)){const l=a.target;let c=l==null?void 0:l.uuid;if(l&&(c=l.guid),c){const h=t[c];if(h){const u=(n=a.arguments)==null?void 0:n.map(f=>f instanceof Object&&f.uuid?t[f.uuid]:f!=null&&f.isComponent?t[f.guid]:f);e.push(new Cs(h.clone,a.methodName,u,a.enabled))}else j()&&console.warn("Could not find target for event listener")}}}return new ye(e)}setEventTarget(t,e){if(this.key=t,this.target=e,this.key!==void 0){let i="",n=!1;for(const s of this.key)n&&LP(s)&&(i+="-"),n=!0,i+=s.toLowerCase();this.key=i}}get listenerCount(){var t;return((t=this.methods)==null?void 0:t.length)??0}get isInvoking(){return this._isInvoking}static from(...t){return new ye(t)}invoke(...t){var e;if(this._isInvoking)return console.warn("Circular event invocation detected. Please check your event listeners for circular references.",this),!1;if(((e=this.methods)==null?void 0:e.length)<=0)return!1;this._isInvoking=!0;try{this._methodsCopy.length=0,this._methodsCopy.push(...this.methods);for(const i of this._methodsCopy)i.invoke(...t);if(typeof this.target=="object"&&typeof this.key=="string"){const i=this.target.dispatchEvent;if(typeof i=="function"){const n=new Yu(this.key);n.args=t,i.call(this.target,n)}}}finally{this._isInvoking=!1,this._methodsCopy.length=0}return!0}addEventListener(t){return this.methods.push(new Cs(t)),t}removeEventListener(t){if(t)for(let e=this.methods.length-1;e>=0;e--)this.methods[e].target===t&&(this.methods[e].enabled=!1,this.methods.splice(e,1))}removeAllEventListeners(){this.methods.length=0}}class DP extends Ki{constructor(){super([d.Color,ie],"ColorSerializer")}onDeserialize(t){if(t!=null)return t.a!==void 0?new ie(t.r,t.g,t.b,t.a):t.alpha!==void 0?new ie(t.r,t.g,t.b,t.alpha):new d.Color(t.r,t.g,t.b)}onSerialize(t){if(t!=null)return t.a!==void 0?{r:t.r,g:t.g,b:t.b,a:t.a}:{r:t.r,g:t.g,b:t.b}}}const IP=new DP;class jP extends Ki{constructor(){super([d.Euler],"EulerSerializer")}onDeserialize(t,e){if(t!=null){if(t.order)return new d.Euler(t.x,t.y,t.z,t.order);if(t.x!=null)return new d.Euler(t.x,t.y,t.z)}}onSerialize(t,e){return{x:t.x,y:t.y,z:t.z,order:t.order}}}const BP=new jP;class FP extends Ki{constructor(){super(d.Object3D,"ObjectSerializer")}onSerialize(t,e){if(e.objectToNode!==void 0&&t.uuid){const i=e.objectToNode[t.uuid];return dt&&console.log(i,t.name,t.uuid),{node:i}}}onDeserialize(t,e){var i,n,s;if(typeof t=="string"){if(t.endsWith(".glb")||t.endsWith(".gltf")){if(e.serializable instanceof Array&&e.serializable.includes(te))return;j()&&me("Detected wrong usage of @serializable with Object3D or GameObject. Instead you should use AssetReference here! Please see the console for details.");const a=(n=(i=e.target)==null?void 0:i.constructor)==null?void 0:n.name;console.warn(`Wrong usage of @serializable detected in your script "${a}"
929
929
 
930
930
  It looks like you used @serializable(Object3D) or @serializable(GameObject) for a prefab or scene reference which is exported to a separate glTF file.
931
931
 
@@ -937,7 +937,7 @@ ${e.path}! : AssetReference;
937
937
  Could not find method ${h.method} on object ${f.name}. Please rename ${h.method} to ${b}?
938
938
  `,f[b],`
939
939
  in script: `,f),me("EventList methods must start with lowercase letter, see console for details");return}else console.warn(`EventList method:
940
- Could not find method ${h.method} on object ${f.name}`,f,typeof f[h.method])};if(typeof f[h.method]!="function"){let b=!1,_=f;for(;_;){const v=Object.getOwnPropertyDescriptor(_,h.method);if(v&&(v.writable===!0||v.set)){b=!0;break}_=Object.getPrototypeOf(_)}!b&&(j()||dt)&&g()}}if(f){let g=h.argument;if(g!==void 0?g=u(g):h.arguments!==void 0&&(g=h.arguments.map(u)),!f[h.method])console.warn(`EventList method not found: "${h.method}" on ${f==null?void 0:f.name}`);else{g!==void 0&&!Array.isArray(g)&&(g=[g]);const b=new Cs(f,h.method,g,h.enabled);a.push(b)}}else j()&&console.warn("[Debug] EventList: Could not find event listener in scene",h,e.object,t)}const l=new ye(a);dt&&console.log(l);const c=e.target;return c!==void 0&&e.path!==void 0&&l.setEventTarget(e.path,c),l}}}const NP=new zP,hu=new WeakMap,$P=d.Texture.prototype.clone;d.Texture.prototype.clone=function(){const o=$P.call(this);return hu.has(o)||hu.set(o,this),o};class hw extends Ki{constructor(){super([xr,d.WebGLRenderTarget])}onSerialize(t,e){}onDeserialize(t,e){if(t instanceof d.Texture&&e.type===xr){let i=t;hu.has(i)&&(i=hu.get(i)),i.isRenderTargetTexture=!0,i.flipY=!0,i.offset.y=1,i.repeat.y=-1,i.needsUpdate=!0,i.mipmaps=[],i instanceof d.CompressedTexture&&(i.isCompressedTexture=!1,i.format=d.RGBAFormat);const n=new xr(i.image.width,i.image.height,{colorSpace:d.LinearSRGBColorSpace});return n.texture=i,n}}}new hw;class dw extends Ki{constructor(){super([URL])}onSerialize(t,e){return null}onDeserialize(t,e){if(typeof t=="string"&&t.length>0)return Eo(e.gltfId,t)}}new dw;var VP=Object.defineProperty,WP=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&VP(t,e,n),n};class qa extends I{awake(){Yt.createIfNoneExists(this.context)}onEnable(){var t;(t=Yt.get(this.context))==null||t.register(this)}onDisable(){var t;(t=Yt.get(this.context))==null||t.unregister(this)}}class Ei extends qa{constructor(){super(...arguments);r(this,"targets",null);r(this,"raycastHits",[]);r(this,"ignoreSkinnedMeshes",!1)}start(){this.targets=[this.gameObject]}performRaycast(e=null){if(!this.targets)return null;e??(e=new Ds),e.targets=this.targets,e.results=this.raycastHits,e.useAcceleratedRaycast=!0;const i=e.testObject;this.ignoreSkinnedMeshes&&(e.testObject=s=>s instanceof d.SkinnedMesh?"continue in children":i?i(s):!0);const n=this.context.physics.raycast(e);return e.testObject=i,n}}WP([m()],Ei.prototype,"ignoreSkinnedMeshes");class Ku extends Ei{constructor(){super(),this.ignoreSkinnedMeshes=!0}}const Eu=class Eu extends qa{performRaycast(t){if(!J.active||!Eu.allow||!(t!=null&&t.ray))return null;const e=t.ray.origin;return this.context.physics.sphereOverlap(e,.015,!1,!0)}};r(Eu,"allow",!0);let Tr=Eu;class Eg{static getObject(t){const e=t[Si];return e&&(e.isComponent===!0?t=e.gameObject:t=e),t}static isInteractable(t,e){if(e&&(e.canvasGroup=void 0,e.graphic=void 0),t==null||!t.visible||(t=this.getObject(t),!t.visible))return!1;const i=this.tryFindCanvasGroup(t);if((i==null?void 0:i.isCanvasGroup)===!0&&(e&&(e.canvasGroup=i),i.blocksRaycasts===!1||i.interactable===!1))return!1;const n=Rr(t,s=>{if(s.isGraphic===!0)return s},!1);return e&&(n==null?void 0:n.isGraphic)===!0&&(e.graphic=n),!((n==null?void 0:n.raycastTarget)===!1||(n==null?void 0:n.layer)===2)}static tryFindCanvasGroup(t){if(!t)return null;const e=Rr(t,i=>{const n=i;if(n.blocksRaycasts!==void 0&&n.interactable!==void 0)return n},!1);return e!==void 0?e:this.tryFindCanvasGroup(t.parent)}}function Tg(o){const t=o[Si];return t||(o.parent?Tg(o.parent):null)}function GP(o){return o.isUI===!0||typeof o[Si]=="object"}function du(o,t){if(!o)return;const e=o.material;if((e==null?void 0:e.isMaterial)===!0){const i=o.parent;i&&i.isText,e.side=t.doubleSided??!0?d.DoubleSide:d.FrontSide,e.shadowSide=t.doubleSided?d.DoubleSide:d.FrontSide,o.castShadow=t.castShadows?t.castShadows:!1,o.receiveShadow=t.receiveShadows?t.receiveShadows:!1}for(const i of o.children)du(i,t)}function ma(o,t,e){o[t]===void 0&&console.warn("Field",t,"is undefined on",o);const i=Proxy.revocable(o[t],{set(a,l,c,h){const u=a[l],f=Reflect.set(a,l,c,h);return e(c,u),f}}),n=i.revoke,s=o[t];return i.revoke=()=>{o[t]=s,n()},o[t]=i.proxy,i}const ab=Symbol("Scheduled action");function HP(o,t,e=we.OnBeforeRender){let i=o[ab];i||(i=o[ab]={});const n=t.name;i[e]||(i[e]={});const s=i[e];if(s[n])return;function*l(){t==null||t.call(o),s[n]=null}const c=o.startCoroutine(l(),e);s[n]=c}const io=S("debugeventsystem");var Cm=(o=>(o.BeforeHandleInput="BeforeHandleInput",o.AfterHandleInput="AfterHandleInput",o))(Cm||{});Jv(o=>{Yt.createIfNoneExists(o)});class Yt extends I{constructor(){super(...arguments);r(this,"raycaster",[]);r(this,"pressedByID",new Map);r(this,"hoveredByID",new Map);r(this,"onPointerEvent",e=>{if(e===void 0||e.propagationStopped||e.defaultPrevented||e.used)return;const i=new mh(this.context.input,e);this._currentPointerEventName=e.type,i.inputSource=this.context.input,i.isClick=e.isClick,i.isDoubleClick=e.isDoubleClick,i.isDown=e.type==Re.PointerDown,i.isUp=e.type==Re.PointerUp,i.isPressed=this.context.input.getPointerPressed(e.pointerId);const n=new Ds;e.hasRay?n.ray=e.ray:n.screenPoint=this.context.input.getPointerPositionRC(e.pointerId),n.allowSlowRaycastFallback=e.isClick||e.isDoubleClick;const s=this.performRaycast(n);if(io&&(i.isDown?console.log("DOWN",{id:i.pointerId,hits:s.length}):i.isUp&&console.log("UP",{id:i.pointerId,hits:s.length}),i.isClick&&console.log("CLICK",{id:i.pointerId,hits:s.length})),s){for(const l of s)l.event=e,e.intersections.push(l);e.origin.onPointerHits&&e.origin.onPointerHits({sender:this,event:e,hits:s})}io&&i.isClick&&Ee("EventSystem: "+i.pointerId+" - "+this.context.time.frame+" - Up:"+i.isUp+", Down:"+i.isDown);const a={sender:this,args:i,hasActiveUI:this.currentActiveMeshUIComponents.length>0};this.dispatchEvent(new CustomEvent("BeforeHandleInput",{detail:a})),this.handleIntersections(s,i),this.dispatchEvent(new CustomEvent("AfterHandleInput",{detail:a}))});r(this,"_sortedHits",[]);r(this,"_testObjectsCache",new Map);r(this,"_currentlyActiveRaycaster",null);r(this,"_currentPointerEventName",null);r(this,"shouldRaycastObject",e=>{var a;const i=e&&"getComponent"in e?e.getComponent(qa):null;if(i&&i!=this._currentlyActiveRaycaster)return!1;let n=null;if(GP(e)&&(n=(a=e[Si])==null?void 0:a.gameObject),this._testObjectsCache.has(e)||n&&this._testObjectsCache.has(n))return this._testObjectsCache.get(e)===!1?"continue in children":!0;{let l=cu(e,this._currentPointerEventName);if(!l&&n&&(l=cu(n,this._currentPointerEventName)),l){this._testObjectsCache.set(e,!0);for(const c of e.children)this.shouldRaycastObject_AddToYesCache(c);return!0}return this._testObjectsCache.set(e,!1),"continue in children"}});r(this,"_sortingBuffer",[]);r(this,"_noDepthTestingResults",[]);r(this,"out",{});r(this,"_capturedPointer",{});r(this,"pointerEnterSymbol",Symbol("pointerEnter"));r(this,"pointerExitSymbol",Symbol("pointerExit"));r(this,"currentActiveMeshUIComponents",[])}static ensureUpdateMeshUI(e,i,n=!1){po.update(e,i,n)}static markUIDirty(e){po.markDirty()}static createIfNoneExists(e){e.scene.getComponent(Yt)||e.scene.addComponent(Yt)}static get(e){return this.createIfNoneExists(e),e.scene.getComponent(Yt)}static get instance(){return this.get(X.Current)}register(e){var i;e&&this.raycaster&&!this.raycaster.includes(e)&&((i=this.raycaster)==null||i.push(e))}unregister(e){var n,s;const i=(n=this.raycaster)==null?void 0:n.indexOf(e);i!==void 0&&i!==-1&&((s=this.raycaster)==null||s.splice(i,1))}get hasActiveUI(){return this.currentActiveMeshUIComponents.length>0}get isHoveringObjects(){return this.hoveredByID.size>0}awake(){this.gameObject!==this.context.scene&&(console.debug(`[Needle Engine] EventSystem is only allowed on the scene root. Disabling EventSystem on '${this.gameObject.name}'`),this.enabled=!1)}start(){this.context.scene.getComponent(qa)||this.context.scene.addComponent(Ei)}onEnable(){this.context.input.addEventListener(Re.PointerDown,this.onPointerEvent),this.context.input.addEventListener(Re.PointerUp,this.onPointerEvent),this.context.input.addEventListener(Re.PointerMove,this.onPointerEvent)}onDisable(){this.context.input.removeEventListener(Re.PointerDown,this.onPointerEvent),this.context.input.removeEventListener(Re.PointerUp,this.onPointerEvent),this.context.input.removeEventListener(Re.PointerMove,this.onPointerEvent)}onBeforeRender(){this.resetMeshUIStates()}shouldRaycastObject_AddToYesCache(e){this._testObjectsCache.set(e,!0);for(const i of e.children)this.shouldRaycastObject_AddToYesCache(i)}performRaycast(e){if(!this.raycaster)return null;this._testObjectsCache.clear(),this._sortedHits.length=0,e.testObject=this.shouldRaycastObject;for(const i of this.raycaster){if(!i.activeAndEnabled)continue;this._currentlyActiveRaycaster=i;const n=i.performRaycast(e);this._currentlyActiveRaycaster=null,n&&n.length>0&&this._sortedHits.push(...n)}return this._sortedHits.sort((i,n)=>i.distance-n.distance),this._sortedHits}assignHitInformation(e,i){i?(e.intersection=i,e.point=i.point,e.normal=i.normal,e.face=i.face,e.distance=i.distance,e.instanceId=i.instanceId):(e.intersection=void 0,e.point=void 0,e.normal=void 0,e.face=void 0,e.distance=void 0,e.instanceId=void 0)}handleIntersections(e,i){var s;if(e!=null&&e.length){e=this.sortCandidates(e);for(const a of e){if(i.event.immediatePropagationStopped)return!1;if(this.assignHitInformation(i,a),this.handleEventOnObject(a.object,i))return!0}}this.assignHitInformation(i,e==null?void 0:e[0]),this.invokePointerCapture(i);const n=this.hoveredByID.get(i.pointerId);return n&&this.propagatePointerExit(n.obj,n.data,null),this.hoveredByID.delete(i.pointerId),i.isUp&&((s=this.pressedByID.get(i.pointerId))==null||s.handlers.forEach(a=>this.invokeOnPointerUp(i,a)),this.pressedByID.delete(i.pointerId)),!1}sortCandidates(e){this._sortingBuffer.length=0,this._noDepthTestingResults.length=0;for(let i=0;i<e.length;i++){const n=e[i],s=n.object;if(s.material&&s.material.depthTest===!1){this._noDepthTestingResults.push(n);continue}this._sortingBuffer.push(n)}for(const i of this._sortingBuffer)this._noDepthTestingResults.push(i);return this._noDepthTestingResults}handleEventOnObject(e,i){if(!this.testIsVisible(e))return i.isClick&&io&&console.log("not allowed",e),!1;if(i.pointerId===void 0)return io&&console.error("Event without pointer can't be handled",i),!1;i.object=e;const n=e.parent,s=i.isClick??!1;let a=null;if(n&&n.isUI){const f=(i.isPressed||i.isClick)??!1;if(n[Si]){const p=n[Si].gameObject;if(p){if(!Eg.isInteractable(p,this.out))return!1;a=this.out.canvasGroup??null,this.handleMeshUIIntersection(e,f),e=p}}}s&&io&&console.log(this.context.time.frame,e);const l=this.hoveredByID.get(i.pointerId),c=l==null?void 0:l.obj;c!==e&&c&&this.propagatePointerExit(c,l.data,e);const u=this.hoveredByID.get(i.pointerId);if(u?(u.obj=e,u.data=i):this.hoveredByID.set(i.pointerId,{obj:e,data:i}),i.isDown){const f=this.pressedByID.get(i.pointerId);f?(f.obj=e,f.data=i):this.pressedByID.set(i.pointerId,{obj:e,data:i,handlers:new Set})}return(a===null||a.interactable)&&this.handleMainInteraction(e,i,c??null),!0}propagate(e,i){for(;e;)C.foreachComponent(e,n=>{i(n)},!1),e=e.parent}handleMainInteraction(e,i,n){const s=this.pressedByID.get(i.pointerId),a=n!==e;let l=!0;switch(i.event.pointerType){case"mouse":case"touch":const c=this.context.input.getPointerPositionLastFrame(i.pointerId),h=this.context.input.getPointerPosition(i.pointerId);l=c&&!z.approximately(c,h);break}this.propagate(e,c=>{var u;const h=c;h.interactable!==!1&&(!h.activeAndEnabled||!h.enabled||(h.onPointerEnter&&a&&this.handlePointerEnter(h,i),i.isDown&&h.onPointerDown&&(h.onPointerDown(i),s==null||s.handlers.add(h),this.handlePointerCapture(i,h)),h.onPointerMove&&(l&&h.onPointerMove(i),this.handlePointerCapture(i,h)),i.isUp&&(h.onPointerUp&&(this.invokeOnPointerUp(i,h),s==null||s.handlers.delete(h)),h.onPointerExit&&((u=i.event)==null?void 0:u.pointerType)===Nu.Touch&&(this.handlePointerExit(h,i),this.hoveredByID.delete(i.pointerId))),i.isClick&&h.onPointerClick&&h.onPointerClick(i)))}),i.isUp&&(s==null||s.handlers.forEach(c=>{this.invokeOnPointerUp(i,c)}),this.pressedByID.delete(i.pointerId))}propagatePointerExit(e,i,n){this.propagate(e,s=>{if(!s.gameObject||s.destroyed)return;const a=s;if(a.onPointerExit||a.onPointerEnter){if(n&&this.isChild(n,s.gameObject))return;this.handlePointerExit(a,i)}})}invokeOnPointerUp(e,i){var n;(n=i.onPointerUp)==null||n.call(i,e),this.releasePointerCapture(e,i)}handlePointerEnter(e,i){e.onPointerEnter&&this.updatePointerState(e,i.pointerId,this.pointerEnterSymbol,!0)&&e.onPointerEnter(i),this.updatePointerState(e,i.pointerId,this.pointerExitSymbol,!1)}handlePointerExit(e,i){e.onPointerExit&&this.updatePointerState(e,i.pointerId,this.pointerExitSymbol,!0)&&e.onPointerExit(i),this.updatePointerState(e,i.pointerId,this.pointerEnterSymbol,!1)}updatePointerState(e,i,n,s){let a=e[n];if(s)return a&&a.includes(i)?!1:(a=a||[],a.push(i),e[n]=a,!0);{if(!a||!a.includes(i))return!1;const l=a.indexOf(i);return l!==-1&&a.splice(l,1),!0}}handlePointerCapture(e,i){if(e.z__pointer_ctured){e.z__pointer_ctured=!1;const n=e.pointerId;if(i.onPointerMove){const s=this._capturedPointer[n]||[];s.push(i),this._capturedPointer[n]=s}else j()&&!i.z__warned_no_pointermove&&(i.z__warned_no_pointermove=!0,console.warn("PointerCapture was requested but the component doesn't implement onPointerMove. It will not receive any pointer events"))}else e.z__pointer_cture_rleased&&(e.z__pointer_cture_rleased=!1,this.releasePointerCapture(e,i))}releasePointerCapture(e,i){const n=e.pointerId;if(this._capturedPointer[n]){const s=this._capturedPointer[n].indexOf(i);s!==-1&&(this._capturedPointer[n].splice(s,1),io&&console.log("released pointer capture",n,i,this._capturedPointer))}}invokePointerCapture(e){var i;if(e.event.type===Re.PointerMove){const n=e.pointerId,s=this._capturedPointer[n];if(s){io&&console.log("Captured",n,s);for(let a=0;a<s.length;a++){const l=s[a];if(l.destroyed){s.splice(a,1),a--;continue}(i=l.onPointerMove)==null||i.call(l,e)}}}}isChild(e,i){return!e||!i?!1:e===i?!0:e.parent?this.isChild(e.parent,i):!1}handleMeshUiObjectWithoutShadowDom(e,i){return!e||!e.isUI?!0:this.handleMeshUIIntersection(e,i)}handleMeshUIIntersection(e,i){const n=po.updateState(e,i);return n&&this.currentActiveMeshUIComponents.push(n),n!==null}resetMeshUIStates(){if(this.context.input.getPointerPressedCount()>0&&po.resetLastSelected(),!(!this.currentActiveMeshUIComponents||this.currentActiveMeshUIComponents.length<=0)){for(let e=0;e<this.currentActiveMeshUIComponents.length;e++){const i=this.currentActiveMeshUIComponents[e];po.resetState(i)}this.currentActiveMeshUIComponents.length=0}}testIsVisible(e){return e?C.isActiveSelf(e)?this.testIsVisible(e.parent):!1:!0}}class po{static markDirty(){this.needsUpdate=!0}static update(t,e,i=!1){if(i){t.update();return}const n=e.time.frameCount;for(const s of this.lastUpdateFrame)if(s.context===e){if(n===s.frame)return;s.frame=n;let a=this.needsUpdate||n<1;s.nextUpdate<=n&&(a=!0),a&&(io&&console.log("Update threemeshui"),this.needsUpdate=!1,s.nextUpdate=n+60,t.update());return}this.lastUpdateFrame=[{context:e,frame:n,nextUpdate:n+60}],t.update(),this.needsUpdate=!1}static updateState(t,e){let i=null;if(t&&(i=this.findBlockOrTextInParent(t),i&&i!==this.lastSelected)){if(i.interactable===!1)return null;this.needsUpdate=!0}return i}static resetLastSelected(){const t=this.lastSelected;t&&(this.lastSelected=null,this.resetState(t))}static resetState(t){t&&(this.needsUpdate=!0)}static findBlockOrTextInParent(t){return t?t.isBlock||t.isText?t:this.findBlockOrTextInParent(t.parent):null}}r(po,"lastSelected",null),r(po,"lastUpdateFrame",[]),r(po,"needsUpdate",!1);var qP=Object.defineProperty,Te=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&qP(t,e,n),n};const Ui=S("debugorbit"),cp=S("freecam"),Tl=S("debugcamerafit"),hd=S("smoothcam"),XP={LEFT:"",UP:"",RIGHT:"",BOTTOM:""};let hp;class Fc extends CustomEvent{constructor(t,e){super("target-reached",{detail:{controls:t,type:e}})}}class ge extends I{constructor(){super(...arguments);r(this,"autoTarget",!0);r(this,"autoFit",!1);r(this,"enableRotate",!0);r(this,"autoRotate",!1);r(this,"autoRotateSpeed",1);r(this,"minAzimuthAngle",1/0);r(this,"maxAzimuthAngle",1/0);r(this,"minPolarAngle",0);r(this,"maxPolarAngle",Math.PI);r(this,"enableKeys",!1);r(this,"enableDamping",!0);r(this,"dampingFactor",.1);r(this,"enableZoom",!0);r(this,"minZoom",0);r(this,"maxZoom",1/0);r(this,"zoomSpeed",1);r(this,"zoomToCursor",!1);r(this,"enablePan",!0);r(this,"lookAtConstraint",null);r(this,"lookAtConstraint01",1);r(this,"allowInterrupt",!0);r(this,"middleClickToFocus",!0);r(this,"doubleClickToFocus",!0);r(this,"clickBackgroundToFitScene",2);r(this,"debugLog",!1);r(this,"targetLerpDuration",1);r(this,"_controls",null);r(this,"_cameraObject",null);r(this,"_lookTargetLerpActive",!1);r(this,"_lookTargetStartPosition",new d.Vector3);r(this,"_lookTargetEndPosition",new d.Vector3);r(this,"_lookTargetLerp01",0);r(this,"_lookTargetLerpDuration",0);r(this,"_cameraLerpActive",!1);r(this,"_cameraStartPosition",new d.Vector3);r(this,"_cameraEndPosition",new d.Vector3);r(this,"_cameraLerp01",0);r(this,"_cameraLerpDuration",0);r(this,"_fovLerpActive",!1);r(this,"_fovLerpStartValue",0);r(this,"_fovLerpEndValue",0);r(this,"_fovLerp01",0);r(this,"_fovLerpDuration",0);r(this,"_inputs",0);r(this,"_enableTime",0);r(this,"_startedListeningToKeyEvents",!1);r(this,"_eventSystem");r(this,"_afterHandleInputFn");r(this,"_camera",null);r(this,"_syncedTransform");r(this,"_didSetTarget",0);r(this,"targetElement",null);r(this,"_activePointerEvents");r(this,"_lastTimeClickOnBackground",-1);r(this,"_clickOnBackgroundCount",0);r(this,"_onPointerDown",e=>{this._activePointerEvents.push(e)});r(this,"_onPointerDownLate",e=>{e.used&&this._controls&&(this._controls.enabled=!1)});r(this,"_onPointerUp",e=>{for(let i=this._activePointerEvents.length-1;i>=0;i--){const n=this._activePointerEvents[i];if(n.pointerId===e.pointerId&&n.button===e.button){this._activePointerEvents.splice(i,1);break}}if(this.clickBackgroundToFitScene>0&&e.isClick&&e.button===0){if(e.hasRay||e.intersections.push(...this.context.physics.raycast()),e.intersections.length<=0){const i=this.context.time.time-this._lastTimeClickOnBackground;this._lastTimeClickOnBackground=this.context.time.time,this.clickBackgroundToFitScene<=1||i<this.clickBackgroundToFitScene*.15?(this._clickOnBackgroundCount+=1,this._clickOnBackgroundCount>=this.clickBackgroundToFitScene-1&&this.fitCamera(this.context.scene.children,{immediate:!1})):this._clickOnBackgroundCount=0}Ui&&console.log(this.clickBackgroundToFitScene,e.intersections.length,this._clickOnBackgroundCount)}});r(this,"_onPointerUpLate",e=>{this.doubleClickToFocus&&e.isDoubleClick&&!e.used&&this.setTargetFromRaycast()});r(this,"_orbitStartAngle",0);r(this,"_zoomStartDistance",0);r(this,"onControlsChangeStarted",()=>{this._controls&&(this._orbitStartAngle=this._controls.getAzimuthalAngle()+this._controls.getPolarAngle(),this._zoomStartDistance=this._controls.getDistance()),this._syncedTransform&&this._syncedTransform.requestOwnership()});r(this,"onControlsChangeEnded",()=>{if(this._controls&&this.autoTarget){const i=this._controls.getAzimuthalAngle()+this._controls.getPolarAngle()-this._orbitStartAngle;Math.abs(i)<.01?(Ui&&console.debug("OrbitControls: Update target",{deltaAngle:i}),this.updateTargetNow({allowSlowRaycastFallback:!1})):Ui&&console.debug("OrbitControls: No target update",{deltaAngle:i})}});r(this,"_shouldDisable",!1);r(this,"__onPreRender",()=>{const e=this.context.pre_render_callbacks.indexOf(this.__onPreRender);e>=0&&this.context.pre_render_callbacks.splice(e,1),this.autoFit&&(this.autoFit=!1,this.fitCamera({centerCamera:"y",immediate:!0,objects:this.scene.children}))});r(this,"_haveAttachedKeyboardEvents",!1)}get isCameraController(){return!0}get controls(){return this._controls}get controllerObject(){return this._cameraObject}onStartInteraction(e){var i;(i=this.controls)==null||i.addEventListener("start",e)}get targetLerpSpeed(){return 5}set targetLerpSpeed(e){this.targetLerpDuration=1/e}rotateLeft(e){var i;(i=this._controls)==null||i._rotateLeft(e)}pan(e,i){var n;(n=this._controls)==null||n._pan(e,i)}zoomIn(e){var i,n;e>0?(i=this._controls)==null||i._dollyIn(1-e):e<0&&((n=this._controls)==null||n._dollyOut(1+e))}awake(){Ui&&console.debug("OrbitControls",this),this._didSetTarget=0,this._startedListeningToKeyEvents=!1}start(){this._eventSystem=Yt.get(this.context)??void 0,this._eventSystem&&(this._afterHandleInputFn=this.afterHandleInput.bind(this),this._eventSystem.addEventListener(Cm.AfterHandleInput,this._afterHandleInputFn))}onDestroy(){var e,i;(e=this._controls)==null||e.dispose(),(i=this._eventSystem)==null||i.removeEventListener(Cm.AfterHandleInput,this._afterHandleInputFn)}onEnable(){this._didSetTarget=0,this._enableTime=this.context.time.time;const e=C.getComponent(this.gameObject,ai);this._camera=e;let i=e==null?void 0:e.threeCamera;if(!i&&this.gameObject instanceof d.PerspectiveCamera&&(i=this.gameObject),i&&Zp(i,this,!0),!this._controls&&i instanceof d.Object3D){this._cameraObject=i;const n=this.targetElement??this.context.renderer.domElement,s=i==null?void 0:i.quaternion.clone();this._controls=new H.OrbitControls(i,n),i==null||i.quaternion.copy(s),hp===void 0&&(hp={...this._controls.keys});const a=Q(i),l=this.gameObject.worldForward,h=a.clone().sub(l.multiplyScalar(2.5));this._controls.target.copy(h)}if(this._controls)if(cp&&(this.enablePan=!0,this.enableZoom=!0,this.middleClickToFocus=!0,exports.DeviceUtilities.isMobileDevice()&&(this.doubleClickToFocus=!0)),this._controls.addEventListener("start",this.onControlsChangeStarted),this._controls.addEventListener("endMovement",this.onControlsChangeEnded),!this._startedListeningToKeyEvents&&this.enableKeys)this._startedListeningToKeyEvents=!0,this._controls.listenToKeyEvents(this.context.domElement);else try{this._controls.stopListenToKeyEvents()}catch{}this._syncedTransform=C.getComponent(this.gameObject,es)??void 0,this.context.pre_render_callbacks.push(this.__onPreRender),this._activePointerEvents=[],this.context.input.addEventListener("pointerdown",this._onPointerDown,{queue:ri.Early}),this.context.input.addEventListener("pointerdown",this._onPointerDownLate,{queue:ri.Late}),this.context.input.addEventListener("pointerup",this._onPointerUp,{queue:ri.Early}),this.context.input.addEventListener("pointerup",this._onPointerUpLate,{queue:ri.Late})}onDisable(){var e;if((e=this._camera)!=null&&e.threeCamera&&Zp(this._camera.threeCamera,this,!1),this._controls){this._controls.enabled=!1,this._controls.autoRotate=!1,this._controls.removeEventListener("start",this.onControlsChangeStarted),this._controls.removeEventListener("endMovement",this.onControlsChangeEnded);try{this._controls.stopListenToKeyEvents()}catch{}this._startedListeningToKeyEvents=!1}this._activePointerEvents.length=0,this.context.input.removeEventListener("pointerdown",this._onPointerDown),this.context.input.removeEventListener("pointerdown",this._onPointerDownLate),this.context.input.removeEventListener("pointerup",this._onPointerUp),this.context.input.removeEventListener("pointerup",this._onPointerUpLate)}updateTargetNow(e){var a,l,c;const i=new d.Ray((a=this._cameraObject)==null?void 0:a.worldPosition,(l=this._cameraObject)==null?void 0:l.worldForward.multiplyScalar(-1)),n=this.context.physics.raycastFromRay(i,e),s=n.length>0?n[0]:void 0;s&&s.distance>this.minZoom&&s.distance<this.maxZoom&&(Ui&&$.DrawWireSphere(s.point,.1,16711680,2),(c=this._controls)==null||c.target.copy(n[0].point))}afterHandleInput(e){e.detail.args.pointerId===0&&(e.detail.args.isDown?this._controls&&this._eventSystem&&(this._shouldDisable=this._eventSystem.hasActiveUI):(!e.detail.args.isPressed||e.detail.args.isUp)&&(this._shouldDisable=!1))}onBeforeRender(){var i,n,s,a;if(!this._controls)return;if(this._cameraObject!==this.context.mainCamera){this._controls.enabled=!1;return}if(this._controls.enabled=!0,(this.context.input.getPointerDown(1)||this.context.input.getPointerDown(2)||this.context.input.mouseWheelChanged||this.context.input.getPointerPressed(0)&&((i=this.context.input.getPointerPositionDelta(0))!=null&&i.length()))&&(this._inputs+=1),this._inputs>0&&this.allowInterrupt&&(this.enableRotate&&(this.autoRotate=!1),this._cameraLerpActive=!1,this._lookTargetLerpActive=!1),this._inputs=0,this.autoTarget&&this._didSetTarget++===0){const l=C.getComponent(this.gameObject,ai);if(l&&!this.setLookTargetFromConstraint()){this.debugLog&&console.log("NO TARGET");const c=Q(l.threeCamera),h=Math.max(.01,c.length()),u=new d.Vector3(0,0,-h).applyMatrix4(l.threeCamera.matrixWorld);Ui&&$.DrawLine(c,u,5592575,10),this.setLookTargetPosition(u,!0)}if(!this.setLookTargetFromConstraint()){const c=new Ds;c.screenPoint=new d.Vector2(0,0),c.lineThreshold=.1;const h=this.context.physics.raycast(c);h.length>0&&this.setLookTargetPosition(h[0].point,!0),Tl&&console.log("OrbitControls hits",...h)}}if(this.middleClickToFocus&&this.context.input.getPointerClicked(1)&&this.setTargetFromRaycast(),this._lookTargetLerpActive||this._cameraLerpActive||this._fovLerpActive){if(this._cameraLerpActive&&this._cameraObject)if(this._cameraLerp01+=this.context.time.deltaTime/this._cameraLerpDuration,this._cameraLerp01>=1)this._cameraObject.position.copy(this._cameraEndPosition),this._cameraLerpActive=!1,this.dispatchEvent(new Fc(this,"camera"));else{const l=z.easeInOutCubic(this._cameraLerp01);this._cameraObject.position.lerpVectors(this._cameraStartPosition,this._cameraEndPosition,l)}if(this._lookTargetLerpActive)if(this._lookTargetLerp01+=this.context.time.deltaTime/this._lookTargetLerpDuration,this._lookTargetLerp01>=1)this._controls.target.copy(this._lookTargetEndPosition),this._lookTargetLerpActive=!1,this.dispatchEvent(new Fc(this,"lookat"));else{const l=z.easeInOutCubic(this._lookTargetLerp01);this._controls.target.lerpVectors(this._lookTargetStartPosition,this._lookTargetEndPosition,l)}if(this._fovLerpActive&&this._cameraObject){const l=this._cameraObject;if(this._fovLerp01+=this.context.time.deltaTime/this._fovLerpDuration,this._fovLerp01>=1)l.fov=this._fovLerpEndValue,this._fovLerpActive=!1;else{const c=z.easeInOutCubic(this._fovLerp01);l.fov=z.lerp(this._fovLerpStartValue,this._fovLerpEndValue,c)}l.updateProjectionMatrix()}}if(this._controls){if(this.debugLog&&(this._controls.domElement=this.context.renderer.domElement),this._controls.enabled=!this._shouldDisable&&this._camera===this.context.mainCameraComponent&&!this.context.isInXR&&!this._activePointerEvents.some(l=>l.used),this._controls.keys=this.enableKeys?hp:XP,this._controls.autoRotate=this.autoRotate,this._controls.autoRotateSpeed=this.autoRotateSpeed,this._controls.enableZoom=this.enableZoom,this._controls.zoomSpeed=this.zoomSpeed,this._controls.zoomToCursor=this.zoomToCursor,this._controls.enableDamping=this.enableDamping,this._controls.dampingFactor=this.dampingFactor,this._controls.enablePan=this.enablePan,this._controls.enableRotate=this.enableRotate,this._controls.minAzimuthAngle=this.minAzimuthAngle,this._controls.maxAzimuthAngle=this.maxAzimuthAngle,this._controls.minPolarAngle=this.minPolarAngle,this._controls.maxPolarAngle=this.maxPolarAngle,cp||(((s=(n=this._camera)==null?void 0:n.threeCamera)==null?void 0:s.type)==="PerspectiveCamera"?(this._controls.minDistance=this.minZoom,this._controls.maxDistance=this.maxZoom,this._controls.minZoom=0,this._controls.maxZoom=1/0):(this._controls.minDistance=0,this._controls.maxDistance=1/0,this._controls.minZoom=this.minZoom,this._controls.maxZoom=this.maxZoom)),typeof hd=="number"||hd===!0){this._controls.enableDamping=!0;const l=typeof hd=="number"?hd:.99;this._controls.dampingFactor=Math.max(.001,1-Math.min(1,l))}this.allowInterrupt||(this._lookTargetLerpActive&&(this._controls.enablePan=!1),this._cameraLerpActive&&(this._controls.enableRotate=!1,this._controls.autoRotate=!1),(this._lookTargetLerpActive||this._cameraLerpActive)&&(this._controls.enableZoom=!1)),this.context.isInXR||(!cp&&((a=this.lookAtConstraint)!=null&&a.locked)&&this.setLookTargetFromConstraint(0,this.lookAtConstraint01),this._controls.update(this.context.time.deltaTime),Ui&&$.DrawWireSphere(this._controls.target,.1,65280))}}setCameraAndLookTarget(e,i=!1){if(!e)return(j()||Ui)&&console.warn("[OrbitControls] setCameraAndLookTarget target is null"),!1;if(!(e instanceof d.Object3D)&&!(e instanceof ai))return(j()||Ui)&&console.warn("[OrbitControls] setCameraAndLookTarget target is not an Object3D or Camera"),!1;e instanceof ai&&(e=e.gameObject);const n=e.worldPosition,s=e.worldForward;e instanceof d.Camera&&(Ui&&console.debug("[OrbitControls] setCameraAndLookTarget flip forward direction for camera"),s.multiplyScalar(-1));const a=new d.Ray(n,s);return Ui&&$.DrawRay(a.origin,a.direction,16711680,10),this.setTargetFromRaycast(a,i)||this.setLookTargetPosition(a.at(2,V()),i),this.setCameraTargetPosition(n,i),!0}setCameraTargetPosition(e,i=!1){var n;e&&(e instanceof d.Object3D&&(e=Q(e)),this._cameraEndPosition||(this._cameraEndPosition=new d.Vector3),this._cameraEndPosition.copy(e),i===!0?(this._cameraLerpActive=!1,this._cameraObject&&this._cameraObject.position.copy(this._cameraEndPosition)):this._cameraObject&&(this._cameraLerpActive=!0,this._cameraLerp01=0,this._cameraStartPosition.copy((n=this._cameraObject)==null?void 0:n.position),typeof i=="number"?this._cameraLerpDuration=i:this._cameraLerpDuration=this.targetLerpDuration))}get cameraLerpActive(){return this._cameraLerpActive}stopCameraLerp(){this._cameraLerpActive=!1}setFieldOfView(e,i=!1){var s;if(!this._controls||typeof e!="number")return;const n=(s=this._camera)==null?void 0:s.threeCamera;n&&(i===!0?n.fov=e:(this._fovLerpActive=!0,this._fovLerp01=0,this._fovLerpStartValue=n.fov,this._fovLerpEndValue=e,typeof i=="number"?this._fovLerpDuration=i:this._fovLerpDuration=this.targetLerpDuration))}setLookTargetPosition(e=null,i=!1){this._controls&&e&&(e instanceof d.Object3D&&(e=Q(e)),this._lookTargetEndPosition.copy(e),this._didSetTarget++,Ui&&(console.warn("OrbitControls: setLookTargetPosition",e,i),$.DrawWireSphere(this._lookTargetEndPosition,.2,16711680,2)),i===!0?this._controls.target.copy(this._lookTargetEndPosition):(this._lookTargetLerpActive=!0,this._lookTargetLerp01=0,this._lookTargetStartPosition.copy(this._controls.target),typeof i=="number"?this._lookTargetLerpDuration=i:this._lookTargetLerpDuration=this.targetLerpDuration))}get lookTargetLerpActive(){return this._lookTargetLerpActive}stopLookTargetLerp(){this._lookTargetLerpActive=!1}setLookTargetFromConstraint(e=0,i=1){var s,a;if(!this._controls||((s=this.lookAtConstraint)==null?void 0:s.enabled)===!1)return!1;const n=(a=this.lookAtConstraint)==null?void 0:a.sources;if(n&&n.length>0){const l=n[e];if(l)return l.getWorldPosition(this._lookTargetEndPosition),this.lerpLookTarget(this._lookTargetEndPosition,i),!0}return!1}lerpTarget(e,i){return this.lerpLookTarget(e,i)}lerpLookTarget(e,i){this._controls&&(i>=1?this._controls.target.copy(e):this._controls.target.lerp(e,i))}setTargetFromRaycast(e,i=!1){if(!this.controls)return!1;const n=e?this.context.physics.raycastFromRay(e):this.context.physics.raycast();for(const s of n)if(s.distance>0&&C.isActiveInHierarchy(s.object)){const a=Tg(s.object);if(a){const l=a.canvas;if(l!=null&&l.screenspace)break}return this.setLookTargetPosition(s.point,i),!0}return!1}fitCamera(e,i){var G,B;if(this.context.isInXR)return;let n;if(Array.isArray(e)?n=e:e&&"type"in e?n=e.children:e&&typeof e=="object"&&!(e instanceof d.Object3D)&&!Array.isArray(e)&&(i=e,n=i.objects),n&&!Array.isArray(n)&&(n=n.children),(!Array.isArray(n)||n&&n.length<=0)&&(n=this.context.scene.children),!Array.isArray(n)||n.length<=0){console.warn("No objects to fit camera to...");return}const s=this._cameraObject,a=this._controls;if(!s||!a){console.warn("No camera or controls found to fit camera to objects...");return}i||(i={});const{immediate:l=!1,centerCamera:c="y",cameraNearFar:h="auto",fitOffset:u=1.1,fov:f=s==null?void 0:s.fov}=i,p=new d.Vector3,g=new d.Vector3,y=ci(n,void 0,(B=(G=this._camera)==null?void 0:G.threeCamera)==null?void 0:B.layers),b=y.clone();s.updateMatrixWorld(),s.updateProjectionMatrix(),y.getCenter(g);const _=new d.Vector3;if(y.getSize(_),y.applyMatrix4(s.matrixWorldInverse),y.getSize(p),y.setFromCenterAndSize(g,p),Number.isNaN(p.x)||Number.isNaN(p.y)||Number.isNaN(p.z)){console.warn("Camera fit size resultet in NaN",s,y,[...n]);return}if(p.length()<=1e-10){Tl&&console.warn("Camera fit size is zero",y,[...n]);return}const v=i.fov||s.fov,w=2*Math.atan(Math.tan(v*Math.PI/360/2)*s.aspect)/Math.PI*360,x=p.y/(2*Math.atan(Math.PI*v/360)),O=p.x/(2*Math.atan(Math.PI*w/360)),E=u*Math.max(x,O)+p.z/2;Tl&&console.log("Fit camera to objects",{fitHeightDistance:x,fitWidthDistance:O,distance:E,verticalFov:v,horizontalFov:w}),this.maxZoom=E*10,this.minZoom=E*.01;const M=.05,R=g.clone();if(R.y-=p.y*M,this.setLookTargetPosition(R,l),this.setFieldOfView(i.fov,l),h==null||h=="auto"){const L=C.findObjectOfType(ss),N=L?L.radius:0,Y=Math.max(_.x,_.y,_.z,N);s.near=E/100,s.far=Y+E*10,L&&(this.maxZoom=Math.max(Math.min(this.maxZoom,N*.5),E))}const F=a.getDistance();F<this.minZoom&&(this.minZoom=F*.9),F>this.maxZoom&&(this.maxZoom=F*1.1),s.updateMatrixWorld(),s.updateProjectionMatrix();const D=Q(s),A=g.clone();A.sub(D),c==="y"&&(A.y=0),A.normalize(),A.multiplyScalar(E),c==="y"&&(A.y+=-M*4*E);let T=g.clone().sub(A);s.parent&&(T=s.parent.worldToLocal(T)),this.setCameraTargetPosition(T,l),(Tl||i.debug)&&($.DrawWireBox3(y,16777011,10),$.DrawWireBox3(b,65280,10),!this._haveAttachedKeyboardEvents&&Tl&&(this._haveAttachedKeyboardEvents=!0,document.body.addEventListener("keydown",L=>{if(L.code==="KeyF"){let N;this._cameraObject instanceof d.PerspectiveCamera&&(N=Math.random()*Math.random()*170+10),this.fitCamera({objects:n,fitOffset:u,immediate:!1,fov:N})}L.code==="KeyV"&&this._cameraObject instanceof d.PerspectiveCamera&&(this._cameraObject.fov=60)}))),this.onBeforeRender()}}Te([m()],ge.prototype,"autoTarget");Te([m()],ge.prototype,"autoFit");Te([m()],ge.prototype,"enableRotate");Te([m()],ge.prototype,"autoRotate");Te([m()],ge.prototype,"autoRotateSpeed");Te([m()],ge.prototype,"minAzimuthAngle");Te([m()],ge.prototype,"maxAzimuthAngle");Te([m()],ge.prototype,"minPolarAngle");Te([m()],ge.prototype,"maxPolarAngle");Te([m()],ge.prototype,"enableKeys");Te([m()],ge.prototype,"enableDamping");Te([m()],ge.prototype,"dampingFactor");Te([m()],ge.prototype,"enableZoom");Te([m()],ge.prototype,"minZoom");Te([m()],ge.prototype,"maxZoom");Te([m()],ge.prototype,"zoomSpeed");Te([m()],ge.prototype,"enablePan");Te([m(Ur)],ge.prototype,"lookAtConstraint");Te([m()],ge.prototype,"lookAtConstraint01");Te([m()],ge.prototype,"allowInterrupt");Te([m()],ge.prototype,"middleClickToFocus");Te([m()],ge.prototype,"doubleClickToFocus");Te([m()],ge.prototype,"clickBackgroundToFitScene");Te([m()],ge.prototype,"targetLerpDuration");var QP=Object.defineProperty,YP=Object.getOwnPropertyDescriptor,Zt=(o,t,e,i)=>{for(var n=i>1?void 0:i?YP(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&QP(t,e,n),n},Cr=(o=>(o[o.None=0]="None",o[o.Skybox=1]="Skybox",o[o.SolidColor=2]="SolidColor",o[o.Uninitialized=4]="Uninitialized",o))(Cr||{});const no=S("debugcam"),lb=S("debugscreenpointtoray");var pn;const Lt=(pn=class extends I{constructor(){super(...arguments);r(this,"_nearClipPlane",.1);r(this,"_farClipPlane",1e3);r(this,"orthographic",!1);r(this,"orthographicSize",5);r(this,"ARBackgroundAlpha",0);r(this,"_cullingMask",4294967295);r(this,"_backgroundBlurriness");r(this,"_backgroundIntensity");r(this,"_backgroundRotation");r(this,"_environmentIntensity");r(this,"_targetTexture",null);r(this,"_backgroundColor");r(this,"_fov");r(this,"_cam",null);r(this,"_clearFlags",2);r(this,"_skybox");r(this,"_frustum");r(this,"_projScreenMatrix",new d.Matrix4)}get isCamera(){return!0}get aspect(){return this._cam instanceof d.PerspectiveCamera?this._cam.aspect:this.context.domWidth/this.context.domHeight}set aspect(e){this._cam instanceof d.PerspectiveCamera&&this._cam.aspect!==e&&(this._cam.aspect=e,this._cam.updateProjectionMatrix())}get fieldOfView(){return this._cam instanceof d.PerspectiveCamera?this._cam.fov:this._fov}set fieldOfView(e){const i=this.fieldOfView!=e;if(this._fov=e,i&&this._cam&&this._cam instanceof d.PerspectiveCamera){if(this._fov===void 0){console.warn("Can not set undefined fov on PerspectiveCamera");return}this._cam.fov=this._fov,this._cam.updateProjectionMatrix()}}get nearClipPlane(){return this._nearClipPlane}set nearClipPlane(e){const i=this._nearClipPlane!=e;this._nearClipPlane=e,this._cam&&(i||this._cam.near!=e)&&(this._cam.near=e,this._cam.updateProjectionMatrix())}get farClipPlane(){return this._farClipPlane}set farClipPlane(e){const i=this._farClipPlane!=e;this._farClipPlane=e,this._cam&&(i||this._cam.far!=e)&&(this._cam.far=e,this._cam.updateProjectionMatrix())}applyClippingPlane(){this._cam&&(this._cam.near=this._nearClipPlane,this._cam.far=this._farClipPlane,this._cam.updateProjectionMatrix())}get clearFlags(){return this._clearFlags}set clearFlags(e){if(typeof e=="string")switch(e){case"skybox":e=1;break;case"solidcolor":e=2;break;default:e=0;break}e!==this._clearFlags&&(this._clearFlags=e,this.applyClearFlagsIfIsActiveCamera())}set cullingMask(e){this._cullingMask=e,this._cam&&(this._cam.layers.mask=e)}get cullingMask(){return this._cam?this._cam.layers.mask:this._cullingMask}set cullingLayer(e){this.cullingMask=(1<<e|0)>>>0}set backgroundBlurriness(e){e!==this._backgroundBlurriness&&(e===void 0?this._backgroundBlurriness=void 0:this._backgroundBlurriness=Math.min(Math.max(e,0),1),this.applyClearFlagsIfIsActiveCamera())}get backgroundBlurriness(){return this._backgroundBlurriness}set backgroundIntensity(e){e!==this._backgroundIntensity&&(e===void 0?this._backgroundIntensity=void 0:this._backgroundIntensity=Math.min(Math.max(e,0),10),this.applyClearFlagsIfIsActiveCamera())}get backgroundIntensity(){return this._backgroundIntensity}set backgroundRotation(e){e!==this._backgroundRotation&&(e===void 0?this._backgroundRotation=void 0:this._backgroundRotation=e,this.applyClearFlagsIfIsActiveCamera())}get backgroundRotation(){return this._backgroundRotation}set environmentIntensity(e){this._environmentIntensity=e}get environmentIntensity(){return this._environmentIntensity}get backgroundColor(){return this._backgroundColor??null}set backgroundColor(e){e&&(this._backgroundColor||(this._backgroundColor=new ie(1,1,1,1)),this._backgroundColor.copy(e),(!("alpha"in e)||e.alpha===void 0)&&(this._backgroundColor.alpha=1),this.applyClearFlagsIfIsActiveCamera())}set targetTexture(e){this._targetTexture=e}get targetTexture(){return this._targetTexture}get cam(){return this.threeCamera}get threeCamera(){return this.activeAndEnabled&&this.buildCamera(),this._cam}screenPointToRay(e,i,n){const s=this.threeCamera,a=pn._origin;a.set(e,i,-1),this.context.input.convertScreenspaceToRaycastSpace(a),lb&&console.log("screenPointToRay",e.toFixed(2),i.toFixed(2),"now:",a.x.toFixed(2),a.y.toFixed(2),"isInXR:"+this.context.isInXR),a.z=-1,a.unproject(s);const l=pn._direction.set(a.x,a.y,a.z),c=Q(s);return l.sub(c),l.normalize(),n?(n.set(c,l),n):new d.Ray(c.clone(),l.clone())}getFrustum(){return this._frustum||(this._frustum=new d.Frustum,this.updateFrustum()),this._frustum}updateFrustum(){this._frustum||(this._frustum=new d.Frustum),this._frustum.setFromProjectionMatrix(this.getProjectionScreenMatrix(this._projScreenMatrix,!0),this.context.renderer.coordinateSystem)}getProjectionScreenMatrix(e,i){return i&&this._projScreenMatrix.multiplyMatrices(this.threeCamera.projectionMatrix,this.threeCamera.matrixWorldInverse),e===this._projScreenMatrix?e:e.copy(this._projScreenMatrix)}awake(){lb&&window.addEventListener("pointerdown",e=>{const i=e.clientX,n=e.clientY;console.log("touch",i.toFixed(2),n.toFixed(2));const s=this.screenPointToRay(i,n),a="#"+Math.floor(Math.random()*16777215).toString(16);$.DrawRay(s.origin,s.direction,a,10)})}onEnable(){no&&console.log(`Camera enabled: "${this.name}". ClearFlags=${Cr[this._clearFlags]}`,this),this.buildCamera(),(this.tag=="MainCamera"||!this.context.mainCameraComponent)&&(this.context.setCurrentCamera(this),ZP(this)),this.applyClearFlagsIfIsActiveCamera({applySkybox:!0})}onDisable(){this.context.removeCamera(this)}onBeforeRender(){if(this._cam&&(this._frustum&&this.updateFrustum(),this._clearFlags===2&&this.applyClearFlagsIfIsActiveCamera(),this._targetTexture)){this.context.isManagedExternally&&(this._warnedAboutExternalRenderer||(this._warnedAboutExternalRenderer=!0,console.warn("Rendering with external renderer is not supported yet. This may not work or throw errors. Please remove the the target texture from your camera: "+this.name,this.targetTexture))),this.context.composer;const e=this.context.renderer;if(e){const i=this.context.mainCameraComponent;this.applyClearFlags(),this._targetTexture.render(this.context.scene,this._cam,e),i==null||i.applyClearFlags()}}}buildCamera(){if(this._cam)return;const e=this.gameObject.isCamera;let i=null;if(e?(i=this.gameObject,i==null||i.layers.enableAll(),i instanceof d.PerspectiveCamera&&(this._fov=i.fov)):i=this.gameObject.children[0],i&&i.isCamera)i instanceof d.PerspectiveCamera&&(this._fov&&(i.fov=this._fov),i.near=this._nearClipPlane,i.far=this._farClipPlane,i.updateProjectionMatrix());else if(!this.orthographic)i=new d.PerspectiveCamera(this.fieldOfView,window.innerWidth/window.innerHeight,this._nearClipPlane,this._farClipPlane),this.fieldOfView&&(i.fov=this.fieldOfView),this.gameObject.add(i);else{const n=this.orthographicSize*100;i=new d.OrthographicCamera(window.innerWidth/-n,window.innerWidth/n,window.innerHeight/n,window.innerHeight/-n,this._nearClipPlane,this._farClipPlane),this.gameObject.add(i)}this._cam=i,this._cam.layers.mask=this._cullingMask,this.tag=="MainCamera"&&this.context.setCurrentCamera(this)}applyClearFlagsIfIsActiveCamera(e){this.context.mainCameraComponent===this&&this.applyClearFlags(e)}applyClearFlags(e){var n;if(!this._cam){no&&console.log("Camera does not exist (apply clear flags)");return}if(this.fieldOfView=this._fov,no){const s=`[Camera] Apply ClearFlags: ${Cr[this._clearFlags]} - "${this.name}"`;console.debug(s)}const i=this.context.domElement.getAttribute("background-image")||this.context.domElement.getAttribute("background-color");switch(this._clearFlags){case 0:return;case 1:if(pn.backgroundShouldBeTransparent(this.context)&&(!this.ARBackgroundAlpha||this.ARBackgroundAlpha<.001)){this.context.scene.background=null,this.context.renderer.setClearColor(0,0);return}(!this.scene.background||!this._skybox||(e==null?void 0:e.applySkybox)===!0)&&this.applySceneSkybox(),this._backgroundBlurriness!==void 0&&!this.context.domElement.getAttribute("background-blurriness")?this.context.scene.backgroundBlurriness=this._backgroundBlurriness:no&&console.warn(`Camera "${this.name}" has no background blurriness`),this._backgroundIntensity!==void 0&&!this.context.domElement.getAttribute("background-intensity")&&(this.context.scene.backgroundIntensity=this._backgroundIntensity),this._backgroundRotation!==void 0&&!this.context.domElement.getAttribute("background-rotation")?this.context.scene.backgroundRotation=this._backgroundRotation:no&&console.warn(`Camera "${this.name}" has no background intensity`);break;case 2:if(this._backgroundColor&&!i){let s=this._backgroundColor.alpha;pn.backgroundShouldBeTransparent(this.context)&&(s=this.ARBackgroundAlpha??0),this.context.scene.background=null,(n=this.context.xr)!=null&&n.isVR?this.context.renderer.setClearColor(S0(this._backgroundColor).convertLinearToSRGB()):this.context.renderer.setClearColor(this._backgroundColor,s)}else this._backgroundColor||no&&console.warn(`[Camera] has no background color "${this.name}" `);break;case 4:i||(this.context.scene.background=null,this.context.renderer.setClearColor(0,0));break}}applySceneSkybox(){this._skybox||(this._skybox=new KP(this)),this._skybox.apply()}static backgroundShouldBeTransparent(e){var a,l,c,h;const i=(a=e.renderer.xr)==null?void 0:a.getSession();if(!i)return!1;if(typeof i._transparent=="boolean")return i._transparent;const n=i.environmentBlendMode;no&&Ee("Environment blend mode: "+n+" on "+navigator.userAgent);let s=n==="additive"||n==="alpha-blend";return e.isInAR&&n==="opaque"&&((l=navigator.userAgent)!=null&&l.includes("OculusBrowser")||(c=navigator.userAgent)!=null&&c.includes("Mozilla")&&((h=navigator.userAgent)!=null&&h.includes("Mobile WebXRViewer/v2")))&&(s=!0),i._transparent=s,s}},r(pn,"_origin",new d.Vector3),r(pn,"_direction",new d.Vector3),pn);Zt([m()],Lt.prototype,"aspect",1);Zt([m()],Lt.prototype,"fieldOfView",1);Zt([m()],Lt.prototype,"nearClipPlane",1);Zt([m()],Lt.prototype,"farClipPlane",1);Zt([m()],Lt.prototype,"clearFlags",1);Zt([m()],Lt.prototype,"orthographic",2);Zt([m()],Lt.prototype,"orthographicSize",2);Zt([m()],Lt.prototype,"ARBackgroundAlpha",2);Zt([m()],Lt.prototype,"cullingMask",1);Zt([m()],Lt.prototype,"backgroundBlurriness",1);Zt([m()],Lt.prototype,"backgroundIntensity",1);Zt([m(d.Euler)],Lt.prototype,"backgroundRotation",1);Zt([m()],Lt.prototype,"environmentIntensity",1);Zt([m(ie)],Lt.prototype,"backgroundColor",1);Zt([m(xr)],Lt.prototype,"targetTexture",1);let ai=Lt;class KP{constructor(t){r(this,"_camera");r(this,"_skybox");this._camera=t}get context(){var t;return(t=this._camera)==null?void 0:t.context}apply(){var t;if(this._skybox=this.context.lightmaps.tryGetSkybox(this._camera.sourceId),!this._skybox)this._did_log_failed_to_find_skybox||(this._did_log_failed_to_find_skybox=!0,console.warn(`Camera "${this._camera.name}" has no skybox texture. ${this._camera.sourceId}`));else if(this.context.scene.background!==this._skybox){const e=this.context.domElement.getAttribute("background-image")||this.context.domElement.getAttribute("background-color")||this.context.domElement.getAttribute("skybox-image");no&&console.debug(`[Camera] Apply Skybox ${(t=this._skybox)==null?void 0:t.name} ${e} - "${this._camera.name}"`),e!=null&&e.length||(this._skybox.mapping=d.EquirectangularReflectionMapping,this.context.scene.background=this._skybox)}}}function ZP(o){S("freecam")&&o.context.mainCameraComponent===o&&C.getOrAddComponent(o.gameObject,ge)}class Ms extends I{constructor(){super(...arguments);r(this,"_listener",null);r(this,"onInteraction",()=>{this.destroyed||this.listener==null||this.addListenerIfItExists()})}get listener(){return this._listener==null&&(this._listener=new d.AudioListener),this._listener}onEnable(){vn.registerWaitForInteraction(this.onInteraction),this.addListenerIfItExists()}onDisable(){vn.unregisterWaitForInteraction(this.onInteraction),this.removeListenerIfItExists()}addListenerIfItExists(){const e=this._listener;if(!e||e!=null&&e.parent)return;const i=this.context.mainCameraComponent||C.getComponentInParent(this.gameObject,ai);i!=null&&i.threeCamera?i.threeCamera.add(e):this.gameObject.add(e),e.filter?(e.gain.connect(e.filter),e.filter.connect(e.context.destination)):e.gain.connect(e.context.destination)}removeListenerIfItExists(){const e=this._listener;e&&(e.removeFromParent(),e.filter&&e.filter.disconnect(),e.gain&&e.gain.disconnect())}}var JP=Object.defineProperty,eM=Object.getOwnPropertyDescriptor,Sn=(o,t,e,i)=>{for(var n=i>1?void 0:i?eM(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&JP(t,e,n),n};const gt=S("debugaudio"),Zi=class so extends I{constructor(){super(...arguments);r(this,"clip","");r(this,"playOnAwake",!1);r(this,"preload",!0);r(this,"playInBackground",!0);r(this,"_spatialBlend",0);r(this,"_minDistance",1);r(this,"_maxDistance",100);r(this,"_volume",1);r(this,"rollOffMode",0);r(this,"_loop",!1);r(this,"sound",null);r(this,"helper",null);r(this,"wasPlaying",!1);r(this,"audioLoader",null);r(this,"shouldPlay",!1);r(this,"_lastClipStartedLoading",null);r(this,"_audioElement",null);r(this,"onVisibilityChanged",()=>{switch(document.visibilityState){case"hidden":(this.playInBackground===!1||exports.DeviceUtilities.isMobileDevice())&&(this.wasPlaying=this.isPlaying,this.isPlaying&&this.pause());break;case"visible":gt&&console.log("visible",this.enabled,this.playOnAwake,!this.isPlaying,so.userInteractionRegistered,this.wasPlaying),this.enabled&&this.playOnAwake&&!this.isPlaying&&so.userInteractionRegistered&&this.wasPlaying&&this.play();break}});r(this,"onApplicationMuteChanged",()=>{var e,i;this.context.application.muted?(e=this.sound)==null||e.setVolume(0):(i=this.sound)==null||i.setVolume(this.volume)});r(this,"createAudio",e=>{if(this.destroyed){gt&&console.warn("AudioSource destroyed, not creating audio",this.name);return}gt&&console.log("AudioBuffer finished loading",e);const i=this.Sound;if(!i){gt&&console.warn("Failed getting sound?",this.name);return}i.isPlaying&&i.stop(),e&&i.setBuffer(e),i.loop=this._loop,this.context.application.muted?i.setVolume(0):i.setVolume(this.volume),i.autoplay=this.shouldPlay&&so.userInteractionRegistered,this.applySpatialDistanceSettings(),i.isPlaying&&i.stop(),so.registerWaitForAllowAudio(this.__onAllowAudioCallback)});r(this,"__onAllowAudioCallback",()=>{this.shouldPlay&&this.play()});r(this,"_lastContextTime",0);r(this,"_hasEnded",!0);r(this,"_needUpdateSpatialDistanceSettings",!1)}static get userInteractionRegistered(){return vn.userInteractionRegistered}static registerWaitForAllowAudio(e){vn.registerWaitForInteraction(e)}get isPlaying(){var e;return((e=this.sound)==null?void 0:e.isPlaying)??!1}get duration(){var e,i;return(i=(e=this.sound)==null?void 0:e.buffer)==null?void 0:i.duration}get time01(){var i;const e=this.duration;return e&&this.sound?((i=this.sound)==null?void 0:i.context.currentTime)/e:0}set time01(e){const i=this.duration;i&&this.sound&&(this.time=e*i)}get time(){var e,i;return(e=this.sound)!=null&&e.source?((i=this.sound.source)==null?void 0:i.context.currentTime)-this._lastContextTime+this.sound.offset:0}set time(e){if(this.sound){if(e===this.sound.offset)return;const i=this.isPlaying;this.stop(),this.sound.offset=e,i&&this.play()}}get loop(){return this.sound&&(this._loop=this.sound.getLoop()),this._loop}set loop(e){this._loop=e,this.sound&&this.sound.setLoop(e)}get spatialBlend(){return this._spatialBlend}set spatialBlend(e){e!==this._spatialBlend&&(this._spatialBlend=e,this._needUpdateSpatialDistanceSettings=!0)}get minDistance(){return this._minDistance}set minDistance(e){this._minDistance!==e&&(this._minDistance=e,this._needUpdateSpatialDistanceSettings=!0)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance!==e&&(this._maxDistance=e,this._needUpdateSpatialDistanceSettings=!0)}get volume(){return this._volume}set volume(e){this._volume=e,this.sound&&!this.context.application.muted&&(gt&&console.log(this.name,"audio set volume",e),this.sound.setVolume(e))}set pitch(e){this.sound&&this.sound.setPlaybackRate(e)}get pitch(){return this.sound?this.sound.getPlaybackRate():1}get Sound(){var e;if(!this.sound&&so.userInteractionRegistered){let i=this.gameObject.getComponent(Ms)??this.context.mainCamera.getComponent(Ms)??hh(Ms,this.context,!1);!i&&this.context.mainCamera&&(i=this.context.mainCamera.addComponent(Ms)),i!=null&&i.listener?(this.sound=new d.PositionalAudio(i.listener),(e=this.gameObject)==null||e.add(this.sound)):gt&&console.warn("No audio listener found in scene - can not play audio")}return this.sound}get ShouldPlay(){return this.shouldPlay}get audioContext(){var e;return(e=this.sound)==null?void 0:e.context}awake(){gt&&console.log("[AudioSource]",this),this.audioLoader=new d.AudioLoader,this.playOnAwake&&(this.shouldPlay=!0),this.preload&&typeof this.clip=="string"&&this.audioLoader.load(this.clip,this.createAudio,()=>{},console.error)}onEnable(){this.sound&&this.gameObject.add(this.sound),so.userInteractionRegistered?this.playOnAwake&&this.context.application.isVisible&&this.play():so.registerWaitForAllowAudio(()=>{this.enabled&&!this.destroyed&&this.shouldPlay&&this.onNewClip(this.clip)}),globalThis.addEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.addEventListener(nm.MuteChanged,this.onApplicationMuteChanged)}onDisable(){globalThis.removeEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.removeEventListener(nm.MuteChanged,this.onApplicationMuteChanged),this.pause()}applySpatialDistanceSettings(){const e=this.sound;if(!e)return;this._needUpdateSpatialDistanceSettings=!1;const i=z.lerp(10*this._maxDistance/Math.max(1e-4,this.spatialBlend),this._minDistance,this.spatialBlend);switch(gt&&console.log(this.name,this._minDistance,this._maxDistance,this.spatialBlend,"Ref distance="+i),e.setRefDistance(i),e.setMaxDistance(Math.max(.01,this._maxDistance)),this.rollOffMode){case 0:e.setDistanceModel("exponential");break;case 1:e.setDistanceModel("linear");break;case 2:console.warn("Custom rolloff for AudioSource is not supported: "+this.name);break}this.spatialBlend>0?gt&&!this.helper&&(this.helper=new H.PositionalAudioHelper(e,e.getRefDistance()),e.add(this.helper)):this.helper&&this.helper.parent&&this.helper.removeFromParent()}async onNewClip(e){if(e&&(this.clip=e),typeof e=="string")if(gt&&console.log(e),e.endsWith(".mp3")||e.endsWith(".wav")){if(this.audioLoader||(this.audioLoader=new d.AudioLoader),this.shouldPlay=!0,this._lastClipStartedLoading===e){gt&&console.log("Is currently loading:",this._lastClipStartedLoading,this);return}this._lastClipStartedLoading=e,gt&&console.log("load audio",e);const i=await this.audioLoader.loadAsync(e).catch(console.error);if(this.destroyed)return;this._lastClipStartedLoading===e&&(this._lastClipStartedLoading=null),i&&this.createAudio(i)}else console.warn("Unsupported audio clip type",e);else this.shouldPlay=!0,this.createAudio()}play(e=void 0){var n,s,a;!e&&this.clip&&(e=this.clip),e!==void 0&&typeof e!="string"&&!(e instanceof MediaStream)&&(j()&&console.warn("Called play on AudioSource with unknown argument type:",e+`
940
+ Could not find method ${h.method} on object ${f.name}`,f,typeof f[h.method])};if(typeof f[h.method]!="function"){let b=!1,_=f;for(;_;){const v=Object.getOwnPropertyDescriptor(_,h.method);if(v&&(v.writable===!0||v.set)){b=!0;break}_=Object.getPrototypeOf(_)}!b&&(j()||dt)&&g()}}if(f){let g=h.argument;if(g!==void 0?g=u(g):h.arguments!==void 0&&(g=h.arguments.map(u)),!f[h.method])console.warn(`EventList method not found: "${h.method}" on ${f==null?void 0:f.name}`);else{g!==void 0&&!Array.isArray(g)&&(g=[g]);const b=new Cs(f,h.method,g,h.enabled);a.push(b)}}else j()&&console.warn("[Debug] EventList: Could not find event listener in scene",h,e.object,t)}const l=new ye(a);dt&&console.log(l);const c=e.target;return c!==void 0&&e.path!==void 0&&l.setEventTarget(e.path,c),l}}}const NP=new zP,hu=new WeakMap,$P=d.Texture.prototype.clone;d.Texture.prototype.clone=function(){const o=$P.call(this);return hu.has(o)||hu.set(o,this),o};class hw extends Ki{constructor(){super([xr,d.WebGLRenderTarget])}onSerialize(t,e){}onDeserialize(t,e){if(t instanceof d.Texture&&e.type===xr){let i=t;hu.has(i)&&(i=hu.get(i)),i.isRenderTargetTexture=!0,i.flipY=!0,i.offset.y=1,i.repeat.y=-1,i.needsUpdate=!0,i.mipmaps=[],i instanceof d.CompressedTexture&&(i.isCompressedTexture=!1,i.format=d.RGBAFormat);const n=new xr(i.image.width,i.image.height,{colorSpace:d.LinearSRGBColorSpace});return n.texture=i,n}}}new hw;class dw extends Ki{constructor(){super([URL])}onSerialize(t,e){return null}onDeserialize(t,e){if(typeof t=="string"&&t.length>0)return Eo(e.gltfId,t)}}new dw;var VP=Object.defineProperty,WP=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&VP(t,e,n),n};class qa extends I{awake(){Yt.createIfNoneExists(this.context)}onEnable(){var t;(t=Yt.get(this.context))==null||t.register(this)}onDisable(){var t;(t=Yt.get(this.context))==null||t.unregister(this)}}class Ei extends qa{constructor(){super(...arguments);r(this,"targets",null);r(this,"raycastHits",[]);r(this,"ignoreSkinnedMeshes",!1)}start(){this.targets=[this.gameObject]}performRaycast(e=null){if(!this.targets)return null;e??(e=new Ds),e.targets=this.targets,e.results=this.raycastHits,e.useAcceleratedRaycast=!0;const i=e.testObject;this.ignoreSkinnedMeshes&&(e.testObject=s=>s instanceof d.SkinnedMesh?"continue in children":i?i(s):!0);const n=this.context.physics.raycast(e);return e.testObject=i,n}}WP([m()],Ei.prototype,"ignoreSkinnedMeshes");class Ku extends Ei{constructor(){super(),this.ignoreSkinnedMeshes=!0}}const Eu=class Eu extends qa{performRaycast(t){if(!J.active||!Eu.allow||!(t!=null&&t.ray))return null;const e=t.ray.origin;return this.context.physics.sphereOverlap(e,.015,!1,!0)}};r(Eu,"allow",!0);let Tr=Eu;class Eg{static getObject(t){const e=t[Si];return e&&(e.isComponent===!0?t=e.gameObject:t=e),t}static isInteractable(t,e){if(e&&(e.canvasGroup=void 0,e.graphic=void 0),t==null||!t.visible||(t=this.getObject(t),!t.visible))return!1;const i=this.tryFindCanvasGroup(t);if((i==null?void 0:i.isCanvasGroup)===!0&&(e&&(e.canvasGroup=i),i.blocksRaycasts===!1||i.interactable===!1))return!1;const n=Rr(t,s=>{if(s.isGraphic===!0)return s},!1);return e&&(n==null?void 0:n.isGraphic)===!0&&(e.graphic=n),!((n==null?void 0:n.raycastTarget)===!1||(n==null?void 0:n.layer)===2)}static tryFindCanvasGroup(t){if(!t)return null;const e=Rr(t,i=>{const n=i;if(n.blocksRaycasts!==void 0&&n.interactable!==void 0)return n},!1);return e!==void 0?e:this.tryFindCanvasGroup(t.parent)}}function Tg(o){const t=o[Si];return t||(o.parent?Tg(o.parent):null)}function GP(o){return o.isUI===!0||typeof o[Si]=="object"}function du(o,t){if(!o)return;const e=o.material;if((e==null?void 0:e.isMaterial)===!0){const i=o.parent;i&&i.isText,e.side=t.doubleSided??!0?d.DoubleSide:d.FrontSide,e.shadowSide=t.doubleSided?d.DoubleSide:d.FrontSide,o.castShadow=t.castShadows?t.castShadows:!1,o.receiveShadow=t.receiveShadows?t.receiveShadows:!1}for(const i of o.children)du(i,t)}function ma(o,t,e){o[t]===void 0&&console.warn("Field",t,"is undefined on",o);const i=Proxy.revocable(o[t],{set(a,l,c,h){const u=a[l],f=Reflect.set(a,l,c,h);return e(c,u),f}}),n=i.revoke,s=o[t];return i.revoke=()=>{o[t]=s,n()},o[t]=i.proxy,i}const ab=Symbol("Scheduled action");function HP(o,t,e=we.OnBeforeRender){let i=o[ab];i||(i=o[ab]={});const n=t.name;i[e]||(i[e]={});const s=i[e];if(s[n])return;function*l(){t==null||t.call(o),s[n]=null}const c=o.startCoroutine(l(),e);s[n]=c}const io=S("debugeventsystem");var Cm=(o=>(o.BeforeHandleInput="BeforeHandleInput",o.AfterHandleInput="AfterHandleInput",o))(Cm||{});Jv(o=>{Yt.createIfNoneExists(o)});class Yt extends I{constructor(){super(...arguments);r(this,"raycaster",[]);r(this,"pressedByID",new Map);r(this,"hoveredByID",new Map);r(this,"onPointerEvent",e=>{if(e===void 0||e.propagationStopped||e.defaultPrevented||e.used)return;const i=new mh(this.context.input,e);this._currentPointerEventName=e.type,i.inputSource=this.context.input,i.isClick=e.isClick,i.isDoubleClick=e.isDoubleClick,i.isDown=e.type==Re.PointerDown,i.isUp=e.type==Re.PointerUp,i.isPressed=this.context.input.getPointerPressed(e.pointerId);const n=new Ds;e.hasRay?n.ray=e.ray:n.screenPoint=this.context.input.getPointerPositionRC(e.pointerId),n.allowSlowRaycastFallback=e.isClick||e.isDoubleClick;const s=this.performRaycast(n);if(io&&(i.isDown?console.log("DOWN",{id:i.pointerId,hits:s.length}):i.isUp&&console.log("UP",{id:i.pointerId,hits:s.length}),i.isClick&&console.log("CLICK",{id:i.pointerId,hits:s.length})),s){for(const l of s)l.event=e,e.intersections.push(l);e.origin.onPointerHits&&e.origin.onPointerHits({sender:this,event:e,hits:s})}io&&i.isClick&&Ee("EventSystem: "+i.pointerId+" - "+this.context.time.frame+" - Up:"+i.isUp+", Down:"+i.isDown);const a={sender:this,args:i,hasActiveUI:this.currentActiveMeshUIComponents.length>0};this.dispatchEvent(new CustomEvent("BeforeHandleInput",{detail:a})),this.handleIntersections(s,i),this.dispatchEvent(new CustomEvent("AfterHandleInput",{detail:a}))});r(this,"_sortedHits",[]);r(this,"_testObjectsCache",new Map);r(this,"_currentlyActiveRaycaster",null);r(this,"_currentPointerEventName",null);r(this,"shouldRaycastObject",e=>{var a;const i=e&&"getComponent"in e?e.getComponent(qa):null;if(i&&i!=this._currentlyActiveRaycaster)return!1;let n=null;if(GP(e)&&(n=(a=e[Si])==null?void 0:a.gameObject),this._testObjectsCache.has(e)||n&&this._testObjectsCache.has(n))return this._testObjectsCache.get(e)===!1?"continue in children":!0;{let l=cu(e,this._currentPointerEventName);if(!l&&n&&(l=cu(n,this._currentPointerEventName)),l){this._testObjectsCache.set(e,!0);for(const c of e.children)this.shouldRaycastObject_AddToYesCache(c);return!0}return this._testObjectsCache.set(e,!1),"continue in children"}});r(this,"_sortingBuffer",[]);r(this,"_noDepthTestingResults",[]);r(this,"out",{});r(this,"_capturedPointer",{});r(this,"pointerEnterSymbol",Symbol("pointerEnter"));r(this,"pointerExitSymbol",Symbol("pointerExit"));r(this,"currentActiveMeshUIComponents",[])}static ensureUpdateMeshUI(e,i,n=!1){po.update(e,i,n)}static markUIDirty(e){po.markDirty()}static createIfNoneExists(e){e.scene.getComponent(Yt)||e.scene.addComponent(Yt)}static get(e){return this.createIfNoneExists(e),e.scene.getComponent(Yt)}static get instance(){return this.get(X.Current)}register(e){var i;e&&this.raycaster&&!this.raycaster.includes(e)&&((i=this.raycaster)==null||i.push(e))}unregister(e){var n,s;const i=(n=this.raycaster)==null?void 0:n.indexOf(e);i!==void 0&&i!==-1&&((s=this.raycaster)==null||s.splice(i,1))}get hasActiveUI(){return this.currentActiveMeshUIComponents.length>0}get isHoveringObjects(){return this.hoveredByID.size>0}awake(){this.gameObject!==this.context.scene&&(console.debug(`[Needle Engine] EventSystem is only allowed on the scene root. Disabling EventSystem on '${this.gameObject.name}'`),this.enabled=!1)}start(){this.context.scene.getComponent(qa)||this.context.scene.addComponent(Ei)}onEnable(){this.context.input.addEventListener(Re.PointerDown,this.onPointerEvent),this.context.input.addEventListener(Re.PointerUp,this.onPointerEvent),this.context.input.addEventListener(Re.PointerMove,this.onPointerEvent)}onDisable(){this.context.input.removeEventListener(Re.PointerDown,this.onPointerEvent),this.context.input.removeEventListener(Re.PointerUp,this.onPointerEvent),this.context.input.removeEventListener(Re.PointerMove,this.onPointerEvent)}onBeforeRender(){this.resetMeshUIStates()}shouldRaycastObject_AddToYesCache(e){this._testObjectsCache.set(e,!0);for(const i of e.children)this.shouldRaycastObject_AddToYesCache(i)}performRaycast(e){if(!this.raycaster)return null;this._testObjectsCache.clear(),this._sortedHits.length=0,e.testObject=this.shouldRaycastObject;for(const i of this.raycaster){if(!i.activeAndEnabled)continue;this._currentlyActiveRaycaster=i;const n=i.performRaycast(e);this._currentlyActiveRaycaster=null,n&&n.length>0&&this._sortedHits.push(...n)}return this._sortedHits.sort((i,n)=>i.distance-n.distance),this._sortedHits}assignHitInformation(e,i){i?(e.intersection=i,e.point=i.point,e.normal=i.normal,e.face=i.face,e.distance=i.distance,e.instanceId=i.instanceId):(e.intersection=void 0,e.point=void 0,e.normal=void 0,e.face=void 0,e.distance=void 0,e.instanceId=void 0)}handleIntersections(e,i){var s;if(e!=null&&e.length){e=this.sortCandidates(e);for(const a of e){if(i.event.immediatePropagationStopped)return!1;if(this.assignHitInformation(i,a),this.handleEventOnObject(a.object,i))return!0}}this.assignHitInformation(i,e==null?void 0:e[0]),this.invokePointerCapture(i);const n=this.hoveredByID.get(i.pointerId);return n&&this.propagatePointerExit(n.obj,n.data,null),this.hoveredByID.delete(i.pointerId),i.isUp&&((s=this.pressedByID.get(i.pointerId))==null||s.handlers.forEach(a=>this.invokeOnPointerUp(i,a)),this.pressedByID.delete(i.pointerId)),!1}sortCandidates(e){this._sortingBuffer.length=0,this._noDepthTestingResults.length=0;for(let i=0;i<e.length;i++){const n=e[i],s=n.object;if(s.material&&s.material.depthTest===!1){this._noDepthTestingResults.push(n);continue}this._sortingBuffer.push(n)}for(const i of this._sortingBuffer)this._noDepthTestingResults.push(i);return this._noDepthTestingResults}handleEventOnObject(e,i){if(!this.testIsVisible(e))return i.isClick&&io&&console.log("not allowed",e),!1;if(i.pointerId===void 0)return io&&console.error("Event without pointer can't be handled",i),!1;i.object=e;const n=e.parent,s=i.isClick??!1;let a=null;if(n&&n.isUI){const f=(i.isPressed||i.isClick)??!1;if(n[Si]){const p=n[Si].gameObject;if(p){if(!Eg.isInteractable(p,this.out))return!1;a=this.out.canvasGroup??null,this.handleMeshUIIntersection(e,f),e=p}}}s&&io&&console.log(this.context.time.frame,e);const l=this.hoveredByID.get(i.pointerId),c=l==null?void 0:l.obj;c!==e&&c&&this.propagatePointerExit(c,l.data,e);const u=this.hoveredByID.get(i.pointerId);if(u?(u.obj=e,u.data=i):this.hoveredByID.set(i.pointerId,{obj:e,data:i}),i.isDown){const f=this.pressedByID.get(i.pointerId);f?(f.obj=e,f.data=i):this.pressedByID.set(i.pointerId,{obj:e,data:i,handlers:new Set})}return(a===null||a.interactable)&&this.handleMainInteraction(e,i,c??null),!0}propagate(e,i){for(;e;)C.foreachComponent(e,n=>{i(n)},!1),e=e.parent}handleMainInteraction(e,i,n){const s=this.pressedByID.get(i.pointerId),a=n!==e;let l=!0;switch(i.event.pointerType){case"mouse":case"touch":const c=this.context.input.getPointerPositionLastFrame(i.pointerId),h=this.context.input.getPointerPosition(i.pointerId);l=c&&!z.approximately(c,h);break}this.propagate(e,c=>{var u;const h=c;h.interactable!==!1&&(!h.activeAndEnabled||!h.enabled||(h.onPointerEnter&&a&&this.handlePointerEnter(h,i),i.isDown&&h.onPointerDown&&(h.onPointerDown(i),s==null||s.handlers.add(h),this.handlePointerCapture(i,h)),h.onPointerMove&&(l&&h.onPointerMove(i),this.handlePointerCapture(i,h)),i.isUp&&(h.onPointerUp&&(this.invokeOnPointerUp(i,h),s==null||s.handlers.delete(h)),h.onPointerExit&&((u=i.event)==null?void 0:u.pointerType)===Nu.Touch&&(this.handlePointerExit(h,i),this.hoveredByID.delete(i.pointerId))),i.isClick&&h.onPointerClick&&h.onPointerClick(i)))}),i.isUp&&(s==null||s.handlers.forEach(c=>{this.invokeOnPointerUp(i,c)}),this.pressedByID.delete(i.pointerId))}propagatePointerExit(e,i,n){this.propagate(e,s=>{if(!s.gameObject||s.destroyed)return;const a=s;if(a.onPointerExit||a.onPointerEnter){if(n&&this.isChild(n,s.gameObject))return;this.handlePointerExit(a,i)}})}invokeOnPointerUp(e,i){var n;(n=i.onPointerUp)==null||n.call(i,e),this.releasePointerCapture(e,i)}handlePointerEnter(e,i){e.onPointerEnter&&this.updatePointerState(e,i.pointerId,this.pointerEnterSymbol,!0)&&e.onPointerEnter(i),this.updatePointerState(e,i.pointerId,this.pointerExitSymbol,!1)}handlePointerExit(e,i){e.onPointerExit&&this.updatePointerState(e,i.pointerId,this.pointerExitSymbol,!0)&&e.onPointerExit(i),this.updatePointerState(e,i.pointerId,this.pointerEnterSymbol,!1)}updatePointerState(e,i,n,s){let a=e[n];if(s)return a&&a.includes(i)?!1:(a=a||[],a.push(i),e[n]=a,!0);{if(!a||!a.includes(i))return!1;const l=a.indexOf(i);return l!==-1&&a.splice(l,1),!0}}handlePointerCapture(e,i){if(e.z__pointer_ctured){e.z__pointer_ctured=!1;const n=e.pointerId;if(i.onPointerMove){const s=this._capturedPointer[n]||[];s.push(i),this._capturedPointer[n]=s}else j()&&!i.z__warned_no_pointermove&&(i.z__warned_no_pointermove=!0,console.warn("PointerCapture was requested but the component doesn't implement onPointerMove. It will not receive any pointer events"))}else e.z__pointer_cture_rleased&&(e.z__pointer_cture_rleased=!1,this.releasePointerCapture(e,i))}releasePointerCapture(e,i){const n=e.pointerId;if(this._capturedPointer[n]){const s=this._capturedPointer[n].indexOf(i);s!==-1&&(this._capturedPointer[n].splice(s,1),io&&console.log("released pointer capture",n,i,this._capturedPointer))}}invokePointerCapture(e){var i;if(e.event.type===Re.PointerMove){const n=e.pointerId,s=this._capturedPointer[n];if(s){io&&console.log("Captured",n,s);for(let a=0;a<s.length;a++){const l=s[a];if(l.destroyed){s.splice(a,1),a--;continue}(i=l.onPointerMove)==null||i.call(l,e)}}}}isChild(e,i){return!e||!i?!1:e===i?!0:e.parent?this.isChild(e.parent,i):!1}handleMeshUiObjectWithoutShadowDom(e,i){return!e||!e.isUI?!0:this.handleMeshUIIntersection(e,i)}handleMeshUIIntersection(e,i){const n=po.updateState(e,i);return n&&this.currentActiveMeshUIComponents.push(n),n!==null}resetMeshUIStates(){if(this.context.input.getPointerPressedCount()>0&&po.resetLastSelected(),!(!this.currentActiveMeshUIComponents||this.currentActiveMeshUIComponents.length<=0)){for(let e=0;e<this.currentActiveMeshUIComponents.length;e++){const i=this.currentActiveMeshUIComponents[e];po.resetState(i)}this.currentActiveMeshUIComponents.length=0}}testIsVisible(e){return e?C.isActiveSelf(e)?this.testIsVisible(e.parent):!1:!0}}class po{static markDirty(){this.needsUpdate=!0}static update(t,e,i=!1){if(i){t.update();return}const n=e.time.frameCount;for(const s of this.lastUpdateFrame)if(s.context===e){if(n===s.frame)return;s.frame=n;let a=this.needsUpdate||n<1;s.nextUpdate<=n&&(a=!0),a&&(io&&console.log("Update threemeshui"),this.needsUpdate=!1,s.nextUpdate=n+60,t.update());return}this.lastUpdateFrame=[{context:e,frame:n,nextUpdate:n+60}],t.update(),this.needsUpdate=!1}static updateState(t,e){let i=null;if(t&&(i=this.findBlockOrTextInParent(t),i&&i!==this.lastSelected)){if(i.interactable===!1)return null;this.needsUpdate=!0}return i}static resetLastSelected(){const t=this.lastSelected;t&&(this.lastSelected=null,this.resetState(t))}static resetState(t){t&&(this.needsUpdate=!0)}static findBlockOrTextInParent(t){return t?t.isBlock||t.isText?t:this.findBlockOrTextInParent(t.parent):null}}r(po,"lastSelected",null),r(po,"lastUpdateFrame",[]),r(po,"needsUpdate",!1);var qP=Object.defineProperty,Te=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&qP(t,e,n),n};const Ui=S("debugorbit"),cp=S("freecam"),Tl=S("debugcamerafit"),hd=S("smoothcam"),XP={LEFT:"",UP:"",RIGHT:"",BOTTOM:""};let hp;class Fc extends CustomEvent{constructor(t,e){super("target-reached",{detail:{controls:t,type:e}})}}class ge extends I{constructor(){super(...arguments);r(this,"autoTarget",!0);r(this,"autoFit",!1);r(this,"enableRotate",!0);r(this,"autoRotate",!1);r(this,"autoRotateSpeed",1);r(this,"minAzimuthAngle",1/0);r(this,"maxAzimuthAngle",1/0);r(this,"minPolarAngle",0);r(this,"maxPolarAngle",Math.PI);r(this,"enableKeys",!1);r(this,"enableDamping",!0);r(this,"dampingFactor",.1);r(this,"enableZoom",!0);r(this,"minZoom",0);r(this,"maxZoom",1/0);r(this,"zoomSpeed",1);r(this,"zoomToCursor",!1);r(this,"enablePan",!0);r(this,"lookAtConstraint",null);r(this,"lookAtConstraint01",1);r(this,"allowInterrupt",!0);r(this,"middleClickToFocus",!0);r(this,"doubleClickToFocus",!0);r(this,"clickBackgroundToFitScene",2);r(this,"_targetElement",null);r(this,"debugLog",!1);r(this,"targetLerpDuration",1);r(this,"_controls",null);r(this,"_cameraObject",null);r(this,"_lookTargetLerpActive",!1);r(this,"_lookTargetStartPosition",new d.Vector3);r(this,"_lookTargetEndPosition",new d.Vector3);r(this,"_lookTargetLerp01",0);r(this,"_lookTargetLerpDuration",0);r(this,"_cameraLerpActive",!1);r(this,"_cameraStartPosition",new d.Vector3);r(this,"_cameraEndPosition",new d.Vector3);r(this,"_cameraLerp01",0);r(this,"_cameraLerpDuration",0);r(this,"_fovLerpActive",!1);r(this,"_fovLerpStartValue",0);r(this,"_fovLerpEndValue",0);r(this,"_fovLerp01",0);r(this,"_fovLerpDuration",0);r(this,"_inputs",0);r(this,"_enableTime",0);r(this,"_startedListeningToKeyEvents",!1);r(this,"_eventSystem");r(this,"_afterHandleInputFn");r(this,"_camera",null);r(this,"_syncedTransform");r(this,"_didSetTarget",0);r(this,"_activePointerEvents");r(this,"_lastTimeClickOnBackground",-1);r(this,"_clickOnBackgroundCount",0);r(this,"_onPointerDown",e=>{this._activePointerEvents.push(e)});r(this,"_onPointerDownLate",e=>{e.used&&this._controls&&(this._controls.enabled=!1)});r(this,"_onPointerUp",e=>{for(let i=this._activePointerEvents.length-1;i>=0;i--){const n=this._activePointerEvents[i];if(n.pointerId===e.pointerId&&n.button===e.button){this._activePointerEvents.splice(i,1);break}}if(this.clickBackgroundToFitScene>0&&e.isClick&&e.button===0){if(e.hasRay||e.intersections.push(...this.context.physics.raycast()),e.intersections.length<=0){const i=this.context.time.time-this._lastTimeClickOnBackground;this._lastTimeClickOnBackground=this.context.time.time,this.clickBackgroundToFitScene<=1||i<this.clickBackgroundToFitScene*.15?(this._clickOnBackgroundCount+=1,this._clickOnBackgroundCount>=this.clickBackgroundToFitScene-1&&this.fitCamera(this.context.scene.children,{immediate:!1})):this._clickOnBackgroundCount=0}Ui&&console.log(this.clickBackgroundToFitScene,e.intersections.length,this._clickOnBackgroundCount)}});r(this,"_onPointerUpLate",e=>{this.doubleClickToFocus&&e.isDoubleClick&&!e.used&&this.setTargetFromRaycast()});r(this,"_orbitStartAngle",0);r(this,"_zoomStartDistance",0);r(this,"onControlsChangeStarted",()=>{this._controls&&(this._orbitStartAngle=this._controls.getAzimuthalAngle()+this._controls.getPolarAngle(),this._zoomStartDistance=this._controls.getDistance()),this._syncedTransform&&this._syncedTransform.requestOwnership()});r(this,"onControlsChangeEnded",()=>{if(this._controls&&this.autoTarget){const i=this._controls.getAzimuthalAngle()+this._controls.getPolarAngle()-this._orbitStartAngle;Math.abs(i)<.01?(Ui&&console.debug("OrbitControls: Update target",{deltaAngle:i}),this.updateTargetNow({allowSlowRaycastFallback:!1})):Ui&&console.debug("OrbitControls: No target update",{deltaAngle:i})}});r(this,"_shouldDisable",!1);r(this,"__onPreRender",()=>{const e=this.context.pre_render_callbacks.indexOf(this.__onPreRender);e>=0&&this.context.pre_render_callbacks.splice(e,1),this.autoFit&&(this.autoFit=!1,this.fitCamera({centerCamera:"y",immediate:!0,objects:this.scene.children}))});r(this,"_haveAttachedKeyboardEvents",!1)}get isCameraController(){return!0}get controls(){return this._controls}get controllerObject(){return this._cameraObject}onStartInteraction(e){var i;(i=this.controls)==null||i.addEventListener("start",e)}get targetElement(){var e;return((e=this._controls)==null?void 0:e.domElement)??this._targetElement}set targetElement(e){this._targetElement=e,this._controls&&this._controls.domElement!==e&&(this._controls.disconnect(),this._controls.domElement=e,this._controls.connect())}get targetLerpSpeed(){return 5}set targetLerpSpeed(e){this.targetLerpDuration=1/e}rotateLeft(e){var i;(i=this._controls)==null||i._rotateLeft(e)}rotateUp(e){var i;(i=this._controls)==null||i._rotateUp(e)}pan(e,i){var n;(n=this._controls)==null||n._pan(e,i)}zoomIn(e){var i,n;e>0?(i=this._controls)==null||i._dollyIn(1-e):e<0&&((n=this._controls)==null||n._dollyOut(1+e))}awake(){Ui&&console.debug("OrbitControls",this),this._didSetTarget=0,this._startedListeningToKeyEvents=!1}start(){this._eventSystem=Yt.get(this.context)??void 0,this._eventSystem&&(this._afterHandleInputFn=this.afterHandleInput.bind(this),this._eventSystem.addEventListener(Cm.AfterHandleInput,this._afterHandleInputFn))}onDestroy(){var e,i;(e=this._controls)==null||e.dispose(),(i=this._eventSystem)==null||i.removeEventListener(Cm.AfterHandleInput,this._afterHandleInputFn)}onEnable(){this._didSetTarget=0,this._enableTime=this.context.time.time;const e=C.getComponent(this.gameObject,ai);this._camera=e;let i=e==null?void 0:e.threeCamera;if(!i&&this.gameObject instanceof d.PerspectiveCamera&&(i=this.gameObject),i&&Zp(i,this,!0),!this._controls&&i instanceof d.Object3D){this._cameraObject=i;const n=this.targetElement??this.context.renderer.domElement,s=i==null?void 0:i.quaternion.clone();this._controls=new H.OrbitControls(i,n),i==null||i.quaternion.copy(s),hp===void 0&&(hp={...this._controls.keys});const a=Q(i),l=this.gameObject.worldForward,h=a.clone().sub(l.multiplyScalar(2.5));this._controls.target.copy(h)}if(this._controls)if(cp&&(this.enablePan=!0,this.enableZoom=!0,this.middleClickToFocus=!0,exports.DeviceUtilities.isMobileDevice()&&(this.doubleClickToFocus=!0)),this._controls.addEventListener("start",this.onControlsChangeStarted),this._controls.addEventListener("endMovement",this.onControlsChangeEnded),!this._startedListeningToKeyEvents&&this.enableKeys)this._startedListeningToKeyEvents=!0,this._controls.listenToKeyEvents(this.context.domElement);else try{this._controls.stopListenToKeyEvents()}catch{}this._syncedTransform=C.getComponent(this.gameObject,es)??void 0,this.context.pre_render_callbacks.push(this.__onPreRender),this._activePointerEvents=[],this.context.input.addEventListener("pointerdown",this._onPointerDown,{queue:ri.Early}),this.context.input.addEventListener("pointerdown",this._onPointerDownLate,{queue:ri.Late}),this.context.input.addEventListener("pointerup",this._onPointerUp,{queue:ri.Early}),this.context.input.addEventListener("pointerup",this._onPointerUpLate,{queue:ri.Late})}onDisable(){var e;if((e=this._camera)!=null&&e.threeCamera&&Zp(this._camera.threeCamera,this,!1),this._controls){this._controls.enabled=!1,this._controls.autoRotate=!1,this._controls.removeEventListener("start",this.onControlsChangeStarted),this._controls.removeEventListener("endMovement",this.onControlsChangeEnded);try{this._controls.stopListenToKeyEvents()}catch{}this._startedListeningToKeyEvents=!1}this._activePointerEvents.length=0,this.context.input.removeEventListener("pointerdown",this._onPointerDown),this.context.input.removeEventListener("pointerdown",this._onPointerDownLate),this.context.input.removeEventListener("pointerup",this._onPointerUp),this.context.input.removeEventListener("pointerup",this._onPointerUpLate)}updateTargetNow(e){var a,l,c;const i=new d.Ray((a=this._cameraObject)==null?void 0:a.worldPosition,(l=this._cameraObject)==null?void 0:l.worldForward.multiplyScalar(-1)),n=this.context.physics.raycastFromRay(i,e),s=n.length>0?n[0]:void 0;s&&s.distance>this.minZoom&&s.distance<this.maxZoom&&(Ui&&$.DrawWireSphere(s.point,.1,16711680,2),(c=this._controls)==null||c.target.copy(n[0].point))}afterHandleInput(e){e.detail.args.pointerId===0&&(e.detail.args.isDown?this._controls&&this._eventSystem&&(this._shouldDisable=this._eventSystem.hasActiveUI):(!e.detail.args.isPressed||e.detail.args.isUp)&&(this._shouldDisable=!1))}onBeforeRender(){var i,n,s,a;if(!this._controls)return;if(this._cameraObject!==this.context.mainCamera){this._controls.enabled=!1;return}if(this._controls.enabled=!0,(this.context.input.getPointerDown(1)||this.context.input.getPointerDown(2)||this.context.input.mouseWheelChanged||this.context.input.getPointerPressed(0)&&((i=this.context.input.getPointerPositionDelta(0))!=null&&i.length()))&&(this._inputs+=1),this._inputs>0&&this.allowInterrupt&&(this.enableRotate&&(this.autoRotate=!1),this._cameraLerpActive=!1,this._lookTargetLerpActive=!1),this._inputs=0,this.autoTarget&&this._didSetTarget++===0){const l=C.getComponent(this.gameObject,ai);if(l&&!this.setLookTargetFromConstraint()){this.debugLog&&console.log("NO TARGET");const c=Q(l.threeCamera),h=Math.max(.01,c.length()),u=new d.Vector3(0,0,-h).applyMatrix4(l.threeCamera.matrixWorld);Ui&&$.DrawLine(c,u,5592575,10),this.setLookTargetPosition(u,!0)}if(!this.setLookTargetFromConstraint()){const c=new Ds;c.screenPoint=new d.Vector2(0,0),c.lineThreshold=.1;const h=this.context.physics.raycast(c);h.length>0&&this.setLookTargetPosition(h[0].point,!0),Tl&&console.log("OrbitControls hits",...h)}}if(this.middleClickToFocus&&this.context.input.getPointerClicked(1)&&this.setTargetFromRaycast(),this._lookTargetLerpActive||this._cameraLerpActive||this._fovLerpActive){if(this._cameraLerpActive&&this._cameraObject)if(this._cameraLerp01+=this.context.time.deltaTime/this._cameraLerpDuration,this._cameraLerp01>=1)this._cameraObject.position.copy(this._cameraEndPosition),this._cameraLerpActive=!1,this.dispatchEvent(new Fc(this,"camera"));else{const l=z.easeInOutCubic(this._cameraLerp01);this._cameraObject.position.lerpVectors(this._cameraStartPosition,this._cameraEndPosition,l)}if(this._lookTargetLerpActive)if(this._lookTargetLerp01+=this.context.time.deltaTime/this._lookTargetLerpDuration,this._lookTargetLerp01>=1)this._controls.target.copy(this._lookTargetEndPosition),this._lookTargetLerpActive=!1,this.dispatchEvent(new Fc(this,"lookat"));else{const l=z.easeInOutCubic(this._lookTargetLerp01);this._controls.target.lerpVectors(this._lookTargetStartPosition,this._lookTargetEndPosition,l)}if(this._fovLerpActive&&this._cameraObject){const l=this._cameraObject;if(this._fovLerp01+=this.context.time.deltaTime/this._fovLerpDuration,this._fovLerp01>=1)l.fov=this._fovLerpEndValue,this._fovLerpActive=!1;else{const c=z.easeInOutCubic(this._fovLerp01);l.fov=z.lerp(this._fovLerpStartValue,this._fovLerpEndValue,c)}l.updateProjectionMatrix()}}if(this._controls){if(this.debugLog&&(this._controls.domElement=this.context.renderer.domElement),this._controls.enabled=!this._shouldDisable&&this._camera===this.context.mainCameraComponent&&!this.context.isInXR&&!this._activePointerEvents.some(l=>l.used),this._controls.keys=this.enableKeys?hp:XP,this._controls.autoRotate=this.autoRotate,this._controls.autoRotateSpeed=this.autoRotateSpeed,this._controls.enableZoom=this.enableZoom,this._controls.zoomSpeed=this.zoomSpeed,this._controls.zoomToCursor=this.zoomToCursor,this._controls.enableDamping=this.enableDamping,this._controls.dampingFactor=this.dampingFactor,this._controls.enablePan=this.enablePan,this._controls.enableRotate=this.enableRotate,this._controls.minAzimuthAngle=this.minAzimuthAngle,this._controls.maxAzimuthAngle=this.maxAzimuthAngle,this._controls.minPolarAngle=this.minPolarAngle,this._controls.maxPolarAngle=this.maxPolarAngle,cp||(((s=(n=this._camera)==null?void 0:n.threeCamera)==null?void 0:s.type)==="PerspectiveCamera"?(this._controls.minDistance=this.minZoom,this._controls.maxDistance=this.maxZoom,this._controls.minZoom=0,this._controls.maxZoom=1/0):(this._controls.minDistance=0,this._controls.maxDistance=1/0,this._controls.minZoom=this.minZoom,this._controls.maxZoom=this.maxZoom)),typeof hd=="number"||hd===!0){this._controls.enableDamping=!0;const l=typeof hd=="number"?hd:.99;this._controls.dampingFactor=Math.max(.001,1-Math.min(1,l))}this.allowInterrupt||(this._lookTargetLerpActive&&(this._controls.enablePan=!1),this._cameraLerpActive&&(this._controls.enableRotate=!1,this._controls.autoRotate=!1),(this._lookTargetLerpActive||this._cameraLerpActive)&&(this._controls.enableZoom=!1)),this.context.isInXR||(!cp&&((a=this.lookAtConstraint)!=null&&a.locked)&&this.setLookTargetFromConstraint(0,this.lookAtConstraint01),this._controls.update(this.context.time.deltaTime),Ui&&$.DrawWireSphere(this._controls.target,.1,65280))}}setCameraAndLookTarget(e,i=!1){if(!e)return(j()||Ui)&&console.warn("[OrbitControls] setCameraAndLookTarget target is null"),!1;if(!(e instanceof d.Object3D)&&!(e instanceof ai))return(j()||Ui)&&console.warn("[OrbitControls] setCameraAndLookTarget target is not an Object3D or Camera"),!1;e instanceof ai&&(e=e.gameObject);const n=e.worldPosition,s=e.worldForward;e instanceof d.Camera&&(Ui&&console.debug("[OrbitControls] setCameraAndLookTarget flip forward direction for camera"),s.multiplyScalar(-1));const a=new d.Ray(n,s);return Ui&&$.DrawRay(a.origin,a.direction,16711680,10),this.setTargetFromRaycast(a,i)||this.setLookTargetPosition(a.at(2,V()),i),this.setCameraTargetPosition(n,i),!0}setCameraTargetPosition(e,i=!1){var n;e&&(e instanceof d.Object3D&&(e=Q(e)),this._cameraEndPosition||(this._cameraEndPosition=new d.Vector3),this._cameraEndPosition.copy(e),i===!0?(this._cameraLerpActive=!1,this._cameraObject&&this._cameraObject.position.copy(this._cameraEndPosition)):this._cameraObject&&(this._cameraLerpActive=!0,this._cameraLerp01=0,this._cameraStartPosition.copy((n=this._cameraObject)==null?void 0:n.position),typeof i=="number"?this._cameraLerpDuration=i:this._cameraLerpDuration=this.targetLerpDuration))}get cameraLerpActive(){return this._cameraLerpActive}stopCameraLerp(){this._cameraLerpActive=!1}setFieldOfView(e,i=!1){var s;if(!this._controls||typeof e!="number")return;const n=(s=this._camera)==null?void 0:s.threeCamera;n&&(i===!0?n.fov=e:(this._fovLerpActive=!0,this._fovLerp01=0,this._fovLerpStartValue=n.fov,this._fovLerpEndValue=e,typeof i=="number"?this._fovLerpDuration=i:this._fovLerpDuration=this.targetLerpDuration))}setLookTargetPosition(e=null,i=!1){this._controls&&e&&(e instanceof d.Object3D&&(e=Q(e)),this._lookTargetEndPosition.copy(e),this._didSetTarget++,Ui&&(console.warn("OrbitControls: setLookTargetPosition",e,i),$.DrawWireSphere(this._lookTargetEndPosition,.2,16711680,2)),i===!0?this._controls.target.copy(this._lookTargetEndPosition):(this._lookTargetLerpActive=!0,this._lookTargetLerp01=0,this._lookTargetStartPosition.copy(this._controls.target),typeof i=="number"?this._lookTargetLerpDuration=i:this._lookTargetLerpDuration=this.targetLerpDuration))}get lookTargetLerpActive(){return this._lookTargetLerpActive}stopLookTargetLerp(){this._lookTargetLerpActive=!1}setLookTargetFromConstraint(e=0,i=1){var s,a;if(!this._controls||((s=this.lookAtConstraint)==null?void 0:s.enabled)===!1)return!1;const n=(a=this.lookAtConstraint)==null?void 0:a.sources;if(n&&n.length>0){const l=n[e];if(l)return l.getWorldPosition(this._lookTargetEndPosition),this.lerpLookTarget(this._lookTargetEndPosition,i),!0}return!1}lerpTarget(e,i){return this.lerpLookTarget(e,i)}lerpLookTarget(e,i){this._controls&&(i>=1?this._controls.target.copy(e):this._controls.target.lerp(e,i))}setTargetFromRaycast(e,i=!1){if(!this.controls)return!1;const n=e?this.context.physics.raycastFromRay(e):this.context.physics.raycast();for(const s of n)if(s.distance>0&&C.isActiveInHierarchy(s.object)){const a=Tg(s.object);if(a){const l=a.canvas;if(l!=null&&l.screenspace)break}return this.setLookTargetPosition(s.point,i),!0}return!1}fitCamera(e,i){var G,B;if(this.context.isInXR)return;let n;if(Array.isArray(e)?n=e:e&&"type"in e?n=e.children:e&&typeof e=="object"&&!(e instanceof d.Object3D)&&!Array.isArray(e)&&(i=e,n=i.objects),n&&!Array.isArray(n)&&(n=n.children),(!Array.isArray(n)||n&&n.length<=0)&&(n=this.context.scene.children),!Array.isArray(n)||n.length<=0){console.warn("No objects to fit camera to...");return}const s=this._cameraObject,a=this._controls;if(!s||!a){console.warn("No camera or controls found to fit camera to objects...");return}i||(i={});const{immediate:l=!1,centerCamera:c="y",cameraNearFar:h="auto",fitOffset:u=1.1,fov:f=s==null?void 0:s.fov}=i,p=new d.Vector3,g=new d.Vector3,y=ci(n,void 0,(B=(G=this._camera)==null?void 0:G.threeCamera)==null?void 0:B.layers),b=y.clone();s.updateMatrixWorld(),s.updateProjectionMatrix(),y.getCenter(g);const _=new d.Vector3;if(y.getSize(_),y.applyMatrix4(s.matrixWorldInverse),y.getSize(p),y.setFromCenterAndSize(g,p),Number.isNaN(p.x)||Number.isNaN(p.y)||Number.isNaN(p.z)){console.warn("Camera fit size resultet in NaN",s,y,[...n]);return}if(p.length()<=1e-10){Tl&&console.warn("Camera fit size is zero",y,[...n]);return}const v=i.fov||s.fov,w=2*Math.atan(Math.tan(v*Math.PI/360/2)*s.aspect)/Math.PI*360,x=p.y/(2*Math.atan(Math.PI*v/360)),O=p.x/(2*Math.atan(Math.PI*w/360)),E=u*Math.max(x,O)+p.z/2;Tl&&console.log("Fit camera to objects",{fitHeightDistance:x,fitWidthDistance:O,distance:E,verticalFov:v,horizontalFov:w}),this.maxZoom=E*10,this.minZoom=E*.01;const M=.05,R=g.clone();if(R.y-=p.y*M,this.setLookTargetPosition(R,l),this.setFieldOfView(i.fov,l),h==null||h=="auto"){const L=C.findObjectOfType(ss),N=L?L.radius:0,Y=Math.max(_.x,_.y,_.z,N);s.near=E/100,s.far=Y+E*10,L&&(this.maxZoom=Math.max(Math.min(this.maxZoom,N*.5),E))}const F=a.getDistance();F<this.minZoom&&(this.minZoom=F*.9),F>this.maxZoom&&(this.maxZoom=F*1.1),s.updateMatrixWorld(),s.updateProjectionMatrix();const D=Q(s),A=g.clone();A.sub(D),c==="y"&&(A.y=0),A.normalize(),A.multiplyScalar(E),c==="y"&&(A.y+=-M*4*E);let T=g.clone().sub(A);s.parent&&(T=s.parent.worldToLocal(T)),this.setCameraTargetPosition(T,l),(Tl||i.debug)&&($.DrawWireBox3(y,16777011,10),$.DrawWireBox3(b,65280,10),!this._haveAttachedKeyboardEvents&&Tl&&(this._haveAttachedKeyboardEvents=!0,document.body.addEventListener("keydown",L=>{if(L.code==="KeyF"){let N;this._cameraObject instanceof d.PerspectiveCamera&&(N=Math.random()*Math.random()*170+10),this.fitCamera({objects:n,fitOffset:u,immediate:!1,fov:N})}L.code==="KeyV"&&this._cameraObject instanceof d.PerspectiveCamera&&(this._cameraObject.fov=60)}))),this.onBeforeRender()}}Te([m()],ge.prototype,"autoTarget");Te([m()],ge.prototype,"autoFit");Te([m()],ge.prototype,"enableRotate");Te([m()],ge.prototype,"autoRotate");Te([m()],ge.prototype,"autoRotateSpeed");Te([m()],ge.prototype,"minAzimuthAngle");Te([m()],ge.prototype,"maxAzimuthAngle");Te([m()],ge.prototype,"minPolarAngle");Te([m()],ge.prototype,"maxPolarAngle");Te([m()],ge.prototype,"enableKeys");Te([m()],ge.prototype,"enableDamping");Te([m()],ge.prototype,"dampingFactor");Te([m()],ge.prototype,"enableZoom");Te([m()],ge.prototype,"minZoom");Te([m()],ge.prototype,"maxZoom");Te([m()],ge.prototype,"zoomSpeed");Te([m()],ge.prototype,"enablePan");Te([m(Ur)],ge.prototype,"lookAtConstraint");Te([m()],ge.prototype,"lookAtConstraint01");Te([m()],ge.prototype,"allowInterrupt");Te([m()],ge.prototype,"middleClickToFocus");Te([m()],ge.prototype,"doubleClickToFocus");Te([m()],ge.prototype,"clickBackgroundToFitScene");Te([m()],ge.prototype,"targetLerpDuration");var QP=Object.defineProperty,YP=Object.getOwnPropertyDescriptor,Zt=(o,t,e,i)=>{for(var n=i>1?void 0:i?YP(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&QP(t,e,n),n},Cr=(o=>(o[o.None=0]="None",o[o.Skybox=1]="Skybox",o[o.SolidColor=2]="SolidColor",o[o.Uninitialized=4]="Uninitialized",o))(Cr||{});const no=S("debugcam"),lb=S("debugscreenpointtoray");var pn;const Lt=(pn=class extends I{constructor(){super(...arguments);r(this,"_nearClipPlane",.1);r(this,"_farClipPlane",1e3);r(this,"orthographic",!1);r(this,"orthographicSize",5);r(this,"ARBackgroundAlpha",0);r(this,"_cullingMask",4294967295);r(this,"_backgroundBlurriness");r(this,"_backgroundIntensity");r(this,"_backgroundRotation");r(this,"_environmentIntensity");r(this,"_targetTexture",null);r(this,"_backgroundColor");r(this,"_fov");r(this,"_cam",null);r(this,"_clearFlags",2);r(this,"_skybox");r(this,"_frustum");r(this,"_projScreenMatrix",new d.Matrix4)}get isCamera(){return!0}get aspect(){return this._cam instanceof d.PerspectiveCamera?this._cam.aspect:this.context.domWidth/this.context.domHeight}set aspect(e){this._cam instanceof d.PerspectiveCamera&&this._cam.aspect!==e&&(this._cam.aspect=e,this._cam.updateProjectionMatrix())}get fieldOfView(){return this._cam instanceof d.PerspectiveCamera?this._cam.fov:this._fov}set fieldOfView(e){const i=this.fieldOfView!=e;if(this._fov=e,i&&this._cam&&this._cam instanceof d.PerspectiveCamera){if(this._fov===void 0){console.warn("Can not set undefined fov on PerspectiveCamera");return}this._cam.fov=this._fov,this._cam.updateProjectionMatrix()}}get nearClipPlane(){return this._nearClipPlane}set nearClipPlane(e){const i=this._nearClipPlane!=e;this._nearClipPlane=e,this._cam&&(i||this._cam.near!=e)&&(this._cam.near=e,this._cam.updateProjectionMatrix())}get farClipPlane(){return this._farClipPlane}set farClipPlane(e){const i=this._farClipPlane!=e;this._farClipPlane=e,this._cam&&(i||this._cam.far!=e)&&(this._cam.far=e,this._cam.updateProjectionMatrix())}applyClippingPlane(){this._cam&&(this._cam.near=this._nearClipPlane,this._cam.far=this._farClipPlane,this._cam.updateProjectionMatrix())}get clearFlags(){return this._clearFlags}set clearFlags(e){if(typeof e=="string")switch(e){case"skybox":e=1;break;case"solidcolor":e=2;break;default:e=0;break}e!==this._clearFlags&&(this._clearFlags=e,this.applyClearFlagsIfIsActiveCamera())}set cullingMask(e){this._cullingMask=e,this._cam&&(this._cam.layers.mask=e)}get cullingMask(){return this._cam?this._cam.layers.mask:this._cullingMask}set cullingLayer(e){this.cullingMask=(1<<e|0)>>>0}set backgroundBlurriness(e){e!==this._backgroundBlurriness&&(e===void 0?this._backgroundBlurriness=void 0:this._backgroundBlurriness=Math.min(Math.max(e,0),1),this.applyClearFlagsIfIsActiveCamera())}get backgroundBlurriness(){return this._backgroundBlurriness}set backgroundIntensity(e){e!==this._backgroundIntensity&&(e===void 0?this._backgroundIntensity=void 0:this._backgroundIntensity=Math.min(Math.max(e,0),10),this.applyClearFlagsIfIsActiveCamera())}get backgroundIntensity(){return this._backgroundIntensity}set backgroundRotation(e){e!==this._backgroundRotation&&(e===void 0?this._backgroundRotation=void 0:this._backgroundRotation=e,this.applyClearFlagsIfIsActiveCamera())}get backgroundRotation(){return this._backgroundRotation}set environmentIntensity(e){this._environmentIntensity=e}get environmentIntensity(){return this._environmentIntensity}get backgroundColor(){return this._backgroundColor??null}set backgroundColor(e){e&&(this._backgroundColor||(this._backgroundColor=new ie(1,1,1,1)),this._backgroundColor.copy(e),(!("alpha"in e)||e.alpha===void 0)&&(this._backgroundColor.alpha=1),this.applyClearFlagsIfIsActiveCamera())}set targetTexture(e){this._targetTexture=e}get targetTexture(){return this._targetTexture}get cam(){return this.threeCamera}get threeCamera(){return this.activeAndEnabled&&this.buildCamera(),this._cam}screenPointToRay(e,i,n){const s=this.threeCamera,a=pn._origin;a.set(e,i,-1),this.context.input.convertScreenspaceToRaycastSpace(a),lb&&console.log("screenPointToRay",e.toFixed(2),i.toFixed(2),"now:",a.x.toFixed(2),a.y.toFixed(2),"isInXR:"+this.context.isInXR),a.z=-1,a.unproject(s);const l=pn._direction.set(a.x,a.y,a.z),c=Q(s);return l.sub(c),l.normalize(),n?(n.set(c,l),n):new d.Ray(c.clone(),l.clone())}getFrustum(){return this._frustum||(this._frustum=new d.Frustum,this.updateFrustum()),this._frustum}updateFrustum(){this._frustum||(this._frustum=new d.Frustum),this._frustum.setFromProjectionMatrix(this.getProjectionScreenMatrix(this._projScreenMatrix,!0),this.context.renderer.coordinateSystem)}getProjectionScreenMatrix(e,i){return i&&this._projScreenMatrix.multiplyMatrices(this.threeCamera.projectionMatrix,this.threeCamera.matrixWorldInverse),e===this._projScreenMatrix?e:e.copy(this._projScreenMatrix)}awake(){lb&&window.addEventListener("pointerdown",e=>{const i=e.clientX,n=e.clientY;console.log("touch",i.toFixed(2),n.toFixed(2));const s=this.screenPointToRay(i,n),a="#"+Math.floor(Math.random()*16777215).toString(16);$.DrawRay(s.origin,s.direction,a,10)})}onEnable(){no&&console.log(`Camera enabled: "${this.name}". ClearFlags=${Cr[this._clearFlags]}`,this),this.buildCamera(),(this.tag=="MainCamera"||!this.context.mainCameraComponent)&&(this.context.setCurrentCamera(this),ZP(this)),this.applyClearFlagsIfIsActiveCamera({applySkybox:!0})}onDisable(){this.context.removeCamera(this)}onBeforeRender(){if(this._cam&&(this._frustum&&this.updateFrustum(),this._clearFlags===2&&this.applyClearFlagsIfIsActiveCamera(),this._targetTexture)){this.context.isManagedExternally&&(this._warnedAboutExternalRenderer||(this._warnedAboutExternalRenderer=!0,console.warn("Rendering with external renderer is not supported yet. This may not work or throw errors. Please remove the the target texture from your camera: "+this.name,this.targetTexture))),this.context.composer;const e=this.context.renderer;if(e){const i=this.context.mainCameraComponent;this.applyClearFlags(),this._targetTexture.render(this.context.scene,this._cam,e),i==null||i.applyClearFlags()}}}buildCamera(){if(this._cam)return;const e=this.gameObject.isCamera;let i=null;if(e?(i=this.gameObject,i==null||i.layers.enableAll(),i instanceof d.PerspectiveCamera&&(this._fov=i.fov)):i=this.gameObject.children[0],i&&i.isCamera)i instanceof d.PerspectiveCamera&&(this._fov&&(i.fov=this._fov),i.near=this._nearClipPlane,i.far=this._farClipPlane,i.updateProjectionMatrix());else if(!this.orthographic)i=new d.PerspectiveCamera(this.fieldOfView,window.innerWidth/window.innerHeight,this._nearClipPlane,this._farClipPlane),this.fieldOfView&&(i.fov=this.fieldOfView),this.gameObject.add(i);else{const n=this.orthographicSize*100;i=new d.OrthographicCamera(window.innerWidth/-n,window.innerWidth/n,window.innerHeight/n,window.innerHeight/-n,this._nearClipPlane,this._farClipPlane),this.gameObject.add(i)}this._cam=i,this._cam.layers.mask=this._cullingMask,this.tag=="MainCamera"&&this.context.setCurrentCamera(this)}applyClearFlagsIfIsActiveCamera(e){this.context.mainCameraComponent===this&&this.applyClearFlags(e)}applyClearFlags(e){var n;if(!this._cam){no&&console.log("Camera does not exist (apply clear flags)");return}if(this.fieldOfView=this._fov,no){const s=`[Camera] Apply ClearFlags: ${Cr[this._clearFlags]} - "${this.name}"`;console.debug(s)}const i=this.context.domElement.getAttribute("background-image")||this.context.domElement.getAttribute("background-color");switch(this._clearFlags){case 0:return;case 1:if(pn.backgroundShouldBeTransparent(this.context)&&(!this.ARBackgroundAlpha||this.ARBackgroundAlpha<.001)){this.context.scene.background=null,this.context.renderer.setClearColor(0,0);return}(!this.scene.background||!this._skybox||(e==null?void 0:e.applySkybox)===!0)&&this.applySceneSkybox(),this._backgroundBlurriness!==void 0&&!this.context.domElement.getAttribute("background-blurriness")?this.context.scene.backgroundBlurriness=this._backgroundBlurriness:no&&console.warn(`Camera "${this.name}" has no background blurriness`),this._backgroundIntensity!==void 0&&!this.context.domElement.getAttribute("background-intensity")&&(this.context.scene.backgroundIntensity=this._backgroundIntensity),this._backgroundRotation!==void 0&&!this.context.domElement.getAttribute("background-rotation")?this.context.scene.backgroundRotation=this._backgroundRotation:no&&console.warn(`Camera "${this.name}" has no background intensity`);break;case 2:if(this._backgroundColor&&!i){let s=this._backgroundColor.alpha;pn.backgroundShouldBeTransparent(this.context)&&(s=this.ARBackgroundAlpha??0),this.context.scene.background=null,(n=this.context.xr)!=null&&n.isVR?this.context.renderer.setClearColor(S0(this._backgroundColor).convertLinearToSRGB()):this.context.renderer.setClearColor(this._backgroundColor,s)}else this._backgroundColor||no&&console.warn(`[Camera] has no background color "${this.name}" `);break;case 4:i||(this.context.scene.background=null,this.context.renderer.setClearColor(0,0));break}}applySceneSkybox(){this._skybox||(this._skybox=new KP(this)),this._skybox.apply()}static backgroundShouldBeTransparent(e){var a,l,c,h;const i=(a=e.renderer.xr)==null?void 0:a.getSession();if(!i)return!1;if(typeof i._transparent=="boolean")return i._transparent;const n=i.environmentBlendMode;no&&Ee("Environment blend mode: "+n+" on "+navigator.userAgent);let s=n==="additive"||n==="alpha-blend";return e.isInAR&&n==="opaque"&&((l=navigator.userAgent)!=null&&l.includes("OculusBrowser")||(c=navigator.userAgent)!=null&&c.includes("Mozilla")&&((h=navigator.userAgent)!=null&&h.includes("Mobile WebXRViewer/v2")))&&(s=!0),i._transparent=s,s}},r(pn,"_origin",new d.Vector3),r(pn,"_direction",new d.Vector3),pn);Zt([m()],Lt.prototype,"aspect",1);Zt([m()],Lt.prototype,"fieldOfView",1);Zt([m()],Lt.prototype,"nearClipPlane",1);Zt([m()],Lt.prototype,"farClipPlane",1);Zt([m()],Lt.prototype,"clearFlags",1);Zt([m()],Lt.prototype,"orthographic",2);Zt([m()],Lt.prototype,"orthographicSize",2);Zt([m()],Lt.prototype,"ARBackgroundAlpha",2);Zt([m()],Lt.prototype,"cullingMask",1);Zt([m()],Lt.prototype,"backgroundBlurriness",1);Zt([m()],Lt.prototype,"backgroundIntensity",1);Zt([m(d.Euler)],Lt.prototype,"backgroundRotation",1);Zt([m()],Lt.prototype,"environmentIntensity",1);Zt([m(ie)],Lt.prototype,"backgroundColor",1);Zt([m(xr)],Lt.prototype,"targetTexture",1);let ai=Lt;class KP{constructor(t){r(this,"_camera");r(this,"_skybox");this._camera=t}get context(){var t;return(t=this._camera)==null?void 0:t.context}apply(){var t;if(this._skybox=this.context.lightmaps.tryGetSkybox(this._camera.sourceId),!this._skybox)this._did_log_failed_to_find_skybox||(this._did_log_failed_to_find_skybox=!0,console.warn(`Camera "${this._camera.name}" has no skybox texture. ${this._camera.sourceId}`));else if(this.context.scene.background!==this._skybox){const e=this.context.domElement.getAttribute("background-image")||this.context.domElement.getAttribute("background-color")||this.context.domElement.getAttribute("skybox-image");no&&console.debug(`[Camera] Apply Skybox ${(t=this._skybox)==null?void 0:t.name} ${e} - "${this._camera.name}"`),e!=null&&e.length||(this._skybox.mapping=d.EquirectangularReflectionMapping,this.context.scene.background=this._skybox)}}}function ZP(o){S("freecam")&&o.context.mainCameraComponent===o&&C.getOrAddComponent(o.gameObject,ge)}class Ms extends I{constructor(){super(...arguments);r(this,"_listener",null);r(this,"onInteraction",()=>{this.destroyed||this.listener==null||this.addListenerIfItExists()})}get listener(){return this._listener==null&&(this._listener=new d.AudioListener),this._listener}onEnable(){vn.registerWaitForInteraction(this.onInteraction),this.addListenerIfItExists()}onDisable(){vn.unregisterWaitForInteraction(this.onInteraction),this.removeListenerIfItExists()}addListenerIfItExists(){const e=this._listener;if(!e||e!=null&&e.parent)return;const i=this.context.mainCameraComponent||C.getComponentInParent(this.gameObject,ai);i!=null&&i.threeCamera?i.threeCamera.add(e):this.gameObject.add(e),e.filter?(e.gain.connect(e.filter),e.filter.connect(e.context.destination)):e.gain.connect(e.context.destination)}removeListenerIfItExists(){const e=this._listener;e&&(e.removeFromParent(),e.filter&&e.filter.disconnect(),e.gain&&e.gain.disconnect())}}var JP=Object.defineProperty,eM=Object.getOwnPropertyDescriptor,Sn=(o,t,e,i)=>{for(var n=i>1?void 0:i?eM(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&JP(t,e,n),n};const gt=S("debugaudio"),Zi=class so extends I{constructor(){super(...arguments);r(this,"clip","");r(this,"playOnAwake",!1);r(this,"preload",!0);r(this,"playInBackground",!0);r(this,"_spatialBlend",0);r(this,"_minDistance",1);r(this,"_maxDistance",100);r(this,"_volume",1);r(this,"rollOffMode",0);r(this,"_loop",!1);r(this,"sound",null);r(this,"helper",null);r(this,"wasPlaying",!1);r(this,"audioLoader",null);r(this,"shouldPlay",!1);r(this,"_lastClipStartedLoading",null);r(this,"_audioElement",null);r(this,"onVisibilityChanged",()=>{switch(document.visibilityState){case"hidden":(this.playInBackground===!1||exports.DeviceUtilities.isMobileDevice())&&(this.wasPlaying=this.isPlaying,this.isPlaying&&this.pause());break;case"visible":gt&&console.log("visible",this.enabled,this.playOnAwake,!this.isPlaying,so.userInteractionRegistered,this.wasPlaying),this.enabled&&this.playOnAwake&&!this.isPlaying&&so.userInteractionRegistered&&this.wasPlaying&&this.play();break}});r(this,"onApplicationMuteChanged",()=>{var e,i;this.context.application.muted?(e=this.sound)==null||e.setVolume(0):(i=this.sound)==null||i.setVolume(this.volume)});r(this,"createAudio",e=>{if(this.destroyed){gt&&console.warn("AudioSource destroyed, not creating audio",this.name);return}gt&&console.log("AudioBuffer finished loading",e);const i=this.Sound;if(!i){gt&&console.warn("Failed getting sound?",this.name);return}i.isPlaying&&i.stop(),e&&i.setBuffer(e),i.loop=this._loop,this.context.application.muted?i.setVolume(0):i.setVolume(this.volume),i.autoplay=this.shouldPlay&&so.userInteractionRegistered,this.applySpatialDistanceSettings(),i.isPlaying&&i.stop(),so.registerWaitForAllowAudio(this.__onAllowAudioCallback)});r(this,"__onAllowAudioCallback",()=>{this.shouldPlay&&this.play()});r(this,"_lastContextTime",0);r(this,"_hasEnded",!0);r(this,"_needUpdateSpatialDistanceSettings",!1)}static get userInteractionRegistered(){return vn.userInteractionRegistered}static registerWaitForAllowAudio(e){vn.registerWaitForInteraction(e)}get isPlaying(){var e;return((e=this.sound)==null?void 0:e.isPlaying)??!1}get duration(){var e,i;return(i=(e=this.sound)==null?void 0:e.buffer)==null?void 0:i.duration}get time01(){var i;const e=this.duration;return e&&this.sound?((i=this.sound)==null?void 0:i.context.currentTime)/e:0}set time01(e){const i=this.duration;i&&this.sound&&(this.time=e*i)}get time(){var e,i;return(e=this.sound)!=null&&e.source?((i=this.sound.source)==null?void 0:i.context.currentTime)-this._lastContextTime+this.sound.offset:0}set time(e){if(this.sound){if(e===this.sound.offset)return;const i=this.isPlaying;this.stop(),this.sound.offset=e,i&&this.play()}}get loop(){return this.sound&&(this._loop=this.sound.getLoop()),this._loop}set loop(e){this._loop=e,this.sound&&this.sound.setLoop(e)}get spatialBlend(){return this._spatialBlend}set spatialBlend(e){e!==this._spatialBlend&&(this._spatialBlend=e,this._needUpdateSpatialDistanceSettings=!0)}get minDistance(){return this._minDistance}set minDistance(e){this._minDistance!==e&&(this._minDistance=e,this._needUpdateSpatialDistanceSettings=!0)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance!==e&&(this._maxDistance=e,this._needUpdateSpatialDistanceSettings=!0)}get volume(){return this._volume}set volume(e){this._volume=e,this.sound&&!this.context.application.muted&&(gt&&console.log(this.name,"audio set volume",e),this.sound.setVolume(e))}set pitch(e){this.sound&&this.sound.setPlaybackRate(e)}get pitch(){return this.sound?this.sound.getPlaybackRate():1}get Sound(){var e;if(!this.sound&&so.userInteractionRegistered){let i=this.gameObject.getComponent(Ms)??this.context.mainCamera.getComponent(Ms)??hh(Ms,this.context,!1);!i&&this.context.mainCamera&&(i=this.context.mainCamera.addComponent(Ms)),i!=null&&i.listener?(this.sound=new d.PositionalAudio(i.listener),(e=this.gameObject)==null||e.add(this.sound)):gt&&console.warn("No audio listener found in scene - can not play audio")}return this.sound}get ShouldPlay(){return this.shouldPlay}get audioContext(){var e;return(e=this.sound)==null?void 0:e.context}awake(){gt&&console.log("[AudioSource]",this),this.audioLoader=new d.AudioLoader,this.playOnAwake&&(this.shouldPlay=!0),this.preload&&typeof this.clip=="string"&&this.audioLoader.load(this.clip,this.createAudio,()=>{},console.error)}onEnable(){this.sound&&this.gameObject.add(this.sound),so.userInteractionRegistered?this.playOnAwake&&this.context.application.isVisible&&this.play():so.registerWaitForAllowAudio(()=>{this.enabled&&!this.destroyed&&this.shouldPlay&&this.onNewClip(this.clip)}),globalThis.addEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.addEventListener(nm.MuteChanged,this.onApplicationMuteChanged)}onDisable(){globalThis.removeEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.removeEventListener(nm.MuteChanged,this.onApplicationMuteChanged),this.pause()}applySpatialDistanceSettings(){const e=this.sound;if(!e)return;this._needUpdateSpatialDistanceSettings=!1;const i=z.lerp(10*this._maxDistance/Math.max(1e-4,this.spatialBlend),this._minDistance,this.spatialBlend);switch(gt&&console.log(this.name,this._minDistance,this._maxDistance,this.spatialBlend,"Ref distance="+i),e.setRefDistance(i),e.setMaxDistance(Math.max(.01,this._maxDistance)),this.rollOffMode){case 0:e.setDistanceModel("exponential");break;case 1:e.setDistanceModel("linear");break;case 2:console.warn("Custom rolloff for AudioSource is not supported: "+this.name);break}this.spatialBlend>0?gt&&!this.helper&&(this.helper=new H.PositionalAudioHelper(e,e.getRefDistance()),e.add(this.helper)):this.helper&&this.helper.parent&&this.helper.removeFromParent()}async onNewClip(e){if(e&&(this.clip=e),typeof e=="string")if(gt&&console.log(e),e.endsWith(".mp3")||e.endsWith(".wav")){if(this.audioLoader||(this.audioLoader=new d.AudioLoader),this.shouldPlay=!0,this._lastClipStartedLoading===e){gt&&console.log("Is currently loading:",this._lastClipStartedLoading,this);return}this._lastClipStartedLoading=e,gt&&console.log("load audio",e);const i=await this.audioLoader.loadAsync(e).catch(console.error);if(this.destroyed)return;this._lastClipStartedLoading===e&&(this._lastClipStartedLoading=null),i&&this.createAudio(i)}else console.warn("Unsupported audio clip type",e);else this.shouldPlay=!0,this.createAudio()}play(e=void 0){var n,s,a;!e&&this.clip&&(e=this.clip),e!==void 0&&typeof e!="string"&&!(e instanceof MediaStream)&&(j()&&console.warn("Called play on AudioSource with unknown argument type:",e+`
941
941
  Using the assigned clip instead:`,this.clip),e=this.clip);let i=!this.sound||e&&e!==this.clip;if(typeof e=="string"&&!this.audioLoader&&(i=!0),(e instanceof MediaStream||typeof e=="string")&&(this.clip=e),i){this.shouldPlay=!0,this.onNewClip(e);return}if(this.shouldPlay=!0,this._hasEnded=!1,gt&&console.log("play",(n=this.sound)==null?void 0:n.getVolume(),this.sound),this.sound&&!this.sound.isPlaying){const l=this.context.application.muted;l&&this.sound.setVolume(0),(s=this.gameObject)==null||s.add(this.sound),this.clip instanceof MediaStream?(this.sound.setMediaStreamSource(this.clip),this._audioElement||(this._audioElement=document.createElement("audio"),this._audioElement.style.display="none"),this._audioElement.parentNode||(a=this.context.domElement.shadowRoot)==null||a.append(this._audioElement),this._audioElement.srcObject=this.clip,this._audioElement.autoplay=!1):(this._audioElement&&this._audioElement.remove(),this.sound.play(l?.1:0))}}pause(){var e,i;gt&&console.log("Pause",this),this._hasEnded=!0,this.shouldPlay=!1,this.sound&&this.sound.isPlaying&&this.sound.source&&(this._lastContextTime=(e=this.sound)==null?void 0:e.context.currentTime,this.sound.pause()),(i=this._audioElement)==null||i.remove()}stop(){var e,i;gt&&console.log("Pause",this),this._hasEnded=!0,this.shouldPlay=!1,this.sound&&this.sound.source&&(this._lastContextTime=(e=this.sound)==null?void 0:e.context.currentTime,gt&&console.log(this._lastContextTime),this.sound.stop()),(i=this._audioElement)==null||i.remove()}update(){this.helper&&(this.isPlaying&&this.helper.update(),this.helper.visible=this.isPlaying),this._needUpdateSpatialDistanceSettings&&this.applySpatialDistanceSettings(),this.sound&&!this.sound.isPlaying&&this.shouldPlay&&!this._hasEnded&&(this._hasEnded=!0,gt&&console.log("Audio clip ended",this.clip),this.dispatchEvent(new CustomEvent("ended",{detail:this})))}};Sn([m(URL)],Zi.prototype,"clip",2);Sn([m()],Zi.prototype,"playOnAwake",2);Sn([m()],Zi.prototype,"preload",2);Sn([m()],Zi.prototype,"playInBackground",2);Sn([m()],Zi.prototype,"loop",1);Sn([m()],Zi.prototype,"spatialBlend",1);Sn([m()],Zi.prototype,"minDistance",1);Sn([m()],Zi.prototype,"maxDistance",1);Sn([m()],Zi.prototype,"volume",1);Sn([m()],Zi.prototype,"pitch",1);Sn([m()],Zi.prototype,"rollOffMode",2);let qi=Zi;const tM=S("debugavatar"),si=class si extends I{constructor(){super(...arguments);r(this,"connectionId");r(this,"avatar")}static getAvatar(e){return e>=0&&e<si.instances.length?si.instances[e]:null}static onAvatarMarkerCreated(e){return si._onNewAvatarMarkerAdded.push(e),e}static onAvatarMarkerDestroyed(e){return si._onAvatarMarkerDestroyed.push(e),e}awake(){si.instances.push(this),tM&&console.log(this);for(const e of si._onNewAvatarMarkerAdded)e({avatarMarker:this,gameObject:this.gameObject})}onDestroy(){si.instances.splice(si.instances.indexOf(this),1);for(const e of si._onAvatarMarkerDestroyed)e({avatarMarker:this,gameObject:this.gameObject})}isLocalAvatar(){return this.connectionId===this.context.connection.connectionId}};r(si,"instances",[]),r(si,"_onNewAvatarMarkerAdded",[]),r(si,"_onAvatarMarkerDestroyed",[]);let At=si;class Ts{static Add(t,e,i=null){if(e){for(const n of this.Pois)if(n.obj===e)return;this.Pois.push({obj:e,avatar:i}),this.LastChangeTime=t.time.time}}static Remove(t,e){var i;if(e){for(const n of this.Pois)if(n.obj===e){this.Pois.splice(this.Pois.indexOf(n),1),this.LastChangeTime=(t==null?void 0:t.time.time)??((i=X.Current)==null?void 0:i.time.time);return}}}}r(Ts,"Pois",[]),r(Ts,"LastChangeTime",0);class iM{constructor(){r(this,"guid");r(this,"position",new d.Vector3)}}class Uc extends I{constructor(){super(...arguments);r(this,"target",null);r(this,"avatar",null);r(this,"_model",null);r(this,"_targetModel",new iM);r(this,"_currentTargetObject",null);r(this,"_lastUpdateTime",0);r(this,"_lookDuration",0);r(this,"_lastPoiChangedTime",0)}set controlledTarget(e){this.target=e;const i=k.get("MoveRandom");if(i&&this.target){const n=C.getComponent(this.target,i);n&&n.destroy()}}awake(){if(this.avatar=C.getComponentInParent(this.gameObject,At),this.avatar){const e=C.getComponentInParent(this.gameObject,At);this._model=new cg(this.context.connection,this.guid),e!=null&&e.isLocalAvatar&&this._model.requestOwnership()}this.context.connection.beginListen("avatar-look-target-changed",e=>{var i;this.target&&e&&e.guid===((i=this.avatar)==null?void 0:i.guid)&&st(this.target,e.position)})}update(){var i;if((!this.context.connection.isConnected||(i=this._model)!=null&&i.hasOwnership)&&(Ts.LastChangeTime!==this._lastPoiChangedTime&&(this._lastPoiChangedTime=Ts.LastChangeTime,this._lookDuration=0),this.selectTarget(),this._currentTargetObject&&this.context.time.frameCount%10===0&&this.target)){const n=Q(this._currentTargetObject);st(this.target,n),this.context.connection.isConnected&&this.avatar&&(this.context.connection.send("avatar-look-target-changed",this._targetModel),this._targetModel.guid=this.avatar.guid,this._targetModel.position.copy(n))}}selectTarget(){if(this.context.time.time-this._lastUpdateTime>this._lookDuration){this._lastUpdateTime=this.context.time.time,this._lookDuration=Math.random()*.5+.2;const i=Ts.Pois;if(i.length>0){const n=i[Math.floor(Math.random()*i.length)];if(n&&n.obj){if(n.avatar&&n.avatar===this.avatar)return;this._currentTargetObject=n.obj}}}}}function uw(o){const t=o;return!!(t.parser&&t.parser.json)}var Zu=(o=>(o[o.None=0]="None",o[o.DontExport=1]="DontExport",o))(Zu||{});function fw(o){return o&&o.isComponent}const nM=Symbol("object"),dp=new ki(()=>new d.Vector3,20);class pw{constructor(t,e,i,n,s,a){r(this,"_point");r(this,"_normal");r(this,"_tangentVelocity");r(this,"distance");r(this,"impulse");r(this,"friction");this._point=t,this.distance=e,this._normal=i,this.impulse=n,this.friction=s,this._tangentVelocity=a}get point(){return dp.get().set(this._point.x,this._point.y,this._point.z)}get normal(){return dp.get().set(this._normal.x,this._normal.y,this._normal.z)}get tangentVelocity(){return dp.get().set(this._tangentVelocity.x,this._tangentVelocity.y,this._tangentVelocity.z)}}class mw{constructor(t,e,i){r(this,"contacts");r(this,"me");r(this,"_collider");r(this,"_gameObject");this.me=t,this._collider=e,this._gameObject=e.gameObject,this.contacts=i}get collider(){return this._collider}get gameObject(){return this._gameObject}get rigidBody(){var t;return(t=this.collider)==null?void 0:t.attachedRigidbody}}class gw{constructor(t,e){r(this,"object");r(this,"collider");this.object=t,this.collider=e}}const Ve=S("debugnetworkingstreams");var Nn=(o=>(o.Connected="peer-user-connected",o.StreamReceived="receive-stream",o.StreamEnded="call-ended",o.Disconnected="peer-user-disconnected",o.UserJoined="user-joined",o))(Nn||{});class Ag{constructor(t,e){r(this,"type","call-ended");r(this,"userId");r(this,"direction");this.userId=t,this.direction=e}}class yw{constructor(t,e,i){r(this,"type","receive-stream");r(this,"userId");r(this,"stream");r(this,"target");this.userId=t,this.stream=e,this.target=i}}class sM{constructor(t,e){r(this,"guid");r(this,"peerId");r(this,"dontSave",!0);this.guid=t.id,this.peerId=e}}var _w=(o=>(o.Incoming="incoming",o.Outgoing="outgoing",o))(_w||{});class oM extends d.EventDispatcher{constructor(e,i,n,s=null){super();r(this,"peerId");r(this,"userId");r(this,"direction");r(this,"call");r(this,"_stream",null);r(this,"_isDisposed",!1);this.peerId=i.peer,this.userId=e,this.call=i,this.direction=n,this._stream=s,i.on("stream",a=>{if(Ve&&console.log("Receive stream",`
942
942
  Audio:`,a.getAudioTracks(),`
943
943
  Video:`,a.getVideoTracks()),this._stream=a,n==="incoming"){const l=new yw(e,a,this);this.dispatchEvent(l)}}),i.on("close",()=>{this.dispatchEvent(new Ag(e,n))})}get stream(){return this._stream}close(){this._isDisposed||(this._isDisposed=!0,this.call.close(),$n(this._stream))}get isOpen(){var e;return((e=this.call.peerConnection)==null?void 0:e.connectionState)==="connected"}get isOpening(){var e;return((e=this.call.peerConnection)==null?void 0:e.connectionState)==="connecting"}get isClosed(){return!this.isOpen||this._isDisposed}}function cb(o){return o=o.replace("a=fmtp:111 minptime=10;useinbandfec=1","a=fmtp:111 ptime=5;useinbandfec=1;stereo=1;maxplaybackrate=48000;maxaveragebitrat=128000;sprop-stereo=1"),o}const or=class or extends d.EventDispatcher{constructor(e,i){super();r(this,"updateCalls",()=>{var e;for(let i=this._incomingCalls.length-1;i>=0;i--){const n=this._incomingCalls[i];n.isClosed&&!n.isOpening&&this._incomingCalls.splice(i,1)}for(let i=this._outgoingCalls.length-1;i>=0;i--){const n=this._outgoingCalls[i];let s=!1;n.isClosed&&!n.isOpening&&((e=n.stream)!=null&&e.active?Ve&&console.warn("!!! Stream is still active, don't remove call",n.userId,"Your id: "+this.context.connection.connectionId):(Ve&&console.warn("!!! Remove closed call",n.userId),s=!0)),this.context.connection.userIsInRoom(n.userId)===!1&&(Ve&&console.warn("!!! User is not in room anymore, remove call",n.userId),s=!0),s&&(n.close(),this._outgoingCalls.splice(i,1))}});r(this,"id");r(this,"context");r(this,"_incomingCalls",[]);r(this,"_outgoingCalls",[]);r(this,"_peer");r(this,"_enabled",!1);r(this,"_enabledPeer",!1);r(this,"onConnectRoomFn",this.onConnectRoom.bind(this));r(this,"onPeerConnect",e=>{if(Ve&&console.log("PEER opened as",e),e===null){console.error("Peer connection failed",e);return}this.context.connection.send("peer-user-connected",new sM(this,e))});r(this,"onPeerClose",()=>{Ve&&console.log("PEER closed"),this.updateCalls()});r(this,"onPeerDisconnected",()=>{Ve&&console.log("PEER disconnected"),this.updateCalls()});r(this,"onPeerError",e=>{Ve&&console.error("PEER error",e)});r(this,"onPeerReceivingCall",e=>{e.answer(void 0,{sdpTransform:i=>cb(i)}),this.registerCall(e,"incoming",null)});this.context=e,this.id=i,this.setupPeer(),navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia}static getOrCreate(e,i){if(or.instances.has(i))return or.instances.get(i);const n=new or(e,i);return or.instances.set(i,n),n}getMyPeerId(){if(this.context.connection.connectionId)return this.getPeerIdFromUserId(this.context.connection.connectionId)}getPeerIdFromUserId(e){return this.id+"-"+e}getUserIdFromPeerId(e){return e.substring(this.id.length+1)}makeCall(e,i){var a;if(!(i!=null&&i.id)){Ve?console.warn("Can not make a call: mediastream has no id or is undefined"):console.debug("Can not make a call: mediastream has no id or is undefined");return}const n={metadata:{userId:this.context.connection.connectionId,streamId:i.id},sdpTransform:l=>cb(l)},s=(a=this._peer)==null?void 0:a.call(e,i,n);if(s){const l=this.registerCall(s,"outgoing",i);return Ve&&console.warn(`📞 CALL ${e}`,`
@@ -1318,9 +1318,9 @@ axisFormat %s
1318
1318
  `;class e extends exports.MODULES.POSTPROCESSING.MODULE.Effect{constructor(){super("Sharpening",t,{vertexShader:o,blendFunction:exports.MODULES.POSTPROCESSING.MODULE.BlendFunction.NORMAL,uniforms:new Map([["amount",new d.Uniform$1(1)],["radius",new d.Uniform$1(1)]]),attributes:Xx.EffectAttribute.CONVOLUTION})}}return e}var xR=Object.defineProperty,bl=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&xR(t,e,n),n};class cs extends Ye{constructor(){super(...arguments);r(this,"offset",new U(0));r(this,"rotation",new U(0));r(this,"focusArea",new U(.4));r(this,"feather",new U(.3));r(this,"kernelSize",new U(2));r(this,"resolutionScale",new U(1/window.devicePixelRatio))}get typeName(){return"TiltShiftEffect"}init(){this.offset.defaultValue=0,this.rotation.defaultValue=0,this.focusArea.defaultValue=.4,this.feather.defaultValue=.3,this.kernelSize.defaultValue=exports.MODULES.POSTPROCESSING.MODULE.KernelSize.MEDIUM,this.resolutionScale.defaultValue=1/window.devicePixelRatio}onCreateEffect(){const e=new exports.MODULES.POSTPROCESSING.MODULE.TiltShiftEffect({kernelSize:exports.MODULES.POSTPROCESSING.MODULE.KernelSize.VERY_LARGE,offset:this.offset.value,rotation:this.rotation.value,focusArea:this.focusArea.value,feather:this.feather.value});return this.offset.onValueChanged=i=>e.offset=i,this.rotation.onValueChanged=i=>e.rotation=i,this.focusArea.onValueChanged=i=>e.focusArea=i,this.feather.onValueChanged=i=>e.feather=i,this.kernelSize.onValueChanged=i=>e.blurPass.kernelSize=i,this.resolutionScale.onValueChanged=i=>e.resolution.scale=i/window.devicePixelRatio,e}}bl([m(U)],cs.prototype,"offset");bl([m(U)],cs.prototype,"rotation");bl([m(U)],cs.prototype,"focusArea");bl([m(U)],cs.prototype,"feather");bl([m(U)],cs.prototype,"kernelSize");bl([m(U)],cs.prototype,"resolutionScale");tn("TiltShiftEffect",cs);var SR=Object.defineProperty,Iy=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&SR(t,e,n),n};class ta extends Ye{constructor(){super(...arguments);r(this,"color",new U({r:0,g:0,b:0,a:1}));r(this,"intensity",new U(0));r(this,"center",new U({x:.5,y:.5}))}get typeName(){return"Vignette"}init(){this.color.defaultValue={r:0,g:0,b:0,a:1},this.intensity.defaultValue=0,this.center.defaultValue={x:.5,y:.5}}onCreateEffect(){const e=new exports.MODULES.POSTPROCESSING.MODULE.VignetteEffect;return this.intensity.onValueChanged=i=>{e.offset=i,this.updateDarkness(e)},this.color.onValueChanged=i=>{this.updateDarkness(e)},e}updateDarkness(e){const i=this.intensity.value;e.darkness=i}}Iy([m(U)],ta.prototype,"color");Iy([m(U)],ta.prototype,"intensity");Iy([m(U)],ta.prototype,"center");tn("Vignette",ta);globalThis.NEEDLE_USE_POSTPROCESSING=globalThis.NEEDLE_USE_POSTPROCESSING!==void 0?globalThis.NEEDLE_USE_POSTPROCESSING:!0;const ps=S("debugpost"),Up=Symbol("needle:postprocessing-handler"),Bl=Symbol("needle:previous-autoclear-state"),Fl=Symbol("needle:previous-tone-mapping");class jy{constructor(t){r(this,"_composer",null);r(this,"_lastVolumeComponents");r(this,"_effects",[]);r(this,"_isActive",!1);r(this,"context");r(this,"_anyPassHasDepth",!1);r(this,"_anyPassHasNormal",!1);r(this,"_hasSmaaEffect",!1);r(this,"_customInputBuffer",null);r(this,"_customInputBufferId",0);r(this,"_multisampling",0);r(this,"_menuEntry",null);r(this,"_passIndices",null);this.context=t}getEffectIsActive(t){return t?this._isActive&&this._effects.some(e=>e.effect===t):!1}get isActive(){return this._isActive}get composer(){return this._composer}apply(t){return this._isActive=!0,this.onApply(this.context,t)}unapply(t=!0){var n,s;if(ps&&console.log("Unapplying postprocessing effects"),this._isActive=!1,this._lastVolumeComponents){for(const a of this._lastVolumeComponents)a.unapply();this._lastVolumeComponents.length=0}const e=this.context;e[Up]===this&&(delete e[Up],typeof e.renderer[Bl]=="boolean"&&(e.renderer.autoClear=e.renderer[Bl]),typeof e.renderer[Fl]=="number"&&(e.renderer.toneMapping=e.renderer[Fl])),(n=this._composer)==null||n.removeAllPasses(),t&&((s=this._composer)==null||s.dispose()),e.composer===this._composer&&(e.composer=null)}dispose(){this.unapply(!0);for(const t of this._effects)t.effect.dispose();this._effects.length=0,this._composer=null}async onApply(t,e){if(!e)return;await Promise.all([exports.MODULES.POSTPROCESSING.load(),exports.MODULES.POSTPROCESSING_AO.load()]),t[Up]=this,ps&&console.log("Apply Postprocessing Effects",e),this._lastVolumeComponents=[...e],this._effects.length=0;const i={handler:this,components:this._lastVolumeComponents};for(let n=0;n<this._lastVolumeComponents.length;n++){const s=this._lastVolumeComponents[n];if(s.context=t,s.apply){if(s.active){let a=function(h,u){return u?(u instanceof exports.MODULES.POSTPROCESSING.MODULE.Effect||u instanceof exports.MODULES.POSTPROCESSING.MODULE.Pass||console.warn(`PostprocessingEffect ${h} created neither Effect nor Pass - this might be caused by a bundler error or false import. Below you find some possible solutions:
1319
1319
  - If you create custom effect try creating it like this: 'new NEEDLE_ENGINE_MODULES.POSTPROCESSING.MODULE.Effect(...)' instead of 'new Effect(...)'`),!0):!1};if(!t.mainCameraComponent){console.error("No camera in scene found or available yet - can not create postprocessing effects");return}const l=s.apply(i);if(!l)continue;const c=s.typeName||s.constructor.name;if(Array.isArray(l))for(const h of l)a(c,h)&&this._effects.push({effect:h,typeName:s.typeName,priority:s.order});else{if(!a(c,l))continue;this._effects.push({effect:l,typeName:s.typeName,priority:s.order})}}}else s.active&&me("Volume component is not a VolumeComponent: "+s.__type)}this.applyEffects(t)}get anyPassHasDepth(){return this._anyPassHasDepth}get anyPassHasNormal(){return this._anyPassHasNormal}get hasSmaaEffect(){return this._hasSmaaEffect}set multisampling(t){this._multisampling=t}get multisampling(){return this._multisampling}applyEffects(t){var u;if(this._anyPassHasDepth=!1,this._anyPassHasNormal=!1,this._hasSmaaEffect=!1,this._effects.length<=0)return;const e=t.mainCameraComponent,i=t.renderer,n=t.scene,s=e.threeCamera;if(typeof i[Bl]=="boolean"&&(i.autoClear=i[Bl]),i[Bl]=i.autoClear,typeof i[Fl]=="number"&&(i.toneMapping=i[Fl]),i[Fl]=i.toneMapping,i.toneMapping!=d.NoToneMapping&&!this._effects.find(f=>f instanceof exports.MODULES.POSTPROCESSING.MODULE.ToneMappingEffect)){const f=new exports.MODULES.POSTPROCESSING.MODULE.ToneMappingEffect;f.name=`ToneMapping (${i.toneMapping})`,f.mode=Vd(i.toneMapping),this._effects.push({typeName:"ToneMapping",effect:f,priority:it.ToneMapping})}this._composer||(this._composer=new exports.MODULES.POSTPROCESSING.MODULE.EffectComposer(i,{frameBufferType:d.HalfFloatType,stencilBuffer:!0})),t.composer&&t.composer!==this._composer&&console.warn("There's already an active EffectComposer in your scene: replacing it with a new one. This might cause unexpected behaviour. Make sure to only use one PostprocessingManager/Volume in your scene."),t.composer=this._composer;const a=t.composer;a.setMainCamera(s),a.setRenderer(i),a.setMainScene(n),a.autoRenderToScreen=!0,a.multisampling=0;for(const f of a.passes)f.dispose();a.removeAllPasses();const l=new exports.MODULES.POSTPROCESSING.MODULE.RenderPass(n,s);l.name="RenderPass",l.mainScene=n,a.addPass(l);const c=l.render;(u=this._customInputBuffer)==null||u.dispose(),this._customInputBuffer=null,l.render=(f,p,g,y,b)=>{var _;p&&(p.samples=0,g&&(g.samples=0),(!this._customInputBuffer||this._customInputBuffer.width!==p.width||this._customInputBuffer.height!==p.height||this._customInputBuffer.samples!==this._multisampling||this._customInputBuffer.texture.format!==p.texture.format||this._customInputBuffer.texture.type!==d.HalfFloatType)&&((_=this._customInputBuffer)==null||_.dispose(),this._customInputBuffer=new d.WebGLRenderTarget(p.width,p.height,{format:p.texture.format,type:d.HalfFloatType,depthBuffer:p.depthBuffer,depthTexture:p.depthTexture?new d.DepthTexture(p.width,p.height):void 0,stencilBuffer:p.stencilBuffer,samples:Math.max(0,this._multisampling),minFilter:p.texture.minFilter??d.LinearFilter,magFilter:p.texture.magFilter??d.LinearFilter,generateMipmaps:p.texture.generateMipmaps}),this._customInputBufferId++,this._customInputBuffer.texture.name=`CustomInputBuffer-${this._customInputBufferId}`,this._customInputBuffer.depthTexture&&p.depthTexture&&(this._customInputBuffer.depthTexture.format=p.depthTexture.format,this._customInputBuffer.depthTexture.type=p.depthTexture.type),this._customInputBuffer.samples>0&&(this._customInputBuffer.ignoreDepthForMultisampleCopy=!1),ps&&console.warn(`[PostProcessing] Input buffer created with size ${this._customInputBuffer.width}x${this._customInputBuffer.height} and samples ${this._customInputBuffer.samples}`)),c.call(l,f,this._customInputBuffer,g,y,b),Mr.blit(this._customInputBuffer.texture,p,{renderer:f,depthTexture:this._customInputBuffer.depthTexture,depthWrite:!0,depthTest:!0}))};try{Hk(this._effects);let f=!1,p=null;for(let b=this._effects.length-1;b>=0;b--){const _=this._effects[b].effect;if(_ instanceof exports.MODULES.POSTPROCESSING.MODULE.ToneMappingEffect){if(f){ps&&console.warn(`[PostProcessing] Found multiple tonemapping effects in the scene: ${_.name} and ${p==null?void 0:p.name}. Only the last one added will be used.`),this._effects.splice(b,1);continue}p=_,f=!0}}const g=[];let y=!1;for(let b=0;b<this._effects.length;b++){const v=this._effects[b].effect;if(v instanceof exports.MODULES.POSTPROCESSING.MODULE.SMAAEffect?this._hasSmaaEffect=!0:v instanceof exports.MODULES.POSTPROCESSING.MODULE.NormalPass&&(this._anyPassHasNormal=!0),!(v instanceof exports.MODULES.POSTPROCESSING.MODULE.ToneMappingEffect&&p!==v))if(v instanceof exports.MODULES.POSTPROCESSING.MODULE.Effect){const w=v.getAttributes(),x=exports.MODULES.POSTPROCESSING.MODULE.EffectAttribute.CONVOLUTION;w&x&&(ps&&console.log("[PostProcessing] Convolution effect: "+v.name),y&&(ps&&console.log("[PostProcessing] → Merging effects ["+g.map(O=>O.name).join(", ")+"]"),this.createPassForMergeableEffects(g,a,s,n)),y=!0),g.push(v)}else v instanceof exports.MODULES.POSTPROCESSING.MODULE.Pass?(y=!1,this.createPassForMergeableEffects(g,a,s,n),v.renderToScreen=!1,a.addPass(v)):(y=!1,this.createPassForMergeableEffects(g,a,s,n),a.addPass(v))}this.createPassForMergeableEffects(g,a,s,n)}catch(f){console.error("Error while applying postprocessing effects",f),a.passes.forEach(p=>p.dispose()),a.removeAllPasses()}let h=!1;for(let f=a.passes.length-1;f>=0;f--){const p=a.passes[f];let g=!1,y=!1;p.enabled&&(h||(g=!0,y=!0),h=!0),p.renderToScreen=y,(p==null?void 0:p.configuration)!==void 0?p.configuration.gammaCorrection=g:"autosetGamma"in p&&(p.autosetGamma=g),this._anyPassHasDepth||(this._anyPassHasDepth=p.needsDepthTexture)}ps&&console.log("[PostProcessing] Passes →",[...a.passes],`
1320
1320
  ---------------------------------
1321
- • `+a.passes.map(f=>f.name).join(`
1321
+ • `+a.passes.map(f=>f.name||f.constructor.name+"*").join(`
1322
1322
  • `)+`
1323
- `),ps&&this._onCreateEffectsDebug(this._composer,s)}createPassForMergeableEffects(t,e,i,n){if(t.length>0){const s=new exports.MODULES.POSTPROCESSING.MODULE.EffectPass(i,...t);s.name=t.map(a=>a.name).join(", "),s.mainScene=n,s.enabled=!0,s.renderToScreen=!1,e.addPass(s),t.length=0}}_onCreateEffectsDebug(t,e){if(ps==="passes"){const i=new exports.MODULES.POSTPROCESSING.MODULE.DepthEffect({blendFunction:exports.MODULES.POSTPROCESSING.MODULE.BlendFunction.NORMAL,inverted:!0});i.name="Depth Effect";const n=new exports.MODULES.POSTPROCESSING.MODULE.EffectPass(e,i);if(n.name="Depth Effect Pass",n.enabled=!1,t.passes.push(n),this._passIndices!==null){const a=[t.passes[0]];this._passIndices.length>0&&a.push(...this._passIndices.filter(l=>l!==0).map(l=>t.passes[l]).filter(l=>l)),a.length>0&&console.log("[PostProcessing] Passes (selected) →",a),t.passes.length=0;for(const l of a)l.enabled=!0,l.renderToScreen=!1,t.addPass(l)}const s=this.context.menu;if(s&&this._passIndices===null){this._menuEntry&&this._menuEntry.remove();const a=document.createElement("select");a.multiple=!0;const l=document.createElement("option");l.innerText="Final Output",l.value="-1",a.appendChild(l);for(const c of t.passes){const h=document.createElement("option");h.innerText=c.name,h.value=`${t.passes.indexOf(c)}`,h.title=c.name,a.appendChild(h)}s.appendChild(a),this._menuEntry=a,a.addEventListener("change",()=>{const c=Array.from(a.selectedOptions).map(h=>parseInt(h.value));c.length===1&&c[0]===-1?this._passIndices=null:this._passIndices=c,this.applyEffects(this.context)})}}}}var CR=Object.defineProperty,yx=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&CR(t,e,n),n};const Yo=S("debugpost");class vl extends I{constructor(){super(...arguments);r(this,"sharedProfile");r(this,"multisampling","auto");r(this,"_postprocessing");r(this,"_activeEffects",[]);r(this,"_effects",[]);r(this,"_componentEnabledTime",-1);r(this,"_multisampleAutoChangeTime",0);r(this,"_multisampleAutoDecreaseTime",0);r(this,"_lastApplyTime");r(this,"_rapidApplyCount",0);r(this,"_isDirty",!1);r(this,"_modificationQueue");r(this,"_recreateId",-1)}get isPostProcessingManager(){return!0}get effects(){return this._activeEffects}get dirty(){return this._isDirty}set dirty(e){this._isDirty=e}addEffect(e){let i=e;return i instanceof Ye||(i=new Gc(i)),i.gameObject===void 0&&this.gameObject.addComponent(i),this._effects.includes(i)||(this._effects.push(i),this._isDirty=!0),e}removeEffect(e){var n,s,a,l;let i=-1;if(e instanceof Ye?i=this._effects.indexOf(e):i=this._effects.findIndex(c=>c instanceof Gc&&c.effect===e),i!==-1)return this._effects.splice(i,1),this._isDirty=!0,e;if(e instanceof Ye){const c=(s=(n=this.sharedProfile)==null?void 0:n.components)==null?void 0:s.indexOf(e);c!==void 0&&c!==-1&&(this._isDirty=!0,(l=(a=this.sharedProfile)==null?void 0:a.components)==null||l.splice(c,1))}return e}markDirty(){this._isDirty=!0}awake(){var e;Yo&&(console.log("PostprocessingManager Awake",this),console.log("Press P to toggle post processing"),window.addEventListener("keydown",i=>{i.key==="p"&&(this.enabled=!this.enabled,Ee("Toggle PostProcessing "+this.name+": Enabled="+this.enabled),this.markDirty())})),(e=this.sharedProfile)==null||e.__init(this)}onEnable(){this._componentEnabledTime=this.context.time.realtimeSinceStartup,this._isDirty=!0}onDisable(){var e;(e=this._postprocessing)==null||e.unapply(),this._isDirty=!1}onBeforeRender(){if(!this.context.isInXR&&(this.context.mainCamera&&this._isDirty&&this.apply(),this.context.composer&&this._postprocessing&&this._postprocessing.composer===this.context.composer)){if(this.context.renderer.getContext().isContextLost()&&this.context.renderer.forceContextRestore(),this.context.composer.getRenderer()!==this.context.renderer&&this.context.composer.setRenderer(this.context.renderer),this.context.composer.setMainScene(this.context.scene),this.multisampling==="auto")if(this._postprocessing&&this._postprocessing.hasSmaaEffect)this._postprocessing.multisampling!==0&&(this._postprocessing.multisampling=0,(Yo||j())&&console.log(`[PostProcessing] multisampling is disabled because it's set to 'auto' on your PostprocessingManager/Volume component that also has an SMAA effect.
1323
+ `),ps&&this._onCreateEffectsDebug(this._composer,s)}createPassForMergeableEffects(t,e,i,n){if(t.length>0){const s=new exports.MODULES.POSTPROCESSING.MODULE.EffectPass(i,...t);s.name=t.map(a=>a.name).join(", "),s.mainScene=n,s.enabled=!0,s.renderToScreen=!1,e.addPass(s),t.length=0}}_onCreateEffectsDebug(t,e){if(ps==="passes"){const i=new exports.MODULES.POSTPROCESSING.MODULE.DepthEffect({blendFunction:exports.MODULES.POSTPROCESSING.MODULE.BlendFunction.NORMAL,inverted:!0});i.name="Depth Effect";const n=new exports.MODULES.POSTPROCESSING.MODULE.EffectPass(e,i);if(n.name="Depth Effect Pass",n.enabled=!1,t.passes.push(n),this._passIndices!==null){const a=[t.passes[0]];this._passIndices.length>0&&a.push(...this._passIndices.filter(l=>l!==0).map(l=>t.passes[l]).filter(l=>l)),a.length>0&&console.log("[PostProcessing] Passes (selected) →",a),t.passes.length=0;for(const l of a)l.enabled=!0,l.renderToScreen=!1,t.addPass(l)}const s=this.context.menu;if(s&&this._passIndices===null){this._menuEntry&&this._menuEntry.remove();const a=document.createElement("select");a.multiple=!0;const l=document.createElement("option");l.innerText="Final Output",l.value="-1",a.appendChild(l);for(const c of t.passes){const h=document.createElement("option");h.innerText=c.name,h.value=`${t.passes.indexOf(c)}`,h.title=c.name,a.appendChild(h)}s.appendChild(a),this._menuEntry=a,a.addEventListener("change",()=>{const c=Array.from(a.selectedOptions).map(h=>parseInt(h.value));c.length===1&&c[0]===-1?this._passIndices=null:this._passIndices=c,this.applyEffects(this.context)})}}}}var CR=Object.defineProperty,yx=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&CR(t,e,n),n};const Yo=S("debugpost");class vl extends I{constructor(){super(...arguments);r(this,"sharedProfile");r(this,"multisampling","auto");r(this,"_postprocessing");r(this,"_activeEffects",[]);r(this,"_effects",[]);r(this,"_componentEnabledTime",-1);r(this,"_multisampleAutoChangeTime",0);r(this,"_multisampleAutoDecreaseTime",0);r(this,"_lastApplyTime");r(this,"_rapidApplyCount",0);r(this,"_isDirty",!1);r(this,"_modificationQueue");r(this,"_recreateId",-1)}get isPostProcessingManager(){return!0}get effects(){return this._activeEffects}get dirty(){return this._isDirty}set dirty(e){this._isDirty=e}addEffect(e){let i=e;return i instanceof Ye||(i=new Gc(i),typeof e.order=="number"&&(i.order=e.order)),i.gameObject===void 0&&this.gameObject.addComponent(i),this._effects.includes(i)||(this._effects.push(i),this._isDirty=!0),e}removeEffect(e){var n,s,a,l;let i=-1;if(e instanceof Ye?i=this._effects.indexOf(e):i=this._effects.findIndex(c=>c instanceof Gc&&c.effect===e),i!==-1)return this._effects.splice(i,1),this._isDirty=!0,e;if(e instanceof Ye){const c=(s=(n=this.sharedProfile)==null?void 0:n.components)==null?void 0:s.indexOf(e);c!==void 0&&c!==-1&&(this._isDirty=!0,(l=(a=this.sharedProfile)==null?void 0:a.components)==null||l.splice(c,1))}return e}markDirty(){this._isDirty=!0}awake(){var e;Yo&&(console.log("PostprocessingManager Awake",this),console.log("Press P to toggle post processing"),window.addEventListener("keydown",i=>{i.key==="p"&&(this.enabled=!this.enabled,Ee("Toggle PostProcessing "+this.name+": Enabled="+this.enabled),this.markDirty())})),(e=this.sharedProfile)==null||e.__init(this)}onEnable(){this._componentEnabledTime=this.context.time.realtimeSinceStartup,this._isDirty=!0}onDisable(){var e;(e=this._postprocessing)==null||e.unapply(),this._isDirty=!1}onBeforeRender(){if(!this.context.isInXR&&(this.context.mainCamera&&this._isDirty&&this.apply(),this.context.composer&&this._postprocessing&&this._postprocessing.composer===this.context.composer)){if(this.context.renderer.getContext().isContextLost()&&this.context.renderer.forceContextRestore(),this.context.composer.getRenderer()!==this.context.renderer&&this.context.composer.setRenderer(this.context.renderer),this.context.composer.setMainScene(this.context.scene),this.multisampling==="auto")if(this._postprocessing&&this._postprocessing.hasSmaaEffect)this._postprocessing.multisampling!==0&&(this._postprocessing.multisampling=0,(Yo||j())&&console.log(`[PostProcessing] multisampling is disabled because it's set to 'auto' on your PostprocessingManager/Volume component that also has an SMAA effect.
1324
1324
 
1325
1325
  If you need multisampling consider changing 'auto' to a fixed value (e.g. 4).`));else{const e=this.context.time.realtimeSinceStartup-this._multisampleAutoChangeTime;if(this.context.time.realtimeSinceStartup-this._componentEnabledTime>2&&e>.5){const i=this._postprocessing.multisampling;if(this._postprocessing.multisampling>0&&this.context.time.smoothedFps<=50){this._multisampleAutoChangeTime=this.context.time.realtimeSinceStartup,this._multisampleAutoDecreaseTime=this.context.time.realtimeSinceStartup;let n=this._postprocessing.multisampling*.5;n=Math.floor(n),n!=this._postprocessing.multisampling&&(this._postprocessing.multisampling=n),Yo&&console.debug(`[PostProcessing] Reduced multisampling from ${i} to ${this._postprocessing.multisampling}`)}else if(e>1&&this.context.time.smoothedFps>=59&&this._postprocessing.multisampling<this.context.renderer.capabilities.maxSamples&&this.context.time.realtimeSinceStartup-this._multisampleAutoDecreaseTime>10){this._multisampleAutoChangeTime=this.context.time.realtimeSinceStartup;let n=this._postprocessing.multisampling<=0?1:this._postprocessing.multisampling*2;n=Math.floor(n),n!==this._postprocessing.multisampling&&(this._postprocessing.multisampling=n),Yo&&console.debug(`[PostProcessing] Increased multisampling from ${i} to ${this._postprocessing.multisampling}`)}}}else{const e=Math.max(0,Math.min(this.multisampling,this.context.renderer.capabilities.maxSamples));e!==this._postprocessing.multisampling&&(this._postprocessing.multisampling=e)}if(this.context.mainCamera){const e=this.context.composer.passes;for(const i of e)if(i.mainCamera&&i.mainCamera!==this.context.mainCamera){this.context.composer.setMainCamera(this.context.mainCamera);break}}}}onDestroy(){var e;(e=this._postprocessing)==null||e.dispose()}apply(){var e,i,n;if(Yo&&console.log(`Apply PostProcessing "${this.name||"unnamed"}"`),j()&&(this._lastApplyTime!==void 0&&Date.now()-this._lastApplyTime<100&&(this._rapidApplyCount++,this._rapidApplyCount===5&&console.warn("Detected rapid post processing modifications - this might be a bug",this)),this._lastApplyTime=Date.now()),this._isDirty=!1,this._activeEffects.length=0,(e=this.sharedProfile)!=null&&e.components){const s=this.sharedProfile.components;for(const a of s)a.active&&a.enabled&&!this._activeEffects.includes(a)&&this._activeEffects.push(a)}for(const s of this._effects)s.active&&s.enabled&&!this._activeEffects.includes(s)&&this._activeEffects.push(s);this._activeEffects.length>0?(this._postprocessing||(this._postprocessing=new jy(this.context)),(i=this._postprocessing.apply(this._activeEffects))==null||i.then(()=>{this.activeAndEnabled&&(this._applyPostQueue(),this._postprocessing?(this.multisampling==="auto"?this._postprocessing.multisampling=exports.DeviceUtilities.isMobileDevice()?2:4:this._postprocessing.multisampling=Math.max(0,Math.min(this.multisampling,this.context.renderer.capabilities.maxSamples)),Yo&&console.debug(`[PostProcessing] Set multisampling to ${this._postprocessing.multisampling} (Is Mobile: ${exports.DeviceUtilities.isMobileDevice()})`)):Yo&&console.warn("[PostProcessing] No composer found"))})):(n=this._postprocessing)==null||n.unapply(!1)}_applyPostQueue(){if(this._modificationQueue){for(const e of this._modificationQueue.values())this.onEditorModification(e);this._modificationQueue.clear()}}onEditorModification(e){var i,n;if(e.propertyName.startsWith("postprocessing.")){if(!this._postprocessing)return this._modificationQueue||(this._modificationQueue=new Map),this._modificationQueue.set(e.propertyName,e),!0;if(!((i=this._activeEffects)!=null&&i.length))return;const s=e.propertyName.split(".");if(s.length===3||s.length===4){const a=s[1],l=s[2];for(const c of this._activeEffects)if(((n=c.typeName)==null?void 0:n.toLowerCase())===a.toLowerCase()){if(l==="active"){c.active=e.value,this.scheduleRecreate();return}if(!Md.has(a)){const h=new Array;Md.set(a,h);const u=Object.keys(c);for(const f of u)c[f]instanceof U&&h.push(f)}if(Md.has(a)){const h=l.toLowerCase(),u=Md.get(a);for(const f of u)if(f.toLowerCase()===h){const p=c[f];p instanceof U&&(s.length===4&&s[3]==="active"?(p.overrideState=e.value,this.scheduleRecreate()):p&&p.value!==void 0&&(p.value=e.value));return}}console.warn("Unknown modification",l);return}}return!0}return!1}scheduleRecreate(){const e=++this._recreateId;setTimeout(()=>{e===this._recreateId&&(this.onDisable(),this.onEnable())},200)}}yx([Br(bf)],vl.prototype,"sharedProfile");yx([Br()],vl.prototype,"multisampling");const Md=new Map;Wk(vl);async function By(o){const{NeedleEngineWebComponent:t}=await Promise.resolve().then(()=>eT);t.observedAttributes.includes(o)||t.observedAttributes.push(o)}var PR=Object.defineProperty,pt=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&PR(t,e,n),n};const Mt=S("debugsceneswitcher"),MR=S("sceneswitcher:clearscene"),Wd="scene";By(Wd);const Js=Promise.resolve(!1);class Ge extends I{constructor(){super(...arguments);r(this,"autoLoadFirstScene",!0);r(this,"scenes",[]);r(this,"loadingScene");r(this,"queryParameterName","scene");r(this,"useSceneName",!0);r(this,"clamp",!0);r(this,"useHistory",!0);r(this,"useKeyboard",!0);r(this,"useSwipe",!0);r(this,"useSceneLighting",!0);r(this,"useSceneBackground",!0);r(this,"preloadNext",1);r(this,"preloadPrevious",1);r(this,"preloadConcurrent",2);r(this,"createMenuButtons",!1);r(this,"sceneLoadingStart",new ye);r(this,"sceneLoadingProgress",new ye);r(this,"sceneLoaded",new ye);r(this,"_currentIndex",-1);r(this,"_currentScene");r(this,"_engineElementOverserver");r(this,"_preloadScheduler");r(this,"_menuButtons");r(this,"onPopState",async e=>{if(!this.useHistory)return;const i=this.useHistory;try{this.useHistory=!1;let n=!1;if(this.queryParameterName&&(n=await this.tryLoadFromQueryParam()),!n){const s=e==null?void 0:e.state;if(s&&s.startsWith(this.guid)){const a=s.substr(this.guid.length+2);Mt&&console.log("PopState",a),await this.trySelectSceneFromValue(a)}}}finally{this.useHistory=i}});r(this,"normalizedSwipeThresholdX",.1);r(this,"_didSwipe",!1);r(this,"onInputPointerMove",e=>{if(this.useSwipe&&!this._didSwipe&&e.button===0&&e.pointerType==="touch"&&this.context.input.getPointerPressedCount()===1){const i=this.context.input.getPointerPositionDelta(e.button);if(i){const n=i.x/this.context.domWidth;n>=this.normalizedSwipeThresholdX?(this._didSwipe=!0,this.selectPrev()):n<=-this.normalizedSwipeThresholdX&&(this._didSwipe=!0,this.selectNext())}}});r(this,"onInputPointerUp",e=>{e.button===0&&(this._didSwipe=!1)});r(this,"onInputKeyDown",e=>{if(!this.useKeyboard||!this.scenes)return;const i=e.key.toLowerCase();if(!i)return;const n=parseInt(i)-1;if(n>=0){this.trySelectSceneFromValue(n);return}switch(i){case"arrowright":case"d":this.selectNext();break;case"arrowleft":case"a":this.selectPrev();break}});r(this,"__lastSwitchScene");r(this,"__lastSwitchScenePromise");r(this,"_currentlyLoadingScene");r(this,"_lastLoadingScene");r(this,"_loadingScenePromise");r(this,"_isCurrentlyLoading",!1);r(this,"_currentLoadingProgress")}get currentIndex(){return this._currentIndex}get currentLoadingProgress(){return this._currentLoadingProgress}get currentlyLoadingScene(){return this._currentlyLoadingScene}get currentlyLoadedScene(){return this._currentScene}awake(){this.scenes===void 0&&(this.scenes=[]);for(const e of this.scenes)e&&!e.hasUrl&&e.asset instanceof d.Object3D?C.remove(e.asset):e instanceof d.Object3D&&C.remove(e);Mt&&console.log("SceneSwitcher",this)}async onEnable(){if(globalThis.addEventListener("popstate",this.onPopState),this.context.input.addEventListener(Re.KeyDown,this.onInputKeyDown),this.context.input.addEventListener(Re.PointerMove,this.onInputPointerMove),this.context.input.addEventListener(Re.PointerUp,this.onInputPointerUp),this._engineElementOverserver||(this._engineElementOverserver=new MutationObserver(e=>{for(const i of e)if(i.type==="attributes"&&i.attributeName===Wd){const n=this.context.domElement.getAttribute(Wd);n!==null&&this.trySelectSceneFromValue(n)}})),this._engineElementOverserver.observe(this.context.domElement,{attributes:!0}),this._preloadScheduler||(this._preloadScheduler=new OR(this)),this._preloadScheduler.maxLoadAhead=this.preloadNext,this._preloadScheduler.maxLoadBehind=this.preloadPrevious,this._preloadScheduler.maxConcurrent=this.preloadConcurrent,this._preloadScheduler.begin(2e3),this.autoLoadFirstScene&&this._currentIndex===-1&&!await this.tryLoadFromQueryParam()){const e=this.context.domElement.getAttribute(Wd);try{(e===null||!await this.trySelectSceneFromValue(e))&&this._currentIndex===-1&&this.select(0)}finally{}}this.createMenuButtons&&(this._menuButtons??(this._menuButtons=[]),this._menuButtons.push(this.context.menu.appendChild({label:"Previous",icon:"arrow_back_ios",onClick:()=>this.selectPrev(),priority:-1005,class:"row2"})),this._menuButtons.push(this.context.menu.appendChild({label:"Next",icon:"arrow_forward_ios",iconSide:"right",onClick:()=>this.selectNext(),priority:-1e3,class:"row2"})))}onDisable(){var e;if(globalThis.removeEventListener("popstate",this.onPopState),this.context.input.removeEventListener(Re.KeyDown,this.onInputKeyDown),this.context.input.removeEventListener(Re.PointerMove,this.onInputPointerMove),this.context.input.removeEventListener(Re.PointerUp,this.onInputPointerUp),(e=this._preloadScheduler)==null||e.stop(),this._menuButtons){for(const i of this._menuButtons)i.remove();this._menuButtons=void 0}}addScene(e){if(typeof e=="string"){let i=this.context.addressables.findAssetReference(e);return i||(i=new te(e),this.context.addressables.registerAssetReference(i)),this.scenes.push(i),i}return this.scenes.push(e),e}selectNext(){return this.select(this._currentIndex+1)}selectPrev(){return this.select(this._currentIndex-1)}select(e){var n,s,a;if(Mt&&console.log("select",e),typeof e=="object"&&console.warn('Switching to "'+e+'" might not work. Please either use an index or a AssetReference (not a scene reference)'),typeof e=="string"){const l=(n=this.scenes)==null?void 0:n.find(c=>c.url===e);if(!l){const c=te.getOrCreate(this.sourceId??"",e,this.context);return this.switchScene(c)}if(l)e=(s=this.scenes)==null?void 0:s.indexOf(l);else return Js}if(!((a=this.scenes)!=null&&a.length))return Js;if(e<0){if(this.clamp)return Js;e=this.scenes.length-1}else if(e>=this.scenes.length){if(this.clamp)return Js;e=0}const i=this.scenes[e];return this.switchScene(i)}unload(){return this.__lastSwitchScene=void 0,this.__lastSwitchScenePromise=void 0,this.__unloadCurrentScene()}async reload(){if(this.__lastSwitchScene){const e=this.__lastSwitchScene;return this.__lastSwitchScene=void 0,this.switchScene(e)}return!1}async switchScene(e){var n;if(!(e instanceof te)){const s=typeof e;if(s==="string")return this.select(e);if(s==="number")return this.select(e);if(e&&e instanceof d.Object3D){const a=(n=this.scenes)==null?void 0:n.indexOf(e);e=new te(e.name,void 0,e),a>=0&&(this.scenes[a]=e)}else return console.warn(`[SceneSwitcher] Can't switch to scene of type ${s}`),!1}return e.url===this.sourceId?(console.warn("[SceneSwitcher] Can't load own scene - prevent recursive loading",this.sourceId),!1):this.__lastSwitchScene===e&&this.__lastSwitchScenePromise?this.__lastSwitchScenePromise:(this.__lastSwitchScene=e,this.__lastSwitchScenePromise=this.__internalSwitchScene(e),await this.__lastSwitchScenePromise)}async __unloadCurrentScene(){const e=this._currentScene;if(this._currentScene=void 0,e){Mt&&console.log("UNLOAD",e.url,"HasURL?: "+e.hasUrl);const i=this.tryGetSceneEventListener(e.asset);if(i!=null&&i.sceneClosing){const n=i.sceneClosing();n instanceof Promise&&await n}e.hasUrl?e.unload():e.asset instanceof d.Object3D&&C.remove(e.asset)}}async __internalSwitchScene(e){var n,s,a,l,c;await this.__unloadCurrentScene();const i=this._currentIndex=((n=this.scenes)==null?void 0:n.indexOf(e))??-1;try{this._currentlyLoadingScene=e,this._currentLoadingProgress=new ProgressEvent("progress",{loaded:0,total:1});const h=new CustomEvent("loadscene-start",{detail:{scene:e,switcher:this,index:i}});this.dispatchEvent(h),(s=this.sceneLoadingStart)==null||s.invoke(h.detail),await this.onStartLoading(),await e.loadAssetAsync((f,p)=>{var g;if(Mt){const y=p.loaded/p.total,b="["+"=".repeat(Math.floor(y*20))+"-".repeat(20-Math.floor(y*20))+"]";console.debug(`[SceneSwitcher] Download ${(y*100).toFixed(1)} % ${b}`,e.url)}this._currentLoadingProgress=p,this.dispatchEvent(p),(g=this.sceneLoadingProgress)==null||g.invoke(p)}).catch(console.error),await this.onEndLoading();const u=new CustomEvent("loadscene-finished",{detail:{scene:e,switcher:this,index:i}});if(this.dispatchEvent(u),this._currentLoadingProgress=void 0,this._currentlyLoadingScene=void 0,u.defaultPrevented)return Mt&&console.warn("Adding loaded scene prevented:",e,u),!1;if(!e.asset)return Mt&&console.warn("Failed loading scene:",e),!1;if(this._currentIndex===i){if(Mt&&console.log("ADD",e.url),this._currentScene=e,MR){const g=((a=this.context.mainCameraComponent)==null?void 0:a.gameObject)||this.context.mainCamera;g==null||g.removeFromParent();const y=this.gameObject.removeFromParent();Ri(this.context.scene,!0,!0),this.context.scene=new d.Scene,this.context.scene.add(y),g&&this.context.scene.add(g)}if(C.add(e.asset,this.gameObject),this.useSceneLighting&&this.context.sceneLighting.enable(e),this.useSceneBackground){const g=this.context.lightmaps.tryGetSkybox(e.url);g?(g.mapping=d.EquirectangularReflectionMapping,this.context.scene.background=g):Mt&&console.warn("SceneSwitcher: Can't find skybox for scene "+e.url)}if(this.useHistory&&i>=0){let g=i.toString();if(this.useSceneName&&(e instanceof d.Object3D?g=e.name:e.url&&(g=Nb(e.url))),(l=this.queryParameterName)!=null&&l.length)Oc(this.queryParameterName,g,this.useHistory);else{const y=history.state,b=this.guid+"::"+i;y!==b&&history.pushState(b,"unused",location.href)}}const f=this.tryGetSceneEventListener(e.asset);if(f!=null&&f.sceneOpened){const g=f.sceneOpened(this);g instanceof Promise&&await g}const p=new CustomEvent("scene-opened",{detail:{scene:e,switcher:this,index:i}});return this.dispatchEvent(p),(c=this.sceneLoaded)==null||c.invoke(this),!0}}catch(h){console.error(h)}return!1}preload(e){if(e>=0&&e<this.scenes.length){const i=this.scenes[e];if(i instanceof te)return i.preload()}return Js}tryLoadFromQueryParam(){var i;if(!((i=this.queryParameterName)!=null&&i.length))return Js;const e=S(this.queryParameterName);return typeof e=="boolean"?Js:this.trySelectSceneFromValue(e)}trySelectSceneFromValue(e){if(typeof e=="string"){const i=parseInt(e);if(i>=0&&i<this.scenes.length)return this.select(i);{const n=e.toLowerCase();for(let s=0;s<this.scenes.length;s++){const a=this.scenes[s];if(!a)continue;if((a instanceof d.Object3D?a.name:Nb(a.url)).toLowerCase().includes(n))return this.select(s)}}}else if(typeof e=="number"&&e>=0&&e<this.scenes.length)return this.select(e);return Kt()&&console.warn('Can not find scene: "'+e+'"',this),Js}async onStartLoading(){var e,i;if(this._isCurrentlyLoading=!0,this.loadingScene&&(this._lastLoadingScene!==this.loadingScene&&(this._loadingScenePromise=void 0),this._lastLoadingScene=this.loadingScene,this._loadingScenePromise||(this._loadingScenePromise=(e=this.loadingScene)==null?void 0:e.loadAssetAsync().then(n=>n!=null)),await this._loadingScenePromise,this._isCurrentlyLoading&&((i=this.loadingScene)!=null&&i.asset))){Mt&&console.log("Add loading scene",this.loadingScene.url,this.loadingScene.asset);const n=this.loadingScene.asset;C.add(n,this.gameObject);const s=this.tryGetSceneEventListener(n);if(s!=null&&s.sceneOpened){const a=s.sceneOpened(this);a instanceof Promise&&await a}}if(this._isCurrentlyLoading){const n=this.tryGetSceneEventListener(this.gameObject);if(n&&n.sceneOpened){const s=n.sceneOpened(this);s instanceof Promise&&await s}}}async onEndLoading(){var e;if(this._isCurrentlyLoading=!1,(e=this.loadingScene)!=null&&e.asset){Mt&&console.log("Remove loading scene",this.loadingScene.url);const i=this.loadingScene.asset,n=this.tryGetSceneEventListener(i);if(typeof(n==null?void 0:n.sceneClosing)=="function"){const s=n.sceneClosing();s instanceof Promise&&await s}C.remove(i)}if(!this._isCurrentlyLoading){const i=this.tryGetSceneEventListener(this.gameObject);if(i&&i.sceneClosing){const n=i.sceneClosing();n instanceof Promise&&await n}}}tryGetSceneEventListener(e,i=0){if(!e)return null;const n=C.foreachComponent(e,s=>{const a=s;if(a.sceneClosing||a.sceneOpened)return a});if(i===0&&!n&&e.children.length)for(const s of e.children){const a=this.tryGetSceneEventListener(s,i+1);if(a)return a}return n||null}}pt([m()],Ge.prototype,"autoLoadFirstScene");pt([m(te)],Ge.prototype,"scenes");pt([m(te)],Ge.prototype,"loadingScene");pt([m()],Ge.prototype,"queryParameterName");pt([m()],Ge.prototype,"useSceneName");pt([m()],Ge.prototype,"clamp");pt([m()],Ge.prototype,"useHistory");pt([m()],Ge.prototype,"useKeyboard");pt([m()],Ge.prototype,"useSwipe");pt([m()],Ge.prototype,"useSceneLighting");pt([m()],Ge.prototype,"useSceneBackground");pt([m()],Ge.prototype,"preloadNext");pt([m()],Ge.prototype,"preloadPrevious");pt([m()],Ge.prototype,"preloadConcurrent");pt([m()],Ge.prototype,"createMenuButtons");pt([m(ye)],Ge.prototype,"sceneLoadingStart");pt([m(ye)],Ge.prototype,"sceneLoadingProgress");pt([m(ye)],Ge.prototype,"sceneLoaded");function Nb(o){const t=o.split("/").pop(),e=t==null?void 0:t.split(".").shift();return e!=null&&e.length?e:o}class OR{constructor(t,e=1,i=1,n=2){r(this,"maxLoadAhead");r(this,"maxLoadBehind");r(this,"maxConcurrent");r(this,"_isRunning",!1);r(this,"_switcher");r(this,"_loadTasks",[]);r(this,"_maxConcurrentLoads",1);this._switcher=t,this.maxLoadAhead=e,this.maxLoadBehind=i,this.maxConcurrent=n}begin(t){if(this._isRunning)return;Mt&&console.log("Preload begin",{delay:t}),this._isRunning=!0;let e=-10,i,n;const s=this._switcher.scenes,a=Date.now()+t,l=setInterval(()=>{if(this.allLoaded()&&(Mt&&console.log("All scenes (pre-)loaded"),this.stop()),!this._isRunning){clearInterval(l);return}if(Date.now()<a||this.canLoadNewScene()===!1)return;(e===-10||e!==this._switcher.currentIndex)&&(e=this._switcher.currentIndex,n=0,i=0);const c=n%2===0;c&&(i+=1),n+=1;const h=c?this.maxLoadAhead:this.maxLoadBehind;if(i>h)return;const u=c?e+i:e-i;if(!(u<0)&&!(u<0||u>=s.length)&&!this._loadTasks.some(f=>f.index===u)){const f=s[u];Mt&&console.log("Preload scene",{roomIndex:u,searchForward:c,lastRoom:e,currentIndex:this._switcher.currentIndex,tasks:this._loadTasks.length},f==null?void 0:f.url),new kR(u,f,this._loadTasks)}},200)}stop(){this._isRunning=!1}canLoadNewScene(){return this._loadTasks.length<this._maxConcurrentLoads}allLoaded(){if(this._switcher.scenes){for(const t of this._switcher.scenes)if(t!=null&&t.isLoaded&&t.isLoaded()===!1)return!1}return!0}}class kR{constructor(t,e,i){r(this,"index");r(this,"asset");r(this,"tasks");this.index=t,this.asset=e,this.tasks=i,i.push(this),this.awaitLoading()}async awaitLoading(){this.asset&&!this.asset.isLoaded()&&(Mt&&console.log("Preload start: "+this.asset.url,this.index),await this.asset.preload(),Mt&&console.log("Preload finished: "+this.asset.url,this.index));const t=this.tasks.indexOf(this);t>=0&&this.tasks.splice(t,1)}}function RR(){return new Promise((o,t)=>{const i=()=>{i!=null&&(document.removeEventListener("pointerdown",i),document.removeEventListener("click",i),document.removeEventListener("dragstart",i),document.removeEventListener("touchstart",i),o())};document.addEventListener("pointerdown",i),document.addEventListener("click",i),document.addEventListener("dragstart",i),document.addEventListener("touchstart",i)})}async function ER(o){await RR(),o()}var TR=Object.defineProperty,AR=Object.getOwnPropertyDescriptor,Ii=(o,t,e,i)=>{for(var n=i>1?void 0:i?AR(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&TR(t,e,n),n};const ct=S("debugvideo");var _x=(o=>(o[o.None=0]="None",o[o.AdjustHeight=1]="AdjustHeight",o[o.AdjustWidth=2]="AdjustWidth",o))(_x||{}),bx=(o=>(o[o.VideoClip=0]="VideoClip",o[o.Url=1]="Url",o))(bx||{}),vx=(o=>(o[o.CameraFarPlane=0]="CameraFarPlane",o[o.CameraNearPlane=1]="CameraNearPlane",o[o.RenderTexture=2]="RenderTexture",o[o.MaterialOverride=3]="MaterialOverride",o))(vx||{});class rt extends I{constructor(){super();r(this,"playOnAwake",!0);r(this,"aspectMode",0);r(this,"clip",null);r(this,"source",1);r(this,"_url",null);r(this,"renderMode");r(this,"targetMaterialProperty");r(this,"targetMaterialRenderer");r(this,"targetTexture");r(this,"time",0);r(this,"_playbackSpeed",1);r(this,"_isLooping",!1);r(this,"_muted",!1);r(this,"_audioOutputMode",2);r(this,"playInBackground",!0);r(this,"_crossOrigin","anonymous");r(this,"_videoElement",null);r(this,"_videoTexture",null);r(this,"_videoMaterial",null);r(this,"_isPlaying",!1);r(this,"wasPlaying",!1);r(this,"visibilityChanged",e=>{switch(document.visibilityState){case"hidden":this.playInBackground||(this.wasPlaying=this._isPlaying,this.pause());break;case"visible":this.wasPlaying&&!this._isPlaying&&this.play();break}});r(this,"_receivedInput",!1);r(this,"_overlay",null);r(this,"_targetObjects");r(this,"_updateAspectRoutineId",-1);r(this,"_hls");r(this,"onHlsAvailable",()=>{var e;ct&&console.log("HLS: available",this.clip),!(!this.shouldUseM3U||!this.url)&&(this._hls||(this._hls=new Hls),this.videoElement.autoplay=!0,this._hls.loadSource(this.url),this._hls.attachMedia(this.videoElement),(e=this._videoElement)==null||e.play(),ct&&console.log("HLS: loaded",this.clip))});ER(()=>{this._receivedInput=!0,this.updateVideoElementSettings()}),this._targetObjects=[],S("videoscreenspace")&&window.addEventListener("keydown",e=>{e.key==="f"&&(this.screenspace=!this.screenspace)})}get url(){return this._url}set url(e){const n=this._url!==e;this.__didAwake?n&&this.setClipURL(e??""):this._url=e}get playbackSpeed(){var e;return((e=this._videoElement)==null?void 0:e.playbackRate)??this._playbackSpeed}set playbackSpeed(e){this._playbackSpeed=e,this._videoElement&&(this._videoElement.playbackRate=e)}get isLooping(){var e;return((e=this._videoElement)==null?void 0:e.loop)??this._isLooping}set isLooping(e){this._isLooping=e,this._videoElement&&(this._videoElement.loop=e)}get currentTime(){var e;return((e=this._videoElement)==null?void 0:e.currentTime)??this.time}set currentTime(e){this._videoElement?this._videoElement.currentTime=e:this.time=e}get isPlaying(){const e=this._videoElement;if(e){if(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>e.HAVE_CURRENT_DATA)return!0;if(e.srcObject&&e.srcObject.active)return!0}return!1}get crossOrigin(){var e;return((e=this._videoElement)==null?void 0:e.crossOrigin)??this._crossOrigin}set crossOrigin(e){this._crossOrigin=e,this._videoElement&&(e!==null?this._videoElement.setAttribute("crossorigin",e):this._videoElement.removeAttribute("crossorigin"))}get videoMaterial(){return!this._videoMaterial&&!this.create(!1)?null:this._videoMaterial}get videoTexture(){return!this._videoTexture&&!this.create(!1)?null:this._videoTexture}get videoElement(){return!this._videoElement&&!this.create(!1)?null:this._videoElement}requestPictureInPicture(){return this._videoElement?this._videoElement.requestPictureInPicture():null}get muted(){var e;return((e=this._videoElement)==null?void 0:e.muted)??this._muted}set muted(e){this._muted=e,this._videoElement&&(this._videoElement.muted=e)}get currentVideo(){return this.clip}set audioOutputMode(e){e!==this._audioOutputMode&&(e===1&&j()&&console.warn("VideoAudioOutputMode.AudioSource is not yet implemented"),this._audioOutputMode=e,this.updateVideoElementSettings())}get audioOutputMode(){return this._audioOutputMode}preloadVideo(){ct&&console.log("Video Preload: "+this.name,this.clip),this.create(!1)}preload(){this.preloadVideo()}setVideo(e){this.clip=e,this.source=0,this._videoElement?(this._videoElement.srcObject=e,this._isPlaying&&this.play(),this.updateAspect()):this.create(this.playOnAwake)}setClipURL(e){this._url!==e&&(this._url=e,this.source=1,ct&&console.log("set url",e),this._videoElement?e.endsWith(".m3u8")||e.includes(".m3u")?this.ensureM3UCanBePlayed():(this._videoElement.src=e,this._isPlaying&&(this.stop(),this.play())):this.create(this.playOnAwake))}onEnable(){var e,i;ct&&console.log("VideoPlayer.onEnable",bx[this.source],this.clip,this.url,this),window.addEventListener("visibilitychange",this.visibilityChanged),this.playOnAwake===!0?this.create(!0):this.preloadVideo(),this.screenspace?(e=this._overlay)==null||e.start():(i=this._overlay)==null||i.stop()}onDisable(){var e;window.removeEventListener("visibilitychange",this.visibilityChanged),(e=this._overlay)==null||e.stop(),this.pause()}onDestroy(){var e;this._videoElement&&((e=this.videoElement)==null||e.remove(),this._videoElement=null),this._videoTexture&&(this._videoTexture.dispose(),this._videoTexture=null)}play(){var e,i;if(this._videoElement||this.create(!1),!this._videoElement){ct&&console.warn("Can not play: no video element found",this);return}if(!(this._isPlaying&&!((e=this._videoElement)!=null&&e.ended)&&!((i=this._videoElement)!=null&&i.paused))){if(this._isPlaying=!0,this._receivedInput||(this._videoElement.muted=!0),this.handleBeginPlaying(!1),this.shouldUseM3U){this.ensureM3UCanBePlayed();return}ct&&console.log("Video Play()",this.clip,this._videoElement,this.time),this._videoElement.currentTime=this.time,this._videoElement.play().catch(n=>{var s;console.log(n),ct&&console.error("Error playing video",n,"CODE="+n.code,(s=this.videoElement)==null?void 0:s.src,this),setTimeout(()=>{this._isPlaying&&!this.destroyed&&this.activeAndEnabled&&this.play()},1e3)}),ct&&console.log("play",this._videoElement,this.time)}}stop(){this._isPlaying=!1,this.time=0,this._videoElement&&(this._videoElement.currentTime=0,this._videoElement.pause(),ct&&console.log("STOP",this))}pause(){var e,i;this.time=((e=this._videoElement)==null?void 0:e.currentTime)??0,this._isPlaying=!1,(i=this._videoElement)==null||i.pause(),ct&&console.log("PAUSE",this,this.currentTime)}create(e){let i;switch(this.source){case 0:i=this.clip;break;case 1:i=this.url,!(i!=null&&i.length)&&typeof this.clip=="string"&&(i=this.clip);break}return i?(this._videoElement||(ct&&console.warn("Create VideoElement",this),this._videoElement=this.createVideoElement(),this.context.domElement.shadowRoot.prepend(this._videoElement),this.updateVideoElementStyles()),typeof i=="string"?(ct&&console.log("Set Video src",i),this._videoElement.src=i):(ct&&console.log("Set Video srcObject",i),this._videoElement.srcObject=i),this._videoTexture||(this._videoTexture=new d.VideoTexture(this._videoElement)),this._videoTexture.flipY=!1,this._videoTexture.colorSpace=d.SRGBColorSpace,e&&this.handleBeginPlaying(e),ct&&console.log("Video: handle playing done...",i,e),!0):(ct&&console.warn("No video source set",this),!1)}updateAspect(){this.aspectMode!==0&&this.startCoroutine(this.updateAspectImpl())}get screenspace(){var e;return((e=this._overlay)==null?void 0:e.enabled)??!1}set screenspace(e){var i;if(e){if(!this._videoTexture)return;this._overlay||(this._overlay=new LR(this.context)),this._overlay.add(this._videoTexture)}else(i=this._overlay)==null||i.remove(this._videoTexture);this._overlay&&(this._overlay.enabled=e)}createVideoElement(){const e=document.createElement("video");return this._crossOrigin&&e.setAttribute("crossorigin",this._crossOrigin),ct&&console.log("created video element",e),e}handleBeginPlaying(e){var s,a;if(!this.activeAndEnabled||!this._videoElement)return;this._targetObjects.length=0;let i=this.gameObject;switch(this.renderMode){case 3:i=(s=this.targetMaterialRenderer)==null?void 0:s.gameObject,i||(i=(a=C.getComponent(this.gameObject,Ti))==null?void 0:a.gameObject);break;case 2:console.error("VideoPlayer renderTexture not implemented yet. Please use material override instead");return}if(!i){console.error("Missing target for video material renderer",this.name,vx[this.renderMode],this);return}const n=i.material;if(n){this._targetObjects.push(i),n!==this._videoMaterial&&(this._videoMaterial=n.clone(),i.material=this._videoMaterial);const l="map",c=this._videoMaterial;if(!this.targetMaterialProperty)c[l]=this._videoTexture;else switch(this.targetMaterialProperty){default:c[l]=this._videoTexture;break}}else{console.warn("Can not play video, no material found, this might be a multimaterial case which is not supported yet");return}this.updateVideoElementSettings(),this.updateVideoElementStyles(),e&&(this.shouldUseM3U&&this.ensureM3UCanBePlayed(),this.play())}updateVideoElementSettings(){if(!this._videoElement)return;this._videoElement.loop=this._isLooping,this._videoElement.currentTime=this.currentTime,this._videoElement.playbackRate=this._playbackSpeed,this._videoElement.playsInline=!0;let e=!this._receivedInput||this.audioOutputMode===0;!e&&this._muted&&(e=!0),this._videoElement.muted=e,this.playOnAwake&&(this._videoElement.autoplay=!0)}updateVideoElementStyles(){this._videoElement&&(this._videoElement.style.userSelect="none",this._videoElement.style.visibility="hidden",this._videoElement.style.display="none",this.updateAspect())}*updateAspectImpl(){const e=++this._updateAspectRoutineId,i=void 0,n=this.clip;for(;e===this._updateAspectRoutineId&&this.aspectMode!==0&&this.clip&&n===this.clip&&this._isPlaying;){if(!n||typeof n=="string")return;let s;for(const a of n.getVideoTracks()){const l=a.getSettings();if(l&&l.width&&l.height){s=l.width/l.height;break}else s=this.context.renderer.domElement.clientWidth/this.context.renderer.domElement.clientHeight}if(s===void 0){for(let a=0;a<10;a++)yield;if(!this.isPlaying)break;continue}if(i===s){yield;continue}for(const a of this._targetObjects){let l=1;if(a.parent){const c=Ue(a.parent);l=c.x/c.y}switch(this.aspectMode){case 1:a.scale.y=1/s*a.scale.x*l;break;case 2:a.scale.x=s*a.scale.y*l;break}}for(let a=0;a<3;a++)yield}}get shouldUseM3U(){return this.url!=null&&(this.url.endsWith(".m3u8")||this.url.endsWith(".m3u"))&&this.source===1}ensureM3UCanBePlayed(){if(!this.shouldUseM3U)return;let e=document.head.querySelector("script[data-hls_library]");e?globalThis.Hls?this.onHlsAvailable():e.addEventListener("load",this.onHlsAvailable):(ct&&console.log("HLS: load script"),e=document.createElement("script"),e.dataset.hls_library="hls.js",e.src="https://cdn.jsdelivr.net/npm/hls.js@1",e.addEventListener("load",this.onHlsAvailable),document.head.append(e))}}Ii([m()],rt.prototype,"playOnAwake",2);Ii([m()],rt.prototype,"aspectMode",2);Ii([m(URL)],rt.prototype,"clip",2);Ii([m()],rt.prototype,"source",2);Ii([m(URL)],rt.prototype,"url",1);Ii([m()],rt.prototype,"renderMode",2);Ii([m()],rt.prototype,"targetMaterialProperty",2);Ii([m(Ti)],rt.prototype,"targetMaterialRenderer",2);Ii([m(d.Texture)],rt.prototype,"targetTexture",2);Ii([m()],rt.prototype,"time",2);Ii([m()],rt.prototype,"playbackSpeed",1);Ii([m()],rt.prototype,"isLooping",1);Ii([m()],rt.prototype,"audioOutputMode",1);class LR{constructor(t){r(this,"context");r(this,"_videos",[]);r(this,"_screenspaceModeQuad");r(this,"_isInScreenspaceMode",!1);r(this,"_input");this.context=t,this._input=new DR(this)}get enabled(){return this._isInScreenspaceMode}set enabled(t){t?this.start():this.stop()}add(t){this._videos.indexOf(t)===-1&&this._videos.push(t)}remove(t){if(!t)return;const e=this._videos.indexOf(t);e>=0&&this._videos.splice(e,1)}start(){var n;if(this._isInScreenspaceMode||this._videos.length<0)return;const t=this._videos[this._videos.length-1];if(!t)return;if(this._isInScreenspaceMode=!0,!this._screenspaceModeQuad){if(this._screenspaceModeQuad=Lo.createPrimitive(Or.Quad,{material:new IR(t)}),!this._screenspaceModeQuad)return;this._screenspaceModeQuad.geometry.scale(2,2,2)}const e=this._screenspaceModeQuad;this.context.scene.add(e),this.updateScreenspaceMaterialUniforms();const i=e.material;i==null||i.reset(),(n=this._input)==null||n.enable(i)}stop(){var t;this._isInScreenspaceMode=!1,this._screenspaceModeQuad&&((t=this._input)==null||t.disable(),this._screenspaceModeQuad.removeFromParent())}updateScreenspaceMaterialUniforms(){var e;const t=(e=this._screenspaceModeQuad)==null?void 0:e.material;t&&(t.screenAspect=this.context.domElement.clientWidth/this.context.domElement.clientHeight)}}class DR{constructor(t){r(this,"_onResizeScreenFn");r(this,"_onKeyUpFn");r(this,"_onMouseWheelFn");r(this,"context");r(this,"overlay");r(this,"_material");r(this,"_isPinching",!1);r(this,"_lastPinch",0);this.overlay=t,this.context=t.context}enable(t){this._material=t,window.addEventListener("resize",this._onResizeScreenFn=()=>{this.overlay.updateScreenspaceMaterialUniforms()}),window.addEventListener("keyup",this._onKeyUpFn=n=>{n.key==="Escape"&&this.overlay.stop()}),window.addEventListener("wheel",this._onMouseWheelFn=n=>{this.overlay.enabled&&(t.zoom+=n.deltaY*5e-4,n.preventDefault())},{passive:!1});const e=new d.Vector2;window.addEventListener("mousemove",n=>{if(this.overlay.enabled&&this.context.input.getPointerPressed(0)){const s=new d.Vector2(n.movementX,n.movementY);s.x/=this.context.domElement.clientWidth,s.y/=this.context.domElement.clientHeight,e.set(s.x,s.y),e.multiplyScalar(t.zoom/-this.context.time.deltaTime*.01),t.offset=t.offset.add(e)}}),window.addEventListener("pointermove",n=>{this.overlay.enabled&&this.context.input.getPointerPressed(0)&&this.context.input.getTouchesPressedCount()===1&&(e.set(n.movementX,n.movementY),e.multiplyScalar(t.zoom*-this.context.time.deltaTime*.05),t.offset=t.offset.add(e))});let i=0;window.addEventListener("touchstart",n=>{if(n.touches.length<2){this.context.time.time-i<.3&&this.overlay.stop(),i=this.context.time.time;return}this._isPinching=!0,this._lastPinch=0}),window.addEventListener("touchmove",n=>{if(!this._isPinching||!this._material)return;const s=n.touches[0],a=n.touches[1],l=s.clientX-a.clientX,c=s.clientY-a.clientY,h=Math.sqrt(l*l+c*c);if(this._lastPinch!==0){const u=h-this._lastPinch;this._material.zoom-=u*.004}this._lastPinch=h}),window.addEventListener("touchend",()=>{this._isPinching=!1})}disable(){this._onResizeScreenFn&&(window.removeEventListener("resize",this._onResizeScreenFn),this._onResizeScreenFn=void 0),this._onKeyUpFn&&(window.removeEventListener("keyup",this._onKeyUpFn),this._onKeyUpFn=void 0),this._onMouseWheelFn&&(window.removeEventListener("wheel",this._onMouseWheelFn),this._onMouseWheelFn=void 0)}}class IR extends d.ShaderMaterial{constructor(e){super();r(this,"_offset",new d.Vector2);this.uniforms={map:{value:e},screenAspect:{value:1},offsetScale:{value:new d.Vector4(0,0,1,1)}},this.vertexShader=`
1326
1326
  uniform sampler2D map;
@@ -1604,4 +1604,4 @@ Error:`,l),null}}updateColliderCollisionGroups(t){const e=t[zt],i=t.membership;l
1604
1604
  justify-content: center;
1605
1605
  gap: .5rem;
1606
1606
  }
1607
- `),ce(this,mr).innerHTML=ce(this,Vt).innerHTML,ce(this,mr).style.cssText="display: flex; align-items: center; justify-content: center;",ce(this,Vt).innerHTML=ce(this,mr).outerHTML,ce(this,pr).innerHTML=ce(this,Vt).outerHTML,ce(this,pr).prepend(ce(this,gr)),ru(_m,{element:ce(this,pr)}),(n=ce(this,Ua))==null||n.disconnect(),ce(this,Ua)??rn(this,Ua,new MutationObserver(()=>Ol(this,nl,Nx).call(this))),ce(this,Ua).observe(ce(this,Vt),{attributes:!0}),Hp&&console.log("Needle Button updated")},Nx=function(){ce(this,Vt)&&(ce(this,Vt).style.display==="none"?this.style.display="none":this.style.display==="none"&&(this.style.display=""))},Kc=new WeakMap,r(Zy,"observedAttributes",["ar","vr","quicklook"]);typeof window<"u"&&!window.customElements.get(i0)&&window.customElements.define(i0,Zy);const Hl=S("debugavatar");class Jy{constructor(t,e,i,n){r(this,"root");r(this,"head");r(this,"leftHand");r(this,"rigthHand");var s;this.root=t,this.head=e,this.leftHand=i,this.rigthHand=n,(s=this.root)==null||s.traverse(a=>a.layers.set(2))}get isValid(){return this.head!==null&&this.head!==void 0}}class $x{constructor(){r(this,"avatarRegistryUrl",null)}async getOrCreateNewAvatarInstance(t,e){if(!e)return console.error("Can not create avatar: failed to provide id or root object"),null;let i=null;if(typeof e=="string"){if(i=await this.loadAvatar(t,e),!i){const s=new xn;i=C.instantiate(za(e,t.scene),s)}}else i=e;if(!i)return null;const n=this.findAvatar(i);return n.isValid?(Hl&&console.log("[Custom Avatar] valid config",e,Hl?n:""),n):(console.warn("[Custom Avatar] config isn't valid",e,Hl?n:""),null)}async loadAvatar(t,e){if(console.assert(e!=null&&typeof e=="string","Avatar id must not be null"),e.length<=0||!e)return null;if(Hl&&console.log("[Custom Avatar] "+e+", loading..."),e.endsWith(".glb")||(e+=".glb"),this.avatarRegistryUrl===null){const n=await fetch("./"+e);let s=null;if(n.ok){const l=await n.blob();l&&(s=await l.arrayBuffer())}if(!s)return null;const a=await bn().parseSync(t,s,null,0);return(a==null?void 0:a.scene)??null}const i=new H.GLTFLoader;return Og(i,t),new Promise((n,s)=>{const a=this.avatarRegistryUrl+"/"+e;i.load(a,async l=>{await bn().createBuiltinComponents(t,a,l,null,void 0),n(l.scene)},l=>{Hl&&console.log("[Custom Avatar] "+l.loaded/l.total*100+"% loaded of "+l.total/1024+"kB")},l=>{console.error("[Custom Avatar] Error when loading: "+l),n(null)})})}cacheModel(t,e){}findAvatar(t){const e=t;let i=e;i.children.length==1&&(i=t.children[0]);let n=this.findAvatarPart(i,["head"]);const s=this.findAvatarPart(i,["left","hand"]),a=this.findAvatarPart(i,["right","hand"]);if(!n){n=e;const c=new d.Vector3;new d.Box3().setFromObject(n).getSize(c);const h=Math.max(c.x,c.y,c.z);console.warn("[Custom Avatar] Normalizing head scale, it's too big: "+h+" meters! Should be < 0.3m"),h>.3&&n.scale.multiplyScalar(1/h*.3)}return new Jy(e,n,s,a)}findAvatarPart(t,e){const i=t.name.toLowerCase();let n=!0;for(const s of e){if(!n)break;i.indexOf(s)===-1&&(n=!1)}if(n)return t;if(t.children)for(const s of t.children){const a=this.findAvatarPart(s,e);if(a)return a}return null}handleCustomAvatarErrors(t){if(!t.ok)throw Error(t.statusText);return t}}class Vx{get extensionName(){return"DocumentExtension"}onAfterBuildDocument(t){}}class Wx{}const hT=Object.freeze(Object.defineProperty({__proto__:null,ActionBuilder:fe,ActionCollection:Zw,ActionModel:xi,AlignmentConstraint:fh,Animation:Tt,AnimationCurve:Ah,AnimationExtension:af,AnimationTrackHandler:Ef,Animator:xt,AnimatorController:Gi,Antialiasing:Dh,AudioExtension:Wr,AudioListener:Ms,AudioSource:qi,AudioTrackHandler:tl,Avatar:Oo,AvatarBlink_Simple:zr,AvatarEyeLook_Rotation:jg,AvatarLoader:$x,AvatarMarker:At,AvatarModel:Jy,Avatar_Brain_LookAt:Uc,Avatar_MouthShapes:yh,Avatar_MustacheShake:Dg,Avatar_POI:Ts,AxesHelper:rl,BaseUIComponent:Qi,BasicIKConstraint:Fg,BehaviorExtension:fy,BehaviorModel:vt,BloomEffect:wf,BoxCollider:tf,BoxGizmo:Xr,BoxHelperComponent:ts,Button:Ws,CallInfo:Cs,Camera:ai,CameraTargetReachedEvent:Fc,Canvas:Ja,CanvasGroup:ko,CapsuleCollider:As,ChangeMaterialOnClick:sy,ChangeTransformOnClick:Gr,CharacterController:Nr,CharacterControllerInput:js,ChromaticAberration:Ih,Collider:ui,ColorAdjustments:$o,ColorBySpeedModule:_l,ColorOverLifetimeModule:_f,ContactShadows:_h,ControlTrackHandler:Tf,CustomBranding:qr,Deletable:$g,DeleteBox:Xa,DepthOfField:Pn,DeviceFlag:nf,DocumentExtension:Vx,DragControls:lr,DropListener:Bs,Duplicatable:Gg,EffectWrapper:Gc,EmissionModule:$s,EmphasizeOnClick:hl,EnvironmentScene:jf,EventList:ye,EventListEvent:Yu,EventSystem:Yt,EventTrigger:of,FieldWithDefault:Bw,FixedJoint:Oy,Fog:ml,GltfExport:ey,GltfExportBox:Zg,Gradient:Yr,Graphic:Oh,GraphicRaycaster:Ku,GridHelper:gl,GridLayoutGroup:by,GroundProjectedEnv:ss,GroupActionModel:yo,HideOnStart:Ya,HingeJoint:Rh,HorizontalLayoutGroup:_y,Image:wl,InheritVelocityModule:Ty,InputField:Wy,InstanceHandle:Nc,InstancingHandler:Qa,Interactable:Ng,Keyframe:li,LODGroup:Th,LODModel:yl,Light:mi,LimitVelocityOverLifetimeModule:lt,LogStats:zg,LookAt:Gy,LookAtConstraint:Ur,MainModule:It,MaskableGraphic:kh,MeshCollider:Io,MeshRenderer:vh,MinMaxCurve:q,MinMaxGradient:Kr,NeedleMenu:rs,NestedGltf:mf,Networking:Ry,NoiseModule:be,ObjectRaycaster:Ei,OffsetConstraint:Qr,OpenURL:xl,OrbitControls:ge,Outline:pl,Padding:Hr,ParticleBurst:wu,ParticleSubEmitter:Ay,ParticleSystem:Wc,ParticleSystemRenderer:en,PhysicsExtension:py,PixelationEffect:jh,PlayAnimationOnClick:$c,PlayAudioOnClick:Mo,PlayableDirector:il,PlayerColor:el,PointerEventData:mh,PostProcessingHandler:jy,PreliminaryAction:dl,PreliminaryTrigger:Sh,RawImage:Df,Rect:nx,RectTransform:wn,ReflectionProbe:zc,RegisteredAnimationInfo:_o,RemoteSkybox:Sf,Renderer:Ti,RendererLightmap:_u,Rigidbody:ot,RotationBySpeedModule:Ji,RotationOverLifetimeModule:Cn,SceneSwitcher:Ge,ScreenCapture:Vo,ScreenSpaceAmbientOcclusion:Vs,ScreenSpaceAmbientOcclusionN8:Mn,SetActiveOnClick:oy,ShadowCatcher:zh,ShapeModule:Ey,SharpeningEffect:Fh,SignalAsset:Rf,SignalReceiver:Gh,SignalReceiverEvent:Wh,SignalTrackHandler:Hc,Size:ix,SizeBySpeedModule:gi,SizeOverLifetimeModule:Zr,SkinnedMeshRenderer:Kg,SmoothFollow:Pf,SpatialGrabRaycaster:Tr,SpatialHtml:Xh,SpatialTrigger:Mf,SpatialTriggerReceiver:Zn,SpectatorCamera:Of,SphereCollider:al,Sprite:Us,SpriteData:Fa,SpriteRenderer:fi,SpriteSheet:Za,SubEmitterSystem:xu,SyncedCamera:Fy,SyncedRoom:On,SyncedTransform:es,TapGestureTrigger:ay,TeleportTarget:uf,TestRunner:Uy,TestSimulateUserData:zy,Text:Dt,TextBuilder:gy,TextExtension:pf,TextureSheetAnimationModule:jt,TiltShiftEffect:cs,ToneMappingEffect:Ro,TrailModule:je,TransformData:We,TransformGizmo:ia,TriggerBuilder:wt,TriggerModel:Co,UIRaycastUtils:Eg,UIRootComponent:Ph,USDZExporter:Kn,USDZText:cr,USDZUIExtension:wy,UsageMarker:bh,VariantAction:ny,VelocityOverLifetimeModule:ze,VerticalLayoutGroup:yy,VideoPlayer:rt,Vignette:ta,VisibilityAction:Ch,Voip:Do,Volume:vl,VolumeParameter:U,VolumeProfile:bf,WebARCameraBackground:Yh,WebARSessionRoot:is,WebXR:ff,WebXRImageTracking:Xc,WebXRImageTrackingModel:Hs,WebXRPlaneTracking:qs,WebXRTrackedImage:qc,XRControllerFollow:Gs,XRControllerModel:ns,XRControllerMovement:Ai,XRFlag:$i,XRRig:Ff,XRState:Qt,__Ignore:Wx},Symbol.toStringTag,{value:"Module"})),Ou=S("debugmissingcamera");re.registerCallback(he.MissingCamera,o=>{var l,c,h;Ou&&console.warn("Creating missing camera");const t=o.context.scene,e=new d.PerspectiveCamera;e.name="Default Fallback Camera",t.add(e);const i=new ai;if(i.sourceId=((c=(l=o.files)==null?void 0:l[0])==null?void 0:c.src)??"unknown",i.fieldOfView=35,o.context.domElement.getAttribute("transparent")!=null)i.clearFlags=Cr.Uninitialized;else if((h=o.context.domElement.getAttribute("background-image"))!=null&&h.length||o.context.lightmaps.tryGetSkybox(i.sourceId))i.clearFlags=Cr.Skybox,o.context.domElement.getAttribute("background-blurriness")===null&&(o.context.scene.backgroundBlurriness=.2);else{if(i.clearFlags=Cr.SolidColor,!o.context.domElement.getAttribute("background-color")){let u="#efefef";typeof window!==void 0&&window.matchMedia("(prefers-color-scheme: dark)").matches&&(u="#1f1f1f"),t.background=new d.Color(u)}if(!t.environment){const u=new d.PMREMGenerator$1(o.context.renderer),f=new jf("neutral");t.environment=u.fromScene(f,.025).texture}}const s=vr(e,i,!0);e.position.x=0,e.position.y=1,e.position.z=2;const a=o.context.domElement;return(a==null?void 0:a.cameraControls)!=!1&&Gx(o.context,s),s});re.registerCallback(he.ContextCreated,o=>{if(!o.context.mainCamera){Ou&&console.log("Will not auto-fit because a default camera exists");return}const t=o.context.domElement;if((t==null?void 0:t.cameraControls)==!0){const e=v0(o.context.mainCamera);if((e==null?void 0:e.isCameraController)==!0){Ou&&console.log("Will not auto-fit because a camera controller exists");return}Gx(o.context)}});function Gx(o,t){t=t??o.mainCameraComponent;const e=t==null?void 0:t.gameObject;if(Ou&&console.log("Creating default camera controls",t==null?void 0:t.name),e){const i=ah(e,ge);i.sourceId=(t==null?void 0:t.sourceId)??"unknown";const n=o.domElement.getAttribute("auto-rotate");if(i.autoRotate=n!=null&&n!="0"&&(n==null?void 0:n.toLowerCase())!="false",i.autoRotateSpeed=.5,i.autoFit=!0,i.autoRotate&&n){const s=parseFloat(n);isNaN(s)||(i.autoRotateSpeed=s)}}else console.warn("Missing camera object, can not add orbit controls")}re.registerCallback(he.ContextCreated,o=>{const t=o.context.domElement.getAttribute("autoplay");if(t!==void 0&&(t===""||t==="true"||t==="1")&&o.files)for(const e of o.files)C.foreachComponent(e.file.scene,n=>{if(n.enabled!==!1){if(n instanceof Tt&&n.playAutomatically||n instanceof xt||n instanceof il&&n.playOnAwake===!0)return!0;if(n instanceof Tt)return n.playAutomatically=!0,!0;if(n instanceof il)return n.playOnAwake=!0,!0}},!0)!==!0&&Ha.assignAnimationsFromFile(e.file,{createAnimationComponent:(n,s)=>Oi(n,Tt)})});class dT extends ae.WorkerBase{constructor(){super(new Worker(new URL("/generateMeshBVH.worker-BaNp_Xtp.js",typeof document>"u"?require("url").pathToFileURL(__filename).href:Nf&&Nf.tagName.toUpperCase()==="SCRIPT"&&Nf.src||new URL("needle-engine.bundle-C6yScKUU.umd.cjs",document.baseURI).href),{type:"module"})),this.name="GenerateMeshBVHWorker"}runTask(t,e,i={}){return new Promise((n,s)=>{if(e.getAttribute("position").isInterleavedBufferAttribute||e.index&&e.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");t.onerror=h=>{s(new Error(`[GenerateMeshBVHWorker] ${h.message||"Unknown error. Please check the server console. If you're using vite try adding 'three-mesh-bvh' to 'optimizeDeps.exclude' in your vite.config.js"}`))},t.onmessage=h=>{const{data:u}=h;if(u.error)s(new Error(u.error)),t.onmessage=null;else if(u.serialized){const{serialized:f,position:p}=u,g=ae.MeshBVH.deserialize(f,e,{setIndex:!1}),y=Object.assign({setBoundingBox:!0},i);if(e.attributes.position.array=p,f.index)if(e.index)e.index.array=f.index;else{const b=new d.BufferAttribute(f.index,1,!1);e.setIndex(b)}y.setBoundingBox&&(e.boundingBox=g.getBoundingBox(new d.Box3)),i.onProgress&&i.onProgress(u.progress),n(g),t.onmessage=null}else i.onProgress&&i.onProgress(u.progress)};const a=e.index?e.index.array:null,l=e.attributes.position.array,c=[l];a&&c.push(a),t.postMessage({index:a,position:l,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...e.groups]}},c.map(h=>h.buffer).filter(h=>typeof SharedArrayBuffer>"u"||!(h instanceof SharedArrayBuffer)))})}}const uT=Object.freeze(Object.defineProperty({__proto__:null,GenerateMeshBVHWorker:dT},Symbol.toStringTag,{value:"Module"}));exports.$physicsKey=nM;exports.ActionBuilder=fe;exports.ActionCollection=Zw;exports.ActionModel=xi;exports.Addressables=Bv;exports.AlignmentConstraint=fh;exports.AmbientMode=Ia;exports.Animation=Tt;exports.AnimationCurve=Ah;exports.AnimationExtension=af;exports.AnimationTrackHandler=Ef;exports.AnimationUtils=Ha;exports.Animator=xt;exports.AnimatorConditionMode=oo;exports.AnimatorController=Gi;exports.AnimatorControllerParameterType=kg;exports.AnimatorStateInfo=Jl;exports.Antialiasing=Dh;exports.Application=vn;exports.AssetDatabase=ev;exports.AssetReference=te;exports.AudioExtension=Wr;exports.AudioListener=Ms;exports.AudioSource=qi;exports.AudioTrackHandler=tl;exports.Avatar=Oo;exports.AvatarBlink_Simple=zr;exports.AvatarEyeLook_Rotation=jg;exports.AvatarLoader=$x;exports.AvatarMarker=At;exports.AvatarModel=Jy;exports.Avatar_Brain_LookAt=Uc;exports.Avatar_MouthShapes=yh;exports.Avatar_MustacheShake=Dg;exports.Avatar_POI=Ts;exports.Axes=xa;exports.AxesHelper=rl;exports.BUILD_TIME=tg;exports.BaseUIComponent=Qi;exports.BasicIKConstraint=Fg;exports.BehaviorExtension=fy;exports.BehaviorModel=vt;exports.BloomEffect=wf;exports.BoxCollider=tf;exports.BoxGizmo=Xr;exports.BoxHelperComponent=ts;exports.Button=Ws;exports.ButtonsFactory=zn;exports.CallDirection=_w;exports.CallInfo=Cs;exports.Camera=ai;exports.CameraTargetReachedEvent=Fc;exports.Canvas=Ja;exports.CanvasGroup=ko;exports.CapsuleCollider=As;exports.ChangeMaterialOnClick=sy;exports.ChangeTransformOnClick=Gr;exports.CharacterController=Nr;exports.CharacterControllerInput=js;exports.ChromaticAberration=Ih;exports.CircularBuffer=ki;exports.ClearFlags=Cr;exports.ClipExtrapolation=An;exports.Collider=ui;exports.Collision=mw;exports.CollisionDetectionMode=Qu;exports.ColorAdjustments=$o;exports.ColorBySpeedModule=_l;exports.ColorOverLifetimeModule=_f;exports.Component=uP;exports.Component$1=I;exports.ComponentLifecycleEvents=sh;exports.Components=hT;exports.ConnectionEvents=X0;exports.ContactPoint=pw;exports.ContactShadows=_h;exports.Context=X;exports.ContextArgs=K1;exports.ContextEvent=he;exports.ContextRegistry=re;exports.ControlTrackHandler=Tf;exports.CustomBranding=qr;exports.CustomShader=mu;exports.DefaultReflectionMode=ou;exports.Deletable=$g;exports.DeleteBox=Xa;exports.DepthOfField=Pn;exports.DeviceFlag=nf;exports.DocumentExtension=Vx;exports.DragControls=lr;exports.DragMode=Vg;exports.DropListener=Bs;exports.Duplicatable=Gg;exports.EffectWrapper=Gc;exports.EmissionModule=$s;exports.EmphasizeOnClick=hl;exports.EngineLoadingView=Pu;exports.EnvironmentScene=jf;exports.EventList=ye;exports.EventListEvent=Yu;exports.EventSystem=Yt;exports.EventTrigger=of;exports.FieldWithDefault=Bw;exports.FileReference=Ic;exports.FileReferenceSerializer=Uv;exports.FileSpawnModel=MM;exports.File_Event=Sw;exports.FixedJoint=Oy;exports.Fog=ml;exports.FrameEvent=we;exports.GENERATOR=Fu;exports.GameObject=C;exports.Gizmos=$;exports.GltfExport=ey;exports.GltfExportBox=Zg;exports.Gradient=Yr;exports.Graphic=Oh;exports.GraphicRaycaster=Ku;exports.Graphics=Mr;exports.GridHelper=gl;exports.GridLayoutGroup=by;exports.GroundProjectedEnv=ss;exports.GroupActionModel=yo;exports.HideFlags=Zu;exports.HideOnStart=Ya;exports.HingeJoint=Rh;exports.HorizontalLayoutGroup=_y;exports.HostData=t1;exports.Image=wl;exports.ImageReference=Dc;exports.ImageReferenceSerializer=Fv;exports.InheritVelocityModule=Ty;exports.Input=$0;exports.InputEventQueue=ri;exports.InputEvents=Re;exports.InputField=Wy;exports.InstanceHandle=Nc;exports.InstancingHandler=Qa;exports.InstancingUtil=Wi;exports.InstantiateEvent=dv;exports.InstantiateIdProvider=bt;exports.InstantiateOptions=xn;exports.Interactable=Ng;exports.JoinedRoomResponse=MC;exports.KeyEventArgs=mC;exports.Keyframe=li;exports.LODGroup=Th;exports.LODModel=yl;exports.LeftRoomResponse=OC;exports.Light=mi;exports.LightData=Wv;exports.LimitVelocityOverLifetimeModule=lt;exports.LoadingElementOptions=QE;exports.LogStats=zg;exports.LogType=Mi;exports.LookAt=Gy;exports.LookAtConstraint=Ur;exports.MainModule=It;exports.MarkerType=Ny;exports.MaskableGraphic=kh;exports.Mathf=z;exports.MeshCollider=Io;exports.MeshRenderer=vh;exports.MinMaxCurve=q;exports.MinMaxGradient=Kr;exports.NEKeyboardEvent=Xl;exports.NEPointerEvent=ys;exports.NeedleButtonElement=Zy;exports.NeedleEngineWebComponent=Ky;exports.NeedleMenu=rs;exports.NeedlePatchesKey=Rd;exports.NeedleXRController=og;exports.NeedleXRSession=J;exports.NeedleXRSync=K0;exports.NeedleXRUtils=J0;exports.NestedGltf=mf;exports.NetworkConnection=Y0;exports.NetworkedStreamEvents=Nn;exports.NetworkedStreams=gh;exports.Networking=Ry;exports.NewInstanceModel=fv;exports.NoiseModule=be;exports.ObjectRaycaster=Ei;exports.ObjectUtils=Lo;exports.OffsetConstraint=Qr;exports.OneEuroFilter=Od;exports.OneEuroFilterXYZ=qm;exports.OpenURL=xl;exports.OrbitControls=ge;exports.Outline=pl;exports.OwnershipEvent=Q0;exports.OwnershipModel=cg;exports.PUBLIC_KEY=ba;exports.Padding=Hr;exports.ParticleBurst=wu;exports.ParticleSubEmitter=Ay;exports.ParticleSystem=Wc;exports.ParticleSystemBaseBehaviour=No;exports.ParticleSystemRenderer=en;exports.ParticleSystemShapeType=vu;exports.PeerHandle=ja;exports.PeerNetworking=q0;exports.Physics=Ec;exports.PhysicsExtension=py;exports.PhysicsMaterialCombine=ht;exports.PixelationEffect=jh;exports.PlayAnimationOnClick=$c;exports.PlayAudioOnClick=Mo;exports.PlayableDirector=il;exports.PlayerColor=el;exports.PlayerState=yn;exports.PlayerStateEvent=tx;exports.PlayerSync=dy;exports.PlayerView=Nv;exports.PlayerViewManager=$v;exports.PointerEventData=mh;exports.PointerType=Nu;exports.PostProcessingEffect=Ye;exports.PostProcessingEffectOrder=it;exports.PostProcessingHandler=jy;exports.PreliminaryAction=dl;exports.PreliminaryTrigger=Sh;exports.PrimitiveType=Or;exports.Progress=oe;exports.PromiseAllWithErrors=Gm;exports.PromiseErrorResult=Qp;exports.RGBAColor=ie;exports.RapierPhysics=Mu;exports.RawImage=Df;exports.RaycastOptions=Ds;exports.Rect=nx;exports.RectTransform=wn;exports.ReflectionProbe=zc;exports.RegisteredAnimationInfo=_o;exports.RemoteSkybox=Sf;exports.RenderTexture=xr;exports.RenderTextureSerializer=hw;exports.Renderer=Ti;exports.RendererData=Vv;exports.RendererLightmap=_u;exports.Rigidbody=ot;exports.RigidbodyConstraints=Ne;exports.RoomEvents=ee;exports.RotationBySpeedModule=Ji;exports.RotationOverLifetimeModule=Cn;exports.SceneLightSettings=fu;exports.SceneSwitcher=Ge;exports.ScreenCapture=Vo;exports.ScreenSpaceAmbientOcclusion=Vs;exports.ScreenSpaceAmbientOcclusionN8=Mn;exports.SendQueue=fn;exports.SerializationContext=vg;exports.SetActiveOnClick=oy;exports.ShadowCatcher=zh;exports.ShapeModule=Ey;exports.SharpeningEffect=Fh;exports.SignalAsset=Rf;exports.SignalReceiver=Gh;exports.SignalReceiverEvent=Wh;exports.SignalTrackHandler=Hc;exports.Size=ix;exports.SizeBySpeedModule=gi;exports.SizeOverLifetimeModule=Zr;exports.SkinnedMeshRenderer=Kg;exports.SmoothFollow=Pf;exports.SpatialGrabRaycaster=Tr;exports.SpatialHtml=Xh;exports.SpatialTrigger=Mf;exports.SpatialTriggerReceiver=Zn;exports.SpectatorCamera=Of;exports.SphereCollider=al;exports.SphereIntersection=ug;exports.SphereOverlapResult=gw;exports.Sprite=Us;exports.SpriteData=Fa;exports.SpriteRenderer=fi;exports.SpriteSheet=Za;exports.StateMachineBehaviour=_P;exports.StreamEndedEvent=Ag;exports.StreamReceivedEvent=yw;exports.SubEmitterSystem=xu;exports.SyncedCamera=Fy;exports.SyncedRoom=On;exports.SyncedTransform=es;exports.TapGestureTrigger=ay;exports.TeleportTarget=uf;exports.TestRunner=Uy;exports.TestSceneUtils=sT;exports.TestSimulateUserData=zy;exports.Text=Dt;exports.TextBuilder=gy;exports.TextExtension=pf;exports.TextureSheetAnimationModule=jt;exports.TiltShiftEffect=cs;exports.Time=Gv;exports.ToneMappingEffect=Ro;exports.TrackHandler=Hh;exports.TrackType=bi;exports.TrailModule=je;exports.TransformData=We;exports.TransformGizmo=ia;exports.TriggerBuilder=wt;exports.TriggerModel=Co;exports.TypeStore=k;exports.UIRaycastUtils=Eg;exports.UIRootComponent=Ph;exports.USDDocument=ty;exports.USDObject=Et;exports.USDWriter=Vw;exports.USDZExporter=Kn;exports.USDZExporter$1=Ww;exports.USDZText=cr;exports.USDZUIExtension=wy;exports.UriSerializer=dw;exports.UsageMarker=bh;exports.UserJoinedOrLeftRoomModel=kC;exports.VERSION=_n;exports.VariantAction=ny;exports.VelocityOverLifetimeModule=ze;exports.VerticalLayoutGroup=yy;exports.VideoPlayer=rt;exports.ViewDevice=wo;exports.Vignette=ta;exports.VisibilityAction=Ch;exports.Voip=Do;exports.Volume=vl;exports.VolumeParameter=U;exports.VolumeProfile=bf;exports.WaitForFrames=E1;exports.WaitForPromise=zv;exports.WaitForSeconds=Sg;exports.Watch=Rs;exports.WebARCameraBackground=Yh;exports.WebARSessionRoot=is;exports.WebXR=ff;exports.WebXRButtonFactory=Po;exports.WebXRImageTracking=Xc;exports.WebXRImageTrackingModel=Hs;exports.WebXRPlaneTracking=qs;exports.WebXRTrackedImage=qc;exports.XRControllerFollow=Gs;exports.XRControllerModel=ns;exports.XRControllerMovement=Ai;exports.XRFlag=$i;exports.XRRig=Ff;exports.XRState=Qt;exports.XRStateFlag=Bn;exports.__Ignore=Wx;exports.__internalNotifyObjectDestroyed=ov;exports.activeInHierarchyFieldName=Es;exports.addAttributeChangeCallback=d0;exports.addComponent=Oi;exports.addCustomExtensionPlugin=XM;exports.addNewComponent=vr;exports.addPatch=Uu;exports.apply=Wu;exports.applyHMRChanges=dP;exports.applyPrototypeExtensions=Pv;exports.beginListenDestroy=uv;exports.beginListenInstantiate=mv;exports.binaryIdentifierCasts=rg;exports.build_scene_functions=Y1;exports.builtinComponentKeyName=er;exports.calculateProgress01=Yy;exports.clearMessages=RS;exports.colorSerializer=IP;exports.compareAssociation=bv;exports.componentSerializer=Bd;exports.copyTexture=O0;exports.createMotion=rw;exports.debugNet=ei;exports.debugOwner=Ql;exports.decompressGpuTexture=Xw;exports.deepClone=Jc;exports.delay=Jn;exports.delayForFrames=eh;exports.deserializeObject=nu;exports.destroy=Ri;exports.destroyComponentInstance=kv;exports.determineMimeTypeFromExtension=Cw;exports.disposeObjectResources=Se;exports.disposeStream=$n;exports.editorGuidKeyName=cc;exports.enableSpatialConsole=_r;exports.euler=BP;exports.eventListSerializer=NP;exports.exportAsGLTF=aT;exports.findByGuid=xg;exports.findObjectOfType=hh;exports.findObjectsOfType=Ev;exports.findResourceUsers=pg;exports.fitObjectIntoVolume=R0;exports.foreachComponent=Rr;exports.foreachComponentEnumerator=Hu;exports.forward=WS;exports.generateQRCode=f0;exports.generateSeed=pv;exports.getBoundingBox=ci;exports.getCameraController=v0;exports.getComponent=jr;exports.getComponentInChildren=ch;exports.getComponentInParent=Lc;exports.getComponents=lh;exports.getComponentsInChildren=sl;exports.getComponentsInParent=Vu;exports.getFormattedDate=Uw;exports.getIconElement=_t;exports.getIconTexture=ym;exports.getLoader=bn;exports.getOrAddComponent=ah;exports.getParam=S;exports.getParentHierarchyPath=qS;exports.getPath=lS;exports.getPeerOptions=xC;exports.getPeerjsInstance=H0;exports.getResourceUserCount=HC;exports.getTempColor=S0;exports.getTempQuaternion=un;exports.getTempVector=V;exports.getUrlParams=Zc;exports.getVisibleInCustomShadowRendering=k0;exports.getWorldDirection=C0;exports.getWorldEuler=Ym;exports.getWorldPosition=Q;exports.getWorldQuaternion=_e;exports.getWorldRotation=Bu;exports.getWorldScale=Ue;exports.hasCommercialLicense=Yn;exports.hasIndieLicense=uh;exports.hasPointerEventComponent=cu;exports.hasProLicense=Qn;exports.hideDebugConsole=L0;exports.imageToCanvas=Qw;exports.instantiate=Er;exports.invokeLoadedImportPluginHooks=Lw;exports.invokeXRSessionEnd=N0;exports.invokeXRSessionStart=z0;exports.isActiveInHierarchy=Tv;exports.isActiveSelf=ol;exports.isAndroidDevice=pS;exports.isAnimationAction=M0;exports.isComponent=fw;exports.isDebugMode=sS;exports.isDesktop=hS;exports.isDestroyed=kr;exports.isDevEnvironment=j;exports.isDisposed=WC;exports.isExporting=oT;exports.isGLTFModel=uw;exports.isHostedOnGlitch=s0;exports.isHotReloadEnabled=wm;exports.isHotReloading=cP;exports.isIPad=uS;exports.isIconElement=Xv;exports.isLocalNetwork=Kt;exports.isMacOS=gS;exports.isMobileDevice=dS;exports.isMozillaXR=mS;exports.isQuest=bS;exports.isResourceTrackingEnabled=iv;exports.isSafari=_S;exports.isUsingInstancing=Gu;exports.isiOS=yS;exports.isiPad=fS;exports.loadAsset=VE;exports.loadSync=Qy;exports.logHierarchy=Xd;exports.lookAtInverse=jS;exports.lookAtObject=th;exports.lookAtScreenPoint=BS;exports.makeId=rS;exports.makeIdFromRandomWords=l0;exports.makeNameSafe=Xi;exports.markAsInstancedRendered=Av;exports.microphonePermissionsGranted=vS;exports.nameof=nS;exports.nameofFactory=r0;exports.objectSerializer=cw;exports.offXRSessionEnd=pC;exports.offXRSessionStart=fC;exports.onAfterRender=aP;exports.onBeforeRender=rP;exports.onClear=sP;exports.onDestroy=oP;exports.onInitialized=Jv;exports.onStart=Mg;exports.onUpdate=ew;exports.onXRSessionEnd=sg;exports.onXRSessionStart=zu;exports.parseSync=Ix;exports.placeOnSurface=E0;exports.postprocessFBXMaterials=Jm;exports.prefix=RP;exports.pushState=a0;exports.randomNumber=aS;exports.registerBinaryType=ag;exports.registerComponent=qu;exports.registerComponentExtension=Xg;exports.registerCustomEffectType=tn;exports.registerExportExtensions=Qg;exports.registerExtensions=yu;exports.registerHotReloadType=iw;exports.registerLoader=ig;exports.registerPrefabProvider=yv;exports.registerPrototypeExtensions=Mv;exports.registerType=r1;exports.relativePathPrefix=h0;exports.removeAttributeChangeCallback=u0;exports.removeComponent=wg;exports.removeCustomImportExtensionType=QM;exports.removePatch=dC;exports.resolveUrl=Eo;exports.sanitizeString=c0;exports.saveImage=Tx;exports.screenshot=ME;exports.screenshot2=qy;exports.sendDestroyed=gg;exports.serializable=m;exports.serializeObject=wv;exports.serializeable=Br;exports.setActive=uc;exports.setAllowBalloonMessages=y0;exports.setAllowOverlayMessages=PS;exports.setAutoFitEnabled=Hd;exports.setCameraController=Zp;exports.setDestroyed=Dv;exports.setDevEnvironment=tC;exports.setDisposable=fg;exports.setDontDestroy=pa;exports.setOrAddParamsToUrl=Xp;exports.setParam=oS;exports.setParamWithoutReload=Oc;exports.setPeerOptions=SC;exports.setResourceTrackingEnabled=VC;exports.setState=Vm;exports.setVisibleInCustomShadowRendering=Zm;exports.setWorldEuler=Km;exports.setWorldPosition=st;exports.setWorldPositionXYZ=Pr;exports.setWorldQuaternion=Hi;exports.setWorldQuaternionXYZW=Qm;exports.setWorldRotation=P0;exports.setWorldRotationXYZ=ih;exports.setWorldScale=Na;exports.showBalloonError=nh;exports.showBalloonMessage=Ee;exports.showBalloonWarning=me;exports.showDebugConsole=eg;exports.slerp=IS;exports.syncDestroy=oh;exports.syncField=hy;exports.syncInstantiate=yg;exports.textureToCanvas=XS;exports.tryCastBinary=W0;exports.tryDetermineMimetypeFromBinary=Mw;exports.tryDetermineMimetypeFromURL=Pw;exports.tryFindObject=za;exports.tryGetGuid=G0;exports.unregisterHotReloadType=nw;exports.unwatchWrite=Wm;exports.useForAutoFit=w0;exports.validate=St;exports.watchWrite=ju;
1607
+ `),ce(this,mr).innerHTML=ce(this,Vt).innerHTML,ce(this,mr).style.cssText="display: flex; align-items: center; justify-content: center;",ce(this,Vt).innerHTML=ce(this,mr).outerHTML,ce(this,pr).innerHTML=ce(this,Vt).outerHTML,ce(this,pr).prepend(ce(this,gr)),ru(_m,{element:ce(this,pr)}),(n=ce(this,Ua))==null||n.disconnect(),ce(this,Ua)??rn(this,Ua,new MutationObserver(()=>Ol(this,nl,Nx).call(this))),ce(this,Ua).observe(ce(this,Vt),{attributes:!0}),Hp&&console.log("Needle Button updated")},Nx=function(){ce(this,Vt)&&(ce(this,Vt).style.display==="none"?this.style.display="none":this.style.display==="none"&&(this.style.display=""))},Kc=new WeakMap,r(Zy,"observedAttributes",["ar","vr","quicklook"]);typeof window<"u"&&!window.customElements.get(i0)&&window.customElements.define(i0,Zy);const Hl=S("debugavatar");class Jy{constructor(t,e,i,n){r(this,"root");r(this,"head");r(this,"leftHand");r(this,"rigthHand");var s;this.root=t,this.head=e,this.leftHand=i,this.rigthHand=n,(s=this.root)==null||s.traverse(a=>a.layers.set(2))}get isValid(){return this.head!==null&&this.head!==void 0}}class $x{constructor(){r(this,"avatarRegistryUrl",null)}async getOrCreateNewAvatarInstance(t,e){if(!e)return console.error("Can not create avatar: failed to provide id or root object"),null;let i=null;if(typeof e=="string"){if(i=await this.loadAvatar(t,e),!i){const s=new xn;i=C.instantiate(za(e,t.scene),s)}}else i=e;if(!i)return null;const n=this.findAvatar(i);return n.isValid?(Hl&&console.log("[Custom Avatar] valid config",e,Hl?n:""),n):(console.warn("[Custom Avatar] config isn't valid",e,Hl?n:""),null)}async loadAvatar(t,e){if(console.assert(e!=null&&typeof e=="string","Avatar id must not be null"),e.length<=0||!e)return null;if(Hl&&console.log("[Custom Avatar] "+e+", loading..."),e.endsWith(".glb")||(e+=".glb"),this.avatarRegistryUrl===null){const n=await fetch("./"+e);let s=null;if(n.ok){const l=await n.blob();l&&(s=await l.arrayBuffer())}if(!s)return null;const a=await bn().parseSync(t,s,null,0);return(a==null?void 0:a.scene)??null}const i=new H.GLTFLoader;return Og(i,t),new Promise((n,s)=>{const a=this.avatarRegistryUrl+"/"+e;i.load(a,async l=>{await bn().createBuiltinComponents(t,a,l,null,void 0),n(l.scene)},l=>{Hl&&console.log("[Custom Avatar] "+l.loaded/l.total*100+"% loaded of "+l.total/1024+"kB")},l=>{console.error("[Custom Avatar] Error when loading: "+l),n(null)})})}cacheModel(t,e){}findAvatar(t){const e=t;let i=e;i.children.length==1&&(i=t.children[0]);let n=this.findAvatarPart(i,["head"]);const s=this.findAvatarPart(i,["left","hand"]),a=this.findAvatarPart(i,["right","hand"]);if(!n){n=e;const c=new d.Vector3;new d.Box3().setFromObject(n).getSize(c);const h=Math.max(c.x,c.y,c.z);console.warn("[Custom Avatar] Normalizing head scale, it's too big: "+h+" meters! Should be < 0.3m"),h>.3&&n.scale.multiplyScalar(1/h*.3)}return new Jy(e,n,s,a)}findAvatarPart(t,e){const i=t.name.toLowerCase();let n=!0;for(const s of e){if(!n)break;i.indexOf(s)===-1&&(n=!1)}if(n)return t;if(t.children)for(const s of t.children){const a=this.findAvatarPart(s,e);if(a)return a}return null}handleCustomAvatarErrors(t){if(!t.ok)throw Error(t.statusText);return t}}class Vx{get extensionName(){return"DocumentExtension"}onAfterBuildDocument(t){}}class Wx{}const hT=Object.freeze(Object.defineProperty({__proto__:null,ActionBuilder:fe,ActionCollection:Zw,ActionModel:xi,AlignmentConstraint:fh,Animation:Tt,AnimationCurve:Ah,AnimationExtension:af,AnimationTrackHandler:Ef,Animator:xt,AnimatorController:Gi,Antialiasing:Dh,AudioExtension:Wr,AudioListener:Ms,AudioSource:qi,AudioTrackHandler:tl,Avatar:Oo,AvatarBlink_Simple:zr,AvatarEyeLook_Rotation:jg,AvatarLoader:$x,AvatarMarker:At,AvatarModel:Jy,Avatar_Brain_LookAt:Uc,Avatar_MouthShapes:yh,Avatar_MustacheShake:Dg,Avatar_POI:Ts,AxesHelper:rl,BaseUIComponent:Qi,BasicIKConstraint:Fg,BehaviorExtension:fy,BehaviorModel:vt,BloomEffect:wf,BoxCollider:tf,BoxGizmo:Xr,BoxHelperComponent:ts,Button:Ws,CallInfo:Cs,Camera:ai,CameraTargetReachedEvent:Fc,Canvas:Ja,CanvasGroup:ko,CapsuleCollider:As,ChangeMaterialOnClick:sy,ChangeTransformOnClick:Gr,CharacterController:Nr,CharacterControllerInput:js,ChromaticAberration:Ih,Collider:ui,ColorAdjustments:$o,ColorBySpeedModule:_l,ColorOverLifetimeModule:_f,ContactShadows:_h,ControlTrackHandler:Tf,CustomBranding:qr,Deletable:$g,DeleteBox:Xa,DepthOfField:Pn,DeviceFlag:nf,DocumentExtension:Vx,DragControls:lr,DropListener:Bs,Duplicatable:Gg,EffectWrapper:Gc,EmissionModule:$s,EmphasizeOnClick:hl,EnvironmentScene:jf,EventList:ye,EventListEvent:Yu,EventSystem:Yt,EventTrigger:of,FieldWithDefault:Bw,FixedJoint:Oy,Fog:ml,GltfExport:ey,GltfExportBox:Zg,Gradient:Yr,Graphic:Oh,GraphicRaycaster:Ku,GridHelper:gl,GridLayoutGroup:by,GroundProjectedEnv:ss,GroupActionModel:yo,HideOnStart:Ya,HingeJoint:Rh,HorizontalLayoutGroup:_y,Image:wl,InheritVelocityModule:Ty,InputField:Wy,InstanceHandle:Nc,InstancingHandler:Qa,Interactable:Ng,Keyframe:li,LODGroup:Th,LODModel:yl,Light:mi,LimitVelocityOverLifetimeModule:lt,LogStats:zg,LookAt:Gy,LookAtConstraint:Ur,MainModule:It,MaskableGraphic:kh,MeshCollider:Io,MeshRenderer:vh,MinMaxCurve:q,MinMaxGradient:Kr,NeedleMenu:rs,NestedGltf:mf,Networking:Ry,NoiseModule:be,ObjectRaycaster:Ei,OffsetConstraint:Qr,OpenURL:xl,OrbitControls:ge,Outline:pl,Padding:Hr,ParticleBurst:wu,ParticleSubEmitter:Ay,ParticleSystem:Wc,ParticleSystemRenderer:en,PhysicsExtension:py,PixelationEffect:jh,PlayAnimationOnClick:$c,PlayAudioOnClick:Mo,PlayableDirector:il,PlayerColor:el,PointerEventData:mh,PostProcessingHandler:jy,PreliminaryAction:dl,PreliminaryTrigger:Sh,RawImage:Df,Rect:nx,RectTransform:wn,ReflectionProbe:zc,RegisteredAnimationInfo:_o,RemoteSkybox:Sf,Renderer:Ti,RendererLightmap:_u,Rigidbody:ot,RotationBySpeedModule:Ji,RotationOverLifetimeModule:Cn,SceneSwitcher:Ge,ScreenCapture:Vo,ScreenSpaceAmbientOcclusion:Vs,ScreenSpaceAmbientOcclusionN8:Mn,SetActiveOnClick:oy,ShadowCatcher:zh,ShapeModule:Ey,SharpeningEffect:Fh,SignalAsset:Rf,SignalReceiver:Gh,SignalReceiverEvent:Wh,SignalTrackHandler:Hc,Size:ix,SizeBySpeedModule:gi,SizeOverLifetimeModule:Zr,SkinnedMeshRenderer:Kg,SmoothFollow:Pf,SpatialGrabRaycaster:Tr,SpatialHtml:Xh,SpatialTrigger:Mf,SpatialTriggerReceiver:Zn,SpectatorCamera:Of,SphereCollider:al,Sprite:Us,SpriteData:Fa,SpriteRenderer:fi,SpriteSheet:Za,SubEmitterSystem:xu,SyncedCamera:Fy,SyncedRoom:On,SyncedTransform:es,TapGestureTrigger:ay,TeleportTarget:uf,TestRunner:Uy,TestSimulateUserData:zy,Text:Dt,TextBuilder:gy,TextExtension:pf,TextureSheetAnimationModule:jt,TiltShiftEffect:cs,ToneMappingEffect:Ro,TrailModule:je,TransformData:We,TransformGizmo:ia,TriggerBuilder:wt,TriggerModel:Co,UIRaycastUtils:Eg,UIRootComponent:Ph,USDZExporter:Kn,USDZText:cr,USDZUIExtension:wy,UsageMarker:bh,VariantAction:ny,VelocityOverLifetimeModule:ze,VerticalLayoutGroup:yy,VideoPlayer:rt,Vignette:ta,VisibilityAction:Ch,Voip:Do,Volume:vl,VolumeParameter:U,VolumeProfile:bf,WebARCameraBackground:Yh,WebARSessionRoot:is,WebXR:ff,WebXRImageTracking:Xc,WebXRImageTrackingModel:Hs,WebXRPlaneTracking:qs,WebXRTrackedImage:qc,XRControllerFollow:Gs,XRControllerModel:ns,XRControllerMovement:Ai,XRFlag:$i,XRRig:Ff,XRState:Qt,__Ignore:Wx},Symbol.toStringTag,{value:"Module"})),Ou=S("debugmissingcamera");re.registerCallback(he.MissingCamera,o=>{var l,c,h;Ou&&console.warn("Creating missing camera");const t=o.context.scene,e=new d.PerspectiveCamera;e.name="Default Fallback Camera",t.add(e);const i=new ai;if(i.sourceId=((c=(l=o.files)==null?void 0:l[0])==null?void 0:c.src)??"unknown",i.fieldOfView=35,o.context.domElement.getAttribute("transparent")!=null)i.clearFlags=Cr.Uninitialized;else if((h=o.context.domElement.getAttribute("background-image"))!=null&&h.length||o.context.lightmaps.tryGetSkybox(i.sourceId))i.clearFlags=Cr.Skybox,o.context.domElement.getAttribute("background-blurriness")===null&&(o.context.scene.backgroundBlurriness=.2);else{if(i.clearFlags=Cr.SolidColor,!o.context.domElement.getAttribute("background-color")){let u="#efefef";typeof window!==void 0&&window.matchMedia("(prefers-color-scheme: dark)").matches&&(u="#1f1f1f"),t.background=new d.Color(u)}if(!t.environment){const u=new d.PMREMGenerator$1(o.context.renderer),f=new jf("neutral");t.environment=u.fromScene(f,.025).texture}}const s=vr(e,i,!0);e.position.x=0,e.position.y=1,e.position.z=2;const a=o.context.domElement;return(a==null?void 0:a.cameraControls)!=!1&&Gx(o.context,s),s});re.registerCallback(he.ContextCreated,o=>{if(!o.context.mainCamera){Ou&&console.log("Will not auto-fit because a default camera exists");return}const t=o.context.domElement;if((t==null?void 0:t.cameraControls)==!0){const e=v0(o.context.mainCamera);if((e==null?void 0:e.isCameraController)==!0){Ou&&console.log("Will not auto-fit because a camera controller exists");return}Gx(o.context)}});function Gx(o,t){t=t??o.mainCameraComponent;const e=t==null?void 0:t.gameObject;if(Ou&&console.log("Creating default camera controls",t==null?void 0:t.name),e){const i=ah(e,ge);i.sourceId=(t==null?void 0:t.sourceId)??"unknown";const n=o.domElement.getAttribute("auto-rotate");if(i.autoRotate=n!=null&&n!="0"&&(n==null?void 0:n.toLowerCase())!="false",i.autoRotateSpeed=.5,i.autoFit=!0,i.autoRotate&&n){const s=parseFloat(n);isNaN(s)||(i.autoRotateSpeed=s)}}else console.warn("Missing camera object, can not add orbit controls")}re.registerCallback(he.ContextCreated,o=>{const t=o.context.domElement.getAttribute("autoplay");if(t!==void 0&&(t===""||t==="true"||t==="1")&&o.files)for(const e of o.files)C.foreachComponent(e.file.scene,n=>{if(n.enabled!==!1){if(n instanceof Tt&&n.playAutomatically||n instanceof xt||n instanceof il&&n.playOnAwake===!0)return!0;if(n instanceof Tt)return n.playAutomatically=!0,!0;if(n instanceof il)return n.playOnAwake=!0,!0}},!0)!==!0&&Ha.assignAnimationsFromFile(e.file,{createAnimationComponent:(n,s)=>Oi(n,Tt)})});class dT extends ae.WorkerBase{constructor(){super(new Worker(new URL("/generateMeshBVH.worker-BaNp_Xtp.js",typeof document>"u"?require("url").pathToFileURL(__filename).href:Nf&&Nf.tagName.toUpperCase()==="SCRIPT"&&Nf.src||new URL("needle-engine.bundle-DM_LxEPT.umd.cjs",document.baseURI).href),{type:"module"})),this.name="GenerateMeshBVHWorker"}runTask(t,e,i={}){return new Promise((n,s)=>{if(e.getAttribute("position").isInterleavedBufferAttribute||e.index&&e.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");t.onerror=h=>{s(new Error(`[GenerateMeshBVHWorker] ${h.message||"Unknown error. Please check the server console. If you're using vite try adding 'three-mesh-bvh' to 'optimizeDeps.exclude' in your vite.config.js"}`))},t.onmessage=h=>{const{data:u}=h;if(u.error)s(new Error(u.error)),t.onmessage=null;else if(u.serialized){const{serialized:f,position:p}=u,g=ae.MeshBVH.deserialize(f,e,{setIndex:!1}),y=Object.assign({setBoundingBox:!0},i);if(e.attributes.position.array=p,f.index)if(e.index)e.index.array=f.index;else{const b=new d.BufferAttribute(f.index,1,!1);e.setIndex(b)}y.setBoundingBox&&(e.boundingBox=g.getBoundingBox(new d.Box3)),i.onProgress&&i.onProgress(u.progress),n(g),t.onmessage=null}else i.onProgress&&i.onProgress(u.progress)};const a=e.index?e.index.array:null,l=e.attributes.position.array,c=[l];a&&c.push(a),t.postMessage({index:a,position:l,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...e.groups]}},c.map(h=>h.buffer).filter(h=>typeof SharedArrayBuffer>"u"||!(h instanceof SharedArrayBuffer)))})}}const uT=Object.freeze(Object.defineProperty({__proto__:null,GenerateMeshBVHWorker:dT},Symbol.toStringTag,{value:"Module"}));exports.$physicsKey=nM;exports.ActionBuilder=fe;exports.ActionCollection=Zw;exports.ActionModel=xi;exports.Addressables=Bv;exports.AlignmentConstraint=fh;exports.AmbientMode=Ia;exports.Animation=Tt;exports.AnimationCurve=Ah;exports.AnimationExtension=af;exports.AnimationTrackHandler=Ef;exports.AnimationUtils=Ha;exports.Animator=xt;exports.AnimatorConditionMode=oo;exports.AnimatorController=Gi;exports.AnimatorControllerParameterType=kg;exports.AnimatorStateInfo=Jl;exports.Antialiasing=Dh;exports.Application=vn;exports.AssetDatabase=ev;exports.AssetReference=te;exports.AudioExtension=Wr;exports.AudioListener=Ms;exports.AudioSource=qi;exports.AudioTrackHandler=tl;exports.Avatar=Oo;exports.AvatarBlink_Simple=zr;exports.AvatarEyeLook_Rotation=jg;exports.AvatarLoader=$x;exports.AvatarMarker=At;exports.AvatarModel=Jy;exports.Avatar_Brain_LookAt=Uc;exports.Avatar_MouthShapes=yh;exports.Avatar_MustacheShake=Dg;exports.Avatar_POI=Ts;exports.Axes=xa;exports.AxesHelper=rl;exports.BUILD_TIME=tg;exports.BaseUIComponent=Qi;exports.BasicIKConstraint=Fg;exports.BehaviorExtension=fy;exports.BehaviorModel=vt;exports.BloomEffect=wf;exports.BoxCollider=tf;exports.BoxGizmo=Xr;exports.BoxHelperComponent=ts;exports.Button=Ws;exports.ButtonsFactory=zn;exports.CallDirection=_w;exports.CallInfo=Cs;exports.Camera=ai;exports.CameraTargetReachedEvent=Fc;exports.Canvas=Ja;exports.CanvasGroup=ko;exports.CapsuleCollider=As;exports.ChangeMaterialOnClick=sy;exports.ChangeTransformOnClick=Gr;exports.CharacterController=Nr;exports.CharacterControllerInput=js;exports.ChromaticAberration=Ih;exports.CircularBuffer=ki;exports.ClearFlags=Cr;exports.ClipExtrapolation=An;exports.Collider=ui;exports.Collision=mw;exports.CollisionDetectionMode=Qu;exports.ColorAdjustments=$o;exports.ColorBySpeedModule=_l;exports.ColorOverLifetimeModule=_f;exports.Component=uP;exports.Component$1=I;exports.ComponentLifecycleEvents=sh;exports.Components=hT;exports.ConnectionEvents=X0;exports.ContactPoint=pw;exports.ContactShadows=_h;exports.Context=X;exports.ContextArgs=K1;exports.ContextEvent=he;exports.ContextRegistry=re;exports.ControlTrackHandler=Tf;exports.CustomBranding=qr;exports.CustomShader=mu;exports.DefaultReflectionMode=ou;exports.Deletable=$g;exports.DeleteBox=Xa;exports.DepthOfField=Pn;exports.DeviceFlag=nf;exports.DocumentExtension=Vx;exports.DragControls=lr;exports.DragMode=Vg;exports.DropListener=Bs;exports.Duplicatable=Gg;exports.EffectWrapper=Gc;exports.EmissionModule=$s;exports.EmphasizeOnClick=hl;exports.EngineLoadingView=Pu;exports.EnvironmentScene=jf;exports.EventList=ye;exports.EventListEvent=Yu;exports.EventSystem=Yt;exports.EventTrigger=of;exports.FieldWithDefault=Bw;exports.FileReference=Ic;exports.FileReferenceSerializer=Uv;exports.FileSpawnModel=MM;exports.File_Event=Sw;exports.FixedJoint=Oy;exports.Fog=ml;exports.FrameEvent=we;exports.GENERATOR=Fu;exports.GameObject=C;exports.Gizmos=$;exports.GltfExport=ey;exports.GltfExportBox=Zg;exports.Gradient=Yr;exports.Graphic=Oh;exports.GraphicRaycaster=Ku;exports.Graphics=Mr;exports.GridHelper=gl;exports.GridLayoutGroup=by;exports.GroundProjectedEnv=ss;exports.GroupActionModel=yo;exports.HideFlags=Zu;exports.HideOnStart=Ya;exports.HingeJoint=Rh;exports.HorizontalLayoutGroup=_y;exports.HostData=t1;exports.Image=wl;exports.ImageReference=Dc;exports.ImageReferenceSerializer=Fv;exports.InheritVelocityModule=Ty;exports.Input=$0;exports.InputEventQueue=ri;exports.InputEvents=Re;exports.InputField=Wy;exports.InstanceHandle=Nc;exports.InstancingHandler=Qa;exports.InstancingUtil=Wi;exports.InstantiateEvent=dv;exports.InstantiateIdProvider=bt;exports.InstantiateOptions=xn;exports.Interactable=Ng;exports.JoinedRoomResponse=MC;exports.KeyEventArgs=mC;exports.Keyframe=li;exports.LODGroup=Th;exports.LODModel=yl;exports.LeftRoomResponse=OC;exports.Light=mi;exports.LightData=Wv;exports.LimitVelocityOverLifetimeModule=lt;exports.LoadingElementOptions=QE;exports.LogStats=zg;exports.LogType=Mi;exports.LookAt=Gy;exports.LookAtConstraint=Ur;exports.MainModule=It;exports.MarkerType=Ny;exports.MaskableGraphic=kh;exports.Mathf=z;exports.MeshCollider=Io;exports.MeshRenderer=vh;exports.MinMaxCurve=q;exports.MinMaxGradient=Kr;exports.NEKeyboardEvent=Xl;exports.NEPointerEvent=ys;exports.NeedleButtonElement=Zy;exports.NeedleEngineWebComponent=Ky;exports.NeedleMenu=rs;exports.NeedlePatchesKey=Rd;exports.NeedleXRController=og;exports.NeedleXRSession=J;exports.NeedleXRSync=K0;exports.NeedleXRUtils=J0;exports.NestedGltf=mf;exports.NetworkConnection=Y0;exports.NetworkedStreamEvents=Nn;exports.NetworkedStreams=gh;exports.Networking=Ry;exports.NewInstanceModel=fv;exports.NoiseModule=be;exports.ObjectRaycaster=Ei;exports.ObjectUtils=Lo;exports.OffsetConstraint=Qr;exports.OneEuroFilter=Od;exports.OneEuroFilterXYZ=qm;exports.OpenURL=xl;exports.OrbitControls=ge;exports.Outline=pl;exports.OwnershipEvent=Q0;exports.OwnershipModel=cg;exports.PUBLIC_KEY=ba;exports.Padding=Hr;exports.ParticleBurst=wu;exports.ParticleSubEmitter=Ay;exports.ParticleSystem=Wc;exports.ParticleSystemBaseBehaviour=No;exports.ParticleSystemRenderer=en;exports.ParticleSystemShapeType=vu;exports.PeerHandle=ja;exports.PeerNetworking=q0;exports.Physics=Ec;exports.PhysicsExtension=py;exports.PhysicsMaterialCombine=ht;exports.PixelationEffect=jh;exports.PlayAnimationOnClick=$c;exports.PlayAudioOnClick=Mo;exports.PlayableDirector=il;exports.PlayerColor=el;exports.PlayerState=yn;exports.PlayerStateEvent=tx;exports.PlayerSync=dy;exports.PlayerView=Nv;exports.PlayerViewManager=$v;exports.PointerEventData=mh;exports.PointerType=Nu;exports.PostProcessingEffect=Ye;exports.PostProcessingEffectOrder=it;exports.PostProcessingHandler=jy;exports.PreliminaryAction=dl;exports.PreliminaryTrigger=Sh;exports.PrimitiveType=Or;exports.Progress=oe;exports.PromiseAllWithErrors=Gm;exports.PromiseErrorResult=Qp;exports.RGBAColor=ie;exports.RapierPhysics=Mu;exports.RawImage=Df;exports.RaycastOptions=Ds;exports.Rect=nx;exports.RectTransform=wn;exports.ReflectionProbe=zc;exports.RegisteredAnimationInfo=_o;exports.RemoteSkybox=Sf;exports.RenderTexture=xr;exports.RenderTextureSerializer=hw;exports.Renderer=Ti;exports.RendererData=Vv;exports.RendererLightmap=_u;exports.Rigidbody=ot;exports.RigidbodyConstraints=Ne;exports.RoomEvents=ee;exports.RotationBySpeedModule=Ji;exports.RotationOverLifetimeModule=Cn;exports.SceneLightSettings=fu;exports.SceneSwitcher=Ge;exports.ScreenCapture=Vo;exports.ScreenSpaceAmbientOcclusion=Vs;exports.ScreenSpaceAmbientOcclusionN8=Mn;exports.SendQueue=fn;exports.SerializationContext=vg;exports.SetActiveOnClick=oy;exports.ShadowCatcher=zh;exports.ShapeModule=Ey;exports.SharpeningEffect=Fh;exports.SignalAsset=Rf;exports.SignalReceiver=Gh;exports.SignalReceiverEvent=Wh;exports.SignalTrackHandler=Hc;exports.Size=ix;exports.SizeBySpeedModule=gi;exports.SizeOverLifetimeModule=Zr;exports.SkinnedMeshRenderer=Kg;exports.SmoothFollow=Pf;exports.SpatialGrabRaycaster=Tr;exports.SpatialHtml=Xh;exports.SpatialTrigger=Mf;exports.SpatialTriggerReceiver=Zn;exports.SpectatorCamera=Of;exports.SphereCollider=al;exports.SphereIntersection=ug;exports.SphereOverlapResult=gw;exports.Sprite=Us;exports.SpriteData=Fa;exports.SpriteRenderer=fi;exports.SpriteSheet=Za;exports.StateMachineBehaviour=_P;exports.StreamEndedEvent=Ag;exports.StreamReceivedEvent=yw;exports.SubEmitterSystem=xu;exports.SyncedCamera=Fy;exports.SyncedRoom=On;exports.SyncedTransform=es;exports.TapGestureTrigger=ay;exports.TeleportTarget=uf;exports.TestRunner=Uy;exports.TestSceneUtils=sT;exports.TestSimulateUserData=zy;exports.Text=Dt;exports.TextBuilder=gy;exports.TextExtension=pf;exports.TextureSheetAnimationModule=jt;exports.TiltShiftEffect=cs;exports.Time=Gv;exports.ToneMappingEffect=Ro;exports.TrackHandler=Hh;exports.TrackType=bi;exports.TrailModule=je;exports.TransformData=We;exports.TransformGizmo=ia;exports.TriggerBuilder=wt;exports.TriggerModel=Co;exports.TypeStore=k;exports.UIRaycastUtils=Eg;exports.UIRootComponent=Ph;exports.USDDocument=ty;exports.USDObject=Et;exports.USDWriter=Vw;exports.USDZExporter=Kn;exports.USDZExporter$1=Ww;exports.USDZText=cr;exports.USDZUIExtension=wy;exports.UriSerializer=dw;exports.UsageMarker=bh;exports.UserJoinedOrLeftRoomModel=kC;exports.VERSION=_n;exports.VariantAction=ny;exports.VelocityOverLifetimeModule=ze;exports.VerticalLayoutGroup=yy;exports.VideoPlayer=rt;exports.ViewDevice=wo;exports.Vignette=ta;exports.VisibilityAction=Ch;exports.Voip=Do;exports.Volume=vl;exports.VolumeParameter=U;exports.VolumeProfile=bf;exports.WaitForFrames=E1;exports.WaitForPromise=zv;exports.WaitForSeconds=Sg;exports.Watch=Rs;exports.WebARCameraBackground=Yh;exports.WebARSessionRoot=is;exports.WebXR=ff;exports.WebXRButtonFactory=Po;exports.WebXRImageTracking=Xc;exports.WebXRImageTrackingModel=Hs;exports.WebXRPlaneTracking=qs;exports.WebXRTrackedImage=qc;exports.XRControllerFollow=Gs;exports.XRControllerModel=ns;exports.XRControllerMovement=Ai;exports.XRFlag=$i;exports.XRRig=Ff;exports.XRState=Qt;exports.XRStateFlag=Bn;exports.__Ignore=Wx;exports.__internalNotifyObjectDestroyed=ov;exports.activeInHierarchyFieldName=Es;exports.addAttributeChangeCallback=d0;exports.addComponent=Oi;exports.addCustomExtensionPlugin=XM;exports.addNewComponent=vr;exports.addPatch=Uu;exports.apply=Wu;exports.applyHMRChanges=dP;exports.applyPrototypeExtensions=Pv;exports.beginListenDestroy=uv;exports.beginListenInstantiate=mv;exports.binaryIdentifierCasts=rg;exports.build_scene_functions=Y1;exports.builtinComponentKeyName=er;exports.calculateProgress01=Yy;exports.clearMessages=RS;exports.colorSerializer=IP;exports.compareAssociation=bv;exports.componentSerializer=Bd;exports.copyTexture=O0;exports.createMotion=rw;exports.debugNet=ei;exports.debugOwner=Ql;exports.decompressGpuTexture=Xw;exports.deepClone=Jc;exports.delay=Jn;exports.delayForFrames=eh;exports.deserializeObject=nu;exports.destroy=Ri;exports.destroyComponentInstance=kv;exports.determineMimeTypeFromExtension=Cw;exports.disposeObjectResources=Se;exports.disposeStream=$n;exports.editorGuidKeyName=cc;exports.enableSpatialConsole=_r;exports.euler=BP;exports.eventListSerializer=NP;exports.exportAsGLTF=aT;exports.findByGuid=xg;exports.findObjectOfType=hh;exports.findObjectsOfType=Ev;exports.findResourceUsers=pg;exports.fitObjectIntoVolume=R0;exports.foreachComponent=Rr;exports.foreachComponentEnumerator=Hu;exports.forward=WS;exports.generateQRCode=f0;exports.generateSeed=pv;exports.getBoundingBox=ci;exports.getCameraController=v0;exports.getComponent=jr;exports.getComponentInChildren=ch;exports.getComponentInParent=Lc;exports.getComponents=lh;exports.getComponentsInChildren=sl;exports.getComponentsInParent=Vu;exports.getFormattedDate=Uw;exports.getIconElement=_t;exports.getIconTexture=ym;exports.getLoader=bn;exports.getOrAddComponent=ah;exports.getParam=S;exports.getParentHierarchyPath=qS;exports.getPath=lS;exports.getPeerOptions=xC;exports.getPeerjsInstance=H0;exports.getResourceUserCount=HC;exports.getTempColor=S0;exports.getTempQuaternion=un;exports.getTempVector=V;exports.getUrlParams=Zc;exports.getVisibleInCustomShadowRendering=k0;exports.getWorldDirection=C0;exports.getWorldEuler=Ym;exports.getWorldPosition=Q;exports.getWorldQuaternion=_e;exports.getWorldRotation=Bu;exports.getWorldScale=Ue;exports.hasCommercialLicense=Yn;exports.hasIndieLicense=uh;exports.hasPointerEventComponent=cu;exports.hasProLicense=Qn;exports.hideDebugConsole=L0;exports.imageToCanvas=Qw;exports.instantiate=Er;exports.invokeLoadedImportPluginHooks=Lw;exports.invokeXRSessionEnd=N0;exports.invokeXRSessionStart=z0;exports.isActiveInHierarchy=Tv;exports.isActiveSelf=ol;exports.isAndroidDevice=pS;exports.isAnimationAction=M0;exports.isComponent=fw;exports.isDebugMode=sS;exports.isDesktop=hS;exports.isDestroyed=kr;exports.isDevEnvironment=j;exports.isDisposed=WC;exports.isExporting=oT;exports.isGLTFModel=uw;exports.isHostedOnGlitch=s0;exports.isHotReloadEnabled=wm;exports.isHotReloading=cP;exports.isIPad=uS;exports.isIconElement=Xv;exports.isLocalNetwork=Kt;exports.isMacOS=gS;exports.isMobileDevice=dS;exports.isMozillaXR=mS;exports.isQuest=bS;exports.isResourceTrackingEnabled=iv;exports.isSafari=_S;exports.isUsingInstancing=Gu;exports.isiOS=yS;exports.isiPad=fS;exports.loadAsset=VE;exports.loadSync=Qy;exports.logHierarchy=Xd;exports.lookAtInverse=jS;exports.lookAtObject=th;exports.lookAtScreenPoint=BS;exports.makeId=rS;exports.makeIdFromRandomWords=l0;exports.makeNameSafe=Xi;exports.markAsInstancedRendered=Av;exports.microphonePermissionsGranted=vS;exports.nameof=nS;exports.nameofFactory=r0;exports.objectSerializer=cw;exports.offXRSessionEnd=pC;exports.offXRSessionStart=fC;exports.onAfterRender=aP;exports.onBeforeRender=rP;exports.onClear=sP;exports.onDestroy=oP;exports.onInitialized=Jv;exports.onStart=Mg;exports.onUpdate=ew;exports.onXRSessionEnd=sg;exports.onXRSessionStart=zu;exports.parseSync=Ix;exports.placeOnSurface=E0;exports.postprocessFBXMaterials=Jm;exports.prefix=RP;exports.pushState=a0;exports.randomNumber=aS;exports.registerBinaryType=ag;exports.registerComponent=qu;exports.registerComponentExtension=Xg;exports.registerCustomEffectType=tn;exports.registerExportExtensions=Qg;exports.registerExtensions=yu;exports.registerHotReloadType=iw;exports.registerLoader=ig;exports.registerPrefabProvider=yv;exports.registerPrototypeExtensions=Mv;exports.registerType=r1;exports.relativePathPrefix=h0;exports.removeAttributeChangeCallback=u0;exports.removeComponent=wg;exports.removeCustomImportExtensionType=QM;exports.removePatch=dC;exports.resolveUrl=Eo;exports.sanitizeString=c0;exports.saveImage=Tx;exports.screenshot=ME;exports.screenshot2=qy;exports.sendDestroyed=gg;exports.serializable=m;exports.serializeObject=wv;exports.serializeable=Br;exports.setActive=uc;exports.setAllowBalloonMessages=y0;exports.setAllowOverlayMessages=PS;exports.setAutoFitEnabled=Hd;exports.setCameraController=Zp;exports.setDestroyed=Dv;exports.setDevEnvironment=tC;exports.setDisposable=fg;exports.setDontDestroy=pa;exports.setOrAddParamsToUrl=Xp;exports.setParam=oS;exports.setParamWithoutReload=Oc;exports.setPeerOptions=SC;exports.setResourceTrackingEnabled=VC;exports.setState=Vm;exports.setVisibleInCustomShadowRendering=Zm;exports.setWorldEuler=Km;exports.setWorldPosition=st;exports.setWorldPositionXYZ=Pr;exports.setWorldQuaternion=Hi;exports.setWorldQuaternionXYZW=Qm;exports.setWorldRotation=P0;exports.setWorldRotationXYZ=ih;exports.setWorldScale=Na;exports.showBalloonError=nh;exports.showBalloonMessage=Ee;exports.showBalloonWarning=me;exports.showDebugConsole=eg;exports.slerp=IS;exports.syncDestroy=oh;exports.syncField=hy;exports.syncInstantiate=yg;exports.textureToCanvas=XS;exports.tryCastBinary=W0;exports.tryDetermineMimetypeFromBinary=Mw;exports.tryDetermineMimetypeFromURL=Pw;exports.tryFindObject=za;exports.tryGetGuid=G0;exports.unregisterHotReloadType=nw;exports.unwatchWrite=Wm;exports.useForAutoFit=w0;exports.validate=St;exports.watchWrite=ju;