cozyclay 1.10.0 → 2.0.2
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.
- package/CHANGELOG.md +193 -0
- package/bin/agent/agent-routes.mjs +82 -72
- package/bin/agent/agent-runner.mjs +10 -3
- package/bin/agent/motion-runtime.mjs +32 -260
- package/bin/agent/providers.mjs +46 -3
- package/bin/agent/session-store.mjs +41 -5
- package/bin/agent/studio-prompt.mjs +1 -1
- package/bin/agent/studio-tools.mjs +48 -11
- package/bin/codex-auth.mjs +2 -1
- package/bin/cozyclay.mjs +38 -11
- package/bin/live/cli.mjs +22 -3
- package/bin/mcp-runtime.mjs +45 -20
- package/bin/telemetry-state.mjs +5 -2
- package/bin/update-check.mjs +15 -0
- package/dist/app/index.html +6 -6
- package/dist/assets/analytics-MVZOEW8O.js +1 -0
- package/dist/assets/app-BxBLC6GT.js +4876 -0
- package/dist/assets/app-CJdxvnrl.css +1 -0
- package/dist/assets/{demo-B-eg1CT8.js → demo-ByeYp-dY.js} +1 -1
- package/dist/assets/{first-shot-handoff-CGgnvNu8.js → first-shot-handoff-DgT28ZiV.js} +1 -1
- package/dist/assets/{landing-IbRp3FnQ.js → landing-BaXkpFip.js} +1 -1
- package/dist/assets/shot-prompt-CbqWcWYi.css +1 -0
- package/dist/assets/shot-prompt-hN0j_O-p.js +17 -0
- package/dist/assets/{ticket-BgIzOBOf.js → ticket-BcmsnHn5.js} +1 -1
- package/dist/assets/workflow-B5XZwVfe.js +179 -0
- package/dist/assets/workflow-DRdwoDBT.css +1 -0
- package/dist/cozyclay-package.json +1 -1
- package/dist/fonts/IBM-Plex-Sans-OFL.txt +92 -0
- package/dist/fonts/JetBrains-Mono-OFL.txt +93 -0
- package/dist/fonts/README.md +13 -9
- package/dist/fonts/ibm-plex-sans-400-latin.woff2 +0 -0
- package/dist/fonts/ibm-plex-sans-500-latin.woff2 +0 -0
- package/dist/fonts/ibm-plex-sans-600-latin.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-400-latin.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-500-latin.woff2 +0 -0
- package/dist/index.html +7 -7
- package/dist/privacy/index.html +13 -8
- package/dist/sitemap.xml +2 -2
- package/dist/workflow/index.html +5 -5
- package/mcp/live-hub.mjs +35 -93
- package/mcp/mesh-file.mjs +48 -0
- package/mcp/server.mjs +6 -77
- package/mcp/tool-handlers.mjs +219 -376
- package/package.json +2 -1
- package/src/App.jsx +1275 -9086
- package/src/analytics.js +393 -9
- package/src/app-context.js +211 -0
- package/src/app-stage.jsx +25 -24
- package/src/ardy/auto-fix-panel.css +108 -0
- package/src/ardy/fix-collisions.js +10 -66
- package/src/ardy/ik-drag.js +101 -0
- package/src/ardy/ik-key-json.js +43 -0
- package/src/ardy/ik.js +97 -67
- package/src/ardy/physics-panel.css +2 -0
- package/src/ardy/physics-panel.jsx +17 -5
- package/src/ardy/platform-fit-panel.css +64 -0
- package/src/ardy/platform-fit-panel.jsx +40 -0
- package/src/ardy/platform-fit.js +326 -0
- package/src/ardy/playback.js +166 -20
- package/src/ardy/range-pin.js +299 -0
- package/src/ardy/timeline-coordinates.js +26 -0
- package/src/ardy/timeline.css +1214 -0
- package/src/ardy/timeline.jsx +152 -41
- package/src/ardy/waypoints.js +3 -3
- package/src/asset-pane.css +462 -0
- package/src/asset-pane.jsx +461 -232
- package/src/camera-tutorial.jsx +38 -18
- package/src/command-bus.js +349 -0
- package/src/commands/ai.js +31 -0
- package/src/commands/cast.js +140 -0
- package/src/commands/elements/character.js +13 -0
- package/src/commands/elements/motion.js +14 -0
- package/src/commands/elements/object.js +22 -0
- package/src/commands/elements/scene.js +16 -0
- package/src/commands/elements/shot.js +9 -0
- package/src/commands/elements/stage.js +11 -0
- package/src/commands/elements.js +155 -0
- package/src/commands/export.js +20 -0
- package/src/commands/index.js +40 -0
- package/src/commands/motion.js +231 -0
- package/src/commands/objects.js +174 -0
- package/src/commands/project.js +53 -0
- package/src/commands/scene.js +81 -0
- package/src/commands/shared.js +19 -0
- package/src/commands/shot.js +103 -0
- package/src/commands/stage.js +17 -0
- package/src/commands/view.js +42 -0
- package/src/document-store.js +144 -0
- package/src/domains/cast.js +1007 -0
- package/src/domains/motion.js +3219 -0
- package/src/domains/objects.js +932 -0
- package/src/domains/scenes.js +823 -0
- package/src/domains/shots.js +404 -0
- package/src/domains/stage.js +93 -0
- package/src/dualview.jsx +113 -57
- package/src/facing-marks.js +3 -0
- package/src/first-success-guide.jsx +14 -14
- package/src/grid-view.js +18 -5
- package/src/hierarchy-panel.css +386 -0
- package/src/hierarchy-panel.jsx +88 -19
- package/src/{fal-motion-client.js → i2v-motion-client.js} +13 -13
- package/src/i2v-motion-studio.jsx +180 -0
- package/src/ik-camera.js +3 -0
- package/src/main.jsx +6 -0
- package/src/motion/generation.js +105 -0
- package/src/motion-readiness-ui.jsx +4 -4
- package/src/motion-readiness.js +11 -0
- package/src/motion-trail.js +366 -9
- package/src/object-gizmo.jsx +7 -1
- package/src/panels/CameraPanel.jsx +60 -0
- package/src/panels/CharacterTransformPanel.jsx +48 -0
- package/src/panels/EnvironmentPanel.jsx +40 -0
- package/src/panels/Foldout.jsx +32 -0
- package/src/panels/LightPanel.jsx +24 -0
- package/src/panels/ObjectTransformPanel.jsx +554 -0
- package/src/panels/PosePanel.jsx +97 -0
- package/src/panels/ProjectPanel.jsx +33 -0
- package/src/panels/PromptBlocksPanel.jsx +442 -0
- package/src/panels/PropsPanel.jsx +70 -0
- package/src/panels/ReferenceImageField.jsx +91 -0
- package/src/panels/RigControlPanel.jsx +78 -0
- package/src/panels/RigPanel.jsx +37 -0
- package/src/panels/SubjectBox.jsx +47 -0
- package/src/panels/SubjectsPanel.jsx +39 -0
- package/src/panels/VideoCapturePanel.jsx +180 -0
- package/src/panels/details.css +1171 -0
- package/src/panels/motion.css +197 -0
- package/src/panels/pose.css +39 -0
- package/src/planview.jsx +60 -31
- package/src/posestudio.jsx +59 -4
- package/src/project-browser.css +1073 -0
- package/src/project-browser.jsx +288 -123
- package/src/range-pin-object-transform.js +19 -0
- package/src/range-pin-panel.css +518 -0
- package/src/range-pin-panel.jsx +344 -0
- package/src/result-modal.jsx +5 -5
- package/src/room.jsx +79 -51
- package/src/scenes.js +9 -8
- package/src/semantic-edit.js +2 -0
- package/src/settings-menu.jsx +39 -105
- package/src/shell/BottomDock.jsx +450 -0
- package/src/shell/DetailsSlot.jsx +513 -0
- package/src/shell/LibrarySlot.jsx +86 -0
- package/src/shell/MenuBar.jsx +601 -0
- package/src/shell/OutlinerSlot.jsx +50 -0
- package/src/shell/PreferencesDialog.jsx +538 -0
- package/src/shell/PreferencesSlot.jsx +40 -0
- package/src/shell/StatusBar.jsx +125 -0
- package/src/shell/StudioShell.jsx +92 -0
- package/src/shell/TopBar.jsx +129 -0
- package/src/shell/ViewportToolbar.jsx +656 -0
- package/src/shell/agent-glass.css +296 -0
- package/src/shell/dock.css +93 -0
- package/src/shell/glass-regions.css +985 -0
- package/src/shell/glass.css +687 -0
- package/src/shell/log-store.js +52 -0
- package/src/shell/mode.css +9 -0
- package/src/shell/preferences.css +651 -0
- package/src/shell/shell.css +282 -0
- package/src/shell/studio-shell-context.js +19 -0
- package/src/shell/topbar.css +435 -0
- package/src/shell/viewport.css +451 -0
- package/src/store/authored-intent.js +22 -0
- package/src/store/runtime-adapters.js +92 -0
- package/src/store/scene-stage.js +21 -0
- package/src/store/use-document-store.js +14 -0
- package/src/studio-actions.js +210 -0
- package/src/studio-agent-commands.js +38 -268
- package/src/studio-agent-context.js +38 -9
- package/src/studio-agent-motion.js +122 -378
- package/src/studio-agent-protocol.js +66 -30
- package/src/studio-app-binding.js +379 -0
- package/src/studio-contact-sheet.js +73 -0
- package/src/studio-elements.js +58 -51
- package/src/styles/themes.css +200 -0
- package/src/styles/tokens.css +69 -0
- package/src/styles.css +456 -1748
- package/src/theme.js +44 -0
- package/src/timeline-extent.js +16 -0
- package/src/timeline-fps.js +13 -0
- package/src/trail-key-conflicts.js +39 -0
- package/src/trail-pick.js +59 -0
- package/src/ui.jsx +8 -8
- package/src/use-case-question.jsx +66 -0
- package/src/workflow/AgentPanel.jsx +86 -71
- package/src/workflow/agent-client.js +12 -2
- package/src/workflow/agent-panel.css +34 -32
- package/src/workflow/cozy-scene-node.css +2 -0
- package/src/workflow/workflow.css +2 -0
- package/tools/ardy/bridge.mjs +164 -146
- package/tools/ardy/visual-qa.mjs +5 -5
- package/tools/bench/EXP3.md +61 -0
- package/tools/bench/cclay_bench_extract_incam.py +125 -0
- package/tools/bench/cclay_bench_extract_obs.py +204 -0
- package/tools/bench/cclay_bench_runner.py +42 -0
- package/tools/bench/cube-contact.mjs +162 -0
- package/tools/bench/exp3.mjs +152 -0
- package/tools/bench/extract-bench-lib.mjs +216 -0
- package/tools/bench/extract-bench.mjs +302 -0
- package/tools/bench/fal-generate.mjs +88 -0
- package/tools/bench/fit/README.md +189 -0
- package/tools/bench/fit/camera.mjs +59 -0
- package/tools/bench/fit/contact.mjs +419 -0
- package/tools/bench/fit/footlock.mjs +234 -0
- package/tools/bench/fit/motion.mjs +85 -0
- package/tools/bench/fit/pin.mjs +27 -0
- package/tools/bench/fit/remote.mjs +105 -0
- package/tools/bench/fit-bench.mjs +126 -0
- package/tools/bench/fit-sanity.mjs +45 -0
- package/tools/bench/metrics.mjs +313 -0
- package/tools/bench/obs/depth.mjs +258 -0
- package/tools/bench/obs/extrinsics.mjs +175 -0
- package/tools/bench/obs/fit_mannequin_betas.py +340 -0
- package/tools/bench/obs/ground.mjs +294 -0
- package/tools/bench/obs/heading.mjs +151 -0
- package/tools/bench/obs/ladder.mjs +555 -0
- package/tools/bench/obs/mannequin-betas.json +124 -0
- package/tools/bench/obs/remote.mjs +83 -0
- package/tools/bench/obs/rest_joints.py +52 -0
- package/tools/bench/obs/ybot-targets.mjs +49 -0
- package/tools/bench/obs-bench.mjs +520 -0
- package/tools/bench/score.mjs +343 -0
- package/tools/bench/summarize.mjs +86 -0
- package/tools/dev/pages/privacy.html +13 -8
- package/tools/gt-render/browser.mjs +159 -0
- package/tools/gt-render/camera-math.mjs +276 -0
- package/tools/gt-render/page.mjs +267 -0
- package/tools/gt-render/render.mjs +514 -0
- package/tools/gt-render/scene-box.mjs +31 -0
- package/tools/gt-render/take-transform.mjs +87 -0
- package/tools/qa/css-rule-usage.mjs +283 -0
- package/tools/qa/studio-control-count.mjs +70 -32
- package/tools/run-tests.mjs +60 -3
- package/tools/track/DESIGN.md +513 -0
- package/tools/track/backfill-provenance.mjs +116 -0
- package/tools/track/budget.mjs +8 -0
- package/tools/track/check-rig.mjs +209 -0
- package/tools/track/diagnostics.schema.json +60 -0
- package/tools/track/export-rig.mjs +256 -0
- package/tools/track/fallback.mjs +7 -0
- package/tools/track/fk-parity-fixture.mjs +161 -0
- package/tools/track/gate.mjs +349 -0
- package/tools/track/masks.mjs +318 -0
- package/tools/track/metrics.mjs +201 -0
- package/tools/track/publish-obs.mjs +108 -0
- package/tools/track/py/check_env.py +61 -0
- package/tools/track/py/eval_lr.py +229 -0
- package/tools/track/py/lr_viterbi.py +294 -0
- package/tools/track/py/masks.py +405 -0
- package/tools/track/py/objective.py +382 -0
- package/tools/track/py/rig.py +508 -0
- package/tools/track/py/scene.py +326 -0
- package/tools/track/py/test_joint_indices.py +123 -0
- package/tools/track/py/test_lr_viterbi.py +195 -0
- package/tools/track/py/test_masks.py +229 -0
- package/tools/track/py/test_rig.py +288 -0
- package/tools/track/py/test_scene.py +354 -0
- package/tools/track/py/test_track.py +328 -0
- package/tools/track/py/track.py +411 -0
- package/tools/track/remote.mjs +140 -0
- package/tools/track/rig-dump.mjs +227 -0
- package/tools/track/run-box-tests.mjs +14 -0
- package/tools/track/run-box.mjs +168 -0
- package/tools/track/setup-box.sh +59 -0
- package/tools/track/study-2d.mjs +728 -0
- package/dist/assets/analytics-B1hnH66c.js +0 -1
- package/dist/assets/app-Cu1cexZR.css +0 -1
- package/dist/assets/app-Dxdh8kds.js +0 -4861
- package/dist/assets/shot-prompt-C_g2BHVc.css +0 -1
- package/dist/assets/shot-prompt-HVJRP4Gr.js +0 -17
- package/dist/assets/workflow-CJd-PDtV.js +0 -179
- package/dist/assets/workflow-DsudxKHF.css +0 -1
- package/src/fal-motion-studio.jsx +0 -180
- package/src/scene-history.js +0 -129
- package/tools/ardy/__pycache__/cclay_gvhmr_worker.cpython-313.pyc +0 -0
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{E as n,M as r,f as i,g as a,i as o,j as s,n as c,o as l,r as u,t as d}from"./analytics-B1hnH66c.js";var f=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function te(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function ne(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function re(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,re(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+te(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),re(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+te(a,u),c+=re(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+te(a,u++),c+=re(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return re(ne(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ie(e,t,n){if(e==null)return e;var r=[],i=0;return re(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ae(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var A=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},j={map:ie,forEach:function(e,t,n){ie(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ie(e,function(){t++}),t},toArray:function(e){return ie(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=j,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ae}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,A)}catch(e){A(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),p=t(((e,t)=>{t.exports=f()})),m=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&te(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&te(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,k=ee.port2;ee.port1.onmessage=D,O=function(){k.postMessage(null)}}else O=function(){_(D,0)};function te(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,te(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),h=t(((e,t)=>{t.exports=m()})),g=t((e=>{var t=p();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),_=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=t((e=>{var t=h(),n=p(),r=_();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,m=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),te=Symbol.iterator;function ne(e){return typeof e!=`object`||!e?null:(e=te&&e[te]||e[`@@iterator`],typeof e==`function`?e:null)}var re=Symbol.for(`react.client.reference`);function ie(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===re?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?ie(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var ae=Array.isArray,A=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},se=[],ce=-1;function le(e){return{current:e}}function ue(e){0>ce||(e.current=se[ce],se[ce]=null,ce--)}function de(e,t){ce++,se[ce]=e.current,e.current=t}var fe=le(null),pe=le(null),me=le(null),he=le(null);function ge(e,t){switch(de(me,t),de(pe,e),de(fe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Xd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Xd(t),e=Zd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ue(fe),de(fe,e)}function _e(){ue(fe),ue(pe),ue(me)}function ve(e){e.memoizedState!==null&&de(he,e);var t=fe.current,n=Zd(t,e.type);t!==n&&(de(pe,e),de(fe,n))}function ye(e){pe.current===e&&(ue(fe),ue(pe)),he.current===e&&(ue(he),G._currentValue=oe)}var be,xe;function Se(e){if(be===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);be=t&&t[1]||``,xe=-1<e.stack.indexOf(`
|
|
2
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
-
`+be+e+xe}var Ce=!1;function we(e,t){if(!e||Ce)return``;Ce=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
|
-
`),l=s.split(`
|
|
5
|
-
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
-
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ce=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Se(n):``}function Te(e,t){switch(e.tag){case 26:case 27:case 5:return Se(e.type);case 16:return Se(`Lazy`);case 13:return e.child!==t&&t!==null?Se(`Suspense Fallback`):Se(`Suspense`);case 19:return Se(`SuspenseList`);case 0:case 15:return we(e.type,!1);case 11:return we(e.type.render,!1);case 1:return we(e.type,!0);case 31:return Se(`Activity`);default:return``}}function Ee(e){try{var t=``,n=null;do t+=Te(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
-
Error generating stack: `+e.message+`
|
|
8
|
-
`+e.stack}}var De=Object.prototype.hasOwnProperty,Oe=t.unstable_scheduleCallback,ke=t.unstable_cancelCallback,Ae=t.unstable_shouldYield,je=t.unstable_requestPaint,Me=t.unstable_now,Ne=t.unstable_getCurrentPriorityLevel,Pe=t.unstable_ImmediatePriority,Fe=t.unstable_UserBlockingPriority,Ie=t.unstable_NormalPriority,Le=t.unstable_LowPriority,Re=t.unstable_IdlePriority,ze=t.log,Be=t.unstable_setDisableYieldValue,Ve=null,He=null;function Ue(e){if(typeof ze==`function`&&Be(e),He&&typeof He.setStrictMode==`function`)try{He.setStrictMode(Ve,e)}catch{}}var We=Math.clz32?Math.clz32:qe,Ge=Math.log,Ke=Math.LN2;function qe(e){return e>>>=0,e===0?32:31-(Ge(e)/Ke|0)|0}var Je=256,Ye=262144,Xe=4194304;function Ze(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Qe(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ze(n))):i=Ze(o):i=Ze(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ze(n))):i=Ze(o)):i=Ze(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function $e(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function et(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function tt(){var e=Xe;return Xe<<=1,!(Xe&62914560)&&(Xe=4194304),e}function nt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function rt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function it(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-We(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&at(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function at(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-We(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ot(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-We(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function st(e,t){var n=t&-t;return n=n&42?1:ct(n),(n&(e.suspendedLanes|t))===0?n:0}function ct(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function lt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ut(){var e=j.p;return e===0?(e=window.event,e===void 0?32:xp(e.type)):e}function dt(e,t){var n=j.p;try{return j.p=e,t()}finally{j.p=n}}var ft=Math.random().toString(36).slice(2),pt=`__reactFiber$`+ft,mt=`__reactProps$`+ft,ht=`__reactContainer$`+ft,gt=`__reactEvents$`+ft,_t=`__reactListeners$`+ft,vt=`__reactHandles$`+ft,yt=`__reactResources$`+ft,bt=`__reactMarker$`+ft;function xt(e){delete e[pt],delete e[mt],delete e[gt],delete e[_t],delete e[vt]}function St(e){var t=e[pt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ht]||n[pt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=bf(e);e!==null;){if(n=e[pt])return n;e=bf(e)}return t}e=n,n=e.parentNode}return null}function Ct(e){if(e=e[pt]||e[ht]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Tt(e){var t=e[yt];return t||=e[yt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Et(e){e[bt]=!0}var Dt=new Set,Ot={};function kt(e,t){At(e,t),At(e+`Capture`,t)}function At(e,t){for(Ot[e]=t,e=0;e<t.length;e++)Dt.add(t[e])}var jt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Mt={},Nt={};function Pt(e){return De.call(Nt,e)?!0:De.call(Mt,e)?!1:jt.test(e)?Nt[e]=!0:(Mt[e]=!0,!1)}function Ft(e,t,n){if(Pt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function It(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Lt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Rt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function zt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Bt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Vt(e){if(!e._valueTracker){var t=zt(e)?`checked`:`value`;e._valueTracker=Bt(e,t,``+e[t])}}function Ht(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=zt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Ut(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Wt=/[\n"\\]/g;function Gt(e){return e.replace(Wt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Kt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Rt(t)):e.value!==``+Rt(t)&&(e.value=``+Rt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Jt(e,o,Rt(n)):Jt(e,o,Rt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Rt(s):e.removeAttribute(`name`)}function qt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Vt(e);return}n=n==null?``:``+Rt(n),t=t==null?n:``+Rt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Vt(e)}function Jt(e,t,n){t===`number`&&Ut(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Yt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Rt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Xt(e,t,n){if(t!=null&&(t=``+Rt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Rt(n)}function Zt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ae(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Rt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Vt(e)}function Qt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var $t=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function en(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||$t.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function tn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&en(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&en(e,o,t[o])}function nn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var rn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),an=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function on(e){return an.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function sn(){}var cn=null;function ln(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var un=null,dn=null;function fn(e){var t=Ct(e);if(t&&(e=t.stateNode)){var n=e[mt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Kt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Gt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[mt]||null;if(!a)throw Error(i(90));Kt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Ht(r)}break a;case`textarea`:Xt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Yt(e,!!n.multiple,t,!1)}}}var M=!1;function pn(e,t,n){if(M)return e(t,n);M=!0;try{return e(t)}finally{if(M=!1,(un!==null||dn!==null)&&(Du(),un&&(t=un,e=dn,dn=un=null,fn(t),e)))for(t=0;t<e.length;t++)fn(e[t])}}function mn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[mt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var hn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),gn=!1;if(hn)try{var _n={};Object.defineProperty(_n,"passive",{get:function(){gn=!0}}),window.addEventListener(`test`,_n,_n),window.removeEventListener(`test`,_n,_n)}catch{gn=!1}var vn=null,yn=null,bn=null;function xn(){if(bn)return bn;var e,t=yn,n=t.length,r,i=`value`in vn?vn.value:vn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return bn=i.slice(e,1<r?1-r:void 0)}function Sn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function N(){return!0}function Cn(){return!1}function wn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?N:Cn,this.isPropagationStopped=Cn,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=N)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=N)},persist:function(){},isPersistent:N}),t}var Tn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},En=wn(Tn),Dn=f({},Tn,{view:0,detail:0}),On=wn(Dn),kn,An,jn,Mn=f({},Dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Hn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==jn&&(jn&&e.type===`mousemove`?(kn=e.screenX-jn.screenX,An=e.screenY-jn.screenY):An=kn=0,jn=e),kn)},movementY:function(e){return`movementY`in e?e.movementY:An}}),Nn=wn(Mn),Pn=wn(f({},Mn,{dataTransfer:0})),Fn=wn(f({},Dn,{relatedTarget:0})),In=wn(f({},Tn,{animationName:0,elapsedTime:0,pseudoElement:0})),Ln=wn(f({},Tn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Rn=wn(f({},Tn,{data:0})),zn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Bn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Vn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function P(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vn[e])?!!t[e]:!1}function Hn(){return P}var F=wn(f({},Dn,{key:function(e){if(e.key){var t=zn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Sn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Bn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Hn,charCode:function(e){return e.type===`keypress`?Sn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Sn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Un=wn(f({},Mn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),I=wn(f({},Dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Hn})),Wn=wn(f({},Tn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Gn=wn(f({},Mn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Kn=wn(f({},Tn,{newState:0,oldState:0})),qn=[9,13,27,32],Jn=hn&&`CompositionEvent`in window,Yn=null;hn&&`documentMode`in document&&(Yn=document.documentMode);var Xn=hn&&`TextEvent`in window&&!Yn,Zn=hn&&(!Jn||Yn&&8<Yn&&11>=Yn),Qn=` `,$n=!1;function er(e,t){switch(e){case`keyup`:return qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var nr=!1;function rr(e,t){switch(e){case`compositionend`:return tr(t);case`keypress`:return t.which===32?($n=!0,Qn):null;case`textInput`:return e=t.data,e===Qn&&$n?null:e;default:return null}}function ir(e,t){if(nr)return e===`compositionend`||!Jn&&er(e,t)?(e=xn(),bn=yn=vn=null,nr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Zn&&t.locale!==`ko`?null:t.data;default:return null}}var ar={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ar[e.type]:t===`textarea`}function sr(e,t,n,r){un?dn?dn.push(r):dn=[r]:un=r,t=Pd(t,`onChange`),0<t.length&&(n=new En(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var cr=null,lr=null;function ur(e){Dd(e,0)}function dr(e){if(Ht(wt(e)))return e}function fr(e,t){if(e===`change`)return t}var pr=!1;if(hn){var mr;if(hn){var L=`oninput`in document;if(!L){var hr=document.createElement(`div`);hr.setAttribute(`oninput`,`return;`),L=typeof hr.oninput==`function`}mr=L}else mr=!1;pr=mr&&(!document.documentMode||9<document.documentMode)}function gr(){cr&&(cr.detachEvent(`onpropertychange`,_r),lr=cr=null)}function _r(e){if(e.propertyName===`value`&&dr(lr)){var t=[];sr(t,lr,e,ln(e)),pn(ur,t)}}function vr(e,t,n){e===`focusin`?(gr(),cr=t,lr=n,cr.attachEvent(`onpropertychange`,_r)):e===`focusout`&&gr()}function yr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return dr(lr)}function br(e,t){if(e===`click`)return dr(t)}function xr(e,t){if(e===`input`||e===`change`)return dr(t)}function Sr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Cr=typeof Object.is==`function`?Object.is:Sr;function wr(e,t){if(Cr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!De.call(t,i)||!Cr(e[i],t[i]))return!1}return!0}function Tr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Er(e,t){var n=Tr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Tr(n)}}function Dr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Or(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ut(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ut(e.document)}return t}function kr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Ar=hn&&`documentMode`in document&&11>=document.documentMode,jr=null,Mr=null,Nr=null,Pr=!1;function Fr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pr||jr==null||jr!==Ut(r)||(r=jr,`selectionStart`in r&&kr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Nr&&wr(Nr,r)||(Nr=r,r=Pd(Mr,`onSelect`),0<r.length&&(t=new En(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=jr)))}function Ir(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Lr={animationend:Ir(`Animation`,`AnimationEnd`),animationiteration:Ir(`Animation`,`AnimationIteration`),animationstart:Ir(`Animation`,`AnimationStart`),transitionrun:Ir(`Transition`,`TransitionRun`),transitionstart:Ir(`Transition`,`TransitionStart`),transitioncancel:Ir(`Transition`,`TransitionCancel`),transitionend:Ir(`Transition`,`TransitionEnd`)},Rr={},zr={};hn&&(zr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Lr.animationend.animation,delete Lr.animationiteration.animation,delete Lr.animationstart.animation),`TransitionEvent`in window||delete Lr.transitionend.transition);function Br(e){if(Rr[e])return Rr[e];if(!Lr[e])return e;var t=Lr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in zr)return Rr[e]=t[n];return e}var Vr=Br(`animationend`),Hr=Br(`animationiteration`),Ur=Br(`animationstart`),Wr=Br(`transitionrun`),Gr=Br(`transitionstart`),Kr=Br(`transitioncancel`),qr=Br(`transitionend`),Jr=new Map,R=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);R.push(`scrollEnd`);function Yr(e,t){Jr.set(e,t),kt(t,[e])}var Xr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Zr=[],Qr=0,$r=0;function ei(){for(var e=Qr,t=$r=Qr=0;t<e;){var n=Zr[t];Zr[t++]=null;var r=Zr[t];Zr[t++]=null;var i=Zr[t];Zr[t++]=null;var a=Zr[t];if(Zr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ii(n,i,a)}}function ti(e,t,n,r){Zr[Qr++]=e,Zr[Qr++]=t,Zr[Qr++]=n,Zr[Qr++]=r,$r|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ni(e,t,n,r){return ti(e,t,n,r),ai(e)}function ri(e,t){return ti(e,null,null,t),ai(e)}function ii(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-We(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ai(e){if(50<vu)throw vu=0,yu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var oi={};function si(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ci(e,t,n,r){return new si(e,t,n,r)}function li(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ui(e,t){var n=e.alternate;return n===null?(n=ci(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function di(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function fi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)li(e)&&(s=1);else if(typeof e==`string`)s=Qf(e,n,fe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ee:return e=ci(31,n,t,a),e.elementType=ee,e.lanes=o,e;case y:return pi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ci(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ci(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ci(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ci(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function pi(e,t,n,r){return e=ci(7,e,r,t),e.lanes=n,e}function mi(e,t,n){return e=ci(6,e,null,t),e.lanes=n,e}function hi(e){var t=ci(18,null,null,0);return t.stateNode=e,t}function gi(e,t,n){return t=ci(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var _i=new WeakMap;function vi(e,t){if(typeof e==`object`&&e){var n=_i.get(e);return n===void 0?(t={value:e,source:t,stack:Ee(t)},_i.set(e,t),t):n}return{value:e,source:t,stack:Ee(t)}}var yi=[],bi=0,xi=null,Si=0,Ci=[],wi=0,Ti=null,Ei=1,Di=``;function Oi(e,t){yi[bi++]=Si,yi[bi++]=xi,xi=e,Si=t}function ki(e,t,n){Ci[wi++]=Ei,Ci[wi++]=Di,Ci[wi++]=Ti,Ti=e;var r=Ei;e=Di;var i=32-We(r)-1;r&=~(1<<i),n+=1;var a=32-We(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ei=1<<32-We(t)+i|n<<i|r,Di=a+e}else Ei=1<<a|n<<i|r,Di=e}function Ai(e){e.return!==null&&(Oi(e,1),ki(e,1,0))}function ji(e){for(;e===xi;)xi=yi[--bi],yi[bi]=null,Si=yi[--bi],yi[bi]=null;for(;e===Ti;)Ti=Ci[--wi],Ci[wi]=null,Di=Ci[--wi],Ci[wi]=null,Ei=Ci[--wi],Ci[wi]=null}function Mi(e,t){Ci[wi++]=Ei,Ci[wi++]=Di,Ci[wi++]=Ti,Ei=t.id,Di=t.overflow,Ti=e}var Ni=null,Pi=null,Fi=!1,Ii=null,Li=!1,Ri=Error(i(519));function zi(e){throw z(vi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ri}function Bi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[pt]=e,t[mt]=r,n){case`dialog`:W(`cancel`,t),W(`close`,t);break;case`iframe`:case`object`:case`embed`:W(`load`,t);break;case`video`:case`audio`:for(n=0;n<Td.length;n++)W(Td[n],t);break;case`source`:W(`error`,t);break;case`img`:case`image`:case`link`:W(`error`,t),W(`load`,t);break;case`details`:W(`toggle`,t);break;case`input`:W(`invalid`,t),qt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:W(`invalid`,t);break;case`textarea`:W(`invalid`,t),Zt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Bd(t.textContent,n)?(r.popover!=null&&(W(`beforetoggle`,t),W(`toggle`,t)),r.onScroll!=null&&W(`scroll`,t),r.onScrollEnd!=null&&W(`scrollend`,t),r.onClick!=null&&(t.onclick=sn),t=!0):t=!1,t||zi(e,!0)}function Vi(e){for(Ni=e.return;Ni;)switch(Ni.tag){case 5:case 31:case 13:Li=!1;return;case 27:case 3:Li=!0;return;default:Ni=Ni.return}}function Hi(e){if(e!==Ni)return!1;if(!Fi)return Vi(e),Fi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Qd(e.type,e.memoizedProps)),n=!n),n&&Pi&&zi(e),Vi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Pi=yf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Pi=yf(e)}else t===27?(t=Pi,sf(e.type)?(e=vf,vf=null,Pi=e):Pi=t):Pi=Ni?_f(e.stateNode.nextSibling):null;return!0}function Ui(){Pi=Ni=null,Fi=!1}function Wi(){var e=Ii;return e!==null&&(iu===null?iu=e:iu.push.apply(iu,e),Ii=null),e}function z(e){Ii===null?Ii=[e]:Ii.push(e)}var Gi=le(null),Ki=null,qi=null;function Ji(e,t,n){de(Gi,t._currentValue),t._currentValue=n}function Yi(e){e._currentValue=Gi.current,ue(Gi)}function Xi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Zi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Xi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Xi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Qi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Cr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===he.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[G]:e.push(G))}a=a.return}e!==null&&Zi(t,e,n,r),t.flags|=262144}function $i(e){for(e=e.firstContext;e!==null;){if(!Cr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ea(e){Ki=e,qi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ta(e){return na(Ki,e)}function B(e,t){return Ki===null&&ea(e),na(e,t)}function na(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},qi===null){if(e===null)throw Error(i(308));qi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else qi=qi.next=t;return n}var ra=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ia=t.unstable_scheduleCallback,aa=t.unstable_NormalPriority,oa={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function sa(){return{controller:new ra,data:new Map,refCount:0}}function ca(e){e.refCount--,e.refCount===0&&ia(aa,function(){e.controller.abort()})}var la=null,ua=0,da=0,fa=null;function pa(e,t){if(la===null){var n=la=[];ua=0,da=yd(),fa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ua++,t.then(ma,ma),t}function ma(){if(--ua===0&&la!==null){fa!==null&&(fa.status=`fulfilled`);var e=la;la=null,da=0,fa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ha(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ga=A.S;A.S=function(e,t){su=Me(),typeof t==`object`&&t&&typeof t.then==`function`&&pa(e,t),ga!==null&&ga(e,t)};var _a=le(null);function va(){var e=_a.current;return e===null?Wl.pooledCache:e}function ya(e,t){t===null?de(_a,_a.current):de(_a,t.pool)}function ba(){var e=va();return e===null?null:{parent:oa._currentValue,pool:e}}var xa=Error(i(460)),Sa=Error(i(474)),Ca=Error(i(542)),wa={then:function(){}};function Ta(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ea(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(sn,sn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Aa(e),e;default:if(typeof t.status==`string`)t.then(sn,sn);else{if(e=Wl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Aa(e),e}throw Oa=t,xa}}function Da(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Oa=e,xa):e}}var Oa=null;function ka(){if(Oa===null)throw Error(i(459));var e=Oa;return Oa=null,e}function Aa(e){if(e===xa||e===Ca)throw Error(i(483))}var ja=null,Ma=0;function Na(e){var t=Ma;return Ma+=1,ja===null&&(ja=[]),Ea(ja,e,t)}function Pa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Fa(e,t){throw t.$$typeof===m?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ia(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ui(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=mi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Da(i)===t.type)?(t=a(t,n.props),Pa(t,n),t.return=e,t):(t=fi(n.type,n.key,n.props,null,e.mode,r),Pa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=gi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=pi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case g:return n=fi(t.type,t.key,t.props,null,e.mode,n),Pa(n,t),n.return=e,n;case v:return t=gi(t,e.mode,n),t.return=e,t;case O:return t=Da(t),f(e,t,n)}if(ae(t)||ne(t))return t=pi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Na(t),n);if(t.$$typeof===C)return f(e,B(e,t),n);Fa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case g:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Da(n),p(e,t,n,r)}if(ae(n)||ne(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Na(n),r);if(n.$$typeof===C)return p(e,t,B(e,n),r);Fa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case g:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Da(r),m(e,t,n,r,i)}if(ae(r)||ne(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Na(r),i);if(r.$$typeof===C)return m(e,t,n,B(t,r),i);Fa(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Fi&&Oi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Fi&&Oi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Fi&&Oi(i,h),l}function _(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Fi&&Oi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Fi&&Oi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Fi&&Oi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case g:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Da(l)===r.type){n(e,r.sibling),c=a(r,o.props),Pa(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=pi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=fi(o.type,o.key,o.props,null,e.mode,c),Pa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}t(e,r),r=r.sibling}c=gi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Da(o),b(e,r,o,c)}if(ae(o))return h(e,r,o,c);if(ne(o)){if(l=ne(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),_(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Na(o),c);if(o.$$typeof===C)return b(e,r,B(e,o),c);Fa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ma=0;var i=b(e,t,n,r);return ja=null,i}catch(t){if(t===xa||t===Ca)throw t;var a=ci(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var La=Ia(!0),Ra=Ia(!1),za=!1;function Ba(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Va(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ha(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ua(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ul&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ai(e),ii(e,null,n),t}return ti(e,r,t,n),ai(e)}function Wa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ot(e,n)}}function Ga(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ka=!1;function qa(){if(Ka){var e=fa;if(e!==null)throw e}}function Ja(e,t,n,r){Ka=!1;var i=e.updateQueue;za=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(U&p)===p:(r&p)===p){p!==0&&p===da&&(Ka=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:za=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ql|=o,e.lanes=o,e.memoizedState=d}}function Ya(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Xa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ya(n[e],t)}var Za=le(null),Qa=le(0);function $a(e,t){e=Xl,de(Qa,e),de(Za,t),Xl=e|t.baseLanes}function eo(){de(Qa,Xl),de(Za,Za.current)}function to(){Xl=Qa.current,ue(Za),ue(Qa)}var no=le(null),ro=null;function io(e){var t=e.alternate;de(lo,lo.current&1),de(no,e),ro===null&&(t===null||Za.current!==null||t.memoizedState!==null)&&(ro=e)}function ao(e){de(lo,lo.current),de(no,e),ro===null&&(ro=e)}function oo(e){e.tag===22?(de(lo,lo.current),de(no,e),ro===null&&(ro=e)):so(e)}function so(){de(lo,lo.current),de(no,no.current)}function co(e){ue(no),ro===e&&(ro=null),ue(lo)}var lo=le(0);function uo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||mf(n)||hf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var fo=0,V=null,po=null,mo=null,ho=!1,go=!1,_o=!1,vo=0,yo=0,bo=null,xo=0;function So(){throw Error(i(321))}function Co(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Cr(e[n],t[n]))return!1;return!0}function wo(e,t,n,r,i,a){return fo=a,V=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Vs:Hs,_o=!1,a=n(r,i),_o=!1,go&&(a=Eo(t,n,r,i)),To(e),a}function To(e){A.H=Bs;var t=po!==null&&po.next!==null;if(fo=0,mo=po=V=null,ho=!1,yo=0,bo=null,t)throw Error(i(300));e===null||ac||(e=e.dependencies,e!==null&&$i(e)&&(ac=!0))}function Eo(e,t,n,r){V=e;var a=0;do{if(go&&(bo=null),yo=0,go=!1,25<=a)throw Error(i(301));if(a+=1,mo=po=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}A.H=Us,o=t(n,r)}while(go);return o}function Do(){var e=A.H,t=e.useState()[0];return t=typeof t.then==`function`?Po(t):t,e=e.useState()[0],(po===null?null:po.memoizedState)!==e&&(V.flags|=1024),t}function Oo(){var e=vo!==0;return vo=0,e}function ko(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Ao(e){if(ho){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ho=!1}fo=0,mo=po=V=null,go=!1,yo=vo=0,bo=null}function jo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mo===null?V.memoizedState=mo=e:mo=mo.next=e,mo}function Mo(){if(po===null){var e=V.alternate;e=e===null?null:e.memoizedState}else e=po.next;var t=mo===null?V.memoizedState:mo.next;if(t!==null)mo=t,po=e;else{if(e===null)throw V.alternate===null?Error(i(467)):Error(i(310));po=e,e={memoizedState:po.memoizedState,baseState:po.baseState,baseQueue:po.baseQueue,queue:po.queue,next:null},mo===null?V.memoizedState=mo=e:mo=mo.next=e}return mo}function No(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Po(e){var t=yo;return yo+=1,bo===null&&(bo=[]),e=Ea(bo,e,t),t=V,(mo===null?t.memoizedState:mo.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Vs:Hs),e}function Fo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Po(e);if(e.$$typeof===C)return ta(e)}throw Error(i(438,String(e)))}function Io(e){var t=null,n=V.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=V.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=No(),V.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=k;return t.index++,n}function Lo(e,t){return typeof t==`function`?t(e):t}function Ro(e){return zo(Mo(),po,e)}function zo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(fo&f)===f:(U&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===da&&(d=!0);else if((fo&p)===p){u=u.next,p===da&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,V.lanes|=p,Ql|=p;f=u.action,_o&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,V.lanes|=f,Ql|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Cr(o,e.memoizedState)&&(ac=!0,d&&(n=fa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Bo(e){var t=Mo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Cr(o,t.memoizedState)||(ac=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Vo(e,t,n){var r=V,a=Mo(),o=Fi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Cr((po||a).memoizedState,n);if(s&&(a.memoizedState=n,ac=!0),a=a.queue,fs(Wo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||mo!==null&&mo.memoizedState.tag&1){if(r.flags|=2048,ss(9,{destroy:void 0},Uo.bind(null,r,a,n,t),null),Wl===null)throw Error(i(349));o||fo&127||Ho(r,t,n)}return n}function Ho(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=V.updateQueue,t===null?(t=No(),V.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Uo(e,t,n,r){t.value=n,t.getSnapshot=r,Go(t)&&Ko(e)}function Wo(e,t,n){return n(function(){Go(t)&&Ko(e)})}function Go(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Cr(e,n)}catch{return!0}}function Ko(e){var t=ri(e,2);t!==null&&Su(t,e,2)}function qo(e){var t=jo();if(typeof e==`function`){var n=e;if(e=n(),_o){Ue(!0);try{n()}finally{Ue(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:e},t}function Jo(e,t,n,r){return e.baseState=n,zo(e,po,typeof r==`function`?r:Lo)}function Yo(e,t,n,r,a){if(Ls(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};A.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Xo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Xo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=A.T,o={};A.T=o;try{var s=n(i,r),c=A.S;c!==null&&c(o,s),Zo(e,t,s)}catch(n){$o(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),A.T=a}}else try{a=n(i,r),Zo(e,t,a)}catch(n){$o(e,t,n)}}function Zo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Qo(e,t,n)},function(n){return $o(e,t,n)}):Qo(e,t,n)}function Qo(e,t,n){t.status=`fulfilled`,t.value=n,es(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Xo(e,n)))}function $o(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,es(t),t=t.next;while(t!==r)}e.action=null}function es(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ts(e,t){return t}function ns(e,t){if(Fi){var n=Wl.formState;if(n!==null){a:{var r=V;if(Fi){if(Pi){b:{for(var i=Pi,a=Li;i.nodeType!==8;){if(!a){i=null;break b}if(i=_f(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Pi=_f(i.nextSibling),r=i.data===`F!`;break a}}zi(r)}r=!1}r&&(t=n[0])}}return n=jo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ts,lastRenderedState:t},n.queue=r,n=Ps.bind(null,V,r),r.dispatch=n,r=qo(!1),a=Is.bind(null,V,!1,r.queue),r=jo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Yo.bind(null,V,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function rs(e){return is(Mo(),po,e)}function is(e,t,n){if(t=zo(e,t,ts)[0],e=Ro(Lo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Po(t)}catch(e){throw e===xa?Ca:e}else r=t;t=Mo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(V.flags|=2048,ss(9,{destroy:void 0},as.bind(null,i,n),null)),[r,a,e]}function as(e,t){e.action=t}function os(e){var t=Mo(),n=po;if(n!==null)return is(t,n,e);Mo(),t=t.memoizedState,n=Mo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ss(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=V.updateQueue,t===null&&(t=No(),V.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function cs(){return Mo().memoizedState}function ls(e,t,n,r){var i=jo();V.flags|=e,i.memoizedState=ss(1|t,{destroy:void 0},n,r===void 0?null:r)}function us(e,t,n,r){var i=Mo();r=r===void 0?null:r;var a=i.memoizedState.inst;po!==null&&r!==null&&Co(r,po.memoizedState.deps)?i.memoizedState=ss(t,a,n,r):(V.flags|=e,i.memoizedState=ss(1|t,a,n,r))}function ds(e,t){ls(8390656,8,e,t)}function fs(e,t){us(2048,8,e,t)}function ps(e){V.flags|=4;var t=V.updateQueue;if(t===null)t=No(),V.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ms(e){var t=Mo().memoizedState;return ps({ref:t,nextImpl:e}),function(){if(Ul&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function hs(e,t){return us(4,2,e,t)}function gs(e,t){return us(4,4,e,t)}function _s(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function vs(e,t,n){n=n==null?null:n.concat([e]),us(4,4,_s.bind(null,t,e),n)}function ys(){}function bs(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Co(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function xs(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Co(t,r[1]))return r[0];if(r=e(),_o){Ue(!0);try{e()}finally{Ue(!1)}}return n.memoizedState=[r,t],r}function Ss(e,t,n){return n===void 0||fo&1073741824&&!(U&261930)?e.memoizedState=t:(e.memoizedState=n,e=xu(),V.lanes|=e,Ql|=e,n)}function Cs(e,t,n,r){return Cr(n,t)?n:Za.current===null?!(fo&42)||fo&1073741824&&!(U&261930)?(ac=!0,e.memoizedState=n):(e=xu(),V.lanes|=e,Ql|=e,t):(e=Ss(e,n,r),Cr(e,t)||(ac=!0),e)}function ws(e,t,n,r,i){var a=j.p;j.p=a!==0&&8>a?a:8;var o=A.T,s={};A.T=s,Is(e,!1,t,n);try{var c=i(),l=A.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Fs(e,t,ha(c,r),bu(e)):Fs(e,t,r,bu(e))}catch(n){Fs(e,t,{then:function(){},status:`rejected`,reason:n},bu())}finally{j.p=a,o!==null&&s.types!==null&&(o.types=s.types),A.T=o}}function Ts(){}function Es(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ds(e).queue;ws(e,a,t,oe,n===null?Ts:function(){return Os(e),n(r)})}function Ds(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:oe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Os(e){var t=Ds(e);t.next===null&&(t=e.alternate.memoizedState),Fs(e,t.next.queue,{},bu())}function ks(){return ta(G)}function As(){return Mo().memoizedState}function js(){return Mo().memoizedState}function Ms(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=bu();e=Ha(n);var r=Ua(t,e,n);r!==null&&(Su(r,t,n),Wa(r,t,n)),t={cache:sa()},e.payload=t;return}t=t.return}}function Ns(e,t,n){var r=bu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ls(e)?Rs(t,n):(n=ni(e,t,n,r),n!==null&&(Su(n,e,r),zs(n,t,r)))}function Ps(e,t,n){Fs(e,t,n,bu())}function Fs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ls(e))Rs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Cr(s,o))return ti(e,t,i,0),Wl===null&&ei(),!1}catch{}if(n=ni(e,t,i,r),n!==null)return Su(n,e,r),zs(n,t,r),!0}return!1}function Is(e,t,n,r){if(r={lane:2,revertLane:yd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ls(e)){if(t)throw Error(i(479))}else t=ni(e,n,r,2),t!==null&&Su(t,e,2)}function Ls(e){var t=e.alternate;return e===V||t!==null&&t===V}function Rs(e,t){go=ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function zs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ot(e,n)}}var Bs={readContext:ta,use:Fo,useCallback:So,useContext:So,useEffect:So,useImperativeHandle:So,useLayoutEffect:So,useInsertionEffect:So,useMemo:So,useReducer:So,useRef:So,useState:So,useDebugValue:So,useDeferredValue:So,useTransition:So,useSyncExternalStore:So,useId:So,useHostTransitionStatus:So,useFormState:So,useActionState:So,useOptimistic:So,useMemoCache:So,useCacheRefresh:So};Bs.useEffectEvent=So;var Vs={readContext:ta,use:Fo,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:ta,useEffect:ds,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ls(4194308,4,_s.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ls(4194308,4,e,t)},useInsertionEffect:function(e,t){ls(4,2,e,t)},useMemo:function(e,t){var n=jo();t=t===void 0?null:t;var r=e();if(_o){Ue(!0);try{e()}finally{Ue(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=jo();if(n!==void 0){var i=n(t);if(_o){Ue(!0);try{n(t)}finally{Ue(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ns.bind(null,V,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:function(e){e=qo(e);var t=e.queue,n=Ps.bind(null,V,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ys,useDeferredValue:function(e,t){return Ss(jo(),e,t)},useTransition:function(){var e=qo(!1);return e=ws.bind(null,V,e.queue,!0,!1),jo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=V,a=jo();if(Fi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Wl===null)throw Error(i(349));U&127||Ho(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ds(Wo.bind(null,r,o,e),[e]),r.flags|=2048,ss(9,{destroy:void 0},Uo.bind(null,r,o,n,t),null),n},useId:function(){var e=jo(),t=Wl.identifierPrefix;if(Fi){var n=Di,r=Ei;n=(r&~(1<<32-We(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=vo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=xo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ks,useFormState:ns,useActionState:ns,useOptimistic:function(e){var t=jo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Is.bind(null,V,!0,n),n.dispatch=t,[e,t]},useMemoCache:Io,useCacheRefresh:function(){return jo().memoizedState=Ms.bind(null,V)},useEffectEvent:function(e){var t=jo(),n={impl:e};return t.memoizedState=n,function(){if(Ul&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Hs={readContext:ta,use:Fo,useCallback:bs,useContext:ta,useEffect:fs,useImperativeHandle:vs,useInsertionEffect:hs,useLayoutEffect:gs,useMemo:xs,useReducer:Ro,useRef:cs,useState:function(){return Ro(Lo)},useDebugValue:ys,useDeferredValue:function(e,t){return Cs(Mo(),po.memoizedState,e,t)},useTransition:function(){var e=Ro(Lo)[0],t=Mo().memoizedState;return[typeof e==`boolean`?e:Po(e),t]},useSyncExternalStore:Vo,useId:As,useHostTransitionStatus:ks,useFormState:rs,useActionState:rs,useOptimistic:function(e,t){return Jo(Mo(),po,e,t)},useMemoCache:Io,useCacheRefresh:js};Hs.useEffectEvent=ms;var Us={readContext:ta,use:Fo,useCallback:bs,useContext:ta,useEffect:fs,useImperativeHandle:vs,useInsertionEffect:hs,useLayoutEffect:gs,useMemo:xs,useReducer:Bo,useRef:cs,useState:function(){return Bo(Lo)},useDebugValue:ys,useDeferredValue:function(e,t){var n=Mo();return po===null?Ss(n,e,t):Cs(n,po.memoizedState,e,t)},useTransition:function(){var e=Bo(Lo)[0],t=Mo().memoizedState;return[typeof e==`boolean`?e:Po(e),t]},useSyncExternalStore:Vo,useId:As,useHostTransitionStatus:ks,useFormState:os,useActionState:os,useOptimistic:function(e,t){var n=Mo();return po===null?(n.baseState=e,[e,n.queue.dispatch]):Jo(n,po,e,t)},useMemoCache:Io,useCacheRefresh:js};Us.useEffectEvent=ms;function Ws(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Gs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=bu(),i=Ha(r);i.payload=t,n!=null&&(i.callback=n),t=Ua(e,i,r),t!==null&&(Su(t,e,r),Wa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=bu(),i=Ha(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ua(e,i,r),t!==null&&(Su(t,e,r),Wa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=bu(),r=Ha(n);r.tag=2,t!=null&&(r.callback=t),t=Ua(e,r,n),t!==null&&(Su(t,e,n),Wa(t,e,n))}};function Ks(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!wr(n,r)||!wr(i,a):!0}function qs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Gs.enqueueReplaceState(t,t.state,null)}function Js(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ys(e){Xr(e)}function Xs(e){console.error(e)}function Zs(e){Xr(e)}function Qs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function $s(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function ec(e,t,n){return n=Ha(n),n.tag=3,n.payload={element:null},n.callback=function(){Qs(e,t)},n}function tc(e){return e=Ha(e),e.tag=3,e}function nc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){$s(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){$s(t,n,r),typeof i!=`function`&&(uu===null?uu=new Set([this]):uu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function rc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Qi(t,n,a,!0),n=no.current,n!==null){switch(n.tag){case 31:case 13:return ro===null?Pu():n.alternate===null&&Zl===0&&(Zl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===wa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),$u(e,r,a)),!1;case 22:return n.flags|=65536,r===wa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),$u(e,r,a)),!1}throw Error(i(435,n.tag))}return $u(e,r,a),Pu(),!1}if(Fi)return t=no.current,t===null?(r!==Ri&&(t=Error(i(423),{cause:r}),z(vi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=vi(r,n),a=ec(e.stateNode,r,a),Ga(e,a),Zl!==4&&(Zl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ri&&(e=Error(i(422),{cause:r}),z(vi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=vi(o,n),ru===null?ru=[o]:ru.push(o),Zl!==4&&(Zl=2),t===null)return!0;r=vi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=ec(n.stateNode,r,e),Ga(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(uu===null||!uu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=tc(a),nc(a,e,n,r),Ga(n,a),!1}n=n.return}while(n!==null);return!1}var ic=Error(i(461)),ac=!1;function oc(e,t,n,r){t.child=e===null?Ra(t,null,n,r):La(t,e.child,n,r)}function sc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ea(t),r=wo(e,t,n,o,a,i),s=Oo(),e!==null&&!ac?(ko(e,t,i),jc(e,t,i)):(Fi&&s&&Ai(t),t.flags|=1,oc(e,t,r,i),t.child)}function cc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!li(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,lc(e,t,a,r,i)):(e=fi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Mc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?wr:n,n(o,r)&&e.ref===t.ref)return jc(e,t,i)}return t.flags|=1,e=ui(a,r),e.ref=t.ref,e.return=t,t.child=e}function lc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(wr(a,r)&&e.ref===t.ref)if(ac=!1,t.pendingProps=r=a,Mc(e,i))e.flags&131072&&(ac=!0);else return t.lanes=e.lanes,jc(e,t,i)}return _c(e,t,n,r,i)}function uc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return fc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ya(t,a===null?null:a.cachePool),a===null?eo():$a(t,a),oo(t);else return r=t.lanes=536870912,fc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ya(t,null),eo(),so(t)):(ya(t,a.cachePool),$a(t,a),so(t),t.memoizedState=null);return oc(e,t,i,n),t.child}function dc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function fc(e,t,n,r,i){var a=va();return a=a===null?null:{parent:oa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ya(t,null),eo(),oo(t),e!==null&&Qi(e,t,r,!0),t.childLanes=i,null}function pc(e,t){return t=Ec({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function mc(e,t,n){return La(t,e.child,null,n),e=pc(t,t.pendingProps),e.flags|=2,co(t),t.memoizedState=null,e}function hc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Fi){if(r.mode===`hidden`)return e=pc(t,r),t.lanes=536870912,dc(null,e);if(ao(t),(e=Pi)?(e=pf(e,Li),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ti===null?null:{id:Ei,overflow:Di},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Ni=t,Pi=null)):e=null,e===null)throw zi(t);return t.lanes=536870912,null}return pc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(ao(t),a)if(t.flags&256)t.flags&=-257,t=mc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ac||Qi(e,t,n,!1),a=(n&e.childLanes)!==0,ac||a){if(r=Wl,r!==null&&(s=st(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ri(e,s),Su(r,e,s),ic;Pu(),t=mc(e,t,n)}else e=o.treeContext,Pi=_f(s.nextSibling),Ni=t,Fi=!0,Ii=null,Li=!1,e!==null&&Mi(t,e),t=pc(t,r),t.flags|=4096;return t}return e=ui(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function gc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function _c(e,t,n,r,i){return ea(t),n=wo(e,t,n,r,void 0,i),r=Oo(),e!==null&&!ac?(ko(e,t,i),jc(e,t,i)):(Fi&&r&&Ai(t),t.flags|=1,oc(e,t,n,i),t.child)}function vc(e,t,n,r,i,a){return ea(t),t.updateQueue=null,n=Eo(t,r,n,i),To(e),r=Oo(),e!==null&&!ac?(ko(e,t,a),jc(e,t,a)):(Fi&&r&&Ai(t),t.flags|=1,oc(e,t,n,a),t.child)}function yc(e,t,n,r,i){if(ea(t),t.stateNode===null){var a=oi,o=n.contextType;typeof o==`object`&&o&&(a=ta(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Gs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ba(t),o=n.contextType,a.context=typeof o==`object`&&o?ta(o):oi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ws(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Gs.enqueueReplaceState(a,a.state,null),Ja(t,r,a,i),qa(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Js(n,s);a.props=c;var l=a.context,u=n.contextType;o=oi,typeof u==`object`&&u&&(o=ta(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&qs(t,a,r,o),za=!1;var f=t.memoizedState;a.state=f,Ja(t,r,a,i),qa(),l=t.memoizedState,s||f!==l||za?(typeof d==`function`&&(Ws(t,n,d,r),l=t.memoizedState),(c=za||Ks(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Va(e,t),o=t.memoizedProps,u=Js(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=oi,typeof l==`object`&&l&&(c=ta(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&qs(t,a,r,c),za=!1,f=t.memoizedState,a.state=f,Ja(t,r,a,i),qa();var p=t.memoizedState;o!==d||f!==p||za||e!==null&&e.dependencies!==null&&$i(e.dependencies)?(typeof s==`function`&&(Ws(t,n,s,r),p=t.memoizedState),(u=za||Ks(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&$i(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,gc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=La(t,e.child,null,i),t.child=La(t,null,n,i)):oc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=jc(e,t,i),e}function bc(e,t,n,r){return Ui(),t.flags|=256,oc(e,t,n,r),t.child}var xc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sc(e){return{baseLanes:e,cachePool:ba()}}function Cc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=tu),e}function wc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(lo.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Fi){if(a?io(t):so(t),(e=Pi)?(e=pf(e,Li),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ti===null?null:{id:Ei,overflow:Di},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Ni=t,Pi=null)):e=null,e===null)throw zi(t);return hf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(so(t),a=t.mode,c=Ec({mode:`hidden`,children:c},a),r=pi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Sc(n),r.childLanes=Cc(e,s,n),t.memoizedState=xc,dc(null,r)):(io(t),Tc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(io(t),t.flags&=-257,t=Dc(e,t,n)):t.memoizedState===null?(so(t),c=r.fallback,a=t.mode,r=Ec({mode:`visible`,children:r.children},a),c=pi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,La(t,e.child,null,n),r=t.child,r.memoizedState=Sc(n),r.childLanes=Cc(e,s,n),t.memoizedState=xc,t=dc(null,r)):(so(t),t.child=e.child,t.flags|=128,t=null);else if(io(t),hf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,z({value:r,source:null,stack:null}),t=Dc(e,t,n)}else if(ac||Qi(e,t,n,!1),s=(n&e.childLanes)!==0,ac||s){if(s=Wl,s!==null&&(r=st(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ri(e,r),Su(s,e,r),ic;mf(c)||Pu(),t=Dc(e,t,n)}else mf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Pi=_f(c.nextSibling),Ni=t,Fi=!0,Ii=null,Li=!1,e!==null&&Mi(t,e),t=Tc(t,r.children),t.flags|=4096);return t}return a?(so(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ui(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=pi(c,a,n,null),c.flags|=2):c=ui(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,dc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Sc(n):(a=c.cachePool,a===null?a=ba():(l=oa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Cc(e,s,n),t.memoizedState=xc,dc(e.child,r)):(io(t),n=e.child,e=n.sibling,n=ui(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Tc(e,t){return t=Ec({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Ec(e,t){return e=ci(22,e,null,t),e.lanes=0,e}function Dc(e,t,n){return La(t,e.child,null,n),e=Tc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Oc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xi(e.return,t,n)}function kc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Ac(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=lo.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,de(lo,o),oc(e,t,r,n),r=Fi?Si:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Oc(e,n,t);else if(e.tag===19)Oc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&uo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),kc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&uo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}kc(t,!0,n,null,a,r);break;case`together`:kc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function jc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ql|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Qi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ui(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ui(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Mc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&$i(e)))}function Nc(e,t,n){switch(t.tag){case 3:ge(t,t.stateNode.containerInfo),Ji(t,oa,e.memoizedState.cache),Ui();break;case 27:case 5:ve(t);break;case 4:ge(t,t.stateNode.containerInfo);break;case 10:Ji(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ao(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(io(t),e=jc(e,t,n),e===null?null:e.sibling):wc(e,t,n):(io(t),t.flags|=128,null);io(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Qi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Ac(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),de(lo,lo.current),r)break;return null;case 22:return t.lanes=0,uc(e,t,n,t.pendingProps);case 24:Ji(t,oa,e.memoizedState.cache)}return jc(e,t,n)}function Pc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ac=!0;else{if(!Mc(e,n)&&!(t.flags&128))return ac=!1,Nc(e,t,n);ac=!!(e.flags&131072)}else ac=!1,Fi&&t.flags&1048576&&ki(t,Si,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Da(t.elementType),t.type=e,typeof e==`function`)li(e)?(r=Js(e,r),t.tag=1,t=yc(null,t,e,r,n)):(t.tag=0,t=_c(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=sc(null,t,e,r,n);break a}if(a===D){t.tag=14,t=cc(null,t,e,r,n);break a}}throw t=ie(e)||e,Error(i(306,t,``))}}return t;case 0:return _c(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Js(r,t.pendingProps),yc(e,t,r,a,n);case 3:a:{if(ge(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Va(e,t),Ja(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ji(t,oa,r),r!==o.cache&&Zi(t,[oa],n,!0),qa(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=bc(e,t,r,n);break a}else if(r!==a){a=vi(Error(i(424)),t),z(a),t=bc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Pi=_f(e.firstChild),Ni=t,Fi=!0,Ii=null,Li=!0,n=Ra(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ui(),r===a){t=jc(e,t,n);break a}oc(e,t,r,n)}t=t.child}return t;case 26:return gc(e,t),e===null?(n=Rf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Fi||(n=t.type,e=t.pendingProps,r=Yd(me.current).createElement(n),r[pt]=t,r[mt]=e,Ud(r,n,e),Et(r),t.stateNode=r):t.memoizedState=Rf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ve(t),e===null&&Fi&&(r=t.stateNode=xf(t.type,t.pendingProps,me.current),Ni=t,Li=!0,a=Pi,sf(t.type)?(vf=a,Pi=_f(r.firstChild)):Pi=a),oc(e,t,t.pendingProps.children,n),gc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Fi&&((a=r=Pi)&&(r=df(r,t.type,t.pendingProps,Li),r===null?a=!1:(t.stateNode=r,Ni=t,Pi=_f(r.firstChild),Li=!1,a=!0)),a||zi(t)),ve(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Qd(a,o)?r=null:s!==null&&Qd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=wo(e,t,Do,null,null,n),G._currentValue=a),gc(e,t),oc(e,t,r,n),t.child;case 6:return e===null&&Fi&&((e=n=Pi)&&(n=ff(n,t.pendingProps,Li),n===null?e=!1:(t.stateNode=n,Ni=t,Pi=null,e=!0)),e||zi(t)),null;case 13:return wc(e,t,n);case 4:return ge(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=La(t,null,r,n):oc(e,t,r,n),t.child;case 11:return sc(e,t,t.type,t.pendingProps,n);case 7:return oc(e,t,t.pendingProps,n),t.child;case 8:return oc(e,t,t.pendingProps.children,n),t.child;case 12:return oc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ji(t,t.type,r.value),oc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ea(t),a=ta(a),r=r(a),t.flags|=1,oc(e,t,r,n),t.child;case 14:return cc(e,t,t.type,t.pendingProps,n);case 15:return lc(e,t,t.type,t.pendingProps,n);case 19:return Ac(e,t,n);case 31:return hc(e,t,n);case 22:return uc(e,t,n,t.pendingProps);case 24:return ea(t),r=ta(oa),e===null?(a=va(),a===null&&(a=Wl,o=sa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ba(t),Ji(t,oa,a)):((e.lanes&n)!==0&&(Va(e,t),Ja(t,null,null,n),qa()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ji(t,oa,r),r!==a.cache&&Zi(t,[oa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ji(t,oa,r))),oc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Fc(e){e.flags|=4}function Ic(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(ju())e.flags|=8192;else throw Oa=wa,Sa}else e.flags&=-16777217}function Lc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!$f(t))if(ju())e.flags|=8192;else throw Oa=wa,Sa}function Rc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:tt(),e.lanes|=t,nu|=t)}function zc(e,t){if(!Fi)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Bc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Vc(e,t,n){var r=t.pendingProps;switch(ji(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bc(t),null;case 1:return Bc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Yi(oa),_e(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Hi(t)?Fc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wi())),Bc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Fc(t),o===null?(Bc(t),Ic(t,a,null,r,n)):(Bc(t),Lc(t,o))):o?o===e.memoizedState?(Bc(t),t.flags&=-16777217):(Fc(t),Bc(t),Lc(t,o)):(e=e.memoizedProps,e!==r&&Fc(t),Bc(t),Ic(t,a,e,r,n)),null;case 27:if(ye(t),n=me.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Bc(t),null}e=fe.current,Hi(t)?Bi(t,e):(e=xf(a,r,n),t.stateNode=e,Fc(t))}return Bc(t),null;case 5:if(ye(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Bc(t),null}if(o=fe.current,Hi(t))Bi(t,o);else{var s=Yd(me.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[pt]=t,o[mt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Ud(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Fc(t)}}return Bc(t),Ic(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=me.current,Hi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ni,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[pt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Bd(e.nodeValue,n)),e||zi(t,!0)}else e=Yd(e).createTextNode(r),e[pt]=t,t.stateNode=e}return Bc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Hi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[pt]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Bc(t),e=!1}else n=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(co(t),t):(co(t),null);if(t.flags&128)throw Error(i(558))}return Bc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Hi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[pt]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Bc(t),a=!1}else a=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(co(t),t):(co(t),null)}return co(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Rc(t,t.updateQueue),Bc(t),null);case 4:return _e(),e===null&&Ad(t.stateNode.containerInfo),Bc(t),null;case 10:return Yi(t.type),Bc(t),null;case 19:if(ue(lo),r=t.memoizedState,r===null)return Bc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null)if(a)zc(r,!1);else{if(Zl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=uo(e),o!==null){for(t.flags|=128,zc(r,!1),e=o.updateQueue,t.updateQueue=e,Rc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)di(n,e),n=n.sibling;return de(lo,lo.current&1|2),Fi&&Oi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Me()>cu&&(t.flags|=128,a=!0,zc(r,!1),t.lanes=4194304)}else{if(!a)if(e=uo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Rc(t,e),zc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Fi)return Bc(t),null}else 2*Me()-r.renderingStartTime>cu&&n!==536870912&&(t.flags|=128,a=!0,zc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Bc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Me(),e.sibling=null,n=lo.current,de(lo,a?n&1|2:n&1),Fi&&Oi(t,r.treeForkCount),e);case 22:case 23:return co(t),to(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Bc(t),t.subtreeFlags&6&&(t.flags|=8192)):Bc(t),n=t.updateQueue,n!==null&&Rc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ue(_a),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Yi(oa),Bc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Hc(e,t){switch(ji(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yi(oa),_e(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ye(t),null;case 31:if(t.memoizedState!==null){if(co(t),t.alternate===null)throw Error(i(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(co(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ue(lo),null;case 4:return _e(),null;case 10:return Yi(t.type),null;case 22:case 23:return co(t),to(),e!==null&&ue(_a),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Yi(oa),null;case 25:return null;default:return null}}function Uc(e,t){switch(ji(t),t.tag){case 3:Yi(oa),_e();break;case 26:case 27:case 5:ye(t);break;case 4:_e();break;case 31:t.memoizedState!==null&&co(t);break;case 13:co(t);break;case 19:ue(lo);break;case 10:Yi(t.type);break;case 22:case 23:co(t),to(),e!==null&&ue(_a);break;case 24:Yi(oa)}}function Wc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Qu(t,t.return,e)}}function Gc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Qu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Qu(t,t.return,e)}}function Kc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Xa(t,n)}catch(t){Qu(e,e.return,t)}}}function qc(e,t,n){n.props=Js(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Qu(e,t,n)}}function Jc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Qu(e,t,n)}}function Yc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Qu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Qu(e,t,n)}else n.current=null}function Xc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Qu(e,e.return,t)}}function Zc(e,t,n){try{var r=e.stateNode;Wd(r,e.type,n,t),r[mt]=t}catch(t){Qu(e,e.return,t)}}function Qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&sf(e.type)||e.tag===4}function $c(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&sf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function el(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=sn));else if(r!==4&&(r===27&&sf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&sf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(tl(e,t,n),e=e.sibling;e!==null;)tl(e,t,n),e=e.sibling}function nl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ud(t,r,n),t[pt]=e,t[mt]=n}catch(t){Qu(e,e.return,t)}}var rl=!1,il=!1,al=!1,ol=typeof WeakSet==`function`?WeakSet:Set,sl=null;function cl(e,t){if(e=e.containerInfo,qd=mp,e=Or(e),kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Jd={focusedElem:e,selectionRange:n},mp=!1,sl=t;sl!==null;)if(t=sl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,sl=e;else for(;sl!==null;){switch(t=sl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Js(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Qu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)uf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:uf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,sl=e;break}sl=t.return}}function ll(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:wl(e,n),r&4&&Wc(5,n);break;case 1:if(wl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Qu(n,n.return,e)}else{var i=Js(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Qu(n,n.return,e)}}r&64&&Kc(n),r&512&&Jc(n,n.return);break;case 3:if(wl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Xa(e,t)}catch(e){Qu(n,n.return,e)}}break;case 27:t===null&&r&4&&nl(n);case 26:case 5:wl(e,n),t===null&&r&4&&Xc(n),r&512&&Jc(n,n.return);break;case 12:wl(e,n);break;case 31:wl(e,n),r&4&&hl(e,n);break;case 13:wl(e,n),r&4&&gl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=nd.bind(null,n),gf(e,n))));break;case 22:if(r=n.memoizedState!==null||rl,!r){t=t!==null&&t.memoizedState!==null||il,i=rl;var a=il;rl=r,(il=t)&&!a?El(e,n,!!(n.subtreeFlags&8772)):wl(e,n),rl=i,il=a}break;case 30:break;default:wl(e,n)}}function ul(e){var t=e.alternate;t!==null&&(e.alternate=null,ul(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&xt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var dl=null,fl=!1;function pl(e,t,n){for(n=n.child;n!==null;)ml(e,t,n),n=n.sibling}function ml(e,t,n){if(He&&typeof He.onCommitFiberUnmount==`function`)try{He.onCommitFiberUnmount(Ve,n)}catch{}switch(n.tag){case 26:il||Yc(n,t),pl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:il||Yc(n,t);var r=dl,i=fl;sf(n.type)&&(dl=n.stateNode,fl=!1),pl(e,t,n),Sf(n.stateNode),dl=r,fl=i;break;case 5:il||Yc(n,t);case 6:if(r=dl,i=fl,dl=null,pl(e,t,n),dl=r,fl=i,dl!==null)if(fl)try{(dl.nodeType===9?dl.body:dl.nodeName===`HTML`?dl.ownerDocument.body:dl).removeChild(n.stateNode)}catch(e){Qu(n,t,e)}else try{dl.removeChild(n.stateNode)}catch(e){Qu(n,t,e)}break;case 18:dl!==null&&(fl?(e=dl,cf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Bp(e)):cf(dl,n.stateNode));break;case 4:r=dl,i=fl,dl=n.stateNode.containerInfo,fl=!0,pl(e,t,n),dl=r,fl=i;break;case 0:case 11:case 14:case 15:Gc(2,n,t),il||Gc(4,n,t),pl(e,t,n);break;case 1:il||(Yc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&qc(n,t,r)),pl(e,t,n);break;case 21:pl(e,t,n);break;case 22:il=(r=il)||n.memoizedState!==null,pl(e,t,n),il=r;break;default:pl(e,t,n)}}function hl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Bp(e)}catch(e){Qu(t,t.return,e)}}}function gl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Bp(e)}catch(e){Qu(t,t.return,e)}}function _l(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ol),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ol),t;default:throw Error(i(435,e.tag))}}function vl(e,t){var n=_l(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=rd.bind(null,e,t);t.then(r,r)}})}function yl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(sf(c.type)){dl=c.stateNode,fl=!1;break a}break;case 5:dl=c.stateNode,fl=!1;break a;case 3:case 4:dl=c.stateNode.containerInfo,fl=!0;break a}c=c.return}if(dl===null)throw Error(i(160));ml(o,s,a),dl=null,fl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)xl(t,e),t=t.sibling}var bl=null;function xl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:yl(t,e),Sl(e),r&4&&(Gc(3,e,e.return),Wc(3,e),Gc(5,e,e.return));break;case 1:yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),r&64&&rl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=bl;if(yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[bt]||o[pt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Ud(o,r,n),o[pt]=e,Et(o),r=o;break a;case`link`:var s=Xf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Ud(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Xf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Ud(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[pt]=e,Et(o),r=o}e.stateNode=r}else Zf(a,e.type,e.stateNode);else e.stateNode=Gf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Zc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Zf(a,e.type,e.stateNode):Gf(a,r,e.memoizedProps))}break;case 27:yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),n!==null&&r&4&&Zc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),e.flags&32){a=e.stateNode;try{Qt(a,``)}catch(t){Qu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Zc(e,a,n===null?a:n.memoizedProps)),r&1024&&(al=!0);break;case 6:if(yl(t,e),Sl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Qu(e,e.return,t)}}break;case 3:if(Yf=null,a=bl,bl=Tf(t.containerInfo),yl(t,e),bl=a,Sl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Bp(t.containerInfo)}catch(t){Qu(e,e.return,t)}al&&(al=!1,Cl(e));break;case 4:r=bl,bl=Tf(e.stateNode.containerInfo),yl(t,e),Sl(e),bl=r;break;case 12:yl(t,e),Sl(e);break;case 31:yl(t,e),Sl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 13:yl(t,e),Sl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(ou=Me()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=rl,d=il;if(rl=u||a,il=d||l,yl(t,e),il=d,rl=u,Sl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||rl||il||Tl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Qu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Qu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?lf(m,!0):lf(l.stateNode,!1)}catch(e){Qu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,vl(e,n))));break;case 19:yl(t,e),Sl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 30:break;case 21:break;default:yl(t,e),Sl(e)}}function Sl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Qc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;tl(e,$c(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Qt(o,``),n.flags&=-33),tl(e,$c(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;el(e,$c(e),s);break;default:throw Error(i(161))}}catch(t){Qu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Cl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Cl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function wl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ll(e,t.alternate,t),t=t.sibling}function Tl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Gc(4,t,t.return),Tl(t);break;case 1:Yc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&qc(t,t.return,n),Tl(t);break;case 27:Sf(t.stateNode);case 26:case 5:Yc(t,t.return),Tl(t);break;case 22:t.memoizedState===null&&Tl(t);break;case 30:Tl(t);break;default:Tl(t)}e=e.sibling}}function El(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:El(i,a,n),Wc(4,a);break;case 1:if(El(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Qu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ya(c[i],s)}catch(e){Qu(r,r.return,e)}}n&&o&64&&Kc(a),Jc(a,a.return);break;case 27:nl(a);case 26:case 5:El(i,a,n),n&&r===null&&o&4&&Xc(a),Jc(a,a.return);break;case 12:El(i,a,n);break;case 31:El(i,a,n),n&&o&4&&hl(i,a);break;case 13:El(i,a,n),n&&o&4&&gl(i,a);break;case 22:a.memoizedState===null&&El(i,a,n),Jc(a,a.return);break;case 30:break;default:El(i,a,n)}t=t.sibling}}function Dl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ca(n))}function Ol(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ca(e))}function kl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Al(e,t,n,r),t=t.sibling}function Al(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:kl(e,t,n,r),i&2048&&Wc(9,t);break;case 1:kl(e,t,n,r);break;case 3:kl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ca(e)));break;case 12:if(i&2048){kl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Qu(t,t.return,e)}}else kl(e,t,n,r);break;case 31:kl(e,t,n,r);break;case 13:kl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?kl(e,t,n,r):(a._visibility|=2,jl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?kl(e,t,n,r):Ml(e,t),i&2048&&Dl(o,t);break;case 24:kl(e,t,n,r),i&2048&&Ol(t.alternate,t);break;default:kl(e,t,n,r)}}function jl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:jl(a,o,s,c,i),Wc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,jl(a,o,s,c,i)):u._visibility&2?jl(a,o,s,c,i):Ml(a,o),i&&l&2048&&Dl(o.alternate,o);break;case 24:jl(a,o,s,c,i),i&&l&2048&&Ol(o.alternate,o);break;default:jl(a,o,s,c,i)}t=t.sibling}}function Ml(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Ml(n,r),i&2048&&Dl(r.alternate,r);break;case 24:Ml(n,r),i&2048&&Ol(r.alternate,r);break;default:Ml(n,r)}t=t.sibling}}var Nl=8192;function Pl(e,t,n){if(e.subtreeFlags&Nl)for(e=e.child;e!==null;)Fl(e,t,n),e=e.sibling}function Fl(e,t,n){switch(e.tag){case 26:Pl(e,t,n),e.flags&Nl&&e.memoizedState!==null&&ep(n,bl,e.memoizedState,e.memoizedProps);break;case 5:Pl(e,t,n);break;case 3:case 4:var r=bl;bl=Tf(e.stateNode.containerInfo),Pl(e,t,n),bl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Nl,Nl=16777216,Pl(e,t,n),Nl=r):Pl(e,t,n));break;default:Pl(e,t,n)}}function Il(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ll(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];sl=r,Bl(r,e)}Il(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Rl(e),e=e.sibling}function Rl(e){switch(e.tag){case 0:case 11:case 15:Ll(e),e.flags&2048&&Gc(9,e,e.return);break;case 3:Ll(e);break;case 12:Ll(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,zl(e)):Ll(e);break;default:Ll(e)}}function zl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];sl=r,Bl(r,e)}Il(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Gc(8,t,t.return),zl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,zl(t));break;default:zl(t)}e=e.sibling}}function Bl(e,t){for(;sl!==null;){var n=sl;switch(n.tag){case 0:case 11:case 15:Gc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ca(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,sl=r;else a:for(n=e;sl!==null;){r=sl;var i=r.sibling,a=r.return;if(ul(r),r===n){sl=null;break a}if(i!==null){i.return=a,sl=i;break a}sl=a}}}var Vl={getCacheForType:function(e){var t=ta(oa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ta(oa).controller.signal}},Hl=typeof WeakMap==`function`?WeakMap:Map,Ul=0,Wl=null,H=null,U=0,Gl=0,Kl=null,ql=!1,Jl=!1,Yl=!1,Xl=0,Zl=0,Ql=0,$l=0,eu=0,tu=0,nu=0,ru=null,iu=null,au=!1,ou=0,su=0,cu=1/0,lu=null,uu=null,du=0,fu=null,pu=null,mu=0,hu=0,gu=null,_u=null,vu=0,yu=null;function bu(){return Ul&2&&U!==0?U&-U:A.T===null?ut():yd()}function xu(){if(tu===0)if(!(U&536870912)||Fi){var e=Ye;Ye<<=1,!(Ye&3932160)&&(Ye=262144),tu=e}else tu=536870912;return e=no.current,e!==null&&(e.flags|=32),tu}function Su(e,t,n){(e===Wl&&(Gl===2||Gl===9)||e.cancelPendingCommit!==null)&&(ku(e,0),Eu(e,U,tu,!1)),rt(e,n),(!(Ul&2)||e!==Wl)&&(e===Wl&&(!(Ul&2)&&($l|=n),Zl===4&&Eu(e,U,tu,!1)),dd(e))}function Cu(e,t,n){if(Ul&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||$e(e,t),a=r?Lu(e,t):Fu(e,t,!0),o=r;do{if(a===0){Jl&&!r&&Eu(e,t,0,!1);break}if(n=e.current.alternate,o&&!Tu(n)){a=Fu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=ru;var l=c.current.memoizedState.isDehydrated;if(l&&(ku(c,s).flags|=256),s=Fu(c,s,!1),s!==2){if(Yl&&!l){c.errorRecoveryDisabledLanes|=o,$l|=o,a=4;break a}o=iu,iu=a,o!==null&&(iu===null?iu=o:iu.push.apply(iu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){ku(e,0),Eu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Eu(r,t,tu,!ql);break a;case 2:iu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=ou+300-Me(),10<a)){if(Eu(r,t,tu,!ql),Qe(r,0,!0)!==0)break a;mu=t,r.timeoutHandle=tf(wu.bind(null,r,n,iu,lu,au,t,tu,$l,nu,ql,o,`Throttled`,-0,0),a);break a}wu(r,n,iu,lu,au,t,tu,$l,nu,ql,o,null,-0,0)}break}while(1);dd(e)}function wu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:sn},Fl(t,a,d);var m=(a&62914560)===a?ou-Me():(a&4194048)===a?su-Me():0;if(m=np(d,m),m!==null){mu=a,e.cancelPendingCommit=m(Wu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Eu(e,a,o,!l);return}}Wu(e,t,a,n,r,i,o,s,c)}function Tu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Cr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Eu(e,t,n,r){t&=~eu,t&=~$l,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-We(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&at(e,n,t)}function Du(){return Ul&6?!0:(fd(0,!1),!1)}function Ou(){if(H!==null){if(Gl===0)var e=H.return;else e=H,qi=Ki=null,Ao(e),ja=null,Ma=0,e=H;for(;e!==null;)Uc(e.alternate,e),e=e.return;H=null}}function ku(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,nf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),mu=0,Ou(),Wl=e,H=n=ui(e.current,null),U=t,Gl=0,Kl=null,ql=!1,Jl=$e(e,t),Yl=!1,nu=tu=eu=$l=Ql=Zl=0,iu=ru=null,au=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-We(r),a=1<<i;t|=e[i],r&=~a}return Xl=t,ei(),n}function Au(e,t){V=null,A.H=Bs,t===xa||t===Ca?(t=ka(),Gl=3):t===Sa?(t=ka(),Gl=4):Gl=t===ic?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Kl=t,H===null&&(Zl=1,Qs(e,vi(t,e.current)))}function ju(){var e=no.current;return e===null?!0:(U&4194048)===U?ro===null:(U&62914560)===U||U&536870912?e===ro:!1}function Mu(){var e=A.H;return A.H=Bs,e===null?Bs:e}function Nu(){var e=A.A;return A.A=Vl,e}function Pu(){Zl=4,ql||(U&4194048)!==U&&no.current!==null||(Jl=!0),!(Ql&134217727)&&!($l&134217727)||Wl===null||Eu(Wl,U,tu,!1)}function Fu(e,t,n){var r=Ul;Ul|=2;var i=Mu(),a=Nu();(Wl!==e||U!==t)&&(lu=null,ku(e,t)),t=!1;var o=Zl;a:do try{if(Gl!==0&&H!==null){var s=H,c=Kl;switch(Gl){case 8:Ou(),o=6;break a;case 3:case 2:case 9:case 6:no.current===null&&(t=!0);var l=Gl;if(Gl=0,Kl=null,Vu(e,s,c,l),n&&Jl){o=0;break a}break;default:l=Gl,Gl=0,Kl=null,Vu(e,s,c,l)}}Iu(),o=Zl;break}catch(t){Au(e,t)}while(1);return t&&e.shellSuspendCounter++,qi=Ki=null,Ul=r,A.H=i,A.A=a,H===null&&(Wl=null,U=0,ei()),o}function Iu(){for(;H!==null;)zu(H)}function Lu(e,t){var n=Ul;Ul|=2;var r=Mu(),a=Nu();Wl!==e||U!==t?(lu=null,cu=Me()+500,ku(e,t)):Jl=$e(e,t);a:do try{if(Gl!==0&&H!==null){t=H;var o=Kl;b:switch(Gl){case 1:Gl=0,Kl=null,Vu(e,t,o,1);break;case 2:case 9:if(Ta(o)){Gl=0,Kl=null,Bu(t);break}t=function(){Gl!==2&&Gl!==9||Wl!==e||(Gl=7),dd(e)},o.then(t,t);break a;case 3:Gl=7;break a;case 4:Gl=5;break a;case 7:Ta(o)?(Gl=0,Kl=null,Bu(t)):(Gl=0,Kl=null,Vu(e,t,o,7));break;case 5:var s=null;switch(H.tag){case 26:s=H.memoizedState;case 5:case 27:var c=H;if(s?$f(s):c.stateNode.complete){Gl=0,Kl=null;var l=c.sibling;if(l!==null)H=l;else{var u=c.return;u===null?H=null:(H=u,Hu(u))}break b}}Gl=0,Kl=null,Vu(e,t,o,5);break;case 6:Gl=0,Kl=null,Vu(e,t,o,6);break;case 8:Ou(),Zl=6;break a;default:throw Error(i(462))}}Ru();break}catch(t){Au(e,t)}while(1);return qi=Ki=null,A.H=r,A.A=a,Ul=n,H===null?(Wl=null,U=0,ei(),Zl):0}function Ru(){for(;H!==null&&!Ae();)zu(H)}function zu(e){var t=Pc(e.alternate,e,Xl);e.memoizedProps=e.pendingProps,t===null?Hu(e):H=t}function Bu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=vc(n,t,t.pendingProps,t.type,void 0,U);break;case 11:t=vc(n,t,t.pendingProps,t.type.render,t.ref,U);break;case 5:Ao(t);default:Uc(n,t),t=H=di(t,Xl),t=Pc(n,t,Xl)}e.memoizedProps=e.pendingProps,t===null?Hu(e):H=t}function Vu(e,t,n,r){qi=Ki=null,Ao(t),ja=null,Ma=0;var i=t.return;try{if(rc(e,i,t,n,U)){Zl=1,Qs(e,vi(n,e.current)),H=null;return}}catch(t){if(i!==null)throw H=i,t;Zl=1,Qs(e,vi(n,e.current)),H=null;return}t.flags&32768?(Fi||r===1?e=!0:Jl||U&536870912?e=!1:(ql=e=!0,(r===2||r===9||r===3||r===6)&&(r=no.current,r!==null&&r.tag===13&&(r.flags|=16384))),Uu(t,e)):Hu(t)}function Hu(e){var t=e;do{if(t.flags&32768){Uu(t,ql);return}e=t.return;var n=Vc(t.alternate,t,Xl);if(n!==null){H=n;return}if(t=t.sibling,t!==null){H=t;return}H=t=e}while(t!==null);Zl===0&&(Zl=5)}function Uu(e,t){do{var n=Hc(e.alternate,e);if(n!==null){n.flags&=32767,H=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){H=e;return}H=e=n}while(e!==null);Zl=6,H=null}function Wu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Yu();while(du!==0);if(Ul&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=$r,it(e,n,o,s,c,l),e===Wl&&(H=Wl=null,U=0),pu=t,fu=e,mu=n,hu=o,gu=a,_u=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,id(Ie,function(){return Xu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=A.T,A.T=null,a=j.p,j.p=2,s=Ul,Ul|=4;try{cl(e,t,n)}finally{Ul=s,j.p=a,A.T=r}}du=1,Gu(),Ku(),qu()}}function Gu(){if(du===1){du=0;var e=fu,t=pu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=A.T,A.T=null;var r=j.p;j.p=2;var i=Ul;Ul|=4;try{xl(t,e);var a=Jd,o=Or(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Dr(s.ownerDocument.documentElement,s)){if(c!==null&&kr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Er(s,h),v=Er(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}mp=!!qd,Jd=qd=null}finally{Ul=i,j.p=r,A.T=n}}e.current=t,du=2}}function Ku(){if(du===2){du=0;var e=fu,t=pu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=A.T,A.T=null;var r=j.p;j.p=2;var i=Ul;Ul|=4;try{ll(e,t.alternate,t)}finally{Ul=i,j.p=r,A.T=n}}du=3}}function qu(){if(du===4||du===3){du=0,je();var e=fu,t=pu,n=mu,r=_u;t.subtreeFlags&10256||t.flags&10256?du=5:(du=0,pu=fu=null,Ju(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(uu=null),lt(n),t=t.stateNode,He&&typeof He.onCommitFiberRoot==`function`)try{He.onCommitFiberRoot(Ve,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=A.T,i=j.p,j.p=2,A.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{A.T=t,j.p=i}}mu&3&&Yu(),dd(e),i=e.pendingLanes,n&261930&&i&42?e===yu?vu++:(vu=0,yu=e):vu=0,fd(0,!1)}}function Ju(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ca(t)))}function Yu(){return Gu(),Ku(),qu(),Xu()}function Xu(){if(du!==5)return!1;var e=fu,t=hu;hu=0;var n=lt(mu),r=A.T,a=j.p;try{j.p=32>n?32:n,A.T=null,n=gu,gu=null;var o=fu,s=mu;if(du=0,pu=fu=null,mu=0,Ul&6)throw Error(i(331));var c=Ul;if(Ul|=4,Rl(o.current),Al(o,o.current,s,n),Ul=c,fd(0,!1),He&&typeof He.onPostCommitFiberRoot==`function`)try{He.onPostCommitFiberRoot(Ve,o)}catch{}return!0}finally{j.p=a,A.T=r,Ju(e,t)}}function Zu(e,t,n){t=vi(n,t),t=ec(e.stateNode,t,2),e=Ua(e,t,2),e!==null&&(rt(e,2),dd(e))}function Qu(e,t,n){if(e.tag===3)Zu(e,e,n);else for(;t!==null;){if(t.tag===3){Zu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(uu===null||!uu.has(r))){e=vi(n,e),n=tc(2),r=Ua(t,n,2),r!==null&&(nc(n,r,t,e),rt(r,2),dd(r));break}}t=t.return}}function $u(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Hl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Yl=!0,i.add(n),e=ed.bind(null,e,t,n),t.then(e,e))}function ed(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Wl===e&&(U&n)===n&&(Zl===4||Zl===3&&(U&62914560)===U&&300>Me()-ou?!(Ul&2)&&ku(e,0):eu|=n,nu===U&&(nu=0)),dd(e)}function td(e,t){t===0&&(t=tt()),e=ri(e,t),e!==null&&(rt(e,t),dd(e))}function nd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),td(e,n)}function rd(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),td(e,n)}function id(e,t){return Oe(e,t)}var ad=null,od=null,sd=!1,cd=!1,ld=!1,ud=0;function dd(e){e!==od&&e.next===null&&(od===null?ad=od=e:od=od.next=e),cd=!0,sd||(sd=!0,vd())}function fd(e,t){if(!ld&&cd){ld=!0;do for(var n=!1,r=ad;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-We(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,_d(r,a))}else a=U,a=Qe(r,r===Wl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||$e(r,a)||(n=!0,_d(r,a));r=r.next}while(n);ld=!1}}function pd(){md()}function md(){cd=sd=!1;var e=0;ud!==0&&ef()&&(e=ud);for(var t=Me(),n=null,r=ad;r!==null;){var i=r.next,a=hd(r,t);a===0?(r.next=null,n===null?ad=i:n.next=i,i===null&&(od=n)):(n=r,(e!==0||a&3)&&(cd=!0)),r=i}du!==0&&du!==5||fd(e,!1),ud!==0&&(ud=0)}function hd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-We(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=et(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Wl,n=U,n=Qe(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Gl===2||Gl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ke(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||$e(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ke(r),lt(n)){case 2:case 8:n=Fe;break;case 32:n=Ie;break;case 268435456:n=Re;break;default:n=Ie}return r=gd.bind(null,e),n=Oe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ke(r),e.callbackPriority=2,e.callbackNode=null,2}function gd(e,t){if(du!==0&&du!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Yu()&&e.callbackNode!==n)return null;var r=U;return r=Qe(e,e===Wl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Cu(e,r,t),hd(e,Me()),e.callbackNode!=null&&e.callbackNode===n?gd.bind(null,e):null)}function _d(e,t){if(Yu())return null;Cu(e,t,!0)}function vd(){af(function(){Ul&6?Oe(Pe,pd):md()})}function yd(){if(ud===0){var e=da;e===0&&(e=Je,Je<<=1,!(Je&261888)&&(Je=256)),ud=e}return ud}function bd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:on(``+e)}function xd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Sd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=bd((i[mt]||null).action),o=r.submitter;o&&(t=(t=o[mt]||null)?bd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new En(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ud!==0){var e=o?xd(i,o):new FormData(i);Es(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?xd(i,o):new FormData(i),Es(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Cd=0;Cd<R.length;Cd++){var wd=R[Cd];Yr(wd.toLowerCase(),`on`+(wd[0].toUpperCase()+wd.slice(1)))}Yr(Vr,`onAnimationEnd`),Yr(Hr,`onAnimationIteration`),Yr(Ur,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Wr,`onTransitionRun`),Yr(Gr,`onTransitionStart`),Yr(Kr,`onTransitionCancel`),Yr(qr,`onTransitionEnd`),At(`onMouseEnter`,[`mouseout`,`mouseover`]),At(`onMouseLeave`,[`mouseout`,`mouseover`]),At(`onPointerEnter`,[`pointerout`,`pointerover`]),At(`onPointerLeave`,[`pointerout`,`pointerover`]),kt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),kt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),kt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),kt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),kt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),kt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Td=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Ed=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Td));function Dd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Xr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Xr(e)}i.currentTarget=null,a=c}}}}function W(e,t){var n=t[gt];n===void 0&&(n=t[gt]=new Set);var r=e+`__bubble`;n.has(r)||(jd(t,e,2,!1),n.add(r))}function Od(e,t,n){var r=0;t&&(r|=4),jd(n,e,r,t)}var kd=`_reactListening`+Math.random().toString(36).slice(2);function Ad(e){if(!e[kd]){e[kd]=!0,Dt.forEach(function(t){t!==`selectionchange`&&(Ed.has(t)||Od(t,!1,e),Od(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[kd]||(t[kd]=!0,Od(`selectionchange`,!1,t))}}function jd(e,t,n,r){switch(xp(t)){case 2:var i=hp;break;case 8:i=gp;break;default:i=_p}n=i.bind(null,t,n,e),i=void 0,!gn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Md(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=St(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}pn(function(){var r=a,i=ln(n),s=[];a:{var c=Jr.get(e);if(c!==void 0){var l=En,u=e;switch(e){case`keypress`:if(Sn(n)===0)break a;case`keydown`:case`keyup`:l=F;break;case`focusin`:u=`focus`,l=Fn;break;case`focusout`:u=`blur`,l=Fn;break;case`beforeblur`:case`afterblur`:l=Fn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Nn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Pn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=I;break;case Vr:case Hr:case Ur:l=In;break;case qr:l=Wn;break;case`scroll`:case`scrollend`:l=On;break;case`wheel`:l=Gn;break;case`copy`:case`cut`:case`paste`:l=Ln;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Un;break;case`toggle`:case`beforetoggle`:l=Kn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=mn(m,p),g!=null&&d.push(Nd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==cn&&(u=n.relatedTarget||n.fromElement)&&(St(u)||u[ht]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?St(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Nn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Un,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:wt(l),h=u==null?c:wt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,St(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Fd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Id(s,c,l,d,!1),u!==null&&f!==null&&Id(s,f,u,d,!0)}}a:{if(c=r?wt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=fr;else if(or(c))if(pr)v=xr;else{v=yr;var y=vr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&nn(r.elementType)&&(v=fr):v=br;if(v&&=v(e,r)){sr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Jt(c,`number`,c.value)}switch(y=r?wt(r):window,e){case`focusin`:(or(y)||y.contentEditable===`true`)&&(jr=y,Mr=r,Nr=null);break;case`focusout`:Nr=Mr=jr=null;break;case`mousedown`:Pr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Pr=!1,Fr(s,n,i);break;case`selectionchange`:if(Ar)break;case`keydown`:case`keyup`:Fr(s,n,i)}var b;if(Jn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else nr?er(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Zn&&n.locale!==`ko`&&(nr||x!==`onCompositionStart`?x===`onCompositionEnd`&&nr&&(b=xn()):(vn=i,yn=`value`in vn?vn.value:vn.textContent,nr=!0)),y=Pd(r,x),0<y.length&&(x=new Rn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=tr(n),b!==null&&(x.data=b)))),(b=Xn?rr(e,n):ir(e,n))&&(x=Pd(r,`onBeforeInput`),0<x.length&&(y=new Rn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),Sd(s,e,r,n,i)}Dd(s,t)})}function Nd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Pd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=mn(e,n),i!=null&&r.unshift(Nd(e,i,a)),i=mn(e,t),i!=null&&r.push(Nd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Fd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Id(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=mn(n,a),l!=null&&o.unshift(Nd(n,l,c))):i||(l=mn(n,a),l!=null&&o.push(Nd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Ld=/\r\n?/g,Rd=/\u0000|\uFFFD/g;function zd(e){return(typeof e==`string`?e:``+e).replace(Ld,`
|
|
9
|
-
`).replace(Rd,``)}function Bd(e,t){return t=zd(t),zd(e)===t}function Vd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Qt(e,``+r);break;case`className`:It(e,`class`,r);break;case`tabIndex`:It(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:It(e,n,r);break;case`style`:tn(e,r,o);break;case`data`:if(t!==`object`){It(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=on(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Vd(e,t,`name`,a.name,a,null),Vd(e,t,`formEncType`,a.formEncType,a,null),Vd(e,t,`formMethod`,a.formMethod,a,null),Vd(e,t,`formTarget`,a.formTarget,a,null)):(Vd(e,t,`encType`,a.encType,a,null),Vd(e,t,`method`,a.method,a,null),Vd(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=on(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=sn);break;case`onScroll`:r!=null&&W(`scroll`,e);break;case`onScrollEnd`:r!=null&&W(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=on(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:W(`beforetoggle`,e),W(`toggle`,e),Ft(e,`popover`,r);break;case`xlinkActuate`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Lt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Lt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Lt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ft(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=rn.get(n)||n,Ft(e,n,r))}}function Hd(e,t,n,r,a,o){switch(n){case`style`:tn(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Qt(e,``+r);break;case`onScroll`:r!=null&&W(`scroll`,e);break;case`onScrollEnd`:r!=null&&W(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=sn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Ot.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[mt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ft(e,n,r)}}}function Ud(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:W(`error`,e),W(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Vd(e,t,o,s,n,null)}}a&&Vd(e,t,`srcSet`,n.srcSet,n,null),r&&Vd(e,t,`src`,n.src,n,null);return;case`input`:W(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Vd(e,t,r,d,n,null)}}qt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in W(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Vd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Yt(e,!!r,n,!0):Yt(e,!!r,t,!1);return;case`textarea`:for(s in W(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Vd(e,t,s,c,n,null)}Zt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Vd(e,t,l,r,n,null)}return;case`dialog`:W(`beforetoggle`,e),W(`toggle`,e),W(`cancel`,e),W(`close`,e);break;case`iframe`:case`object`:W(`load`,e);break;case`video`:case`audio`:for(r=0;r<Td.length;r++)W(Td[r],e);break;case`image`:W(`error`,e),W(`load`,e);break;case`details`:W(`toggle`,e);break;case`embed`:case`source`:case`link`:W(`error`,e),W(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Vd(e,t,u,r,n,null)}return;default:if(nn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Hd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Vd(e,t,c,r,n,null))}function Wd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Vd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Vd(e,t,p,m,r,f)}}Kt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Vd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Vd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Yt(e,!!n,n?[]:``,!1):Yt(e,!!n,t,!0)):Yt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Vd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Vd(e,t,s,a,r,o)}Xt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Vd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Vd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Vd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Vd(e,t,u,p,r,m)}return;default:if(nn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Hd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Hd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Vd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Vd(e,t,f,p,r,m)}function Gd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Kd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Gd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Gd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var qd=null,Jd=null;function Yd(e){return e.nodeType===9?e:e.ownerDocument}function Xd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Zd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Qd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var $d=null;function ef(){var e=window.event;return e&&e.type===`popstate`?e!==$d&&($d=e,!0):($d=null,!1)}var tf=typeof setTimeout==`function`?setTimeout:void 0,nf=typeof clearTimeout==`function`?clearTimeout:void 0,rf=typeof Promise==`function`?Promise:void 0,af=typeof queueMicrotask==`function`?queueMicrotask:rf===void 0?tf:function(e){return rf.resolve(null).then(e).catch(of)};function of(e){setTimeout(function(){throw e})}function sf(e){return e===`head`}function cf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Bp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Sf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Sf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[bt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Sf(e.ownerDocument.body);n=i}while(n);Bp(t)}function lf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function uf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:uf(n),xt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function df(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[bt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=_f(e.nextSibling),e===null)break}return null}function ff(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=_f(e.nextSibling),e===null))return null;return e}function pf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=_f(e.nextSibling),e===null))return null;return e}function mf(e){return e.data===`$?`||e.data===`$~`}function hf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function gf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function _f(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var vf=null;function yf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return _f(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function bf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function xf(e,t,n){switch(t=Yd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Sf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);xt(e)}var Cf=new Map,wf=new Set;function Tf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ef=j.d;j.d={f:Df,r:Of,D:jf,C:Mf,L:Nf,m:Pf,X:If,S:Ff,M:Lf};function Df(){var e=Ef.f(),t=Du();return e||t}function Of(e){var t=Ct(e);t!==null&&t.tag===5&&t.type===`form`?Os(t):Ef.r(e)}var kf=typeof document>`u`?null:document;function Af(e,t,n){var r=kf;if(r&&typeof t==`string`&&t){var i=Gt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),wf.has(i)||(wf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ud(t,`link`,e),Et(t),r.head.appendChild(t)))}}function jf(e){Ef.D(e),Af(`dns-prefetch`,e,null)}function Mf(e,t){Ef.C(e,t),Af(`preconnect`,e,t)}function Nf(e,t,n){Ef.L(e,t,n);var r=kf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Gt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Gt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Gt(n.imageSizes)+`"]`)):i+=`[href="`+Gt(e)+`"]`;var a=i;switch(t){case`style`:a=zf(e);break;case`script`:a=Uf(e)}Cf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Cf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Bf(a))||t===`script`&&r.querySelector(Wf(a))||(t=r.createElement(`link`),Ud(t,`link`,e),Et(t),r.head.appendChild(t)))}}function Pf(e,t){Ef.m(e,t);var n=kf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Gt(r)+`"][href="`+Gt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Uf(e)}if(!Cf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Cf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Wf(a)))return}r=n.createElement(`link`),Ud(r,`link`,e),Et(r),n.head.appendChild(r)}}}function Ff(e,t,n){Ef.S(e,t,n);var r=kf;if(r&&e){var i=Tt(r).hoistableStyles,a=zf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Bf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Cf.get(a))&&qf(e,n);var c=o=r.createElement(`link`);Et(c),Ud(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Kf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function If(e,t){Ef.X(e,t);var n=kf;if(n&&e){var r=Tt(n).hoistableScripts,i=Uf(e),a=r.get(i);a||(a=n.querySelector(Wf(i)),a||(e=f({src:e,async:!0},t),(t=Cf.get(i))&&Jf(e,t),a=n.createElement(`script`),Et(a),Ud(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t){Ef.M(e,t);var n=kf;if(n&&e){var r=Tt(n).hoistableScripts,i=Uf(e),a=r.get(i);a||(a=n.querySelector(Wf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Cf.get(i))&&Jf(e,t),a=n.createElement(`script`),Et(a),Ud(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Rf(e,t,n,r){var a=(a=me.current)?Tf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=zf(n.href),n=Tt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=zf(n.href);var o=Tt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Bf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Cf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Cf.set(e,n),o||Hf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Uf(n),n=Tt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function zf(e){return`href="`+Gt(e)+`"`}function Bf(e){return`link[rel="stylesheet"][`+e+`]`}function Vf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Hf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Ud(t,`link`,n),Et(t),e.head.appendChild(t))}function Uf(e){return`[src="`+Gt(e)+`"]`}function Wf(e){return`script[async]`+e}function Gf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Gt(n.href)+`"]`);if(r)return t.instance=r,Et(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Et(r),Ud(r,`style`,a),Kf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=zf(n.href);var o=e.querySelector(Bf(a));if(o)return t.state.loading|=4,t.instance=o,Et(o),o;r=Vf(n),(a=Cf.get(a))&&qf(r,a),o=(e.ownerDocument||e).createElement(`link`),Et(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Ud(o,`link`,r),t.state.loading|=4,Kf(o,n.precedence,e),t.instance=o;case`script`:return o=Uf(n.src),(a=e.querySelector(Wf(o)))?(t.instance=a,Et(a),a):(r=n,(a=Cf.get(o))&&(r=f({},n),Jf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Et(a),Ud(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Kf(r,n.precedence,e));return t.instance}function Kf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function qf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Jf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Yf=null;function Xf(e,t,n){if(Yf===null){var r=new Map,i=Yf=new Map;i.set(n,r)}else i=Yf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[bt]||a[pt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Zf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Qf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function $f(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function ep(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=zf(r.href),a=t.querySelector(Bf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=rp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Et(a);return}a=t.ownerDocument||t,r=Vf(r),(i=Cf.get(i))&&qf(r,i),a=a.createElement(`link`),Et(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ud(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=rp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var tp=0;function np(e,t){return e.stylesheets&&e.count===0&&ap(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ap(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&tp===0&&(tp=62500*Kd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ap(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>tp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ap(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ip=null;function ap(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ip=new Map,t.forEach(op,e),ip=null,rp.call(e))}function op(e,t){if(!(t.state.loading&4)){var n=ip.get(e);if(n)var r=n.get(null);else{n=new Map,ip.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=rp.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var G={$$typeof:C,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function sp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nt(0),this.hiddenUpdates=nt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function cp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new sp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ci(3,null,null,t),e.current=a,a.stateNode=e,t=sa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ba(a),e}function lp(e){return e?(e=oi,e):oi}function up(e,t,n,r,i,a){i=lp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ha(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ua(e,r,t),n!==null&&(Su(n,e,t),Wa(n,e,t))}function dp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fp(e,t){dp(e,t),(e=e.alternate)&&dp(e,t)}function pp(e){if(e.tag===13||e.tag===31){var t=ri(e,67108864);t!==null&&Su(t,e,67108864),fp(e,67108864)}}function K(e){if(e.tag===13||e.tag===31){var t=bu();t=ct(t);var n=ri(e,t);n!==null&&Su(n,e,t),fp(e,t)}}var mp=!0;function hp(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=2,_p(e,t,n,r)}finally{j.p=a,A.T=i}}function gp(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=8,_p(e,t,n,r)}finally{j.p=a,A.T=i}}function _p(e,t,n,r){if(mp){var i=vp(r);if(i===null)Md(e,t,r,yp,n),Ap(e,r);else if(Mp(i,e,t,n,r))r.stopPropagation();else if(Ap(e,r),t&4&&-1<kp.indexOf(e)){for(;i!==null;){var a=Ct(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ze(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-We(o);s.entanglements[1]|=c,o&=~c}dd(a),!(Ul&6)&&(cu=Me()+500,fd(0,!1))}}break;case 31:case 13:s=ri(a,2),s!==null&&Su(s,a,2),Du(),fp(a,2)}if(a=vp(r),a===null&&Md(e,t,r,yp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Md(e,t,r,null,n)}}function vp(e){return e=ln(e),bp(e)}var yp=null;function bp(e){if(yp=null,e=St(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return yp=e,null}function xp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ne()){case Pe:return 2;case Fe:return 8;case Ie:case Le:return 32;case Re:return 268435456;default:return 32}default:return 32}}var Sp=!1,Cp=null,wp=null,Tp=null,Ep=new Map,Dp=new Map,Op=[],kp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Ap(e,t){switch(e){case`focusin`:case`focusout`:Cp=null;break;case`dragenter`:case`dragleave`:wp=null;break;case`mouseover`:case`mouseout`:Tp=null;break;case`pointerover`:case`pointerout`:Ep.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Dp.delete(t.pointerId)}}function jp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ct(t),t!==null&&pp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Mp(e,t,n,r,i){switch(t){case`focusin`:return Cp=jp(Cp,e,t,n,r,i),!0;case`dragenter`:return wp=jp(wp,e,t,n,r,i),!0;case`mouseover`:return Tp=jp(Tp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Ep.set(a,jp(Ep.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Dp.set(a,jp(Dp.get(a)||null,e,t,n,r,i)),!0}return!1}function Np(e){var t=St(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,dt(e.priority,function(){K(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,dt(e.priority,function(){K(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Pp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=vp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);cn=r,n.target.dispatchEvent(r),cn=null}else return t=Ct(n),t!==null&&pp(t),e.blockedOn=n,!1;t.shift()}return!0}function Fp(e,t,n){Pp(e)&&n.delete(t)}function Ip(){Sp=!1,Cp!==null&&Pp(Cp)&&(Cp=null),wp!==null&&Pp(wp)&&(wp=null),Tp!==null&&Pp(Tp)&&(Tp=null),Ep.forEach(Fp),Dp.forEach(Fp)}function Lp(e,n){e.blockedOn===n&&(e.blockedOn=null,Sp||(Sp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ip)))}var Rp=null;function zp(e){Rp!==e&&(Rp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Rp===e&&(Rp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(bp(r||n)===null)continue;break}var a=Ct(n);a!==null&&(e.splice(t,3),t-=3,Es(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Bp(e){function t(t){return Lp(t,e)}Cp!==null&&Lp(Cp,e),wp!==null&&Lp(wp,e),Tp!==null&&Lp(Tp,e),Ep.forEach(t),Dp.forEach(t);for(var n=0;n<Op.length;n++){var r=Op[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Op.length&&(n=Op[0],n.blockedOn===null);)Np(n),n.blockedOn===null&&Op.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[mt]||null;if(typeof a==`function`)o||zp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[mt]||null)s=o.formAction;else if(bp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),zp(n)}}}function Vp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Hp(e){this._internalRoot=e}Up.prototype.render=Hp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;up(n,bu(),e,t,null,null)},Up.prototype.unmount=Hp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;up(e.current,2,null,e,null,null),Du(),t[ht]=null}};function Up(e){this._internalRoot=e}Up.prototype.unstable_scheduleHydration=function(e){if(e){var t=ut();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Op.length&&t!==0&&t<Op[n].priority;n++);Op.splice(n,0,e),n===0&&Np(e)}};var Wp=n.version;if(Wp!==`19.2.8`)throw Error(i(527,Wp,`19.2.8`));j.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Gp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:A,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Kp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kp.isDisabled&&Kp.supportsFiber)try{Ve=Kp.inject(Gp),He=Kp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ys,s=Xs,c=Zs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=cp(e,1,!1,null,null,n,r,null,o,s,c,Vp),e[ht]=t.current,Ad(e),new Hp(t)}})),y=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=v()})),b={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},x={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},S=`attached`,C=`detached`,w=1e3,T=1001,E=1002,D=1003,O=1004,ee=1004,k=1005,te=1005,ne=1006,re=1007,ie=1007,ae=1008,A=1008,j=1009,oe=1010,se=1011,ce=1012,le=1013,ue=1014,de=1015,fe=1016,pe=1017,me=1018,he=1020,ge=35902,_e=35899,ve=1021,ye=1022,be=1023,xe=1026,Se=1027,Ce=1028,we=1029,Te=1030,Ee=1031,De=1032,Oe=1033,ke=33776,Ae=33777,je=33778,Me=33779,Ne=35840,Pe=35841,Fe=35842,Ie=35843,Le=36196,Re=37492,ze=37496,Be=37488,Ve=37489,He=37490,Ue=37491,We=37808,Ge=37809,Ke=37810,qe=37811,Je=37812,Ye=37813,Xe=37814,Ze=37815,Qe=37816,$e=37817,et=37818,tt=37819,nt=37820,rt=37821,it=36492,at=36494,ot=36495,st=36283,ct=36284,lt=36285,ut=36286,dt=2200,ft=2201,pt=2202,mt=2300,ht=2301,gt=2302,_t=2303,vt=2400,yt=2401,bt=2402,xt=2500,St=2501,Ct=3200,wt=3201,Tt=3202,Et=3203,Dt=`srgb`,Ot=`srgb-linear`,kt=`linear`,At=`srgb`,jt=7680,Mt=7681,Nt=7682,Pt=7683,Ft=34055,It=34056,Lt=5386,Rt=35044,zt=35048,Bt=35040,Vt=35045,Ht=35049,Ut=35041,Wt=35046,Gt=35050,Kt=35042,qt=`300 es`,Jt=2e3,Yt=2001,Xt={COMPUTE:`compute`,RENDER:`render`},Zt={PERSPECTIVE:`perspective`,LINEAR:`linear`,FLAT:`flat`},Qt={NORMAL:`normal`,CENTROID:`centroid`,SAMPLE:`sample`,FIRST:`first`,EITHER:`either`},$t={TEXTURE_COMPARE:`depthTextureCompare`};function en(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var tn={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function nn(e,t){return new tn[e](t)}function rn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function an(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function on(){let e=an(`canvas`);return e.style.display=`block`,e}var sn={},cn=null;function ln(e){cn=e}function un(){return cn}function dn(...e){let t=`THREE.`+e.shift();cn?cn(`log`,t,...e):console.log(t,...e)}function fn(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function M(...e){e=fn(e);let t=`THREE.`+e.shift();if(cn)cn(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function pn(...e){e=fn(e);let t=`THREE.`+e.shift();if(cn)cn(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function mn(...e){let t=e.join(` `);t in sn||(sn[t]=!0,M(...e))}function hn(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}var gn={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},_n=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n!==void 0&&n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},vn=`00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff`.split(`.`),yn=1234567,bn=Math.PI/180,xn=180/Math.PI;function Sn(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(vn[e&255]+vn[e>>8&255]+vn[e>>16&255]+vn[e>>24&255]+`-`+vn[t&255]+vn[t>>8&255]+`-`+vn[t>>16&15|64]+vn[t>>24&255]+`-`+vn[n&63|128]+vn[n>>8&255]+`-`+vn[n>>16&255]+vn[n>>24&255]+vn[r&255]+vn[r>>8&255]+vn[r>>16&255]+vn[r>>24&255]).toLowerCase()}function N(e,t,n){return Math.max(t,Math.min(n,e))}function Cn(e,t){return(e%t+t)%t}function wn(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function Tn(e,t,n){return e===t?0:(n-e)/(t-e)}function En(e,t,n){return(1-n)*e+n*t}function Dn(e,t,n,r){return En(e,t,1-Math.exp(-n*r))}function On(e,t=1){return t-Math.abs(Cn(e,t*2)-t)}function kn(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function An(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function jn(e,t){return e+Math.floor(Math.random()*(t-e+1))}function Mn(e,t){return e+Math.random()*(t-e)}function Nn(e){return e*(.5-Math.random())}function Pn(e){e!==void 0&&(yn=e);let t=yn+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Fn(e){return e*bn}function In(e){return e*xn}function Ln(e){return!(e&e-1)&&e!==0}function Rn(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function zn(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function Bn(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:M(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function Vn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}function P(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}var Hn={DEG2RAD:bn,RAD2DEG:xn,generateUUID:Sn,clamp:N,euclideanModulo:Cn,mapLinear:wn,inverseLerp:Tn,lerp:En,damp:Dn,pingpong:On,smoothstep:kn,smootherstep:An,randInt:jn,randFloat:Mn,randFloatSpread:Nn,seededRandom:Pn,degToRad:Fn,radToDeg:In,isPowerOfTwo:Ln,ceilPowerOfTwo:Rn,floorPowerOfTwo:zn,setQuaternionFromProperEuler:Bn,normalize:P,denormalize:Vn},F=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`THREE.Vector2: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`THREE.Vector2: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=N(this.x,e.x,t.x),this.y=N(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=N(this.x,e,t),this.y=N(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(N(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(N(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Un=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:M(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(N(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},I=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`THREE.Vector3: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`THREE.Vector3: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Gn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Gn.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=N(this.x,e.x,t.x),this.y=N(this.y,e.y,t.y),this.z=N(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=N(this.x,e,t),this.y=N(this.y,e,t),this.z=N(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(N(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Wn.copy(this).projectOnVector(e),this.sub(Wn)}reflect(e){return this.sub(Wn.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(N(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Wn=new I,Gn=new Un,Kn=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return mn(`Matrix3: .scale() is deprecated. Use .makeScale() instead.`),this.premultiply(qn.makeScale(e,t)),this}rotate(e){return mn(`Matrix3: .rotate() is deprecated. Use .makeRotation() instead.`),this.premultiply(qn.makeRotation(-e)),this}translate(e,t){return mn(`Matrix3: .translate() is deprecated. Use .makeTranslation() instead.`),this.premultiply(qn.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},qn=new Kn,Jn=new Kn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Yn=new Kn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Xn(){let e={enabled:!0,workingColorSpace:Ot,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=Qn(e.r),e.g=Qn(e.g),e.b=Qn(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=$n(e.r),e.g=$n(e.g),e.b=$n(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?kt:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return mn(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return mn(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Ot]:{primaries:t,whitePoint:r,transfer:kt,toXYZ:Jn,fromXYZ:Yn,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Dt},outputColorSpaceConfig:{drawingBufferColorSpace:Dt}},[Dt]:{primaries:t,whitePoint:r,transfer:At,toXYZ:Jn,fromXYZ:Yn,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Dt}}}),e}var Zn=Xn();function Qn(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function $n(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var er,tr=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{er===void 0&&(er=an(`canvas`)),er.width=e.width,er.height=e.height;let t=er.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=er}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=an(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=Qn(i[e]/255)*255;return n.putImageData(r,0,0),t}if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(Qn(t[e]/255)*255):t[e]=Qn(t[e]);return{data:t,width:e.width,height:e.height}}return M(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},nr=0,rr=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:nr++}),this.uuid=Sn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t===null?e.set(0,0,0):e.set(t.width,t.height,t.depth||0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(ir(r[t].image)):e.push(ir(r[t]))}else e=ir(r);n.url=e}return t||(e.images[this.uuid]=n),n}};function ir(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?tr.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(M(`Texture: Unable to serialize Texture.`),{})}var ar=0,or=new I,sr=class e extends _n{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=T,i=T,a=ne,o=ae,s=be,c=j,l=e.DEFAULT_ANISOTROPY,u=``){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ar++}),this.uuid=Sn(),this.name=``,this.source=new rr(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new F(0,0),this.repeat=new F(1,1),this.center=new F(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Kn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(or).x}get height(){return this.source.getSize(or).y}get depth(){return this.source.getSize(or).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){M(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){M(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case w:e.x-=Math.floor(e.x);break;case T:e.x=e.x<0?0:1;break;case E:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case w:e.y-=Math.floor(e.y);break;case T:e.y=e.y<0?0:1;break;case E:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};sr.DEFAULT_IMAGE=null,sr.DEFAULT_MAPPING=300,sr.DEFAULT_ANISOTROPY=1;var cr=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`THREE.Vector4: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`THREE.Vector4: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=N(this.x,e.x,t.x),this.y=N(this.y,e.y,t.y),this.z=N(this.z,e.z,t.z),this.w=N(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=N(this.x,e,t),this.y=N(this.y,e,t),this.z=N(this.z,e,t),this.w=N(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(N(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},lr=class extends _n{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ne,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new cr(0,0,e,t),this.scissorTest=!1,this.viewport=new cr(0,0,e,t),this.textures=[];let r=new sr({width:e,height:t,depth:n.depth}),i=n.count;for(let e=0;e<i;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:ne,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new rr(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:`dispose`})}},ur=class extends lr{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},dr=class extends sr{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=D,this.minFilter=D,this.wrapR=T,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},fr=class extends ur{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new dr(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},pr=class extends sr{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=D,this.minFilter=D,this.wrapR=T,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},mr=class extends ur{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new pr(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},L=class e{static{e.prototype.isMatrix4=!0}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/hr.setFromMatrixColumn(e,0).length(),i=1/hr.setFromMatrixColumn(e,1).length(),a=1/hr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(_r,e,vr)}lookAt(e,t,n){let r=this.elements;return xr.subVectors(e,t),xr.lengthSq()===0&&(xr.z=1),xr.normalize(),yr.crossVectors(n,xr),yr.lengthSq()===0&&(Math.abs(n.z)===1?xr.x+=1e-4:xr.z+=1e-4,xr.normalize(),yr.crossVectors(n,xr)),yr.normalize(),br.crossVectors(xr,yr),r[0]=yr.x,r[4]=br.x,r[8]=xr.x,r[1]=yr.y,r[5]=br.y,r[9]=xr.y,r[2]=yr.z,r[6]=br.z,r[10]=xr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],ee=r[2],k=r[6],te=r[10],ne=r[14],re=r[3],ie=r[7],ae=r[11],A=r[15];return i[0]=a*x+o*T+s*ee+c*re,i[4]=a*S+o*E+s*k+c*ie,i[8]=a*C+o*D+s*te+c*ae,i[12]=a*w+o*O+s*ne+c*A,i[1]=l*x+u*T+d*ee+f*re,i[5]=l*S+u*E+d*k+f*ie,i[9]=l*C+u*D+d*te+f*ae,i[13]=l*w+u*O+d*ne+f*A,i[2]=p*x+m*T+h*ee+g*re,i[6]=p*S+m*E+h*k+g*ie,i[10]=p*C+m*D+h*te+g*ae,i[14]=p*w+m*O+h*ne+g*A,i[3]=_*x+v*T+y*ee+b*re,i[7]=_*S+v*E+y*k+b*ie,i[11]=_*C+v*D+y*te+b*ae,i[15]=_*w+v*O+y*ne+b*A,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[1],a=e[5],o=e[9],s=e[2],c=e[6],l=e[10];return t*(a*l-o*c)-n*(i*l-o*s)+r*(i*c-a*s)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m,O=d*g-f*h,ee=_*O-v*D+y*E+b*T-x*w+S*C;if(ee===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let k=1/ee;return e[0]=(o*O-s*D+c*E)*k,e[1]=(r*D-n*O-i*E)*k,e[2]=(m*S-h*x+g*b)*k,e[3]=(d*x-u*S-f*b)*k,e[4]=(s*T-a*O-c*w)*k,e[5]=(t*O-r*T+i*w)*k,e[6]=(h*y-p*S-g*v)*k,e[7]=(l*S-d*y+f*v)*k,e[8]=(a*D-o*T+c*C)*k,e[9]=(n*T-t*D-i*C)*k,e[10]=(p*x-m*y+g*_)*k,e[11]=(u*y-l*x-f*_)*k,e[12]=(o*w-a*E-s*C)*k,e[13]=(t*E-n*w+r*C)*k,e[14]=(m*v-p*b-h*_)*k,e[15]=(l*b-u*v+d*_)*k,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinantAffine();if(i===0)return n.set(1,1,1),t.identity(),this;let a=hr.set(r[0],r[1],r[2]).length(),o=hr.set(r[4],r[5],r[6]).length(),s=hr.set(r[8],r[9],r[10]).length();i<0&&(a=-a),gr.copy(this);let c=1/a,l=1/o,u=1/s;return gr.elements[0]*=c,gr.elements[1]*=c,gr.elements[2]*=c,gr.elements[4]*=l,gr.elements[5]*=l,gr.elements[6]*=l,gr.elements[8]*=u,gr.elements[9]*=u,gr.elements[10]*=u,t.setFromRotationMatrix(gr),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=Jt,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=Jt,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},hr=new I,gr=new L,_r=new I(0,0,0),vr=new I(1,1,1),yr=new I,br=new I,xr=new I,Sr=new L,Cr=new Un,wr=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(N(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-N(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(N(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-N(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(N(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-N(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:M(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Sr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Sr,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Cr.setFromEuler(this),this.setFromQuaternion(Cr,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};wr.DEFAULT_ORDER=`XYZ`;var Tr=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return!!(this.mask&(1<<e|0))}},Er=0,Dr=new I,Or=new Un,kr=new L,Ar=new I,jr=new I,Mr=new I,Nr=new Un,Pr=new I(1,0,0),Fr=new I(0,1,0),Ir=new I(0,0,1),Lr={type:`added`},Rr={type:`removed`},zr={type:`childadded`,child:null},Br={type:`childremoved`,child:null},Vr=class e extends _n{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Er++}),this.uuid=Sn(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new I,n=new wr,r=new Un,i=new I(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new L},normalMatrix:{value:new Kn}}),this.matrix=new L,this.matrixWorld=new L,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Tr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Or.setFromAxisAngle(e,t),this.quaternion.multiply(Or),this}rotateOnWorldAxis(e,t){return Or.setFromAxisAngle(e,t),this.quaternion.premultiply(Or),this}rotateX(e){return this.rotateOnAxis(Pr,e)}rotateY(e){return this.rotateOnAxis(Fr,e)}rotateZ(e){return this.rotateOnAxis(Ir,e)}translateOnAxis(e,t){return Dr.copy(e).applyQuaternion(this.quaternion),this.position.add(Dr.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Pr,e)}translateY(e){return this.translateOnAxis(Fr,e)}translateZ(e){return this.translateOnAxis(Ir,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(kr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Ar.copy(e):Ar.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),jr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?kr.lookAt(jr,Ar,this.up):kr.lookAt(Ar,jr,this.up),this.quaternion.setFromRotationMatrix(kr),r&&(kr.extractRotation(r.matrixWorld),Or.setFromRotationMatrix(kr),this.quaternion.premultiply(Or.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(pn(`Object3D.add: object can't be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Lr),zr.child=e,this.dispatchEvent(zr),zr.child=null):pn(`Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Rr),Br.child=e,this.dispatchEvent(Br),Br.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),kr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),kr.multiply(e.parent.matrixWorld)),e.applyMatrix4(kr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Lr),zr.child=e,this.dispatchEvent(zr),zr.child=null,this}getObjectById(e){return this.getObjectByProperty(`id`,e)}getObjectByName(e){return this.getObjectByProperty(`name`,e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(jr,e,Mr),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(jr,Nr,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let e=this.children;for(let t=0,r=e.length;t<r;t++)e[t].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}};Vr.DEFAULT_UP=new I(0,1,0),Vr.DEFAULT_MATRIX_AUTO_UPDATE=!0,Vr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Hr=class extends Vr{constructor(){super(),this.isGroup=!0,this.type=`Group`}},Ur={type:`move`},Wr=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Hr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Hr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Hr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Ur)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Hr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Gr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Kr={h:0,s:0,l:0},qr={h:0,s:0,l:0};function Jr(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var R=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Dt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Zn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Zn.workingColorSpace){return this.r=e,this.g=t,this.b=n,Zn.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Zn.workingColorSpace){if(e=Cn(e,1),t=N(t,0,1),n=N(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Jr(i,r,e+1/3),this.g=Jr(i,r,e),this.b=Jr(i,r,e-1/3)}return Zn.colorSpaceToWorking(this,r),this}setStyle(e,t=Dt){function n(t){t!==void 0&&parseFloat(t)<1&&M(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:M(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);M(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Dt){let n=Gr[e.toLowerCase()];return n===void 0?M(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Qn(e.r),this.g=Qn(e.g),this.b=Qn(e.b),this}copyLinearToSRGB(e){return this.r=$n(e.r),this.g=$n(e.g),this.b=$n(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Dt){return Zn.workingToColorSpace(Yr.copy(this),e),Math.round(N(Yr.r*255,0,255))*65536+Math.round(N(Yr.g*255,0,255))*256+Math.round(N(Yr.b*255,0,255))}getHexString(e=Dt){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Zn.workingColorSpace){Zn.workingToColorSpace(Yr.copy(this),t);let n=Yr.r,r=Yr.g,i=Yr.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=Zn.workingColorSpace){return Zn.workingToColorSpace(Yr.copy(this),t),e.r=Yr.r,e.g=Yr.g,e.b=Yr.b,e}getStyle(e=Dt){Zn.workingToColorSpace(Yr.copy(this),e);let t=Yr.r,n=Yr.g,r=Yr.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(Kr),this.setHSL(Kr.h+e,Kr.s+t,Kr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Kr),e.getHSL(qr);let n=En(Kr.h,qr.h,t),r=En(Kr.s,qr.s,t),i=En(Kr.l,qr.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Yr=new R;R.NAMES=Gr;var Xr=class e{constructor(e,t=25e-5){this.isFogExp2=!0,this.name=``,this.color=new R(e),this.density=t}clone(){return new e(this.color,this.density)}toJSON(){return{type:`FogExp2`,name:this.name,color:this.color.getHex(),density:this.density}}},Zr=class e{constructor(e,t=1,n=1e3){this.isFog=!0,this.name=``,this.color=new R(e),this.near=t,this.far=n}clone(){return new e(this.color,this.near,this.far)}toJSON(){return{type:`Fog`,name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},Qr=class extends Vr{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new wr,this.environmentIntensity=1,this.environmentRotation=new wr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},$r=new I,ei=new I,ti=new I,ni=new I,ri=new I,ii=new I,ai=new I,oi=new I,si=new I,ci=new I,li=new cr,ui=new cr,di=new cr,fi=class e{constructor(e=new I,t=new I,n=new I){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),$r.subVectors(e,t),r.cross($r);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){$r.subVectors(r,t),ei.subVectors(n,t),ti.subVectors(e,t);let a=$r.dot($r),o=$r.dot(ei),s=$r.dot(ti),c=ei.dot(ei),l=ei.dot(ti),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,ni)!==null&&ni.x>=0&&ni.y>=0&&ni.x+ni.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ni)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,ni.x),s.addScaledVector(a,ni.y),s.addScaledVector(o,ni.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return li.setScalar(0),ui.setScalar(0),di.setScalar(0),li.fromBufferAttribute(e,t),ui.fromBufferAttribute(e,n),di.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(li,i.x),a.addScaledVector(ui,i.y),a.addScaledVector(di,i.z),a}static isFrontFacing(e,t,n,r){return $r.subVectors(n,t),ei.subVectors(e,t),$r.cross(ei).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return $r.subVectors(this.c,this.b),ei.subVectors(this.a,this.b),$r.cross(ei).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;ri.subVectors(r,n),ii.subVectors(i,n),oi.subVectors(e,n);let s=ri.dot(oi),c=ii.dot(oi);if(s<=0&&c<=0)return t.copy(n);si.subVectors(e,r);let l=ri.dot(si),u=ii.dot(si);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(ri,a);ci.subVectors(e,i);let f=ri.dot(ci),p=ii.dot(ci);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(ii,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return ai.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(ai,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(ri,a).addScaledVector(ii,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},pi=class{constructor(e=new I(1/0,1/0,1/0),t=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(hi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(hi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=hi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,hi):hi.fromBufferAttribute(r,t),hi.applyMatrix4(e.matrixWorld),this.expandByPoint(hi);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),gi.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),gi.copy(e.boundingBox)),gi.applyMatrix4(e.matrixWorld),this.union(gi)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,hi),hi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ci),wi.subVectors(this.max,Ci),_i.subVectors(e.a,Ci),vi.subVectors(e.b,Ci),yi.subVectors(e.c,Ci),bi.subVectors(vi,_i),xi.subVectors(yi,vi),Si.subVectors(_i,yi);let t=[0,-bi.z,bi.y,0,-xi.z,xi.y,0,-Si.z,Si.y,bi.z,0,-bi.x,xi.z,0,-xi.x,Si.z,0,-Si.x,-bi.y,bi.x,0,-xi.y,xi.x,0,-Si.y,Si.x,0];return!Di(t,_i,vi,yi,wi)||(t=[1,0,0,0,1,0,0,0,1],!Di(t,_i,vi,yi,wi))?!1:(Ti.crossVectors(bi,xi),t=[Ti.x,Ti.y,Ti.z],Di(t,_i,vi,yi,wi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,hi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(hi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(mi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),mi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),mi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),mi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),mi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),mi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),mi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),mi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(mi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},mi=[new I,new I,new I,new I,new I,new I,new I,new I],hi=new I,gi=new pi,_i=new I,vi=new I,yi=new I,bi=new I,xi=new I,Si=new I,Ci=new I,wi=new I,Ti=new I,Ei=new I;function Di(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){Ei.fromArray(e,a);let o=i.x*Math.abs(Ei.x)+i.y*Math.abs(Ei.y)+i.z*Math.abs(Ei.z),s=t.dot(Ei),c=n.dot(Ei),l=r.dot(Ei);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var Oi=ki();function ki(){let e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[e|256]=32768,i[e]=24,i[e|256]=24):t<-14?(r[e]=1024>>-t-14,r[e|256]=1024>>-t-14|32768,i[e]=-t-1,i[e|256]=-t-1):t<=15?(r[e]=t+15<<10,r[e|256]=t+15<<10|32768,i[e]=13,i[e|256]=13):t<128?(r[e]=31744,r[e|256]=64512,i[e]=24,i[e|256]=24):(r[e]=31744,r[e|256]=64512,i[e]=13,i[e|256]=13)}let a=new Uint32Array(2048),o=new Uint32Array(64),s=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(t&8388608);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)o[e]=e<<23;o[31]=1199570944,o[32]=2147483648;for(let e=33;e<63;++e)o[e]=2147483648+(e-32<<23);o[63]=3347054592;for(let e=1;e<64;++e)e!==32&&(s[e]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:a,exponentTable:o,offsetTable:s}}function Ai(e){Math.abs(e)>65504&&M(`DataUtils.toHalfFloat(): Value out of range.`),e=N(e,-65504,65504),Oi.floatView[0]=e;let t=Oi.uint32View[0],n=t>>23&511;return Oi.baseTable[n]+((t&8388607)>>Oi.shiftTable[n])}function ji(e){let t=e>>10;return Oi.uint32View[0]=Oi.mantissaTable[Oi.offsetTable[t]+(e&1023)]+Oi.exponentTable[t],Oi.floatView[0]}var Mi=class{static toHalfFloat(e){return Ai(e)}static fromHalfFloat(e){return ji(e)}},Ni=new I,Pi=new F,Fi=0,Ii=class extends _n{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Fi++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=Rt,this.updateRanges=[],this.gpuType=de,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Pi.fromBufferAttribute(this,t),Pi.applyMatrix3(e),this.setXY(t,Pi.x,Pi.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Ni.fromBufferAttribute(this,t),Ni.applyMatrix3(e),this.setXYZ(t,Ni.x,Ni.y,Ni.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Ni.fromBufferAttribute(this,t),Ni.applyMatrix4(e),this.setXYZ(t,Ni.x,Ni.y,Ni.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ni.fromBufferAttribute(this,t),Ni.applyNormalMatrix(e),this.setXYZ(t,Ni.x,Ni.y,Ni.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ni.fromBufferAttribute(this,t),Ni.transformDirection(e),this.setXYZ(t,Ni.x,Ni.y,Ni.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Vn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=P(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Vn(t,this.array)),t}setX(e,t){return this.normalized&&(t=P(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Vn(t,this.array)),t}setY(e,t){return this.normalized&&(t=P(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Vn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=P(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Vn(t,this.array)),t}setW(e,t){return this.normalized&&(t=P(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=P(t,this.array),n=P(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=P(t,this.array),n=P(n,this.array),r=P(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=P(t,this.array),n=P(n,this.array),r=P(r,this.array),i=P(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==``&&(e.name=this.name),this.usage!==35044&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:`dispose`})}},Li=class extends Ii{constructor(e,t,n){super(new Int8Array(e),t,n)}},Ri=class extends Ii{constructor(e,t,n){super(new Uint8Array(e),t,n)}},zi=class extends Ii{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}},Bi=class extends Ii{constructor(e,t,n){super(new Int16Array(e),t,n)}},Vi=class extends Ii{constructor(e,t,n){super(new Uint16Array(e),t,n)}},Hi=class extends Ii{constructor(e,t,n){super(new Int32Array(e),t,n)}},Ui=class extends Ii{constructor(e,t,n){super(new Uint32Array(e),t,n)}},Wi=class extends Ii{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=ji(this.array[e*this.itemSize]);return this.normalized&&(t=Vn(t,this.array)),t}setX(e,t){return this.normalized&&(t=P(t,this.array)),this.array[e*this.itemSize]=Ai(t),this}getY(e){let t=ji(this.array[e*this.itemSize+1]);return this.normalized&&(t=Vn(t,this.array)),t}setY(e,t){return this.normalized&&(t=P(t,this.array)),this.array[e*this.itemSize+1]=Ai(t),this}getZ(e){let t=ji(this.array[e*this.itemSize+2]);return this.normalized&&(t=Vn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=P(t,this.array)),this.array[e*this.itemSize+2]=Ai(t),this}getW(e){let t=ji(this.array[e*this.itemSize+3]);return this.normalized&&(t=Vn(t,this.array)),t}setW(e,t){return this.normalized&&(t=P(t,this.array)),this.array[e*this.itemSize+3]=Ai(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=P(t,this.array),n=P(n,this.array)),this.array[e+0]=Ai(t),this.array[e+1]=Ai(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=P(t,this.array),n=P(n,this.array),r=P(r,this.array)),this.array[e+0]=Ai(t),this.array[e+1]=Ai(n),this.array[e+2]=Ai(r),this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=P(t,this.array),n=P(n,this.array),r=P(r,this.array),i=P(i,this.array)),this.array[e+0]=Ai(t),this.array[e+1]=Ai(n),this.array[e+2]=Ai(r),this.array[e+3]=Ai(i),this}},z=class extends Ii{constructor(e,t,n){super(new Float32Array(e),t,n)}},Gi=new pi,Ki=new I,qi=new I,Ji=class{constructor(e=new I,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?Gi.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ki.subVectors(e,this.center);let t=Ki.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(Ki,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(qi.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ki.copy(e.center).add(qi)),this.expandByPoint(Ki.copy(e.center).sub(qi))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Yi=0,Xi=new L,Zi=new Vr,Qi=new I,$i=new pi,ea=new pi,ta=new I,B=class e extends _n{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Yi++}),this.uuid=Sn(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(en(e)?Ui:Vi)(e,1):e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new Kn().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Xi.makeRotationFromQuaternion(e),this.applyMatrix4(Xi),this}rotateX(e){return Xi.makeRotationX(e),this.applyMatrix4(Xi),this}rotateY(e){return Xi.makeRotationY(e),this.applyMatrix4(Xi),this}rotateZ(e){return Xi.makeRotationZ(e),this.applyMatrix4(Xi),this}translate(e,t,n){return Xi.makeTranslation(e,t,n),this.applyMatrix4(Xi),this}scale(e,t,n){return Xi.makeScale(e,t,n),this.applyMatrix4(Xi),this}lookAt(e){return Zi.lookAt(e),Zi.updateMatrix(),this.applyMatrix4(Zi.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qi).negate(),this.translate(Qi.x,Qi.y,Qi.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new z(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&M(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pi);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){pn(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];$i.setFromBufferAttribute(n),this.morphTargetsRelative?(ta.addVectors(this.boundingBox.min,$i.min),this.boundingBox.expandByPoint(ta),ta.addVectors(this.boundingBox.max,$i.max),this.boundingBox.expandByPoint(ta)):(this.boundingBox.expandByPoint($i.min),this.boundingBox.expandByPoint($i.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&pn(`BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ji);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){pn(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new I,1/0);return}if(e){let n=this.boundingSphere.center;if($i.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];ea.setFromBufferAttribute(n),this.morphTargetsRelative?(ta.addVectors($i.min,ea.min),$i.expandByPoint(ta),ta.addVectors($i.max,ea.max),$i.expandByPoint(ta)):($i.expandByPoint(ea.min),$i.expandByPoint(ea.max))}$i.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)ta.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(ta));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)ta.fromBufferAttribute(a,t),o&&(Qi.fromBufferAttribute(e,t),ta.add(Qi)),r=Math.max(r,n.distanceToSquared(ta))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&pn(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){pn(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv,a=this.getAttribute(`tangent`);(a===void 0||a.count!==n.count)&&(a=new Ii(new Float32Array(4*n.count),4),this.setAttribute(`tangent`,a));let o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new I,s[e]=new I;let c=new I,l=new I,u=new I,d=new F,f=new F,p=new F,m=new I,h=new I;function g(e,t,r){c.fromBufferAttribute(n,e),l.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),f.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),l.sub(c),u.sub(c),f.sub(d),p.sub(d);let a=1/(f.x*p.y-p.x*f.y);isFinite(a)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(a),h.copy(u).multiplyScalar(f.x).addScaledVector(l,-p.x).multiplyScalar(a),o[e].add(m),o[t].add(m),o[r].add(m),s[e].add(h),s[t].add(h),s[r].add(h))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new I,y=new I,b=new I,x=new I;function S(e){b.fromBufferAttribute(r,e),x.copy(b);let t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)S(e.getX(t+0)),S(e.getX(t+1)),S(e.getX(t+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0||n.count!==t.count)n=new Ii(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new I,i=new I,a=new I,o=new I,s=new I,c=new I,l=new I,u=new I;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ta.fromBufferAttribute(e,t),ta.normalize(),e.setXYZ(t,ta.x,ta.y,ta.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new Ii(a,r,i)}if(this.index===null)return M(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?`BufferGeometry`:this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:`dispose`})}},na=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=Rt,this.updateRanges=[],this.version=0,this.uuid=Sn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Sn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Sn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},ra=new I,ia=class e{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)ra.fromBufferAttribute(this,t),ra.applyMatrix4(e),this.setXYZ(t,ra.x,ra.y,ra.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ra.fromBufferAttribute(this,t),ra.applyNormalMatrix(e),this.setXYZ(t,ra.x,ra.y,ra.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ra.fromBufferAttribute(this,t),ra.transformDirection(e),this.setXYZ(t,ra.x,ra.y,ra.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Vn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=P(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=P(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=P(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=P(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=P(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Vn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Vn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Vn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Vn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=P(t,this.array),n=P(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=P(t,this.array),n=P(n,this.array),r=P(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=P(t,this.array),n=P(n,this.array),r=P(r,this.array),i=P(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}clone(t){if(t===void 0){dn(`InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new Ii(new this.array.constructor(e),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){dn(`InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},aa=0,oa=class extends _n{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:aa++}),this.uuid=Sn(),this.name=``,this.type=`Material`,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new R(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=jt,this.stencilZFail=jt,this.stencilZPass=jt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){M(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){M(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new R().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(this.vertexColors=typeof e.vertexColors==`number`?e.vertexColors>0:e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let t=e.normalScale;Array.isArray(t)===!1&&(t=[t,t]),this.normalScale=new F().fromArray(t)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new F().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},sa=class extends oa{constructor(e){super(),this.isSpriteMaterial=!0,this.type=`SpriteMaterial`,this.color=new R(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},ca,la=new I,ua=new I,da=new I,fa=new F,pa=new F,ma=new L,ha=new I,ga=new I,_a=new I,va=new F,ya=new F,ba=new F,xa=class extends Vr{constructor(e=new sa){if(super(),this.isSprite=!0,this.type=`Sprite`,ca===void 0){ca=new B;let e=new na(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);ca.setIndex([0,1,2,0,2,3]),ca.setAttribute(`position`,new ia(e,3,0,!1)),ca.setAttribute(`uv`,new ia(e,2,3,!1))}this.geometry=ca,this.material=e,this.center=new F(.5,.5),this.count=1}raycast(e,t){e.camera===null&&pn(`Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),ua.setFromMatrixScale(this.matrixWorld),ma.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),da.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ua.multiplyScalar(-da.z);let n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;Sa(ha.set(-.5,-.5,0),da,a,ua,r,i),Sa(ga.set(.5,-.5,0),da,a,ua,r,i),Sa(_a.set(.5,.5,0),da,a,ua,r,i),va.set(0,0),ya.set(1,0),ba.set(1,1);let o=e.ray.intersectTriangle(ha,ga,_a,!1,la);if(o===null&&(Sa(ga.set(-.5,.5,0),da,a,ua,r,i),ya.set(0,1),o=e.ray.intersectTriangle(ha,_a,ga,!1,la),o===null))return;let s=e.ray.origin.distanceTo(la);s<e.near||s>e.far||t.push({distance:s,point:la.clone(),uv:fi.getInterpolation(la,ha,ga,_a,va,ya,ba,new F),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function Sa(e,t,n,r,i,a){fa.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?pa.copy(fa):(pa.x=a*fa.x-i*fa.y,pa.y=i*fa.x+a*fa.y),e.copy(t),e.x+=pa.x,e.y+=pa.y,e.applyMatrix4(ma)}var Ca=new I,wa=new I,Ta=class extends Vr{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type=`LOD`,Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,n=t.length;e<n;e++){let n=t[e];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);let r=this.levels,i;for(i=0;i<r.length&&!(t<r[i].distance);i++);return r.splice(i,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){let t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){let e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Ca.setFromMatrixPosition(this.matrixWorld);let n=e.ray.origin.distanceTo(Ca);this.getObjectForDistance(n).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){Ca.setFromMatrixPosition(e.matrixWorld),wa.setFromMatrixPosition(this.matrixWorld);let n=Ca.distanceTo(wa)/e.zoom;t[0].object.visible=!0;let r,i;for(r=1,i=t.length;r<i;r++){let e=t[r].distance;if(t[r].object.visible&&(e-=e*t[r].hysteresis),n>=e)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}}toJSON(e){let t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];let n=this.levels;for(let e=0,r=n.length;e<r;e++){let r=n[e];t.object.levels.push({object:r.object.uuid,distance:r.distance,hysteresis:r.hysteresis})}return t}},Ea=new I,Da=new I,Oa=new I,ka=new I,Aa=new I,ja=new I,Ma=new I,Na=class{constructor(e=new I,t=new I(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ea)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Ea.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ea.copy(this.origin).addScaledVector(this.direction,t),Ea.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Da.copy(e).add(t).multiplyScalar(.5),Oa.copy(t).sub(e).normalize(),ka.copy(this.origin).sub(Da);let i=e.distanceTo(t)*.5,a=-this.direction.dot(Oa),o=ka.dot(this.direction),s=-ka.dot(Oa),c=ka.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Da).addScaledVector(Oa,d),f}intersectSphere(e,t){Ea.subVectors(e.center,this.origin);let n=Ea.dot(this.direction),r=Ea.dot(Ea)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Ea)!==null}intersectTriangle(e,t,n,r,i){Aa.subVectors(t,e),ja.subVectors(n,e),Ma.crossVectors(Aa,ja);let a=this.direction.dot(Ma),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ka.subVectors(this.origin,e);let s=o*this.direction.dot(ja.crossVectors(ka,ja));if(s<0)return null;let c=o*this.direction.dot(Aa.cross(ka));if(c<0||s+c>a)return null;let l=-o*ka.dot(Ma);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Pa=class extends oa{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new R(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new wr,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Fa=new L,Ia=new Na,La=new Ji,Ra=new I,za=new I,Ba=new I,Va=new I,Ha=new I,Ua=new I,Wa=new I,Ga=new I,Ka=class extends Vr{constructor(e=new B,t=new Pa){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){Ua.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(Ha.fromBufferAttribute(s,e),a?Ua.addScaledVector(Ha,r):Ua.addScaledVector(Ha.sub(t),r))}t.add(Ua)}return t}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),La.copy(n.boundingSphere),La.applyMatrix4(i),Ia.copy(e.ray).recast(e.near),!(La.containsPoint(Ia.origin)===!1&&(Ia.intersectSphere(La,Ra)===null||Ia.origin.distanceToSquared(Ra)>(e.far-e.near)**2))&&(Fa.copy(i).invert(),Ia.copy(e.ray).applyMatrix4(Fa),(n.boundingBox===null||Ia.intersectsBox(n.boundingBox)!==!1)&&this._computeIntersections(e,t,Ia)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=Ja(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=Ja(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}else if(s!==void 0)if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=Ja(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=Ja(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}};function qa(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;Ga.copy(s),Ga.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(Ga);return l<n.near||l>n.far?null:{distance:l,point:Ga.clone(),object:e}}function Ja(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,za),e.getVertexPosition(c,Ba),e.getVertexPosition(l,Va);let u=qa(e,t,n,r,za,Ba,Va,Wa);if(u){let e=new I;fi.getBarycoord(Wa,za,Ba,Va,e),i&&(u.uv=fi.getInterpolatedAttribute(i,s,c,l,e,new F)),a&&(u.uv1=fi.getInterpolatedAttribute(a,s,c,l,e,new F)),o&&(u.normal=fi.getInterpolatedAttribute(o,s,c,l,e,new I),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new I,materialIndex:0};fi.getNormal(za,Ba,Va,t.normal),u.face=t,u.barycoord=e}return u}var Ya=new cr,Xa=new cr,Za=new cr,Qa=new cr,$a=new L,eo=new I,to=new Ji,no=new L,ro=new Na,io=class extends Ka{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type=`SkinnedMesh`,this.bindMode=S,this.bindMatrix=new L,this.bindMatrixInverse=new L,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new pi),this.boundingBox.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,eo),this.boundingBox.expandByPoint(eo)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Ji),this.boundingSphere.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,eo),this.boundingSphere.expandByPoint(eo)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),to.copy(this.boundingSphere),to.applyMatrix4(r),e.ray.intersectsSphere(to)!==!1&&(no.copy(r).invert(),ro.copy(e.ray).applyMatrix4(no),(this.boundingBox===null||ro.intersectsBox(this.boundingBox)!==!1)&&this._computeIntersections(e,t,ro)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new cr,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r===1/0?e.set(1,0,0,0):e.multiplyScalar(r),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===`attached`?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===`detached`?this.bindMatrixInverse.copy(this.bindMatrix).invert():M(`SkinnedMesh: Unrecognized bindMode: `+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,r=this.geometry;Xa.fromBufferAttribute(r.attributes.skinIndex,e),Za.fromBufferAttribute(r.attributes.skinWeight,e),t.isVector4?(Ya.copy(t),t.set(0,0,0,0)):(Ya.set(...t,1),t.set(0,0,0)),Ya.applyMatrix4(this.bindMatrix);for(let e=0;e<4;e++){let r=Za.getComponent(e);if(r!==0){let i=Xa.getComponent(e);$a.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(Qa.copy(Ya).applyMatrix4($a),r)}}return t.isVector4&&(t.w=Ya.w),t.applyMatrix4(this.bindMatrixInverse)}},ao=class extends Vr{constructor(){super(),this.isBone=!0,this.type=`Bone`}},oo=class extends sr{constructor(e=null,t=1,n=1,r,i,a,o,s,c=D,l=D,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},so=new L,co=new L,lo=class e{constructor(e=[],t=[]){this.uuid=Sn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){M(`Skeleton: Number of inverse bone matrices does not match amount of bones.`),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new L)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new L;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=e.length;r<i;r++){let i=e[r]?e[r].matrixWorld:co;so.multiplyMatrices(i,t[r]),so.toArray(n,r*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new e(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new oo(t,e,e,be,de);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let n=this.bones[t];if(n.name===e)return n}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){let r=e.bones[n],i=t[r];i===void 0&&(M(`Skeleton: No bone found with UUID:`,r),i=new ao),this.bones.push(i),this.boneInverses.push(new L().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:`Skeleton`,generator:`Skeleton.toJSON`},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let r=0,i=t.length;r<i;r++){let i=t[r];e.bones.push(i.uuid);let a=n[r];e.boneInverses.push(a.toArray())}return e}},uo=class extends Ii{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},fo=new L,V=new L,po=[],mo=new pi,ho=new L,go=new Ka,_o=new Ji,vo=class extends Ka{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new uo(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,ho)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new pi),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,fo),mo.copy(e.boundingBox).applyMatrix4(fo),this.boundingBox.union(mo)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Ji),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,fo),_o.copy(e.boundingSphere).applyMatrix4(fo),this.boundingSphere.union(_o)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,i=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=r[i+e]}raycast(e,t){let n=this.matrixWorld,r=this.count;if(go.geometry=this.geometry,go.material=this.material,go.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_o.copy(this.boundingSphere),_o.applyMatrix4(n),e.ray.intersectsSphere(_o)!==!1))for(let i=0;i<r;i++){this.getMatrixAt(i,fo),V.multiplyMatrices(n,fo),go.matrixWorld=V,go.raycast(e,po);for(let e=0,n=po.length;e<n;e++){let n=po[e];n.instanceId=i,n.object=this,t.push(n)}po.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new uo(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new oo(new Float32Array(r*this.count),r,this.count,Ce,de));let i=this.morphTexture.source.data.data,a=0;for(let e=0;e<n.length;e++)a+=n[e];let o=this.geometry.morphTargetsRelative?1:1-a,s=r*e;return i[s]=o,i.set(n,s+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:`dispose`}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},yo=new I,bo=new I,xo=new Kn,So=class{constructor(e=new I(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=yo.subVectors(n,t).cross(bo.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(yo),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||xo.getNormalMatrix(e),r=this.coplanarPoint(yo).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},Co=new Ji,wo=new F(.5,.5),To=new I,Eo=class{constructor(e=new So,t=new So,n=new So,r=new So,i=new So,a=new So){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Jt,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Co.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Co.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Co)}intersectsSprite(e){return Co.center.set(0,0,0),Co.radius=.7071067811865476+wo.distanceTo(e.center),Co.applyMatrix4(e.matrixWorld),this.intersectsSphere(Co)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(To.x=r.normal.x>0?e.max.x:e.min.x,To.y=r.normal.y>0?e.max.y:e.min.y,To.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(To)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},Do=new L,Oo=class e{constructor(){this.coordinateSystem=Jt,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let e=0;e<t.length;e++){let r=t[e];Do.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),n[e]===void 0&&(n[e]=new Eo),n[e].setFromProjectionMatrix(Do,r.coordinateSystem,r.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new Eo),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new e().copy(this)}};function ko(e,t){return e-t}function Ao(e,t){return e.z-t.z}function jo(e,t){return t.z-e.z}var Mo=class{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,r){let i=this.pool,a=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});let o=i[this.index];a.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}},No=new L,Po=new R(1,1,1),Fo=new Eo,Io=new Oo,Lo=new pi,Ro=new Ji,zo=new I,Bo=new I,Vo=new I,Ho=new Mo,Uo=new Ka,Wo=[];function Go(e,t,n=0){let r=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let i=e.count;for(let a=0;a<i;a++)for(let i=0;i<r;i++)t.setComponent(a+n,i,e.getComponent(a,i))}else t.array.set(e.array,n*r);t.needsUpdate=!0}function Ko(e,t){if(e.constructor!==t.constructor){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)t[r]=e[r]}else{let n=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,n))}}var qo=class extends Ka{constructor(e,t,n=t*2,r){super(new B,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new oo(new Float32Array(e*e*4),e,e,be,de);this._matricesTexture=t}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);let t=new oo(new Uint32Array(e*e),e,e,we,ue);this._indirectTexture=t}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);let t=new oo(new Float32Array(e*e*4).fill(1),e,e,be,de);t.colorSpace=Zn.workingColorSpace,this._colorsTexture=t}_initializeGeometry(e){let t=this.geometry,n=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(let r in e.attributes){let{array:i,itemSize:a,normalized:o}=e.getAttribute(r),s=new Ii(new i.constructor(n*a),a,o);t.setAttribute(r,s)}if(e.getIndex()!==null){let e=n>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new Ii(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error(`THREE.BatchedMesh: All geometries must consistently have "index".`);for(let n in t.attributes){if(!e.hasAttribute(n))throw Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);let r=e.getAttribute(n),i=t.getAttribute(n);if(r.itemSize!==i.itemSize||r.normalized!==i.normalized)throw Error(`THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.`)}}validateInstanceId(e){let t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){let t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pi);let e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;let r=t[n].geometryIndex;this.getMatrixAt(n,No),this.getBoundingBoxAt(r,Lo).applyMatrix4(No),e.union(Lo)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ji);let e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;let r=t[n].geometryIndex;this.getMatrixAt(n,No),this.getBoundingSphereAt(r,Ro).applyMatrix4(No),e.union(Ro)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw Error(`THREE.BatchedMesh: Maximum item count reached.`);let t={visible:!0,active:!0,geometryIndex:e},n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(ko),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));let r=this._matricesTexture;No.identity().toArray(r.image.data,n*16),r.needsUpdate=!0;let i=this._colorsTexture;return i&&(Po.toArray(i.image.data,n*4),i.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},i=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=t===-1?e.getAttribute(`position`).count:t;let a=e.getIndex();if(a!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=n===-1?a.count:n),r.indexStart!==-1&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error(`THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.`);let o;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(ko),o=this._availableGeometryIds.shift(),i[o]=r):(o=this._geometryCount,this._geometryCount++,i.push(r)),this.setGeometryAt(o,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,o}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error(`THREE.BatchedMesh: Maximum geometry count reached.`);this._validateGeometry(t);let n=this.geometry,r=n.getIndex()!==null,i=n.getIndex(),a=t.getIndex(),o=this._geometryInfo[e];if(r&&a.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw Error(`THREE.BatchedMesh: Reserved space not large enough for provided geometry.`);let s=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=t.getAttribute(`position`).count;for(let e in n.attributes){let r=t.getAttribute(e),i=n.getAttribute(e);Go(r,i,s);let a=r.itemSize;for(let e=r.count,t=c;e<t;e++){let t=s+e;for(let e=0;e<a;e++)i.setComponent(t,e,0)}i.needsUpdate=!0,i.addUpdateRange(s*a,c*a)}if(r){let e=o.indexStart,n=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let t=0;t<a.count;t++)i.setX(e+t,s+a.getX(t));for(let t=a.count,r=n;t<r;t++)i.setX(e+t,s);i.needsUpdate=!0,i.addUpdateRange(e,o.reservedIndexCount)}return o.start=r?o.indexStart:o.vertexStart,o.count=r?o.indexCount:o.vertexCount,o.boundingBox=null,t.boundingBox!==null&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,t.boundingSphere!==null&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){let t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;let n=this._instanceInfo;for(let t=0,r=n.length;t<r;t++)n[t].active&&n[t].geometryIndex===e&&this.deleteInstance(t);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0,n=this._geometryInfo,r=n.map((e,t)=>t).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),i=this.geometry;for(let a=0,o=n.length;a<o;a++){let o=n[r[a]];if(o.active!==!1){if(i.index!==null){if(o.indexStart!==t){let{indexStart:n,vertexStart:r,reservedIndexCount:a}=o,s=i.index,c=s.array,l=e-r;for(let e=n;e<n+a;e++)c[e]=c[e]+l;s.array.copyWithin(t,n,n+a),s.addUpdateRange(t,a),s.needsUpdate=!0,o.indexStart=t}t+=o.reservedIndexCount}if(o.vertexStart!==e){let{vertexStart:t,reservedVertexCount:n}=o,r=i.attributes;for(let i in r){let a=r[i],{array:o,itemSize:s}=a;o.copyWithin(e*s,t*s,(t+n)*s),a.addUpdateRange(e*s,n*s),a.needsUpdate=!0}o.vertexStart=e}e+=o.reservedVertexCount,o.start=i.index?o.indexStart:o.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){let e=new pi,t=n.index,i=n.attributes.position;for(let n=r.start,a=r.start+r.count;n<a;n++){let r=n;t&&(r=t.getX(r)),e.expandByPoint(zo.fromBufferAttribute(i,r))}r.boundingBox=e}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){let t=new Ji;this.getBoundingBoxAt(e,Lo),Lo.getCenter(t.center);let i=n.index,a=n.attributes.position,o=0;for(let e=r.start,n=r.start+r.count;e<n;e++){let n=e;i&&(n=i.getX(n)),zo.fromBufferAttribute(a,n),o=Math.max(o,t.center.distanceToSquared(zo))}t.radius=Math.sqrt(o),r.boundingSphere=t}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);let n=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null?t.isVector4?t.set(1,1,1,1):t.setRGB(1,1,1):t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);let n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){let t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(ko);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw Error(`THREE.BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);let r=new Int32Array(e),i=new Int32Array(e);Ko(this._multiDrawCounts,r),Ko(this._multiDrawStarts,i),this._multiDrawCounts=r,this._multiDrawStarts=i,this._maxInstanceCount=e;let a=this._indirectTexture,o=this._matricesTexture,s=this._colorsTexture;a.dispose(),this._initIndirectTexture(),Ko(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),Ko(o.image.data,this._matricesTexture.image.data),s&&(s.dispose(),this._initColorsTexture(),Ko(s.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){let n=[...this._geometryInfo].filter(e=>e.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw Error(`THREE.BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw Error(`THREE.BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);let r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new B,this._initializeGeometry(r));let i=this.geometry;r.index&&Ko(r.index.array,i.index.array);for(let e in r.attributes)Ko(r.attributes[e].array,i.attributes[e].array)}raycast(e,t){let n=this._instanceInfo,r=this._geometryInfo,i=this.matrixWorld,a=this.geometry;Uo.material=this.material,Uo.geometry.index=a.index,Uo.geometry.attributes=a.attributes,Uo.geometry.boundingBox===null&&(Uo.geometry.boundingBox=new pi),Uo.geometry.boundingSphere===null&&(Uo.geometry.boundingSphere=new Ji);for(let a=0,o=n.length;a<o;a++){if(!n[a].visible||!n[a].active)continue;let o=n[a].geometryIndex,s=r[o];Uo.geometry.setDrawRange(s.start,s.count),this.getMatrixAt(a,Uo.matrixWorld).premultiply(i),this.getBoundingBoxAt(o,Uo.geometry.boundingBox),this.getBoundingSphereAt(o,Uo.geometry.boundingSphere),Uo.raycast(e,Wo);for(let e=0,n=Wo.length;e<n;e++){let n=Wo[e];n.object=this,n.batchId=a,t.push(n)}Wo.length=0}Uo.material=null,Uo.geometry.index=null,Uo.geometry.attributes={},Uo.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox===null?null:e.boundingBox.clone(),this.boundingSphere=e.boundingSphere===null?null:e.boundingSphere.clone(),this._geometryInfo=e._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox===null?null:e.boundingBox.clone(),boundingSphere:e.boundingSphere===null?null:e.boundingSphere.clone()})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,r,i){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let a=r.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,s=1;i.wireframe&&(s=2,o=r.attributes.position.count>65535?4:2);let c=this._instanceInfo,l=this._multiDrawStarts,u=this._multiDrawCounts,d=this._geometryInfo,f=this.perObjectFrustumCulled,p=this._indirectTexture,m=p.image.data,h=n.isArrayCamera?Io:Fo;f&&(n.isArrayCamera?h.setFromArrayCamera(n):(No.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),h.setFromProjectionMatrix(No,n.coordinateSystem,n.reversedDepth)));let g=0;if(this.sortObjects){No.copy(this.matrixWorld).invert(),zo.setFromMatrixPosition(n.matrixWorld).applyMatrix4(No),Bo.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(No);for(let e=0,t=c.length;e<t;e++)if(c[e].visible&&c[e].active){let t=c[e].geometryIndex;this.getMatrixAt(e,No),this.getBoundingSphereAt(t,Ro).applyMatrix4(No);let n=!1;if(f&&(n=!h.intersectsSphere(Ro)),!n){let n=d[t],r=Vo.subVectors(Ro.center,zo).dot(Bo);Ho.push(n.start,n.count,r,e)}}let e=Ho.list,t=this.customSort;t===null?e.sort(i.transparent?jo:Ao):t.call(this,e,n);for(let t=0,n=e.length;t<n;t++){let n=e[t];l[g]=n.start*o*s,u[g]=n.count*s,m[g]=n.index,g++}Ho.reset()}else for(let e=0,t=c.length;e<t;e++)if(c[e].visible&&c[e].active){let t=c[e].geometryIndex,n=!1;if(f&&(this.getMatrixAt(e,No),this.getBoundingSphereAt(t,Ro).applyMatrix4(No),n=!h.intersectsSphere(Ro)),!n){let n=d[t];l[g]=n.start*o*s,u[g]=n.count*s,m[g]=e,g++}}p.needsUpdate=!0,this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(e,t,n,r,i,a){this.onBeforeRender(e,null,r,i,a)}},Jo=class extends oa{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new R(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Yo=new I,Xo=new I,Zo=new L,Qo=new Na,$o=new Ji,es=new I,ts=new I,ns=class extends Vr{constructor(e=new B,t=new Jo){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)Yo.fromBufferAttribute(t,e-1),Xo.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=Yo.distanceTo(Xo);e.setAttribute(`lineDistance`,new z(n,1))}else M(`Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),$o.copy(n.boundingSphere),$o.applyMatrix4(r),$o.radius+=i,e.ray.intersectsSphere($o)===!1)return;Zo.copy(r).invert(),Qo.copy(e.ray).applyMatrix4(Zo);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=this.isLineSegments?2:1,l=n.index,u=n.attributes.position;if(l!==null){let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=l.getX(i),r=l.getX(i+1),a=rs(this,e,Qo,s,n,r,i);a&&t.push(a)}if(this.isLineLoop){let i=l.getX(r-1),a=l.getX(n),o=rs(this,e,Qo,s,i,a,r-1);o&&t.push(o)}}else{let n=Math.max(0,a.start),r=Math.min(u.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=rs(this,e,Qo,s,i,i+1,i);n&&t.push(n)}if(this.isLineLoop){let i=rs(this,e,Qo,s,r-1,n,r-1);i&&t.push(i)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}};function rs(e,t,n,r,i,a,o){let s=e.geometry.attributes.position;if(Yo.fromBufferAttribute(s,i),Xo.fromBufferAttribute(s,a),n.distanceSqToSegment(Yo,Xo,es,ts)>r)return;es.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(es);if(!(c<t.near||c>t.far))return{distance:c,point:ts.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var is=new I,as=new I,os=class extends ns{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)is.fromBufferAttribute(t,e),as.fromBufferAttribute(t,e+1),n[e]=e===0?0:n[e-1],n[e+1]=n[e]+is.distanceTo(as);e.setAttribute(`lineDistance`,new z(n,1))}else M(`LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}},ss=class extends ns{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type=`LineLoop`}},cs=class extends oa{constructor(e){super(),this.isPointsMaterial=!0,this.type=`PointsMaterial`,this.color=new R(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},ls=new L,us=new Na,ds=new Ji,fs=new I,ps=class extends Vr{constructor(e=new B,t=new cs){super(),this.isPoints=!0,this.type=`Points`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ds.copy(n.boundingSphere),ds.applyMatrix4(r),ds.radius+=i,e.ray.intersectsSphere(ds)===!1)return;ls.copy(r).invert(),us.copy(e.ray).applyMatrix4(ls);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=n.index,l=n.attributes.position;if(c!==null){let n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let a=n,o=i;a<o;a++){let n=c.getX(a);fs.fromBufferAttribute(l,n),ms(fs,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(l.count,a.start+a.count);for(let a=n,o=i;a<o;a++)fs.fromBufferAttribute(l,a),ms(fs,a,s,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}};function ms(e,t,n,r,i,a,o){let s=us.distanceSqToPoint(e);if(s<n){let n=new I;us.closestPointToPoint(e,n),n.applyMatrix4(r);let c=i.ray.origin.distanceTo(n);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var hs=class extends sr{constructor(e,t,n,r,i=ne,a=ne,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let l=this;function u(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u)}`requestVideoFrameCallback`in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!(`requestVideoFrameCallback`in e)&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},gs=class extends hs{constructor(e,t,n,r,i,a,o,s){super({},e,t,n,r,i,a,o,s),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}},_s=class extends sr{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=D,this.minFilter=D,this.generateMipmaps=!1,this.needsUpdate=!0}},vs=class extends sr{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}},ys=class extends vs{constructor(e,t,n,r,i,a){super(e,t,n,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=T,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},bs=class extends vs{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}},xs=class extends sr{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},Ss=class extends sr{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},Cs=class extends sr{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;let l=e?e.parentNode:null;l!==null&&`requestPaint`in l&&(l.onpaint=()=>{this.needsUpdate=!0},l.requestPaint())}dispose(){let e=this.image?this.image.parentNode:null;e!==null&&`onpaint`in e&&(e.onpaint=null),super.dispose()}},ws=class extends sr{constructor(e,t,n=ue,r,i,a,o=D,s=D,c,l=xe,u=1){if(l!==1026&&l!==1027)throw Error(`THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new rr(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Ts=class extends ws{constructor(e,t=ue,n=301,r,i,a=D,o=D,s,c=xe){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},Es=class extends sr{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Ds=class e extends B{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new z(c,3)),this.setAttribute(`normal`,new z(l,3)),this.setAttribute(`uv`,new z(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new I;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)D[e]=(s*v-b)*r,D[t]=o*i,D[n]=S,c.push(D.x,D.y,D.z),D[e]=0,D[t]=0,D[n]=m>0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},Os=class e extends B{constructor(e=1,t=1,n=4,r=8,i=1){super(),this.type=`CapsuleGeometry`,this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:i},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r)),i=Math.max(1,Math.floor(i));let a=[],o=[],s=[],c=[],l=t/2,u=Math.PI/2*e,d=t,f=2*u+d,p=n*2+i,m=r+1,h=new I,g=new I;for(let _=0;_<=p;_++){let v=0,y=0,b=0,x=0;if(_<=n){let t=_/n,r=t*Math.PI/2;y=-l-e*Math.cos(r),b=e*Math.sin(r),x=-e*Math.cos(r),v=t*u}else if(_<=n+i){let r=(_-n)/i;y=-l+r*t,b=e,x=0,v=u+r*d}else{let t=(_-n-i)/n,r=t*Math.PI/2;y=l+e*Math.sin(r),b=e*Math.cos(r),x=e*Math.sin(r),v=u+d+t*u}let S=Math.max(0,Math.min(1,v/f)),C=0;_===0?C=.5/r:_===p&&(C=-.5/r);for(let e=0;e<=r;e++){let t=e/r,n=t*Math.PI*2,i=Math.sin(n),a=Math.cos(n);g.x=-b*a,g.y=y,g.z=b*i,o.push(g.x,g.y,g.z),h.set(-b*a,x,b*i),h.normalize(),s.push(h.x,h.y,h.z),c.push(t+C,S)}if(_>0){let e=(_-1)*m;for(let t=0;t<r;t++){let n=e+t,r=e+t+1,i=_*m+t,o=_*m+t+1;a.push(n,r,i),a.push(r,o,i)}}}this.setIndex(a),this.setAttribute(`position`,new z(o,3)),this.setAttribute(`normal`,new z(s,3)),this.setAttribute(`uv`,new z(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}},ks=class e extends B{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let i=[],a=[],o=[],s=[],c=new I,l=new F;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=t;i++,u+=3){let d=n+i/t*r;c.x=e*Math.cos(d),c.y=e*Math.sin(d),a.push(c.x,c.y,c.z),o.push(0,0,1),l.x=(a[u]/e+1)/2,l.y=(a[u+1]/e+1)/2,s.push(l.x,l.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute(`position`,new z(a,3)),this.setAttribute(`normal`,new z(o,3)),this.setAttribute(`uv`,new z(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.segments,t.thetaStart,t.thetaLength)}},As=class e extends B{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new z(u,3)),this.setAttribute(`normal`,new z(d,3)),this.setAttribute(`uv`,new z(f,2));function _(){let a=new I,_=new I,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n<r;n++)for(let r=0;r<i;r++){let a=m[r][n],o=m[r+1][n],s=m[r+1][n+1],c=m[r][n+1];(e>0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new F,m=new I,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e<r;e++){let t=i+e,r=b+e;n===!0?l.push(r,r+1,t):l.push(r+1,r,t),_+=3}c.addGroup(g,_,n===!0?1:2),g+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},js=class e extends As{constructor(e=1,t=1,n=32,r=1,i=!1,a=0,o=Math.PI*2){super(0,e,t,n,r,i,a,o),this.type=`ConeGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}static fromJSON(t){return new e(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},Ms=class e extends B{constructor(e=[],t=[],n=1,r=0){super(),this.type=`PolyhedronGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r};let i=[],a=[];o(r),c(n),l(),this.setAttribute(`position`,new z(i,3)),this.setAttribute(`normal`,new z(i.slice(),3)),this.setAttribute(`uv`,new z(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(e){let n=new I,r=new I,i=new I;for(let a=0;a<t.length;a+=3)f(t[a+0],n),f(t[a+1],r),f(t[a+2],i),s(n,r,i,e)}function s(e,t,n,r){let i=r+1,a=[];for(let r=0;r<=i;r++){a[r]=[];let o=e.clone().lerp(n,r/i),s=t.clone().lerp(n,r/i),c=i-r;for(let e=0;e<=c;e++)e===0&&r===i?a[r][e]=o:a[r][e]=o.clone().lerp(s,e/c)}for(let e=0;e<i;e++)for(let t=0;t<2*(i-e)-1;t++){let n=Math.floor(t/2);t%2==0?(d(a[e][n+1]),d(a[e+1][n]),d(a[e][n])):(d(a[e][n+1]),d(a[e+1][n+1]),d(a[e+1][n]))}}function c(e){let t=new I;for(let n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}function l(){let e=new I;for(let t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];let n=h(e)/2/Math.PI+.5,r=g(e)/Math.PI+.5;a.push(n,1-r)}p(),u()}function u(){for(let e=0;e<a.length;e+=6){let t=a[e+0],n=a[e+2],r=a[e+4];Math.max(t,n,r)>.9&&Math.min(t,n,r)<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}function d(e){i.push(e.x,e.y,e.z)}function f(t,n){let r=t*3;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function p(){let e=new I,t=new I,n=new I,r=new I,o=new F,s=new F,c=new F;for(let l=0,u=0;l<i.length;l+=9,u+=6){e.set(i[l+0],i[l+1],i[l+2]),t.set(i[l+3],i[l+4],i[l+5]),n.set(i[l+6],i[l+7],i[l+8]),o.set(a[u+0],a[u+1]),s.set(a[u+2],a[u+3]),c.set(a[u+4],a[u+5]),r.copy(e).add(t).add(n).divideScalar(3);let d=h(r);m(o,u+0,e,d),m(s,u+2,t,d),m(c,u+4,n,d)}}function m(e,t,n,r){r<0&&e.x===1&&(a[t]=e.x-1),n.x===0&&n.z===0&&(a[t]=r/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function g(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.vertices,t.indices,t.radius,t.detail)}},Ns=class e extends Ms{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];super(i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type=`DodecahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},Ps=new I,Fs=new I,Is=new I,Ls=new fi,Rs=class extends B{constructor(e=null,t=1){if(super(),this.type=`EdgesGeometry`,this.parameters={geometry:e,thresholdAngle:t},e!==null){let n=10**4,r=Math.cos(bn*t),i=e.getIndex(),a=e.getAttribute(`position`),o=i?i.count:a.count,s=[0,0,0],c=[`a`,`b`,`c`],l=[,,,],u={},d=[];for(let e=0;e<o;e+=3){i?(s[0]=i.getX(e),s[1]=i.getX(e+1),s[2]=i.getX(e+2)):(s[0]=e,s[1]=e+1,s[2]=e+2);let{a:t,b:o,c:f}=Ls;if(t.fromBufferAttribute(a,s[0]),o.fromBufferAttribute(a,s[1]),f.fromBufferAttribute(a,s[2]),Ls.getNormal(Is),l[0]=`${Math.round(t.x*n)},${Math.round(t.y*n)},${Math.round(t.z*n)}`,l[1]=`${Math.round(o.x*n)},${Math.round(o.y*n)},${Math.round(o.z*n)}`,l[2]=`${Math.round(f.x*n)},${Math.round(f.y*n)},${Math.round(f.z*n)}`,l[0]!==l[1]&&l[1]!==l[2]&&l[2]!==l[0])for(let e=0;e<3;e++){let t=(e+1)%3,n=l[e],i=l[t],a=Ls[c[e]],o=Ls[c[t]],f=`${n}_${i}`,p=`${i}_${n}`;p in u&&u[p]?(Is.dot(u[p].normal)<=r&&(d.push(a.x,a.y,a.z),d.push(o.x,o.y,o.z)),u[p]=null):f in u||(u[f]={index0:s[e],index1:s[t],normal:Is.clone()})}}for(let e in u)if(u[e]){let{index0:t,index1:n}=u[e];Ps.fromBufferAttribute(a,t),Fs.fromBufferAttribute(a,n),d.push(Ps.x,Ps.y,Ps.z),d.push(Fs.x,Fs.y,Fs.z)}this.setAttribute(`position`,new z(d,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}},zs=class{constructor(){this.type=`Curve`,this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){M(`Curve: .getPoint() not implemented.`)}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,i=n.length,a;a=t||e*n[i-1];let o=0,s=i-1,c;for(;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);let l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)}getTangent(e,t){let n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);let a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new F:new I);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new I,r=[],i=[],a=[],o=new I,s=new L;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new I)}i[0]=new I,a[0]=new I;let c=Number.MAX_VALUE,l=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>2**-52){o.normalize();let e=Math.acos(N(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(r[t],i[t])}if(t===!0){let t=Math.acos(N(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},Bs=class extends zs{constructor(e=0,t=0,n=1,r=1,i=0,a=Math.PI*2,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type=`EllipseCurve`,this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t=new F){let n=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<2**-52;for(;i<0;)i+=r;for(;i>r;)i-=r;i<2**-52&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);let o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=c-this.aY;s=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(s,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},Vs=class extends Bs{constructor(e,t,n,r,i,a){super(e,t,n,n,r,i,a),this.isArcCurve=!0,this.type=`ArcCurve`}};function Hs(){let e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){let c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){let a=i*i,o=a*i;return e+t*i+n*a+r*o}}}var Us=new I,Ws=new I,Gs=new Hs,Ks=new Hs,qs=new Hs,Js=class extends zs{constructor(e=[],t=!1,n=`centripetal`,r=.5){super(),this.isCatmullRomCurve3=!0,this.type=`CatmullRomCurve3`,this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new I){let n=t,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);let c,l;this.closed||o>0?c=r[(o-1)%i]:(Ws.subVectors(r[0],r[1]).add(r[0]),c=Ws);let u=r[o%i],d=r[(o+1)%i];if(this.closed||o+2<i?l=r[(o+2)%i]:(Us.subVectors(r[i-1],r[i-2]).add(r[i-1]),l=Us),this.curveType===`centripetal`||this.curveType===`chordal`){let e=this.curveType===`chordal`?.5:.25,t=c.distanceToSquared(u)**+e,n=u.distanceToSquared(d)**+e,r=d.distanceToSquared(l)**+e;n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),Gs.initNonuniformCatmullRom(c.x,u.x,d.x,l.x,t,n,r),Ks.initNonuniformCatmullRom(c.y,u.y,d.y,l.y,t,n,r),qs.initNonuniformCatmullRom(c.z,u.z,d.z,l.z,t,n,r)}else this.curveType===`catmullrom`&&(Gs.initCatmullRom(c.x,u.x,d.x,l.x,this.tension),Ks.initCatmullRom(c.y,u.y,d.y,l.y,this.tension),qs.initCatmullRom(c.z,u.z,d.z,l.z,this.tension));return n.set(Gs.calc(s),Ks.calc(s),qs.calc(s)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new I().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function Ys(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function Xs(e,t){let n=1-e;return n*n*t}function Zs(e,t){return 2*(1-e)*e*t}function Qs(e,t){return e*e*t}function $s(e,t,n,r){return Xs(e,t)+Zs(e,n)+Qs(e,r)}function ec(e,t){let n=1-e;return n*n*n*t}function tc(e,t){let n=1-e;return 3*n*n*e*t}function nc(e,t){return 3*(1-e)*e*e*t}function rc(e,t){return e*e*e*t}function ic(e,t,n,r,i){return ec(e,t)+tc(e,n)+nc(e,r)+rc(e,i)}var ac=class extends zs{constructor(e=new F,t=new F,n=new F,r=new F){super(),this.isCubicBezierCurve=!0,this.type=`CubicBezierCurve`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new F){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ic(e,r.x,i.x,a.x,o.x),ic(e,r.y,i.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},oc=class extends zs{constructor(e=new I,t=new I,n=new I,r=new I){super(),this.isCubicBezierCurve3=!0,this.type=`CubicBezierCurve3`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new I){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ic(e,r.x,i.x,a.x,o.x),ic(e,r.y,i.y,a.y,o.y),ic(e,r.z,i.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},sc=class extends zs{constructor(e=new F,t=new F){super(),this.isLineCurve=!0,this.type=`LineCurve`,this.v1=e,this.v2=t}getPoint(e,t=new F){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new F){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},cc=class extends zs{constructor(e=new I,t=new I){super(),this.isLineCurve3=!0,this.type=`LineCurve3`,this.v1=e,this.v2=t}getPoint(e,t=new I){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new I){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},lc=class extends zs{constructor(e=new F,t=new F,n=new F){super(),this.isQuadraticBezierCurve=!0,this.type=`QuadraticBezierCurve`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new F){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set($s(e,r.x,i.x,a.x),$s(e,r.y,i.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},uc=class extends zs{constructor(e=new I,t=new I,n=new I){super(),this.isQuadraticBezierCurve3=!0,this.type=`QuadraticBezierCurve3`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new I){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set($s(e,r.x,i.x,a.x),$s(e,r.y,i.y,a.y),$s(e,r.z,i.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},dc=class extends zs{constructor(e=[]){super(),this.isSplineCurve=!0,this.type=`SplineCurve`,this.points=e}getPoint(e,t=new F){let n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Ys(o,s.x,c.x,l.x,u.x),Ys(o,s.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new F().fromArray(n))}return this}},fc=Object.freeze({__proto__:null,ArcCurve:Vs,CatmullRomCurve3:Js,CubicBezierCurve:ac,CubicBezierCurve3:oc,EllipseCurve:Bs,LineCurve:sc,LineCurve3:cc,QuadraticBezierCurve:lc,QuadraticBezierCurve3:uc,SplineCurve:dc}),pc=class extends zs{constructor(){super(),this.type=`CurvePath`,this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?`LineCurve`:`LineCurve3`;this.curves.push(new fc[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),i=0;for(;i<r.length;){if(r[i]>=n){let e=r[i]-n,a=this.curves[i],o=a.getLength(),s=o===0?0:1-e/o;return a.getPointAt(s,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,i=this.curves;r<i.length;r++){let a=i[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o);for(let e=0;e<s.length;e++){let r=s[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(new fc[n.type]().fromJSON(n))}return this}},mc=class extends pc{constructor(e){super(),this.type=`Path`,this.currentPoint=new F,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new sc(this.currentPoint.clone(),new F(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let i=new lc(this.currentPoint.clone(),new F(e,t),new F(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,i,a){let o=new ac(this.currentPoint.clone(),new F(e,t),new F(n,r),new F(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}splineThru(e){let t=new dc([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,i,a){let o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}absarc(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}ellipse(e,t,n,r,i,a,o,s){let c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this}absellipse(e,t,n,r,i,a,o,s){let c=new Bs(e,t,n,r,i,a,o,s);if(this.curves.length>0){let e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);let l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},hc=class extends mc{constructor(e){super(e),this.uuid=Sn(),this.type=`Shape`,this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(new mc().fromJSON(n))}return this}};function gc(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=_c(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=wc(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return yc(a,o,n,s,c,l,0),o}function _c(e,t,n,r,i){let a;if(i===Jc(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Gc(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Gc(i/r|0,e[i],e[i+1],a);return a&&Lc(a,a.next)&&(Kc(a),a=a.next),a}function vc(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(Lc(n,n.next)||Ic(n.prev,n,n.next)===0)){if(Kc(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function yc(e,t,n,r,i,a,o){if(!e)return;!o&&a&&kc(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?xc(e,r,i,a):bc(e)){t.push(c.i,e.i,l.i),Kc(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=Sc(vc(e),t),yc(e,t,n,r,i,a,2)):o===2&&Cc(e,t,n,r,i,a):yc(vc(e),t,n,r,i,a,1);break}}}function bc(e){let t=e.prev,n=e,r=e.next;if(Ic(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&Pc(i,s,a,c,o,l,m.x,m.y)&&Ic(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function xc(e,t,n,r){let i=e.prev,a=e,o=e.next;if(Ic(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=jc(p,m,t,n,r),v=jc(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&Pc(s,u,c,d,l,f,y.x,y.y)&&Ic(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&Pc(s,u,c,d,l,f,b.x,b.y)&&Ic(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&Pc(s,u,c,d,l,f,y.x,y.y)&&Ic(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&Pc(s,u,c,d,l,f,b.x,b.y)&&Ic(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Sc(e,t){let n=e;do{let r=n.prev,i=n.next.next;!Lc(r,i)&&Rc(r,n,n.next,i)&&Hc(r,i)&&Hc(i,r)&&(t.push(r.i,n.i,i.i),Kc(n),Kc(n.next),n=e=i),n=n.next}while(n!==e);return vc(n)}function Cc(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Fc(o,e)){let s=Wc(o,e);o=vc(o,o.next),s=vc(s,s.next),yc(o,t,n,r,i,a,0),yc(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function wc(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=_c(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(Mc(o))}i.sort(Tc);for(let e=0;e<i.length;e++)n=Ec(i[e],n);return n}function Tc(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function Ec(e,t){let n=Dc(e,t);if(!n)return t;let r=Wc(n,e);return vc(r,r.next),vc(n,n.next)}function Dc(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(Lc(e,n))return n;do{if(Lc(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&Nc(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);Hc(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&Oc(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function Oc(e,t){return Ic(e.prev,e,t.prev)<0&&Ic(t.next,e,e.next)<0}function kc(e,t,n,r){let i=e;do i.z===0&&(i.z=jc(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Ac(i)}function Ac(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function jc(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Mc(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Nc(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function Pc(e,t,n,r,i,a,o,s){return(e!==o||t!==s)&&Nc(e,t,n,r,i,a,o,s)}function Fc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Vc(e,t)&&(Hc(e,t)&&Hc(t,e)&&Uc(e,t)&&(Ic(e.prev,e,t.prev)||Ic(e,t.prev,t))||Lc(e,t)&&Ic(e.prev,e,e.next)>0&&Ic(t.prev,t,t.next)>0)}function Ic(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Lc(e,t){return e.x===t.x&&e.y===t.y}function Rc(e,t,n,r){let i=Bc(Ic(e,t,n)),a=Bc(Ic(e,t,r)),o=Bc(Ic(n,r,e)),s=Bc(Ic(n,r,t));return!!(i!==a&&o!==s||i===0&&zc(e,n,t)||a===0&&zc(e,r,t)||o===0&&zc(n,e,r)||s===0&&zc(n,t,r))}function zc(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Bc(e){return e>0?1:e<0?-1:0}function Vc(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Rc(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Hc(e,t){return Ic(e.prev,e,e.next)<0?Ic(e,t,e.next)>=0&&Ic(e,e.prev,t)>=0:Ic(e,t,e.prev)<0||Ic(e,e.next,t)<0}function Uc(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Wc(e,t){let n=qc(e.i,e.x,e.y),r=qc(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Gc(e,t,n,r){let i=qc(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Kc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function qc(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Jc(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}var Yc=class{static triangulate(e,t,n=2){return gc(e,t,n)}},Xc=class e{static area(e){let t=e.length,n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5}static isClockWise(t){return e.area(t)<0}static triangulateShape(e,t){let n=[],r=[],i=[];Zc(e),Qc(n,e);let a=e.length;t.forEach(Zc);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,Qc(n,t[e]);let o=Yc.triangulate(n,r);for(let e=0;e<o.length;e+=3)i.push(o.slice(e,e+3));return i}};function Zc(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Qc(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var $c=class e extends B{constructor(e=new hc([new F(.5,.5),new F(-.5,.5),new F(-.5,-.5),new F(.5,-.5)]),t={}){super(),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],i=[];for(let t=0,n=e.length;t<n;t++){let n=e[t];a(n)}this.setAttribute(`position`,new z(r,3)),this.setAttribute(`uv`,new z(i,2)),this.computeVertexNormals();function a(e){let a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?1:t.depth,l=t.bevelEnabled===void 0||t.bevelEnabled,u=t.bevelThickness===void 0?.2:t.bevelThickness,d=t.bevelSize===void 0?u-.1:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?el:t.UVGenerator,g,_=!1,v,y,b,x;if(m){g=m.getSpacedPoints(s),_=!0,l=!1;let e=m.isCatmullRomCurve3?m.closed:!1;v=m.computeFrenetFrames(s,e),y=new I,b=new I,x=new I}l||(p=0,u=0,d=0,f=0);let S=e.extractPoints(o),C=S.shape,w=S.holes;if(!Xc.isClockWise(C)){C=C.reverse();for(let e=0,t=w.length;e<t;e++){let t=w[e];Xc.isClockWise(t)&&(w[e]=t.reverse())}}function T(e){let t=e[0];for(let n=1;n<=e.length;n++){let r=n%e.length,i=e[r],a=i.x-t.x,o=i.y-t.y,s=a*a+o*o,c=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(t.x),Math.abs(t.y));if(s<=10000000000000001e-36*c*c){e.splice(r,1),n--;continue}t=i}}T(C),w.forEach(T);let E=w.length,D=C;for(let e=0;e<E;e++){let t=w[e];C=C.concat(t)}function O(e,t,n){return t||pn(`ExtrudeGeometry: vec does not exist`),e.clone().addScaledVector(t,n)}let ee=C.length;function k(e,t,n){let r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>2**-52){let d=Math.sqrt(u),f=Math.sqrt(c*c+l*l),p=t.x-s/d,m=t.y+o/d,h=n.x-l/f,g=n.y+c/f,_=((h-p)*l-(g-m)*c)/(o*l-s*c);r=p+o*_-e.x,i=m+s*_-e.y;let v=r*r+i*i;if(v<=2)return new F(r,i);a=Math.sqrt(v/2)}else{let e=!1;o>2**-52?c>2**-52&&(e=!0):o<-(2**-52)?c<-(2**-52)&&(e=!0):Math.sign(s)===Math.sign(l)&&(e=!0),e?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new F(r/a,i/a)}let te=[];for(let e=0,t=D.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),te[e]=k(D[e],D[n],D[r]);let ne=[],re,ie=te.concat();for(let e=0,t=E;e<t;e++){let t=w[e];re=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),re[e]=k(t[e],t[r],t[i]);ne.push(re),ie=ie.concat(re)}let ae;if(p===0)ae=Xc.triangulateShape(D,w);else{let e=[],t=[];for(let n=0;n<p;n++){let r=n/p,i=u*Math.cos(r*Math.PI/2),a=d*Math.sin(r*Math.PI/2)+f;for(let t=0,n=D.length;t<n;t++){let n=O(D[t],te[t],a);le(n.x,n.y,-i),r===0&&e.push(n)}for(let e=0,n=E;e<n;e++){let n=w[e];re=ne[e];let o=[];for(let e=0,t=n.length;e<t;e++){let t=O(n[e],re[e],a);le(t.x,t.y,-i),r===0&&o.push(t)}r===0&&t.push(o)}}ae=Xc.triangulateShape(e,t)}let A=ae.length,j=d+f;for(let e=0;e<ee;e++){let t=l?O(C[e],ie[e],j):C[e];_?(b.copy(v.normals[0]).multiplyScalar(t.x),y.copy(v.binormals[0]).multiplyScalar(t.y),x.copy(g[0]).add(b).add(y),le(x.x,x.y,x.z)):le(t.x,t.y,0)}for(let e=1;e<=s;e++)for(let t=0;t<ee;t++){let n=l?O(C[t],ie[t],j):C[t];_?(b.copy(v.normals[e]).multiplyScalar(n.x),y.copy(v.binormals[e]).multiplyScalar(n.y),x.copy(g[e]).add(b).add(y),le(x.x,x.y,x.z)):le(n.x,n.y,c/s*e)}for(let e=p-1;e>=0;e--){let t=e/p,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+f;for(let e=0,t=D.length;e<t;e++){let t=O(D[e],te[e],r);le(t.x,t.y,c+n)}for(let e=0,t=w.length;e<t;e++){let t=w[e];re=ne[e];for(let e=0,i=t.length;e<i;e++){let i=O(t[e],re[e],r);_?le(i.x,i.y+g[s-1].y,g[s-1].x+n):le(i.x,i.y,c+n)}}}oe(),se();function oe(){let e=r.length/3;if(l){let e=0,t=ee*e;for(let e=0;e<A;e++){let n=ae[e];ue(n[2]+t,n[1]+t,n[0]+t)}e=s+p*2,t=ee*e;for(let e=0;e<A;e++){let n=ae[e];ue(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<A;e++){let t=ae[e];ue(t[2],t[1],t[0])}for(let e=0;e<A;e++){let t=ae[e];ue(t[0]+ee*s,t[1]+ee*s,t[2]+ee*s)}}n.addGroup(e,r.length/3-e,0)}function se(){let e=r.length/3,t=0;ce(D,t),t+=D.length;for(let e=0,n=w.length;e<n;e++){let n=w[e];ce(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}function ce(e,t){let n=e.length;for(;--n>=0;){let r=n,i=n-1;i<0&&(i=e.length-1);for(let e=0,n=s+p*2;e<n;e++){let n=ee*e,a=ee*(e+1);de(t+r+n,t+i+n,t+i+a,t+r+a)}}}function le(e,t,n){a.push(e),a.push(t),a.push(n)}function ue(e,t,i){fe(e),fe(t),fe(i);let a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);pe(o[0]),pe(o[1]),pe(o[2])}function de(e,t,i,a){fe(e),fe(t),fe(a),fe(t),fe(i),fe(a);let o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);pe(s[0]),pe(s[1]),pe(s[3]),pe(s[1]),pe(s[2]),pe(s[3])}function fe(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function pe(e){i.push(e.x),i.push(e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return tl(t,n,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}let i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new fc[i.type]().fromJSON(i)),new e(r,t.options)}},el={generateTopUV:function(e,t,n,r,i){let a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new F(a,o),new F(s,c),new F(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){let o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<Math.abs(o-l)?[new F(o,1-c),new F(l,1-d),new F(f,1-m),new F(h,1-_)]:[new F(s,1-c),new F(u,1-d),new F(p,1-m),new F(g,1-_)]}};function tl(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){let r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}var nl=class e extends Ms{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];super(r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type=`IcosahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},rl=class e extends B{constructor(e=[new F(0,-.5),new F(.5,0),new F(0,.5)],t=12,n=0,r=Math.PI*2){super(),this.type=`LatheGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=N(r,0,Math.PI*2);let i=[],a=[],o=[],s=[],c=[],l=1/t,u=new I,d=new F,f=new I,p=new I,m=new I,h=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,m.copy(f),f.normalize(),s.push(f.x,f.y,f.z);break;case e.length-1:s.push(m.x,m.y,m.z);break;default:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,p.copy(f),f.x+=m.x,f.y+=m.y,f.z+=m.z,f.normalize(),s.push(f.x,f.y,f.z),m.copy(p)}for(let i=0;i<=t;i++){let f=n+i*l*r,p=Math.sin(f),m=Math.cos(f);for(let n=0;n<=e.length-1;n++){u.x=e[n].x*p,u.y=e[n].y,u.z=e[n].x*m,a.push(u.x,u.y,u.z),d.x=i/t,d.y=n/(e.length-1),o.push(d.x,d.y);let r=s[3*n+0]*p,l=s[3*n+1],f=s[3*n+0]*m;c.push(r,l,f)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){let r=t+n*e.length,a=r,o=r+e.length,s=r+e.length+1,c=r+1;i.push(a,o,c),i.push(s,c,o)}this.setIndex(i),this.setAttribute(`position`,new z(a,3)),this.setAttribute(`uv`,new z(o,2)),this.setAttribute(`normal`,new z(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.points,t.segments,t.phiStart,t.phiLength)}},il=class e extends Ms{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type=`OctahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},al=class e extends B{constructor(e=1,t=1,n=1,r=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,o=Math.floor(n),s=Math.floor(r),c=o+1,l=s+1,u=e/o,d=t/s,f=[],p=[],m=[],h=[];for(let e=0;e<l;e++){let t=e*d-a;for(let n=0;n<c;n++){let r=n*u-i;p.push(r,-t,0),m.push(0,0,1),h.push(n/o),h.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){let n=t+c*e,r=t+c*(e+1),i=t+1+c*(e+1),a=t+1+c*e;f.push(n,r,a),f.push(r,i,a)}this.setIndex(f),this.setAttribute(`position`,new z(p,3)),this.setAttribute(`normal`,new z(m,3)),this.setAttribute(`uv`,new z(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)}},ol=class e extends B{constructor(e=.5,t=1,n=32,r=1,i=0,a=Math.PI*2){super(),this.type=`RingGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);let o=[],s=[],c=[],l=[],u=e,d=(t-e)/r,f=new I,p=new F;for(let e=0;e<=r;e++){for(let e=0;e<=n;e++){let r=i+e/n*a;f.x=u*Math.cos(r),f.y=u*Math.sin(r),s.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,l.push(p.x,p.y)}u+=d}for(let e=0;e<r;e++){let t=e*(n+1);for(let e=0;e<n;e++){let r=e+t,i=r,a=r+n+1,s=r+n+2,c=r+1;o.push(i,a,c),o.push(a,s,c)}}this.setIndex(o),this.setAttribute(`position`,new z(s,3)),this.setAttribute(`normal`,new z(c,3)),this.setAttribute(`uv`,new z(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},sl=class e extends B{constructor(e=new hc([new F(0,.5),new F(-.5,-.5),new F(.5,-.5)]),t=12){super(),this.type=`ShapeGeometry`,this.parameters={shapes:e,curveSegments:t};let n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)c(e);else for(let t=0;t<e.length;t++)c(e[t]),this.addGroup(o,s,t),o+=s,s=0;this.setIndex(n),this.setAttribute(`position`,new z(r,3)),this.setAttribute(`normal`,new z(i,3)),this.setAttribute(`uv`,new z(a,2));function c(e){let o=r.length/3,c=e.extractPoints(t),l=c.shape,u=c.holes;Xc.isClockWise(l)===!1&&(l=l.reverse());for(let e=0,t=u.length;e<t;e++){let t=u[e];Xc.isClockWise(t)===!0&&(u[e]=t.reverse())}let d=Xc.triangulateShape(l,u);for(let e=0,t=u.length;e<t;e++){let t=u[e];l=l.concat(t)}for(let e=0,t=l.length;e<t;e++){let t=l[e];r.push(t.x,t.y,0),i.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){let t=d[e],r=t[0]+o,i=t[1]+o,a=t[2]+o;n.push(r,i,a),s+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return cl(t,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}return new e(r,t.curveSegments)}};function cl(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){let r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}var ll=class e extends B{constructor(e=1,t=32,n=16,r=0,i=Math.PI*2,a=0,o=Math.PI){super(),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let s=Math.min(a+o,Math.PI),c=0,l=[],u=new I,d=new I,f=[],p=[],m=[],h=[];for(let f=0;f<=n;f++){let g=[],_=f/n,v=a+_*o,y=e*Math.cos(v),b=Math.sqrt(e*e-y*y),x=0;f===0&&a===0?x=.5/t:f===n&&s===Math.PI&&(x=-.5/t);for(let e=0;e<=t;e++){let n=e/t,a=r+n*i;u.x=-b*Math.cos(a),u.y=y,u.z=b*Math.sin(a),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),h.push(n+x,1-_),g.push(c++)}l.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){let t=l[e][r+1],i=l[e][r],o=l[e+1][r],c=l[e+1][r+1];(e!==0||a>0)&&f.push(t,i,c),(e!==n-1||s<Math.PI)&&f.push(i,o,c)}this.setIndex(f),this.setAttribute(`position`,new z(p,3)),this.setAttribute(`normal`,new z(m,3)),this.setAttribute(`uv`,new z(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},ul=class e extends Ms{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type=`TetrahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},dl=class e extends B{constructor(e=1,t=.4,n=12,r=48,i=Math.PI*2,a=0,o=Math.PI*2){super(),this.type=`TorusGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i,thetaStart:a,thetaLength:o},n=Math.floor(n),r=Math.floor(r);let s=[],c=[],l=[],u=[],d=new I,f=new I,p=new I;for(let s=0;s<=n;s++){let m=a+s/n*o;for(let a=0;a<=r;a++){let o=a/r*i;f.x=(e+t*Math.cos(m))*Math.cos(o),f.y=(e+t*Math.cos(m))*Math.sin(o),f.z=t*Math.sin(m),c.push(f.x,f.y,f.z),d.x=e*Math.cos(o),d.y=e*Math.sin(o),p.subVectors(f,d).normalize(),l.push(p.x,p.y,p.z),u.push(a/r),u.push(s/n)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*e+t-1,i=(r+1)*(e-1)+t-1,a=(r+1)*(e-1)+t,o=(r+1)*e+t;s.push(n,i,o),s.push(i,a,o)}this.setIndex(s),this.setAttribute(`position`,new z(c,3)),this.setAttribute(`normal`,new z(l,3)),this.setAttribute(`uv`,new z(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},fl=class e extends B{constructor(e=1,t=.4,n=64,r=8,i=2,a=3){super(),this.type=`TorusKnotGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},n=Math.floor(n),r=Math.floor(r);let o=[],s=[],c=[],l=[],u=new I,d=new I,f=new I,p=new I,m=new I,h=new I,g=new I;for(let o=0;o<=n;++o){let v=o/n*i*Math.PI*2;_(v,i,a,e,f),_(v+.01,i,a,e,p),h.subVectors(p,f),g.addVectors(p,f),m.crossVectors(h,g),g.crossVectors(m,h),m.normalize(),g.normalize();for(let e=0;e<=r;++e){let i=e/r*Math.PI*2,a=-t*Math.cos(i),p=t*Math.sin(i);u.x=f.x+(a*g.x+p*m.x),u.y=f.y+(a*g.y+p*m.y),u.z=f.z+(a*g.z+p*m.z),s.push(u.x,u.y,u.z),d.subVectors(u,f).normalize(),c.push(d.x,d.y,d.z),l.push(o/n),l.push(e/r)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),a=(r+1)*e+t,s=(r+1)*(e-1)+t;o.push(n,i,s),o.push(i,a,s)}this.setIndex(o),this.setAttribute(`position`,new z(s,3)),this.setAttribute(`normal`,new z(c,3)),this.setAttribute(`uv`,new z(l,2));function _(e,t,n,r,i){let a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},pl=class e extends B{constructor(e=new uc(new I(-1,-1,0),new I(-1,1,0),new I(1,1,0)),t=64,n=1,r=8,i=!1){super(),this.type=`TubeGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i};let a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let o=new I,s=new I,c=new F,l=new I,u=[],d=[],f=[],p=[];m(),this.setIndex(p),this.setAttribute(`position`,new z(u,3)),this.setAttribute(`normal`,new z(d,3)),this.setAttribute(`uv`,new z(f,2));function m(){for(let e=0;e<t;e++)h(e);h(i===!1?t:0),_(),g()}function h(i){l=e.getPointAt(i/t,l);let c=a.normals[i],f=a.binormals[i];for(let e=0;e<=r;e++){let t=e/r*Math.PI*2,i=Math.sin(t),a=-Math.cos(t);s.x=a*c.x+i*f.x,s.y=a*c.y+i*f.y,s.z=a*c.z+i*f.z,s.normalize(),d.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,u.push(o.x,o.y,o.z)}}function g(){for(let e=1;e<=t;e++)for(let t=1;t<=r;t++){let n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),a=(r+1)*e+t,o=(r+1)*(e-1)+t;p.push(n,i,o),p.push(i,a,o)}}function _(){for(let e=0;e<=t;e++)for(let n=0;n<=r;n++)c.x=e/t,c.y=n/r,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(t){return new e(new fc[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},ml=class extends B{constructor(e=null){if(super(),this.type=`WireframeGeometry`,this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new I,i=new I;if(e.index!==null){let a=e.attributes.position,o=e.index,s=e.groups;s.length===0&&(s=[{start:0,count:o.count,materialIndex:0}]);for(let e=0,c=s.length;e<c;++e){let c=s[e],l=c.start,u=c.count;for(let e=l,s=l+u;e<s;e+=3)for(let s=0;s<3;s++){let c=o.getX(e+s),l=o.getX(e+(s+1)%3);r.fromBufferAttribute(a,c),i.fromBufferAttribute(a,l),hl(r,i,n)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}}else{let a=e.attributes.position;for(let e=0,o=a.count/3;e<o;e++)for(let o=0;o<3;o++){let s=3*e+o,c=3*e+(o+1)%3;r.fromBufferAttribute(a,s),i.fromBufferAttribute(a,c),hl(r,i,n)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}this.setAttribute(`position`,new z(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function hl(e,t,n){let r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return n.has(r)===!0||n.has(i)===!0?!1:(n.add(r),n.add(i),!0)}var gl=Object.freeze({__proto__:null,BoxGeometry:Ds,CapsuleGeometry:Os,CircleGeometry:ks,ConeGeometry:js,CylinderGeometry:As,DodecahedronGeometry:Ns,EdgesGeometry:Rs,ExtrudeGeometry:$c,IcosahedronGeometry:nl,LatheGeometry:rl,OctahedronGeometry:il,PlaneGeometry:al,PolyhedronGeometry:Ms,RingGeometry:ol,ShapeGeometry:sl,SphereGeometry:ll,TetrahedronGeometry:ul,TorusGeometry:dl,TorusKnotGeometry:fl,TubeGeometry:pl,WireframeGeometry:ml}),_l=class extends oa{constructor(e){super(),this.isShadowMaterial=!0,this.type=`ShadowMaterial`,this.color=new R(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function vl(e){let t={};for(let n in e){t[n]={};for(let r in e[n]){let i=e[n][r];if(bl(i))i.isRenderTargetTexture?(M(`UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().`),t[n][r]=null):t[n][r]=i.clone();else if(Array.isArray(i))if(bl(i[0])){let e=[];for(let t=0,n=i.length;t<n;t++)e[t]=i[t].clone();t[n][r]=e}else t[n][r]=i.slice();else t[n][r]=i}}return t}function yl(e){let t={};for(let n=0;n<e.length;n++){let r=vl(e[n]);for(let e in r)t[e]=r[e]}return t}function bl(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function xl(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function Sl(e){let t=e.getRenderTarget();return t===null?e.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:Zn.workingColorSpace}var Cl={clone:vl,merge:yl},wl=`void main() {
|
|
10
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
11
|
-
}`,Tl=`void main() {
|
|
12
|
-
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
13
|
-
}`,El=class extends oa{constructor(e){super(),this.isShaderMaterial=!0,this.type=`ShaderMaterial`,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=wl,this.fragmentShader=Tl,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=vl(e.uniforms),this.uniformsGroups=xl(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let n in this.uniforms){let r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:`t`,value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:`c`,value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:`v2`,value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:`v3`,value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:`v4`,value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:`m3`,value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:`m4`,value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case`t`:this.uniforms[n].value=t[r.value]||null;break;case`c`:this.uniforms[n].value=new R().setHex(r.value);break;case`v2`:this.uniforms[n].value=new F().fromArray(r.value);break;case`v3`:this.uniforms[n].value=new I().fromArray(r.value);break;case`v4`:this.uniforms[n].value=new cr().fromArray(r.value);break;case`m3`:this.uniforms[n].value=new Kn().fromArray(r.value);break;case`m4`:this.uniforms[n].value=new L().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let t in e.extensions)this.extensions[t]=e.extensions[t];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},Dl=class extends El{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type=`RawShaderMaterial`}},Ol=class extends oa{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type=`MeshStandardMaterial`,this.defines={STANDARD:``},this.color=new R(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new R(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new wr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},kl=class extends Ol{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new F(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return N(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new R(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new R(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new R(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},Al=class extends oa{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type=`MeshPhongMaterial`,this.color=new R(16777215),this.specular=new R(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new R(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new wr,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},jl=class extends oa{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:``},this.type=`MeshToonMaterial`,this.color=new R(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new R(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Ml=class extends oa{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type=`MeshNormalMaterial`,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},Nl=class extends oa{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type=`MeshLambertMaterial`,this.color=new R(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new R(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new wr,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Pl=class extends oa{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=Ct,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},Fl=class extends oa{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type=`MeshDistanceMaterial`,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},Il=class extends oa{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:``},this.type=`MeshMatcapMaterial`,this.color=new R(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:``},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},Ll=class extends Jo{constructor(e){super(),this.isLineDashedMaterial=!0,this.type=`LineDashedMaterial`,this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function Rl(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function zl(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function Bl(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function Vl(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}function Hl(e,t,n,r,i=30){let a=e.clone();a.name=t;let o=[];for(let e=0;e<a.tracks.length;++e){let t=a.tracks[e],s=t.getValueSize(),c=[],l=[];for(let e=0;e<t.times.length;++e){let a=t.times[e]*i;if(!(a<n||a>=r)){c.push(t.times[e]);for(let n=0;n<s;++n)l.push(t.values[e*s+n])}}c.length!==0&&(t.times=Rl(c,t.times.constructor),t.values=Rl(l,t.values.constructor),o.push(t))}a.tracks=o;let s=1/0;for(let e=0;e<a.tracks.length;++e)s>a.tracks[e].times[0]&&(s=a.tracks[e].times[0]);for(let e=0;e<a.tracks.length;++e)a.tracks[e].shift(-1*s);return a.resetDuration(),a}function Ul(e,t=0,n=e,r=30){r<=0&&(r=30);let i=n.tracks.length,a=t/r;for(let t=0;t<i;++t){let r=n.tracks[t],i=r.ValueTypeName;if(i===`bool`||i===`string`)continue;let o=e.tracks.find(function(e){return e.name===r.name&&e.ValueTypeName===i});if(o===void 0)continue;let s=0,c=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=c/3);let l=0,u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=u/3);let d=r.times.length-1,f;if(a<=r.times[0]){let e=s,t=c-s;f=r.values.slice(e,t)}else if(a>=r.times[d]){let e=d*c+s,t=e+c-s;f=r.values.slice(e,t)}else{let e=r.createInterpolant(),t=s,n=c-s;e.evaluate(a),f=e.resultBuffer.slice(t,n)}i===`quaternion`&&new Un().fromArray(f).normalize().conjugate().toArray(f);let p=o.times.length;for(let e=0;e<p;++e){let t=e*u+l;if(i===`quaternion`)Un.multiplyQuaternionsFlat(o.values,t,f,0,o.values,t);else{let e=u-l*2;for(let n=0;n<e;++n)o.values[t+n]-=f[n]}}}return e.blendMode=St,e}var Wl=class{static convertArray(e,t){return Rl(e,t)}static isTypedArray(e){return rn(e)}static getKeyframeOrder(e){return zl(e)}static sortedArray(e,t,n){return Bl(e,t,n)}static flattenJSON(e,t,n,r){Vl(e,t,n,r)}static subclip(e,t,n,r,i=30){return Hl(e,t,n,r,i)}static makeClipAdditive(e,t=0,n=e,r=30){return Ul(e,t,n,r)}},H=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){let o=t[1];e<o&&(n=2,i=o);for(let a=n-2;;){if(i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){let r=n+a>>>1;e<t[r]?a=r:n=r+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t}interpolate_(){throw Error(`THREE.Interpolant: Call to abstract method.`)}intervalChanged_(){}},U=class extends H{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:vt,endingEnd:vt}}intervalChanged_(e,t,n){let r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case yt:i=e,o=2*t-n;break;case bt:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case yt:a=e,s=2*n-t;break;case bt:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}let c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m;for(let e=0;e!==o;++e)i[e]=g*a[l+e]+_*a[c+e]+v*a[s+e]+y*a[u+e];return i}},Gl=class extends H{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l;for(let e=0;e!==o;++e)i[e]=a[c+e]*u+a[s+e]*l;return i}},Kl=class extends H{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},ql=class extends H{interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this.inTangents,u=this.outTangents;if(!l||!u){let e=(n-t)/(r-t),l=1-e;for(let t=0;t!==o;++t)i[t]=a[c+t]*l+a[s+t]*e;return i}let d=o*2,f=e-1;for(let p=0;p!==o;++p){let o=a[c+p],m=a[s+p],h=f*d+p*2,g=u[h],_=u[h+1],v=e*d+p*2,y=l[v],b=l[v+1],x=(n-t)/(r-t),S,C,w,T,E;for(let e=0;e<8;e++){S=x*x,C=S*x,w=1-x,T=w*w,E=T*w;let e=E*t+3*T*x*g+3*w*S*y+C*r-n;if(Math.abs(e)<1e-10)break;let i=3*T*(g-t)+6*w*x*(y-g)+3*S*(r-y);if(Math.abs(i)<1e-10)break;x-=e/i,x=Math.max(0,Math.min(1,x))}i[p]=E*o+3*T*x*_+3*w*S*b+C*m}return i}},Jl=class{constructor(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=Rl(t,this.TimeBufferType),this.values=Rl(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Rl(e.times,Array),values:Rl(e.values,Array)};let t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Kl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Gl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new U(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new ql(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case mt:t=this.InterpolantFactoryMethodDiscrete;break;case ht:t=this.InterpolantFactoryMethodLinear;break;case gt:t=this.InterpolantFactoryMethodSmooth;break;case _t:t=this.InterpolantFactoryMethodBezier}if(t===void 0){let t=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return M(`KeyframeTrack:`,t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return mt;case this.InterpolantFactoryMethodLinear:return ht;case this.InterpolantFactoryMethodSmooth:return gt;case this.InterpolantFactoryMethodBezier:return _t}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,i=0,a=r-1;for(;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(pn(`KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(pn(`KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){pn(`KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){pn(`KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&rn(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){pn(`KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===gt,i=e.length-1,a=1;for(let o=1;o<i;++o){let i=!1,s=e[o];if(s!==e[o+1]&&(o!==1||s!==e[0]))if(r)i=!0;else{let e=o*n,r=e-n,a=e+n;for(let o=0;o!==n;++o){let n=t[e+o];if(n!==t[r+o]||n!==t[a+o]){i=!0;break}}}if(i){if(o!==a){e[a]=e[o];let r=o*n,i=a*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++a}}if(i>0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Jl.prototype.ValueTypeName=``,Jl.prototype.TimeBufferType=Float32Array,Jl.prototype.ValueBufferType=Float32Array,Jl.prototype.DefaultInterpolation=ht;var Yl=class extends Jl{constructor(e,t,n){super(e,t,n)}};Yl.prototype.ValueTypeName=`bool`,Yl.prototype.ValueBufferType=Array,Yl.prototype.DefaultInterpolation=mt,Yl.prototype.InterpolantFactoryMethodLinear=void 0,Yl.prototype.InterpolantFactoryMethodSmooth=void 0;var Xl=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};Xl.prototype.ValueTypeName=`color`;var Zl=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};Zl.prototype.ValueTypeName=`number`;var Ql=class extends H{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)Un.slerpFlat(i,0,a,c-o,a,c,s);return i}},$l=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new Ql(this.times,this.values,this.getValueSize(),e)}};$l.prototype.ValueTypeName=`quaternion`,$l.prototype.InterpolantFactoryMethodSmooth=void 0;var eu=class extends Jl{constructor(e,t,n){super(e,t,n)}};eu.prototype.ValueTypeName=`string`,eu.prototype.ValueBufferType=Array,eu.prototype.DefaultInterpolation=mt,eu.prototype.InterpolantFactoryMethodLinear=void 0,eu.prototype.InterpolantFactoryMethodSmooth=void 0;var tu=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};tu.prototype.ValueTypeName=`vector`;var nu=class{constructor(e=``,t=-1,n=[],r=xt){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=Sn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(iu(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i.userData=JSON.parse(e.userData||`{}`),i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,r=n.length;e!==r;++e)t.push(Jl.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e<i;e++){let o=[],s=[];o.push((e+i-1)%i,e,(e+1)%i),s.push(0,1,0);let c=zl(o);o=Bl(o,1,c),s=Bl(s,1,c),!r&&o[0]===0&&(o.push(i),s.push(s[0])),a.push(new Zl(`.morphTargetInfluences[`+t[e].name+`]`,o,s).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let r={},i=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){let n=e[t],a=n.name.match(i);if(a&&a.length>1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}resetDuration(){let e=this.tracks,t=0;for(let n=0,r=e.length;n!==r;++n){let e=this.tracks[n];t=Math.max(t,e.times[e.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e&&=this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}};function ru(e){switch(e.toLowerCase()){case`scalar`:case`double`:case`float`:case`number`:case`integer`:return Zl;case`vector`:case`vector2`:case`vector3`:case`vector4`:return tu;case`color`:return Xl;case`quaternion`:return $l;case`bool`:case`boolean`:return Yl;case`string`:return eu}throw Error(`THREE.KeyframeTrack: Unsupported typeName: `+e)}function iu(e){if(e.type===void 0)throw Error(`THREE.KeyframeTrack: track type undefined, can not parse`);let t=ru(e.type);if(e.times===void 0){let t=[],n=[];Vl(e.keys,t,n,`value`),e.times=t,e.values=n}return t.parse===void 0?new t(e.name,e.times,e.values,e.interpolation):t.parse(e)}var au={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(ou(e)||(this.files[e]=t))},get:function(e){if(this.enabled!==!1&&!ou(e))return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function ou(e){try{let t=e.slice(e.indexOf(`:`)+1);return new URL(t).protocol===`blob:`}catch{return!1}}var su=class{constructor(e,t,n){let r=this,i=!1,a=0,o=0,s,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return e=e.normalize(`NFC`),s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){let t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=c.length;t<n;t+=2){let n=c[t],r=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||=new AbortController,this._abortController}},cu=new su,lu=class{constructor(e){this.manager=e===void 0?cu:e,this.crossOrigin=`anonymous`,this.withCredentials=!1,this.path=``,this.resourcePath=``,this.requestHeader={},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,i){n.load(e,r,t,i)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};lu.DEFAULT_MATERIAL_NAME=`__DEFAULT`;var uu={},du=class extends Error{constructor(e,t){super(e),this.response=t}},fu=class extends lu{constructor(e){super(e),this.mimeType=``,this.responseType=``,this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=au.get(`file:${e}`);if(i!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(i),this.manager.itemEnd(e)},0);return}if(uu[e]!==void 0){uu[e].push({onLoad:t,onProgress:n,onError:r});return}uu[e]=[],uu[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`,signal:typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&M(`FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=uu[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e<t;e++){let t=n[e];t.onProgress&&t.onProgress(r)}e.enqueue(i),t()}},t=>{e.error(t)})}}});return new Response(c)}throw new du(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{au.add(`file:${e}`,t);let n=uu[e];delete uu[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let n=uu[e];if(n===void 0)throw this.manager.itemError(e),t;delete uu[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onError&&r.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},pu=class extends lu{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new fu(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):pn(t),i.manager.itemError(e)}},n,r)}parse(e){let t=[];for(let n=0;n<e.length;n++){let r=nu.parse(e[n]);t.push(r)}return t}},mu=class extends lu{constructor(e){super(e)}load(e,t,n,r){let i=this,a=[],o=new vs,s=new fu(this.manager);s.setPath(this.path),s.setResponseType(`arraybuffer`),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials);let c=0;function l(l){s.load(e[l],function(e){let n=i.parse(e,!0);a[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},c+=1,c===6&&(n.mipmapCount===1&&(o.minFilter=ne),o.image=a,o.format=n.format,o.needsUpdate=!0,t&&t(o))},n,r)}if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)l(t);else s.load(e,function(e){let n=i.parse(e,!0);if(n.isCubemap){let e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){a[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)a[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),a[t].format=n.format,a[t].width=n.width,a[t].height=n.height}o.image=a}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;n.mipmapCount===1&&(o.minFilter=ne),o.format=n.format,o.needsUpdate=!0,t&&t(o)},n,r);return o}},hu=new WeakMap,gu=class extends lu{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=au.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0);else{let e=hu.get(a);e===void 0&&(e=[],hu.set(a,e)),e.push({onLoad:t,onError:r})}return a}let o=an(`img`);function s(){l(),t&&t(this);let n=hu.get(this)||[];for(let e=0;e<n.length;e++){let t=n[e];t.onLoad&&t.onLoad(this)}hu.delete(this),i.manager.itemEnd(e)}function c(t){l(),r&&r(t),au.remove(`image:${e}`);let n=hu.get(this)||[];for(let e=0;e<n.length;e++){let r=n[e];r.onError&&r.onError(t)}hu.delete(this),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),au.add(`image:${e}`,o),i.manager.itemStart(e),o.src=e,o}},_u=class extends lu{constructor(e){super(e)}load(e,t,n,r){let i=new xs;i.colorSpace=Dt;let a=new gu(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function s(n){a.load(e[n],function(e){i.images[n]=e,o++,o===6&&(i.needsUpdate=!0,t&&t(i))},void 0,r)}for(let t=0;t<e.length;++t)s(t);return i}},vu=class extends lu{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new oo,o=new fu(this.manager);return o.setResponseType(`arraybuffer`),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,function(e){let n;try{n=i.parse(e)}catch(e){r===void 0?pn(e):r(e);return}i._applyTexData(a,n),t&&t(a,n)},n,r),a}createDataTexture(e){let t=new oo;return this._applyTexData(t,this.parse(e)),t}_applyTexData(e,t){t.image===void 0?t.data!==void 0&&(e.image.width=t.width,e.image.height=t.height,e.image.data=t.data):e.image=t.image,e.wrapS=t.wrapS===void 0?T:t.wrapS,e.wrapT=t.wrapT===void 0?T:t.wrapT,e.magFilter=t.magFilter===void 0?ne:t.magFilter,e.minFilter=t.minFilter===void 0?ne:t.minFilter,e.anisotropy=t.anisotropy===void 0?1:t.anisotropy,t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.mipmaps!==void 0&&(e.mipmaps=t.mipmaps,e.minFilter=ae),t.mipmapCount===1&&(e.minFilter=ne),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),e.needsUpdate=!0}},yu=class extends lu{constructor(e){super(e)}load(e,t,n,r){let i=new sr,a=new gu(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}},bu=class extends Vr{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new R(e),this.intensity=t}dispose(){this.dispatchEvent({type:`dispose`})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},xu=class extends bu{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(Vr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new R(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},Su=new L,Cu=new I,wu=new I,Tu=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new F(512,512),this.mapType=j,this.map=null,this.mapPass=null,this.matrix=new L,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Eo,this._frameExtents=new F(1,1),this._viewportCount=1,this._viewports=[new cr(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;Cu.setFromMatrixPosition(e.matrixWorld),t.position.copy(Cu),wu.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(wu),t.updateMatrixWorld(),Su.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Su,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Su)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},Eu=new I,Du=new Un,Ou=new I,ku=class extends Vr{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new L,this.projectionMatrix=new L,this.projectionMatrixInverse=new L,this.coordinateSystem=Jt,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(Eu,Du,Ou),Ou.x===1&&Ou.y===1&&Ou.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Eu,Du,Ou.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Eu,Du,Ou),Ou.x===1&&Ou.y===1&&Ou.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Eu,Du,Ou.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Au=new I,ju=new F,Mu=new F,Nu=class extends ku{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=xn*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(bn*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return xn*2*Math.atan(Math.tan(bn*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Au.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Au.x,Au.y).multiplyScalar(-e/Au.z),Au.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Au.x,Au.y).multiplyScalar(-e/Au.z)}getViewSize(e,t){return this.getViewBounds(e,ju,Mu),t.subVectors(Mu,ju)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(bn*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},Pu=class extends Tu{constructor(){super(new Nu(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=xn*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},Fu=class extends bu{constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(Vr.DEFAULT_UP),this.updateMatrix(),this.target=new Vr,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new Pu}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},Iu=class extends Tu{constructor(){super(new Nu(90,1,.5,500)),this.isPointLightShadow=!0}},Lu=class extends bu{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=r,this.shadow=new Iu}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},Ru=class extends ku{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},zu=class extends Tu{constructor(){super(new Ru(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},Bu=class extends bu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(Vr.DEFAULT_UP),this.updateMatrix(),this.target=new Vr,this.shadow=new zu}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},Vu=class extends bu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type=`AmbientLight`}},Hu=class extends bu{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type=`RectAreaLight`,this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},Uu=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new I)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*i),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*r),t.addScaledVector(a[5],.858086*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],.858086*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}},Wu=class extends bu{constructor(e=new Uu,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}},Gu={},Ku=class e extends lu{constructor(e){super(e),this.textures={}}load(e,t,n,r){let i=this,a=new fu(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):pn(t),i.manager.itemError(e)}},n,r)}parse(e){let t=this.createMaterialFromType(e.type);return t.fromJSON(e,this.textures),t}setTextures(e){return this.textures=e,this}createMaterialFromType(t){return e.createMaterialFromType(t)}static createMaterialFromType(e){let t={ShadowMaterial:_l,SpriteMaterial:sa,RawShaderMaterial:Dl,ShaderMaterial:El,PointsMaterial:cs,MeshPhysicalMaterial:kl,MeshStandardMaterial:Ol,MeshPhongMaterial:Al,MeshToonMaterial:jl,MeshNormalMaterial:Ml,MeshLambertMaterial:Nl,MeshDepthMaterial:Pl,MeshDistanceMaterial:Fl,MeshBasicMaterial:Pa,MeshMatcapMaterial:Il,LineDashedMaterial:Ll,LineBasicMaterial:Jo,Material:oa,...Gu}[e],n;return t===void 0?(mn(`MaterialLoader: Unknown material type "${e}". Use .registerMaterial() before starting the deserialization process.`),n=new oa):n=new t,n}static registerMaterial(e,t){Gu[e]=t}},qu=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},Ju=class extends B{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type=`InstancedBufferGeometry`,this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}},Yu=class extends lu{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new fu(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):pn(t),i.manager.itemError(e)}},n,r)}parse(e){let t={},n={};function r(e,n){if(t[n]!==void 0)return t[n];let r=e.interleavedBuffers[n],a=i(e,r.buffer),o=new na(nn(r.type,a),r.stride);return o.uuid=r.uuid,t[n]=o,o}function i(e,t){if(n[t]!==void 0)return n[t];let r=e.arrayBuffers[t],i=new Uint32Array(r).buffer;return n[t]=i,i}let a=e.isInstancedBufferGeometry?new Ju:new B,o=e.data.index;if(o!==void 0){let e=nn(o.type,o.array);a.setIndex(new Ii(e,1))}let s=e.data.attributes;for(let t in s){let n=s[t],i;if(n.isInterleavedBufferAttribute)i=new ia(r(e.data,n.data),n.itemSize,n.offset,n.normalized);else{let e=nn(n.type,n.array);i=new(n.isInstancedBufferAttribute?uo:Ii)(e,n.itemSize,n.normalized)}n.name!==void 0&&(i.name=n.name),n.usage!==void 0&&i.setUsage(n.usage),a.setAttribute(t,i)}let c=e.data.morphAttributes;if(c)for(let t in c){let n=c[t],i=[];for(let t=0,a=n.length;t<a;t++){let a=n[t],o;o=a.isInterleavedBufferAttribute?new ia(r(e.data,a.data),a.itemSize,a.offset,a.normalized):new Ii(nn(a.type,a.array),a.itemSize,a.normalized),a.name!==void 0&&(o.name=a.name),i.push(o)}a.morphAttributes[t]=i}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);let l=e.data.groups||e.data.drawcalls||e.data.offsets;if(l!==void 0)for(let e=0,t=l.length;e!==t;++e){let t=l[e];a.addGroup(t.start,t.count,t.materialIndex)}let u=e.data.boundingSphere;return u!==void 0&&(a.boundingSphere=new Ji().fromJSON(u)),e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}},Xu={},Zu=class extends lu{constructor(e){super(e)}load(e,t,n,r){let i=this,a=this.path===``?qu.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;let o=new fu(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(n){let a=null;try{a=JSON.parse(n)}catch(t){r!==void 0&&r(t),pn(`ObjectLoader: Can't parse `+e+`.`,t.message);return}let o=a.metadata;if(o===void 0||o.type===void 0||o.type.toLowerCase()===`geometry`){r!==void 0&&r(Error(`THREE.ObjectLoader: Can't load `+e)),pn(`ObjectLoader: Can't load `+e);return}i.parse(a,t)},n,r)}async loadAsync(e,t){let n=this,r=this.path===``?qu.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;let i=new fu(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);let a=await i.loadAsync(e,t),o;try{o=JSON.parse(a)}catch(t){throw Error(`THREE.ObjectLoader: Can't parse `+e+`. `+t.message)}let s=o.metadata;if(s===void 0||s.type===void 0||s.type.toLowerCase()===`geometry`)throw Error(`THREE.ObjectLoader: Can't load `+e);return await n.parseAsync(o)}parse(e,t){let n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),a=this.parseImages(e.images,function(){t!==void 0&&t(c)}),o=this.parseTextures(e.textures,a),s=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,i,s,o,n),l=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,l),this.bindLightTargets(c),t!==void 0){let e=!1;for(let t in a)if(a[t].data instanceof HTMLImageElement){e=!0;break}e===!1&&t(c)}return c}async parseAsync(e){let t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,n),i=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o,a,t),c=this.parseSkeletons(e.skeletons,s);return this.bindSkeletons(s,c),this.bindLightTargets(s),s}static registerGeometry(e,t){Xu[e]=t}parseShapes(e){let t={};if(e!==void 0)for(let n=0,r=e.length;n<r;n++){let r=new hc().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){let n={},r={};if(t.traverse(function(e){e.isBone&&(r[e.uuid]=e)}),e!==void 0)for(let t=0,i=e.length;t<i;t++){let i=new lo().fromJSON(e[t],r);n[i.uuid]=i}return n}parseGeometries(e,t){let n={};if(e!==void 0){let r=new Yu;for(let i=0,a=e.length;i<a;i++){let a,o=e[i];switch(o.type){case`BufferGeometry`:case`InstancedBufferGeometry`:a=r.parse(o);break;default:o.type in gl?a=gl[o.type].fromJSON(o,t):o.type in Xu?a=Xu[o.type].fromJSON(o,t):M(`ObjectLoader: Unknown geometry type "${o.type}". Use .registerGeometry() before starting the deserialization process.`)}a.uuid=o.uuid,o.name!==void 0&&(a.name=o.name),o.userData!==void 0&&(a.userData=o.userData),n[o.uuid]=a}}return n}parseMaterials(e,t){let n={},r={};if(e!==void 0){let i=new Ku;i.setTextures(t);for(let t=0,a=e.length;t<a;t++){let a=e[t];n[a.uuid]===void 0&&(n[a.uuid]=i.parse(a)),r[a.uuid]=n[a.uuid]}}return r}parseAnimations(e){let t={};if(e!==void 0)for(let n=0;n<e.length;n++){let r=e[n],i=nu.parse(r);t[i.uuid]=i}return t}parseImages(e,t){let n=this,r={},i;function a(e){return e=n.manager.resolveURL(e),n.manager.itemStart(e),i.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}function o(e){if(typeof e==`string`){let t=e;return a(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:nn(e.type,e.data),width:e.width,height:e.height}:null}if(e!==void 0&&e.length>0){i=new gu(new su(t)),i.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){let n=e[t],i=n.url;if(Array.isArray(i)){let e=[];for(let t=0,n=i.length;t<n;t++){let n=i[t],r=o(n);r!==null&&(r instanceof HTMLImageElement?e.push(r):e.push(new oo(r.data,r.width,r.height)))}r[n.uuid]=new rr(e)}else{let e=o(n.url);r[n.uuid]=new rr(e)}}}return r}async parseImagesAsync(e){let t=this,n={},r;async function i(e){if(typeof e==`string`){let n=e,i=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:t.resourcePath+n;return await r.loadAsync(i)}return e.data?{data:nn(e.type,e.data),width:e.width,height:e.height}:null}if(e!==void 0&&e.length>0){r=new gu(this.manager),r.setCrossOrigin(this.crossOrigin);for(let t=0,r=e.length;t<r;t++){let r=e[t],a=r.url;if(Array.isArray(a)){let e=[];for(let t=0,n=a.length;t<n;t++){let n=a[t],r=await i(n);r!==null&&(r instanceof HTMLImageElement?e.push(r):e.push(new oo(r.data,r.width,r.height)))}n[r.uuid]=new rr(e)}else{let e=await i(r.url);n[r.uuid]=new rr(e)}}}return n}parseTextures(e,t){function n(e,t){return typeof e==`number`?e:(M(`ObjectLoader.parseTexture: Constant should be in numeric form.`,e),t[e])}let r={};if(e!==void 0)for(let i=0,a=e.length;i<a;i++){let a=e[i];a.image===void 0&&M(`ObjectLoader: No "image" specified for`,a.uuid),t[a.image]===void 0&&M(`ObjectLoader: Undefined image`,a.image);let o=t[a.image],s=o.data,c;Array.isArray(s)?(c=new xs,s.length===6&&(c.needsUpdate=!0)):(c=s&&s.data?new oo:new sr,s&&(c.needsUpdate=!0)),c.source=o,c.uuid=a.uuid,a.name!==void 0&&(c.name=a.name),a.mapping!==void 0&&(c.mapping=n(a.mapping,Qu)),a.channel!==void 0&&(c.channel=a.channel),a.offset!==void 0&&c.offset.fromArray(a.offset),a.repeat!==void 0&&c.repeat.fromArray(a.repeat),a.center!==void 0&&c.center.fromArray(a.center),a.rotation!==void 0&&(c.rotation=a.rotation),a.wrap!==void 0&&(c.wrapS=n(a.wrap[0],$u),c.wrapT=n(a.wrap[1],$u)),a.format!==void 0&&(c.format=a.format),a.internalFormat!==void 0&&(c.internalFormat=a.internalFormat),a.type!==void 0&&(c.type=a.type),a.colorSpace!==void 0&&(c.colorSpace=a.colorSpace),a.minFilter!==void 0&&(c.minFilter=n(a.minFilter,ed)),a.magFilter!==void 0&&(c.magFilter=n(a.magFilter,ed)),a.anisotropy!==void 0&&(c.anisotropy=a.anisotropy),a.flipY!==void 0&&(c.flipY=a.flipY),a.generateMipmaps!==void 0&&(c.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(c.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(c.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(c.compareFunction=a.compareFunction),a.normalized!==void 0&&(c.normalized=a.normalized),a.userData!==void 0&&(c.userData=a.userData),r[a.uuid]=c}return r}parseObject(e,t,n,r,i){let a;function o(e){return t[e]===void 0&&M(`ObjectLoader: Undefined geometry`,e),t[e]}function s(e){if(e!==void 0){if(Array.isArray(e)){let t=[];for(let r=0,i=e.length;r<i;r++){let i=e[r];n[i]===void 0&&M(`ObjectLoader: Undefined material`,i),t.push(n[i])}return t}return n[e]===void 0&&M(`ObjectLoader: Undefined material`,e),n[e]}}function c(e){return r[e]===void 0&&M(`ObjectLoader: Undefined texture`,e),r[e]}let l,u;switch(e.type){case`Scene`:a=new Qr,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new R(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type===`Fog`?a.fog=new Zr(e.fog.color,e.fog.near,e.fog.far):e.fog.type===`FogExp2`&&(a.fog=new Xr(e.fog.color,e.fog.density)),e.fog.name!==``&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(a.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&a.environmentRotation.fromArray(e.environmentRotation);break;case`PerspectiveCamera`:a=new Nu(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case`OrthographicCamera`:a=new Ru(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case`AmbientLight`:a=new Vu(e.color,e.intensity);break;case`DirectionalLight`:a=new Bu(e.color,e.intensity),a.target=e.target||``;break;case`PointLight`:a=new Lu(e.color,e.intensity,e.distance,e.decay);break;case`RectAreaLight`:a=new Hu(e.color,e.intensity,e.width,e.height);break;case`SpotLight`:a=new Fu(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||``;break;case`HemisphereLight`:a=new xu(e.color,e.groundColor,e.intensity);break;case`LightProbe`:a=new Wu(new Uu().fromArray(e.sh),e.intensity);break;case`SkinnedMesh`:l=o(e.geometry),u=s(e.material),a=new io(l,u),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case`Mesh`:l=o(e.geometry),u=s(e.material),a=new Ka(l,u);break;case`InstancedMesh`:l=o(e.geometry),u=s(e.material);let t=e.count,n=e.instanceMatrix,r=e.instanceColor;a=new vo(l,u,t),a.instanceMatrix=new uo(new Float32Array(n.array),16),r!==void 0&&(a.instanceColor=new uo(new Float32Array(r.array),r.itemSize));break;case`BatchedMesh`:l=o(e.geometry),u=s(e.material),a=new qo(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,u),a.geometry=l,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(e=>{let t=null,n=null;return e.boundingBox!==void 0&&(t=new pi().fromJSON(e.boundingBox)),e.boundingSphere!==void 0&&(n=new Ji().fromJSON(e.boundingSphere)),{...e,boundingBox:t,boundingSphere:n}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(a.boundingSphere=new Ji().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new pi().fromJSON(e.boundingBox));break;case`LOD`:a=new Ta;break;case`Line`:a=new ns(o(e.geometry),s(e.material));break;case`LineLoop`:a=new ss(o(e.geometry),s(e.material));break;case`LineSegments`:a=new os(o(e.geometry),s(e.material));break;case`PointCloud`:case`Points`:a=new ps(o(e.geometry),s(e.material));break;case`Sprite`:a=new xa(s(e.material));break;case`Group`:a=new Hr;break;case`Bone`:a=new ao;break;default:a=new Vr}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix===void 0?(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)):(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.pivot!==void 0&&(a.pivot=new I().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(a.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(a.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.static!==void 0&&(a.static=e.static),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){let o=e.children;for(let e=0;e<o.length;e++)a.add(this.parseObject(o[e],t,n,r,i))}if(e.animations!==void 0){let t=e.animations;for(let e=0;e<t.length;e++){let n=t[e];a.animations.push(i[n])}}if(e.type===`LOD`){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);let t=e.levels;for(let e=0;e<t.length;e++){let n=t[e],r=a.getObjectByProperty(`uuid`,n.object);r!==void 0&&a.addLevel(r,n.distance,n.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(e){if(e.isSkinnedMesh===!0&&e.skeleton!==void 0){let n=t[e.skeleton];n===void 0?M(`ObjectLoader: No skeleton found with UUID:`,e.skeleton):e.bind(n,e.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){let n=t.target,r=e.getObjectByProperty(`uuid`,n);t.target=r===void 0?new Vr:r}})}},Qu={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306},$u={RepeatWrapping:w,ClampToEdgeWrapping:T,MirroredRepeatWrapping:E},ed={NearestFilter:D,NearestMipmapNearestFilter:O,NearestMipmapLinearFilter:k,LinearFilter:ne,LinearMipmapNearestFilter:re,LinearMipmapLinearFilter:ae},td=new WeakMap,nd=class extends lu{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>`u`&&M(`ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&M(`ImageBitmapLoader: fetch() not supported.`),this.options={premultiplyAlpha:`none`},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=au.get(`image-bitmap:${e}`);if(a!==void 0){if(i.manager.itemStart(e),a.then){a.then(n=>{td.has(a)===!0?(r&&r(td.get(a)),i.manager.itemError(e),i.manager.itemEnd(e)):(t&&t(n),i.manager.itemEnd(e))});return}setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0);return}let o={};o.credentials=this.crossOrigin===`anonymous`?`same-origin`:`include`,o.headers=this.requestHeader,o.signal=typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:`none`}))}).then(function(n){au.add(`image-bitmap:${e}`,n),t&&t(n),i.manager.itemEnd(e)}).catch(function(t){r&&r(t),td.set(s,t),au.remove(`image-bitmap:${e}`),i.manager.itemError(e),i.manager.itemEnd(e)});au.add(`image-bitmap:${e}`,s),i.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},rd,id=class{static getContext(){return rd===void 0&&(rd=new(window.AudioContext||window.webkitAudioContext)),rd}static setContext(e){rd=e}},ad=class extends lu{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new fu(this.manager);a.setResponseType(`arraybuffer`),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{let r=n.slice(0),a=id.getContext(),s=e+`#decode`;i.manager.itemStart(s),a.decodeAudioData(r,function(e){t(e),i.manager.itemEnd(s)}).catch(function(e){o(e),i.manager.itemEnd(s)})}catch(e){o(e)}},n,r);function o(t){r?r(t):pn(t),i.manager.itemError(e)}}},od=new L,sd=new L,cd=new L,ld=class{constructor(){this.type=`StereoCamera`,this.aspect=1,this.eyeSep=.064,this.cameraL=new Nu,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Nu,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){let t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,cd.copy(e.projectionMatrix);let n=t.eyeSep/2,r=n*t.near/t.focus,i=t.near*Math.tan(bn*t.fov*.5)/t.zoom,a,o;sd.elements[12]=-n,od.elements[12]=n,a=-i*t.aspect+r,o=i*t.aspect+r,cd.elements[0]=2*t.near/(o-a),cd.elements[8]=(o+a)/(o-a),this.cameraL.projectionMatrix.copy(cd),a=-i*t.aspect-r,o=i*t.aspect-r,cd.elements[0]=2*t.near/(o-a),cd.elements[8]=(o+a)/(o-a),this.cameraR.projectionMatrix.copy(cd)}this.cameraL.matrix.copy(e.matrixWorld).multiply(sd),this.cameraL.matrixWorldNeedsUpdate=!0,this.cameraR.matrix.copy(e.matrixWorld).multiply(od),this.cameraR.matrixWorldNeedsUpdate=!0}},ud=-90,dd=1,fd=class extends Vr{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Nu(ud,dd,e,t);r.layers=this.layers,this.add(r);let i=new Nu(ud,dd,e,t);i.layers=this.layers,this.add(i);let a=new Nu(ud,dd,e,t);a.layers=this.layers,this.add(a);let o=new Nu(ud,dd,e,t);o.layers=this.layers,this.add(o);let s=new Nu(ud,dd,e,t);s.layers=this.layers,this.add(s);let c=new Nu(ud,dd,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let h=!1;h=e.isWebGLRenderer===!0?e.state.buffers.depth.getReversed():e.reversedDepthBuffer,e.setRenderTarget(n,0,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,i),e.setRenderTarget(n,1,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,4,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},pd=class extends Nu{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},md=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=hd.bind(this),e.addEventListener(`visibilitychange`,this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener(`visibilitychange`,this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e===void 0?performance.now():e)-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function hd(){this._document.hidden===!1&&this.reset()}var gd=new I,_d=new Un,vd=new I,yd=new I,bd=new I,xd=class extends Vr{constructor(){super(),this.type=`AudioListener`,this.context=id.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new md}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter===null?this.gain.disconnect(this.context.destination):(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();let t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(gd,_d,vd),yd.set(0,0,-1).applyQuaternion(_d),bd.set(0,1,0).applyQuaternion(_d),t.positionX){let e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(gd.x,e),t.positionY.linearRampToValueAtTime(gd.y,e),t.positionZ.linearRampToValueAtTime(gd.z,e),t.forwardX.linearRampToValueAtTime(yd.x,e),t.forwardY.linearRampToValueAtTime(yd.y,e),t.forwardZ.linearRampToValueAtTime(yd.z,e),t.upX.linearRampToValueAtTime(bd.x,e),t.upY.linearRampToValueAtTime(bd.y,e),t.upZ.linearRampToValueAtTime(bd.z,e)}else t.setPosition(gd.x,gd.y,gd.z),t.setOrientation(yd.x,yd.y,yd.z,bd.x,bd.y,bd.z)}},Sd=class extends Vr{constructor(e){super(),this.type=`Audio`,this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType=`empty`,this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType=`audioNode`,this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaNode`,this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaStreamNode`,this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType=`buffer`,this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){M(`Audio: Audio is already playing.`);return}if(this.hasPlaybackControl===!1){M(`Audio: this Audio has no playback control.`);return}this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){M(`Audio: this Audio has no playback control.`);return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress%=this.duration||this.buffer.duration),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){M(`Audio: this Audio has no playback control.`);return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||=[],this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){M(`Audio: this Audio has no playback control.`);return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(M(`Audio: this Audio has no playback control.`),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){M(`Audio: this Audio has no playback control.`);return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType===`buffer`?(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this):(M(`Audio: Audio source type cannot be copied.`),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}},Cd=new I,wd=new Un,Td=new I,Ed=new I,Dd=class extends Sd{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel=`HRTF`,this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Cd,wd,Td),Ed.set(0,0,1).applyQuaternion(wd);let t=this.panner;if(t.positionX){let e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Cd.x,e),t.positionY.linearRampToValueAtTime(Cd.y,e),t.positionZ.linearRampToValueAtTime(Cd.z,e),t.orientationX.linearRampToValueAtTime(Ed.x,e),t.orientationY.linearRampToValueAtTime(Ed.y,e),t.orientationZ.linearRampToValueAtTime(Ed.z,e)}else t.setPosition(Cd.x,Cd.y,Cd.z),t.setOrientation(Ed.x,Ed.y,Ed.z)}},W=class{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}},Od=class{constructor(e,t,n){this.binding=e,this.valueSize=n;let r,i,a;switch(t){case`quaternion`:r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case`string`:case`bool`:r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(n*5);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(a===0){for(let e=0;e!==r;++e)n[i+e]=n[e];a=t}else{a+=t;let e=t/a;this._mixBufferRegion(n,i,0,e,r)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,r=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){let e=t*this._origIndex;this._mixBufferRegion(n,r,e,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let e=t,i=t+t;e!==i;++e)if(n[e]!==n[e+t]){o.setValue(n,r);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let e=n,i=r;e!==i;++e)t[e]=t[r+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,r,i){if(r>=.5)for(let r=0;r!==i;++r)e[t+r]=e[n+r]}_slerp(e,t,n,r){Un.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,i){let a=this._workIndex*i;Un.multiplyQuaternionsFlat(e,a,e,t,e,n),Un.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,n,r,i){let a=1-r;for(let o=0;o!==i;++o){let i=t+o;e[i]=e[i]*a+e[n+o]*r}}_lerpAdditive(e,t,n,r,i){for(let a=0;a!==i;++a){let i=t+a;e[i]=e[i]+e[n+a]*r}}},kd=`\\[\\]\\.:\\/`,Ad=RegExp(`[\\[\\]\\.:\\/]`,`g`),jd=`[^\\[\\]\\.:\\/]`,Md=`[^`+kd.replace(`\\.`,``)+`]`,Nd=`((?:WC+[\\/:])*)`.replace(`WC`,jd),Pd=`(WCOD+)?`.replace(`WCOD`,Md),Fd=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,jd),Id=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,jd),Ld=RegExp(`^`+Nd+Pd+Fd+Id+`$`),Rd=[`material`,`materials`,`bones`,`map`],zd=class{constructor(e,t,n){let r=n||Bd.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Bd=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(Ad,``)}static parseTrackName(e){let t=Ld.exec(e);if(t===null)throw Error(`THREE.PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);Rd.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`THREE.PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;r<e.length;r++){let i=e[r];if(i.name===t||i.uuid===t)return i;let a=n(i.children);if(a)return a}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){M(`PropertyBinding: No target node found for track: `+this.path+`.`);return}if(r){let e=n.objectIndex;switch(r){case`materials`:if(!t.material){pn(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.materials){pn(`PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}t=t.material.materials;break;case`bones`:if(!t.skeleton){pn(`PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}t=t.skeleton.bones;for(let n=0;n<t.length;n++)if(t[n].name===e){e=n;break}break;case`map`:if(`map`in t){t=t.map;break}if(!t.material){pn(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.map){pn(`PropertyBinding: Can not bind to material.map as node.material does not have a map.`,this);return}t=t.material.map;break;default:if(t[r]===void 0){pn(`PropertyBinding: Can not bind to objectName of node undefined.`,this);return}t=t[r]}if(e!==void 0){if(t[e]===void 0){pn(`PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,t);return}t=t[e]}}let o=t[i];if(o===void 0){let e=n.nodeName;pn(`PropertyBinding: Trying to update property for track: `+e+`.`+i+` but it wasn't found.`,t);return}let s=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?s=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(s=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(a!==void 0){if(i===`morphTargetInfluences`){if(!t.geometry){pn(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(!t.geometry.morphAttributes){pn(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}t.morphTargetDictionary[a]!==void 0&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Bd.Composite=zd,Bd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Bd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Bd.prototype.GetterByBindingType=[Bd.prototype._getValue_direct,Bd.prototype._getValue_array,Bd.prototype._getValue_arrayElement,Bd.prototype._getValue_toArray],Bd.prototype.SetterByBindingTypeAndVersioning=[[Bd.prototype._setValue_direct,Bd.prototype._setValue_direct_setNeedsUpdate,Bd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Bd.prototype._setValue_array,Bd.prototype._setValue_array_setNeedsUpdate,Bd.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Bd.prototype._setValue_arrayElement,Bd.prototype._setValue_arrayElement_setNeedsUpdate,Bd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Bd.prototype._setValue_fromArray,Bd.prototype._setValue_fromArray_setNeedsUpdate,Bd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Vd=class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Sn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){let e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,a=i.length,o,s=e.length,c=this.nCachedObjects_;for(let l=0,u=arguments.length;l!==u;++l){let u=arguments[l],d=u.uuid,f=t[d];if(f===void 0){f=s++,t[d]=f,e.push(u);for(let e=0,t=a;e!==t;++e)i[e].push(new Bd(u,n[e],r[e]))}else if(f<c){o=e[f];let s=--c,l=e[s];t[l.uuid]=f,e[f]=l,t[d]=s,e[s]=u;for(let e=0,t=a;e!==t;++e){let t=i[e],a=t[s],o=t[f];t[f]=a,o===void 0&&(o=new Bd(u,n[e],r[e])),t[s]=o}}else e[f]!==o&&pn(`AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.`)}this.nCachedObjects_=c}remove(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){let o=arguments[a],s=o.uuid,c=t[s];if(c!==void 0&&c>=i){let a=i++,l=e[a];t[l.uuid]=c,e[c]=l,t[s]=a,e[a]=o;for(let e=0,t=r;e!==t;++e){let t=n[e],r=t[a],i=t[c];t[c]=r,t[a]=i}}}this.nCachedObjects_=i}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=e.length;for(let o=0,s=arguments.length;o!==s;++o){let s=arguments[o].uuid,c=t[s];if(c!==void 0)if(delete t[s],c<i){let o=--i,s=e[o],l=--a,u=e[l];t[s.uuid]=c,e[c]=s,t[u.uuid]=o,e[o]=u,e.pop();for(let e=0,t=r;e!==t;++e){let t=n[e],r=t[o],i=t[l];t[c]=r,t[o]=i,t.pop()}}else{let i=--a,o=e[i];i>0&&(t[o.uuid]=c),e[c]=o,e.pop();for(let e=0,t=r;e!==t;++e){let t=n[e];t[c]=t[i],t.pop()}}}this.nCachedObjects_=i}subscribe_(e,t){let n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(r!==void 0)return i[r];let a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=Array(c);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(let n=l,r=s.length;n!==r;++n){let r=s[n];u[n]=new Bd(r,e,t)}return u}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){let r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=e[o];t[c]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}},Hd=class{constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;let i=t.tracks,a=i.length,o=Array(a),s={endingStart:vt,endingEnd:vt};for(let e=0;e!==a;++e){let t=i[e].createInterpolant(null);o[e]=t,t.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._restoreTimeScale=null,this._weightInterpolant=null,this.loop=ft,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){let n=this._clip.duration,r=e._clip.duration,i=r/n,a=n/r;e._restoreTimeScale=e.timeScale,this._restoreTimeScale=this.timeScale,e.warp(1,i,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;o===null&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);let s=o.parameterPositions,c=o.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/a,c[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this._restoreTimeScale=null,this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}let i=this._startTime;if(i!==null){let r=(e-i)*n;r<0||n===0?t=0:(this._startTime=null,t=n*r)}t*=this._updateTimeScale(e);let a=this._updateTime(t),o=this._updateWeight(e);if(o>0){let e=this._interpolants,t=this._propertyBindings;switch(this.blendMode){case St:for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(a),t[n].accumulateAdditive(o);break;case xt:default:for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(a),t[n].accumulate(r,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(t===0?this.paused=!0:(this._restoreTimeScale!==null&&(t=this._restoreTimeScale),this.timeScale=t),this.stopWarping())}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=n===pt;if(e===0)return i===-1?r:a&&(i&1)==1?t-r:r;if(n===2200){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));handle_stop:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break handle_stop}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=t||r<0){let n=Math.floor(r/t);r-=t*n,i+=Math.abs(n);let o=this.repetitions-i;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e>0?1:-1});else{if(o===1){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:`loop`,action:this,loopDelta:n})}}else this._loopCount=i,this.time=r;if(a&&(i&1)==1)return t-r}return r}_setEndings(e,t,n){let r=this._interpolantSettings;n?(r.endingStart=yt,r.endingEnd=yt):(r.endingStart=e?this.zeroSlopeAtStart?yt:vt:bt,r.endingEnd=t?this.zeroSlopeAtEnd?yt:vt:bt)}_scheduleFading(e,t,n){let r=this._mixer,i=r.time,a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);let o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}},Ud=new Float32Array(1),Wd=class extends _n{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}_bindAction(e,t){let n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];l===void 0&&(l={},c[s]=l);for(let e=0;e!==i;++e){let i=r[e],c=i.name,u=l[c];if(u!==void 0)++u.referenceCount,a[e]=u;else{if(u=a[e],u!==void 0){u._cacheIndex===null&&(++u.referenceCount,this._addInactiveBinding(u,s,c));continue}let r=t&&t._propertyBindings[e].binding.parsedPath;u=new Od(Bd.create(n,c,r),i.ValueTypeName,i.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,s,c),a[e]=u}o[e].resultBuffer=u.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];n.useCount++===0&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];--n.useCount===0&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){let r=this._actions,i=this._actionsByClip,a=i[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{let t=a.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;let i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null;let u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],s.length===0&&delete a[i],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];--n.referenceCount===0&&this._removeInactiveBinding(n)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_addInactiveBinding(e,t,n){let r=this._bindingsByRootAndName,i=this._bindings,a=r[t];a===void 0&&(a={},r[t]=a),a[n]=e,e._cacheIndex=i.length,i.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[i],Object.keys(o).length===0&&delete a[r]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new Gl(new Float32Array(2),new Float32Array(2),1,Ud),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i}clipAction(e,t,n){let r=t||this._root,i=r.uuid,a=typeof e==`string`?nu.findByName(r,e):e,o=a===null?e:a.uuid,s=this._actionsByClip[o],c=null;if(n===void 0&&(n=a===null?xt:a.blendMode),s!==void 0){let e=s.actionByRoot[i];if(e!==void 0&&e.blendMode===n)return e;c=s.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;let l=new Hd(this,a,t,n);return this._bindAction(l,c),this._addInactiveAction(l,o,i),l}existingAction(e,t){let n=t||this._root,r=n.uuid,i=typeof e==`string`?nu.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return o===void 0?null:o.actionByRoot[r]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1;for(let o=0;o!==n;++o)t[o]._update(r,e,i,a);let o=this._bindings,s=this._nActiveBindings;for(let e=0;e!==s;++e)o[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(i!==void 0){let e=i.knownActions;for(let n=0,r=e.length;n!==r;++n){let r=e[n];this._deactivateAction(r);let i=r._cacheIndex,a=t[t.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,a._cacheIndex=i,t[i]=a,t.pop(),this._removeInactiveBindingsForAction(r)}delete r[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let e in n){let r=n[e].actionByRoot[t];r!==void 0&&(this._deactivateAction(r),this._removeInactiveAction(r))}let r=this._bindingsByRootAndName[t];if(r!==void 0)for(let e in r){let t=r[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){let n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}},Gd=class extends lr{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isRenderTarget3D=!0,this.depth=n,this.texture=new pr(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},Kd=class e{constructor(e){this.value=e}clone(){return new e(this.value.clone===void 0?this.value:this.value.clone())}},qd=0,Jd=class extends _n{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:qd++}),this.name=``,this.usage=Rt,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){let t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:`dispose`})}copy(e){this.name=e.name,this.usage=e.usage;let t=e.uniforms;this.uniforms.length=0;for(let e=0,n=t.length;e<n;e++){let n=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0;e<n.length;e++)this.uniforms.push(n[e].clone())}return this}clone(){return new this.constructor().copy(this)}},Yd=class extends na{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}},Xd=class{constructor(e,t,n,r,i,a=!1){this.isGLBufferAttribute=!0,this.name=``,this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=r,this.count=i,this.normalized=a,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}},Zd=new L,Qd=class{constructor(e,t,n=0,r=1/0){this.ray=new Na(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Tr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):pn(`Raycaster: Unsupported camera type: `+t.type)}setFromXRController(e){return Zd.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Zd),this}intersectObject(e,t=!0,n=[]){return ef(e,this,n,t),n.sort($d),n}intersectObjects(e,t=!0,n=[]){for(let r=0,i=e.length;r<i;r++)ef(e[r],this,n,t);return n.sort($d),n}};function $d(e,t){return e.distance-t.distance}function ef(e,t,n,r){let i=!0;if(e.layers.test(t.layers)&&e.raycast(t,n)===!1&&(i=!1),i===!0&&r===!0){let r=e.children;for(let e=0,i=r.length;e<i;e++)ef(r[e],t,n,!0)}}var tf=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,M(`Clock: This module has been deprecated. Please use THREE.Timer instead.`)}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}},nf=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){let e=1e-6;return this.phi=N(this.phi,e,Math.PI-e),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(N(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},rf=class{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}},af=class e{static{e.prototype.isMatrix2=!0}constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}},of=new F,sf=class{constructor(e=new F(1/0,1/0),t=new F(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=of.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,of).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},cf=new I,lf=new I,uf=new I,df=new I,ff=new I,pf=new I,mf=new I,hf=class{constructor(e=new I,t=new I){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){cf.subVectors(e,this.start),lf.subVectors(this.end,this.start);let n=lf.dot(lf);if(n===0)return 0;let r=lf.dot(cf)/n;return t&&(r=N(r,0,1)),r}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=pf,n=mf){let r=1e-8*1e-8,i,a,o=this.start,s=e.start,c=this.end,l=e.end;uf.subVectors(c,o),df.subVectors(l,s),ff.subVectors(o,s);let u=uf.dot(uf),d=df.dot(df),f=df.dot(ff);if(u<=r&&d<=r)return t.copy(o),n.copy(s),t.sub(n),t.dot(t);if(u<=r)i=0,a=f/d,a=N(a,0,1);else{let e=uf.dot(ff);if(d<=r)a=0,i=N(-e/u,0,1);else{let t=uf.dot(df),n=u*d-t*t;i=n===0?0:N((t*f-e*d)/n,0,1),a=(t*i+f)/d,a<0?(a=0,i=N(-e/u,0,1)):a>1&&(a=1,i=N((t-e)/u,0,1))}}return t.copy(o).addScaledVector(uf,i),n.copy(s).addScaledVector(df,a),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},gf=new I,_f=class extends Vr{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type=`SpotLightHelper`;let n=new B,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1;e<32;e++,t++){let n=e/32*Math.PI*2,i=t/32*Math.PI*2;r.push(Math.cos(n),Math.sin(n),1,Math.cos(i),Math.sin(i),1)}n.setAttribute(`position`,new z(r,3));let i=new Jo({fog:!1,toneMapped:!1});this.cone=new os(n,i),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorldNeedsUpdate=!0;let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),gf.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(gf),this.color===void 0?this.cone.material.color.copy(this.light.color):this.cone.material.color.set(this.color)}},vf=new I,yf=new L,bf=new L,xf=class extends os{constructor(e){let t=Sf(e),n=new B,r=[],i=[];for(let e=0;e<t.length;e++){let n=t[e];n.parent&&n.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(0,0,0),i.push(0,0,0))}n.setAttribute(`position`,new z(r,3)),n.setAttribute(`color`,new z(i,3));let a=new Jo({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,a),this.isSkeletonHelper=!0,this.type=`SkeletonHelper`,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;let o=new R(255),s=new R(65280);this.setColors(o,s)}updateMatrixWorld(e){let t=this.bones,n=this.geometry,r=n.getAttribute(`position`);bf.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e<t.length;e++){let i=t[e];i.parent&&i.parent.isBone&&(yf.multiplyMatrices(bf,i.matrixWorld),vf.setFromMatrixPosition(yf),r.setXYZ(n,vf.x,vf.y,vf.z),yf.multiplyMatrices(bf,i.parent.matrixWorld),vf.setFromMatrixPosition(yf),r.setXYZ(n+1,vf.x,vf.y,vf.z),n+=2)}n.getAttribute(`position`).needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){let n=this.geometry.getAttribute(`color`);for(let r=0;r<n.count;r+=2)n.setXYZ(r,e.r,e.g,e.b),n.setXYZ(r+1,t.r,t.g,t.b);return n.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};function Sf(e){let t=[];e.isBone===!0&&t.push(e);for(let n=0;n<e.children.length;n++)t.push(...Sf(e.children[n]));return t}var Cf=class extends Ka{constructor(e,t,n){let r=new ll(t,4,2),i=new Pa({wireframe:!0,fog:!1,toneMapped:!1});super(r,i),this.light=e,this.color=n,this.type=`PointLightHelper`,this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),this.color===void 0?this.material.color.copy(this.light.color):this.material.color.set(this.color)}},wf=new I,Tf=new R,Ef=new R,Df=class extends Vr{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type=`HemisphereLightHelper`;let r=new il(t);r.rotateY(Math.PI*.5),this.material=new Pa({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);let i=r.getAttribute(`position`),a=new Float32Array(i.count*3);r.setAttribute(`color`,new Ii(a,3)),this.add(new Ka(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{let t=e.geometry.getAttribute(`color`);Tf.copy(this.light.color),Ef.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){let r=e<n/2?Tf:Ef;t.setXYZ(e,r.r,r.g,r.b)}t.needsUpdate=!0}this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),e.lookAt(wf.setFromMatrixPosition(this.light.matrixWorld).negate())}},Of=class extends os{constructor(e=10,t=10,n=4473924,r=8947848){n=new R(n),r=new R(r);let i=t/2,a=e/t,o=e/2,s=[],c=[];for(let e=0,l=0,u=-o;e<=t;e++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);let t=e===i?n:r;t.toArray(c,l),l+=3,t.toArray(c,l),l+=3,t.toArray(c,l),l+=3,t.toArray(c,l),l+=3}let l=new B;l.setAttribute(`position`,new z(s,3)),l.setAttribute(`color`,new z(c,3));let u=new Jo({vertexColors:!0,toneMapped:!1});super(l,u),this.type=`GridHelper`}dispose(){this.geometry.dispose(),this.material.dispose()}},kf=class extends os{constructor(e=10,t=16,n=8,r=64,i=4473924,a=8947848){i=new R(i),a=new R(a);let o=[],s=[];if(t>1)for(let n=0;n<t;n++){let r=n/t*(Math.PI*2),c=Math.sin(r)*e,l=Math.cos(r)*e;o.push(0,0,0),o.push(c,0,l);let u=n&1?i:a;s.push(u.r,u.g,u.b),s.push(u.r,u.g,u.b)}for(let t=0;t<n;t++){let c=t&1?i:a,l=e-e/n*t;for(let e=0;e<r;e++){let t=e/r*(Math.PI*2),n=Math.sin(t)*l,i=Math.cos(t)*l;o.push(n,0,i),s.push(c.r,c.g,c.b),t=(e+1)/r*(Math.PI*2),n=Math.sin(t)*l,i=Math.cos(t)*l,o.push(n,0,i),s.push(c.r,c.g,c.b)}}let c=new B;c.setAttribute(`position`,new z(o,3)),c.setAttribute(`color`,new z(s,3));let l=new Jo({vertexColors:!0,toneMapped:!1});super(c,l),this.type=`PolarGridHelper`}dispose(){this.geometry.dispose(),this.material.dispose()}},Af=new I,jf=new I,Mf=new I,Nf=class extends Vr{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type=`DirectionalLightHelper`,t===void 0&&(t=1);let r=new B;r.setAttribute(`position`,new z([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let i=new Jo({fog:!1,toneMapped:!1});this.lightPlane=new ns(r,i),this.add(this.lightPlane),r=new B,r.setAttribute(`position`,new z([0,0,0,0,0,1],3)),this.targetLine=new ns(r,i),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Af.setFromMatrixPosition(this.light.matrixWorld),jf.setFromMatrixPosition(this.light.target.matrixWorld),Mf.subVectors(jf,Af),this.lightPlane.lookAt(jf),this.color===void 0?(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)):(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)),this.targetLine.lookAt(jf),this.targetLine.scale.z=Mf.length()}},Pf=new I,Ff=new ku,If=class extends os{constructor(e){let t=new B,n=new Jo({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],a={};o(`n1`,`n2`),o(`n2`,`n4`),o(`n4`,`n3`),o(`n3`,`n1`),o(`f1`,`f2`),o(`f2`,`f4`),o(`f4`,`f3`),o(`f3`,`f1`),o(`n1`,`f1`),o(`n2`,`f2`),o(`n3`,`f3`),o(`n4`,`f4`),o(`p`,`n1`),o(`p`,`n2`),o(`p`,`n3`),o(`p`,`n4`),o(`u1`,`u2`),o(`u2`,`u3`),o(`u3`,`u1`),o(`c`,`t`),o(`p`,`c`),o(`cn1`,`cn2`),o(`cn3`,`cn4`),o(`cf1`,`cf2`),o(`cf3`,`cf4`);function o(e,t){s(e),s(t)}function s(e){r.push(0,0,0),i.push(0,0,0),a[e]===void 0&&(a[e]=[]),a[e].push(r.length/3-1)}t.setAttribute(`position`,new z(r,3)),t.setAttribute(`color`,new z(i,3)),super(t,n),this.type=`CameraHelper`,this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();let c=new R(16755200),l=new R(16711680),u=new R(43775),d=new R(16777215),f=new R(3355443);this.setColors(c,l,u,d,f)}setColors(e,t,n,r,i){let a=this.geometry.getAttribute(`color`);return a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,i.r,i.g,i.b),a.setXYZ(41,i.r,i.g,i.b),a.setXYZ(42,i.r,i.g,i.b),a.setXYZ(43,i.r,i.g,i.b),a.setXYZ(44,i.r,i.g,i.b),a.setXYZ(45,i.r,i.g,i.b),a.setXYZ(46,i.r,i.g,i.b),a.setXYZ(47,i.r,i.g,i.b),a.setXYZ(48,i.r,i.g,i.b),a.setXYZ(49,i.r,i.g,i.b),a.needsUpdate=!0,this}update(){let e=this.geometry,t=this.pointMap,n,r;if(Ff.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)n=1,r=0;else if(this.camera.coordinateSystem===2e3)n=-1,r=1;else if(this.camera.coordinateSystem===2001)n=0,r=1;else throw Error(`THREE.CameraHelper.update(): Invalid coordinate system: `+this.camera.coordinateSystem);Lf(`c`,t,e,Ff,0,0,n),Lf(`t`,t,e,Ff,0,0,r),Lf(`n1`,t,e,Ff,-1,-1,n),Lf(`n2`,t,e,Ff,1,-1,n),Lf(`n3`,t,e,Ff,-1,1,n),Lf(`n4`,t,e,Ff,1,1,n),Lf(`f1`,t,e,Ff,-1,-1,r),Lf(`f2`,t,e,Ff,1,-1,r),Lf(`f3`,t,e,Ff,-1,1,r),Lf(`f4`,t,e,Ff,1,1,r),Lf(`u1`,t,e,Ff,.7,1.1,n),Lf(`u2`,t,e,Ff,-.7,1.1,n),Lf(`u3`,t,e,Ff,0,2,n),Lf(`cf1`,t,e,Ff,-1,0,r),Lf(`cf2`,t,e,Ff,1,0,r),Lf(`cf3`,t,e,Ff,0,-1,r),Lf(`cf4`,t,e,Ff,0,1,r),Lf(`cn1`,t,e,Ff,-1,0,n),Lf(`cn2`,t,e,Ff,1,0,n),Lf(`cn3`,t,e,Ff,0,-1,n),Lf(`cn4`,t,e,Ff,0,1,n),e.getAttribute(`position`).needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Lf(e,t,n,r,i,a,o){Pf.set(i,a,o).unproject(r);let s=t[e];if(s!==void 0){let e=n.getAttribute(`position`);for(let t=0,n=s.length;t<n;t++)e.setXYZ(s[t],Pf.x,Pf.y,Pf.z)}}var Rf=new pi,zf=class extends os{constructor(e,t=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new B;i.setIndex(new Ii(n,1)),i.setAttribute(`position`,new Ii(r,3)),super(i,new Jo({color:t,toneMapped:!1})),this.object=e,this.type=`BoxHelper`,this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Rf.setFromObject(this.object),Rf.isEmpty())return;let e=Rf.min,t=Rf.max,n=this.geometry.attributes.position,r=n.array;r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=e.x,r[4]=t.y,r[5]=t.z,r[6]=e.x,r[7]=e.y,r[8]=t.z,r[9]=t.x,r[10]=e.y,r[11]=t.z,r[12]=t.x,r[13]=t.y,r[14]=e.z,r[15]=e.x,r[16]=t.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=t.x,r[22]=e.y,r[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}},Bf=class extends os{constructor(e,t=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],i=new B;i.setIndex(new Ii(n,1)),i.setAttribute(`position`,new z(r,3)),super(i,new Jo({color:t,toneMapped:!1})),this.box=e,this.type=`Box3Helper`,this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}},Vf=class extends ns{constructor(e,t=1,n=16776960){let r=n,i=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new B;a.setAttribute(`position`,new z(i,3)),a.computeBoundingSphere(),super(a,new Jo({color:r,toneMapped:!1})),this.type=`PlaneHelper`,this.plane=e,this.size=t;let o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],s=new B;s.setAttribute(`position`,new z(o,3)),s.computeBoundingSphere(),this.add(new Ka(s,new Pa({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},Hf=new I,Uf,Wf,Gf=class extends Vr{constructor(e=new I(0,0,1),t=new I(0,0,0),n=1,r=16776960,i=n*.2,a=i*.2){super(),this.type=`ArrowHelper`,Uf===void 0&&(Uf=new B,Uf.setAttribute(`position`,new z([0,0,0,0,1,0],3)),Wf=new js(.5,1,5,1),Wf.translate(0,-.5,0)),this.position.copy(t),this.line=new ns(Uf,new Jo({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ka(Wf,new Pa({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Hf.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Hf,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},Kf=class extends os{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new B;r.setAttribute(`position`,new z(t,3)),r.setAttribute(`color`,new z(n,3));let i=new Jo({vertexColors:!0,toneMapped:!1});super(r,i),this.type=`AxesHelper`}setColors(e,t,n){let r=new R,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(t),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},qf=class{constructor(){this.type=`ShapePath`,this.color=new R,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new mc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(e,t){let n=!1,r=t.length;for(let i=0,a=r-1;i<r;a=i++){let r=t[i],o=t[a];r.y>e.y!=o.y>e.y&&e.x<(o.x-r.x)*(e.y-r.y)/(o.y-r.y)+r.x&&(n=!n)}return n}function t(t,n){let r=n.getCenter(new F);if(e(r,t))return r;let i=r.y,a=[],o=t.length;for(let e=0;e<o;e++){let n=t[e],r=t[(e+1)%o];if(n.y>i!=r.y>i){let e=n.x+(i-n.y)*(r.x-n.x)/(r.y-n.y);a.push(e)}}return a.length>1&&(a.sort((e,t)=>e-t),r.x=(a[0]+a[1])/2),r}let n=this.userData.style&&this.userData.style.fillRule||`nonzero`;n!==`nonzero`&&n!==`evenodd`&&(M(`Fill-rule "`+n+`" is not supported, falling back to "nonzero".`),n=`nonzero`);let r=n===`nonzero`?(e=>e!==0):(e=>!!(e&1)),i=[];for(let e of this.subPaths){let n=e.getPoints();if(n.length<3)continue;let r=Xc.area(n);if(r===0)continue;let a=new sf;for(let e=0;e<n.length;e++)a.expandByPoint(n[e]);i.push({subPath:e,points:n,boundingBox:a,interiorPoint:t(n,a),absArea:Math.abs(r),winding:r<0?-1:1,container:null,exclude:!1,role:null})}i.sort((e,t)=>t.absArea-e.absArea);for(let t=0;t<i.length;t++){let n=i[t],a=0;for(let r=t-1;r>=0;r--){let t=i[r];if(t.boundingBox.containsBox(n.boundingBox)&&e(n.interiorPoint,t.points)){n.container=t.exclude?t.container:t,a=t.winding,n.winding+=a;break}}r(n.winding)===r(a)&&(n.exclude=!0)}for(let e of i)e.exclude||(e.role=e.container===null||e.container.role===`hole`?`outer`:`hole`);let a=[],o=new Map;for(let e of i){if(e.exclude||e.role!==`outer`)continue;let t=new hc;t.curves=e.subPath.curves,a.push(t),o.set(e,t)}for(let e of i){if(e.exclude||e.role!==`hole`)continue;let t=o.get(e.container);if(!t)continue;let n=new mc;n.curves=e.subPath.curves,t.holes.push(n)}return a}},Jf=class extends _n{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){M(`Controls: connect() now requires an element.`);return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function Yf(e,t){let n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}function Xf(e,t){let n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}function Zf(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}function Qf(e,t,n,r){let i=$f(r);switch(n){case ve:return e*t;case Ce:return e*t/i.components*i.byteLength;case we:return e*t/i.components*i.byteLength;case Te:return e*t*2/i.components*i.byteLength;case Ee:return e*t*2/i.components*i.byteLength;case ye:return e*t*3/i.components*i.byteLength;case be:return e*t*4/i.components*i.byteLength;case Oe:return e*t*4/i.components*i.byteLength;case ke:case Ae:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case je:case Me:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Pe:case Ie:return Math.max(e,16)*Math.max(t,8)/4;case Ne:case Fe:return Math.max(e,8)*Math.max(t,8)/2;case Le:case Re:case Be:case Ve:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case ze:case He:case Ue:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case We:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Ge:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case Ke:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case qe:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case Je:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case Ye:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case Xe:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Ze:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case Qe:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case $e:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case et:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case tt:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case nt:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case rt:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case it:case at:case ot:return Math.ceil(e/4)*Math.ceil(t/4)*16;case st:case ct:return Math.ceil(e/4)*Math.ceil(t/4)*8;case lt:case ut:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function $f(e){switch(e){case j:case oe:return{byteLength:1,components:1};case ce:case se:case fe:return{byteLength:2,components:1};case pe:case me:return{byteLength:2,components:4};case ue:case le:case de:return{byteLength:4,components:1};case ge:case _e:return{byteLength:4,components:3}}throw Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}var ep=class{static contain(e,t){return Yf(e,t)}static cover(e,t){return Xf(e,t)}static fill(e){return Zf(e)}static getByteLength(e,t,n,r){return Qf(e,t,n,r)}};typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`185`}})),typeof window<`u`&&(window.__THREE__?M(`WARNING: Multiple instances of Three.js being imported.`):window.__THREE__=`185`);var tp=t((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),np=t(((e,t)=>{t.exports=tp()})),rp=t((e=>{var t=p(),n=np();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),ip=t(((e,t)=>{t.exports=rp()})),ap=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),op=t(((e,t)=>{t.exports=ap()})),G=e(p(),1),sp=`cozyclay.locale`;function cp(){try{let e=localStorage.getItem(sp);return e===`ko`||e===`en`?e:null}catch{return null}}var lp=cp()??`en`,up=lp===`ko`,dp=cp()!==null;function fp(e,t){return up?t:e}function pp(e){if(e===`ko`||e===`en`){try{localStorage.setItem(sp,e)}catch{}window.location.reload()}}var K=op(),mp=Object.freeze({minScale:.1,maxScale:10,maxOffset:100}),hp=(e,t)=>{let n=Number(e);return Number.isFinite(n)?n:t};function gp(e){let t=((e+180)%360+360)%360-180;return Object.is(t,-0)?0:t}function _p(e,t=mp){let n=e&&typeof e==`object`&&!Array.isArray(e)?e:{},r=Math.max(2**-52,hp(t?.minScale,mp.minScale)),i=Math.max(r,hp(t?.maxScale,mp.maxScale)),a=Math.max(0,hp(t?.maxOffset,mp.maxOffset)),o=hp(n.scale,1),s=hp(n.yawDeg??n.yaw,0),c=e=>Math.max(-a,Math.min(a,hp(e,0)));return{scale:Math.max(r,Math.min(i,o>0?o:1)),yawDeg:gp(s),offsetX:c(n.offsetX??n.offset_x),offsetY:c(n.offsetY??n.offset_y),offsetZ:c(n.offsetZ??n.offset_z)}}function vp(e){return e==null?e:typeof e.slice==`function`?e.slice():Array.from(e)}function yp(e,t){return e!=null&&typeof e.length==`number`&&e.length>=t}function bp(e,t=e?.sceneCalibration,n={}){let r={status:`not-needed`,applied:!1,changedFrames:0,maxDisplacement:0,maxRootDisplacement:0,maxJointDisplacement:0,calibration:_p(null,n.limits)};if(!e||typeof e!=`object`)return{motion:e,diagnostics:{...r,status:`invalid-motion`}};let i=_p(t,n.limits),a=Number(e.frames),o=Number.isInteger(a)&&a>=0&&yp(e.rootPos,a*3),s=Number.isInteger(a)&&a>=0&&yp(e.posedJoints,0)&&e.posedJoints.length%(a*3||1)==0;if(!o&&!s)return{motion:e,diagnostics:{...r,status:`invalid-motion`,calibration:i}};if(i.scale===1&&i.yawDeg===0&&i.offsetX===0&&i.offsetY===0&&i.offsetZ===0)return{motion:e,diagnostics:{...r,calibration:i}};let c=i.yawDeg*Math.PI/180,l=Math.cos(c),u=Math.sin(c),d=(e,t,n)=>{let r=i.scale*e,a=i.scale*t,o=i.scale*n;return[l*r+u*o+i.offsetX,a+i.offsetY,-u*r+l*o+i.offsetZ]},f=o?vp(e.rootPos):e.rootPos,p=s?vp(e.posedJoints):e.posedJoints,m=0,h=0,g=0,_=(e,t)=>[...e,...t].every(Number.isFinite)?Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]):0;for(let t=0;t<a;t+=1){let n=!1;if(o){let r=t*3,i=[e.rootPos[r],e.rootPos[r+1],e.rootPos[r+2]],a=d(...i);f[r]=a[0],f[r+1]=a[1],f[r+2]=a[2],m=Math.max(m,_(i,a)),n||=_(i,a)>1e-9}if(s){let r=e.posedJoints.length/(a*3);for(let i=0;i<r;i+=1){let a=(t*r+i)*3,o=[e.posedJoints[a],e.posedJoints[a+1],e.posedJoints[a+2]],s=d(...o);p[a]=s[0],p[a+1]=s[1],p[a+2]=s[2],h=Math.max(h,_(o,s)),n||=_(o,s)>1e-9}}n&&(g+=1)}let v={status:`calibrated`,applied:!0,changedFrames:g,maxDisplacement:Math.max(m,h),maxRootDisplacement:m,maxJointDisplacement:h,calibration:i};return{motion:{...e,rootPos:f,posedJoints:p},diagnostics:v}}Object.freeze([`idle`,`fetching`,`probing`,`ready`,`error`]);function xp(e,t=!1){if(!e)return``;if(e.status===`disabled`)return t?`낙하 보정 꺼짐`:`Descent recovery off`;if(e.status===`corrected`){let n=e.rejected?.length??0;return t?`낙하 보정 ${e.changedFrames}프레임 적용${n?` · ${n}구간 미해결`:``}`:`Descent recovery: ${e.changedFrames} frames corrected${n?` · ${n} unresolved spans`:``}`}let n=e.rejected?.[0]?.reason??e.reason??`unknown`;return`${t?`낙하 보정 미적용`:`Descent recovery not applied`}: ${{"world-endpoint-unsettled":[`3D endpoint never settles`,`3D 끝점이 안정되지 않음`],"no-confident-delayed-descent":[`no confident delayed descent detected`,`확실한 낙하 지연이 검출되지 않음`],"moving-camera-not-supported":[`moving-camera recovery unsupported`,`이동 카메라 보정 미지원`],"uncertain-keypoints":[`body tracking uncertain`,`관절 추적 불확실`],"uncertain-depth":[`depth change too large`,`깊이 변화가 큼`],"moving-landing":[`landing does not stay still`,`착지 후 이동이 계속됨`],"no-observed-landing":[`landing not observed`,`착지를 확인할 수 없음`],"landing-observation-too-short":[`not enough footage after landing`,`착지 이후 영상이 너무 짧음`],"excessive-correction":[`recovery exceeds its safety bound`,`보정량이 안전 범위를 초과함`]}[n]?.[+!!t]??n}`}function Sp(e,t=!1){if(!e)return``;if(e.available===!1)return t?`색 세그멘테이션 측정 불가`:`Palette segmentation metrics unavailable`;if(e.detector!==`palette`||!Number.isFinite(e.detectionRate))return``;let n=Math.round(e.detectionRate*100),r=Number.isFinite(e.coverage?.mean)?Math.round(e.coverage.mean*100):null,i=Number.isFinite(e.coverage?.p10)&&Number.isFinite(e.coverage?.p90)?`${Math.round(e.coverage.p10*100)}–${Math.round(e.coverage.p90*100)}%`:null,a=Number.isFinite(e.parts?.mean)?Math.round(e.parts.mean):null,o=Number.isFinite(e.longestGapFrames)?e.longestGapFrames:0,s=Number.isFinite(e.hueErrorDeg?.p95)?Math.round(e.hueErrorDeg.p95):null;return t?`색 세그멘테이션: ${n}% 검출${r===null?``:` · 마스크 ${r}%${i?` (${i})`:``}`}${a===null?``:` · 색 파트 ${a}개`}${o?` · 최대 끊김 ${o}프레임`:``}${s===null?``:` · 색 오차 P95 ${s}°`}`:`Palette segmentation: ${n}% detected${r===null?``:` · ${r}% mask${i?` (${i})`:``}`}${a===null?``:` · ${a} colour parts`}${o?` · longest gap ${o} frames`:``}${s===null?``:` · hue error P95 ${s}°`}`}function Cp(e){if(typeof e!=`string`)return{ok:!1,reason:`url-not-string`};let t=e.trim();if(t.length===0)return{ok:!1,reason:`url-empty`};if(t.startsWith(`//`))return{ok:!1,reason:`url-protocol-relative`};if(t.startsWith(`/`))return{ok:!0,url:t};if(/^https?:\/\//i.test(t)){let e;try{e=new URL(t)}catch{return{ok:!1,reason:`url-malformed`}}return Tp(e.toString())?{ok:!1,reason:`url-platform-page`}:{ok:!0,url:e.toString()}}return{ok:!1,reason:`url-scheme-unsupported`}}var wp=/(?:^|\.)(?:youtube\.com|youtu\.be|vimeo\.com|tiktok\.com|instagram\.com|facebook\.com|twitter\.com|x\.com|bilibili\.com|naver\.com|kakao\.com)$/i;function Tp(e){if(typeof e!=`string`)return!1;try{return wp.test(new URL(e).hostname)}catch{return!1}}async function Ep(e,t,{fetchImpl:n,onProgress:r,defaultError:i}={}){let a=n??globalThis.fetch;if(typeof a!=`function`)throw Error(`fetch-unavailable`);let o;try{o=await a(e,t)}catch{throw Error(`bridge-unreachable`)}if(!o.ok){let e=`http-${o.status}`;try{e=(await o.json())?.reason??e}catch{}throw Error(e)}let s=o.body?.getReader?null:await o.text(),c=``,l=null,u=e=>{if(!e.trim())return;let t;try{t=JSON.parse(e)}catch{return}if(t.event===`progress`)r?.({stage:t.stage,ratio:t.ratio});else if(t.event===`error`)throw Error(t.message||i);else t.event===`done`&&(l=t)};if(s!==null)for(let e of s.split(`
|
|
14
|
-
`))u(e);else{let e=o.body.getReader(),t=new TextDecoder;for(;;){let{done:n,value:r}=await e.read();if(n)break;c+=t.decode(r,{stream:!0});let i=c.split(`
|
|
15
|
-
`);c=i.pop()??``;for(let e of i)u(e)}c&&u(c)}return l}async function Dp(e,t={}){let n=await Ep(`/ardy/footage`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})},{...t,defaultError:`footage-download-failed`});if(!n||typeof n.url!=`string`)throw Error(`bridge-footage-incomplete`);return n}async function Op(e,t={}){let n=await Ep(`/ardy/extract`,typeof e?.footage==`string`?{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({footage:e.footage})}:{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:e},{...t,defaultError:`extract-run-failed`});if(!n||typeof n.motionUrl!=`string`)throw Error(`bridge-extract-incomplete`);return n}async function kp(e,t=globalThis.fetch){if(typeof e!=`string`||!e)throw Error(`Generated video has no fetchable output.`);if(typeof t!=`function`)throw Error(`video-download-unavailable`);let n=await t(e);if(!n.ok)throw Error(`Generated video download failed (${n.status}).`);return n.blob()}function Ap(e){if(typeof e!=`string`||e.length===0)return``;let t=e.split(/[?#]/)[0];return t.split(`/`).filter(Boolean).pop()??t}function jp(e,t){return!Number.isFinite(t)||t<=0||!Number.isFinite(e)||e<0?null:Math.min(1,e/t)}function Mp(e,t){return!(e>0)||!(t>0)?1:Math.max(1,Math.floor(e*t+1e-6)+1)}function Np(e,t=30){if(!Array.isArray(e)||e.length<3)return{fps:t,measured:!1};let n=[];for(let t=1;t<e.length;t+=1){let r=e[t]-e[t-1];r>1e-4&&n.push(r)}if(n.length===0)return{fps:t,measured:!1};n.sort((e,t)=>e-t);let r=n[Math.floor(n.length/2)];return r>0?{fps:Math.round(1/r),measured:!0}:{fps:t,measured:!1}}function Pp(e){return!Number.isFinite(e)||e<0?``:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:`${(e/1048576).toFixed(1)} MB`}function Fp(e){if(!e)return``;let t=[`${e.width}×${e.height}`,`${e.durationS.toFixed(2)}s`,`${e.fps} fps${e.fpsMeasured?``:`?`}`,`${e.frames} frames`];return Number.isFinite(e.bytes)&&e.bytes>0&&t.push(Pp(e.bytes)),t.join(` · `)}async function Ip(e,{fetchImpl:t,onProgress:n,signal:r}={}){let i=t??globalThis.fetch;if(typeof i!=`function`)throw Error(`fetch-unavailable`);let a;try{a=await i(e,{signal:r})}catch(e){throw e?.name===`AbortError`?e:Error(`fetch-failed`)}if(!a.ok)throw Error(`http-${a.status}`);let o=Number(a.headers?.get?.(`content-length`)),s=Number.isFinite(o)&&o>0?o:null,c=a.headers?.get?.(`content-type`)??``;if(/^(?:text\/html|application\/json|text\/plain)\b/i.test(c))throw Error(`not-a-video`);if(!a.body?.getReader){let e=await a.blob();return n?.({received:e.size,total:e.size,ratio:1}),{blob:e,bytes:e.size,type:c}}let l=a.body.getReader(),u=[],d=0;for(;;){let{done:e,value:t}=await l.read();if(e)break;u.push(t),d+=t.byteLength??t.length??0,n?.({received:d,total:s,ratio:jp(d,s)})}let f=new Blob(u,{type:c||`video/mp4`});return n?.({received:d,total:s??d,ratio:1}),{blob:f,bytes:d,type:c}}async function Lp(e,{createVideo:t,timeoutMs:n=15e3,fallbackFps:r=30,knownFps:i=null}={}){let a=t();a.src=e,a.muted=!0,a.playsInline=!0,a.preload=`auto`,await new Promise((e,t)=>{let r=!1,i=setTimeout(()=>{r||(r=!0,t(Error(`probe-timeout`)))},n),o=n=>{r||(r=!0,clearTimeout(i),n?t(n):e())};a.addEventListener(`loadedmetadata`,()=>o(null),{once:!0}),a.addEventListener(`error`,()=>o(Error(`decode-failed`)),{once:!0}),a.load?.()});let o=Number(a.duration),s=Number(a.videoWidth),c=Number(a.videoHeight);if(!(o>0))throw Error(`duration-unreadable`);if(!(s>0)||!(c>0))throw Error(`dimensions-unreadable`);let l=Number.isFinite(i)&&i>0,u=l?[]:await Rp(a),{fps:d,measured:f}=l?{fps:i,measured:!0}:Np(u,r);return{durationS:o,width:s,height:c,fps:d,fpsMeasured:f,frames:Mp(o,d)}}async function Rp(e,t=12){if(typeof e.requestVideoFrameCallback!=`function`)return[];let n=[];try{await e.play?.()}catch{return[]}return await new Promise(r=>{let i=Date.now()+2e3,a=(o,s)=>{if(n.push(s?.mediaTime??0),n.length>=t||Date.now()>i){r();return}e.requestVideoFrameCallback(a)};e.requestVideoFrameCallback(a)}),e.pause?.(),e.currentTime=0,n}var zp=1.8,Bp=1.3,Vp=Object.freeze({super16:Object.freeze({id:`super16`,label:`Super 16`,widthMm:12.52,heightMm:7.41}),super35:Object.freeze({id:`super35`,label:`Super 35`,widthMm:24.89,heightMm:18.66}),fullFrame:Object.freeze({id:`fullFrame`,label:`Full Frame`,widthMm:36,heightMm:24}),"65mm":Object.freeze({id:`65mm`,label:`65mm`,widthMm:52.63,heightMm:23.01})}),Hp=`fullFrame`,Up=16/9,Wp=Object.freeze({"16:9":16/9,"2.39:1":2.39,"9:16":9/16,"1:1":1,"4:3":4/3,"12:7":12/7,"fal 480P":832/480});function Gp(e=Hp,t=Up){let n=Vp[e]??Vp.fullFrame,r=Number.isFinite(t)&&t>0?t:Up;return Math.min(n.heightMm,n.widthMm/r)}function Kp(e,t=Hp,n=Up){return Gp(t,n)/(2*Math.tan(e/2))}function qp(e,t=Hp,n=Up){return 2*Math.atan(Gp(t,n)/(2*e))}var Jp=[14,18,24,28,35,50,85,100,135];function Yp(e,t=Hp,n=Up){let r=Kp(e,t,n);return Jp.reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e)}var Xp=[[2.8,`extreme close-up`,`ultra-realistic skin texture with visible pores and micro-detail, tack-sharp eyes, shallow depth of field`],[1.6,`close-up`,`ultra-realistic skin texture and fine facial detail, soft background blur, shallow depth of field`],[1.15,`medium close-up`,`natural skin and fabric texture, clear facial detail, shallow depth of field`],[.8,`medium shot`,`balanced detail on the subject and the surrounding space, moderate depth of field`],[.52,`medium-wide shot`,`the full figure with the environment clearly visible, deep focus`],[.3,`wide shot`,`full body in a richly detailed environment, deep focus`],[0,`extreme wide shot`,`a small figure within a vast, highly detailed environment, epic sense of scale, deep focus`]],Zp=[[2.5,`overhead`,`a directly overhead bird's-eye view looking down at the subject`],[1.8,`high angle`,`a high angle looking down at the subject`],[1.5,`eye level`,`eye level`],[1.25,`chest level`,`chest level`],[.95,`hip level`,`a low hip-level angle`],[.45,`knee level`,`a low knee-level angle looking up at the subject`],[-1/0,`ground level`,`a dramatic ground-level angle looking up at the subject`]],Qp=(e,t)=>e.find(([e])=>t>=e)??e[e.length-1];function $p(e,t,n,r=zp,i={}){let a=i.sensorId??`fullFrame`,o=i.aspectRatio??1.7777777777777777,s=e.x-t.x,c=e.z-t.z,l=e.y-Bp,u=Math.hypot(s,c),d=Math.max(Math.hypot(u,l),1e-6),f=r/(2*d*Math.tan(n/2)),[,p,m]=Qp(Xp,f),[,h,g]=Qp(Zp,e.y),_=Math.atan2(e.y-r*.94,Math.max(u,1e-6))*180/Math.PI,v=t.rot*Math.PI/180,y={x:Math.sin(v),z:Math.cos(v)},b={x:s/Math.max(u,1e-6),z:c/Math.max(u,1e-6)},x=y.x*b.x+y.z*b.z,S=y.x*b.z-y.z*b.x>=0?`right`:`left`,C=S===`right`?`R`:`L`,w,T;return x>.85?(w=`front`,T=`seen from the front, the face toward the camera`):x<-.85?(w=`back`,T=`seen from directly behind, the back of the head toward the camera`):x>.34?(w=`front ¾ ${C}`,T=`a three-quarter front view from the ${S}`):x<-.34?(w=`rear ¾ ${C}`,T=`a three-quarter rear view from the ${S}`):(w=`${S} profile`,T=`a ${S}-side profile view`),{sizeLabel:p,sizeContext:m,levelLabel:h,levelPhrase:g,viewShort:w,viewPhrase:T,focalMm:Yp(n,a,o),exactFocalMm:Kp(n,a,o),sensorId:Vp[a]?.id??`fullFrame`,usedSensorHeightMm:Gp(a,o),distance:d,screenFraction:f,elevationDeg:_}}function em(e){return[e.sizeLabel,e.viewShort,e.levelLabel,`${e.focalMm}mm`].map(e=>e.toUpperCase()).join(` · `)}var tm=[{id:`nano_banana_pro`,label:`Nano Banana Pro`},{id:`nano_banana_2`,label:`Nano Banana 2`},{id:`gpt_image_2`,label:`GPT Image 2`},{id:`seedream_5`,label:`Seedream 5.0`},{id:`flux_2`,label:`Flux 2`,numericLens:!0,flavor:`fine film grain, high micro-detail`}],nm=`Custom…`,rm=[`Static / locked-off`,`Push-in (dolly in)`,`Pull-out (dolly out)`,`Pan left`,`Pan right`,`Tilt up`,`Tilt down`,`Tracking / follow`,`Orbit / arc`,`Crane up`,`Crane down`,`Handheld`,`Crash zoom in`,`Dolly-zoom (vertigo)`,`Whip pan`,`Aerial / drone`,nm];function im({mode:e=`image`,model:t,shot:n,subject:r,subject2:i=null,posePhrase:a=``,pose2Phrase:o=``,environment:s,style:c,cameraMove:l=rm[0],customMove:u=``,hasCharSheet:d=!1,hasEnvSheet:f=!1}){let p=t?.numericLens?`${n.focalMm}mm lens at f/2.2`:`${n.focalMm}mm lens`,m=e===`video`?`Cinematic ${n.sizeLabel} at ${p}, ${n.levelPhrase}, ${n.viewPhrase}.`:`Photorealistic cinematic film still, ${n.sizeLabel} at ${p}, ${n.levelPhrase}, ${n.viewPhrase}.`,h=(e,t)=>t?`${e}, ${t}`:e,g;g=d?i?`Both subjects are the characters from the attached character sheet. Each one exactly matches their own body pose and placement shown in the blocking frame.`:`The subject is the character from the attached character sheet, exactly matching the body pose and placement shown in the blocking frame.`:i?`Two subjects. Subject 1: ${h(r,a)}. Subject 2: ${h(i,o)}. Each subject exactly matches their own body pose and placement shown in the blocking frame.`:`Subject: ${h(r,a)}, exactly matching the body pose and placement shown in the blocking frame.`;let _=f?`The setting is the location from the attached environment sheet.`:`Environment: ${s}.`,v=l===`Custom…`?u.trim()||`static, locked-off shot`:l.toLowerCase();return[m,g,_,`${c}, ${n.sizeContext}.`,e===`video`?`Camera move: ${v}.`:null,`Use the attached blocking frame ONLY as a camera and staging guide — it fixes the exact framing, this camera angle, the lens, and the subject placement. Its floor grid is a measuring aid that encodes distance and scale: read the subject's depth and size from it, but do NOT draw the grid itself. Replace the entire setting with the described environment and render real people; do NOT reproduce its grey mannequins, grey box set, measurement grid, or flat lighting.`,t?.flavor??null,e===`video`&&(t?.audio||t?.capabilities?.audio)?`Include natural ambient sound.`:null,`16:9.`].filter(Boolean).join(` `)}var am=1;function om(e){return Array.isArray(e)?`[${e.map(om).join(`,`)}]`:!e||typeof e!=`object`?JSON.stringify(e):`{${Object.keys(e).filter(e=>e!==`id`).sort().map(t=>`${JSON.stringify(t)}:${om(e[t])}`).join(`,`)}}`}function sm(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}var cm=class extends Error{constructor(e,t){super(`Unknown ${e} ID: ${t}`),this.name=`UnknownStableItemIdError`}};function lm(e){return`${e}-${Date.now().toString(36)}-${am++}`}function um(e){return typeof e==`string`&&e.trim()!==``}function dm(e,t,n=new Set){let r=n,i=new Map;return(Array.isArray(e)?e:[]).map(e=>{let n=e&&typeof e==`object`&&!Array.isArray(e)?e:{},a=um(n.id)?n.id:null;if(a&&!r.has(a))return r.add(a),{...n,id:a};let o=`${t}-${sm(om(n))}`,s=i.get(o)??0;i.set(o,s+1);let c=s===0?o:`${o}-${s+1}`;for(;r.has(c);){let e=i.get(o)??0;i.set(o,e+1),c=`${o}-${e+1}`}return r.add(c),{...n,id:c}})}function fm(e,t,n){let r=Array.isArray(e)?e.find(e=>e.id===t):void 0;if(!r)throw new cm(n,t);return r}function pm(e,t,n,r){return fm(e,t,r),e.map(e=>e.id===t?n(e):e)}function mm(e,t,n){return fm(e,t,n),e.filter(e=>e.id!==t)}var hm=e=>e&&typeof e==`object`?Object.freeze({...e}):e,gm=Object.freeze([{path:`character.position`,type:`vec3`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`,min:{x:-240,y:0,z:-240},max:{x:240,y:240,z:240},gizmo:{min:{x:-4,y:0,z:-4},max:{x:4,y:240,z:4}},note:`y is the feet`},{path:`character.rot`,type:`number`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`,min:-180,max:180,angle:!0,note:`yaw degrees, wrapped at the upper bound`},{path:`character.scale`,type:`number`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`,min:.2,max:3},{path:`character.subject`,type:`string`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`},{path:`character.hidden`,type:`boolean`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`},{path:`character.model`,type:`enum`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`,enum:[`y-bot-tpose`,`x-bot-tpose`]},{path:`character.tint`,type:`color`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`},{path:`character.identityImage`,type:`image`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`,note:`data:image only`},{path:`character.pose`,type:`id`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`},{path:`character.waypoints`,type:`array`,persisted:!0,undoDomain:`cast`,agentExposure:`todo`,normalizer:`createCharacterEntry`,note:`agent exposure gap`},{path:`character.promptBlocks`,type:`array`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`,note:`stored at layer.promptClips`},{path:`character.motionRef.url`,type:`string`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`},{path:`character.motionRef.motionId`,type:`id`,persisted:!0,undoDomain:`cast`,agentExposure:`patch`,normalizer:`createCharacterEntry`},{path:`character.sessionMotion`,type:`array`,persisted:!1,undoDomain:`cast`,agentExposure:`readonly`,normalizer:`createCharacterEntry`,note:`dropped by createCharacterEntry`},{path:`character.ikKeys`,type:`array`,persisted:!1,undoDomain:`cast`,agentExposure:`todo`,normalizer:`createCharacterEntry`,note:`dropped by createCharacterEntry`},{path:`object.renderer`,type:`enum`,persisted:!0,undoDomain:`objects`,agentExposure:`patch`,normalizer:`normalizeSceneObject`,enum:[`cube`,`sphere`,`capsule`,`cylinder`,`cone`,`plane`,`chair`,`car`,`small-plane`]},{path:`object.position`,type:`vec3`,persisted:!0,undoDomain:`objects`,agentExposure:`patch`,normalizer:`normalizeSceneObject`,min:{x:-240,y:0,z:-240},max:{x:240,y:240,z:240},note:`y is the object's base: y=0 rests on the floor; height/supportY rise from it`},{path:`object.rotation`,type:`vec3`,persisted:!0,undoDomain:`objects`,agentExposure:`patch`,normalizer:`normalizeSceneObject`,min:{x:-180,y:-180,z:-180},max:{x:180,y:180,z:180},note:`rot/rotX/rotZ degrees, wrapped at the upper bound`},{path:`object.scale`,type:`vec3`,persisted:!0,undoDomain:`objects`,agentExposure:`patch`,normalizer:`normalizeSceneObject`,min:{x:.1,y:.1,z:.1},max:{x:100,y:100,z:100}},{path:`object.name`,type:`string`,persisted:!0,undoDomain:`objects`,agentExposure:`patch`,normalizer:`normalizeSceneObject`},{path:`object.color`,type:`color`,persisted:!0,undoDomain:`objects`,agentExposure:`patch`,normalizer:`normalizeSceneObject`},{path:`object.parent`,type:`id`,persisted:!0,undoDomain:`objects`,agentExposure:`patch`,normalizer:`normalizeSceneObject`},{path:`object.attach`,type:`id`,persisted:!0,undoDomain:`objects`,agentExposure:`todo`,normalizer:`normalizeSceneObject`,note:`agent exposure gap`},{path:`object.path`,type:`array`,persisted:!0,undoDomain:`objects`,agentExposure:`patch`,normalizer:`normalizeSceneObject`},{path:`object.remove`,type:`boolean`,persisted:!0,undoDomain:`objects`,agentExposure:`patch`,normalizer:null,note:`lifecycle operation, not a document field`},{path:`object.cutout`,type:`image`,persisted:!0,undoDomain:`objects`,agentExposure:`composite`,normalizer:`normalizeSceneObject`,note:`assetId-backed cutout record`},{path:`stage.keyLight.x`,type:`number`,persisted:!0,undoDomain:`stage`,agentExposure:`patch`,normalizer:`createSceneStage`,min:-30,max:30},{path:`stage.keyLight.y`,type:`number`,persisted:!0,undoDomain:`stage`,agentExposure:`patch`,normalizer:`createSceneStage`,min:.5,max:30},{path:`stage.keyLight.z`,type:`number`,persisted:!0,undoDomain:`stage`,agentExposure:`patch`,normalizer:`createSceneStage`,min:-30,max:30},{path:`stage.keyLight.intensity`,type:`number`,persisted:!0,undoDomain:`stage`,agentExposure:`patch`,normalizer:`createSceneStage`,min:0,max:4},{path:`stage.keyLight.warmth`,type:`number`,persisted:!0,undoDomain:`stage`,agentExposure:`patch`,normalizer:`createSceneStage`,min:0,max:1},{path:`stage.environmentImage`,type:`image`,persisted:!0,undoDomain:`stage`,agentExposure:`patch`,normalizer:`createSceneStage`,note:`data:image only`},{path:`stage.environment`,type:`string`,persisted:!0,undoDomain:`stage`,agentExposure:`patch`,normalizer:`createSceneStage`,note:`location description every shot prompt is built from`},{path:`stage.style`,type:`string`,persisted:!0,undoDomain:`stage`,agentExposure:`patch`,normalizer:`createSceneStage`,note:`look / style line for shot prompts`},{path:`stage.hasEnvSheet`,type:`boolean`,persisted:!0,undoDomain:`stage`,agentExposure:`patch`,normalizer:`createSceneStage`,note:`author supplies an environment sheet instead of a description`},{path:`stage.camera`,type:`enum`,persisted:!0,undoDomain:`stage`,agentExposure:`patch`,normalizer:`createSceneStage`,enum:[`16:9`,`2.39:1`,`9:16`,`1:1`,`4:3`,`12:7`,`fal 480P`],note:`shotAspect/cameraPresetId/sensorId`},{path:`shot.crud`,type:`array`,persisted:!0,undoDomain:`shot`,agentExposure:`todo`,normalizer:null,note:`create/split/duplicate/reorder/remove/range; agent exposure gap`},{path:`shot.cameraKeys`,type:`array`,persisted:!0,undoDomain:`shot`,agentExposure:`patch`,normalizer:null,frameMin:0},{path:`shot.cameraRail`,type:`array`,persisted:!0,undoDomain:`shot`,agentExposure:`todo`,normalizer:`repairCamera`,note:`rail/crane/dolly timing; agent exposure gap`},{path:`shot.targetModel`,type:`id`,persisted:!0,undoDomain:`shot`,agentExposure:`patch`,normalizer:`repairCamera`},{path:`shot.freeCamera`,type:`vec3`,persisted:!1,undoDomain:`shot`,agentExposure:`readonly`,normalizer:null,note:`transient until keyed`},{path:`scenes`,type:`array`,persisted:!0,undoDomain:null,agentExposure:`composite`,normalizer:null},{path:`project`,type:`string`,persisted:!0,undoDomain:null,agentExposure:`composite`,normalizer:null,note:`save/open project file`},{path:`selection`,type:`id`,persisted:!1,undoDomain:null,agentExposure:`readonly`,normalizer:null},{path:`timeline`,type:`number`,persisted:!1,undoDomain:null,agentExposure:`readonly`,normalizer:null},{path:`view.mode`,type:`enum`,persisted:!1,undoDomain:null,agentExposure:`readonly`,normalizer:null,enum:[`scene`,`camera`,`motion`]},{path:`view.partColoursGuideModeInset`,type:`array`,persisted:!1,undoDomain:null,agentExposure:`todo`,normalizer:null,note:`partColours/guideMode/inset; not a document field`},{path:`read.sceneDescription`,type:`string`,persisted:!1,undoDomain:null,agentExposure:`readonly`,normalizer:null},{path:`read.captureFrame`,type:`image`,persisted:!1,undoDomain:null,agentExposure:`readonly`,normalizer:null},{path:`undo`,type:`boolean`,persisted:!1,undoDomain:null,agentExposure:`readonly`,normalizer:null}].map(e=>Object.freeze({...e,...e.enum?{enum:Object.freeze([...e.enum])}:{},...e.min&&typeof e.min==`object`?{min:hm(e.min)}:{},...e.max&&typeof e.max==`object`?{max:hm(e.max)}:{},...e.gizmo?{gizmo:Object.freeze({min:hm(e.gizmo.min),max:hm(e.gizmo.max)})}:{}})));function _m(e){return gm.find(t=>t.path===e)}var vm=240,ym=(e,t,n)=>Math.min(n,Math.max(t,e)),bm=(e,t=0)=>typeof e==`number`&&Number.isFinite(e)?e:t;function xm(e){let t=e&&typeof e==`object`?e:{};return{x:ym(bm(t.x),-240,vm),y:ym(bm(t.y),0,60),z:ym(bm(t.z),-240,vm)}}function Sm(e){if(!e||typeof e!=`object`)return null;let t=Array.isArray(e.points)?e.points:[],r=[];for(let e of t){let t=xm(e),n=r[r.length-1];if(!(n&&Math.hypot(t.x-n.x,t.z-n.z,t.y-n.y)<1e-4)&&(r.push(t),r.length>=64))break}if(r.length<2)return null;let i=bm(e.speed,0),a=n(e.timing);return{points:r,timing:s(a)?null:a,speed:i>0?ym(i,.01,50):0,faceTravel:e.faceTravel!==!1,loop:e.loop===!0,extend:e.extend===!0}}function Cm(e,t){let n=Sm(e);if(!n)return null;let r=bm(t?.x),i=bm(t?.y),a=bm(t?.z);return!r&&!i&&!a?n:Sm({...n,points:n.points.map(e=>({x:e.x+r,y:e.y+i,z:e.z+a}))})}function wm(e){let t=e?.points??[],n=[0];for(let e=1;e<t.length;e+=1){let r=t[e-1],i=t[e];n.push(n[e-1]+Math.hypot(i.x-r.x,i.y-r.y,i.z-r.z))}return{cumulative:n,length:n[n.length-1]??0}}function Tm(e,t,n){let{points:r}=e,{cumulative:i,length:a}=t;if(n<=0){let e=Em(r[0],r[1]);return{...r[0],heading:e}}if(n>=a){let t=r[r.length-1],i=Em(r[r.length-2],t);if(!e.extend)return{...t,heading:i};let o=n-a,s=r[r.length-2],c=Math.hypot(t.x-s.x,t.y-s.y,t.z-s.z)||1;return{x:t.x+(t.x-s.x)/c*o,y:Math.max(0,t.y+(t.y-s.y)/c*o),z:t.z+(t.z-s.z)/c*o,heading:i}}let o=1;for(;o<i.length-1&&i[o]<n;)o+=1;let s=r[o-1],c=r[o],l=i[o]-i[o-1],u=l>1e-9?(n-i[o-1])/l:0;return{x:s.x+(c.x-s.x)*u,y:s.y+(c.y-s.y)*u,z:s.z+(c.z-s.z)*u,heading:Em(s,c)}}function Em(e,t){if(!e||!t)return null;let n=t.x-e.x,r=t.z-e.z;return Math.abs(n)<1e-9&&Math.abs(r)<1e-9?null:Math.atan2(n,r)*180/Math.PI}function Dm(e,t,n={}){let i=Sm(e?.path);if(!i)return null;let a=wm(i);if(a.length<=1e-9)return null;let o=Math.max(1,Math.round(bm(n.frameCount,1))),s=Math.max(1,bm(n.fps,24)),c=ym(bm(t),0,Math.max(0,o-1))/s,l=Math.max(1e-6,(o-1)/s),u=i.speed>0?i.speed:a.length/l,d=a.length/u,f=c/Math.max(1e-6,d),p;p=i.loop&&a.length>1e-9?a.length*r(i.timing,f-Math.floor(f)):f>=1?a.length+(i.extend?u*(c-d):0):a.length*r(i.timing,f);let m=Tm(i,a,p);return{x:m.x,y:m.y,z:m.z,rot:i.faceTravel&&m.heading!==null?m.heading:null}}function Om(e,t,{maxPoints:n=5,epsilon:r=.55}={}){if(!e||e.length<2)return[];let i=t(e,r);for(let a=0;a<12&&i.length>n;a+=1)r*=1.8,i=t(e,r);if(i.length>n){let e=[i[0]];for(let t=1;t<n-1;t+=1)e.push(i[Math.round(t*(i.length-1)/(n-1))]);e.push(i[i.length-1]),i=e}return i.map(e=>({x:e.x,y:0,z:e.z}))}var km=`img-`,Am=`mesh-`,jm=32,Mm=`cozyclay.assets`,Nm=`images`,Pm=Object.freeze([`image/png`,`image/webp`,`image/jpeg`,`image/gif`]),Fm=Object.freeze([`model/gltf-binary`,`model/obj`,`model/fbx`]),Im=33554432,Lm=2048;function Rm(e){return typeof e==`string`&&Pm.includes(e.toLowerCase())}function zm(e){return typeof e==`string`&&Fm.includes(e.toLowerCase())}function Bm(e,t){if(typeof t!=`string`)return null;let n=t.trim().toLowerCase();return!/^[0-9a-f]+$/.test(n)||n.length<jm?null:`${e}${n.slice(0,jm)}`}function Vm(e,t){return typeof t==`string`&&RegExp(`^${e}[0-9a-f]{${jm}}$`).test(t)}function Hm(e){return Bm(km,e)}function Um(e){return Bm(Am,e)}function Wm(e){return Vm(km,e)}function Gm(e){return Vm(Am,e)}function Km(e){return Wm(e)||Gm(e)}async function qm(e,t){if(!t?.digest)throw Error(`SubtleCrypto is unavailable — a secure context is required to import images`);let n=e instanceof ArrayBuffer?e:e?.buffer?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null;if(!n)return null;let r=await t.digest(`SHA-256`,n);return Array.from(new Uint8Array(r),e=>e.toString(16).padStart(2,`0`)).join(``)}async function Jm(e,t=globalThis.crypto?.subtle){let n=await qm(e,t);if(!n)throw TypeError(`assetIdForBytes needs an ArrayBuffer or a typed array`);return Hm(n)}async function Ym(e,t=globalThis.crypto?.subtle){let n=await qm(e,t);if(!n)throw TypeError(`meshIdForBytes needs an ArrayBuffer or a typed array`);return Um(n)}function Xm(e,t,n=Lm){let r=Math.max(0,Math.round(Number(e)||0)),i=Math.max(0,Math.round(Number(t)||0));if(!r||!i)return null;let a=Math.max(r,i);if(a<=n)return{width:r,height:i,scaled:!1};let o=n/a;return{width:Math.max(1,Math.round(r*o)),height:Math.max(1,Math.round(i*o)),scaled:!0}}function Zm(e){let t=Number(e?.width),n=Number(e?.height);return!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0?null:t/n}function Qm(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.bytes instanceof ArrayBuffer?e.bytes:null;if(!t||!t.byteLength)return null;if(Gm(e.id))return zm(e.type)?{id:e.id,type:e.type.toLowerCase(),bytes:t,name:typeof e.name==`string`?e.name:``,...typeof e.role==`string`?{role:e.role}:{}}:null;if(!Wm(e.id)||!Rm(e.type))return null;let n=Math.round(Number(e.width)),r=Math.round(Number(e.height));return!Number.isInteger(n)||!Number.isInteger(r)||n<=0||r<=0?null:{id:e.id,type:e.type.toLowerCase(),width:n,height:r,bytes:t,name:typeof e.name==`string`?e.name:``,...typeof e.role==`string`?{role:e.role}:{}}}function $m(e){return Array.from(e?.files??[]).filter(e=>{if(!e)return!1;if(Rm(e.type))return!0;if(e.type)return!1;let t=String(e.name??``).toLowerCase().match(/\.([a-z0-9]+)$/)?.[1];return[`png`,`webp`,`jpg`,`jpeg`,`gif`].includes(t)})}function eh(e){let t=[],n=Array.from(e?.items??[]);for(let e of n){if(e.kind!==`file`||!Rm(e.type))continue;let n=e.getAsFile?.();n&&t.push(n.name&&n.name!==`image.png`?n:new File([n],`pasted-${Date.now()}.${e.type.split(`/`)[1]||`png`}`,{type:e.type}))}return t.length?t:$m(e)}function th(e){return e===`image/jpeg`?`image/jpeg`:`image/png`}function nh(e,t){if(typeof OffscreenCanvas==`function`)return new OffscreenCanvas(e,t);throw Error(`this browser cannot resize images — OffscreenCanvas is unavailable`)}async function rh(e,{subtle:t=globalThis.crypto?.subtle,createBitmap:n=globalThis.createImageBitmap,makeCanvas:r=nh,maxDimension:i=Lm,maxSourceBytes:a=Im}={}){if(!e||typeof e.arrayBuffer!=`function`)throw TypeError(`importImageFile needs a File or Blob`);let o=typeof e.type==`string`?e.type.toLowerCase():``;if(!Rm(o))throw Error(`that file is not an image CozyClay can import (PNG, WebP, JPEG or GIF)`);if(Number(e.size)>a)throw Error(`that image is larger than ${Math.round(a/1048576)} MB`);if(typeof n!=`function`)throw Error(`this browser cannot decode images — createImageBitmap is unavailable`);let s=await n(e);try{let n=Xm(s.width,s.height,i);if(!n)throw Error(`that image has no usable size`);let a=o,c;if(n.scaled){let e=r(n.width,n.height),t=e.getContext(`2d`);if(!t)throw Error(`this browser cannot resize images — no 2D context`);t.drawImage(s,0,0,n.width,n.height),a=th(o),c=await(await e.convertToBlob({type:a})).arrayBuffer()}else c=await e.arrayBuffer();let l=Qm({id:await Jm(c,t),type:a,width:n.width,height:n.height,bytes:c,name:typeof e.name==`string`?e.name:``});if(!l)throw Error(`that image could not be prepared for the set`);return l}finally{s?.close?.()}}function ih(e){return new Set(ah(e).keys())}function ah(e){let t=new Map;for(let n of Array.isArray(e)?e:[])for(let e of Array.isArray(n?.objects)?n.objects:[]){let n=new Set;for(let t of[e?.assetId,e?.sourceAssetId,e?.matteAssetId])Km(t)&&n.add(t);for(let e of n)t.set(e,(t.get(e)??0)+1)}return t}function oh(e){return JSON.stringify((Array.isArray(e)?e:[]).map(e=>[typeof e?.id==`string`?e.id:null,(Array.isArray(e?.objects)?e.objects:[]).map(e=>[typeof e?.id==`string`?e.id:null,...[e?.assetId,e?.sourceAssetId,e?.matteAssetId].map(e=>Km(e)?e:null)])]))}async function sh({expectedGraphSignature:e,deleteRecord:t,restoreRecord:n,readGraphSignature:r}){return await t(),r()===e||(await n(),!1)}function ch(e,t){let n=ih(t);return(Array.isArray(e)?e:[]).filter(e=>Km(e)&&!n.has(e))}var lh=e=>new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)});function uh(e=globalThis.indexedDB){return e?new Promise((t,n)=>{let r=e.open(Mm,1);r.onupgradeneeded=()=>{r.result.objectStoreNames.contains(`images`)||r.result.createObjectStore(Nm,{keyPath:`id`})},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error),r.onblocked=()=>n(Error(`the asset database is blocked by another tab`))}):Promise.reject(Error(`IndexedDB is unavailable`))}async function dh(e,t){let n=Qm(t);if(!n)throw TypeError(`putAsset needs a normalizable asset record`);let r=e.transaction(Nm,`readwrite`);return r.objectStore(Nm).put(n),await new Promise((e,t)=>{r.oncomplete=e,r.onerror=()=>t(r.error),r.onabort=()=>t(r.error)}),n}async function fh(e,t){return Km(t)?Qm(await lh(e.transaction(Nm,`readonly`).objectStore(Nm).get(t))):null}async function ph(e){return(await lh(e.transaction(Nm,`readonly`).objectStore(`images`).getAllKeys())??[]).filter(Km)}async function mh(e,t){if(!Km(t))return!1;let n=e.transaction(Nm,`readwrite`);return n.objectStore(Nm).delete(t),await new Promise((e,t)=>{n.oncomplete=e,n.onerror=()=>t(n.error),n.onabort=()=>t(n.error)}),!0}var hh=Uint8Array,gh=Uint16Array,_h=Int32Array,vh=new hh([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),yh=new hh([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),bh=new hh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xh=function(e,t){for(var n=new gh(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new _h(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Sh=xh(vh,2),Ch=Sh.b,wh=Sh.r;Ch[28]=258,wh[258]=28;var Th=xh(yh,0),Eh=Th.b;Th.r;for(var Dh=new gh(32768),Oh=0;Oh<32768;++Oh){var kh=(Oh&43690)>>1|(Oh&21845)<<1;kh=(kh&52428)>>2|(kh&13107)<<2,kh=(kh&61680)>>4|(kh&3855)<<4,Dh[Oh]=((kh&65280)>>8|(kh&255)<<8)>>1}for(var Ah=(function(e,t,n){for(var r=e.length,i=0,a=new gh(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new gh(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new gh(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[Dh[d]>>c]=l}else for(s=new gh(r),i=0;i<r;++i)e[i]&&(s[i]=Dh[o[e[i]-1]++]>>15-e[i]);return s}),jh=new hh(288),Oh=0;Oh<144;++Oh)jh[Oh]=8;for(var Oh=144;Oh<256;++Oh)jh[Oh]=9;for(var Oh=256;Oh<280;++Oh)jh[Oh]=7;for(var Oh=280;Oh<288;++Oh)jh[Oh]=8;for(var Mh=new hh(32),Oh=0;Oh<32;++Oh)Mh[Oh]=5;var Nh=Ah(jh,9,1),Ph=Ah(Mh,5,1),Fh=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ih=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Lh=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Rh=function(e){return(e+7)/8|0},zh=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new hh(e.subarray(t,n))},Bh=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],Vh=function(e,t,n){var r=Error(t||Bh[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Vh),!n)throw r;return r},Hh=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new hh(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new hh(i*3));var l=function(e){var t=n.length;if(e>t){var r=new hh(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=Ih(e,d,1);var v=Ih(e,d+1,3);if(d+=3,!v){var y=Rh(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&Vh(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}if(v==1)p=Nh,m=Ph,h=9,g=5;else if(v==2){var S=Ih(e,d,31)+257,C=Ih(e,d+10,15)+4,w=S+Ih(e,d+5,31)+1;d+=14;for(var T=new hh(w),E=new hh(19),D=0;D<C;++D)E[bh[D]]=Ih(e,d+D*3,7);d+=C*3;for(var O=Fh(E),ee=(1<<O)-1,k=Ah(E,O,1),D=0;D<w;){var te=k[Ih(e,d,ee)];d+=te&15;var y=te>>4;if(y<16)T[D++]=y;else{var ne=0,re=0;for(y==16?(re=3+Ih(e,d,3),d+=2,ne=T[D-1]):y==17?(re=3+Ih(e,d,7),d+=3):y==18&&(re=11+Ih(e,d,127),d+=7);re--;)T[D++]=ne}}var ie=T.subarray(0,S),ae=T.subarray(S);h=Fh(ie),g=Fh(ae),p=Ah(ie,h,1),m=Ah(ae,g,1)}else Vh(1);if(d>_){c&&Vh(0);break}}s&&l(f+131072);for(var A=(1<<h)-1,j=(1<<g)-1,oe=d;;oe=d){var ne=p[Lh(e,d)&A],se=ne>>4;if(d+=ne&15,d>_){c&&Vh(0);break}if(ne||Vh(2),se<256)n[f++]=se;else if(se==256){oe=d,p=null;break}else{var ce=se-254;if(se>264){var D=se-257,le=vh[D];ce=Ih(e,d,(1<<le)-1)+Ch[D],d+=le}var ue=m[Lh(e,d)&j],de=ue>>4;ue||Vh(3),d+=ue&15;var ae=Eh[de];if(de>3){var le=yh[de];ae+=Lh(e,d)&(1<<le)-1,d+=le}if(d>_){c&&Vh(0);break}s&&l(f+131072);var fe=f+ce;if(f<ae){var pe=a-ae,me=Math.min(ae,fe);for(pe+f<0&&Vh(3);f<me;++f)n[f]=r[pe+f]}for(;f<fe;++f)n[f]=n[f-ae]}}t.l=p,t.p=oe,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?zh(n,0,f):n.subarray(0,f)},Uh=new hh(0),Wh=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&Vh(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&Vh(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Gh(e,t){return Hh(e.subarray(Wh(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var Kh=typeof TextDecoder<`u`&&new TextDecoder;try{Kh.decode(Uh,{stream:!0})}catch{}function qh(e,t,n){let r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;let i=e,a=r,o=Math.floor((i+a)/2);for(;t<n[o]||t>=n[o+1];)t<n[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function Jh(e,t,n,r){let i=[],a=[],o=[];i[0]=1;for(let s=1;s<=n;++s){a[s]=t-r[e+1-s],o[s]=r[e+s]-t;let n=0;for(let e=0;e<s;++e){let t=o[e+1],r=a[s-e],c=i[e]/(t+r);i[e]=n+t*c,n=r*c}i[s]=n}return i}function Yh(e,t,n,r){let i=qh(e,r,t),a=Jh(i,r,e,t),o=new cr(0,0,0,0);for(let t=0;t<=e;++t){let r=n[i-e+t],s=a[t],c=r.w*s;o.x+=r.x*c,o.y+=r.y*c,o.z+=r.z*c,o.w+=r.w*s}return o}function Xh(e,t,n,r,i){let a=[];for(let e=0;e<=n;++e)a[e]=0;let o=[];for(let e=0;e<=r;++e)o[e]=a.slice(0);let s=[];for(let e=0;e<=n;++e)s[e]=a.slice(0);s[0][0]=1;let c=a.slice(0),l=a.slice(0);for(let r=1;r<=n;++r){c[r]=t-i[e+1-r],l[r]=i[e+r]-t;let n=0;for(let e=0;e<r;++e){let t=l[e+1],i=c[r-e];s[r][e]=t+i;let a=s[e][r-1]/s[r][e];s[e][r]=n+t*a,n=i*a}s[r][r]=n}for(let e=0;e<=n;++e)o[0][e]=s[e][n];for(let e=0;e<=n;++e){let t=0,i=1,c=[];for(let e=0;e<=n;++e)c[e]=a.slice(0);c[0][0]=1;for(let a=1;a<=r;++a){let r=0,l=e-a,u=n-a;e>=a&&(c[i][0]=c[t][0]/s[u+1][l],r=c[i][0]*s[l][u]);let d=l>=-1?1:-l,f=e-1<=u?a-1:n-e;for(let e=d;e<=f;++e)c[i][e]=(c[t][e]-c[t][e-1])/s[u+1][l+e],r+=c[i][e]*s[l+e][u];e<=u&&(c[i][a]=-c[t][a-1]/s[u+1][e],r+=c[i][a]*s[e][u]),o[a][e]=r;let p=t;t=i,i=p}}let u=n;for(let e=1;e<=r;++e){for(let t=0;t<=n;++t)o[e][t]*=u;u*=n-e}return o}function Zh(e,t,n,r,i){let a=i<e?i:e,o=[],s=qh(e,r,t),c=Xh(s,r,e,a,t),l=[];for(let e=0;e<n.length;++e){let t=n[e].clone(),r=t.w;t.x*=r,t.y*=r,t.z*=r,l[e]=t}for(let t=0;t<=a;++t){let n=l[s-e].clone().multiplyScalar(c[t][0]);for(let r=1;r<=e;++r)n.add(l[s-e+r].clone().multiplyScalar(c[t][r]));o[t]=n}for(let e=a+1;e<=i+1;++e)o[e]=new cr(0,0,0);return o}function Qh(e,t){let n=1;for(let t=2;t<=e;++t)n*=t;let r=1;for(let e=2;e<=t;++e)r*=e;for(let n=2;n<=e-t;++n)r*=n;return n/r}function $h(e){let t=e.length,n=[],r=[];for(let i=0;i<t;++i){let t=e[i];n[i]=new I(t.x,t.y,t.z),r[i]=t.w}let i=[];for(let e=0;e<t;++e){let t=n[e].clone();for(let n=1;n<=e;++n)t.sub(i[e-n].clone().multiplyScalar(Qh(e,n)*r[n]));i[e]=t.divideScalar(r[0])}return i}function eg(e,t,n,r,i){return $h(Zh(e,t,n,r,i))}var tg=class extends zs{constructor(e,t,n,r,i){super();let a=t?t.length-1:0,o=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||a;for(let e=0;e<o;++e){let t=n[e];this.controlPoints[e]=new cr(t.x,t.y,t.z,t.w)}}getPoint(e,t=new I){let n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=Yh(this.degree,this.knots,this.controlPoints,r);return i.w!==1&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}getTangent(e,t=new I){let n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=eg(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n}toJSON(){let e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(e=>e.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(e=>new cr(e[0],e[1],e[2],e[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}},q,ng,rg,ig=class extends lu{constructor(e){super(e)}load(e,t,n,r){let i=this,a=i.path===``?qu.extractUrlBase(e):i.path,o=new fu(this.manager);o.setPath(i.path),o.setResponseType(`arraybuffer`),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e,t){if(fg(e))q=new lg().parse(e);else{let t=Cg(e);if(!pg(t))throw Error(`THREE.FBXLoader: Unknown format.`);if(mg(t)<7e3)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+mg(t));q=new cg().parse(t)}return new ag(new yu(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),this.manager).parse(q)}},ag=class{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){ng=this.parseConnections();let e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),r=this.parseDeformers(),i=new og().parse(r);return this.parseScene(r,i,n),rg}parseConnections(){let e=new Map;return`Connections`in q&&q.Connections.connections.forEach(function(t){let n=t[0],r=t[1],i=t[2];e.has(n)||e.set(n,{parents:[],children:[]});let a={ID:r,relationship:i};e.get(n).parents.push(a),e.has(r)||e.set(r,{parents:[],children:[]});let o={ID:n,relationship:i};e.get(r).children.push(o)}),e}parseImages(){let e={},t={};if(`Video`in q.Objects){let n=q.Objects.Video;for(let r in n){let i=n[r],a=parseInt(r);if(e[a]=i.RelativeFilename||i.Filename,`Content`in i){let e=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,a=typeof i.Content==`string`&&i.Content!==``;if(e||a){let e=this.parseImage(n[r]);t[i.RelativeFilename||i.Filename]=e}}}}for(let n in e){let r=e[n];e[n]=t[r]===void 0?e[n].split(`\\`).pop():t[r]}return e}parseImage(e){let t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(`.`)+1).toLowerCase(),i;switch(r){case`bmp`:i=`image/bmp`;break;case`jpg`:case`jpeg`:i=`image/jpeg`;break;case`png`:i=`image/png`;break;case`tif`:i=`image/tiff`;break;case`tga`:this.manager.getHandler(`.tga`)===null&&console.warn(`FBXLoader: TGA loader not found, skipping `,n),i=`image/tga`;break;case`webp`:i=`image/webp`;break;default:console.warn(`FBXLoader: Image type "`+r+`" is not supported.`);return}if(typeof t==`string`)return`data:`+i+`;base64,`+t;{let e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:i}))}}parseTextures(e){let t=new Map;if(`Texture`in q.Objects){let n=q.Objects.Texture;for(let r in n){let i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}parseTexture(e,t){let n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;let r=e.WrapModeU,i=e.WrapModeV,a=r===void 0?0:r.value,o=i===void 0?0:i.value;if(n.wrapS=a===0?w:T,n.wrapT=o===0?w:T,`Scaling`in e){let t=e.Scaling.value;n.repeat.x=t[0],n.repeat.y=t[1]}if(`Translation`in e){let t=e.Translation.value;n.offset.x=t[0],n.offset.y=t[1]}return n}loadTexture(e,t){let n=e.FileName.split(`.`).pop().toLowerCase(),r=this.manager.getHandler(`.${n}`);r===null&&(r=this.textureLoader);let i=r.path;i||r.setPath(this.textureLoader.path);let a=ng.get(e.id).children,o;if(a!==void 0&&a.length>0&&t[a[0].ID]!==void 0&&(o=t[a[0].ID],(o.indexOf(`blob:`)===0||o.indexOf(`data:`)===0)&&r.setPath(void 0)),o===void 0)return console.warn(`FBXLoader: Undefined filename, creating placeholder texture.`),new sr;let s=r.load(o);return r.setPath(i),s}parseMaterials(e){let t=new Map;if(`Material`in q.Objects){let n=q.Objects.Material;for(let r in n){let i=this.parseMaterial(n[r],e);i!==null&&t.set(parseInt(r),i)}}return t}parseMaterial(e,t){let n=e.id,r=e.attrName,i=e.ShadingModel;if(typeof i==`object`&&(i=i.value),!ng.has(n))return null;let a=this.parseParameters(e,t,n),o;switch(i.toLowerCase()){case`phong`:o=new Al;break;case`lambert`:o=new Nl;break;default:console.warn(`THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.`,i),o=new Al}return o.setValues(a),o.name=r,o}parseParameters(e,t,n){let r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=Zn.colorSpaceToWorking(new R().fromArray(e.Diffuse.value),Dt):e.DiffuseColor&&(e.DiffuseColor.type===`Color`||e.DiffuseColor.type===`ColorRGB`)&&(r.color=Zn.colorSpaceToWorking(new R().fromArray(e.DiffuseColor.value),Dt)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=Zn.colorSpaceToWorking(new R().fromArray(e.Emissive.value),Dt):e.EmissiveColor&&(e.EmissiveColor.type===`Color`||e.EmissiveColor.type===`ColorRGB`)&&(r.emissive=Zn.colorSpaceToWorking(new R().fromArray(e.EmissiveColor.value),Dt)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),r.opacity=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0),(r.opacity===1||r.opacity===0)&&(r.opacity=e.Opacity?parseFloat(e.Opacity.value):null,r.opacity===null&&(r.opacity=1)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=Zn.colorSpaceToWorking(new R().fromArray(e.Specular.value),Dt):e.SpecularColor&&e.SpecularColor.type===`Color`&&(r.specular=Zn.colorSpaceToWorking(new R().fromArray(e.SpecularColor.value),Dt));let i=this;return ng.get(n).children.forEach(function(e){let n=e.relationship;switch(n){case`Bump`:r.bumpMap=i.getTexture(t,e.ID);break;case`Maya|TEX_ao_map`:r.aoMap=i.getTexture(t,e.ID);break;case`DiffuseColor`:case`Maya|TEX_color_map`:r.map=i.getTexture(t,e.ID),r.map!==void 0&&(r.map.colorSpace=Dt);break;case`DisplacementColor`:r.displacementMap=i.getTexture(t,e.ID);break;case`EmissiveColor`:r.emissiveMap=i.getTexture(t,e.ID),r.emissiveMap!==void 0&&(r.emissiveMap.colorSpace=Dt);break;case`NormalMap`:case`Maya|TEX_normal_map`:r.normalMap=i.getTexture(t,e.ID);break;case`ReflectionColor`:r.envMap=i.getTexture(t,e.ID),r.envMap!==void 0&&(r.envMap.mapping=303,r.envMap.colorSpace=Dt);break;case`SpecularColor`:r.specularMap=i.getTexture(t,e.ID),r.specularMap!==void 0&&(r.specularMap.colorSpace=Dt);break;case`TransparentColor`:case`TransparencyFactor`:r.alphaMap=i.getTexture(t,e.ID),r.transparent=!0;break;default:console.warn(`THREE.FBXLoader: %s map is not supported in three.js, skipping texture.`,n)}}),r}getTexture(e,t){return`LayeredTexture`in q.Objects&&t in q.Objects.LayeredTexture&&(console.warn(`THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.`),t=ng.get(t).children[0].ID),e.get(t)}parseDeformers(){let e={},t={};if(`Deformer`in q.Objects){let n=q.Objects.Deformer;for(let r in n){let i=n[r],a=ng.get(parseInt(r));if(i.attrType===`Skin`){let t=this.parseSkeleton(a,n);t.ID=r,a.parents.length>1&&console.warn(`THREE.FBXLoader: skeleton attached to more than one geometry is not supported.`),t.geometryID=a.parents[0].ID,e[r]=t}else if(i.attrType===`BlendShape`){let e={id:r};e.rawTargets=this.parseMorphTargets(a,n),e.id=r,a.parents.length>1&&console.warn(`THREE.FBXLoader: morph target attached to more than one geometry is not supported.`),t[r]=e}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){let n=[];return e.children.forEach(function(e){let r=t[e.ID];if(r.attrType!==`Cluster`)return;let i={ID:e.ID,indices:[],weights:[],transformLink:new L().fromArray(r.TransformLink.a)};`Indexes`in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){let n=[];for(let r=0;r<e.children.length;r++){let i=e.children[r],a=t[i.ID],o={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if(a.attrType!==`BlendShapeChannel`)return;o.geoID=ng.get(parseInt(i.ID)).children.filter(function(e){return e.relationship===void 0})[0].ID,n.push(o)}return n}parseScene(e,t,n){rg=new Hr;let r=this.parseModels(e.skeletons,t,n),i=q.Objects.Model,a=this;r.forEach(function(e){let t=i[e.ID];a.setLookAtProperties(e,t),ng.get(e.ID).parents.forEach(function(t){let n=r.get(t.ID);n!==void 0&&n.add(e)}),e.parent===null&&rg.add(e)}),this.addGlobalSceneSettings(),rg.traverse(function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);let t=bg(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}});let o=this.parsePoseNodes(),s=new Set;for(let t in e.skeletons)e.skeletons[t].rawBones.forEach(function(n,r){let i=e.skeletons[t].bones[r];i&&s.add(i.ID)});let c=new L;rg.traverse(function(e){if(e.isBone&&e.ID!==void 0&&!s.has(e.ID)){let t=o[e.ID];t!==void 0&&(e.parent?(c.copy(e.parent.matrixWorld).invert(),c.multiply(t)):c.copy(t),c.decompose(e.position,e.quaternion,e.scale),e.updateMatrix(),e.matrixWorld.copy(t))}}),this.bindSkeleton(e.skeletons,t,r);let l=new sg().parse();rg.children.length===1&&rg.children[0].isGroup&&(rg.children[0].animations=l,rg=rg.children[0]),rg.animations=l,`GlobalSettings`in q&&`UpAxis`in q.GlobalSettings&&q.GlobalSettings.UpAxis.value===2&&(console.warn(`THREE.FBXLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted.`),rg.rotation.set(-Math.PI/2,0,0))}parseModels(e,t,n){let r=new Map,i=q.Objects.Model;for(let a in i){let o=parseInt(a),s=i[a],c=ng.get(o),l=this.buildSkeleton(c,e,o,s.attrName);if(!l){switch(s.attrType){case`Camera`:l=this.createCamera(c);break;case`Light`:l=this.createLight(c);break;case`Mesh`:l=this.createMesh(c,t,n);break;case`NurbsCurve`:l=this.createCurve(c,t);break;case`LimbNode`:case`Root`:l=new ao;break;default:l=new Hr}l.name=s.attrName?Bd.sanitizeNodeName(s.attrName):``,l.userData.originalName=s.attrName,l.ID=o}this.getTransformData(l,s),r.set(o,l)}return r}buildSkeleton(e,t,n,r){let i=null;return e.parents.forEach(function(e){for(let a in t){let o=t[a];o.rawBones.forEach(function(t,a){if(t.ID===e.ID){let e=i;i=new ao,i.matrixWorld.copy(t.transformLink),i.name=r?Bd.sanitizeNodeName(r):``,i.userData.originalName=r,i.ID=n,o.bones[a]=i,e!==null&&i.add(e)}})}}),i}createCamera(e){let t,n;if(e.children.forEach(function(e){let t=q.Objects.NodeAttribute[e.ID];t!==void 0&&(n=t)}),n===void 0)t=new Vr;else{let e=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(e=1);let r=1;n.NearPlane!==void 0&&(r=n.NearPlane.value/1e3);let i=1e3;n.FarPlane!==void 0&&(i=n.FarPlane.value/1e3);let a=window.innerWidth,o=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(a=n.AspectWidth.value,o=n.AspectHeight.value);let s=a/o,c=45;n.FieldOfView!==void 0&&(c=n.FieldOfView.value);let l=n.FocalLength?n.FocalLength.value:null;switch(e){case 0:t=new Nu(c,s,r,i),l!==null&&t.setFocalLength(l);break;case 1:console.warn(`THREE.FBXLoader: Orthographic cameras not supported yet.`),t=new Vr;break;default:console.warn(`THREE.FBXLoader: Unknown camera type `+e+`.`),t=new Vr}}return t}createLight(e){let t,n;if(e.children.forEach(function(e){let t=q.Objects.NodeAttribute[e.ID];t!==void 0&&(n=t)}),n===void 0)t=new Vr;else{let e;e=n.LightType===void 0?0:n.LightType.value;let r=16777215;n.Color!==void 0&&(r=Zn.colorSpaceToWorking(new R().fromArray(n.Color.value),Dt));let i=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(i=0);let a=0;switch(n.FarAttenuationEnd!==void 0&&(a=n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?0:n.FarAttenuationEnd.value),e){case 0:t=new Lu(r,i,a,1);break;case 1:t=new Bu(r,i);break;case 2:let e=Math.PI/3,o=0;n.OuterAngle===void 0?n.InnerAngle!==void 0&&(e=Hn.degToRad(n.InnerAngle.value)):(e=Hn.degToRad(n.OuterAngle.value),n.InnerAngle!==void 0&&(o=1-n.InnerAngle.value/n.OuterAngle.value,o=Math.max(0,o))),t=new Fu(r,i,a,e,o,1);break;default:console.warn(`THREE.FBXLoader: Unknown light type `+n.LightType.value+`, defaulting to a PointLight.`),t=new Lu(r,i)}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let r,i=null,a=null,o=[];if(e.children.forEach(function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&o.push(n.get(e.ID))}),o.length>1?a=o:o.length>0?a=o[0]:(a=new Al({name:lu.DEFAULT_MATERIAL_NAME,color:13421772}),o.push(a)),`color`in i.attributes&&o.forEach(function(e){e.vertexColors=!0}),i.groups.length>0){let e=!1;for(let t=0,n=i.groups.length;t<n;t++){let n=i.groups[t];(n.materialIndex<0||n.materialIndex>=o.length)&&(n.materialIndex=o.length,e=!0)}if(e){let e=new Al;o.push(e)}}return i.FBX_Deformer?(r=new io(i,a),r.normalizeSkinWeights()):r=new Ka(i,a),r}createCurve(e,t){return new ns(e.children.reduce(function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e},null),new Jo({name:lu.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1}))}getTransformData(e,t){let n={};`InheritType`in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder=`RotationOrder`in t?xg(t.RotationOrder.value):xg(0),`Lcl_Translation`in t&&(n.translation=t.Lcl_Translation.value),`PreRotation`in t&&(n.preRotation=t.PreRotation.value),`Lcl_Rotation`in t&&(n.rotation=t.Lcl_Rotation.value),`PostRotation`in t&&(n.postRotation=t.PostRotation.value),`Lcl_Scaling`in t&&(n.scale=t.Lcl_Scaling.value),`ScalingOffset`in t&&(n.scalingOffset=t.ScalingOffset.value),`ScalingPivot`in t&&(n.scalingPivot=t.ScalingPivot.value),`RotationOffset`in t&&(n.rotationOffset=t.RotationOffset.value),`RotationPivot`in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){`LookAtProperty`in t&&ng.get(e.ID).children.forEach(function(t){if(t.relationship===`LookAtProperty`){let n=q.Objects.Model[t.ID];if(`Lcl_Translation`in n){let t=n.Lcl_Translation.value;e.target===void 0?e.lookAt(new I().fromArray(t)):(e.target.position.fromArray(t),rg.add(e.target))}}})}bindSkeleton(e,t,n){for(let r in e){let i=e[r],a=[];for(let e=0,t=i.bones.length;e<t;e++){let t=new L;i.bones[e]&&i.rawBones[e]&&t.copy(i.rawBones[e].transformLink).invert(),a.push(t)}ng.get(parseInt(i.ID)).parents.forEach(function(e){if(t.has(e.ID)){let t=e.ID;ng.get(t).parents.forEach(function(e){if(n.has(e.ID)){let t=n.get(e.ID);t.updateMatrixWorld(!0),t.bind(new lo(i.bones,a),t.matrixWorld)}})}})}}parsePoseNodes(){let e={};if(`Pose`in q.Objects){let t=q.Objects.Pose;for(let n in t)if(t[n].attrType===`BindPose`&&t[n].NbPoseNodes>0){let r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(t){e[t.Node]=new L().fromArray(t.Matrix.a)}):e[r.Node]=new L().fromArray(r.Matrix.a)}}return e}addGlobalSceneSettings(){if(`GlobalSettings`in q){if(`AmbientColor`in q.GlobalSettings){let e=q.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){let e=new R().setRGB(t,n,r,Dt);rg.add(new Vu(e,1))}}`UnitScaleFactor`in q.GlobalSettings&&(rg.userData.unitScaleFactor=q.GlobalSettings.UnitScaleFactor.value)}}},og=class{constructor(){this.negativeMaterialIndices=!1}parse(e){let t=new Map;if(`Geometry`in q.Objects){let n=q.Objects.Geometry;for(let r in n){let i=ng.get(parseInt(r)),a=this.parseGeometry(i,n[r],e);t.set(parseInt(r),a)}}return this.negativeMaterialIndices===!0&&console.warn(`THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected.`),t}parseGeometry(e,t,n){switch(t.attrType){case`Mesh`:return this.parseMeshGeometry(e,t,n);case`NurbsCurve`:return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){let r=n.skeletons,i=[],a=e.parents.map(function(e){return q.Objects.Model[e.ID]});if(a.length===0)return;let o=e.children.reduce(function(e,t){return r[t.ID]!==void 0&&(e=r[t.ID]),e},null);e.children.forEach(function(e){n.morphTargets[e.ID]!==void 0&&i.push(n.morphTargets[e.ID])});let s=a[0],c={};`RotationOrder`in s&&(c.eulerOrder=xg(s.RotationOrder.value)),`InheritType`in s&&(c.inheritType=parseInt(s.InheritType.value)),`GeometricTranslation`in s&&(c.translation=s.GeometricTranslation.value),`GeometricRotation`in s&&(c.rotation=s.GeometricRotation.value),`GeometricScaling`in s&&(c.scale=s.GeometricScaling.value);let l=bg(c);return this.genGeometry(t,o,i,l)}genGeometry(e,t,n,r){let i=new B;e.attrName&&(i.name=e.attrName);let a=this.parseGeoNode(e,t),o=this.genBuffers(a),s=new z(o.vertex,3);if(s.applyMatrix4(r),i.setAttribute(`position`,s),o.colors.length>0&&i.setAttribute(`color`,new z(o.colors,3)),t&&(i.setAttribute(`skinIndex`,new Vi(o.weightsIndices,4)),i.setAttribute(`skinWeight`,new z(o.vertexWeights,4)),i.FBX_Deformer=t),o.normal.length>0){let e=new Kn().getNormalMatrix(r),t=new z(o.normal,3);t.applyNormalMatrix(e),i.setAttribute(`normal`,t)}if(o.uvs.forEach(function(e,t){let n=t===0?`uv`:`uv${t}`;i.setAttribute(n,new z(o.uvs[t],2))}),a.material&&a.material.mappingType!==`AllSame`){let e=o.materialIndex[0],t=0;if(o.materialIndex.forEach(function(n,r){n!==e&&(i.addGroup(t,r-t,e),e=n,t=r)}),i.groups.length>0){let t=i.groups[i.groups.length-1],n=t.start+t.count;n!==o.materialIndex.length&&i.addGroup(n,o.materialIndex.length-n,e)}i.groups.length===0&&i.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(i,e,n,r),i}parseGeoNode(e,t){let n={};if(n.vertexPositions=e.Vertices===void 0?[]:e.Vertices.a,n.vertexIndices=e.PolygonVertexIndex===void 0?[]:e.PolygonVertexIndex.a,e.LayerElementColor&&e.LayerElementColor[0].Colors&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(e,t){e.indices.forEach(function(r,i){n.weightTable[r]===void 0&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],o=[],s=[],c=[],l=[],u=[],d=this;return e.vertexIndices.forEach(function(f,p){let m,h=!1;f<0&&(f^=-1,h=!0);let g=[],_=[];if(a.push(f*3,f*3+1,f*3+2),e.color){let t=_g(p,n,f,e.color);s.push(t[0],t[1],t[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(e){_.push(e.weight),g.push(e.id)}),_.length>4){i||=(console.warn(`THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.`),!0);let e=[0,0,0,0],t=[0,0,0,0];_.forEach(function(n,r){let i=n,a=g[r];t.forEach(function(t,n,r){if(i>t){r[n]=i,i=t;let o=e[n];e[n]=a,a=o}})}),g=e,_=t}for(;_.length<4;)_.push(0),g.push(0);for(let e=0;e<4;++e)l.push(_[e]),u.push(g[e])}if(e.normal){let t=_g(p,n,f,e.normal);o.push(t[0],t[1],t[2])}e.material&&e.material.mappingType!==`AllSame`&&(m=_g(p,n,f,e.material)[0],m<0&&(d.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(e,t){let r=_g(p,n,f,e);c[t]===void 0&&(c[t]=[]),c[t].push(r[0]),c[t].push(r[1])}),r++,h&&(d.genFace(t,e,a,m,o,s,c,l,u,r),n++,r=0,a=[],o=[],s=[],c=[],l=[],u=[])}),t}getNormalNewell(e){let t=new I(0,0,0);for(let n=0;n<e.length;n++){let r=e[n],i=e[(n+1)%e.length];t.x+=(r.y-i.y)*(r.z+i.z),t.y+=(r.z-i.z)*(r.x+i.x),t.z+=(r.x-i.x)*(r.y+i.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){let t=this.getNormalNewell(e),n=(Math.abs(t.z)>.5?new I(0,1,0):new I(0,0,1)).cross(t).normalize();return{normal:t,tangent:n,bitangent:t.clone().cross(n).normalize()}}flattenVertex(e,t,n){return new F(e.dot(t),e.dot(n))}genFace(e,t,n,r,i,a,o,s,c,l){let u;if(l>3){let e=[],r=t.baseVertexPositions||t.vertexPositions;for(let t=0;t<n.length;t+=3)e.push(new I(r[n[t]],r[n[t+1]],r[n[t+2]]));let{tangent:i,bitangent:a}=this.getNormalTangentAndBitangent(e),o=[];for(let t of e)o.push(this.flattenVertex(t,i,a));u=Xc.triangulateShape(o,[])}else u=[[0,1,2]];for(let[l,d,f]of u)e.vertex.push(t.vertexPositions[n[l*3]]),e.vertex.push(t.vertexPositions[n[l*3+1]]),e.vertex.push(t.vertexPositions[n[l*3+2]]),e.vertex.push(t.vertexPositions[n[d*3]]),e.vertex.push(t.vertexPositions[n[d*3+1]]),e.vertex.push(t.vertexPositions[n[d*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),t.skeleton&&(e.vertexWeights.push(s[l*4]),e.vertexWeights.push(s[l*4+1]),e.vertexWeights.push(s[l*4+2]),e.vertexWeights.push(s[l*4+3]),e.vertexWeights.push(s[d*4]),e.vertexWeights.push(s[d*4+1]),e.vertexWeights.push(s[d*4+2]),e.vertexWeights.push(s[d*4+3]),e.vertexWeights.push(s[f*4]),e.vertexWeights.push(s[f*4+1]),e.vertexWeights.push(s[f*4+2]),e.vertexWeights.push(s[f*4+3]),e.weightsIndices.push(c[l*4]),e.weightsIndices.push(c[l*4+1]),e.weightsIndices.push(c[l*4+2]),e.weightsIndices.push(c[l*4+3]),e.weightsIndices.push(c[d*4]),e.weightsIndices.push(c[d*4+1]),e.weightsIndices.push(c[d*4+2]),e.weightsIndices.push(c[d*4+3]),e.weightsIndices.push(c[f*4]),e.weightsIndices.push(c[f*4+1]),e.weightsIndices.push(c[f*4+2]),e.weightsIndices.push(c[f*4+3])),t.color&&(e.colors.push(a[l*3]),e.colors.push(a[l*3+1]),e.colors.push(a[l*3+2]),e.colors.push(a[d*3]),e.colors.push(a[d*3+1]),e.colors.push(a[d*3+2]),e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2])),t.material&&t.material.mappingType!==`AllSame`&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[l*3]),e.normal.push(i[l*3+1]),e.normal.push(i[l*3+2]),e.normal.push(i[d*3]),e.normal.push(i[d*3+1]),e.normal.push(i[d*3+2]),e.normal.push(i[f*3]),e.normal.push(i[f*3+1]),e.normal.push(i[f*3+2])),t.uv&&t.uv.forEach(function(t,n){e.uvs[n]===void 0&&(e.uvs[n]=[]),e.uvs[n].push(o[n][l*2]),e.uvs[n].push(o[n][l*2+1]),e.uvs[n].push(o[n][d*2]),e.uvs[n].push(o[n][d*2+1]),e.uvs[n].push(o[n][f*2]),e.uvs[n].push(o[n][f*2+1])})}addMorphTargets(e,t,n,r){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];let i=r.clone().setPosition(0,0,0),a=this;n.forEach(function(n){n.rawTargets.forEach(function(n){let r=q.Objects.Geometry[n.geoID];r!==void 0&&a.genMorphGeometry(e,t,r,i,n.name)})})}genMorphGeometry(e,t,n,r,i){let a=t.Vertices===void 0?[]:t.Vertices.a,o=t.PolygonVertexIndex===void 0?[]:t.PolygonVertexIndex.a,s=n.Vertices===void 0?[]:n.Vertices.a,c=n.Indexes===void 0?[]:n.Indexes.a,l=e.attributes.position.count*3,u=new Float32Array(l);for(let e=0;e<c.length;e++){let t=c[e]*3;u[t]=s[e*3],u[t+1]=s[e*3+1],u[t+2]=s[e*3+2]}let d={vertexIndices:o,vertexPositions:u,baseVertexPositions:a},f=new z(this.genBuffers(d).vertex,3);f.name=i||n.attrName,f.applyMatrix4(r),e.morphAttributes.position.push(f)}parseNormals(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return n===`IndexToDirect`&&(`NormalIndex`in e?i=e.NormalIndex.a:`NormalsIndex`in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}parseUVs(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return n===`IndexToDirect`&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}}parseVertexColors(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];n===`IndexToDirect`&&(i=e.ColorIndex.a);for(let e=0,t=new R;e<r.length;e+=4)t.fromArray(r,e),Zn.colorSpaceToWorking(t,Dt),t.toArray(r,e);return{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}}parseMaterialIndices(e){let t=e.MappingInformationType,n=e.ReferenceInformationType;if(t===`NoMappingInformation`)return{dataSize:1,buffer:[0],indices:[0],mappingType:`AllSame`,referenceType:n};let r=e.Materials.a,i=[];for(let e=0;e<r.length;++e)i.push(e);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}parseNurbsGeometry(e){let t=parseInt(e.Order);if(isNaN(t))return console.error(`THREE.FBXLoader: Invalid Order %s given for geometry ID: %s`,e.Order,e.id),new B;let n=t-1,r=e.KnotVector.a,i=[],a=e.Points.a;for(let e=0,t=a.length;e<t;e+=4)i.push(new cr().fromArray(a,e));let o,s;if(e.Form===`Closed`)i.push(i[0]);else if(e.Form===`Periodic`){o=n,s=r.length-1-o;for(let e=0;e<n;++e)i.push(i[e])}let c=new tg(n,r,i,o,s).getPoints(i.length*12);return new B().setFromPoints(c)}},sg=class{parse(){let e=[],t=this.parseClips();if(t!==void 0)for(let n in t){let r=t[n],i=this.addClip(r);e.push(i)}return e}parseClips(){if(q.Objects.AnimationCurve===void 0)return;let e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);let t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){let e=q.Objects.AnimationCurveNode,t=new Map;for(let n in e){let r=e[n];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){let e={id:r.id,attr:r.attrName,curves:{}};t.set(e.id,e)}}return t}parseAnimationCurves(e){let t=q.Objects.AnimationCurve;for(let n in t){let r={id:t[n].id,times:t[n].KeyTime.a.map(hg),values:t[n].KeyValueFloat.a},i=ng.get(r.id);if(i!==void 0){let t=i.parents[0].ID,n=i.parents[0].relationship;n.match(/X/)?e.get(t).curves.x=r:n.match(/Y/)?e.get(t).curves.y=r:n.match(/Z/)?e.get(t).curves.z=r:n.match(/DeformPercent/)&&e.has(t)&&(e.get(t).curves.morph=r)}}}parseAnimationLayers(e){let t=q.Objects.AnimationLayer,n=new Map;for(let r in t){let t=[],i=ng.get(parseInt(r));i!==void 0&&(i.children.forEach(function(n,r){if(e.has(n.ID)){let i=e.get(n.ID);if(i.curves.x!==void 0||i.curves.y!==void 0||i.curves.z!==void 0){if(t[r]===void 0){let e=ng.get(n.ID).parents.filter(function(e){return e.relationship!==void 0});if(e.length===0)return;let i=e[0].ID;if(i!==void 0){let e=q.Objects.Model[i.toString()];if(e===void 0){console.warn(`THREE.FBXLoader: Encountered a unused curve.`,n);return}let a={modelName:e.attrName?Bd.sanitizeNodeName(e.attrName):``,ID:e.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};rg.traverse(function(t){t.ID===e.id&&(a.transform=t.matrix,t.userData.transformData&&(a.eulerOrder=t.userData.transformData.eulerOrder,t.userData.transformData.rotation&&(a.initialRotation=t.userData.transformData.rotation)))}),a.transform||=new L,`PreRotation`in e&&(a.preRotation=e.PreRotation.value),`PostRotation`in e&&(a.postRotation=e.PostRotation.value),t[r]=a}}t[r]&&(t[r][i.attr]=i)}else if(i.curves.morph!==void 0){if(t[r]===void 0){let e=ng.get(n.ID).parents.filter(function(e){return e.relationship!==void 0});if(e.length===0)return;let i=e[0].ID,a=ng.get(i).parents[0].ID,o=ng.get(a).parents[0].ID,s=ng.get(o).parents[0].ID,c=q.Objects.Model[s],l={modelName:c.attrName?Bd.sanitizeNodeName(c.attrName):``,morphName:q.Objects.Deformer[i].attrName};t[r]=l}t[r][i.attr]=i}}}),n.set(parseInt(r),t))}return n}parseAnimStacks(e){let t=q.Objects.AnimationStack,n={};for(let r in t){let i=ng.get(parseInt(r)).children;i.length>1&&console.warn(`THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.`);let a=e.get(i[0].ID);n[r]={name:t[r].attrName,layer:a}}return n}addClip(e){let t=[],n=this;return e.layer.forEach(function(e){t=t.concat(n.generateTracks(e))}),new nu(e.name,-1,t)}generateTracks(e){let t=[],n=new I,r=new I;if(e.transform&&e.transform.decompose(n,new Un,r),n=n.toArray(),r=r.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){let r=this.generateVectorTrack(e.modelName,e.T.curves,n,`position`);r!==void 0&&t.push(r)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){let n=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder,e.initialRotation);n!==void 0&&t.push(n)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){let n=this.generateVectorTrack(e.modelName,e.S.curves,r,`scale`);n!==void 0&&t.push(n)}if(e.DeformPercent!==void 0){let n=this.generateMorphTrack(e);n!==void 0&&t.push(n)}return t}generateVectorTrack(e,t,n,r){let i=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(i,t,n);return new tu(e+`.`+r,i,a)}generateRotationTrack(e,t,n,r,i,a){let o,s;if(t.x!==void 0||t.y!==void 0||t.z!==void 0){let e=this.getTimesForAllAxes(t);if(e.length>0){let n=a||[0,0,0],r=this.synchronizeCurve(t.x,e,n[0]),c=this.synchronizeCurve(t.y,e,n[1]),l=this.synchronizeCurve(t.z,e,n[2]),u=this.interpolateRotations(r,c,l,i);o=u[0],s=u[1]}}let c=xg(0);n!==void 0&&(n=n.map(Hn.degToRad),n.push(c),n=new wr().fromArray(n),n=new Un().setFromEuler(n)),r!==void 0&&(r=r.map(Hn.degToRad),r.push(c),r=new wr().fromArray(r),r=new Un().setFromEuler(r).invert());let l=new Un,u=new wr,d=[];if(!(!s||!o)){for(let e=0;e<s.length;e+=3)u.set(s[e],s[e+1],s[e+2],i),l.setFromEuler(u),n!==void 0&&l.premultiply(n),r!==void 0&&l.multiply(r),e>2&&new Un().fromArray(d,(e-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(d,e/3*4);return new $l(e+`.quaternion`,o,d)}}generateMorphTrack(e){let t=e.DeformPercent.curves.morph,n=t.values.map(function(e){return e/100}),r=rg.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Zl(e.modelName+`.morphTargetInfluences[`+r+`]`,t.times,n)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(e,t){return e-t}),t.length>1){let e=1,n=t[0];for(let r=1;r<t.length;r++){let i=t[r];i!==n&&(t[e]=i,n=i,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,n){let r=n,i=[],a=-1,o=-1,s=-1;return e.forEach(function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),a!==-1){let e=t.x.values[a];i.push(e),r[0]=e}else i.push(r[0]);if(o!==-1){let e=t.y.values[o];i.push(e),r[1]=e}else i.push(r[1]);if(s!==-1){let e=t.z.values[s];i.push(e),r[2]=e}else i.push(r[2])}),i}synchronizeCurve(e,t,n){if(e===void 0)return{times:t,values:t.map(()=>n)};if(e.times.length===t.length)return e;let r=[];for(let i=0;i<t.length;i++)r.push(this.sampleCurveValue(e,t[i],n));return{times:t,values:r}}sampleCurveValue(e,t,n){let r=e.times,i=e.values;if(t<=r[0])return i[0];if(t>=r[r.length-1])return i[i.length-1];for(let e=0;e<r.length-1;e++)if(t>=r[e]&&t<=r[e+1]){if(r[e]===t)return i[e];let n=(t-r[e])/(r[e+1]-r[e]);return i[e]*(1-n)+i[e+1]*n}return n}interpolateRotations(e,t,n,r){let i=[],a=[];i.push(e.times[0]),a.push(Hn.degToRad(e.values[0])),a.push(Hn.degToRad(t.values[0])),a.push(Hn.degToRad(n.values[0]));for(let o=1;o<e.values.length;o++){let s=[e.values[o-1],t.values[o-1],n.values[o-1]];if(isNaN(s[0])||isNaN(s[1])||isNaN(s[2]))continue;let c=s.map(Hn.degToRad),l=[e.values[o],t.values[o],n.values[o]];if(isNaN(l[0])||isNaN(l[1])||isNaN(l[2]))continue;let u=l.map(Hn.degToRad),d=[l[0]-s[0],l[1]-s[1],l[2]-s[2]],f=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){let t=Math.max(...f)/180,n=new wr(...c,r),s=new wr(...u,r),l=new Un().setFromEuler(n),d=new Un().setFromEuler(s);l.dot(d)<0&&d.set(-d.x,-d.y,-d.z,-d.w);let p=e.times[o-1],m=e.times[o]-p,h=new Un,g=new wr;for(let e=0;e<1;e+=1/t)h.copy(l.clone().slerp(d.clone(),e)),i.push(p+e*m),g.setFromQuaternion(h,r),a.push(g.x),a.push(g.y),a.push(g.z)}else i.push(e.times[o]),a.push(Hn.degToRad(e.values[o])),a.push(Hn.degToRad(t.values[o])),a.push(Hn.degToRad(n.values[o]))}return[i,a]}},cg=class{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),--this.currentIndent}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new dg,this.nodeStack=[],this.currentProp=[],this.currentPropName=``;let t=this,n=e.split(/[\r\n]+/);return n.forEach(function(e,r){let i=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(i||a)return;let o=e.match(`^\\t{`+t.currentIndent+`}(\\w+):(.*){`,``),s=e.match(`^\\t{`+t.currentIndent+`}(\\w+):[\\s\\t\\r\\n](.*)`),c=e.match(`^\\t{`+(t.currentIndent-1)+`}}`);o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,n[++r]):c?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}),this.allNodes}parseNodeBegin(e,t){let n=t[1].trim().replace(/^"/,``).replace(/"$/,``),r=t[2].split(`,`).map(function(e){return e.trim().replace(/^"/,``).replace(/"$/,``)}),i={name:n},a=this.parseNodeAttr(r),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,i):n in o?(n===`PoseNode`?o.PoseNode.push(i):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),a.id!==``&&(o[n][a.id]=i)):typeof a.id==`number`?(o[n]={},o[n][a.id]=i):n!==`Properties70`&&(o[n]=n===`PoseNode`?[i]:i),typeof a.id==`number`&&(i.id=a.id),a.name!==``&&(i.attrName=a.name),a.type!==``&&(i.attrType=a.type),this.pushStack(i)}parseNodeAttr(e){let t=e[0];e[0]!==``&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n=``,r=``;return e.length>1&&(n=e[1].replace(/^(\w+)::/,``),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,``).replace(/"$/,``).trim(),i=t[2].replace(/^"/,``).replace(/"$/,``).trim();r===`Content`&&i===`,`&&(i=n.replace(/"/g,``).replace(/,$/,``).trim());let a=this.getCurrentNode();if(a.name===`Properties70`){this.parseNodeSpecialProperty(e,r,i);return}if(r===`C`){let e=i.split(`,`).slice(1),t=parseInt(e[0]),n=parseInt(e[1]),o=i.split(`,`).slice(3);o=o.map(function(e){return e.trim().replace(/^"/,``)}),r=`connections`,i=[t,n],wg(i,o),a[r]===void 0&&(a[r]=[])}r===`Node`&&(a.id=i),r in a&&Array.isArray(a[r])?a[r].push(i):r===`a`?a.a=i:a[r]=i,this.setCurrentProp(a,r),r===`a`&&i.slice(-1)!==`,`&&(a.a=Sg(i))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==`,`&&(t.a=Sg(t.a))}parseNodeSpecialProperty(e,t,n){let r=n.split(`",`).map(function(e){return e.trim().replace(/^\"/,``).replace(/\s/,`_`)}),i=r[0],a=r[1],o=r[2],s=r[3],c=r[4];switch(a){case`int`:case`enum`:case`bool`:case`ULongLong`:case`double`:case`Number`:case`FieldOfView`:c=parseFloat(c);break;case`Color`:case`ColorRGB`:case`Vector3D`:case`Lcl_Translation`:case`Lcl_Rotation`:case`Lcl_Scaling`:c=Sg(c)}this.getPrevNode()[i]={type:a,type2:o,flag:s,value:c},this.setCurrentProp(this.getPrevNode(),i)}},lg=class{parse(e){let t=new ug(e);t.skip(23);let n=t.getUint32();if(n<6400)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+n);let r=new dg;for(;!this.endOfContent(t);){let e=this.parseNode(t,n);e!==null&&r.add(e.name,e)}return r}endOfContent(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let a=e.getUint8(),o=e.getString(a);if(r===0)return null;let s=[];for(let t=0;t<i;t++)s.push(this.parseProperty(e));let c=s.length>0?s[0]:``,l=s.length>1?s[1]:``,u=s.length>2?s[2]:``;for(n.singleProperty=i===1&&e.getOffset()===r;r>e.getOffset();){let r=this.parseNode(e,t);r!==null&&this.parseSubNode(o,n,r)}return n.propertyList=s,typeof c==`number`&&(n.id=c),l!==``&&(n.attrName=l),u!==``&&(n.attrType=u),o!==``&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){let e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if(e===`Connections`&&n.name===`C`){let e=[];n.propertyList.forEach(function(t,n){n!==0&&e.push(t)}),t.connections===void 0&&(t.connections=[]),t.connections.push(e)}else if(n.name===`Properties70`)Object.keys(n).forEach(function(e){t[e]=n[e]});else if(e===`Properties70`&&n.name===`P`){let e=n.propertyList[0],r=n.propertyList[1],i=n.propertyList[2],a=n.propertyList[3],o;e.indexOf(`Lcl `)===0&&(e=e.replace(`Lcl `,`Lcl_`)),r.indexOf(`Lcl `)===0&&(r=r.replace(`Lcl `,`Lcl_`)),o=r===`Color`||r===`ColorRGB`||r===`Vector`||r===`Vector3D`||r.indexOf(`Lcl_`)===0?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[e]={type:r,type2:i,flag:a,value:o}}else t[n.name]===void 0?typeof n.id==`number`?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name===`PoseNode`?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){let t=e.getString(1),n;switch(t){case`C`:return e.getBoolean();case`D`:return e.getFloat64();case`F`:return e.getFloat32();case`I`:return e.getInt32();case`L`:return e.getInt64();case`R`:return n=e.getUint32(),e.getArrayBuffer(n);case`S`:return n=e.getUint32(),e.getString(n);case`Y`:return e.getInt16();case`b`:case`c`:case`d`:case`f`:case`i`:case`l`:let r=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(i===0)switch(t){case`b`:case`c`:return e.getBooleanArray(r);case`d`:return e.getFloat64Array(r);case`f`:return e.getFloat32Array(r);case`i`:return e.getInt32Array(r);case`l`:return e.getInt64Array(r)}let o=new ug(Gh(new Uint8Array(e.getArrayBuffer(a))).buffer);switch(t){case`b`:case`c`:return o.getBooleanArray(r);case`d`:return o.getFloat64Array(r);case`f`:return o.getFloat32Array(r);case`i`:return o.getInt32Array(r);case`l`:return o.getInt64Array(r)}break;default:throw Error(`THREE.FBXLoader: Unknown property type `+t)}}},ug=class{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t===void 0||t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)==1}getBooleanArray(e){let t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){let e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){let e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){let e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){let e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){let e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){let e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){let t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=this.offset,n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);let r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}},dg=class{add(e,t){this[e]=t}};function fg(e){return e.byteLength>=21&&Cg(e,0,21)===`Kaydara FBX Binary \0`}function pg(e){let t=[`K`,`a`,`y`,`d`,`a`,`r`,`a`,`\\`,`F`,`B`,`X`,`\\`,`B`,`i`,`n`,`a`,`r`,`y`,`\\`,`\\`],n=0;function r(t){let r=e[t-1];return e=e.slice(n+t),n++,r}for(let e=0;e<t.length;++e)if(r(1)===t[e])return!1;return!0}function mg(e){let t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw Error(`THREE.FBXLoader: Cannot find the version number for the file given.`)}function hg(e){return e/46186158e3}var gg=[];function _g(e,t,n,r){let i;switch(r.mappingType){case`ByPolygonVertex`:i=e;break;case`ByPolygon`:i=t;break;case`ByVertice`:i=n;break;case`AllSame`:i=r.indices[0];break;default:console.warn(`THREE.FBXLoader: unknown attribute mapping type `+r.mappingType)}r.referenceType===`IndexToDirect`&&(i=r.indices[i]);let a=i*r.dataSize,o=a+r.dataSize;return Tg(gg,r.buffer,a,o)}var vg=new wr,yg=new I;function bg(e){let t=new L,n=new L,r=new L,i=new L,a=new L,o=new L,s=new L,c=new L,l=new L,u=new L,d=new L,f=new L,p=e.inheritType?e.inheritType:0;e.translation&&t.setPosition(yg.fromArray(e.translation));let m=xg(0);if(e.preRotation){let t=e.preRotation.map(Hn.degToRad);t.push(m),n.makeRotationFromEuler(vg.fromArray(t))}if(e.rotation){let t=e.rotation.map(Hn.degToRad);t.push(e.eulerOrder||m),r.makeRotationFromEuler(vg.fromArray(t))}if(e.postRotation){let t=e.postRotation.map(Hn.degToRad);t.push(m),i.makeRotationFromEuler(vg.fromArray(t)),i.invert()}e.scale&&a.scale(yg.fromArray(e.scale)),e.scalingOffset&&s.setPosition(yg.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(yg.fromArray(e.scalingPivot)),e.rotationOffset&&c.setPosition(yg.fromArray(e.rotationOffset)),e.rotationPivot&&l.setPosition(yg.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d.copy(e.parentMatrix),u.copy(e.parentMatrixWorld));let h=n.clone().multiply(r).multiply(i),g=new L;g.extractRotation(u);let _=new L;_.copyPosition(u);let v=_.clone().invert().multiply(u),y=g.clone().invert().multiply(v),b=a,x=new L;if(p===0)x.copy(g).multiply(h).multiply(y).multiply(b);else if(p===1)x.copy(g).multiply(y).multiply(h).multiply(b);else{let e=new L().scale(new I().setFromMatrixScale(d)).clone().invert(),t=y.clone().multiply(e);x.copy(g).multiply(h).multiply(t).multiply(b)}let S=l.clone().invert(),C=o.clone().invert(),w=t.clone().multiply(c).multiply(l).multiply(n).multiply(r).multiply(i).multiply(S).multiply(s).multiply(o).multiply(a).multiply(C),T=new L().copyPosition(w),E=u.clone().multiply(T);return f.copyPosition(E),w=f.clone().multiply(x),w.premultiply(u.invert()),w}function xg(e){e||=0;let t=[`ZYX`,`YZX`,`XZY`,`ZXY`,`YXZ`,`XYZ`];return e===6?(console.warn(`THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.`),t[0]):t[e]}function Sg(e){return e.split(`,`).map(function(e){return parseFloat(e)})}function Cg(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=e.byteLength),new TextDecoder().decode(new Uint8Array(e,t,n))}function wg(e,t){for(let n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}function Tg(e,t,n,r){for(let i=n,a=0;i<r;i++,a++)e[a]=t[i];return e}var Eg=`Kaydara FBX Binary \0`,Dg=65536;function Og(e){return e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):null}function kg(e){return e instanceof ArrayBuffer?e:ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function Ag(e){let t=Og(e);if(!t||t.byteLength<21)return!1;for(let e=0;e<21;e++)if(t[e]!==Eg.charCodeAt(e))return!1;return!0}function jg(e){let t=Og(e);if(!t||!t.byteLength)return null;let n=t.subarray(0,Math.min(t.byteLength,Dg)),r=new TextDecoder(`utf-8`).decode(n).match(/FBXVersion: (\d+)/);if(!r)return null;let i=Number(r[1]);return Number.isFinite(i)?i:null}function Mg(e){let t=kg(e);return!t||!t.byteLength?null:new ig().parse(t,``)}function Ng(e){try{let t=Mg(e);if(!t)return null;t.updateMatrixWorld(!0);let n=new pi().setFromObject(t),r=n.getSize(new I);return!(r.y>0)||!Number.isFinite(r.y)?null:{min:{x:n.min.x,y:n.min.y,z:n.min.z},max:{x:n.max.x,y:n.max.y,z:n.max.z}}}catch{return null}}var Pg=.05,Fg=1179937895,Ig=1313821514,Lg=12,Rg=8;function zg(e){return e instanceof ArrayBuffer?new DataView(e):ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):null}function Bg(e){let t=zg(e);return!!(t&&t.byteLength>=4&&t.getUint32(0,!0)===Fg)}function Vg(e){let t=zg(e);if(!t||t.byteLength<Lg||t.getUint32(0,!0)!==Fg)return null;let n=Lg;for(;n+Rg<=t.byteLength;){let e=t.getUint32(n,!0),r=t.getUint32(n+4,!0),i=n+Rg;if(e>t.byteLength-i)return null;if(r===Ig){let n=new Uint8Array(t.buffer,t.byteOffset+i,e);try{let e=n.length;for(;e>0&&n[e-1]===0;)--e;return JSON.parse(new TextDecoder().decode(n.subarray(0,e)))}catch{return null}}n=i+e}return null}function Hg(e){let t=Vg(e);if(!t||typeof t!=`object`)return null;let n=Array.isArray(t.accessors)?t.accessors:[],r=new Set;for(let e of Array.isArray(t.meshes)?t.meshes:[])for(let t of Array.isArray(e?.primitives)?e.primitives:[]){let e=t?.attributes?.POSITION;Number.isInteger(e)&&r.add(e)}let i=null;for(let e of r){let t=n[e],r=t?.min,a=t?.max;if(!Array.isArray(r)||!Array.isArray(a)||r.length!==3||a.length!==3)continue;let o=[Number(r[0]),Number(r[1]),Number(r[2])],s=[Number(a[0]),Number(a[1]),Number(a[2])];if(!(o.some(e=>!Number.isFinite(e))||s.some(e=>!Number.isFinite(e)))){if(!i){i={min:{x:o[0],y:o[1],z:o[2]},max:{x:s[0],y:s[1],z:s[2]}};continue}i.min.x=Math.min(i.min.x,o[0]),i.min.y=Math.min(i.min.y,o[1]),i.min.z=Math.min(i.min.z,o[2]),i.max.x=Math.max(i.max.x,s[0]),i.max.y=Math.max(i.max.y,s[1]),i.max.z=Math.max(i.max.z,s[2])}}return i}var Ug=new Set([`KHR_draco_mesh_compression`,`EXT_meshopt_compression`]),Wg=`That model is compressed — export it uncompressed (no Draco / meshopt)`;function Gg(e){let t=new Set;if(!e||typeof e!=`object`)return t;for(let n of[e.extensionsUsed,e.extensionsRequired])if(Array.isArray(n))for(let e of n)typeof e==`string`&&t.add(e);for(let n of Array.isArray(e.meshes)?e.meshes:[])for(let e of Array.isArray(n?.primitives)?n.primitives:[]){let n=e?.extensions;if(!(!n||typeof n!=`object`))for(let e of Object.keys(n))t.add(e)}return t}function Kg(e){let t=Vg(e);if(!t)return null;for(let e of Gg(t))if(Ug.has(e))return Wg;return null}function qg(e){return e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):null}function Jg(e){let t=qg(e);if(!t||!t.byteLength)return``;let n=new TextDecoder(`utf-8`).decode(t);return n.charCodeAt(0)===65279&&(n=n.slice(1)),n}function Yg(e){let t=Jg(e);if(!t)return null;let n=null;for(let e of t.split(/\r?\n/)){let t=e.trim();if(!/^v(?:\s|$)/.test(t))continue;let r=t.split(/\s+/);if(r[0]!==`v`)continue;let i=Number(r[1]),a=Number(r[2]),o=Number(r[3]);if([i,a,o].every(Number.isFinite)){if(!n){n={min:{x:i,y:a,z:o},max:{x:i,y:a,z:o}};continue}n.min.x=Math.min(n.min.x,i),n.min.y=Math.min(n.min.y,a),n.min.z=Math.min(n.min.z,o),n.max.x=Math.max(n.max.x,i),n.max.y=Math.max(n.max.y,a),n.max.z=Math.max(n.max.z,o)}}return n}function Xg(e){let t=String(e?.type??``).toLowerCase();return t===`model/obj`?Yg(e?.bytes):t===`model/fbx`?Ng(e?.bytes):t===`model/gltf-binary`?Hg(e?.bytes):null}function Zg({min:e,max:t}={}){let n=Number(t?.x)-Number(e?.x),r=Number(t?.y)-Number(e?.y),i=Number(t?.z)-Number(e?.z);if(!Number.isFinite(r)||!(r>0))return null;let a=r<.05||r>10?1/r:1,o=n*a,s=r*a,c=i*a;return{width:o,height:s,depth:c,fitScale:a,footprint:{width:o,depth:c}}}function Qg(e){if(!e)return!1;let t=typeof e.type==`string`?e.type.toLowerCase():``;return t===`model/gltf-binary`||t===`application/gltf-binary`?!0:t===``||t===`application/octet-stream`?String(e.name??``).toLowerCase().endsWith(`.glb`):!1}function $g(e){if(!e)return!1;let t=typeof e.type==`string`?e.type.toLowerCase():``;return t===`model/obj`?!0:String(e.name??``).toLowerCase().endsWith(`.obj`)?t===``||t===`text/plain`||t===`application/octet-stream`||t===`text/x-obj`||t===`application/object`:!1}function e_(e){if(!e)return!1;let t=typeof e.type==`string`?e.type.toLowerCase():``;return t===`model/fbx`?!0:String(e.name??``).toLowerCase().endsWith(`.fbx`)?t===``||t===`text/plain`||t===`application/octet-stream`:!1}function t_(e){return Array.from(e?.files??[]).filter(e=>Qg(e)||$g(e)||e_(e))}function n_(e){return e?Array.isArray(e)?e:typeof e.length==`number`&&e.files==null?Array.from(e):Array.from(e.files??[]):[]}function r_(e){let t=[],n=[],r=[];for(let i of n_(e))t_({files:[i]}).length?n.push(i):$m({files:[i]}).length?t.push(i):r.push(i);return{images:t,meshes:n,rejected:r}}async function i_(e,t=globalThis.crypto?.subtle){if(!e||typeof e.arrayBuffer!=`function`)throw Error(`importMeshFile needs a File or Blob`);if(Number(e.size)>33554432)throw Error(`That model is too large to import — larger than ${Math.round(Im/1048576)} MB`);let n=await e.arrayBuffer(),r=typeof e.name==`string`?e.name:``,i=Qg(e)||r.toLowerCase().endsWith(`.glb`),a=e_(e)||r.toLowerCase().endsWith(`.fbx`),o=$g(e)||r.toLowerCase().endsWith(`.obj`);if(Bg(n)){let e=Kg(n);if(e)throw Error(e);let i=Hg(n),a=i?Zg(i):null;if(!a)throw Error(`That model has no measurable geometry`);let o=Qm({id:await Ym(n,t),type:`model/gltf-binary`,bytes:n,name:r});if(!o)throw Error(`That model could not be prepared for the set`);return{asset:o,height:a.height,footprint:a.footprint}}if(i)throw Error(`That file is not a GLB model`);let s=jg(n);if(Ag(n)||(s??0)>=7e3)try{let e=Ng(n),i=e?Zg(e):null;if(!i)throw Error(`That model has no measurable geometry`);let a=Qm({id:await Ym(n,t),type:`model/fbx`,bytes:n,name:r});if(!a)throw Error(`That model could not be prepared for the set`);return{asset:a,height:i.height,footprint:i.footprint}}catch(e){throw a_(e)}if(s!=null&&s<7e3)throw Error(`That FBX file is too old to import`);if(a)throw Error(`That file is not an FBX model`);let c=Yg(n);if(!c)throw Error(o?`That file is not an OBJ model`:`That file is not a 3D model`);let l=Zg(c);if(!l)throw Error(`That model has no measurable geometry`);let u=Qm({id:await Ym(n,t),type:`model/obj`,bytes:n,name:r});if(!u)throw Error(`That model could not be prepared for the set`);return{asset:u,height:l.height,footprint:l.footprint}}function a_(e){let t=String(e?.message??e);return/too old to import/i.test(t)||/no measurable geometry/i.test(t)||/not an FBX/i.test(t)?e instanceof Error?e:Error(t):/version not supported|FileVersion/i.test(t)?Error(`That FBX file is too old to import`):Error(`That file is not an FBX model`)}var o_=[],s_=`XYZ`,c_=Math.PI/180,l_=_m(`object.position`),u_=_m(`object.rotation`),d_=_m(`object.scale`),f_=(e,t,n)=>Math.min(n,Math.max(t,e)),p_=e=>{let t=u_.min.y,n=u_.max.y-t;return((e-t)%n+n)%n+t},m_=(e,t)=>Number((t>0?Math.round(e/t)*t:e).toFixed(4)),h_=`#c2c6c8`,g_=[{kind:`cube`,label:`Cube`,group:`Primitives`,footprint:{width:1,depth:1},height:1,color:h_},{kind:`sphere`,label:`Sphere`,group:`Primitives`,footprint:{width:1,depth:1},height:1,color:h_},{kind:`capsule`,label:`Capsule`,group:`Primitives`,footprint:{width:.7,depth:.7},height:1.4,color:h_},{kind:`cylinder`,label:`Cylinder`,group:`Primitives`,footprint:{width:1,depth:1},height:1,color:h_},{kind:`cone`,label:`Cone`,group:`Primitives`,footprint:{width:1,depth:1},height:1,color:h_},{kind:`plane`,label:`Plane`,group:`Primitives`,footprint:{width:2,depth:2},height:0,color:h_},{kind:`chair`,label:`Chair`,group:`Set pieces`,footprint:{width:.6,depth:.6},height:1.15,supportY:.495,color:`#b9855d`},{kind:`car`,label:`Car`,group:`Set pieces`,footprint:{width:1.8,depth:4.5},height:1.4,color:`#d98770`},{kind:`small-plane`,label:`Plane (aircraft)`,group:`Set pieces`,footprint:{width:3.4,depth:3.6},height:1.4,color:`#7896a4`}],__=[`#e2e5e6`,h_,`#9aa1a5`,`#767d81`,`#d9b18c`,`#8fae9b`,`#d94a4a`,`#4a7bd9`,`#e2c04a`,`#4fa86a`],v_=`cozyclay.objectColors.recent`,y_=/^#?([0-9a-f]{3})$/i,b_=/^#?([0-9a-f]{6})$/i;function x_(e){if(typeof e!=`string`)return null;let t=e.trim(),n=y_.exec(t);if(n)return`#${n[1].toLowerCase().replace(/./g,e=>e+e)}`;let r=b_.exec(t);return r?`#${r[1].toLowerCase()}`:null}function S_(e,t){let n=Array.isArray(e)?e.map(x_).filter((e,t,n)=>e&&n.indexOf(e)===t&&!__.includes(e)):[],r=x_(t),i=(r&&!__.includes(r)?[r,...n.filter(e=>e!==r)]:n).slice(0,6);return Array.isArray(e)&&i.length===e.length&&i.every((t,n)=>t===e[n])?e:i}function C_(e){try{let t=JSON.parse(e?.getItem(`cozyclay.objectColors.recent`)??`[]`);return S_(Array.isArray(t)?t:[],null)}catch{return[]}}function w_(e,t){try{e?.setItem(v_,JSON.stringify(t))}catch{}}var T_=`cutout`,E_=.02,D_=1.8,O_=.05,k_=.02,A_=50,j_=`#ffffff`,M_={kind:T_,label:`Cutout`,group:`Images`,footprint:{width:1,depth:E_},height:D_,color:j_},N_=`mesh`,P_={kind:N_,label:`Model`,group:`Models`,footprint:{width:1,depth:1},height:1,color:`#c49a6c`};function F_(e){return e===`cutout`?M_:e===`mesh`?P_:g_.find(t=>t.kind===e)??null}function I_(e){if(!e||typeof e!=`object`)return 0;let t=F_(e.renderer),n=Number(e.supportY??t?.supportY??e.height??t?.height);return Number.isFinite(n)?n:0}var L_=e=>Math.max(O_,e),R_=e=>f_(e,k_,A_),z_=.1,B_=e=>{let t=Number(e);return Number.isFinite(t)?f_(t,z_,10):1};function V_(e,t,n=1){return{width:L_(e)*R_(t)*B_(n),depth:E_}}var H_=Object.freeze([`hips`,`spine`,`chest`,`neck`,`head`,`leftShoulder`,`leftElbow`,`leftHand`,`rightShoulder`,`rightElbow`,`rightHand`,`leftKnee`,`leftFoot`,`rightKnee`,`rightFoot`]);function U_(e){if(e===null)return null;if(!e||typeof e!=`object`||Array.isArray(e))return;let{characterId:t,bone:n}=e;if(!(typeof t!=`string`||!t)){if(n==null)return{characterId:t,bone:null};if(!(typeof n!=`string`||!H_.includes(n)))return{characterId:t,bone:n}}}function W_(e){return e.startsWith(`object:`)?e.slice(7):null}function G_(e,t=[],n={}){if(e===`cutout`||e===`mesh`)return null;let r=F_(e);if(!r)return null;let i=new Set(t.map(e=>e.name)),a=r.label;for(let e=2;i.has(a);e+=1)a=`${r.label} ${e}`;let o=new Set(t.map(e=>e.id)),s=e;for(let t=2;o.has(s);t+=1)s=`${e}-${t}`;return{id:s,name:a,renderer:e,x:X_.x(Number(n.x)||0),y:0,z:X_.z(Number(n.z)||0),rot:X_.rot(Number(n.rot)||0),rotX:0,rotZ:0,scaleX:1,scaleY:1,scaleZ:1,path:null,color:r.color,parent:null,attach:null,hidden:!1,footprint:{...r.footprint},height:r.height,supportY:Number.isFinite(r.supportY)?r.supportY:r.height}}function K_({assetId:e,aspect:t=1,height:n=D_,name:r=``,sourceAssetId:i,matteAssetId:a,matteScale:o,stretch:s}={},c=[],l={}){if(typeof e!=`string`||!e)return null;let u=R_(Number(t)),d=L_(Number(n));if(!Number.isFinite(u)||!Number.isFinite(d))return null;let f=B_(s),p=typeof r==`string`&&r.trim()?r.trim():M_.label,m=new Set(c.map(e=>e.name)),h=p;for(let e=2;m.has(h);e+=1)h=`${p} ${e}`;let g=new Set(c.map(e=>e.id)),_=T_;for(let e=2;g.has(_);e+=1)_=`${T_}-${e}`;return{id:_,name:h,renderer:T_,x:X_.x(Number(l.x)||0),y:0,z:X_.z(Number(l.z)||0),rot:X_.rot(Number(l.rot)||0),rotX:0,rotZ:0,scaleX:1,scaleY:1,scaleZ:1,path:null,color:j_,parent:null,attach:null,hidden:!1,assetId:e,sourceAssetId:typeof i==`string`&&i?i:e,matteAssetId:typeof a==`string`?a:``,matteScale:Number.isFinite(Number(o))?Number(o):1,aspect:u,stretch:f,footprint:V_(d,u,f),height:d}}function q_(e){return{assetId:e.assetId,aspect:e.aspect,height:e.height,name:e.name,sourceAssetId:e.sourceAssetId,matteAssetId:e.matteAssetId,matteScale:e.matteScale,stretch:e.stretch}}function J_({assetId:e,height:t=1,footprint:n,name:r=``,clay:i=!1}={},a=[],o={}){if(typeof e!=`string`||!e)return null;let s=Math.max(Pg,Number(t));if(!Number.isFinite(s))return null;let c=Number(n?.width),l=Number(n?.depth),u=Number.isFinite(c)&&c>0&&Number.isFinite(l)&&l>0?{width:c,depth:l}:{width:s,depth:s},d=typeof r==`string`&&r.trim()?r.trim():P_.label,f=new Set(a.map(e=>e.name)),p=d;for(let e=2;f.has(p);e+=1)p=`${d} ${e}`;let m=new Set(a.map(e=>e.id)),h=N_;for(let e=2;m.has(h);e+=1)h=`${N_}-${e}`;return{id:h,name:p,renderer:N_,x:X_.x(Number(o.x)||0),y:0,z:X_.z(Number(o.z)||0),rot:p_(Number(o.rot)||0),rotX:0,rotZ:0,scaleX:1,scaleY:1,scaleZ:1,path:null,color:P_.color,parent:null,attach:null,hidden:!1,assetId:e,clay:i===!0,footprint:u,height:s}}function Y_(e){return{assetId:e.assetId,height:e.height,footprint:e.footprint,name:e.name,clay:e.clay===!0}}var X_={x:e=>f_(e,l_.min.x,l_.max.x),y:e=>f_(e,l_.min.y,l_.max.y),z:e=>f_(e,l_.min.z,l_.max.z),rot:e=>p_(e),rotX:e=>p_(e),rotZ:e=>p_(e),scaleX:e=>f_(e,d_.min.x,d_.max.x),scaleY:e=>f_(e,d_.min.y,d_.max.y),scaleZ:e=>f_(e,d_.min.z,d_.max.z)};function Z_(e,t){let n=[],r=new Set([t]),i=[t];for(;i.length;){let t=[];for(let a of e)a.parent&&i.includes(a.parent)&&!r.has(a.id)&&(r.add(a.id),n.push(a),t.push(a.id));i=t}return n}function Q_(e,t=[],n=[]){if(!e||typeof e!=`object`)return!1;let r=new Map;for(let e of t)e&&typeof e.id==`string`&&r.set(e.id,e);let i=e=>n.some(t=>t&&typeof t==`object`&&t.id===e&&t.hidden===!0),a=new Set,o=e;for(;o&&typeof o==`object`;){let e=typeof o.id==`string`?o.id:null;if(e){if(a.has(e))break;a.add(e),r.has(e)&&(o=r.get(e))}if(o.hidden===!0)return!0;let t=o.attach&&typeof o.attach.characterId==`string`?o.attach.characterId:null;if(t&&i(t))return!0;let n=typeof o.parent==`string`?o.parent:null;if(!n)break;o=r.get(n)??null}return!1}function $_(e,t,n){let r=!1,i=e.find(e=>e.id===t),a=i?Z_(e,t):[],o={x:0,y:0,z:0};if(i)for(let e of[`x`,`y`,`z`]){if(n[e]===void 0)continue;let t=Number(n[e]);Number.isFinite(t)&&(o[e]=X_[e](t)-i[e])}let s=new Set(a.map(e=>e.id)),c=o.x||o.y||o.z,l=e.map(e=>{if(e.id!==t){if(!c||!s.has(e.id))return e;let t={},n={x:0,y:0,z:0};for(let r of[`x`,`y`,`z`]){if(!o[r])continue;let i=X_[r](e[r]+o[r]);i!==e[r]&&(t[r]=i,n[r]=i-e[r])}return e.path&&(n.x||n.y||n.z)&&(t.path=Cm(e.path,n)),Object.keys(t).length?(r=!0,{...e,...t}):e}let i={};for(let[t,r]of Object.entries(X_)){if(n[t]===void 0)continue;let a=Number(n[t]);if(!Number.isFinite(a))continue;let o=r(a);o!==e[t]&&(i[t]=o)}for(let t of[`name`,`color`])typeof n[t]!=`string`||!n[t]||n[t]===e[t]||(i[t]=n[t]);if(typeof n.hidden==`boolean`&&n.hidden!==(e.hidden===!0)&&(i.hidden=n.hidden),n.path!==void 0){let t=n.path===null?null:Sm(n.path);JSON.stringify(t??null)!==JSON.stringify(e.path??null)&&(i.path=t)}else if(e.path&&c){let t=Cm(e.path,o);JSON.stringify(t??null)!==JSON.stringify(e.path??null)&&(i.path=t)}if(e.renderer===`cutout`){for(let t of[`assetId`,`sourceAssetId`,`matteAssetId`])typeof n[t]==`string`&&n[t]&&n[t]!==e[t]&&(i[t]=n[t]);if(Number.isFinite(Number(n.matteScale))){let t=f_(Number(n.matteScale),.01,1);t!==e.matteScale&&(i.matteScale=t)}let t=n.height===void 0?NaN:L_(Number(n.height)),r=n.aspect===void 0?NaN:R_(Number(n.aspect)),a=Number.isFinite(t)?t:e.height,o=Number.isFinite(r)?r:e.aspect,s=B_(e.stretch),c=n.width!==void 0&&Number.isFinite(Number(n.width))?B_(Number(n.width)/(a*o)):n.stretch===void 0?s:B_(n.stretch);(a!==e.height||o!==e.aspect||c!==s)&&(i.height=a,i.aspect=o,i.stretch=c,i.footprint=V_(a,o,c))}if(e.renderer===`mesh`){typeof n.clay==`boolean`&&n.clay!==(e.clay===!0)&&(i.clay=n.clay),typeof n.assetId==`string`&&n.assetId&&n.assetId!==e.assetId&&(i.assetId=n.assetId);let t=n.height===void 0?NaN:Math.max(Pg,Number(n.height));if(Number.isFinite(t)&&t!==e.height){i.height=t;let n=Number(e.height);if(n>0){let r=t/n;i.footprint={width:Number(e.footprint?.width)*r,depth:Number(e.footprint?.depth)*r}}}}return Object.keys(i).length?(r=!0,{...e,...i}):e});return r?l:e}function ev(e,t,n){if(t===n||n!==null&&!e.some(e=>e.id===n)||n!==null&&Z_(e,t).some(e=>e.id===n))return e;let r=!1,i=e.map(e=>{if(e.id!==t)return e;let i=n??null,a=i!==null&&(e.attach??null)!==null;return(e.parent??null)===i&&!a?e:(r=!0,a?{...e,parent:i,attach:null}:{...e,parent:i})});return r?i:e}function tv(e,t,n){let r=U_(n);if(r===void 0||!e.some(e=>e.id===t))return e;let i=!1,a=e.map(e=>{if(e.id!==t)return e;let n=e.attach??null;if(r===null)return n===null?e:(i=!0,{...e,attach:null});let a=n!==null&&n.characterId===r.characterId&&(n.bone??null)===r.bone,o=(e.parent??null)!==null;return a&&!o?e:(i=!0,o?{...e,attach:r,parent:null}:{...e,attach:r})});return i?a:e}function nv(e,t){let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n.map(e=>e.parent===t?{...e,parent:null}:e)}var rv=[`x`,`y`,`z`],iv={x:`rotX`,y:`rot`,z:`rotZ`},av={x:`scaleX`,y:`scaleY`,z:`scaleZ`},ov=.05,sv=5,cv=.05;function lv(e,t,n,r=ov){if(!rv.includes(t)||!Number.isFinite(n))return null;let i=m_((e[t]??0)+n,r);return{[t]:i}}function uv(e,t,n,r=sv){let i=iv[t];return!i||!Number.isFinite(n)?null:{[i]:p_(m_((e[i]??0)+n,r))}}function dv(e,t,n,r=cv){if(!Number.isFinite(n)||n<=0)return null;let i=t===null?rv:rv.includes(t)?[t]:[];if(!i.length)return null;let a={};for(let t of i){let i=av[t];a[i]=X_[i](m_((e[i]??1)*n,r))}return a}function fv(e,t,n,r=sv){if(!Number.isFinite(n)||!t)return null;let i=m_(n,r),a=new Un().setFromEuler(new wr((e.rotX??0)*c_,(e.rot??0)*c_,(e.rotZ??0)*c_,s_));a.premultiply(new Un().setFromAxisAngle(t,i*c_));let o=new wr().setFromQuaternion(a,s_);return{rotX:p_(m_(o.x/c_,0)),rot:p_(m_(o.y/c_,0)),rotZ:p_(m_(o.z/c_,0))}}function pv(e){return{width:(e.footprint?.width??1)*(e.scaleX??1),height:(e.height??1)*(e.scaleY??1),depth:(e.footprint?.depth??1)*(e.scaleZ??1)}}var mv=1e-4;function hv(e){let t=pv(e),n=(e.rot??0)*c_,r=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n)),a=(t.width*r+t.depth*i)/2,o=(t.width*i+t.depth*r)/2,s=e.x??0,c=e.z??0,l=e.y??0;return{minX:s-a,maxX:s+a,minZ:c-o,maxZ:c+o,baseY:l,topY:l+t.height}}function gv(e,t,n=[]){let r=hv(e),i=0;for(let e of t){if(Q_(e,t,n))continue;let a=hv(e);r.minX>=a.maxX-mv||a.minX>=r.maxX-mv||r.minZ>=a.maxZ-mv||a.minZ>=r.maxZ-mv||a.topY>r.baseY+mv||a.topY>i&&(i=a.topY)}return i===r.baseY?null:{y:i}}function _v(e,t,n=2.6){let r=e.x-Math.sin(t)*n,i=e.z-Math.cos(t)*n;return{x:m_(X_.x(r),ov),z:m_(X_.z(i),ov)}}var vv=_m(`character.position`);_m(`character.rot`);var yv=_m(`character.scale`),bv=Object.fromEntries([`x`,`y`,`z`,`intensity`,`warmth`].map(e=>[e,_m(`stage.keyLight.${e}`)])),xv=`cozyclay.scenes.v4`,Sv=`cozyclay.scenes.v4.quarantine`,Cv=`cozyclay.scenes.v3`,wv=`cozyclay.scenes.v2`,Tv=`cozyclay.scenes.v1`,Ev=`cozyclay.scene.v1`,Dv=Object.freeze([Cv,wv,Tv]),Ov=e=>Math.round(e*24/20),kv=Object.freeze([`y-bot-tpose`,`x-bot-tpose`]),Av=`y-bot-tpose`,jv=`a young woman in a tan coat`,Mv=`a man in a dark coat`,Nv=Object.freeze({characters:Object.freeze([Object.freeze({id:`char-a`,model:Av,x:0,z:0,rot:0,hidden:!1,pose:null,subject:jv})]),hasCharSheet:!1,environmentImage:null,environment:`a sunlit modern living room`,style:`moody cinematic lighting, 35mm film look`,hasEnvSheet:!1,shotAspect:`16:9`,cameraPresetId:null,sensorId:Hp,keyLight:Object.freeze({x:6,y:9,z:4,intensity:1.12,warmth:.5})});function Pv(e){let t=Iv(e)?e:{},n=Nv.keyLight,r=(e,t,n)=>typeof e==`number`&&Number.isFinite(e)?Math.max(n.min,Math.min(n.max,e)):t;return{x:r(t.x,n.x,bv.x),y:r(t.y,n.y,bv.y),z:r(t.z,n.z,bv.z),intensity:r(t.intensity,n.intensity,bv.intensity),warmth:r(t.warmth,n.warmth,bv.warmth)}}var Fv=1,Iv=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function Lv(e,t=new WeakMap){if(e===null||typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e!=`object`)return null;if(t.has(e))return t.get(e);if(Array.isArray(e)){let n=[];t.set(e,n);for(let r of e)n.push(Lv(r,t));return n}let n={};t.set(e,n);for(let[r,i]of Object.entries(e))Object.defineProperty(n,r,{value:Lv(i,t),enumerable:!0,writable:!0,configurable:!0});return n}var Rv=(e,t)=>Number.isFinite(e)?e:t;function zv(e){return typeof e==`string`&&e.startsWith(`data:image/`)?e:null}yv.min,yv.max;var Bv=e=>Number.isFinite(e)&&e>0?Math.max(yv.min,Math.min(yv.max,e)):1;function Vv(e,t,n){let r=Rv(e?.rot,0)*Math.PI/180,i=Rv(t,0),a=Rv(n,0);return{x:Rv(e?.x,0)+i*Math.cos(r)+a*Math.sin(r),z:Rv(e?.z,0)-i*Math.sin(r)+a*Math.cos(r)}}function Hv(e=null,t=0){let n=Iv(e)?e:{};return{id:typeof n.id==`string`&&n.id?n.id:`char-${t+1}`,model:kv.includes(n.model)?n.model:Av,x:Math.max(vv.min.x,Math.min(vv.max.x,Rv(n.x,0))),y:Math.max(vv.min.y,Math.min(vv.max.y,Rv(n.y,0))),z:Math.max(vv.min.z,Math.min(vv.max.z,Rv(n.z,0))),rot:p_(Rv(n.rot,0)),hidden:n.hidden===!0,tint:typeof n.tint==`string`&&/^#[0-9a-fA-F]{6}$/.test(n.tint)?n.tint:null,pose:Iv(n.pose)?Lv(n.pose):null,identityImage:zv(n.identityImage),scale:Bv(n.scale),subject:typeof n.subject==`string`?n.subject:t===0?jv:Mv,layer:Gv(n.layer),motionRef:Wv(n.motionRef)}}var Uv=/^[0-9a-f]{64}$/i;function Wv(e){if(!Iv(e))return null;let t=typeof e.motionId==`string`&&Uv.test(e.motionId)?e.motionId.toLowerCase():null,n=typeof e.url==`string`&&e.url?e.url:null;if(!t&&!n)return null;let r={};return t&&(r.motionId=t),n&&(r.url=n),Object.assign(r,{prompt:typeof e.prompt==`string`?e.prompt:``,rotationDeg:Number.isFinite(e.rotationDeg)?e.rotationDeg:0,anchorX:Number.isFinite(e.anchorX)?e.anchorX:0,anchorZ:Number.isFinite(e.anchorZ)?e.anchorZ:0}),Iv(e.calibration)&&(r.calibration=_p(e.calibration)),r}function Gv(e){let t=Iv(e)?e:{};return{waypoints:dm(Lv(t.waypoints),`waypoint`),promptClips:dm(Lv(t.promptClips),`prompt-clip`)}}function Kv(e){let t=Iv(e)?e:{},n=new Set;return{...t,characters:Array.isArray(t.characters)?t.characters.map(e=>({...e,layer:{waypoints:dm(Lv(e.layer?.waypoints),`waypoint`,n),promptClips:dm(Lv(e.layer?.promptClips),`prompt-clip`,n)}})):t.characters}}function qv(){return{waypoints:[],promptClips:[]}}function Jv(e){if(!Iv(e))return e;let t={...Lv(e)};if(Array.isArray(e.waypoints)){let n=new Map;for(let t of e.waypoints){if(!Iv(t)||!Number.isFinite(t.frame))continue;let e=Math.max(0,Ov(Math.round(t.frame)));n.set(e,{...Lv(t),frame:e})}t.waypoints=[...n.values()].sort((e,t)=>e.frame-t.frame)}if(Array.isArray(e.promptClips)){let n=e.promptClips.filter(e=>Iv(e)&&Number.isFinite(e.startFrame)&&Number.isFinite(e.endFrame)).sort((e,t)=>e.startFrame-t.startFrame),r=[],i=0;for(let e of n){let t=Math.max(i,Ov(Math.round(e.startFrame))),n=Math.max(t,Ov(Math.round(e.endFrame)));r.push({...Lv(e),startFrame:t,endFrame:n}),i=n}t.promptClips=r}return t}function Yv(e){return!Iv(e)||!Array.isArray(e.characters)?e:{...e,characters:e.characters.map(e=>Iv(e)&&Iv(e.layer)?{...e,layer:Jv(e.layer)}:e)}}function Xv(e){let t=[Hv({...Iv(e.charA)?e.charA:{},id:`char-a`,pose:e.poseA??null,subject:e.subject??`a young woman in a tan coat`},0)];return e.showB===!0&&t.push(Hv({...Iv(e.charB)?e.charB:{},id:`char-b`,pose:e.poseB??null,subject:e.subject2??`a man in a dark coat`},1)),t}var Zv=new Set([`characters`,`hasCharSheet`,`environmentImage`,`environment`,`style`,`hasEnvSheet`,`shotAspect`,`cameraPresetId`,`sensorId`,`keyLight`,`charA`,`charB`,`showB`,`poseA`,`poseB`,`subject`,`subject2`]);function Qv(e=null){let t=Iv(e)?e:{},n=Array.isArray(t.characters)&&t.characters.length?t.characters.map((e,t)=>Hv(e,t)):Xv(t),r={};for(let[e,n]of Object.entries(t))Zv.has(e)||(r[e]=Lv(n));return{...r,characters:n,hasCharSheet:t.hasCharSheet===!0,environmentImage:zv(t.environmentImage),environment:typeof t.environment==`string`?t.environment:Nv.environment,style:typeof t.style==`string`?t.style:Nv.style,hasEnvSheet:t.hasEnvSheet===!0,shotAspect:[`16:9`,`2.39:1`,`9:16`,`1:1`,`4:3`,`12:7`,`fal 480P`].includes(t.shotAspect)?t.shotAspect:Nv.shotAspect,cameraPresetId:typeof t.cameraPresetId==`string`&&t.cameraPresetId?t.cameraPresetId:Nv.cameraPresetId,sensorId:Object.hasOwn(Vp,t.sensorId??t.sensorFormat)?t.sensorId??t.sensorFormat:Nv.sensorId,keyLight:Pv(t.keyLight)}}function $v(e){let t=new Set(e.map(e=>e?.id)),n;do n=`scene-${Date.now().toString(36)}-${Fv++}`;while(t.has(n));return n}function ey(e,t){let n=e=>typeof e==`string`?e.normalize(`NFKC`).toLowerCase():``,r=new Set(t.map(e=>n(e?.name))),i=e=>r.has(n(e)),a=typeof e==`string`&&e.trim()?e.trim():`SCENE 01`;if(!i(a))return a;let o=a.match(/^(.*?)(\d+)$/);if(o){let[,e,t]=o;for(let n=Number(t)+1;;n+=1){let r=`${e}${String(n).padStart(t.length,`0`)}`;if(!i(r))return r}}for(let e=2;;e+=1){let t=`${a} ${e}`;if(!i(t))return t}}function ty(e=`SCENE 01`,t=[]){return{id:$v(t),name:ey(e,t),objects:[],shotDocument:null,stage:Qv()}}function ny(e,t=`SCENE 01`){let n=Array.isArray(e)?e:[];return[...n,ty(t,n)]}function ry(e,t){if(!Array.isArray(e)||t<0||t>=e.length)return e;let n=e[t],r=ty(n.name,e);return r.objects=Lv(n.objects),r.shotDocument=Lv(n.shotDocument),r.stage=Qv(n.stage),[...e.slice(0,t+1),r,...e.slice(t+1)]}function iy(e,t,n){if(!Array.isArray(e)||t<0||t>=e.length||typeof n!=`string`||!n.trim())return e;let r=ey(n,e.filter((e,n)=>n!==t));return r===e[t].name?e:e.map((e,n)=>n===t?{...e,name:r}:e)}function ay(e,t){return!Array.isArray(e)||e.length<=1||t<0||t>=e.length?e:e.filter((e,n)=>n!==t)}function oy(e,t){if(!Array.isArray(e)||!e.length)return-1;let n=e.findIndex(e=>e.id===t);return n<0?0:n}function sy(){let e=ty();return{version:4,activeSceneId:e.id,scenes:[e]}}function cy(e,t,n,r,i=!1){if(!Iv(e)||typeof e.id!=`string`||!e.id||!Array.isArray(e.objects)||t.some(t=>t.id===e.id))return null;let a=Kv(Qv(Lv(Iv(e.stage)?e.stage:r)));return{id:e.id,name:ey(typeof e.name==`string`?e.name:`SCENE ${String(n).padStart(2,`0`)}`,t),objects:e.objects.filter(Iv).map(e=>Lv(e)),shotDocument:Lv(e.shotDocument??null),stage:i?Yv(a):a}}function ly(e,t=Nv,n=!1){let r=[],i=0;for(let a of e.scenes){let e=cy(a,r,r.length+1,t,n);e?r.push(e):i+=1}return r.length||r.push(ty()),{document:{version:4,activeSceneId:r[oy(r,e.activeSceneId)].id,scenes:r},dropped:i}}function uy(e){try{return JSON.parse(e)}catch{return null}}function dy(e,t=null){if(e==null||e===``){if(t!=null&&t!==``){let e=uy(t);if(!Iv(e)||e.version!==1||!Array.isArray(e.objects))return{status:`corrupt`,document:sy(),dropped:0,quarantineRaw:t};let n=sy();return n.scenes[0].objects=e.objects.filter(Iv).map(e=>Lv(e)),{status:`migrated`,document:n,dropped:e.objects.length-n.scenes[0].objects.length}}return{status:`absent`,document:sy(),dropped:0}}let n=uy(e);if(!Iv(n)||!Number.isInteger(n.version)||n.version<1)return{status:`corrupt`,document:sy(),dropped:0,quarantineRaw:e};if(n.version>4)return{status:`future`,document:null,dropped:0};if(!Array.isArray(n.scenes))return{status:`corrupt`,document:sy(),dropped:0,quarantineRaw:e};let r=n.version<4,i=n.version<4,a=ly(n,Qv(n.stage),i);return{status:r?`migrated`:`valid`,...a}}function fy(e){return JSON.stringify({version:4,activeSceneId:e.activeSceneId,scenes:e.scenes})}function py(e){let t=e.getItem(xv);for(let n of Dv){if(t)break;t=e.getItem(n)}let n=t?null:e.getItem(Ev),r=dy(t,n);return r.status===`corrupt`&&r.quarantineRaw!==void 0&&e.setItem(Sv,r.quarantineRaw),r.status===`migrated`&&e.setItem(xv,fy(r.document)),r}var my=new Set([`aborted`,`capture_failed`,`generation_failed`,`unknown`]),hy=new Set([`aborted`,`auth`,`rate_limited`,`tool_failed`,`upstream`,`unknown`]);function gy(){try{if(!globalThis.crypto?.getRandomValues)return null;let e=new Uint8Array(16);return globalThis.crypto.getRandomValues(e),[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``)}catch{return null}}function _y(e,t,n){try{Promise.resolve(e(t,n)).catch(()=>{})}catch{}}function vy(e){try{return e()}catch{return NaN}}function yy(e,t,n=`unknown`){let r=t===`agent`?hy:my;try{if(e?.name===`AbortError`)return`aborted`}catch{}return r.has(n)?n:`unknown`}function by(e,{capture:t=a,now:n=()=>performance.now(),durationBucket:r=l}={}){let i=gy(),s=!1,c=!1,u=vy(n),d=(e,n)=>{i&&_y(t,e,n)};i&&d(`workflow:run_requested`,{surface:`workflow`,...o.node_count_bucket.has(e.node_count_bucket)?{node_count_bucket:e.node_count_bucket}:{},run_id:i});let f=(e,t,a)=>{if(s||!i)return;s=!0;let c=yy(t,`workflow`,a),l=e===`failed`&&c===`aborted`?`cancelled`:e,f=`lt1s`;try{let e=r(vy(n)-u);o.duration_bucket.has(e)&&(f=e)}catch{}d(`workflow:run_${l}`,{run_id:i,duration_bucket:f,...l===`succeeded`?{}:{failure_code:c}})};return{runId:i,succeed(){f(`succeeded`)},fail(e,t=`unknown`){f(`failed`,e,t)},apply(){c||!i||(c=!0,d(`workflow:result_applied`,{run_id:i}))}}}var xy=new Set([...new Set([`motion:generate_requested`,`motion:preflight_blocked`,`motion:preflight_passed`,`motion:job_started`,`motion:job_succeeded`,`motion:job_failed`,`motion:result_applied`]),...c.filter(e=>e.startsWith(`mcp:`))]),Sy=`5184`,Cy=((e=Sy)=>`ws://127.0.0.1:${e}/live`)(),wy=1e3,Ty=15e3,Ey=.25,Dy=2e4,Oy=1e4,ky=`cozyclay:live-workspace-id`,Ay=``;function jy(e){try{return e??globalThis.sessionStorage??null}catch{return null}}function My(){return globalThis.crypto?.randomUUID?.()??`live-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function Ny(e,t){Ay=e;try{jy(t)?.setItem(ky,e)}catch{}return e}function Py(e){try{let t=jy(e)?.getItem(ky);if(typeof t==`string`&&t)return Ay=t,t}catch{}return Ay||Ny(My(),e)}function Fy(e){return Ny(My(),e)}function Iy(e,{target:t=globalThis,doc:n=globalThis.document}={}){if(typeof t?.addEventListener!=`function`)return()=>{};let r=()=>{n?.visibilityState===`visible`&&e()},i=[`online`,`focus`,`pageshow`];for(let n of i)t.addEventListener(n,e);return n?.addEventListener?.(`visibilitychange`,r),()=>{for(let n of i)t.removeEventListener(n,e);n?.removeEventListener?.(`visibilitychange`,r)}}var Ly={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>globalThis.performance?.now?.()??Date.now()};function Ry(e){return e?.code===1008&&typeof e.reason==`string`&&e.reason.includes(`Workspace id is already connected`)}function zy(e){return e instanceof Error&&e.message?e.message:typeof e==`string`&&e?e:`Command failed`}function By(e,t,n){return t?{type:`result`,id:e,ok:!0,value:n??{}}:{type:`result`,id:e,ok:!1,error:n}}async function Vy(e,t={}){if(typeof e!=`string`)return null;let n;try{n=JSON.parse(e)}catch{return null}if(!n||typeof n!=`object`||Array.isArray(n)||n.type!==`cmd`||typeof n.id!=`string`)return null;if(typeof n.name!=`string`||!n.name)return By(n.id,!1,`Invalid command name`);if(!n.args||typeof n.args!=`object`||Array.isArray(n.args))return By(n.id,!1,`Invalid command arguments`);let r=t[n.name];if(typeof r!=`function`)return By(n.id,!1,`Unknown command: ${n.name}`);try{return By(n.id,!0,await r(n.args))}catch(e){return By(n.id,!1,zy(e))}}function Hy({handlers:e={},onWorkspace:t=()=>{},onEvent:n=()=>{},onDuplicate:r=()=>Fy(),captureMotionTelemetry:o=a,captureTelemetry:s=a,workspaceId:l=``,meta:d=null,WebSocketImpl:f=globalThis.WebSocket,url:p=Cy,timers:m=Ly,random:h=Math.random,listen:g=Iy}={}){let _=e,v=l,y=null,b=null,x=0,S=!1,C=null,w=0,T=0,E=!1,D=null,O=new Set,ee=e=>{if(!xy.has(e.event))return;let t=i(e.event,e.props),n=t.request_id;if(!n||c.includes(e.event)&&u[e.event]?.some(e=>!Object.hasOwn(t,e))||(e.event===`motion:generate_requested`||e.event.startsWith(`motion:preflight_`))&&t.surface!==`mcp`)return;let r=`${n}:${e.event}`;if(O.has(r))return;O.add(r);let a=e.event.startsWith(`motion:`)?o:s;try{Promise.resolve(a(e.event,t)).catch(()=>{})}catch{}},k=()=>{b!==null&&m.clearTimeout(b),b=null},te=()=>{let e=Math.min(wy*2**x,Ty);return x+=1,Math.round(e*(1+(h()*2-1)*Ey))},ne=()=>{S||b!==null||y||(b=m.setTimeout(()=>{b=null,ce()},te()))},re=()=>{S||y||(k(),ce())},ie=()=>{C!==null&&m.clearTimeout(C),C=null,E=!1,D=null},ae=e=>{C!==null&&m.clearTimeout(C),w=m.now(),T=e,C=m.setTimeout(j,e)},A=e=>{ie(),!(typeof e!=`number`||!(e>0))&&(E=!0,ae(Dy))};function j(){if(C=null,S||!E||!y)return;let e=m.now();if(e-w>T+2e3){D=null,ae(Dy);return}if(D===null){se({type:`ping`}),D=e,ae(Oy);return}let t=e-D;if(t>=1e4){oe();return}ae(Oy-t)}let oe=()=>{let e=y;y=null,ie();try{e?.close()}catch{}ne()},se=e=>{if(!(!y||y.readyState!==(y.OPEN??1)))try{y.send(JSON.stringify(e))}catch{}},ce=()=>{if(S||!f)return;k(),ie();try{y=new f(p)}catch{y=null,ne();return}let e=y;e.onopen=()=>{y!==e||S||se({type:`hello`,role:`editor`,version:1,...v?{workspaceId:v}:{},...d?{meta:d}:{}})},e.onmessage=async r=>{if(y!==e||S)return;if(typeof r?.data==`string`)try{let e=JSON.parse(r.data);if(e?.type===`workspace`&&typeof e.handle==`string`){x=0,A(e.heartbeatMs),t(e.handle);return}if(e?.type===`pong`){E&&(D=null,ae(Dy));return}if(e?.type===`event`&&typeof e.name==`string`&&e.payload&&typeof e.payload==`object`){if(e.name===`motion_telemetry`||e.name===`telemetry`){ee(e.payload);return}n(e.name,e.payload);return}}catch{}let i=await Vy(r?.data,_);i&&se(i)},e.onerror=()=>{},e.onclose=t=>{if(y===e&&(y=null,ie()),Ry(t)){x=0;try{let e=r();typeof e==`string`&&e&&(v=e)}catch{}}ne()}},le=g(re)??(()=>{});return ce(),{setHandlers(e){_=e&&typeof e==`object`?e:{}},close(){S=!0,k(),ie();try{le()}catch{}let e=y;y=null;try{e?.close()}catch{}}}}var Uy={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Wy=G.createContext&&G.createContext(Uy),Gy=[`attr`,`size`,`title`];function Ky(e,t){if(e==null)return{};var n,r,i=qy(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function qy(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Jy(){return Jy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jy.apply(null,arguments)}function Yy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Yy(Object(n),!0).forEach(function(t){Zy(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yy(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Zy(e,t,n){return(t=Qy(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qy(e){var t=$y(e,`string`);return typeof t==`symbol`?t:t+``}function $y(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function eb(e){return e&&e.map((e,t)=>G.createElement(e.tag,Xy({key:t},e.attr),eb(e.child)))}function tb(e){return t=>G.createElement(nb,Jy({attr:Xy({},e.attr)},t),eb(e.child))}function nb(e){var t=t=>{var n=e.attr,r=e.size,i=e.title,a=Ky(e,Gy),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),G.createElement(`svg`,Jy({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:Xy(Xy({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&G.createElement(`title`,null,i),e.children)};return Wy===void 0?t(Uy):G.createElement(Wy.Consumer,null,e=>t(e))}function rb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`18`,y1:`6`,x2:`6`,y2:`18`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`6`,x2:`18`,y2:`18`},child:[]}]})(e)}function ib(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polygon`,attr:{points:`23 7 16 12 23 17 23 7`},child:[]},{tag:`rect`,attr:{x:`1`,y:`5`,width:`15`,height:`14`,rx:`2`,ry:`2`},child:[]}]})(e)}function ab(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`},child:[]},{tag:`polyline`,attr:{points:`17 8 12 3 7 8`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`3`,x2:`12`,y2:`15`},child:[]}]})(e)}function ob(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`4 7 4 4 20 4 20 7`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`20`,x2:`15`,y2:`20`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`4`,x2:`12`,y2:`20`},child:[]}]})(e)}function sb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`23 4 23 10 17 10`},child:[]},{tag:`path`,attr:{d:`M20.49 15a9 9 0 1 1-2.12-9.36L23 10`},child:[]}]})(e)}function cb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`5`,x2:`12`,y2:`19`},child:[]},{tag:`line`,attr:{x1:`5`,y1:`12`,x2:`19`,y2:`12`},child:[]}]})(e)}function lb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polygon`,attr:{points:`5 3 19 12 5 21 5 3`},child:[]}]})(e)}function ub(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48`},child:[]}]})(e)}function db(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M9 18V5l12-2v13`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`18`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`18`,cy:`16`,r:`3`},child:[]}]})(e)}function fb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`19`,cy:`12`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`5`,cy:`12`,r:`1`},child:[]}]})(e)}function pb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`},child:[]},{tag:`path`,attr:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`},child:[]}]})(e)}function mb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]},{tag:`circle`,attr:{cx:`8.5`,cy:`8.5`,r:`1.5`},child:[]},{tag:`polyline`,attr:{points:`21 15 16 10 5 21`},child:[]}]})(e)}function hb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`2`,y:`2`,width:`20`,height:`20`,rx:`2.18`,ry:`2.18`},child:[]},{tag:`line`,attr:{x1:`7`,y1:`2`,x2:`7`,y2:`22`},child:[]},{tag:`line`,attr:{x1:`17`,y1:`2`,x2:`17`,y2:`22`},child:[]},{tag:`line`,attr:{x1:`2`,y1:`12`,x2:`22`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`2`,y1:`7`,x2:`7`,y2:`7`},child:[]},{tag:`line`,attr:{x1:`2`,y1:`17`,x2:`7`,y2:`17`},child:[]},{tag:`line`,attr:{x1:`17`,y1:`17`,x2:`22`,y2:`17`},child:[]},{tag:`line`,attr:{x1:`17`,y1:`7`,x2:`22`,y2:`7`},child:[]}]})(e)}function gb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`},child:[]},{tag:`polyline`,attr:{points:`14 2 14 8 20 8`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`13`,x2:`8`,y2:`13`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`17`,x2:`8`,y2:`17`},child:[]},{tag:`polyline`,attr:{points:`10 9 9 9 8 9`},child:[]}]})(e)}function _b(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`},child:[]},{tag:`polyline`,attr:{points:`7 10 12 15 17 10`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`15`,x2:`12`,y2:`3`},child:[]}]})(e)}function vb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`},child:[]},{tag:`path`,attr:{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`},child:[]}]})(e)}function yb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`16 18 22 12 16 6`},child:[]},{tag:`polyline`,attr:{points:`8 6 2 12 8 18`},child:[]}]})(e)}function bb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`polyline`,attr:{points:`12 6 12 12 16 14`},child:[]}]})(e)}function xb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`9 18 15 12 9 6`},child:[]}]})(e)}function Sb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`20 6 9 17 4 12`},child:[]}]})(e)}function Cb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`},child:[]},{tag:`polyline`,attr:{points:`3.27 6.96 12 12.01 20.73 6.96`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`22.08`,x2:`12`,y2:`12`},child:[]}]})(e)}function wb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`9`,x2:`12`,y2:`13`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`},child:[]}]})(e)}function Tb(e){return tb({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`22 12 18 12 15 21 9 3 6 12 2 12`},child:[]}]})(e)}function Eb(e){let t=Array.from(e?.files??[]).find(e=>e.type.startsWith(`image/`));if(t)return t;for(let t of Array.from(e?.items??[]))if(t.kind===`file`&&t.type.startsWith(`image/`)){let e=t.getAsFile?.();if(e)return e}return null}async function Db(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode.apply(null,t.subarray(e,e+32768));return`data:${e.type||`image/png`};base64,${btoa(n)}`}function Ob(e,t){return{fileName:e.name&&e.name!==`image.png`?e.name:`pasted-${new Date().toISOString().slice(0,19).replace(/[:T]/g,`-`)}.png`,mimeType:e.type||`image/png`,fileUrl:t,image_url:t,localPreview:!0,outputs:[{value:t}]}}function kb(e,t){return Eb(t)?!e||typeof e.matches!=`function`||!(e.isContentEditable||e.matches(`[contenteditable=true]`)):!1}var Ab=1600,jb=4194304,Mb=.85,Nb=Object.freeze([`image/png`,`image/jpeg`,`image/webp`]),Pb=`Up to 4 images per message`,Fb=`Attach a PNG, JPEG or WebP image`,Ib=`That image could not be attached`,Lb={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,webp:`image/webp`};function Rb(e){let t=String(e?.type??``).toLowerCase();return Nb.includes(t)?t:t?null:Lb[String(e?.name??``).toLowerCase().match(/\.([a-z0-9]+)$/)?.[1]]??null}function zb(e){return Array.from(e?.types??[]).includes(`Files`)}function Bb(e){let t=Array.from(e?.files??[]);if(!t.length){let n=Eb(e);n&&t.push(n)}let n=[],r=0;for(let e of t)Rb(e)?n.push(e):String(e?.type??``).startsWith(`image/`)&&(r+=1);return{images:n,unsupported:r}}function Vb(e){let t=String(e??``).slice(String(e??``).indexOf(`,`)+1);if(!t)return 0;let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`);return Math.max(0,Math.floor(t.length*3/4)-n)}function Hb(e,t,n=Ab){let r=Math.max(e,t);if(!Number.isFinite(r)||r<=0)return null;if(r<=n)return{width:Math.round(e),height:Math.round(t),scaled:!1};let i=n/r;return{width:Math.max(1,Math.round(e*i)),height:Math.max(1,Math.round(t*i)),scaled:!0}}function Ub(e=[],t=[],n=4){let r=Math.max(0,n-e.length);return{attachments:[...e,...t.slice(0,r)],rejected:Math.max(0,t.length-r)}}var Wb=32768,Gb=e=>{let t=``;for(let n=0;n<e.length;n+=Wb)t+=String.fromCharCode.apply(null,e.subarray(n,n+Wb));return btoa(t)};async function Kb(e,t){let n=new Uint8Array(await e.arrayBuffer());return`data:${t||e.type||`image/jpeg`};base64,${Gb(n)}`}function qb(e,t){if(typeof OffscreenCanvas==`function`)return new OffscreenCanvas(e,t);throw Error(`this browser cannot resize images — OffscreenCanvas is unavailable`)}function Jb(e){let t=e.indexOf(`,`),n=e.slice(5,e.indexOf(`;`)),r=atob(e.slice(t+1)),i=new Uint8Array(r.length);for(let e=0;e<r.length;e+=1)i[e]=r.charCodeAt(e);return new Blob([i],{type:n})}async function Yb(e,{decode:t=globalThis.createImageBitmap,makeCanvas:n=qb,toBlob:r=Jb,maxBytes:i=jb,maxDimension:a=Ab,quality:o=Mb}={}){if(Vb(e)<=i)return e;if(typeof t!=`function`)throw Error(`this browser cannot decode images — createImageBitmap is unavailable`);let s=await t(r(e));try{let e=Hb(s.width,s.height,a);if(!e)throw Error(`that image has no usable size`);let t=n(e.width,e.height),r=t.getContext(`2d`);if(!r)throw Error(`this browser cannot resize images — no 2D context`);return r.drawImage(s,0,0,e.width,e.height),await Kb(await t.convertToBlob({type:`image/jpeg`,quality:o}),`image/jpeg`)}finally{s?.close?.()}}function Xb(e){let t=String(e?.name??``).trim();return!t||t===`image.png`?`pasted-image.png`:t.slice(0,120)}async function Zb(e,t={}){let{readDataUrl:n=Db,...r}=t,i=Rb(e)??`image/png`,a=await n(e);return{dataUrl:await Yb(a.startsWith(`data:${i};`)?a:`data:${i};${a.slice(a.indexOf(`;`)+1)}`,r),name:Xb(e)}}var Qb=16384,$b=Object.freeze({entities:24,shots:8,assets:6,recentReceipts:3,jobs:8}),ex=Object.freeze([`inspect_studio`,`operate_studio`,`arrange_objects`,`arrange_characters`,`patch_elements`,`frame_shot`,`generate_motion`,`verify_result`,`undo_edit`]);Object.freeze({inspect_studio:`Read the scene`,operate_studio:`Selection and view`,arrange_objects:`Arrange objects`,arrange_characters:`Arrange characters`,patch_elements:`Edit properties`,frame_shot:`Frame the shot`,generate_motion:`Generate motion`,verify_result:`Verify the result`,undo_edit:`Undo an edit`});var tx=Object.freeze([`character`,`object`,`shot`,`stage`]),nx=Object.freeze({character:`cast`,object:`objects`,shot:`shot`,stage:`stage`}),rx=Object.freeze(`INVALID_ARGUMENT.INVALID_CONTEXT.INVALID_IDENTITY.INVALID_TURN_ID.INVALID_SESSION_ID.INVALID_RECEIPT.INVALID_RANGE.INVALID_REQUEST.UNKNOWN_TOOL.UNKNOWN_VARIANT.DUPLICATE_NAME.CONTEXT_LIMIT.CONTEXT_TOO_LARGE.AMBIGUOUS_TARGET.AMBIGUOUS_BASIS.TARGET_NOT_READY.TARGET_BUSY.STALE_TARGET.STALE_SCENE.STALE_ENVIRONMENT.STALE_CURSOR.CAPABILITY_MISSING.LIVE_HUB_UNAVAILABLE.AUTH_REQUIRED.RATE_LIMITED.BACKEND_UNAVAILABLE.VERIFICATION_FAILED.REPAIR_REGRESSED.CANCELLED.UNCERTAIN_APPLY.UNDO_CONFLICT`.split(`.`)),ix=sx({selectionKinds:[`scene`,`object`,`character`,`rig`,`camera`],modes:[`scene`,`camera`,`motion`],shotModes:[`keys`,`follow`,`rail`],framingSizes:[`extreme close-up`,`close-up`,`medium close-up`,`medium shot`,`medium-wide shot`,`wide shot`,`extreme wide shot`],framingViews:[`front`,`front three-quarter`,`profile`,`rear three-quarter`,`back`],framingLevels:[`ground`,`low`,`hip`,`eye`,`high`,`overhead`],framingSides:[`left`,`right`],positionSides:[`left`,`right`,`front`,`behind`],positionBases:[`world`,`subject`,`shot_camera`],collisionPolicies:[`report`,`avoid`],objectOps:[`create`,`update`,`remove`,`group`,`ungroup`],characterOps:[`create`,`update`,`remove`],inspectScopes:[`selection`,`scene`,`entities`,`shot`,`motion`,`catalogue`],receiptStatuses:[`applied`,`partial`,`noop`,`transient`,`installed`,`undone`],opStatuses:[`applied`,`partial`,`noop`],jobStates:[`queued`,`generating`,`preparing`,`verifying`,`repairing`,`committing`,`reconciling`,`installed`,`review_required`,`failed`,`cancelled`,`stale_target`,`stale_environment`]}),ax=class extends Error{constructor(e,t,n={}){super(t),this.name=`StudioProtocolError`,this.code=e,this.details=n}toJSON(){return{code:this.code,message:this.message,...Object.keys(this.details).length?{details:this.details}:{}}}},ox=e=>new TextEncoder().encode(e).byteLength;function sx(e){if(e&&typeof e==`object`&&!Object.isFrozen(e)){for(let t of Object.values(e))sx(t);Object.freeze(e)}return e}var J=(e,t,n=`$`,r={})=>{throw new ax(e,t,{path:n,...r})},cx=e=>typeof e==`object`&&!!e&&!Array.isArray(e),lx=(e=120)=>({type:`string`,minLength:1,maxLength:e}),ux=(e,t)=>({type:`number`,...e===void 0?{}:{minimum:e},...t===void 0?{}:{maximum:t}}),Y=(e=0,t=2**53-1)=>({...ux(e,t),type:`integer`}),X={type:`boolean`},Z=e=>({const:e}),dx=e=>({type:`string`,enum:e}),fx=e=>({oneOf:[e,{type:`null`}]}),px=(e,t,n=0,r=!1)=>({type:`array`,items:e,minItems:n,maxItems:t,...r?{uniqueItems:r}:{}}),Q=(e,t={})=>({type:`object`,properties:{...e,...t},required:Object.keys(e),additionalProperties:!1}),mx=(...e)=>({oneOf:e}),$={...lx(),pattern:`^[A-Za-z0-9][A-Za-z0-9._:-]*$`},hx={...lx(36),pattern:`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`},gx=Q({x:ux(),y:ux(),z:ux()}),_x={type:`number`,exclusiveMinimum:0},vx=Q({x:_x,y:_x,z:_x}),yx={...Q({startFrame:Y(),endFrameExclusive:Y(1)}),"x-studio-range":!0},bx=(e=100,t=1)=>px($,e,t,!0),xx=lx(120),Sx={workspaceId:$,documentEpoch:$,sceneId:$,sceneEpoch:$},Cx=Q(Sx),wx=Q({surface:Z(`studio`),...Sx,workspaceHandle:fx($)}),Tx=Q({scene:Y(),physics:Y(),view:Y()}),Ex=fx(Q({kind:dx(ix.selectionKinds),id:$},{hierarchyId:$})),Dx=Q({mode:dx(ix.modes),frame:Y(),playing:X,lookThrough:X,grid:X,autoColor:X}),Ox=mx(Q({world:gx}),Q({relativeTo:$,basis:dx(ix.positionBases),side:dx(ix.positionSides),gapM:ux(0),support:mx(Z(`floor`),Q({objectId:$}))}),Q({between:bx(2,2),fraction:ux(0,1),support:Z(`floor`)}),Q({onObject:$},{offsetXZ:Q({x:ux(),z:ux()})})),kx=mx(Q({yawDeg:ux()}),Q({towardId:$}),Q({sameAsId:$}),Q({awayFromId:$})),Ax=mx(Q({intent:Q({size:dx(ix.framingSizes),view:dx(ix.framingViews),level:dx(ix.framingLevels),side:dx(ix.framingSides)},{focalMm:_x})}),Q({exact:Q({position:gx,lookAt:gx,focalMm:_x})})),jx=mx(Q({op:Z(`create`),source:Q({kind:$}),position:Ox},{name:xx,facing:kx,scale:vx}),Q({op:Z(`update`),id:$},{position:Ox,facing:kx,rotationDeg:gx,scale:vx,color:lx(32),name:xx,hidden:X}),Q({op:Z(`remove`),id:$}),Q({op:Z(`group`),parentId:$,childIds:bx()}),Q({op:Z(`ungroup`),childIds:bx()})),Mx=mx(Q({op:Z(`create`),name:xx,position:Ox},{facing:kx,scale:_x}),Q({op:Z(`update`),characterId:$},{position:Ox,facing:kx,scale:_x,name:xx,hidden:X}),Q({op:Z(`remove`),characterId:$})),Nx=Q({kind:Z(`generate`),beats:px(Q({text:lx(2e3)},{seconds:ux(.5,60)}),8,1)},{durationSeconds:ux(2,60),seed:Y(-2147483648,2147483647)}),Px=mx(Nx,Q({kind:Z(`reuse`),artifactId:$})),Fx={...lx(2097152),pattern:`^data:image/[A-Za-z0-9.+-]+[;,]`},Ix=Q({startFrame:Y(),endFrame:Y(1),text:lx(2e3)},{id:$}),Lx=Q({frame:Y(),framing:Q({pos:gx,yaw:ux(),pitch:ux(),fovDeg:ux(1,179)})},{id:$}),Rx=fx(Q({points:px(gx,64,2)},{speed:ux(0,50),faceTravel:X,loop:X,extend:X})),zx={"character.pose":fx($),"character.identityImage":fx(Fx),"character.promptBlocks":px(Ix,64),"object.parent":fx($),"object.path":Rx,"stage.environmentImage":fx(Fx),"shot.cameraKeys":px(Lx,64),"shot.targetModel":fx($)};function Bx(e){if(Object.hasOwn(zx,e.path))return zx[e.path];if(e.type===`number`)return ux(e.min,e.max);if(e.type===`boolean`)return X;if(e.type===`enum`)return dx([...e.enum]);if(e.type===`id`)return $;if(e.type===`color`)return{...lx(32),pattern:`^#[0-9a-fA-F]{6}$`};if(e.type===`image`)return fx(Fx);if(e.type===`vec3`){let t=e.gizmo??e;return t.min&&typeof t.min==`object`&&t.max&&typeof t.max==`object`?Q({x:ux(t.min.x,t.max.x),y:ux(t.min.y,t.max.y),z:ux(t.min.z,t.max.z)}):gx}return e.type===`string`?lx(240):null}function Vx(e){return e.filter(e=>e.agentExposure===`patch`).map(({path:e,type:t,min:n,max:r,enum:i,gizmo:a,note:o})=>({path:e,type:t,...a?.min===void 0?n===void 0?{}:{min:n&&typeof n==`object`?{...n}:n}:{min:{...a.min}},...a?.max===void 0?r===void 0?{}:{max:r&&typeof r==`object`?{...r}:r}:{max:{...a.max}},...i?{enum:[...i]}:{},...o?{note:o}:{}}))}var Hx=sx(Vx(gm));function Ux(e){let t={};for(let n of tx){let r={};for(let t of e){if(t.agentExposure!==`patch`||!t.path.startsWith(`${n}.`))continue;let e=Bx(t);e&&(r[t.path.slice(n.length+1)]=e)}t[n]={type:`object`,properties:r,required:[],additionalProperties:!1}}return t}var Wx=sx(Ux(gm)),Gx=sx(Object.fromEntries(tx.map(e=>[e,Object.keys(Wx[e].properties).map(t=>`${e}.${t}`)]))),Kx=mx(Q({target:Q({kind:Z(`character`),id:$}),set:Wx.character}),Q({target:Q({kind:Z(`object`),id:$}),set:Wx.object}),Q({target:Q({kind:Z(`shot`)},{id:$}),set:Wx.shot}),Q({target:Q({kind:Z(`stage`)}),set:Wx.stage})),qx={inspect_studio:Q({scope:dx(ix.inspectScopes)},{ids:bx(32),query:xx,cursor:lx(512),limit:{...Y(1,32),default:12}}),operate_studio:Q({},{selection:Ex,shotId:$,frame:Y(),playing:X,mode:dx(ix.modes),view:Q({},{lookThrough:X,grid:X,autoColor:X})}),arrange_objects:Q({ops:px(jx,100,1)},{collisionPolicy:{...dx(ix.collisionPolicies),default:`report`}}),arrange_characters:Q({ops:px(Mx,8,1)}),patch_elements:Q({ops:px(Kx,32,1)}),frame_shot:Q({subjectIds:bx(1),framing:Ax},{shotId:$,keyAtFrame:Y()}),generate_motion:Q({characterId:$,source:Px},{repair:{...dx([`bounded`,`none`]),default:`bounded`}}),verify_result:Q({checks:px(dx([`placement`,`framing`,`motion`]),3,1,!0)},{receiptId:$,targets:bx(),range:mx(Z(`whole_clip`),yx),visual:{...dx([`none`,`frame`,`contact_sheet`]),default:`none`}}),undo_edit:Q({receiptId:$})};sx(qx);var Jx=sx(ex.map(e=>({name:e,slice:1,parameters:qx[e]}))),Yx=Q({min:gx,max:gx}),Xx=Q({id:$,kind:dx([`object`,`character`,`rig`]),token:$},{name:xx,detailsOmitted:X,position:gx,yawDeg:ux(),rotationDeg:gx,scale:mx(_x,vx),bounds:fx(Yx),libraryKind:$,renderer:$,parentId:fx($),attachment:fx(Q({characterId:$,bone:fx($)})),pathPointCount:Y(0,64),motion:Q({takeId:fx($),frames:Y(),ikKeyCount:Y(),promptBlockCount:Y()},{poseId:fx($),keyIds:bx(8,0)}),capabilities:Q({rigReady:X,ik:X,measuredFeet:X})}),Zx=Q({id:$,name:xx,range:yx,keyCount:Y()},{subjectIds:bx(24,0)}),Qx=Q({id:$,name:xx,range:yx,mode:dx(ix.shotModes)},{subjectIds:bx(24,0)}),$x=Q({position:gx,lookAt:gx,focalMm:_x,sensorId:$,slate:xx}),eS=Q({imageId:$,origin:dx([`user_attachment`,`scene_asset`,`capture`])},{name:xx}),tS=Q({id:$,characterId:$,state:dx(ix.jobStates)},{targetIds:bx(24,0),progress:fx(ux(0,1)),phase:xx}),nS=Q({schema:Z(`studio-context-v1`),host:wx,revision:Tx,units:Q({distance:Z(`m`),angle:Z(`deg`),up:Z(`+Y`),yawZero:Z(`+Z`),yawPositiveToward:Z(`+X`),pivot:Z(`base`),fps:Z(24),rangeEnd:Z(`exclusive`)}),scene:Q({name:xx,aspect:lx(40),floorY:ux(),frameCount:Y(),objectCount:Y(),characterCount:Y()}),selection:Ex,activeCharacterId:fx($),view:Dx,shot:fx(Qx),camera:fx($x),entities:px(Xx,24),entityPage:Q({returned:Y(0,24),total:Y(),truncated:X,nextCursor:fx(lx(512))}),shots:px(Zx,8),shotsTruncated:X,assets:px(eS,6),recentReceipts:px(Q({id:$,summary:xx,canUndoDirect:X}),3),jobs:px(tS,8),capabilities:Q({profile:Z(`studio-slice-1`),tools:px(dx(ex),9,0,!0)},{rigReady:X,cameraReady:X,bridgeReady:X})}),rS=Q({...Sx,targetId:$,token:$}),iS=[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],aS=Q({dataUrl:{...lx(6e6),pattern:`^data:image/(png|jpeg|webp);base64,`}},{name:lx(120)}),oS=Q({surface:Z(`studio`),sessionId:hx,turnId:hx,text:lx(16e3),context:nS},{model:lx(120),effort:dx(iS),attachFrame:X,attachments:px(aS,4,1)}),sS=Q({surface:Z(`studio`),sessionId:hx,turnId:hx},{jobId:$}),cS=Q({before:Y(),after:Y()}),lS=Q({historyEntryId:$,entries:Z(1),canUndoDirect:X}),uS=Q({characterId:$,beforeTakeId:fx($),takeId:$,targetToken:$,frameCount:Y(1),fps:Z(24),durationSeconds:_x,blocks:px(Q({sourceBeat:Y(0,7),startFrame:Y(),endFrameExclusive:Y(1)}),120,1),selectionChanged:Z(!1)}),dS=Q({id:$,status:dx([`verified`,`unverified`]),profile:Z(`studio-motion-v1`),range:yx,evaluatedFrames:Y(),physicsRevision:Y(),limitations:px(xx,12)},{surfaceMeasured:X,maxFloorPenetrationM:ux(0),maxContactSlipM:ux(0),maxContactFloatM:ux(0),unsupportedFrames:Y(),supportedCollisionFrames:Y(),continuityRegressed:X,semanticStatus:dx([`pending_image_review`,`passed`,`failed`,`unavailable`])}),fS=Q({path:lx(120)},{number:ux(),text:fx(lx(512)),flag:X,vec:gx,count:Y(),bytes:Y()}),pS=Q({},{position:gx,yawDeg:ux(),rotationDeg:gx,scale:mx(_x,vx),name:xx,color:lx(32),hidden:X,modelId:$,renderer:$,parentId:fx($),childIds:bx(100,0),removed:X,range:yx,camera:$x,keyId:$,frame:Y(),subjectIds:bx(24,0),selection:Ex,activeCharacterId:fx($),shotId:fx($),view:Dx,token:$,takeId:fx($),statureM:_x,patched:px(fS,32,1)}),mS=Q({coverage:xx},{relationSatisfied:X,overlapIds:bx(100,0),actualGapM:ux(),requestedGapM:ux(0),maximumFootprintOverlapM:ux(0),basis:dx(ix.positionBases),clipped:X,occluded:X,behindCamera:X,screenFraction:ux(0),derivedSize:dx(ix.framingSizes),support:xx,baseY:ux(),facesTargetId:$}),hS=Q({code:$},{id:$,message:xx,suggestedOutwardDeltaM:ux(),count:Y()}),gS={ok:Z(!0),commandId:$,receiptId:$,host:Cx,status:dx(ix.receiptStatuses),authored:X,revision:cS,affectedIds:bx(100,0),delta:px(Q({id:$,after:pS}),8),checks:mS,undo:fx(lS),warnings:px(hS,12)},_S={counts:Q({created:Y(),updated:Y(),deleted:Y()}),detailCursor:fx(lx(512))},vS=px(Q({index:Y(),status:dx(ix.opStatuses)},{droppedPaths:px(lx(120),32,1)}),32,1),yS={...gS,authored:Z(!0),undo:lS},bS={applied:Q({...yS,status:Z(`applied`)},{mutated:Z(!0),ops:vS,..._S}),partial:Q({...yS,status:Z(`partial`),ops:vS},{mutated:Z(!0),..._S}),noop:Q({...gS,status:Z(`noop`),authored:Z(!1),mutated:Z(!1),undo:Z(null)},{ops:vS}),transient:Q({...gS,status:Z(`transient`),authored:Z(!1),view:cS,undo:Z(null)},{mutated:X}),installed:Q({...yS,status:Z(`installed`),jobId:$,artifactId:$,installed:uS,verification:dS},{mutated:Z(!0),explicitUnverifiedAcceptance:X,repairs:Q({autoPhysicsInvocations:Y(0,1),fixCollisionsInvocations:Y(0,1),remaining:Y(0,2)}),..._S}),undone:Q({...yS,status:Z(`undone`),undoneReceiptId:$,restoredTargets:px(rS,100,1)},{mutated:Z(!0),..._S})},xS=mx(...Object.values(bS)),SS=Q({ok:Z(!1),commandId:$,host:Cx,code:dx(rx),phase:dx([`admission`,`execution`,`prepare`,`verify`,`repair`,`commit`,`reconcile`,`undo`]),affectedIds:bx(100,0),expectedTargets:px(rS,24),currentTargets:px(rS,24),mutated:mx(X,Z(`unknown`)),preserved:Q({authoredState:dx([`unchanged`,`changed`,`unknown`])}),recovery:Q({action:dx([`none`,`inspect`,`retry`,`new_intent`,`reconcile`,`sign_in`])},{retryAllowed:X})},{message:xx,candidates:px(Q({id:$,kind:dx([`object`,`character`,`rig`]),position:fx(gx)}),5)}),CS=sx({catalogue:Jx,variants:ix,Vec3:gx,FrameRange:yx,PositionSpec:Ox,FacingSpec:kx,ObjectOp:jx,CharacterOp:Mx,Framing:Ax,GenerateSource:Nx,Source:Px,Identity:Cx,Host:wx,TargetGuard:rS,Entity:Xx,ShotSummary:Zx,StudioContextV1:nS,StudioTurn:oS,StudioStop:sS,Receipt:xS,ReceiptVariants:bS,Failure:SS});function wS(e,t,n=`INVALID_ARGUMENT`,r=`$`){if(e.oneOf){let i=[],a=[];for(let o of e.oneOf)try{i.push(wS(o,t,n,r))}catch(e){if(!(e instanceof ax))throw e;a.push({branch:o,error:e})}if(i.length===0&&a.length){let e=cx(t)&&cx(t.target)?t.target.kind:void 0;throw(e!==void 0&&a.find(({branch:t})=>t.properties?.target?.properties?.kind?.const===e)||a.reduce((e,t)=>t.error.details.path.length>e.error.details.path.length?t:e)).error}return i.length!==1&&J(n,`Expected exactly one supported variant.`,r),i[0]}if(Object.hasOwn(e,`const`))return t!==e.const&&J(n,`Invalid constant.`,r),t;if(e.type===`null`)return t!==null&&J(n,`Expected null.`,r),null;if(e.type===`object`){cx(t)||J(n,`Expected object.`,r);for(let i of Object.keys(t))Object.hasOwn(e.properties,i)||J(n,`Unexpected field.`,r);let i={};for(let[a,o]of Object.entries(e.properties))Object.hasOwn(t,a)?i[a]=wS(o,t[a],n,`${r}.${a}`):e.required.includes(a)?J(n,`Required field missing.`,`${r}.${a}`):Object.hasOwn(o,`default`)&&(i[a]=structuredClone(o.default));return e[`x-studio-range`]&&i.endFrameExclusive<=i.startFrame&&J(n,`Frame range must be nonempty and half-open.`,r),i}if(e.type===`array`){(!Array.isArray(t)||t.length<e.minItems||t.length>e.maxItems)&&J(n,`Array outside supported bounds.`,r);let i=t.map((t,i)=>wS(e.items,t,n,`${r}[${i}]`));return e.uniqueItems&&new Set(i.map(e=>JSON.stringify(e))).size!==i.length&&J(n,`Duplicate array member.`,r),i}if(e.type===`string`)return(typeof t!=`string`||!t.trim()||e.maxLength!==void 0&&[...t].length>e.maxLength||e.pattern&&!new RegExp(e.pattern).test(t))&&J(n,`Invalid or oversized string.`,r),e.enum&&!e.enum.includes(t)&&J(n,`Unsupported enum value.`,r),t;if(e.type===`boolean`)return typeof t!=`boolean`&&J(n,`Expected boolean.`,r),t;if(e.type===`number`||e.type===`integer`)return(typeof t!=`number`||!Number.isFinite(t)||e.type===`integer`&&!Number.isSafeInteger(t)||e.exclusiveMinimum!==void 0&&t<=e.exclusiveMinimum)&&J(n,`Number outside supported bounds.`,r),(e.minimum!==void 0&&t<e.minimum||e.maximum!==void 0&&t>e.maximum)&&J(n,`${r}: Expected a number within [${[e.minimum,e.maximum].filter(e=>e!==void 0).join(`, `)}].`,r),t;throw Error(`Unsupported internal Studio schema.`)}var TS=e=>wS(Cx,e,`INVALID_IDENTITY`),ES=e=>sx(wS(yx,e,`INVALID_RANGE`));function DS(e){return[...new Set([...[`object`,`character`,`rig`].includes(e.selection?.kind)?[e.selection.id]:[],...e.activeCharacterId?[e.activeCharacterId]:[],...e.shot?.subjectIds??[],...e.jobs.flatMap(e=>[e.characterId,...e.targetIds??[]])])]}function OS(e){let t=ox(JSON.stringify(e)??``);t>16384&&J(`CONTEXT_TOO_LARGE`,`Studio context exceeds 16 KiB.`,`$`,{bytes:t,maxBytes:Qb});let n=wS(nS,e,`INVALID_CONTEXT`),r=new Set(n.entities.map(e=>e.id));r.size!==n.entities.length&&J(`INVALID_CONTEXT`,`Duplicate entity ID.`);for(let e of DS(n))r.has(e)||J(`TARGET_NOT_READY`,`Mandatory target is absent from context.`);n.activeCharacterId&&!n.entities.some(e=>e.id===n.activeCharacterId&&e.kind===`character`)&&J(`INVALID_CONTEXT`,`Active target is not a character.`),[`object`,`character`,`rig`].includes(n.selection?.kind)&&!n.entities.some(e=>e.id===n.selection.id&&e.kind===n.selection.kind)&&J(`INVALID_CONTEXT`,`Selection kind disagrees with the selected entity.`),n.selection?.kind===`scene`&&n.selection.id!==n.host.sceneId&&J(`INVALID_CONTEXT`,`Selected scene is not the bound scene.`);for(let e of n.entities)e.bounds&&[`x`,`y`,`z`].some(t=>e.bounds.min[t]>e.bounds.max[t])&&J(`INVALID_CONTEXT`,`Inverted entity bounds.`),e.kind===`object`&&typeof e.scale==`number`&&J(`INVALID_CONTEXT`,`Objects use three-axis scale.`),e.kind!==`object`&&cx(e.scale)&&J(`INVALID_CONTEXT`,`Cast uses scalar scale.`);let i=n.entityPage;(i.returned!==n.entities.length||i.total<i.returned||i.truncated!==i.total>i.returned||(i.truncated?i.nextCursor===null:i.nextCursor!==null))&&J(`INVALID_CONTEXT`,`Entity pagination is inconsistent.`),n.view.frame>=Math.max(1,n.scene.frameCount)&&J(`INVALID_CONTEXT`,`Playhead is outside the scene.`),new Set(n.shots.map(e=>e.id)).size!==n.shots.length&&J(`INVALID_CONTEXT`,`Duplicate shot ID.`);for(let e of[...n.shots,...n.shot?[n.shot]:[]])e.range.endFrameExclusive>n.scene.frameCount&&J(`INVALID_CONTEXT`,`Shot is outside the scene.`);return n.shot&&!n.shots.some(e=>e.id===n.shot.id&&e.range.startFrame===n.shot.range.startFrame&&e.range.endFrameExclusive===n.shot.range.endFrameExclusive)&&J(`INVALID_CONTEXT`,`Current shot and range must survive projection.`),n}function kS(e,t){let n=wS(rS,e,`STALE_TARGET`),r=wS(rS,t,`STALE_TARGET`);return Object.keys(n).some(e=>n[e]!==r[e])&&J(`STALE_TARGET`,`Workspace, scene, epoch or target incarnation/content changed.`,`$`,{currentTargets:[r]}),!0}function AS(e){let t=e.beats.filter(e=>e.seconds!==void 0).length;(e.durationSeconds!==void 0&&t!==0||e.durationSeconds===void 0&&t!==e.beats.length)&&J(`INVALID_ARGUMENT`,`Use total duration or a duration for every beat, not mixed timing.`);let n=e.durationSeconds??e.beats.reduce((e,t)=>e+t.seconds,0);return(n<2||n>60||n/e.beats.length<.5)&&J(`INVALID_ARGUMENT`,`Generation must be 2-60 seconds with at least 0.5 seconds per beat.`),n}function jS(e){let t=new Set;for(let n of Array.isArray(e?.ops)?e.ops:[]){let e=cx(n)?n.target?.kind:void 0;if(tx.includes(e)){t.add(e);for(let t of cx(n.set)?Object.keys(n.set):[])Object.hasOwn(Wx[e].properties,t)||J(`INVALID_ARGUMENT`,`Unknown ${e} path "${e}.${t}". Valid ${e} paths: ${Gx[e].join(`, `)}.`)}}t.size>1&&J(`INVALID_ARGUMENT`,`One domain per patch: split character, object, shot and stage edits into separate commands.`)}function MS(e){(!cx(e)||!ex.includes(e.name))&&J(`UNKNOWN_TOOL`,`Unsupported Studio tool.`),e.name===`patch_elements`&&jS(e.args);let{args:t}=wS(Q({name:dx(ex),args:qx[e.name]}),e);if(e.name===`inspect_studio`&&t.ids&&t.query!==void 0&&J(`INVALID_ARGUMENT`,`IDs and query are exclusive.`),e.name===`operate_studio`&&(!Object.keys(t).length||t.view&&!Object.keys(t.view).length)&&J(`INVALID_ARGUMENT`,`Transient operation must specify an action.`),t.ops){let e=t.ops.filter(e=>e.op===`create`&&e.name!==void 0).map(e=>e.name.normalize(`NFC`).trim());new Set(e).size!==e.length&&J(`DUPLICATE_NAME`,`Create names must be unique; resolve existing targets by ID.`);for(let e of t.ops)e.op===`update`&&Object.keys(e).length===2&&J(`INVALID_ARGUMENT`,`Update has no fields.`),e.facing&&e.rotationDeg&&J(`INVALID_ARGUMENT`,`Facing and exact rotation are exclusive.`),e.op===`group`&&e.childIds.includes(e.parentId)&&J(`INVALID_ARGUMENT`,`Cannot group an object under itself.`),t.collisionPolicy===`avoid`&&(![`create`,`update`].includes(e.op)||!e.position?.relativeTo)&&J(`INVALID_ARGUMENT`,`Avoid requires a side-relative position for every operation.`)}if(e.name===`generate_motion`&&t.source.kind===`generate`&&(t.source.beats=t.source.beats.map(e=>({...e,text:e.text.trim().replace(/\s+/g,` `)})),AS(t.source)),e.name===`frame_shot`&&t.framing.exact&&JSON.stringify(t.framing.exact.position)===JSON.stringify(t.framing.exact.lookAt)&&J(`INVALID_ARGUMENT`,`Camera position and aim cannot coincide.`),e.name===`patch_elements`)for(let e of t.ops)Object.keys(e.set).length||J(`INVALID_ARGUMENT`,`Patch has no fields.`);return e.name===`verify_result`&&(!!t.receiptId==!!t.targets&&J(`INVALID_ARGUMENT`,`Exactly one of receiptId or targets is required.`),t.checks.includes(`motion`)&&t.range===void 0&&(t.range=`whole_clip`)),{name:e.name,args:t}}function NS(e){if(e?.ok===!1){let t=wS(SS,e,`INVALID_RECEIPT`);return ox(JSON.stringify(t))>8192&&J(`INVALID_RECEIPT`,`Failure receipt exceeds 8 KiB.`),(t.mutated===!1&&t.preserved.authoredState!==`unchanged`||t.mutated===!0&&t.preserved.authoredState!==`changed`||t.mutated===`unknown`&&(t.preserved.authoredState!==`unknown`||t.recovery.action!==`reconcile`||t.recovery.retryAllowed===!0))&&J(`INVALID_RECEIPT`,`Failure must preserve uncertainty and actual state evidence.`),sx(t)}let t=wS(xS,e,`INVALID_RECEIPT`);if(ox(JSON.stringify(t))>8192&&J(`INVALID_RECEIPT`,`Receipt exceeds 8 KiB; use a detail cursor.`),t.delta.some(e=>!t.affectedIds.includes(e.id)||!Object.keys(e.after).length)&&J(`INVALID_RECEIPT`,`Readback must identify affected targets and actual state.`),t.ops){let e=t.ops.some(e=>e.status===`partial`);t.ops.some((e,t)=>e.index!==t)&&J(`INVALID_RECEIPT`,`Operation results must report every operation in order.`),t.ops.some(e=>e.status===`partial`!=!!e.droppedPaths?.length)&&J(`INVALID_RECEIPT`,`A partial operation must name the paths the domain dropped, and only a partial one may.`),t.status===`applied`&&e&&J(`INVALID_RECEIPT`,`Applied status cannot hide a dropped path.`),t.status===`partial`&&!e&&J(`INVALID_RECEIPT`,`Partial status requires at least one dropped path.`),t.status===`noop`&&t.ops.some(e=>e.status===`applied`)&&J(`INVALID_RECEIPT`,`A noop cannot report an applied operation.`)}if(t.status===`noop`||t.status===`transient`?((t.authored||t.undo!==null||t.revision.before!==t.revision.after)&&J(`INVALID_RECEIPT`,`Non-authored operations cannot create history or advance authored revision.`),t.status===`noop`&&(t.mutated!==!1||t.delta.length)&&J(`INVALID_RECEIPT`,`Noop must prove no mutation.`),t.status===`transient`&&(!t.view||t.view.after<t.view.before||!t.delta.length)&&J(`INVALID_RECEIPT`,`Transient receipt requires view revisions and actual readback.`)):((!t.authored||!t.undo||t.revision.after!==t.revision.before+1||!t.affectedIds.length||!t.delta.length||t.mutated===!1)&&J(`INVALID_RECEIPT`,`Authored mutation requires one revision and one undo entry with actual readback.`),t.delta.length<t.affectedIds.length&&!t.detailCursor&&J(`INVALID_RECEIPT`,`Omitted batch readback requires a detail cursor.`)),t.status===`undone`&&(new Set(t.restoredTargets.map(e=>e.targetId)).size!==t.affectedIds.length||t.restoredTargets.some(e=>!t.affectedIds.includes(e.targetId)||Object.keys(Sx).some(n=>e[n]!==t.host[n])))&&J(`INVALID_RECEIPT`,`Undo must identify every restored target and its new token in the bound host.`),t.status===`installed`){(!t.jobId||!t.artifactId||!t.installed||!t.verification||!t.affectedIds.includes(t.installed.characterId))&&J(`INVALID_RECEIPT`,`Installation requires correlated target, artifact and verification evidence.`);let{frameCount:e,blocks:n}=t.installed,r=0;for(let e of n)(e.startFrame!==r||e.endFrameExclusive<=r||e.endFrameExclusive-r>120)&&J(`INVALID_RECEIPT`,`Installed schedule is not contiguous or bounded.`),r=e.endFrameExclusive;(r!==e||t.installed.durationSeconds!==e/24||t.verification.range.startFrame!==0||t.verification.range.endFrameExclusive!==e||t.verification.evaluatedFrames>e)&&J(`INVALID_RECEIPT`,`Installed schedule and verification coverage disagree.`),t.verification.status===`verified`&&t.verification.evaluatedFrames!==e&&J(`INVALID_RECEIPT`,`Verified motion requires whole-clip coverage.`),t.verification.status===`unverified`&&t.explicitUnverifiedAcceptance!==!0&&J(`INVALID_RECEIPT`,`Unverified installation requires explicit user acceptance.`)}else(t.installed||t.verification||t.jobId||t.artifactId||t.repairs||t.explicitUnverifiedAcceptance!==void 0)&&J(`INVALID_RECEIPT`,`Installation evidence is exclusive to installed receipts.`);return sx(t)}var PS=`cozyclay.workflow.agentPanel.width`,FS=1100,IS=`cozyclay.agent.session.studio`,LS=[`signed-out`,`signing-in`,`no-entitlement`,`ready`,`streaming`,`rate-limited`,`error`];function RS(e=globalThis.crypto){let t=e?.randomUUID?.();if(typeof t==`string`)return t;let n=new Uint8Array(16);e.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128;let r=[...n].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}var zS={queued:`Queued`,generating:`Generating`,preparing:`Preparing`,verifying:`Verifying`,repairing:`Repairing`,committing:`Installing`,reconciling:`Reconciling`,installed:`Installed`,review_required:`Needs review`,failed:`Failed`,cancelled:`Stopped`,stale_target:`Target changed`,stale_environment:`Scene changed`},BS=new Set([`installed`,`failed`,`cancelled`,`stale_target`,`stale_environment`]),VS=e=>BS.has(e),HS=e=>e===`installed`?`ok`:e===`review_required`?`warn`:VS(e)?`alert`:`busy`,US=e=>Number.isFinite(e)?`${Math.round(e*100)}%`:``;function WS(e){if(e?.status===`installed`){let{installed:t,verification:n}=e,r=n.status===`verified`?`verified over ${n.evaluatedFrames} frames`:`installed unverified`;return`Installed ${t.durationSeconds}s of motion on ${t.characterId} — ${r}`}return e?.status===`undone`?`Undid ${e.undoneReceiptId}`:e?.status===`noop`?`Nothing to change`:e?.status===`transient`?`Changed the view only`:`Applied to ${e?.affectedIds?.join(`, `)||`the scene`}`}function GS(e){let t=Array.isArray(e?.efforts)?e.efforts:[];if(!t.length)return[];let n=e.defaultEffort&&t.includes(e.defaultEffort)?e.defaultEffort:t[0];return[n,...t.filter(e=>e!==n)]}var KS=[`Block a two-shot conversation in this scene`,`Render this frame as a storyboard panel`,`Suggest a camera move for the current shot`],qS=[fp(`Block a two-shot`,`투샷 블로킹`),fp(`Frame the selected character`,`선택한 캐릭터 구도 잡기`),fp(`Light the set warmer`,`세트 조명 더 따뜻하게`)],JS=`Image generation uses about 3-5x a normal turn`,YS={describe_workflow:`Read canvas`,add_workflow_node:`Add node`,update_workflow_node:`Edit node`,remove_workflow_node:`Remove node`,connect_workflow_nodes:`Connect nodes`,disconnect_workflow_nodes:`Disconnect nodes`,run_workflow:`Run workflow`,set_workflow_node_output:`Set node output`,focus_workflow_node:`Focus node`,add_reference_node:`Add reference image`},XS={inspect_studio:fp(`Read the scene`,`장면 읽기`),operate_studio:fp(`Selection and view`,`선택과 뷰`),arrange_objects:fp(`Arrange objects`,`오브젝트 배치`),arrange_characters:fp(`Arrange characters`,`캐릭터 배치`),patch_elements:fp(`Edit properties`,`속성 편집`),frame_shot:fp(`Frame the shot`,`샷 구도 잡기`),generate_motion:fp(`Generate motion`,`모션 생성`),verify_result:fp(`Verify the result`,`결과 검증`),undo_edit:fp(`Undo an edit`,`편집 되돌리기`)},ZS=Object.freeze({workflow:Object.freeze({toolLabels:YS,toolBadge:`Canvas`,suggestions:KS,imageHint:JS,imageEntitlement:!0,steer:!0,history:!0,persistWidth:!0,emptyTitle:`Direct the scene`,emptyHint:e=>`Ask for blocking, a camera move, or a rendered frame from \u201C${e}\u201D.`,composerPlaceholder:`Ask the agent to block, frame or render…`}),studio:Object.freeze({toolLabels:XS,toolBadge:fp(`Scene`,`장면`),suggestions:qS,imageHint:null,imageEntitlement:!1,steer:!1,history:!0,persistWidth:!1,emptyTitle:fp(`Direct the scene`,`장면을 연출하세요`),emptyHint:e=>fp(`Ask for blocking, a camera move, or a motion take in \u201C${e}\u201D.`,`\u201C${e}\u201D\uC5D0\uC11C \uBE14\uB85C\uD0B9, \uCE74\uBA54\uB77C \uC6C0\uC9C1\uC784, \uBAA8\uC158 \uD14C\uC774\uD06C\uB97C \uC694\uCCAD\uD558\uC138\uC694.`),composerPlaceholder:fp(`Ask the agent to block, frame or animate…`,`블로킹·구도·모션을 요청하세요…`)})});function QS(e){return Object.hasOwn(ZS,e)?ZS[e]:ZS.workflow}function $S(e,t=YS){return Object.hasOwn(t,e?.name)?t[e.name]:dC(e)}function eC(e){let t=Number(e);return Number.isFinite(t)?Math.min(560,Math.max(300,Math.round(t))):360}function tC(e=globalThis.localStorage){try{let t=e?.getItem(PS);return t==null||t===``?360:eC(t)}catch{return 360}}function nC(e,t=globalThis.localStorage){try{t?.setItem(PS,String(eC(e)))}catch{}}var rC=`cozyclay.agent.model`;function iC(e=globalThis.localStorage){try{let t=e?.getItem(rC);return typeof t==`string`&&t?t:null}catch{return null}}function aC(e,t=globalThis.localStorage){try{typeof e==`string`&&e&&t?.setItem(rC,e)}catch{}}function oC(e,t=iC()){let n=Array.isArray(e)?e:[];return n.some(e=>e?.id===t)?t:n[0]?.id??``}function sC(e,t){if(!e.length)return!0;let n=e.find(e=>e.models?.some(e=>e.key===t));return!n||n.signedIn}function cC(e,t,n){return n&&t.some(e=>e.id===n)&&sC(e,n)?n:oC(t.filter(t=>sC(e,t.id)))}function lC(e,t=Date.now()){if(!e)return null;let n=typeof e==`number`?e:Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.max(0,n-t),i=Math.round(r/1e3),a=Math.floor(i/3600),o=Math.floor(i%3600/60),s=i%60;return a>0?`${a}h ${String(o).padStart(2,`0`)}m`:o>0?`${o}m ${String(s).padStart(2,`0`)}s`:`${s}s`}var uC={capture_blocking_frame:{verb:`Capture`,target:`blocking frame`},render_from_frame:{verb:`Render`,target:`from frame`},place_image_in_scene:{verb:`Place`,target:`image in scene`}};function dC(e){if(e?.label)return e.label;let t=uC[e?.name];if(t)return`${t.verb} ${t.target}`;let n=String(e?.name||`tool`).split(/[_\-\s]+/).filter(Boolean);if(!n.length)return`Run tool`;let r=n[0][0].toUpperCase()+n[0].slice(1);return n.length>1?`${r} ${n.slice(1).join(` `)}`:r}function fC(e){return!Number.isFinite(e)||e<0?``:e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}var pC={STEER_UNSUPPORTED:`This surface cannot steer a running turn.`,NO_ACTIVE_TURN:`That turn already ended — send it as a new message.`},mC={auth:`Your session expired. Sign in again to continue.`,entitlement:`This account cannot generate images.`,rate_limit:`You have hit the usage limit for this window.`,upstream:`The model service failed to answer.`,overloaded:`The model service is overloaded right now. Try again in a moment.`},hC=`Ready`,gC={auth:`session expired`,entitlement:`not on this plan`,rate_limit:`usage limit reached`,rate_limited:`usage limit reached`,overloaded:`service overloaded`,no_output:`no response`};function _C(e){if(!e)return`unknown error`;let t=gC[e.code];if(t)return t;let n=String(e.message??``).trim();return n?n.length>64?`${n.slice(0,63)}…`:n:String(e.code||`unknown error`)}function vC(e){let t=Number.isFinite(e)&&e>0?Math.floor(e/1e3):0;return t<60?`${t} s`:`${Math.floor(t/60)} m ${String(t%60).padStart(2,`0`)} s`}var yC=(e,t,n)=>({phase:e,kind:`live`,tone:`busy`,text:`${t} · ${vC(n)}`,ticking:!0});function bC(e,{now:t=Date.now(),toolLabel:n=dC}={}){let r=e?.items??[],i=r.find(e=>e.kind===`image`&&e.apply?.status===`applying`);if(i)return yC(`editor`,`Waiting for the editor…`,t-(i.apply.startedAt??t));if(e?.streaming){let i=t-(e.turnStartedAt??t),a=r.findLast(e=>e.kind===`job`&&!VS(e.state));if(a){let e=US(a.progress);return yC(`job`,`${zS[a.state]||a.state} motion${e?` ${e}`:``}`,i)}let o=r.findLast(e=>e.kind===`tool`&&e.status===`running`);return o?yC(`tool`,`Running ${n(o)}…`,i):r.findLastIndex(e=>e.kind===`user`)===r.length-1?yC(`sending`,`Sending…`,i):yC(`thinking`,`Thinking…`,i)}let a=e?.lastTurn;return a&&t-a.endedAt<6e3?a.status===`stopped`?{phase:`stopped`,kind:`terminal`,tone:`warn`,text:`Stopped`,ticking:!0}:a.status===`failed`?{phase:`failed`,kind:`terminal`,tone:`alert`,text:`Failed: ${_C(a.failure)}`,ticking:!0}:{phase:`done`,kind:`terminal`,tone:`ok`,text:`Done · ${vC(a.durationMs)}`,ticking:!0}:{phase:`idle`,kind:`idle`,tone:``,text:hC,ticking:!1}}function xC(e){let t=[],n=e.split(`
|
|
16
|
-
`),r=n.pop()??``;for(let e of n){let n=e.trim();if(!n.startsWith(`data:`))continue;let r=n.slice(5).trim();if(r)try{t.push(JSON.parse(r))}catch{}}return{events:t,tail:r}}var SC=``;function CC(e){return`${SC}${e}`}var wC=e=>typeof e==`string`&&/^[a-f0-9]{32}$/.test(e),TC=new Set([`aborted`,`auth`,`rate_limited`,`tool_failed`,`upstream`,`unknown`]),EC=(e,t)=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t)),DC=(e,t)=>{try{return e()}catch{return t}},OC=e=>DC(()=>e?.status===401||e?.code===`auth`?`auth`:e?.status===429||e?.code===`rate_limit`?`rate_limited`:`upstream`,`upstream`),kC=new Set([`auth`,`entitlement`,`rate_limit`,`overloaded`,`upstream`]);async function AC(e){let t=Number.isFinite(e?.status)?e.status:null,n=null;try{let t=await e.clone().json();n=typeof t?.error==`string`?{message:t.error}:t?.error&&typeof t.error==`object`?t.error:null}catch{}let r=typeof n?.message==`string`?n.message.trim():``,i=r?t!==null&&r.startsWith(`${t} `)?r:`${t??`Upstream`} — ${r}`:`The turn was refused with HTTP ${t??`error`}.`;return{code:kC.has(n?.code)?n.code:t===429?`rate_limit`:t===401?`auth`:`upstream`,message:i,...t===null?{}:{status:t},...n?.resetAt?{resetAt:n.resetAt}:{}}}function jC({surface:e,capture:t,now:n,correlationId:r=null}){let i=DC(()=>{let e=new Uint8Array(16);return globalThis.crypto.getRandomValues(e),[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``)},null),a=()=>DC(()=>{let e=n();return Number.isFinite(e)?e:NaN},NaN),s=r??i,c=a(),u=DC(()=>[`studio`,`workflow`].includes(e)?e:/^\/workflow(?:\/|$)/.test(globalThis.location?.pathname||``)?`workflow`:`studio`,`studio`),f=!1,p=!1,m=new Map,h=new Set,g=(e,n)=>{if(i)try{Promise.resolve(t(e,n)).catch(()=>{})}catch{}},_=(e,t)=>{if(!f){if(f=!0,e===`cancelled`)for(let[e,t]of m)h.has(e)||g(`agent:tool_executed`,{turn_id:i,tool_category:t.category,outcome:`cancelled`,duration_bucket:l(a()-t.startedAt)});m.clear(),g(`agent:turn_${e}`,{turn_id:i,duration_bucket:l(a()-c),...e===`succeeded`?{}:{failure_code:t}})}};return g(`agent:turn_requested`,{surface:u,turn_id:i}),{turnId:i,cancel:()=>_(`cancelled`,`aborted`),fail:e=>_(`failed`,TC.has(e)?e:`upstream`),frame(e){try{if(!i||f)return;if(e.type===`execution_tool_started`){if(!EC(e,[`type`,`turn_id`,`telemetry_id`,`tool_category`])||e.turn_id!==s||!wC(e.telemetry_id)||!d.includes(e.tool_category))return;!m.has(e.telemetry_id)&&!h.has(e.telemetry_id)&&m.set(e.telemetry_id,{category:e.tool_category,startedAt:a()});return}let{event:t,props:n}=e;if(n?.turn_id!==s)return;if(t===`agent:tool_executed`){if(!EC(e,[`type`,`event`,`props`,`telemetry_id`])||!wC(e.telemetry_id)||!EC(n,[`turn_id`,`tool_category`,`outcome`,`duration_bucket`])||!d.includes(n.tool_category)||![`succeeded`,`failed`,`cancelled`].includes(n.outcome)||!o.duration_bucket.has(n.duration_bucket)||h.has(e.telemetry_id))return;h.add(e.telemetry_id),m.delete(e.telemetry_id),g(t,{turn_id:i,tool_category:n.tool_category,outcome:n.outcome,duration_bucket:n.duration_bucket});return}if(!EC(e,[`type`,`event`,`props`]))return;if(t===`agent:result_applied`){!p&&EC(n,[`turn_id`])&&(p=!0,g(t,{turn_id:i}));return}if(![`agent:turn_succeeded`,`agent:turn_failed`,`agent:turn_cancelled`].includes(t))return;let r=t.slice(11),c=Object.hasOwn(n,`failure_code`);if(!EC(n,[`turn_id`,`duration_bucket`,...c?[`failure_code`]:[]])||!o.duration_bucket.has(n.duration_bucket)||c&&(r===`succeeded`||!TC.has(n.failure_code)))return;_(r,r===`cancelled`?`aborted`:n.failure_code||`unknown`)}catch{}}}}var MC=3,NC={anthropic:[`ANTHROPIC_API_KEY`],openai:[`OPENAI_API_KEY`],google:[`GEMINI_API_KEY`,`GOOGLE_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],cliproxy:[`CLIPROXY_API_KEY`]};function PC(e){let t=NC[e];return t?.length?t.join(` or `):`an environment variable`}function FC({fetchImpl:e=globalThis.fetch?.bind(globalThis),surface:t,capture:n=a,now:r=()=>performance.now()}={}){let i=new Map,o=async(t,n)=>{let r=await e(CC(t),{headers:{"content-type":`application/json`},...n});if(!r.ok){let e=null;try{e=await r.clone().json()}catch{}let n=typeof e?.error==`string`?e.error:e?.error?.message,i=Error(n||`${t} responded ${r.status}`);throw i.status=r.status,e?.error&&typeof e.error==`object`&&Object.assign(i,e.error),e?.preservation&&typeof e.preservation==`object`&&(i.preservation=e.preservation),i}return r.json()};return{mock:!1,async status(){return o(`/oauth/status`)},async signIn(){let e=await o(`/oauth/start`,{method:`POST`,body:`{}`});return e?.authorizeUrl&&globalThis.open?.(e.authorizeUrl,`_blank`,`noopener,noreferrer`),e},async signOut(){return o(`/oauth/logout`,{method:`POST`,body:`{}`})},async models(){let e=await o(`/agent/models`),t=Array.isArray(e?.models)?e.models:[];return{providers:Array.isArray(e?.providers)?e.providers.filter(e=>e?.id&&Array.isArray(e.models)):[],models:t}},async steer(e,t){return o(`/agent/turn/${encodeURIComponent(e)}/steer`,{method:`POST`,body:JSON.stringify(t)})},async providers(){let e=await o(`/agent/providers`);return Array.isArray(e?.providers)?e.providers:[]},async setProviderKey(e,t){return o(`/agent/providers/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify({key:t})})},async removeProviderKey(e){return o(`/agent/providers/${encodeURIComponent(e)}`,{method:`DELETE`})},async listSessions(){let e=await o(`/agent/sessions?surface=${encodeURIComponent(t||`studio`)}`);return Array.isArray(e?.sessions)?e.sessions:[]},async loadSession(e){return o(`/agent/sessions/${encodeURIComponent(e)}`)},async stop(e){let t=typeof e==`string`||!e?{sessionId:e}:{surface:`studio`,sessionId:e.sessionId,turnId:e.turnId,...e.jobId?{jobId:e.jobId}:{}};return i.get(t.sessionId)?.cancel(),o(`/agent/stop`,{method:`POST`,body:JSON.stringify(t)})},async acceptJob({jobId:e,sessionId:t,turnId:n}){return o(`/agent/jobs/${encodeURIComponent(e)}/accept`,{method:`POST`,body:JSON.stringify({surface:`studio`,sessionId:t,turnId:n,explicitUnverifiedAcceptance:!0})})},async image({prompt:e,imageDataUrl:t,referenceDataUrl:n,references:r,quality:i=`auto`},a){return o(`/agent/image`,{method:`POST`,body:JSON.stringify({prompt:e,imageDataUrl:t,...n?{referenceDataUrl:n}:{},...Array.isArray(r)&&r.length?{references:r}:{},quality:i}),signal:a})},async video(e,t){return o(`/agent/video`,{method:`POST`,body:JSON.stringify(e),signal:t})},async videoProviders(){return o(`/agent/video/providers`)},async turn(a,o,s){let{sessionId:c,text:l,attachFrame:u,model:d,effort:f,attachments:p}=a,m=Array.isArray(p)&&p.length?{attachments:p}:{},h=a.surface===`studio`,g=h?a.turnId:null,_=jC({surface:t,capture:n,now:r,correlationId:g});a.onTurnId?.(h?g:_.turnId),i.set(c,_);let v=()=>{s.reason===`agent-stop`&&_.cancel()};s?.addEventListener(`abort`,v,{once:!0}),s?.aborted&&v();let y=!1,b,x=0,S=!1,C=e=>{if(e?.type===`execution_telemetry`||e?.type===`execution_tool_started`){_.frame(e);return}if(h&&Number.isFinite(e?.eventSeq)){if(e.eventSeq<=x)return;x=e.eventSeq}e?.type===`error`&&(b=OC(e)),e?.type===`done`&&(S=!0),o(e)},w=async e=>{let t=e.body.getReader();y=!0;try{let e=new TextDecoder,n=``;for(;;){let{value:r,done:i}=await t.read();if(i)break;n+=e.decode(r,{stream:!0});let a=xC(n);n=a.tail;for(let e of a.events)C(e)}for(let e of xC(`${n}\n`).events)e?.type!==`execution_telemetry`&&e?.type!==`execution_tool_started`&&C(e)}finally{t.releaseLock()}},T=JSON.stringify(h?{surface:`studio`,sessionId:c,turnId:g,text:l,context:a.context,...d?{model:d}:{},...f?{effort:f}:{},...u===void 0?{}:{attachFrame:!!u},...m}:{sessionId:c,text:l,attachFrame:u,model:d,...f?{effort:f}:{},...m,..._.turnId?{turn_id:_.turnId}:{}});try{let t=await e(CC(`/agent/turn`),{method:`POST`,headers:{"content-type":`application/json`,accept:`text/event-stream`},body:T,signal:s});if(!t.ok||!t.body){_.fail(OC(t)),o({type:`error`,...await AC(t)}),o({type:`done`});return}let n=null;try{await w(t)}catch(e){n=e}for(let t=0;h&&g&&!S&&!s?.aborted&&t<MC;t+=1){let t;try{t=await e(CC(`/agent/turn/${encodeURIComponent(g)}/events?after=${x}`),{headers:{accept:`text/event-stream`},signal:s})}catch{break}if(!t?.ok||!t.body)break;n=null;try{await w(t)}catch(e){n=e}}if(n)throw n;b&&_.fail(b)}catch(e){throw!s?.aborted&&(!y||b)&&_.fail(b||OC(e)),e}finally{s?.removeEventListener(`abort`,v),i.get(c)===_&&i.delete(c)}}}}function IC(e=globalThis.location?.search||``){let t=new URLSearchParams(e);if(t.get(`agent`)!==`mock`)return null;let n=t.get(`state`);return{state:LS.includes(n)?n:`ready`,speed:Number(t.get(`speed`))||1}}var LC={signedIn:!0,email:`director@cozyclay.org`,plan:`Plus`,accountId:`acct_mock_126`,expiresAt:null},RC=[{delay:40,event:{type:`text.delta`,text:`Framing a wide two-shot from the current blocking. `}},{delay:120,event:{type:`text.delta`,text:`Capturing the viewport first.`}},{delay:120,event:{type:`tool.start`,callId:`call-1`,name:`capture_blocking_frame`,label:`Capture blocking frame`,args:{shot:`current`}}},{delay:260,event:{type:`tool.done`,callId:`call-1`,ok:!0,elapsedMs:268,result:{width:1280,height:720}}},{delay:90,event:{type:`tool.start`,callId:`call-2`,name:`render_from_frame`,label:`Render from frame`,args:{style:`storyboard`,strength:.6}}},{delay:420,event:{type:`tool.done`,callId:`call-2`,ok:!0,elapsedMs:1412,result:{imageId:`img-1`}}},{delay:80,event:{type:`image`,imageId:`img-1`,dataUrl:`data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22512%22%20height%3D%22288%22%20viewBox%3D%220%200%20512%20288%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22g%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%221%22%20y2%3D%221%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%232a2f52%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%235b3550%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Crect%20width%3D%22512%22%20height%3D%22288%22%20fill%3D%22url(%23g)%22%2F%3E%3Ccircle%20cx%3D%22150%22%20cy%3D%22150%22%20r%3D%2252%22%20fill%3D%22%23ef759d%22%20opacity%3D%220.85%22%2F%3E%3Crect%20x%3D%22250%22%20y%3D%22112%22%20width%3D%22180%22%20height%3D%22112%22%20rx%3D%2210%22%20fill%3D%22%238994ff%22%20opacity%3D%220.8%22%2F%3E%3Crect%20y%3D%22240%22%20width%3D%22512%22%20height%3D%2248%22%20fill%3D%22%23101116%22%20opacity%3D%220.55%22%2F%3E%3Ctext%20x%3D%2224%22%20y%3D%22272%22%20font-family%3D%22Inter%2Csans-serif%22%20font-size%3D%2218%22%20fill%3D%22%23edf0fb%22%3Emock%20render%20%C2%B7%20wide%20two-shot%3C%2Ftext%3E%3C%2Fsvg%3E`,width:512,height:288,prompt:`wide two-shot, storyboard ink`}},{delay:60,event:{type:`quota`,plan:`Plus`,primary:{usedPercent:46,windowMinutes:300,resetAt:null},credits:{has:!0}}},{delay:40,event:{type:`done`}}],zC={ok:!0,commandId:`cmd-mock-1`,receiptId:`receipt-mock-1`,host:{workspaceId:`tab-mock`,documentEpoch:`doc-mock`,sceneId:`scene-mock`,sceneEpoch:`scene-open-mock`},status:`applied`,authored:!0,revision:{before:41,after:42},affectedIds:[`char-a`],delta:[{id:`char-a`,after:{position:{x:-.8,y:0,z:.4}}}],checks:{coverage:`affected-targets`},undo:{historyEntryId:`history-mock-1`,entries:1,canUndoDirect:!0},warnings:[]},BC=[{delay:40,event:{type:`text.delta`,text:`Reading the scene before I move anyone. `}},{delay:120,event:{type:`tool.start`,callId:`studio-1`,name:`inspect_studio`,label:`inspect studio`,args:{scope:`selection`}}},{delay:220,event:{type:`tool.done`,callId:`studio-1`,ok:!0,elapsedMs:214,result:{entities:2}}},{delay:90,event:{type:`text.delta`,text:`Blocking the two-shot now.`}},{delay:120,event:{type:`tool.start`,callId:`studio-2`,name:`arrange_characters`,label:`arrange characters`,args:{ops:[{op:`update`,characterId:`char-a`,position:{world:{x:-.8,y:0,z:.4}}}]}}},{delay:320,event:{type:`tool.done`,callId:`studio-2`,ok:!0,elapsedMs:332,result:{ok:!0,receiptId:zC.receiptId}}},{delay:60,event:{type:`receipt`,receipt:zC}},{delay:40,event:{type:`done`}}],VC=[[`openai-codex`,`ChatGPT (OpenAI Codex)`],[`anthropic`,`Anthropic`],[`openai`,`OpenAI`],[`google`,`Google Gemini`],[`openrouter`,`OpenRouter`],[`cliproxy`,`CLIProxyAPI`]],HC=`google`,UC={"openai-codex":[{id:`gpt-6-astra`,label:`gpt-6-astra`,efforts:[`none`,`low`,`medium`,`high`,`xhigh`],defaultEffort:`medium`},{id:`gpt-5.1-codex`,label:`gpt-5.1-codex`,efforts:[`low`,`medium`,`high`],defaultEffort:`medium`}],anthropic:[{id:`claude-sonnet-4-5`,label:`Claude Sonnet 4.5`,efforts:[`none`,`low`,`medium`,`high`],defaultEffort:`medium`}],openai:[{id:`gpt-5.1`,label:`GPT-5.1`,efforts:[`none`,`low`,`medium`,`high`,`xhigh`],defaultEffort:`medium`}],google:[{id:`gemini-3-pro`,label:`Gemini 3 Pro`,efforts:[`none`,`low`,`medium`,`high`],defaultEffort:`medium`}],openrouter:[{id:`deepseek-v3`,label:`DeepSeek V3`,efforts:[`none`],defaultEffort:`none`}],cliproxy:[{id:`claude-sonnet-5`,label:`Claude Sonnet 5`,efforts:[`none`,`low`,`medium`,`high`],defaultEffort:`medium`}]},WC={id:`gpt-6-live-preview`,label:`gpt-6 live preview`,efforts:[`none`,`low`,`medium`,`high`],defaultEffort:`high`},GC=`cozyclay.mock.agent.status-calls`,KC=`cozyclay.mock.agent.model-calls`,qC=e=>{try{globalThis.localStorage?.setItem(e,String(Number(globalThis.localStorage.getItem(e)||0)+1))}catch{}};function JC(e={state:`ready`}){let t=e?.state||`ready`,n=e?.surface===`studio`,r=e?.speed>0?e.speed:1,i=e=>new Promise(t=>setTimeout(t,Math.max(0,e/r))),a=new Set,o=t===`signed-out`?`out`:t===`signing-in`?`pending`:`in`,s=()=>VC.map(([e,t])=>{let n=e===`openai-codex`?o===`in`?`chatgpt`:null:e===HC?`env`:a.has(e)?`file`:null;return{id:e,label:t,authSource:n,signedIn:!!n}}),c=null,l=0;return{mock:!0,state:t,async status(){qC(GC);let e=s().filter(e=>e.id!==`openai-codex`&&e.signedIn).length;return o===`pending`?{signedIn:!1,pending:!0,email:null,plan:null,accountId:null,expiresAt:null,providersConfigured:a.size}:o===`out`?{signedIn:!1,email:null,plan:null,accountId:null,expiresAt:null,providersConfigured:a.size}:t===`no-entitlement`?{...LC,plan:`Free`,entitlements:{image:!1},providersConfigured:e}:{...LC,entitlements:{image:!0},providersConfigured:e}},async signIn(){return o=`in`,{ok:!0,authorizeUrl:`https://auth.example.invalid/mock`}},async signOut(){return o=`out`,{ok:!0}},async models(){qC(KC);let e=s().map(e=>{let t=UC[e.id]??[],n=e.id===`openai-codex`&&o===`in`?[...t,WC]:t;return{...e,models:n.map(t=>({...t,key:`${e.id}/${t.id}`,input:[`text`,`image`]}))}});return{providers:e,models:e.flatMap(e=>e.models.map(e=>({...e,id:e.key})))}},async providers(){return s()},async setProviderKey(e,t){if(e===`openai-codex`)throw Object.assign(Error(`Use ChatGPT sign-in for OpenAI Codex.`),{status:400});if(typeof t!=`string`||t.trim().length<8)throw Object.assign(Error(`That key was refused: it is too short.`),{status:400});return a.add(e),{ok:!0}},async removeProviderKey(e){return a.delete(e),{ok:!0}},async stop(){return c=null,{ok:!0}},async steer(e,t){if(n)throw Object.assign(Error(`409 — Steering a Studio turn is not supported.`),{status:409,code:`STEER_UNSUPPORTED`});if(!c||e!==c)throw Object.assign(Error(`409 — This turn already ended.`),{status:409,code:`NO_ACTIVE_TURN`});try{globalThis.localStorage?.setItem(`cozyclay.mock.agent.last-steer`,JSON.stringify({turnId:e,text:t?.text??null,attachments:t?.attachments?.length??0}))}catch{}return{ok:!0,queued:!0}},async acceptJob(){return{ok:!0}},async listSessions(){if(!n)return[];let e=[];try{for(let t=0;t<globalThis.localStorage.length;t+=1){let n=globalThis.localStorage.key(t);if(!n?.startsWith(`cozyclay.mock.agent.session.`))continue;let r=JSON.parse(globalThis.localStorage.getItem(n));r?.meta&&e.push(r.meta)}}catch{}return e.sort((e,t)=>Date.parse(t.updatedAt||0)-Date.parse(e.updatedAt||0)).slice(0,50)},async loadSession(e){try{let t=JSON.parse(globalThis.localStorage.getItem(`cozyclay.mock.agent.session.${e}`));if(t?.transcript)return t}catch{}throw Error(`Mock session not found.`)},async applyImage({requestId:e}){return{ok:!0,receiptId:`mock-${e}`}},async turn(e,r,a){let o=`mock-turn-${++l}`;c=o,e?.onTurnId?.(o);try{globalThis.localStorage?.setItem(`cozyclay.mock.agent.last-turn`,JSON.stringify({turnId:o,model:e?.model??null,effort:e?.effort??null,text:e?.text??null}))}catch{}try{n&&e?.sessionId&&globalThis.localStorage?.setItem(`cozyclay.mock.agent.last-turn-session`,e.sessionId)}catch{}let s=[],u=n&&e?.sessionId?`cozyclay.mock.agent.session.${e.sessionId}`:null;if(u){try{s=JSON.parse(globalThis.localStorage.getItem(u))?.transcript||[]}catch{s=[]}s.push({kind:`user`,text:e.text})}let d=t=>{if(u){if(t.type===`text.delta`){let e=s.at(-1);e?.kind===`assistant`?e.text+=t.text:s.push({kind:`assistant`,text:t.text})}else if(t.type===`tool.start`)s.push({kind:`tool`,name:t.name,label:t.label,ok:!0,elapsedMs:null,callId:t.callId});else if(t.type===`tool.done`){let e=[...s].reverse().find(e=>e.kind===`tool`&&e.callId===t.callId);e&&Object.assign(e,{ok:t.ok,elapsedMs:t.elapsedMs})}else t.type===`receipt`&&s.push({kind:`receipt`,receiptId:t.receipt?.receiptId,summary:t.receipt?.status===`applied`?`Applied to the scene`:`Receipt`});try{globalThis.localStorage.setItem(u,JSON.stringify({sessionId:e.sessionId,transcript:s,meta:{sessionId:e.sessionId,surface:`studio`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),sceneName:`Mock scene`,firstText:s.find(e=>e.kind===`user`)?.text||``}}))}catch{}}r(t)};if(t===`rate-limited`){d({type:`text.delta`,text:`Framing a wide two-shot from the current blocking.`}),d({type:`quota`,plan:`Plus`,primary:{usedPercent:100,windowMinutes:300,resetAt:new Date(Date.now()+252e4).toISOString()},credits:{has:!1}}),d({type:`error`,code:`rate_limit`,message:mC.rate_limit,resetAt:new Date(Date.now()+252e4).toISOString()}),d({type:`done`}),c=null;return}if(t===`error`){d({type:`text.delta`,text:n?`Reading the scene first.`:`Capturing the viewport first.`}),d(n?{type:`tool.start`,callId:`call-1`,name:`inspect_studio`,label:`inspect studio`,args:{scope:`selection`}}:{type:`tool.start`,callId:`call-1`,name:`capture_blocking_frame`,label:`Capture blocking frame`,args:{shot:`current`}}),d({type:`tool.done`,callId:`call-1`,ok:!1,elapsedMs:812,error:n?`The scene is not ready`:`Viewport is not ready`}),d({type:`error`,code:`upstream`,message:mC.upstream}),d({type:`done`}),c=null;return}for(let e of n?BC:RC){if(a?.aborted||(await i(e.delay),a?.aborted))break;d(e.event)}c=null,await i(240),a?.aborted&&d({type:`done`})}}}function YC(e={}){let t=e.mockConfig===void 0?IC():e.mockConfig;return t?JC({surface:e.surface,...t}):FC(e)}function XC(e){let t=e?.outcome;return t?.status===`already_applied`?null:t&&t.mutated===!1?{status:`not_applied`,code:t.code??`CANCELLED`,mutated:!1}:{status:`unknown`,code:t?.code??null,mutated:`unknown`}}function ZC(e){return new Promise(t=>{let n=r=>{r.detail?.requestId===e.requestId&&(globalThis.removeEventListener(`cozyclay:agent-image-result`,n),t({ok:!!r.detail.ok,error:r.detail.error,receiptId:r.detail.receiptId}))};globalThis.addEventListener?.(`cozyclay:agent-image-result`,n),!(globalThis.dispatchEvent&&!globalThis.dispatchEvent(new CustomEvent(`cozyclay:agent-image`,{cancelable:!0,detail:e})))&&(globalThis.removeEventListener?.(`cozyclay:agent-image-result`,n),t({ok:!1,error:`No editor accepted the image. Open the scene that should receive it.`}))})}function QC({transport:e,surface:t=`workflow`,buildContext:n=null,requestImageAction:r=null,onAuthLost:i=null,onReceipt:a=null,newId:o=RS,clock:s=()=>Date.now()}={}){let c=t===`studio`,l=new Set,u=new Set,d=new Set,f=null,p=null,m=null,h={sessionId:o(),turnId:null,draft:``,pendingAttachments:[],items:[],streaming:!1,quota:null,rateLimit:null,lastPrompt:``,turnStartedAt:null,lastTurn:null},g=e=>{h={...h,...e};for(let e of[...l])e(h)},_=e=>g({items:e(h.items)}),v=(e,t)=>_(n=>n.map(n=>e(n)?{...n,...t}:n)),y=e=>h.items.find(t=>t.kind===`job`&&t.jobId===e);function b(e){if(!e?.jobId||!ix.jobStates.includes(e.state))return;let t=typeof e.progress==`number`&&Number.isFinite(e.progress)?Math.min(1,Math.max(0,e.progress)):null;_(n=>{let r=n.find(t=>t.kind===`job`&&t.jobId===e.jobId),i={kind:`job`,id:r?.id??`job:${e.jobId}`,jobId:e.jobId,commandId:e.commandId??r?.commandId??null,state:e.state,phase:typeof e.phase==`string`?e.phase:r?.phase??null,progress:t??r?.progress??null,verification:r?.verification??null,receiptId:r?.receiptId??null,outcome:r?.outcome??null,acceptance:e.state===`review_required`?r?.acceptance??{status:`required`}:r?.acceptance??null};return r?n.map(e=>e===r?i:e):[...n,i]})}function x(e){let t;try{t=NS(e)}catch(e){_(t=>[...t,{kind:`failure`,id:o(),failure:{code:e?.code||`INVALID_RECEIPT`,message:e?.message||`The host returned an unreadable receipt.`,preserved:{authoredState:`unknown`},recovery:{action:`inspect`}}}]);return}if(t.ok===!1){let e=`failure:${t.commandId}:${t.code}`;if(u.has(e))return;u.add(e),_(n=>[...n.map(e=>e.kind===`job`&&e.commandId===t.commandId&&!VS(e.state)?{...e,state:`failed`,phase:t.phase,acceptance:null}:e),{kind:`failure`,id:e,failure:t}]);return}if(!u.has(t.receiptId)){u.add(t.receiptId),_(e=>[...e.map(e=>e.kind===`job`&&e.jobId===t.jobId?{...e,state:t.status===`installed`?`installed`:e.state,verification:t.verification??null,receiptId:t.receiptId,acceptance:t.explicitUnverifiedAcceptance?{status:`accepted`}:null}:e),{kind:`receipt`,id:`receipt:${t.receiptId}`,receiptId:t.receiptId,receipt:t,summary:WS(t)}]);try{a?.(t)}catch{}}}function S(e){if(p&&[`text.delta`,`tool.start`,`tool.done`,`image`,`job.state`,`job.progress`,`receipt`,`error`].includes(e?.type)&&(p.produced=!0),e?.type===`text.delta`){_(t=>{let n=t[t.length-1];return n?.kind===`assistant`?[...t.slice(0,-1),{...n,text:n.text+e.text}]:[...t,{kind:`assistant`,id:o(),text:e.text}]});return}if(e?.type===`tool.start`){_(t=>[...t,{kind:`tool`,id:e.callId||o(),callId:e.callId,name:e.name,label:e.label,args:e.args,status:`running`}]);return}if(e?.type===`tool.done`){v(t=>t.kind===`tool`&&t.callId===e.callId,{status:e.ok?`done`:`failed`,elapsedMs:e.elapsedMs,result:e.result,error:e.error});let t=e.result;if(e.ok&&t&&typeof t==`object`&&t.ok===!0&&typeof t.receiptId==`string`&&Array.isArray(t.affectedIds))try{a?.(t)}catch{}return}if(e?.type===`image`){_(t=>[...t,{kind:`image`,id:e.imageId||o(),imageId:e.imageId,dataUrl:e.dataUrl,width:e.width,height:e.height,prompt:e.prompt,placed:!1,apply:null}]);return}if(e?.type===`job.state`||e?.type===`job.progress`){b(e);return}if(e?.type===`receipt`){x(e.receipt);return}if(e?.type===`quota`){g({quota:{plan:e.plan,usedPercent:e.primary?.usedPercent,windowMinutes:e.primary?.windowMinutes,resetAt:e.primary?.resetAt,credits:e.credits}});return}if(e?.type!==`error`)return;let t={code:e.code||`upstream`,message:e.message||mC[e.code]||`The turn failed.`,...Number.isFinite(e.status)?{status:e.status}:{}};if(p&&(p.failure=t),e.code===`rate_limit`){g({rateLimit:{resetAt:e.resetAt||null,message:e.message||mC.rate_limit}});return}if(e.code===`auth`){i?.();return}_(e=>{let n=e.findLastIndex(e=>e.kind===`user`),r=e.findLastIndex((e,t)=>t>n&&e.kind===`tool`&&e.status===`failed`);return r===-1?[...e,{kind:`failure`,id:o(),failure:{...t,recovery:{action:`retry`,retryAllowed:!0}}}]:e.map((e,n)=>n===r?{...e,failure:t}:e)})}function C(e,t,n){if(!e||d.has(e))return;d.add(e);let r=!!t?.ok,i={apply:{requestId:e,status:r?`settled`:`failed`,error:r?null:t?.error||`The editor did not apply the image.`,receiptId:t?.receiptId??null}};r&&(i.placed=n===`place`),v(t=>t.kind===`image`&&t.apply?.requestId===e,i)}async function w(e,t){let n=h.items.find(t=>t.kind===`image`&&t.id===e);if(!n||n.apply?.status===`applying`||(t===`place`?n.placed:!n.placed))return;let i=o();v(t=>t.kind===`image`&&t.id===e,{apply:{requestId:i,status:`applying`,error:null,receiptId:null,startedAt:s()}});let a={action:t,requestId:i,imageId:n.imageId,dataUrl:n.dataUrl,width:n.width,height:n.height,prompt:n.prompt};try{C(i,await(r??ZC)(a),t)}catch(e){C(i,{ok:!1,error:String(e?.message||e)},t)}}let T=()=>{u.clear(),d.clear(),g({sessionId:o(),turnId:null,items:[],pendingAttachments:[],rateLimit:null,lastPrompt:``,turnStartedAt:null,lastTurn:null})};return{getState:()=>h,subscribe(e){return l.add(e),()=>l.delete(e)},setDraft:e=>g({draft:String(e??``)}),addAttachments(e){let t=(Array.isArray(e)?e:[]).filter(e=>typeof e?.dataUrl==`string`&&e.dataUrl.startsWith(`data:image/`)).map(e=>({id:o(),dataUrl:e.dataUrl,...e.name?{name:String(e.name).slice(0,120)}:{}})),{attachments:n,rejected:r}=Ub(h.pendingAttachments,t,4),i=n.length-h.pendingAttachments.length;return g({pendingAttachments:n}),{added:i,rejected:r}},removeAttachment:e=>g({pendingAttachments:h.pendingAttachments.filter(t=>t.id!==e)}),clearAttachments:()=>g({pendingAttachments:[]}),async send(t,r={}){let i=String(t??``).trim();if(!i||h.streaming)return;let a=o(),l=c?n?.()??null:null;if(c&&!l){S({type:`error`,code:`upstream`,message:`The editor is not ready to describe the scene yet.`});return}let u=s(),d={produced:!1,failure:null};p=d;let v=(Array.isArray(r.attachments)?r.attachments:h.pendingAttachments).slice(0,4).map(({dataUrl:e,name:t})=>({dataUrl:e,...t?{name:t}:{}}));g({lastPrompt:i,rateLimit:null,turnId:a,streaming:!0,draft:``,pendingAttachments:[],turnStartedAt:u,lastTurn:null,items:[...h.items,{kind:`user`,id:o(),text:i,attachFrame:!!r.attachFrame,attachments:v}]}),f=new AbortController;let y=f.signal;try{await e.turn({onTurnId:e=>{m=e},...c?{surface:`studio`,turnId:a,context:l}:{},sessionId:h.sessionId,text:i,...v.length?{attachments:v}:{},attachFrame:!!r.attachFrame,model:r.model,effort:r.effort??void 0},S,y)}catch(e){y.aborted||S({type:`error`,code:`upstream`,message:String(e?.message||e)})}finally{if(f?.signal===y&&(f=null),p===d){m=null,!d.produced&&!d.failure&&!y.aborted&&(d.failure={code:`no_output`,message:`The turn ended without a response.`,recovery:{action:`retry`,retryAllowed:!0}},_(e=>[...e,{kind:`failure`,id:o(),failure:d.failure}]));let e=s();p=null,g({streaming:!1,turnStartedAt:null,lastTurn:{status:y.aborted?`stopped`:d.failure?`failed`:`done`,endedAt:e,durationMs:e-u,failure:d.failure}})}}},async steer(t,n={}){let r=String(t??``).trim();if(!r)return{ok:!1,code:`EMPTY`,message:``};if(!h.streaming||!m||typeof e.steer!=`function`)return{ok:!1,code:`NO_ACTIVE_TURN`,message:pC.NO_ACTIVE_TURN};let i=(Array.isArray(n.attachments)?n.attachments:h.pendingAttachments).slice(0,4).map(({dataUrl:e,name:t})=>({dataUrl:e,...t?{name:t}:{}}));try{await e.steer(m,{text:r,...i.length?{attachments:i}:{}})}catch(e){let t=typeof e?.code==`string`?e.code:`upstream`;return{ok:!1,code:t,message:pC[t]||String(e?.message||e)}}return g({draft:``,pendingAttachments:[],items:[...h.items,{kind:`user`,id:o(),text:r,steered:!0,attachments:i}]}),{ok:!0,code:null,message:``}},stop(){let t=[...h.items].reverse().find(e=>e.kind===`job`&&!VS(e.state));f?.abort(`agent-stop`),f=null;let n=c?{sessionId:h.sessionId,turnId:h.turnId,...t?{jobId:t.jobId}:{}}:h.sessionId;if(Promise.resolve(e.stop?.(n)).then(e=>{if(!t)return;let n=XC(e);n&&(v(e=>e.kind===`job`&&e.jobId===t.jobId&&!VS(e.state),{state:n.status===`not_applied`?`cancelled`:`reconciling`,phase:null,outcome:n,acceptance:null}),v(e=>e.kind===`tool`&&e.status===`running`,{status:`cancelled`,result:n,elapsedMs:null}))}).catch(()=>{}),!h.streaming){g({streaming:!1});return}let r=s();g({streaming:!1,turnStartedAt:null,lastTurn:{status:`stopped`,endedAt:r,durationMs:r-(h.turnStartedAt??r),failure:null}})},async acceptJob(t){let n=y(t);if(!(!n||n.acceptance?.status!==`required`)){v(e=>e.kind===`job`&&e.jobId===t,{acceptance:{status:`accepting`}});try{let n=await e.acceptJob?.({jobId:t,sessionId:h.sessionId,turnId:h.turnId});n?.receipt?x(n.receipt):v(e=>e.kind===`job`&&e.jobId===t,{acceptance:{status:`required`,error:`The host did not acknowledge the acceptance.`}})}catch(e){v(e=>e.kind===`job`&&e.jobId===t,{acceptance:{status:`required`,error:String(e?.message||e)}})}}},applyImage:e=>w(e,`place`),undoImage:e=>w(e,`remove`),acknowledgeImageAction:({requestId:e,ok:t,error:n,receiptId:r})=>{let i=h.items.find(t=>t.kind===`image`&&t.apply?.requestId===e);C(e,{ok:t,error:n,receiptId:r},i?.placed?`remove`:`place`)},clearRateLimit:()=>g({rateLimit:null}),clearContext:T,newSession:T,restore:(e,t=h.sessionId)=>{u.clear(),d.clear();let n=(Array.isArray(e)?e:[]).flatMap(e=>{if(e?.kind===`user`||e?.kind===`assistant`){let t=Array.isArray(e.attachments)?e.attachments.filter(e=>typeof e?.dataUrl==`string`):[];return[{kind:e.kind,id:o(),text:String(e.text??``),...t.length?{attachments:t}:{}}]}return e?.kind===`tool`?[{kind:`tool`,id:o(),callId:o(),name:e.name||`tool`,label:e.label,ok:e.ok,elapsedMs:e.elapsedMs,status:e.ok===!1?`failed`:`done`}]:e?.kind===`receipt`?[{kind:`receipt`,id:`receipt:${e.receiptId||o()}`,receiptId:e.receiptId,summary:e.summary||`Receipt`,receipt:{status:`applied`,warnings:[],verification:{status:`verified`}}}]:[]}),r=[...n].reverse().find(e=>e.kind===`user`)?.text||``;return g({sessionId:t,turnId:null,items:n,rateLimit:null,lastPrompt:r,turnStartedAt:null,lastTurn:null,streaming:!1}),n}}}function $C(e,t=Date.now()){let n=Date.parse(e||``);if(!Number.isFinite(n))return`just now`;let r=Math.max(0,Math.floor((t-n)/1e3));if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function ew({tone:e,title:t}){return(0,K.jsx)(`span`,{className:`agent-status-dot ${e}`,title:t,"aria-hidden":`true`})}function tw({call:e,presentation:t,onRetry:n}){let r=e.status===`running`?`busy`:[`failed`,`cancelled`].includes(e.status)?`alert`:`ok`,i=Object.hasOwn(t.toolLabels,e.name),a=e.error?`error: ${e.error}`:JSON.stringify(e.result??e.args??{},null,2);return(0,K.jsxs)(`div`,{className:`agent-card agent-tool-card${e.status===`failed`?` failed`:``}`,"data-tool-status":e.status,"data-tool-name":e.name,children:[(0,K.jsxs)(`details`,{children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(ew,{tone:r,title:e.status}),(0,K.jsx)(`span`,{className:`agent-tool-label`,children:$S(e,t.toolLabels)}),i&&(0,K.jsx)(`span`,{className:`agent-tool-badge`,children:t.toolBadge}),(0,K.jsx)(`span`,{className:`agent-tool-elapsed`,children:e.status===`running`?`running…`:e.status===`cancelled`?e.result?.status===`not_applied`?`not applied`:`result unknown`:fC(e.elapsedMs)}),(0,K.jsx)(xb,{size:12,"aria-hidden":`true`})]}),(0,K.jsx)(`pre`,{className:`agent-tool-detail`,children:a})]}),e.failure&&(0,K.jsxs)(`div`,{className:`agent-error`,role:`alert`,children:[(0,K.jsx)(`span`,{children:e.failure.message||mC[e.failure.code]||`The turn failed.`}),(0,K.jsxs)(`div`,{className:`agent-error-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`agent-ghost-button agent-error-retry`,onClick:n,children:`Retry`}),(0,K.jsx)(`button`,{type:`button`,className:`agent-ghost-button agent-error-details`,onClick:e=>{let t=e.currentTarget.closest(`.agent-tool-card`)?.querySelector(`details`);t&&(t.open=!t.open)},children:`Details`})]})]})]})}function nw({image:e,onUse:t,onUndo:n,onRegenerate:r,onOpen:i}){let a=e.apply?.status===`applying`,o=e.apply?.status===`failed`;return(0,K.jsxs)(`div`,{className:`agent-card agent-image-card`,"data-image-id":e.imageId,"data-placed":e.placed?`true`:`false`,"data-apply-status":e.apply?.status||`idle`,children:[(0,K.jsx)(`figure`,{children:(0,K.jsx)(`img`,{src:e.dataUrl,width:e.width,height:e.height,alt:e.prompt||`Generated image`,onClick:()=>i(e)})}),e.placed?(0,K.jsxs)(`div`,{className:`agent-placed`,children:[(0,K.jsx)(ew,{tone:`ok`}),`Placed`,(0,K.jsx)(`button`,{type:`button`,className:`agent-image-undo`,disabled:a,onClick:()=>n(e),children:a?`Removing…`:`Undo`})]}):(0,K.jsxs)(`div`,{className:`agent-image-actions`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`primary agent-image-use`,disabled:a,onClick:()=>t(e),children:[(0,K.jsx)(mb,{size:11}),` `,a?`Applying…`:`Use in scene`]}),(0,K.jsxs)(`a`,{className:`agent-image-download`,role:`button`,href:e.dataUrl,download:`${e.imageId||`agent-image`}.png`,children:[(0,K.jsx)(_b,{size:11}),` Download`]}),(0,K.jsxs)(`button`,{type:`button`,className:`agent-image-regenerate`,onClick:()=>r(e),children:[(0,K.jsx)(sb,{size:11}),` Regenerate`]})]}),o&&(0,K.jsx)(`p`,{className:`agent-image-error`,role:`alert`,children:e.apply.error})]})}function rw({resetAt:e,onRetry:t,onSwitchModel:n}){let[r,i]=(0,G.useState)(()=>Date.now());(0,G.useEffect)(()=>{let e=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(e)},[]);let a=lC(e,r);return(0,K.jsxs)(`div`,{className:`agent-paused`,"data-agent-card":`rate-limited`,role:`status`,children:[(0,K.jsxs)(`div`,{className:`agent-paused-head`,children:[(0,K.jsx)(bb,{size:12,"aria-hidden":`true`}),` Paused — usage limit reached`,(0,K.jsx)(`span`,{className:`agent-paused-countdown`,children:a?`resets in ${a}`:`resets soon`})]}),(0,K.jsx)(`p`,{style:{margin:0},children:mC.rate_limit}),(0,K.jsxs)(`div`,{className:`agent-paused-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`agent-paused-wait`,onClick:t,children:`Wait & retry`}),(0,K.jsx)(`button`,{type:`button`,className:`agent-paused-switch`,onClick:n,children:`Switch model`})]})]})}function iw({job:e,onStop:t,onAccept:n}){let r=!VS(e.state),i=r&&Number.isFinite(e.progress)?Math.round(e.progress*100):null,a=e.state===`installed`?null:e.phase,o=e.state===`review_required`||e.verification?.status===`unverified`,s=e.verification?.limitations??[];return(0,K.jsxs)(`div`,{className:`agent-card agent-job-card`,"data-job-id":e.jobId,"data-job-state":e.state,children:[(0,K.jsxs)(`div`,{className:`agent-job-head`,children:[(0,K.jsx)(ew,{tone:HS(e.state),title:e.state}),(0,K.jsx)(`span`,{className:`agent-job-label`,children:zS[e.state]||e.state}),o&&(0,K.jsx)(`span`,{className:`agent-job-badge`,children:`Unverified`}),i!==null&&(0,K.jsx)(`span`,{className:`agent-job-progress`,children:US(e.progress)})]}),a&&(0,K.jsx)(`p`,{className:`agent-job-phase`,children:a}),e.outcome?.status===`not_applied`&&(0,K.jsx)(`p`,{className:`agent-job-outcome`,children:`Not applied — scene unchanged.`}),e.outcome?.status===`unknown`&&(0,K.jsx)(`p`,{className:`agent-job-outcome`,children:`Stopped, but the result is unknown — reconcile before editing this target.`}),i!==null&&(0,K.jsx)(`div`,{className:`agent-job-bar`,role:`progressbar`,"aria-label":`Generation progress`,"aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:(0,K.jsx)(`span`,{className:`agent-job-bar-fill`,style:{transform:`scaleX(${e.progress})`}})}),s.length>0&&(0,K.jsx)(`ul`,{className:`agent-job-limits`,children:s.map(e=>(0,K.jsx)(`li`,{children:e},e))}),(0,K.jsxs)(`div`,{className:`agent-job-actions`,children:[r&&e.state!==`review_required`&&(0,K.jsx)(`button`,{type:`button`,className:`agent-ghost-button agent-job-stop`,onClick:()=>t(e),children:`Stop`}),e.acceptance?.status===`required`&&(0,K.jsxs)(`button`,{type:`button`,className:`agent-ghost-button agent-job-accept`,onClick:()=>n(e),children:[(0,K.jsx)(wb,{size:11}),` Apply with warnings`]}),e.acceptance?.status===`accepting`&&(0,K.jsx)(`span`,{className:`agent-job-note`,children:`Applying…`}),e.acceptance?.status===`accepted`&&(0,K.jsxs)(`span`,{className:`agent-job-note`,children:[(0,K.jsx)(Sb,{size:11}),` Applied at your request`]}),e.acceptance?.error&&(0,K.jsx)(`span`,{className:`agent-job-note alert`,role:`alert`,children:e.acceptance.error})]})]})}function aw({item:e}){let{receipt:t={},summary:n}=e,r=t.verification?.status===`unverified`,i=t.verification?.limitations??[],a=t.warnings??[];return(0,K.jsxs)(`div`,{className:`agent-card agent-receipt-card`,"data-receipt-id":e.receiptId,"data-receipt-status":t.status,children:[(0,K.jsxs)(`div`,{className:`agent-receipt-head`,children:[(0,K.jsx)(ew,{tone:r?`warn`:`ok`,title:t.status}),(0,K.jsx)(`span`,{className:`agent-receipt-summary`,children:n})]}),(a.length>0||i.length>0)&&(0,K.jsxs)(`ul`,{className:`agent-receipt-notes`,children:[a.map(e=>(0,K.jsx)(`li`,{children:e.message||e.code},e.code)),i.map(e=>(0,K.jsx)(`li`,{children:e},e))]})]})}var ow={none:`No recovery is available for this command.`,inspect:`Ask the agent to inspect the target before trying again.`,retry:`The same command can be retried.`,new_intent:`Tell the agent what to do with the changed target.`,reconcile:`The result is unknown; reconcile before changing this target.`,sign_in:`Sign in again to continue.`};function sw({failure:e,onRetry:t}){return(0,K.jsxs)(`div`,{className:`agent-card agent-failure-card`,"data-failure-code":e.code,role:`alert`,children:[(0,K.jsxs)(`div`,{className:`agent-failure-head`,children:[(0,K.jsx)(wb,{size:12,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`agent-failure-code`,children:e.code})]}),(0,K.jsx)(`p`,{className:`agent-failure-message`,children:e.message||`The command did not complete.`}),(0,K.jsxs)(`p`,{className:`agent-failure-recovery`,children:[ow[e.recovery?.action]||ow.none,e.preserved?.authoredState===`unchanged`?` Nothing in the scene changed.`:e.preserved?.authoredState===`unknown`?` Whether the scene changed is unknown.`:``]}),e.recovery?.retryAllowed&&(0,K.jsx)(`div`,{className:`agent-error-actions`,children:(0,K.jsx)(`button`,{type:`button`,className:`agent-ghost-button agent-error-retry`,onClick:t,children:`Retry`})})]})}function cw({provider:e,onSave:t,onRemove:n}){let[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),l=e.authSource===`env`,u=e.authSource===`file`,d=`set by ${PC(e.id)}`,f=`agent-key-${e.id}`,p=async e=>{o(!0),c(``);try{await e(),i(``)}catch(e){c(e?.message||`The sidecar refused that key.`)}finally{o(!1)}};return(0,K.jsxs)(`div`,{className:`agent-key-row`,"data-provider":e.id,"data-provider-source":e.authSource||`none`,"data-provider-signed-in":e.signedIn?`true`:`false`,children:[(0,K.jsxs)(`div`,{className:`agent-key-head`,children:[(0,K.jsx)(ew,{tone:e.signedIn?`ok`:``,title:e.signedIn?`key configured`:`no key`}),(0,K.jsx)(`label`,{className:`agent-key-label`,htmlFor:f,children:e.label}),(0,K.jsx)(`span`,{className:`agent-key-source`,children:l?`environment`:u?`saved on this machine`:`no key`})]}),(0,K.jsxs)(`div`,{className:`agent-key-controls`,children:[(0,K.jsx)(`input`,{id:f,className:`agent-key-input`,type:`password`,autoComplete:`off`,spellCheck:`false`,"aria-label":`${e.label} API key`,placeholder:l?d:e.signedIn?`Replace key`:`Paste API key`,disabled:l||a,value:r,onChange:e=>{i(e.target.value),c(``)}}),(0,K.jsx)(`button`,{type:`button`,className:`agent-key-save`,disabled:l||a||!r.trim(),onClick:()=>p(()=>t(e.id,r)),children:`Save`}),u&&(0,K.jsx)(`button`,{type:`button`,className:`agent-ghost-button agent-key-remove`,disabled:a,onClick:()=>p(()=>n(e.id)),children:`Remove`})]}),s&&(0,K.jsx)(`p`,{className:`agent-key-error`,role:`alert`,children:s})]})}function lw({transport:e=null,sceneName:t=`CozyClay Scene`,defaultCollapsed:n=!1,onCollapsedChange:r=null,embedded:i=!1,hidden:a=!1,surface:o=`workflow`,buildContext:s=null,onImageAction:c=null,onFalAction:l=null,onReceipt:u=null}){let d=(0,G.useMemo)(()=>QS(o),[o]),f=(0,G.useMemo)(()=>e||YC({surface:o}),[e,o]),p=f.mock?f.state:null,[m,h]=(0,G.useState)(n),[g,_]=(0,G.useState)(()=>d.persistWidth?tC():360),[v,y]=(0,G.useState)(!1),[b,x]=(0,G.useState)(!1),[S,C]=(0,G.useState)(null),[w,T]=(0,G.useState)(`loading`),[E,D]=(0,G.useState)([]),[O,ee]=(0,G.useState)([]),[k,te]=(0,G.useState)(``),[ne,re]=(0,G.useState)(`loading`),[ie,ae]=(0,G.useState)(null),A=(0,G.useMemo)(()=>GS(E.find(e=>e.id===k)),[E,k]),j=(0,G.useCallback)(e=>{te(e),ae(null),aC(e)},[]),oe=(0,G.useCallback)(e=>{let t=Array.isArray(e?.models)?e.models:[];if(!t.length)return!1;let n=Array.isArray(e?.providers)?e.providers:[];return ee(n),D(t),te(e=>cC(n,t,e)),re(`ready`),!0},[]),[se,ce]=(0,G.useState)(!1),[le,ue]=(0,G.useState)(null),[de,fe]=(0,G.useState)(!1),[pe,me]=(0,G.useState)(null),[he,ge]=(0,G.useState)(()=>!i&&(globalThis.innerWidth||1440)<1100),[_e,ve]=(0,G.useState)(!1),[ye,be]=(0,G.useState)(!1),[xe,Se]=(0,G.useState)([]),[Ce,we]=(0,G.useState)(`loading`),[Te,Ee]=(0,G.useState)([]),[De,Oe]=(0,G.useState)(``),[ke,Ae]=(0,G.useState)(``),[je,Me]=(0,G.useState)(o!==`studio`),Ne=(0,G.useRef)(null),Pe=(0,G.useRef)(null),Fe=(0,G.useRef)(s);Fe.current=s;let Ie=(0,G.useRef)(c);Ie.current=c;let Le=(0,G.useRef)(l);Le.current=l;let Re=(0,G.useRef)(u);Re.current=u;let ze=(0,G.useMemo)(()=>QC({transport:f,surface:o,buildContext:()=>Fe.current?.()??null,requestImageAction:e=>(Ie.current??f.applyImage?.bind(f)??ZC)(e),onReceipt:e=>Re.current?.(e),onAuthLost:()=>T(`signed-out`)}),[o,f]),Be=(0,G.useSyncExternalStore)(ze.subscribe,ze.getState,ze.getState),{draft:Ve,items:He,pendingAttachments:Ue,quota:We,rateLimit:Ge,streaming:Ke}=Be;(0,G.useEffect)(()=>{if(o!==`studio`){Me(!0);return}let e=!1,t=null;try{t=globalThis.localStorage?.getItem(IS)}catch{}if(!t){Me(!0);return}return(async()=>{try{let n=await f.loadSession(t);if(!Array.isArray(n?.transcript))throw Error(`missing transcript`);e||ze.restore(n.transcript,n.sessionId||t)}catch{e||(ze.newSession(),Oe(`Previous conversation could not be restored`))}finally{e||Me(!0)}})(),()=>{e=!0}},[o,ze,f]),(0,G.useEffect)(()=>{if(!(o!==`studio`||!je))try{globalThis.localStorage?.setItem(IS,Be.sessionId)}catch{}},[Be.sessionId,je,o]);let[qe,Je]=(0,G.useState)(()=>Date.now()),Ye=k?bC(Be,{now:qe,toolLabel:e=>$S(e,d.toolLabels)}):ne===`failed`?{phase:`no-model`,kind:`terminal`,tone:`alert`,text:`No model available — the agent service did not answer with one`,ticking:!1}:{phase:`models`,kind:`live`,tone:`busy`,text:`Loading models…`,ticking:!1};(0,G.useEffect)(()=>{if(!Ye.ticking)return;let e=setInterval(()=>Je(Date.now()),500);return()=>clearInterval(e)},[Ye.ticking]);let Xe=(0,G.useCallback)(e=>e?.signedIn||e?.providersConfigured>0?d.imageEntitlement&&e?.entitlements?.image===!1?`no-entitlement`:`ready`:e?.pending?`signing-in`:`signed-out`,[d]),Ze=(0,G.useCallback)(async()=>{try{let e=await f.status();return C(e),T(Xe(e)),e}catch{return T(`signed-out`),null}},[Xe,f]),Qe=(0,G.useCallback)(async()=>{try{let e=await f.providers?.();if(!Array.isArray(e))throw Error(`no provider list`);Se(e),we(`ready`)}catch{Se([]),we(`failed`)}},[f]),$e=(0,G.useCallback)(async()=>{let e=Ze();await Qe(),await e;try{oe(await f.models())}catch{}},[oe,Ze,Qe,f]);(0,G.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await f.status();if(e)return;C(t),T(Xe(t))}catch{e||T(`signed-out`)}try{let t=await f.models();if(e)return;if(!oe(t)){re(`failed`);return}}catch{e||re(`failed`)}})(),()=>{e=!0}},[oe,Xe,f]),(0,G.useEffect)(()=>{if(w!==`signing-in`)return;let e=()=>{document.visibilityState!==`hidden`&&$e()};return window.addEventListener(`focus`,e),window.addEventListener(`cozyclay:agent-auth-return`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`cozyclay:agent-auth-return`,e),document.removeEventListener(`visibilitychange`,e)}},[w,$e]),(0,G.useEffect)(()=>{!p||w!==`ready`||!k||[`streaming`,`rate-limited`,`error`].includes(p)&&(He.length||ze.send(`Give me a wide two-shot of this scene`,{attachFrame:!1,model:k}))},[w,He.length,p,k,ze]),(0,G.useEffect)(()=>{if(i)return;let e=()=>ge((globalThis.innerWidth||1440)<FS);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[i]),(0,G.useEffect)(()=>{if(i)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`b`&&(e.preventDefault(),h(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]),(0,G.useEffect)(()=>{if(i)return;let e=()=>h(e=>!e);return window.addEventListener(`cozyclay:agent-panel-toggle`,e),()=>window.removeEventListener(`cozyclay:agent-panel-toggle`,e)},[i]),(0,G.useEffect)(()=>{i||r?.(m)},[m,i,r]),(0,G.useEffect)(()=>{if(a){Ne.current&&Ne.current===document.activeElement&&Ne.current.blur();return}m||Ne.current?.focus()},[w,m,a]),(0,G.useEffect)(()=>{let e=Pe.current;e&&(e.scrollTop=e.scrollHeight)},[He,Ke]);let et=(0,G.useCallback)(e=>{e.preventDefault(),y(!0);let t=e.clientX,n=g,r=e=>_(eC(n+(t-e.clientX))),i=e=>{y(!1),window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i),nC(eC(n+(t-e.clientX)))};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)},[g]),tt=(0,G.useCallback)(e=>{_(t=>{let n=eC(t+e);return nC(n),n})},[]),nt=(0,G.useCallback)(async e=>{let t=[],n=0;for(let r of e)try{t.push(await Zb(r))}catch{n+=1}let r=t.length?ze.addAttachments(t).rejected:0;ue(r?Pb:n?Ib:null)},[ze]),rt=(0,G.useCallback)(e=>{let{images:t,unsupported:n}=Bb(e);return t.length?(nt(t),!0):(n&&ue(Fb),n>0)},[nt]),it=(0,G.useCallback)(e=>{rt(e.clipboardData)&&e.preventDefault()},[rt]),at=(0,G.useCallback)(e=>{zb(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,fe(!0))},[]),ot=(0,G.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||fe(!1)},[]),st=(0,G.useCallback)(e=>{fe(!1),rt(e.dataTransfer)&&e.preventDefault()},[rt]),ct=(0,G.useCallback)(e=>(ue(null),Ae(``),ze.send(e,{attachFrame:se,model:k,effort:ie??void 0})),[se,ie,k,ze]),lt=(0,G.useCallback)(()=>ze.stop(),[ze]),ut=(0,G.useCallback)(async e=>{if(!String(e??``).trim())return;ue(null),Ae(``);let t=await ze.steer(e);t.ok||Ae(t.message||`The running turn did not take that message.`)},[ze]),dt=(0,G.useCallback)(async()=>{T(`signing-in`);try{await f.signIn(),await $e()}catch{T(`signed-out`)}},[$e,f]),ft=(0,G.useCallback)(async()=>{x(!1),await f.signOut().catch(()=>{}),C(null),ze.newSession(),await $e()},[$e,ze,f]),pt=(0,G.useCallback)(()=>{if(o===`studio`)try{globalThis.localStorage?.removeItem(IS)}catch{}ze.newSession(),ve(!1),x(!1),Ne.current?.focus()},[ze,o]),mt=(0,G.useCallback)(async()=>{if(o!==`studio`)return;let e=!_e;if(ve(e),e)try{Ee(await f.listSessions())}catch{Ee([])}},[_e,o,f]),ht=(0,G.useCallback)(async e=>{try{let t=await f.loadSession(e);if(!Array.isArray(t?.transcript))throw Error(`missing transcript`);ze.restore(t.transcript,t.sessionId||e),ve(!1),Oe(``)}catch{Oe(`Previous conversation could not be restored`)}},[ze,f]),gt=(0,G.useCallback)(()=>{x(!1);let e=!ye;be(e),e&&(we(`loading`),Qe())},[ye,Qe]),_t=(0,G.useCallback)(async(e,t)=>{await f.setProviderKey(e,t),await $e()},[$e,f]),vt=(0,G.useCallback)(async e=>{await f.removeProviderKey(e),await $e()},[$e,f]),yt=(0,G.useCallback)(()=>{ze.clearContext(),x(!1)},[ze]),bt=(0,G.useCallback)(()=>{let e=E.filter(e=>sC(O,e.id)),t=e.length?e:E,n=t[(t.findIndex(e=>e.id===k)+1)%t.length];n&&j(n.id),ze.clearRateLimit()},[j,k,O,E,ze]),xt=(0,G.useCallback)(e=>{if(e.key===`Escape`&&Ke){e.preventDefault(),lt();return}if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),Ke){d.steer&&ut(Ve);return}ct(Ve)}},[Ve,d,ct,ut,lt,Ke]),St=Ge?`rate-limited`:w===`ready`?Ke?`streaming`:He.some(e=>e.kind===`tool`&&e.status===`failed`||e.kind===`failure`)?`error`:`ready`:w,Ct={"signed-out":``,"signing-in":`busy`,"no-entitlement":`warn`,ready:`ok`,streaming:`busy`,"rate-limited":`warn`,error:`alert`}[St]||``,wt=lC(Ge?.resetAt||We?.resetAt),Tt=w===`ready`||w===`no-entitlement`,Et=St===`rate-limited`||!k||!sC(O,k);return m&&!i?(0,K.jsxs)(`aside`,{className:`agent-panel collapsed`,"data-agent-state":St,"data-agent-collapsed":`true`,"aria-label":`Agent panel, collapsed`,children:[(0,K.jsx)(`button`,{type:`button`,className:`agent-rail-toggle`,onClick:()=>h(!1),"aria-label":`Expand agent panel`,title:`Expand agent panel (Cmd/Ctrl+B)`,children:(0,K.jsx)(xb,{size:13,style:{transform:`rotate(180deg)`}})}),(0,K.jsx)(ew,{tone:Ct,title:St}),(0,K.jsx)(`span`,{className:`agent-rail-label`,children:`Agent`})]}):(0,K.jsxs)(`aside`,{className:`agent-panel${v?` resizing`:``}${he&&!i?` overlay`:``}${i?` embedded`:``}`,style:i?void 0:{width:`${g}px`},hidden:i&&a,"data-agent-state":St,"data-agent-width":i?void 0:g,"data-agent-overlay":he&&!i?`true`:`false`,"data-agent-embedded":i?`true`:`false`,"aria-label":`Agent`,children:[!i&&(0,K.jsx)(`div`,{role:`separator`,"aria-label":`Resize agent panel`,"aria-orientation":`vertical`,"aria-valuenow":g,"aria-valuemin":300,"aria-valuemax":560,tabIndex:0,className:`agent-resize`,onPointerDown:et,onKeyDown:e=>{e.key===`ArrowLeft`&&(e.preventDefault(),tt(16)),e.key===`ArrowRight`&&(e.preventDefault(),tt(-16))}}),(0,K.jsxs)(`header`,{className:`agent-header`,children:[(0,K.jsx)(ew,{tone:Ct,title:St}),(0,K.jsx)(`h2`,{className:`agent-title`,children:`Agent`}),(0,K.jsx)(`span`,{className:`agent-header-spacer`}),(0,K.jsxs)(`button`,{type:`button`,className:`agent-ghost-button agent-new`,onClick:pt,children:[(0,K.jsx)(cb,{size:11}),` New`]}),d.history&&(0,K.jsxs)(`span`,{className:`agent-history-wrap`,children:[(0,K.jsx)(`button`,{type:`button`,className:`agent-ghost-button agent-history`,"aria-haspopup":`listbox`,"aria-expanded":o===`studio`?_e:void 0,onClick:o===`studio`?mt:void 0,disabled:o!==`studio`,children:`History`}),o===`studio`&&_e&&(0,K.jsx)(`div`,{className:`agent-history-popover`,role:`listbox`,"aria-label":`Agent history`,children:Te.length?Te.map(e=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,className:`agent-history-item`,onClick:()=>ht(e.sessionId),children:[(0,K.jsx)(`span`,{className:`agent-history-time`,children:$C(e.updatedAt)}),(0,K.jsx)(`span`,{className:`agent-history-text`,children:e.firstText||`Untitled conversation`})]},e.sessionId)):(0,K.jsx)(`span`,{className:`agent-history-empty`,children:`No previous conversations`})})]}),(0,K.jsxs)(`span`,{className:`agent-overflow`,children:[(0,K.jsx)(`button`,{type:`button`,className:`agent-icon-button agent-overflow-toggle`,"aria-haspopup":`menu`,"aria-expanded":b,"aria-label":`More agent actions`,onClick:()=>x(e=>!e),children:(0,K.jsx)(fb,{size:13})}),b&&(0,K.jsxs)(`div`,{className:`agent-menu`,role:`menu`,children:[(0,K.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:yt,children:`Clear context`}),(0,K.jsx)(`button`,{type:`button`,role:`menuitem`,className:`agent-menu-keys`,"aria-expanded":ye,onClick:gt,children:`Provider keys…`}),(0,K.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:ft,children:`Sign out`})]})]}),!i&&(0,K.jsx)(`button`,{type:`button`,className:`agent-icon-button agent-collapse`,onClick:()=>h(!0),"aria-label":`Collapse agent panel`,title:`Collapse agent panel (Cmd/Ctrl+B)`,children:(0,K.jsx)(xb,{size:13})})]}),De&&(0,K.jsx)(`div`,{className:`agent-toast`,role:`status`,children:De}),ke&&(0,K.jsx)(`div`,{className:`agent-toast alert agent-steer-notice`,role:`alert`,children:ke}),S?.signedIn&&(0,K.jsxs)(`div`,{className:`agent-account`,children:[(0,K.jsx)(`span`,{className:`agent-account-email`,children:S.email}),(0,K.jsx)(`span`,{className:`agent-plan-badge`,children:We?.plan||S.plan||`Free`}),wt&&(0,K.jsxs)(`span`,{className:`agent-account-reset`,children:[`resets in `,wt]})]}),ye&&(0,K.jsxs)(`section`,{className:`agent-keys`,"aria-label":`Provider keys`,"data-agent-keys":`true`,children:[(0,K.jsxs)(`div`,{className:`agent-keys-head`,children:[(0,K.jsx)(`h3`,{className:`agent-keys-title`,children:`Provider keys`}),(0,K.jsx)(`button`,{type:`button`,className:`agent-icon-button agent-keys-close`,"aria-label":`Close provider keys`,onClick:()=>be(!1),children:(0,K.jsx)(rb,{size:11,"aria-hidden":`true`})})]}),(0,K.jsx)(`p`,{className:`agent-keys-hint`,children:`Keys are stored by the local CozyClay service and are never shown again.`}),Ce===`loading`&&(0,K.jsx)(`p`,{className:`agent-keys-note`,children:`Loading providers…`}),Ce===`failed`&&(0,K.jsx)(`p`,{className:`agent-keys-note alert`,role:`alert`,children:`The provider list is unavailable.`}),xe.filter(e=>e.id!==`openai-codex`).map(e=>(0,K.jsx)(cw,{provider:e,onSave:_t,onRemove:vt},e.id))]}),(0,K.jsxs)(`div`,{className:`agent-transcript`,ref:Pe,"aria-live":`polite`,"aria-label":`Conversation`,"data-agent-transcript":`true`,children:[w===`signed-out`&&(0,K.jsxs)(`div`,{className:`agent-state-card`,"data-agent-card":`signed-out`,children:[(0,K.jsx)(`h3`,{children:`Sign in with ChatGPT`}),(0,K.jsx)(`p`,{children:`The agent runs against your ChatGPT plan. Sign-in happens in your browser — no token is ever stored in this page.`}),(0,K.jsx)(`button`,{type:`button`,className:`agent-primary-button agent-signin`,onClick:dt,children:`Sign in with ChatGPT`})]}),w===`signing-in`&&(0,K.jsxs)(`div`,{className:`agent-state-card`,"data-agent-card":`signing-in`,children:[(0,K.jsx)(`span`,{className:`agent-spinner`,"aria-hidden":`true`}),(0,K.jsx)(`h3`,{children:`Waiting for your browser…`}),(0,K.jsx)(`p`,{children:`Finish the ChatGPT sign-in in the tab that just opened. This panel picks up the session when you come back.`})]}),w===`no-entitlement`&&(0,K.jsxs)(`div`,{className:`agent-state-card`,"data-agent-card":`no-entitlement`,children:[(0,K.jsx)(`h3`,{children:`Image generation is not on this plan`}),(0,K.jsxs)(`p`,{children:[`Signed in as `,S?.email||`your account`,`. Chat and tool calls work; image results need a plan with image generation.`]}),(0,K.jsx)(`button`,{type:`button`,className:`agent-primary-button`,onClick:()=>window.open(`https://chatgpt.com/#pricing`,`_blank`,`noopener,noreferrer`),children:`See plans`})]}),w===`ready`&&!He.length&&!Ge&&(0,K.jsxs)(`div`,{className:`agent-state-card`,"data-agent-card":`ready`,children:[(0,K.jsx)(`h3`,{children:d.emptyTitle}),(0,K.jsx)(`p`,{children:d.emptyHint(t)}),(0,K.jsx)(`div`,{className:`agent-suggestions`,children:d.suggestions.map(e=>(0,K.jsx)(`button`,{type:`button`,className:`agent-chip`,onClick:()=>{ze.setDraft(e),Ne.current?.focus()},children:e},e))})]}),He.map(e=>e.kind===`user`?(0,K.jsxs)(`div`,{className:`agent-row user`,children:[e.attachments?.length>0&&(0,K.jsx)(`div`,{className:`agent-bubble-attachments`,children:e.attachments.map((t,n)=>(0,K.jsx)(`img`,{src:t.dataUrl,alt:t.name||`Attached image`,onClick:()=>me({dataUrl:t.dataUrl,prompt:t.name})},`${e.id}-${n}`))}),(0,K.jsx)(`div`,{className:`agent-bubble`,children:e.text})]},e.id):e.kind===`assistant`?(0,K.jsx)(`div`,{className:`agent-row assistant`,children:(0,K.jsxs)(`div`,{className:`agent-assistant-text`,children:[e.text,Ke&&(0,K.jsx)(`span`,{className:`agent-caret`,children:`▌`})]})},e.id):e.kind===`tool`?(0,K.jsx)(`div`,{className:`agent-row`,children:(0,K.jsx)(tw,{call:e,presentation:d,onRetry:()=>ct(Be.lastPrompt)})},e.id):e.kind===`job`?(0,K.jsx)(`div`,{className:`agent-row`,children:(0,K.jsx)(iw,{job:e,onStop:lt,onAccept:e=>ze.acceptJob(e.jobId)})},e.id):e.kind===`receipt`?(0,K.jsx)(`div`,{className:`agent-row`,children:(0,K.jsx)(aw,{item:e})},e.id):e.kind===`failure`?(0,K.jsx)(`div`,{className:`agent-row`,children:(0,K.jsx)(sw,{failure:e.failure,onRetry:()=>ct(Be.lastPrompt)})},e.id):(0,K.jsx)(`div`,{className:`agent-row`,children:(0,K.jsx)(nw,{image:e,onUse:e=>ze.applyImage(e.id),onUndo:e=>ze.undoImage(e.id),onRegenerate:()=>ct(Be.lastPrompt),onOpen:me})},e.id)),Ge&&(0,K.jsx)(rw,{resetAt:Ge.resetAt,onRetry:()=>{ze.clearRateLimit(),ct(Be.lastPrompt)},onSwitchModel:bt})]}),Tt&&(0,K.jsxs)(`div`,{className:`agent-activity`,"data-agent-activity":Ye.phase,"data-agent-activity-kind":Ye.kind,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(`span`,{className:`agent-activity-indicator ${Ye.tone}`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`agent-activity-text`,children:Ye.text})]}),Tt&&(0,K.jsxs)(`div`,{className:`agent-composer`,"data-agent-dropping":de?`true`:`false`,onDragOver:Et?void 0:at,onDragLeave:Et?void 0:ot,onDrop:Et?void 0:st,children:[Ue.length>0&&(0,K.jsx)(`ul`,{className:`agent-attachments`,"aria-label":`Attached images`,children:Ue.map(e=>(0,K.jsxs)(`li`,{className:`agent-attachment`,children:[(0,K.jsx)(`img`,{src:e.dataUrl,alt:e.name||`Attached image`}),(0,K.jsx)(`button`,{type:`button`,className:`agent-attachment-remove`,"aria-label":`Remove ${e.name||`attached image`}`,onClick:()=>ze.removeAttachment(e.id),children:(0,K.jsx)(rb,{size:10,"aria-hidden":`true`})})]},e.id))}),le&&(0,K.jsx)(`p`,{className:`agent-attachment-notice`,role:`status`,children:le}),(0,K.jsx)(`textarea`,{ref:Ne,className:`agent-input`,"aria-label":`Message the agent`,placeholder:St===`rate-limited`?`Composer is paused`:k?d.composerPlaceholder:`Waiting for the model list…`,value:Ve,disabled:Et,onChange:e=>ze.setDraft(e.target.value),onKeyDown:xt,onPaste:it,onDragOver:at,onDrop:st}),(0,K.jsxs)(`div`,{className:`agent-composer-controls agent-composer-picks`,children:[(0,K.jsx)(`select`,{className:`agent-model-select`,"aria-label":`Model`,value:k,disabled:!E.length,onChange:e=>j(e.target.value),children:O.length?O.map(e=>(0,K.jsx)(`optgroup`,{label:e.label,children:e.models.length?e.models.map(t=>(0,K.jsx)(`option`,{value:t.key,disabled:!e.signedIn,children:e.signedIn?t.label:`${t.label} — add key`},t.key)):(0,K.jsx)(`option`,{value:`${e.id}/`,disabled:!0,children:e.signedIn?`No models`:`No models — add key`})},e.id)):E.length?E.map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.label},e.id)):(0,K.jsx)(`option`,{value:``,children:ne===`failed`?`No model available`:`Loading models…`})}),A.length>0&&(0,K.jsx)(`select`,{className:`agent-model-select agent-effort-select`,"aria-label":`Reasoning effort`,title:`Reasoning effort`,value:ie??A[0],onChange:e=>ae(e.target.value),children:A.map((e,t)=>(0,K.jsx)(`option`,{value:e,children:t===0?`${e} · default`:e},e))})]}),(0,K.jsxs)(`div`,{className:`agent-composer-controls`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`agent-attach-chip`,"aria-pressed":se,onClick:()=>ce(e=>!e),children:[se?(0,K.jsx)(`span`,{className:`agent-attach-thumb`,"aria-hidden":`true`}):(0,K.jsx)(ub,{size:11,"aria-hidden":`true`}),`Attach current frame`]}),o===`studio`&&Le.current&&(0,K.jsx)(`button`,{type:`button`,className:`agent-attach-chip agent-fal-action`,"data-testid":`fal-agent-action`,disabled:Et||!Ve.trim()||Ke,onClick:()=>{let e=Ve.trim();ze.setDraft(``),Le.current?.(e)},children:`Generate motion`}),(0,K.jsx)(`span`,{className:`agent-composer-spacer`,"aria-hidden":`true`}),Ke?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`agent-send stop agent-stop`,onClick:lt,children:`Stop`}),d.steer&&(0,K.jsx)(`button`,{type:`button`,className:`agent-send agent-steer`,disabled:!Ve.trim(),onClick:()=>ut(Ve),children:`Steer`})]}):(0,K.jsx)(`button`,{type:`button`,className:`agent-send`,disabled:Et||!Ve.trim(),onClick:()=>ct(Ve),children:`Send`})]})]}),Tt&&d.imageHint&&(0,K.jsx)(`p`,{className:`agent-footer-hint`,children:d.imageHint}),pe&&(0,K.jsx)(`button`,{type:`button`,className:`agent-lightbox`,"aria-label":`Close image preview`,onClick:()=>me(null),children:(0,K.jsx)(`img`,{src:pe.dataUrl,alt:pe.prompt||`Generated image`})})]})}function uw(e){return e?typeof e.id==`string`&&Gm(e.id)?!0:zm(e.type):!1}function dw({getRecord:e=async e=>fh(await pw(),e),putRecord:t=async e=>dh(await pw(),e),createBitmap:n=(...e)=>createImageBitmap(...e),makeTexture:r=e=>new sr(e)}={}){let i=new Map;function a(e){let t=i.get(e);return t||(t={texture:null,record:null,promise:null,listeners:new Set,generation:0,evicted:!1},i.set(e,t)),t}function o(e){for(let t of e.listeners)t(e.texture)}function s(e){e?.image?.close?.(),e?.dispose?.()}async function c(e){if(uw(e))return null;let t=r(await n(new Blob([e.bytes],{type:e.type}),{imageOrientation:`flipY`}));return t.flipY=!1,t.colorSpace=Dt,t.generateMipmaps=!0,t.minFilter=ae,t.magFilter=ne,t.anisotropy=4,t.needsUpdate=!0,t.userData.assetId=e.id,t}function l(t){if(typeof t!=`string`||!t||Gm(t))return Promise.resolve(null);let n=a(t);if(n.evicted)return Promise.resolve(null);if(n.texture)return Promise.resolve(n.texture);if(!n.promise){let r=n.generation;n.promise=(async()=>{let i=n.record??await e(t);if(!i||n.evicted||n.generation!==r||uw(i))return null;n.record=i;let a=await c(i);return n.evicted||n.generation!==r?(s(a),null):(n.texture=a,o(n),a)})().catch(e=>(console.warn(`[cozyclay] could not load image asset ${t}`,e),n.failed=!0,null)).finally(()=>{n.generation===r&&(n.promise=null)})}return n.promise}async function u(t){if(typeof t!=`string`||!t)return null;let n=a(t);return n.evicted?null:(n.record||=await e(t),n.record)}async function d(e){let n=await t(e),r=a(n.id),i=++r.generation;if(r.evicted=!1,s(r.texture),r.texture=null,r.record=n,r.promise=null,uw(n)||Gm(n.id))return n;let l=await c(n);return!l||r.generation!==i?(s(l),n):(r.texture=l,o(r),n)}function f(e){let t=i.get(e);t&&(t.generation+=1,t.evicted=!0,s(t.texture),t.texture=null,t.record=null,t.promise=null,o(t))}function p(e,t){if(typeof e!=`string`||!e)return()=>{};let n=a(e);return n.listeners.add(t),n.texture?t(n.texture):l(e),()=>n.listeners.delete(t)}function m(){for(let e of i.values())s(e.texture);i.clear()}return{loadAssetTexture:l,assetRecord:u,rememberAsset:d,evictAssetTexture:f,subscribeToAssetTexture:p,clearAssetTextures:m}}var fw=null;function pw(){return fw||=uh(),fw}var mw=dw();mw.loadAssetTexture;var hw=mw.assetRecord,gw=mw.rememberAsset,_w=mw.evictAssetTexture,vw=mw.subscribeToAssetTexture;mw.clearAssetTextures;var yw=`cozyclay:scene-change`,bw=`cozyclay.scene-playback.v1`,xw=`cozyclay:scene-playback`;function Sw(e,t){return!e||typeof e!=`object`?!1:[e.assetId,e.sourceAssetId,e.matteAssetId].includes(t)}function Cw(e,t,{height:n=D_,placement:r={},name:i=t?.name}={}){if(!t||!Wm(t.id))return{document:e,object:null,changed:!1,reason:`invalid-asset`};let a=e&&typeof e==`object`?e:sy(),o=Array.isArray(a.scenes)?a.scenes:[],s=oy(o,a.activeSceneId);if(s<0||!o[s])return{document:a,object:null,changed:!1,reason:`no-active-scene`};let c=o[s],l=Array.isArray(c.objects)?c.objects:[];if(l.some(e=>Sw(e,t.id)))return{document:a,object:null,changed:!1,reason:`already-in-scene`};let u=K_({assetId:t.id,aspect:Zm(t)??1,height:n,name:i},l,r);if(!u)return{document:a,object:null,changed:!1,reason:`cutout-failed`};let d=o.map((e,t)=>t===s?{...e,objects:[...l,u]}:e);return{document:{...a,version:Number.isInteger(a.version)?a.version:4,scenes:d},object:u,changed:!0,reason:`added`}}function ww(e,t,n={}){if(typeof t!=`string`||!t.trim()||!n||typeof n!=`object`)return{document:e,changed:!1,reason:`invalid-motion`};let r=e&&typeof e==`object`?e:sy(),i=Array.isArray(r.scenes)?r.scenes:[],a=oy(i,r.activeSceneId);if(a<0||!i[a])return{document:r,changed:!1,reason:`no-active-scene`};let o=i[a],s=o.stage&&typeof o.stage==`object`?o.stage:{},c=Array.isArray(s.characters)?s.characters:[],l=c.find(e=>e?.id===t);if(!l)return{document:r,changed:!1,reason:`character-not-found`};let u=typeof n.url==`string`&&n.url?n.url:typeof n.objectUrl==`string`&&n.objectUrl?n.objectUrl:null;if(!u)return{document:r,changed:!1,reason:`motion-url-missing`};let d={...l.motionRef&&typeof l.motionRef==`object`?l.motionRef:{},...n.motionRef&&typeof n.motionRef==`object`?n.motionRef:{},url:u},f=c.map(e=>e?.id===t?{...e,motionRef:d}:e),p={...o,stage:{...s,characters:f}};return{document:{...r,scenes:i.map((e,t)=>t===a?p:e)},changed:!0,reason:`updated`,characterId:t,motionRef:d}}function Tw(e,t,n={}){let r=ww(n.document??Ew(n.storage),e,t);return r.changed&&Dw(r.document,n),r}function Ew(e=globalThis.localStorage){return dy(e?.getItem?.(`cozyclay.scenes.v4`)??null).document}function Dw(e,{storage:t=globalThis.localStorage,target:n=globalThis}={}){let r=e&&typeof e==`object`?e:sy(),i=fy(r);try{t?.setItem?.(xv,i)}catch{}try{n?.dispatchEvent?.(new CustomEvent(yw,{detail:r}))}catch{}return r}function Ow(e,{storage:t=globalThis.localStorage,target:n=globalThis}={}){if(typeof e!=`function`)return()=>{};let r=t=>{let n=t?.detail;n&&typeof n==`object`&&e(n,{source:`same-tab`})},i=t=>{if(t?.key!==`cozyclay.scenes.v4`||!t.newValue)return;let n=dy(t.newValue);n.status===`corrupt`||n.status===`future`||!n.document||e(n.document,{source:`storage`})};return n?.addEventListener?.(yw,r),n?.addEventListener?.(`storage`,i),()=>{n?.removeEventListener?.(yw,r),n?.removeEventListener?.(`storage`,i)}}function kw(e,{storage:t=globalThis.localStorage,target:n=globalThis}={}){let r={activeSceneId:typeof e?.activeSceneId==`string`?e.activeSceneId:null,frame:Number.isFinite(Number(e?.frame))?Math.max(0,Math.round(Number(e.frame))):null,playing:typeof e?.playing==`boolean`&&e.playing,issuedAt:Date.now()};try{t?.setItem?.(bw,JSON.stringify(r))}catch{}try{n?.dispatchEvent?.(new CustomEvent(xw,{detail:r}))}catch{}return r}function Aw(e,{storage:t=globalThis.localStorage,target:n=globalThis}={}){if(typeof e!=`function`)return()=>{};let r=t=>{try{let n=typeof t==`string`?JSON.parse(t):t;n&&typeof n==`object`&&e(n)}catch{}},i=e=>r(e?.detail),a=e=>{e?.key===`cozyclay.scene-playback.v1`&&e.newValue&&r(e.newValue)};return n?.addEventListener?.(xw,i),n?.addEventListener?.(`storage`,a),()=>{n?.removeEventListener?.(xw,i),n?.removeEventListener?.(`storage`,a)}}async function jw(e,{importer:t=rh,remember:n=gw,importOptions:r}={}){return n(await t(e,{maxDimension:Lm,...r||{}}))}async function Mw(e,t={}){let n=await jw(e,t),r=Cw(t.document??Ew(t.storage),n,t);return r.changed&&Dw(r.document,t),{...r,asset:n}}var Nw=`.cclayproject`,Pw=`cozyclay.workflow.v1`,Fw=`cozyclay.project-handle.v1`,Iw=`kv`,Lw=`lastProjectHandle`,Rw=201326592,zw=268435456,Bw=/^[0-9a-f]{64}$/i;function Vw(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Hw(e,t=0){if(e===null||typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(t>32)return null;if(Array.isArray(e))return e.map(e=>Hw(e,t+1));if(!Vw(e))return null;let n={};for(let[r,i]of Object.entries(e))r!==`__proto__`&&r!==`constructor`&&r!==`prototype`&&i!==void 0&&typeof i!=`function`&&typeof i!=`symbol`&&(n[r]=Hw(i,t+1));return n}function Uw(e){return{x:Number.isFinite(e?.x)?e.x:0,y:Number.isFinite(e?.y)?e.y:0}}function Ww(){return{version:1,nodes:[],edges:[]}}function Gw(e){if(!Vw(e)||e.version!==void 0&&e.version!==1)return Ww();let t=[],n=new Set;for(let r of Array.isArray(e.nodes)?e.nodes:[]){if(!Vw(r)||typeof r.id!=`string`||!r.id.trim()||n.has(r.id))continue;let e=Hw(r.data);t.push({id:r.id,type:typeof r.type==`string`&&r.type.trim()?r.type:`default`,position:Uw(r.position),data:Vw(e)?e:{}}),n.add(r.id)}let r=[],i=new Set;for(let t=0;t<(Array.isArray(e.edges)?e.edges.length:0);t+=1){let a=e.edges[t];if(!Vw(a)||typeof a.source!=`string`||typeof a.target!=`string`||!n.has(a.source)||!n.has(a.target))continue;let o=typeof a.id==`string`&&a.id.trim()?a.id:`${a.source}->${a.target}:${t}`;if(i.has(o))continue;let s={id:o,source:a.source,target:a.target};typeof a.sourceHandle==`string`&&a.sourceHandle&&(s.sourceHandle=a.sourceHandle),typeof a.targetHandle==`string`&&a.targetHandle&&(s.targetHandle=a.targetHandle);let c=Hw(a.data);Vw(c)&&(s.data=c),r.push(s),i.add(o)}return{version:1,nodes:t,edges:r}}function Kw(e=globalThis.localStorage){try{return Gw(JSON.parse(e?.getItem(`cozyclay.workflow.v1`)||`null`))}catch{return Ww()}}function qw(e,t=globalThis.localStorage){let n=Gw(e);try{t?.setItem(Pw,JSON.stringify(n))}catch{}try{globalThis.dispatchEvent?.(new CustomEvent(`cozyclay:workflow-change`))}catch{}return n}function Jw(e){return e instanceof ArrayBuffer?e:ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function Yw(e){let t=new Uint8Array(e),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}function Xw(e,t){if(typeof e!=`string`||e.length<4||e.length%4)return{code:`bad-base64`};if(e.length>Math.ceil(t/3)*4)return{code:`too-large`};let n=e.endsWith(`==`)?2:+!!e.endsWith(`=`);for(let t=0;t<e.length-n;t+=1){let n=e.charCodeAt(t);if(!(n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57||n===43||n===47))return{code:`bad-base64`}}let r=e.length/4*3-n;return r>t?{code:`too-large`}:{bytes:r}}function Zw(e,t){let n=Xw(e,t);if(n.code)return n;try{let t=atob(e),n=Uint8Array.from(t,e=>e.charCodeAt(0));return Yw(n)===e?{buffer:n.buffer}:{code:`bad-base64`}}catch{return{code:`bad-base64`}}}function Qw(e,t,n){let r=Error(`${n} (${e} bytes) exceeds the ${t}-byte limit.`);return r.code=`resources-too-large`,r.bytes=e,r.limit=t,r}function $w(e){let t=Jw(e?.bytes),n=Qm({...e,bytes:t});return!n||n.bytes.byteLength>33554432?null:{record:{...n,bytes:Yw(n.bytes)},bytes:n.bytes.byteLength}}function eT(e){let t=new Set,n=e=>{if(Array.isArray(e)){for(let t of e)n(t);return}if(Vw(e)){Wm(e.assetRef)&&t.add(e.assetRef);for(let t of Object.values(e))n(t)}};return n(e),t}function tT(e){return{...Number.isInteger(e.frames)&&e.frames>=0?{frames:e.frames}:{},...Number.isFinite(e.fps)&&e.fps>0?{fps:e.fps}:{},...typeof e.name==`string`&&e.name.trim()?{name:e.name}:{},...Vw(e.meta)?{meta:Hw(e.meta)}:{}}}function nT(e){return typeof e==`string`&&Bw.test(e)?e.toLowerCase():null}function rT(e){if(!e||typeof e!=`object`)return null;let t=nT(e.motionId);if(!t)return null;let n=Jw(e.bytes);if(n){if(!n.byteLength)return null;if(n.byteLength>201326592)throw Qw(n.byteLength,Rw,`Motion ${t}`);return{motionId:t,bytes:n.byteLength,raw:n,details:tT(e)}}if(e.encoding!==`base64`)return null;let r=Xw(e.data,Rw);if(r.code===`too-large`)throw Qw(e.data.length/4*3,Rw,`Motion ${t}`);return r.code||e.bytes!==void 0&&e.bytes!==r.bytes?null:{motionId:t,bytes:r.bytes,data:e.data,details:tT(e)}}async function iT(e,t){let n=Jw(e?.bytes);if(!n)return!1;try{return(Gm(e.id)?await Ym(n,t):await Jm(n,t))===e.id}catch{return!1}}var aT={"bad-id":`its id is not a content address`,duplicate:`the same id appears earlier in the file`,"bad-encoding":`its encoding is not base64`,"bad-base64":`its payload is not valid base64`,"length-mismatch":`its payload does not match the recorded byte length`,"too-large":`its payload exceeds the size limit`,"bad-record":`its metadata is incomplete`};function oT(e,t){let n=[];if(!Array.isArray(e))return n;let r=new Set;for(let i of e){let e=typeof i?.id==`string`?i.id:null;if(!Km(e)){t(`image`,e,`bad-id`);continue}if(r.has(e)){t(`image`,e,`duplicate`);continue}let a=Zw(i.bytes,Im);if(a.code){t(`image`,e,a.code);continue}let o=Qm({...i,bytes:a.buffer});if(!o){t(`image`,e,`bad-record`);continue}r.add(e),n.push(o)}return n}function sT(e,t){let n=[];if(!Array.isArray(e))return n;let r=new Set;for(let i of e){let e=nT(i?.motionId);if(!e){t(`motion`,typeof i?.motionId==`string`?i.motionId:null,`bad-id`);continue}if(r.has(e)){t(`motion`,e,`duplicate`);continue}if(i.encoding!==`base64`){t(`motion`,e,`bad-encoding`);continue}let a=Xw(i.data,Rw);if(a.code){t(`motion`,e,a.code);continue}if(i.bytes!==a.bytes){t(`motion`,e,`length-mismatch`);continue}r.add(e),n.push({motionId:e,encoding:`base64`,data:i.data,bytes:a.bytes,...tT(i)})}return n}function cT({scenesDocument:e,workspaceLayout:t,customPoses:n,name:r,assets:i,motions:a,savedAt:o,workflow:s}){let c=new Map;for(let e of Array.isArray(i)?i:[]){let t=$w(e);t&&c.set(t.record.id,t)}let l=[],u=0,d=ih(e?.scenes);for(let e of eT(s))d.add(e);for(let e of d){let t=c.get(e);t&&(l.push(t.record),u+=t.bytes)}let f=new Map;for(let e of Array.isArray(a)?a:[]){let t=rT(e);!t||f.has(t.motionId)||(f.set(t.motionId,t),u+=t.bytes)}if(u>268435456)throw Qw(u,zw,`Embedded resources`);let p=[...f.values()].map(({motionId:e,bytes:t,raw:n,data:r,details:i})=>({motionId:e,encoding:`base64`,data:r??Yw(n),bytes:t,...i}));return{app:`cozyclay`,kind:`project`,version:4,name:typeof r==`string`&&r.trim()?r.trim():`Untitled`,...Number.isFinite(o)&&o>0?{savedAt:o}:{},scenes:e,workspace:t??null,poseLibrary:Array.isArray(n)?n:[],workflow:Gw(s),resources:{assets:l,motions:p}}}function lT(e){let t;try{t=JSON.parse(e)}catch{return{ok:!1,reason:`corrupt`}}if(!t||typeof t!=`object`)return{ok:!1,reason:`corrupt`};if(t.app!==`cozyclay`||t.kind!==`project`)return{ok:!1,reason:`not-a-project`};if(typeof t.version!=`number`)return{ok:!1,reason:`corrupt`};if(t.version>4)return{ok:!1,reason:`future`};let n=t.scenes;if(!n||typeof n!=`object`||n.version>4||!Array.isArray(n.scenes))return{ok:!1,reason:`scenes-invalid`};let r=[],i=[],a=(e,t,n)=>{let a=`Skipped embedded ${e} ${t??`(no id)`}: ${aT[n]}.`;i.push({kind:e,id:t,code:n,message:a}),r.push(a)},o=oT(t.version>=4?t.resources?.assets:t.version>=2?t.assets:void 0,a),s=t.version>=4?sT(t.resources?.motions,a):[],c=Gw(t.workflow);return{ok:!0,warnings:r,problems:i,project:{name:typeof t.name==`string`&&t.name.trim()?t.name.trim():`Untitled`,savedAt:Number.isFinite(t.savedAt)&&t.savedAt>0?t.savedAt:null,scenesDocument:{version:n.version,activeSceneId:n.activeSceneId??null,scenes:n.scenes},workspaceLayout:t.workspace&&typeof t.workspace==`object`?t.workspace:null,customPoses:Array.isArray(t.poseLibrary)?t.poseLibrary.filter(e=>e&&typeof e==`object`&&typeof e.id==`string`&&e.bones&&typeof e.bones==`object`):[],assets:o,motions:s,workflow:c}}}function uT(){return typeof window<`u`&&typeof window.showSaveFilePicker==`function`&&typeof window.showOpenFilePicker==`function`}var dT=[{description:`CozyClay Project`,accept:{"application/json":[Nw,`.json`]}}];async function fT(e){return await window.showSaveFilePicker({suggestedName:`${e||`Untitled`}${Nw}`,types:dT})}async function pT(){let[e]=await window.showOpenFilePicker({types:dT,multiple:!1});return e}async function mT(e,t){let n=await e.createWritable();await n.write(t),await n.close()}async function hT(e){let t=await e.getFile();return{name:t.name.replace(/\.cclayproject$|\.json$/i,``),text:await t.text(),savedAt:t.lastModified}}function gT(e,t){let n=new Blob([e],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t||`Untitled`}${Nw}`,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}function _T(){return new Promise(e=>{let t=document.createElement(`input`);t.type=`file`,t.accept=`${Nw},.json,application/json`,t.onchange=async()=>{let n=t.files?.[0];if(!n)return e(null);e({name:n.name.replace(/\.cclayproject$|\.json$/i,``),text:await n.text(),savedAt:n.lastModified})},t.oncancel=()=>e(null),t.click()})}function vT(){return new Promise((e,t)=>{let n=indexedDB.open(Fw,1);n.onupgradeneeded=()=>n.result.createObjectStore(Iw),n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function yT(e,t){try{let n=await vT();await new Promise((r,i)=>{let a=n.transaction(Iw,`readwrite`);a.objectStore(Iw).put({handle:e,name:t},Lw),a.oncomplete=r,a.onerror=()=>i(a.error)}),n.close()}catch{}}async function bT(){try{let e=await vT(),t=await new Promise((t,n)=>{let r=e.transaction(Iw,`readonly`).objectStore(Iw).get(Lw);r.onsuccess=()=>t(r.result??null),r.onerror=()=>n(r.error)});return e.close(),t}catch{return null}}async function xT(){try{let e=await vT();await new Promise((t,n)=>{let r=e.transaction(Iw,`readwrite`);r.objectStore(Iw).delete(Lw),r.oncomplete=t,r.onerror=()=>n(r.error)}),e.close()}catch{}}var ST=`recentProjects`,CT=`projectsDirectory`,wT=8,TT=`cozyclay.project-session.v1`;function ET(e=globalThis.localStorage){try{let t=JSON.parse(e?.getItem(`cozyclay.project-session.v1`)||`null`);if(!t||typeof t!=`object`)return null;let n=typeof t.name==`string`?t.name.trim():``;return n?{name:n,updatedAt:Number.isFinite(t.updatedAt)?t.updatedAt:0}:null}catch{return null}}function DT(e,t=globalThis.localStorage){let n=typeof e==`string`?e.trim():``;if(!n)return!1;try{return t?.setItem(TT,JSON.stringify({name:n,updatedAt:Date.now()})),!0}catch{return!1}}async function OT(e,t){try{let n=await vT();await new Promise((r,i)=>{let a=n.transaction(Iw,`readwrite`);a.objectStore(Iw).put(t,e),a.oncomplete=r,a.onerror=()=>i(a.error)}),n.close()}catch{}}async function kT(e){try{let t=await vT(),n=await new Promise((n,r)=>{let i=t.transaction(Iw,`readonly`).objectStore(Iw).get(e);i.onsuccess=()=>n(i.result??null),i.onerror=()=>r(i.error)});return t.close(),n}catch{return null}}async function AT(e,t){let n=await kT(ST)??[];await OT(ST,[{handle:e,name:t,openedAt:Date.now()},...n.filter(e=>e.name!==t)].slice(0,wT)),await yT(e,t)}async function jT(){return await kT(ST)??[]}async function MT(e){await OT(ST,(await kT(ST)??[]).filter(t=>t.name!==e))}function NT(){return typeof window<`u`&&typeof window.showDirectoryPicker==`function`}async function PT(){return window.showDirectoryPicker({mode:`readwrite`})}async function FT(e){await OT(CT,{handle:e})}async function IT(){return(await kT(CT))?.handle??null}async function LT(e){let t=[];try{for await(let[n,r]of e.entries()){if(r.kind!==`file`||!n.endsWith(`.cclayproject`))continue;let e=await r.getFile();t.push({name:n.slice(0,-13),handle:r,lastModified:e.lastModified})}}catch{return[]}return t.sort((e,t)=>t.lastModified-e.lastModified)}async function RT(e){try{return await e.queryPermission({mode:`readwrite`})}catch{return`denied`}}async function zT(e){try{return await e.queryPermission({mode:`readwrite`})===`granted`?`granted`:await e.requestPermission({mode:`readwrite`})}catch{return`denied`}}var BT=`follow the reference clip's framing and camera motion exactly`,VT=`clay previs, neutral look`,HT=`motion and blocking come from the reference; keep timing`;function UT(e){if(!Number.isFinite(e)||e<=0)return`normal`;let t=18/Math.tan(e*Math.PI/360);return t<=20?`wide`:t<=40?`normal`:`long`}function WT(e){return`${Number(e.toFixed(2))}s`}function GT(e){let t=[];return e?.dolly&&t.push(`smooth dolly move`),e?.crane&&t.push(`gentle crane move`),e?.rail&&t.push(`sliding rail move`),t.length>0?t.join(`; `):`locked-off camera, no move`}var KT=[`front`,`front right`,`right`,`back right`,`back`,`back left`,`left`,`front left`];function qT(e){if(!Number.isFinite(e))return``;let t=(e%360+360)%360;return KT[Math.round(t/45)%8]}function JT(e){return Number.isFinite(e)?e>=50?`high`:e<=10?`low`:`level`:``}function YT(e){return Number.isFinite(e)?e>=.8?`strong`:e>=.35?`moderate`:`dim`:`moderate`}function XT(e){return e?`${[JT(e.elevationDeg),qT(e.azimuthDeg)].filter(Boolean).join(` `)||`even`} key light, ${YT(e.intensity)}`:`no key light, ambient fill`}function ZT(e,t={}){let n=t.target===`video`?`video`:`image`,r=t.referenceOwnsCamera!==!1,i=Math.max(0,(e.frameRange?.end??0)-(e.frameRange?.start??0)+1)/(e.fps||24),a=typeof e.intent==`string`?e.intent.trim():``,o=[`SHOT: ${e.shotTitle||`untitled shot`}, ${WT(i)}, ${e.aspect||``}`.trimEnd(),`LENS: ${e.focalMm}mm, ${UT(e.fovDeg)} shot`,r?`CAMERA: ${BT}`:`CAMERA: ${GT(e.cameraMove)}`,`LIGHT: ${XT(e.keyLight)}`,`CAST: ${(e.cast||[]).map(e=>e.name).join(`, `)||`none`}`,`LOOK: ${a||VT}`];return n===`video`&&o.push(`MOTION: ${HT}`),o.join(`
|
|
17
|
-
`)}export{DS as $,Ft as $a,qf as $c,ac as $i,gs as $l,Gm as $n,L as $o,Vu as $r,et as $s,o_ as $t,iT as A,$c as Aa,Dl as Ac,au as Ai,dl as Al,Pg as An,Ll as Ao,Gp as Ar,ps as As,kv as At,gw as B,Xd as Ba,gn as Bc,Xl as Bi,Cl as Bl,Im as Bn,kt as Bo,Ap as Br,$l as Bs,sy as Bt,hT as C,zt as Ca,Re as Cc,Bf as Ci,x as Cl,tv as Cn,bu as Co,Wp as Cr,mc as Cs,ob as Ct,mn as Cu,DT as D,wr as Da,Et as Dc,B as Di,ep as Dl,$_ as Dn,Jo as Do,qp as Dr,Vf as Ds,Py as Dt,p as Du,zT as E,Bs as Ea,ke as Ec,Ii as Ei,yu as El,lv as En,hf as Eo,$p as Er,al as Es,Hy as Et,h as Eu,Ew as F,Zr as Fa,we as Fc,Js as Fi,Ui as Fl,Xg as Fn,A as Fo,Cp as Fr,Bd as Fs,oy as Ft,Qb as G,fe as Ga,Ue as Gc,vs as Gi,ue as Gl,mh as Gn,pt as Go,up as Gr,st as Gs,zv as Gt,lw as H,Of as Ha,Ve as Hc,$t as Hi,_e as Hl,oh as Hn,qu as Ho,bp as Hr,Be as Hs,ry as Ht,Ow as I,Xr as Ia,lr as Ic,ks as Ii,Ri as Il,r_ as In,ie as Io,Lp as Ir,Od as Is,ny as It,tx as J,nl as Ja,Qr as Jc,Jf as Ji,ce as Jl,fh as Jn,oa as Jo,pp as Jr,be as Js,iy as Jt,Hx as K,xu as Ka,Dt as Kc,mu as Ki,pe as Kl,sh as Kn,ft as Ko,fp as Kr,He as Ks,dy as Kt,Aw as L,_s as La,Gd as Lc,T as Li,zi as Ll,kg as Ln,ae as Lo,Op as Lr,lc as Ls,Hv as Lt,Tw as M,Wi as Ma,Qd as Mc,If as Mi,fi as Ml,Jg as Mn,os as Mo,kp as Mr,kf as Ms,Mv as Mt,Mw as N,z as Na,Hu as Nc,Ss as Ni,pl as Nl,Zg as Nn,ne as No,Fp as Nr,Ms as Ns,Sv as Nt,FT as O,_n as Oa,Te as Oc,Yu as Oi,md as Ol,p_ as On,sc as Oo,Kp as Or,Lu as Os,Fy as Ot,kw as P,de as Pa,Ce as Pc,Os as Pi,Vi as Pl,i_ as Pn,Gl as Po,Tp as Pr,Dd as Ps,xv as Pt,sx as Q,Nt as Qa,sl as Qc,_u as Qi,tu as Ql,Wm as Qn,Kn as Qo,ve as Qr,$e as Qs,T_ as Qt,hw as R,Eo as Ra,w as Rc,tf as Ri,Kd as Rl,ig as Rn,re as Ro,Dp as Rr,uc as Rs,qv as Rt,lT as S,Gt as Sa,Le as Sc,pi as Si,eu as Sl,fv as Sn,Tr as So,Vp as Sr,Ru as Ss,cb as St,M as Su,MT as T,Rs as Ta,Ne as Tc,zf as Ti,sr as Tl,I_ as Tn,ns as To,im as Tr,So as Ts,ib as Tt,_ as Tu,FC as U,Hr as Ua,ut as Uc,ys as Ui,he as Ul,Jm as Un,su as Uo,_p as Ur,xn as Us,py as Ut,vw as V,qt as Va,ol as Vc,Zn as Vi,j as Vl,Zm as Vn,lu as Vo,xp as Vr,Ql as Vs,Qv as Vt,$b as W,Cs as Wa,ct as Wc,bs as Wi,ge as Wl,ah as Wn,dt as Wo,lp as Wr,lt as Ws,Yv as Wt,ax as X,gu as Xa,_l as Xc,Ts as Xi,I as Xl,rh as Xn,Hn as Xo,ip as Xr,tt as Xs,Vv as Xt,ex as Y,nd as Ya,El as Yc,fd as Yi,F as Yl,eh as Yn,Ku as Yo,op as Yr,Oe as Ys,fy as Yt,CS as Z,tr as Za,hc as Zc,xs as Zi,cr as Zl,Km as Zn,af as Zo,St as Zr,Qe as Zs,D_ as Zt,_T as _,C as _a,Tt as _c,qo as _i,Vt as _l,S_ as _n,Lt as _o,rm as _r,xt as _s,hb as _t,Sl as _u,cT as a,rf as aa,qe as ac,Wl as ai,rr as al,J_ as an,Hi as ao,ih as ar,Il as as,TS as at,Yt as au,PT as b,Kl as ba,at as bc,Yl as bi,Bt as bl,dv as bn,Ta as bo,Bp as br,Zu as bs,db as bt,hn as bu,NT as c,oo as ca,Xe as cc,Gf as ci,nf as cl,gv as cn,na as co,Dm as cr,kl as cs,kb as ct,bt as cu,ET as d,Pt as da,ze as dc,W as di,Fu as dl,Q_ as dn,_t as do,_m as dr,E as ds,Ob as dt,vl as du,oc as ea,nt as ec,Hd as ei,Xc as el,N_ as en,uo as eo,zm as er,Ka as es,ox as et,hs as eu,IT as f,It as fa,Ie as fc,id as fi,_f as fl,x_ as fn,mt as fo,lm as fr,D as fs,Tb as ft,on as fu,Gw as g,ws as ga,Me as gc,Ct as gi,Rt as gl,C_ as gn,Zt as go,pm as gr,O as gs,gb as gt,un as gu,Kw as h,Se as ha,je as hc,Kf as hi,Wt as hl,_v as hn,Qt as ho,fm as hr,k as hs,vb as ht,Qf as hu,xT as i,As as ia,Ke as ic,Vd as ii,io as il,K_ as in,Bi as io,dh as ir,Nl as is,OS as it,ur as iu,mT as j,fu as ja,Na as jc,ku as ji,fl as jl,Kg as jn,ss as jo,Ip as jr,cs as js,jv as jt,qw as k,Es as ka,Ee as kc,oe as ki,Xt as kl,w_ as kn,cc as ko,em as kr,Cf as ks,by as kt,uT as l,vu as la,Ze as lc,S as li,Uu as ll,q_ as ln,ia as lo,wm as lr,Ol as ls,Db as lt,vt as lu,bT as m,xe as ma,Ae as mc,ad as mi,sa as ml,pv as mn,gt as mo,mm as mr,ee as ms,yb as mt,pn as mu,Nw as n,zs as na,We as nc,pu as ni,lo as nl,g_ as nn,Yd as no,Qm as nr,Pl as ns,NS as nt,fr as nu,Ww as o,pr as oa,Je as oc,Vs as oi,Ji as ol,G_ as on,Li as oo,ch as or,Ml as os,wS as ot,Wr as ou,jT as p,cu as pa,Fe as pc,xd as pi,xa as pl,hv as pn,ht as po,dm as pr,te as ps,Cb as pt,an as pu,nx as q,Df as qa,At as qc,js as qi,me as ql,Xm as qn,b as qo,dp as qr,wt as qs,ay as qt,Pw as r,pc as ra,Ge as rc,Wd as ri,xf as rl,H_ as rn,vo as ro,uh as rr,Fl as rs,MS as rt,Jt as ru,gT as s,dr as sa,Ye as sc,pd as si,ll as sl,Z_ as sn,le as so,Sm as sr,Al as ss,kS as st,ml as su,ZT as t,U as ta,rt as tc,nu as ti,se as tl,__ as tn,Ju as to,ph as tr,Pa as ts,ES as tt,mr as tu,LT as u,Mi as ua,it as uc,Sd as ui,dc as ul,Y_ as un,H as uo,Om as ur,jl as us,Eb as ut,yt as uu,pT as v,Bu as va,ye as vc,ql as vi,ld as vl,nv as vn,jt as vo,nm as vr,Zl as vs,mb as vt,dn as vu,AT as w,Ht as wa,Pe as wc,Ds as wi,ul as wl,ev as wn,Wu as wo,zp as wr,Nu as ws,ab as wt,y as wu,RT as x,Ns as xa,ot as xc,sf as xi,Ut as xl,W_ as xn,rl as xo,tm as xr,il as xs,lb as xt,ln as xu,fT as y,Nf as ya,De as yc,ao as yi,Kt as yl,uv as yn,Jl as yo,Hp as yr,Vr as ys,pb as yt,yl as yu,_w as z,Oo as za,Mt as zc,R as zi,Jd as zl,Pm as zn,Ot as zo,Sp as zr,Un as zs,Pv as zt};
|