1
0
forked from sent/waves
chunglloyd_unblocker/public/assets/g/polytrack/main.bundle.js
2025-04-09 17:11:14 -05:00

14 lines
1.3 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(()=>{var e={811:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.checkpoint {\n\tposition: absolute;\n\tbottom: 0;\n\tleft: 0;\n\tmargin: 0;\n\tpadding: 8px 10px 8px 8px;\n\tline-height: 0;\n\tfont-size: 40px;\n\tcolor: var(--text-color);\n\ttext-align: left;\n\topacity: 0.9;\n\tclip-path: polygon(0 0, calc(100% - 8px) 0, 100% 100%, 0 100%);\n\tbackground-color: var(--surface-color);\n}\n.checkpoint.up {\n\tposition: absolute;\n\tbottom: auto;\n\ttop: 0;\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n}\n\n.checkpoint > div {\n\tmargin: 0;\n\tpadding: 0 16px 0 16px;\n\tclip-path: polygon(0 0, calc(100% - 6px) 0, 100% 100%, 0 100%);\n\tbackground-color: var(--surface-tertiary-color);\n}\n.checkpoint.up > div {\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%);\n}\n\n.checkpoint > div > img {\n\tmargin: 0 12px 5px 0;\n\tpadding: 0;\n\twidth: 24px;\n\theight: 24px;\n\tvertical-align: middle;\n}\n",""]);const s=o},848:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.color-picker {\n\tmargin: 8px;\n}\n\n.color-picker > .value-saturation-picker {\n\tposition: relative;\n\tmargin: 0 0 8px 0;\n\twidth: 140px;\n\theight: 140px;\n\tbackground-color: #fff;\n\toverflow: hidden;\n}\n\n.color-picker > .value-saturation-picker > .marker {\n\tposition: absolute;\n\twidth: 12px;\n\theight: 12px;\n\tbackground-image: radial-gradient(closest-side, transparent, #000, #fff, #000, transparent);\n}\n\n.color-picker > .hue-picker {\n\tposition: relative;\n\twidth: 140px;\n\theight: 30px;\n\tbackground-image: linear-gradient(to right, \n\t\thsl(0, 100%, 50%),\n\t\thsl(60, 100%, 50%),\n\t\thsl(120, 100%, 50%),\n\t\thsl(180, 100%, 50%),\n\t\thsl(240, 100%, 50%),\n\t\thsl(300, 100%, 50%),\n\t\thsl(0, 100%, 50%)\n\t);\n\toverflow: hidden;\n}\n\n.color-picker > .hue-picker > .marker {\n\tposition: absolute;\n\ttop: 0;\n\theight: 100%;\n\twidth: 3px;\n\tbackground-image: linear-gradient(to right, #000, #fff, #000);\n}\n",""]);const s=o},959:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.customization {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\theight: 100%;\n}\n\n.customization > .top {\n\tdisplay: block;\n\tmargin: 0;\n\tpadding: 0;\n\tbackground-color: var(--surface-color);\n}\n.customization > .top > .button {\n\tdisplay: inline-block;\n\tmargin: 8px 0;\n}\n.customization > .top > .button:first-of-type {\n\tmargin-left: 8px;\n}\n\n.customization > .colors {\n\tposition: absolute;\n\tleft: 0;\n\tbottom: 0;\n\twidth: 100%;\n\ttext-align: center;\n\twhite-space: nowrap;\n}\n\n.customization > .colors > div {\n\tdisplay: inline-block;\n\tmargin: 0 10px;\n\tpadding: 0;\n\ttext-align: center;\n\tbackground: var(--surface-color);\n\tpointer-events: auto;\n}\n.customization > .colors > div > h2 {\n\tmargin: 0;\n\tpadding: 2px;\n\tfont-size: 26px;\n\tfont-weight: normal;\n\tbackground-color: var(--surface-secondary-color);\n\tcolor: var(--text-color);\n}\n.customization > .colors > div > input {\n\tmargin: 8px 8px 0 8px;\n\twidth: calc(140px - 8px * 2);\n\tfont-weight: normal;\n\tclip-path: none;\n\ttext-align: center;\n}\n",""]);const s=o},344:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.debug {\n\tmargin: 0.25em;\n\tpadding: 0;\n\tposition: absolute;\n\tleft: 0;\n\tbottom: 0;\n\tfont-size: 28px;\n\ttext-shadow: 0 0 5px #000;\n\tcolor: #fff;\n\tz-index: 10;\n}\n",""]);const s=o},57:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.editor {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\theight: 100%;\n}\n\n.editor > .top {\n\tdisplay: block;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.editor > .top > .button-bar {\n\tdisplay: flex;\n\tmargin: 0;\n\tpadding: 0 8px;\n\theight: 68px;\n\tbackground-color: var(--surface-color);\n\twhite-space: nowrap;\n}\n.editor > .top > .button-bar > .button {\n\tmargin: 8px 0;\n\tmin-width: 0;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n}\n\n.editor > .top > .trackname-input {\n\tdisplay: inline-block;\n\tmargin: 0;\n\tpadding: 6px 7px;\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%);\n\tfont-size: 30px;\n\tcolor: var(--text-color);\n\tbackground: var(--surface-secondary-color);\n}\n.editor > .top > .trackname-input > input {\n\tfont-weight: normal;\n\tfont-size: 30px;\n}\n\n.editor > .side {\n\tposition: absolute;\n\ttop: 68px;\n\tright: 0;\n\tmargin: 0;\n\tpadding: 0;\n\theight: calc(100% - 68px);\n\tdisplay: flex;\n\talign-items: end;\n}\n\n.editor > .side > .side-panel {\n\theight: 100%;\n\tbackground-color: var(--surface-secondary-color);\n\tpointer-events: auto;\n}\n\n.editor > .side > .side-panel > .category-panel, .editor > .side > .side-panel > .part-panel {\n\tdisplay: inline-block;\n\tvertical-align: top;\n\tpadding: 2px 2px 0 2px;\n\theight: 100%;\n\tbox-sizing: border-box;\n\toverflow-x: hidden;\n\toverflow-y: scroll;\n\tscrollbar-width: thin;\n}\n.editor > .side > .side-panel > .category-panel > button > img {\n\twidth: 96px;\n}\n.editor > .side > .side-panel > .part-panel.hidden {\n\tdisplay: none;\n}\n\n.editor > .side > .side-panel button {\n\tdisplay: block;\n\tmargin: 0 0 2px 0;\n\tpadding: 5px;\n\tbackground-color: var(--button-color);\n\tborder: 2px solid rgb(38, 31, 88);\n\tcursor: pointer;\n}\n.editor > .side > .side-panel button:hover {\n\tbackground-color: var(--button-hover-color);\n}\n@media (hover: none) {\n\t.editor > .side > .side-panel button:hover {\n\t\tbackground-color: var(--button-color);\n\t}\n}\n.editor > .side > .side-panel button:active {\n\tbackground-color: var(--button-active-color);\n}\n.editor > .side > .side-panel button.selected {\n\tbackground-color: var(--button-hover-color);\n\tbox-shadow: inset 0 0 5px #fff;\n\tborder: 2px solid #fff;\n}\n.editor > .side > .side-panel button > img {\n\tdisplay: block;\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 64px;\n\t-webkit-filter: drop-shadow(0 0 2px #000);\n\tfilter: drop-shadow(0 0 2px #000);\n\tpointer-events: none;\n}\n\n.editor > .message-box {\n\tmargin: 10px;\n\tpadding: 0;\n\tposition: absolute;\n\tfont-size: 30px;\n\tcolor: #ff9696;\n\ttext-shadow: 0 0 5px #000;\n\tpointer-events: none;\n\n\tleft: -10px;\n\topacity: 0;\n}\n.editor > .message-box.green {\n\tcolor: #96ff96;\n}\n.editor > .message-box.show {\n\tleft: 0;\n\topacity: 1;\n\ttransition: opacity 0.25s ease-in-out, left 0.25s ease-in-out;\n}\n.editor > .message-box.hide {\n\tleft: 0;\n\topacity: 0;\n\ttransition: opacity 0.25s ease-in-out, left 0.25s ease-in-out;\n}\n",""]);const s=o},909:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.editor-checkpoint-order > .buttons {\n\tdisplay: inline-block;\n\tvertical-align: bottom;\n}\n.editor-checkpoint-order > .buttons > button {\n\tdisplay: block;\n\tmargin: 0;\n\tpadding: 0;\n\tborder: none;\n\tbackground-color: var(--button-color);\n\tpointer-events: auto;\n\tcursor: pointer;\n}\n.editor-checkpoint-order > .buttons > button:hover {\n\tbackground-color: var(--button-hover-color);\n}\n@media (hover: none) {\n\t.editor-checkpoint-order > .buttons > button:hover {\n\t\tbackground-color: var(--button-color);\n\t}\n}\n.editor-checkpoint-order > .buttons > button:active {\n\tbackground-color: var(--button-active-color);\n}\n\n.editor-checkpoint-order > .buttons > button > img {\n\tmargin: 0;\n\tpadding: 0 6px;\n\twidth: 20px;\n\theight: 20px;\n\tvertical-align: bottom;\n\tpointer-events: none;\n}\n.editor-checkpoint-order.touch > .buttons > button > img {\n\tpadding: 24px;\n\twidth: 40px;\n\theight: 40px;\n}\n\n.editor-checkpoint-order > p {\n\tmargin: 0;\n\tpadding: 0 10px;\n\tdisplay: inline-block;\n\tvertical-align: bottom;\n\tline-height: 40px;\n\tmin-width: 275px;\n\tfont-size: 26px;\n\ttext-align: center;\n\tbackground-color: var(--surface-transparent-color);\n\tcolor: var(--text-color);\n}\n.editor-checkpoint-order.touch > p {\n\tline-height: calc((40px + 2 * 24px) * 2);\n}\n",""]);const s=o},7:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.editor-height-selector {\n\tposition: absolute;\n\tleft: 0;\n\tbottom: 0;\n}\n\n.editor-height-selector > .buttons {\n\tdisplay: inline-block;\n\tvertical-align: bottom;\n}\n.editor-height-selector > .buttons > button {\n\tdisplay: block;\n\tmargin: 0;\n\tpadding: 0;\n\tborder: none;\n\tbackground-color: var(--button-color);\n\tpointer-events: auto;\n\tcursor: pointer;\n}\n.editor-height-selector > .buttons > button:hover {\n\tbackground-color: var(--button-hover-color);\n}\n@media (hover: none) {\n\t.editor-height-selector > .buttons > button:hover {\n\t\tbackground-color: var(--button-color);\n\t}\n}\n.editor-height-selector > .buttons > button:active {\n\tbackground-color: var(--button-active-color);\n}\n\n.editor-height-selector > .buttons > button > img { \n\tmargin: 0;\n\tpadding: 0 6px;\n\twidth: 20px;\n\theight: 20px;\n\tvertical-align: bottom;\n\tpointer-events: none;\n}\n.editor-height-selector.touch > .buttons > button > img {\n\tpadding: 24px;\n\twidth: 40px;\n\theight: 40px;\n}\n\n.editor-height-selector > p {\n\tmargin: 0;\n\tpadding: 0 10px;\n\tdisplay: inline-block;\n\tvertical-align: bottom;\n\tline-height: 40px;\n\tmin-width: 140px;\n\tfont-size: 26px;\n\ttext-align: center;\n\tbackground-color: var(--surface-transparent-color);\n\tcolor: var(--text-color);\n}\n.editor-height-selector.touch > p {\n\tline-height: calc((40px + 2 * 24px) * 2);\n}\n",""]);const s=o},242:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.editor-help > .background {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\tz-index: 1;\n\twidth: 100%;\n\theight: 100%;\n\tbackground-color: rgba(20, 20, 30, 0.5);\n\tpointer-events: auto;\n}\n\n.editor-help > .container {\n\tposition: absolute;\n\tleft: calc(50% - 80% / 2);\n\ttop: 0;\n\tz-index: 2;\n\tdisplay: flex;\n\tflex-direction: column;\n\tbox-sizing: border-box;\n\twidth: 80%;\n\theight: 100%;\n\tbackground-color: var(--surface-color);\n}\n\n.editor-help > .container > h1 {\n\tmargin: 10px;\n\tpadding: 0;\n\tfont-weight: normal;\n\tfont-size: 38px;\n\ttext-align: center;\n\tcolor: var(--text-color);\n}\n\n.editor-help > .container > .content {\n\tflex-grow: 1;\n\tpadding: 40px;\n\tbackground-color: var(--surface-secondary-color);\n\toverflow-y: auto;\n\tpointer-events: auto;\n}\n\n.editor-help > .container > .content > h2 {\n\tmargin: 32px 0 16px 0;\n\tpadding: 0;\n\tfont-weight: normal;\n\tfont-size: 30px;\n\tcolor: var(--text-color);\n\tborder-bottom: 2px solid var(--text-color);\n}\n.editor-help > .container > .content > h2:first-of-type {\n\tmargin-top: 0;\n}\n\n.editor-help > .container > .content > p {\n\tmargin: 0;\n\tpadding: 0;\n\tfont-size: 20px;\n\tcolor: var(--text-color);\n\twhite-space: pre-wrap;\n}\n\n.editor-help > .container > .content > .part-images {\n\tdisplay: flex;\n\tjustify-content: space-around;\n}\n\n.editor-help > .container > .content > .part-images > div {\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n.editor-help > .container > .content > .part-images > div > img {\n\twidth: 128px;\n\theight: 128px;\n\tfilter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.4));\n\tpointer-events: none;\n}\n\n.editor-help > .container > .content > .part-images > div > span {\n\tmargin: 0;\n\tpadding: 0;\n\tfont-size: 20px;\n\tcolor: var(--text-color);\n\ttext-align: center;\n}\n\n.editor-help > .container > .button-wrapper > button {\n\tmargin: 10px;\n}\n",""]);const s=o},51:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.editor-touch-controls > button {\n\tposition: absolute;\n\tbottom: 176px;\n\tleft: 0;\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 160px;\n\theight: 160px;\n\tbackground-color: var(--button-color);\n\tborder: none;\n\topacity: 0.6;\n\tpointer-events: auto;\n}\n.editor-touch-controls > button > img {\n\tmargin: 0;\n\tpadding: 30px;\n\tvertical-align: top;\n\twidth: 100%;\n height: 100%;\n\tbox-sizing: border-box;\n\tpointer-events: none;\n\ttransition: padding 0.25s ease-out;\n}\n.editor-touch-controls > button.active > img {\n padding: 40px;\n}\n",""]);const s=o},804:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.game-toolbar {\n\tposition: absolute;\n\tleft: 0;\n\tbottom: 0;\n\tpadding: 8px 10px 8px 8px;\n\tbackground-color: var(--surface-color);\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n\topacity: 0;\n\ttransform: translateX(-10px);\n\ttransition: opacity ease-in-out 0.2s, transform ease-in-out 0.2s;\n}\n.game-toolbar.up {\n\tposition: absolute;\n\tbottom: auto;\n\ttop: 0;\n}\n\n.game-toolbar.visible {\n\topacity: 1;\n\ttransform: translateX(0);\n\ttransition: opacity 0.2s ease-in-out 0.5s, transform 0.2s ease-in-out 0.5s;\n}\n",""]);const s=o},229:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.hint {\n\tmargin: 10px;\n\tpadding: 0;\n\tposition: absolute;\n\tleft: 0;\n\ttop: 90px;\n\twidth: 100%;\n\ttext-align: center;\n\tfont-size: 40px;\n\tcolor: #fff;\n\ttext-shadow: 0 0 5px #000;\n\tpointer-events: none;\n\n\topacity: 0;\n}\n.hint.show {\n\ttop: 100px;\n\topacity: 1;\n\ttransition: opacity 0.25s ease-in-out, top 0.25s ease-in-out;\n}\n.hint.hide {\n\ttop: 90px;\n\topacity: 0;\n\ttransition: opacity 0.25s ease-in-out, top 0.25s ease-in-out;\n}\n",""]);const s=o},465:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.input-visualizer {\n position: absolute;\n left: 0;\n bottom: 64px;\n margin: 10px;\n padding: 0;\n --size: 96px;\n width: calc(var(--size) * 3);\n height: calc(var(--size) * 2);\n opacity: 0.9;\n}\n\n.input-visualizer > div {\n position: absolute;\n margin: 0;\n padding: 0;\n width: var(--size);\n height: var(--size);\n background-color: var(--surface-color);\n}\n\n.input-visualizer > .arrow-up {\n left: var(--size);\n top: 0;\n}\n\n.input-visualizer > .arrow-right {\n left: calc(var(--size) * 2);\n top: var(--size);\n}\n\n.input-visualizer > .arrow-down {\n left: var(--size);\n top: var(--size);\n}\n\n.input-visualizer > .arrow-left {\n left: 0;\n top: var(--size);\n}\n\n.input-visualizer > div.active {\n background-color: var(--surface-tertiary-color);\n}\n\n.input-visualizer > div > img {\n margin: 0;\n padding: 20px;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n}\n.input-visualizer > div.active > img {\n padding: 25px;\n}",""]);const s=o},657:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.leaderboard {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 600px;\n\theight: 100%;\n\ttext-align: left;\n\tdisplay: flex;\n\tflex-direction: column;\n\tbackground-color: var(--surface-color);\n}\n\n.leaderboard > h2 {\n\tmargin: 10px;\n\tpadding: 0;\n\tfont-weight: normal;\n\tfont-size: 38px;\n\ttext-align: center;\n\tcolor: var(--text-color);\n}\n\n.leaderboard > .container {\n\tmargin: 0;\n\tpadding: 0;\n\tflex-grow: 1;\n\tbackground-color: var(--surface-secondary-color);\n\toverflow-y: scroll;\n\tpointer-events: auto;\n}\n\n.leaderboard > .container > .loading-spinner {\n\tmargin: 50% auto;\n}\n\n.leaderboard > .container > .error-message {\n\tfont-size: 20px;\n\ttext-align: center;\n\tcolor: var(--text-color);\n}\n\n.leaderboard > .container > .buttons {\n\tposition: relative;\n\tmargin: 10px 10px 0 10px;\n\tpadding: 0;\n}\n\n.leaderboard > .container > .buttons:last-of-type {\n\tmargin-bottom: 10px;\n}\n\n.leaderboard > .container > .buttons > button.main {\n\tmargin: 0;\n\tpadding: 0;\n\tvertical-align: top;\n\twidth: 100%;\n\theight: 100px;\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n\ttext-align: left;\n\twhite-space: nowrap;\n}\n\n.leaderboard > .container > .buttons > button.main:disabled {\n\tbackground-color: var(--button-hover-color);\n}\n\n.leaderboard > .container > .buttons > button.main > img {\n\tbackground-color: rgba(0, 0, 0, 0.1);\n\twidth: 100px;\n\theight: 100px;\n}\n\n.leaderboard > .container > .buttons > button.main > .left, .leaderboard > .container > .buttons > button.main > .right {\n\tdisplay: inline-block;\n\tvertical-align: top;\n}\n\n.leaderboard > .container > .buttons > button.main > div > p {\n\tmargin: 0;\n\tpadding: 12px;\n\tfont-size: 28px;\n\tcolor: var(--text-color);\n}\n\n.leaderboard > .container > .buttons > button.main > div > .name {\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\twidth: 260px;\n}\n\n.leaderboard > .container > .buttons > button.main > div > .verified-state {\n\topacity: 0.8;\n\tposition: absolute;\n\tright: 6px;\n\tmargin: 6px 0 0 0;\n\tfont-size: 18px;\n}\n.leaderboard > .container > .buttons > button.main > div > .verified-state > img {\n\tmargin: 0 0 0 2px;\n\tpadding: 0;\n\theight: 12px;\n\tvertical-align: middle;\n}\n.leaderboard > .container > .buttons > button.main > div > .verified-state.verified {\n\tcolor: #5f5;\n}\n.leaderboard > .container > .buttons > button.main > div > .verified-state.invalid {\n\tcolor: #f55;\n}\n.leaderboard > .container > .buttons > button.main > div > .verified-state.pending {\n\tcolor: #ff5;\n}\n\n.leaderboard > .container > .buttons > button.preview {\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n\tmargin: 8px;\n\tpadding: 0 9px;\n\tbackground-color: var(--surface-color);\n\tclip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%);\n}\n.leaderboard > .container > .buttons > button.preview > img {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 16px;\n\tpointer-events: none;\n}\n\n.leaderboard > .pages {\n\tmargin: 10px 10px 0 10px;\n\tdisplay: flex;\n\tflex-direction: row;\n}\n.leaderboard > .pages > button.page {\n\tpadding: 0;\n\twidth: 0;\n\tflex-grow: 1;\n}\n.leaderboard > .pages > button.selected {\n\tbackground-color: var(--button-hover-color);\n}\n\n.leaderboard > .button-wrapper > .back {\n\tmargin: 10px;\n}\n\n.leaderboard > .button-wrapper > .icon-button {\n\tmargin: 10px 0;\n\tfloat: right;\n}\n.leaderboard > .button-wrapper > .icon-button.first {\n\tmargin: 10px 10px 10px 0;\n}\n\n.leaderboard > .button-wrapper > .icon-button > img {\n\twidth: 28px;\n}\n.leaderboard > .button-wrapper > .icon-button.disabled > img, .leaderboard > .button-wrapper > .icon-button:disabled > img {\n\topacity: 0.25;\n}\n",""]);const s=o},86:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.loading-spinner {\n\twidth: 40px;\n\theight: 40px;\n\tborder-radius: 50%;\n\tborder: 5px solid var(--surface-tertiary-color);\n\tborder-left-color: var(--text-color);\n\n\tanimation: 1s linear infinite forwards loading-spinner-spin;\n}\n\n@keyframes loading-spinner-spin {\n\tfrom {\n\t\ttransform: rotate(0);\n\t}\n\tto {\n\t\ttransform: rotate(360deg);\n\t}\n}\n",""]);const s=o},927:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.loading {\n\tmargin: 200px 0 0 0;\n\tpadding: 0;\n}\n\n.loading > p {\n\tmargin: 5px;\n\tpadding: 0;\n\tcolor: var(--text-color);\n\tfont-size: 32px;\n}\n\n.loading > div {\n\tmargin: 0 auto;\n\tpadding: 0;\n\twidth: 600px;\n\theight: 50px;\n\tbackground-color: var(--surface-color);\n\tclip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);\n\toverflow: hidden;\n}\n\n.loading > div > div {\n\tmargin: 15px 20px;\n\tpadding: 0;\n\twidth: 560px;\n\theight: 20px;\n\tclip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%);\n\tbackground-color: #224;\n\tbox-shadow: inset 0 0 6px #000;\n}\n\n.loading > div > div > div {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 0;\n\theight: 100%;\n\tclip-path: polygon(2px 0, 100% 0, calc(100% - 2px) 100%, 0 100%);\n\tbackground-color: #fff;\n\tbox-shadow: inset 0 0 6px #000;\n}\n",""]);const s=o},915:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.menu {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbackground-color: rgba(10,10,20,0.8);\n\ttext-align: center;\n}\n\n.menu > .logo {\n\tdisplay: block;\n\tmargin: 80px auto 180px auto;\n\tpadding: 0;\n\twidth: 1000px;\n\theight: 200px;\n\t-webkit-filter: drop-shadow(0 0 3px #000);\n\tfilter: drop-shadow(0 0 3px #000);\n}\n\n.menu .button-image {\n\tdisplay: inline-block;\n\tmargin: 10px 0;\n\tpadding: 0;\n\twidth: 200px;\n\theight: 200px;\n\tpointer-events: auto;\n}\n.menu .button-image > img {\n\tmargin: 40px 40px 0 40px;\n\tpadding: 0;\n\twidth: 96px;\n\ttransition: transform 0.2s ease-in-out;\n\tpointer-events: none;\n}\n.menu .button-image:not(:disabled):hover > img {\n\ttransform: translateY(-10px);\n}\n@media (hover: none) {\n\t.menu .button-image:not(:disabled):hover > img {\n\t\ttransform: none;\n\t}\n}\n.menu .button-image > p {\n\tmargin: 0;\n\tpadding: 0;\n\tcolor: var(--text-color);\n\tfont-size: 27px;\n}\n\n.menu > .bottom-buttons {\n\tmargin: 4px;\n\tpadding: 0;\n\tposition: absolute;\n\tleft: 0;\n\tbottom: 0;\n}\n\n.menu > .bottom-buttons > .small {\n\tpadding: 6px 12px;\n\tclip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);\n\tfont-size: 22px;\n}\n.menu > .bottom-buttons > .small > img {\n\tvertical-align: middle;\n}\n\n.menu > .discord-link {\n\tdisplay: block;\n\tposition: absolute;\n\tright: 0;\n\tbottom: 0;\n\tmargin: 0;\n\tpadding: 0;\n\tpointer-events: auto;\n}\n.menu > .discord-link > img {\n\tmargin: 8px 16px;\n\tpadding: 0;\n\theight: 40px;\n}\n\n.menu > .info {\n\tposition: absolute;\n\tleft: 0;\n\tbottom: 0;\n\twidth: 100%;\n}\n.menu > .info > a {\n\tdisplay: block;\n\tmargin: 0 auto;\n\tpadding: 5px;\n\twidth: fit-content;\n\tcolor: var(--text-color);\n\ttext-decoration: none;\n\tfont-size: 20px;\n\tpointer-events: auto;\n}\n.menu > .info > a:hover, .menu > .info > a:focus-visible {\n\ttext-decoration: underline;\n\toutline: none;\n}\n",""]);const s=o},437:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.message-box > .background {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\tz-index: 1;\n\twidth: 100%;\n\theight: 100%;\n\tbackground-color: rgba(20, 20, 30, 0.5);\n\tpointer-events: auto;\n}\n\n.message-box > .box {\n\tposition: absolute;\n\tleft: calc(50% - 500px / 2);\n\ttop: 30%;\n\tz-index: 2;\n\tmargin: 0;\n\tpadding: 16px;\n\twidth: 500px;\n\tbox-sizing: border-box;\n\tbackground-color: var(--surface-color);\n\ttext-align: center;\n}\n\n.message-box > .box > p {\n\tmargin: 5px 0 20px 0;\n\tpadding: 0;\n\tmin-height: 50px;\n\tline-height: 0.9;\n\tfont-size: 32px;\n\toverflow-wrap: break-word;\n\twhite-space: pre-wrap;\n\tcolor: var(--text-color);\n}\n\n.message-box.message > .box > button:first-of-type {\n\tdisplay: none;\n}\n\n.message-box.confirm > .box > button:first-of-type {\n\tfloat: left;\n}\n.message-box.confirm > .box > button:last-of-type {\n\tfloat: right;\n}\n\n.message-box > .box > button {\n\tmin-width: 140px;\n}\n",""]);const s=o},474:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.nickname {\n\tposition: absolute;\n\tleft: calc(50% - 500px / 2);\n\ttop: 40%;\n\tz-index: 2;\n\tmargin: 0;\n\tpadding: 16px;\n\twidth: 500px;\n\tbox-sizing: border-box;\n\tbackground-color: var(--surface-color);\n}\n\n.nickname > h1 {\n\tmargin: 0 4px 0 4px;\n\tpadding: 0;\n\tfont-size: 35px;\n\tfont-weight: normal;\n\tcolor: var(--text-color);\n}\n\n.nickname > input[type=text] {\n\tdisplay: block;\n\tmargin: 0;\n\tpadding: 0.25em;\n\tbox-sizing: border-box;\n\twidth: 100%;\n\tfont-size: 36px;\n\tfont-weight: normal;\n}\n\n.nickname > p {\n\tmargin: 16px 4px 0 4px;\n\tpadding: 0;\n\tfont-size: 20px;\n\tcolor: var(--text-color);\n}\n\n.nickname > button {\n\tdisplay: inline-block;\n\tmargin: 16px 0 0 0;\n}\n.nickname > button:last-of-type {\n\tfloat: right;\n}\n\n.nickname > button.delete {\n\tposition: absolute;\n\tright: 8px;\n\ttop: 0;\n\tfont-size: 16px;\n\tpadding: 8px 16px;\n}\n\n.nickname > button.delete > img.button-icon {\n\tmargin: -5px 0 -2px -3px;\n\theight: 16px;\n}\n\nbutton.nickname-verifier-button {\n\tposition: absolute;\n\tleft: 0;\n\tbottom: 22px;\n\tmargin: 0 4px;\n}\n\n.nickname-user-token {\n\tposition: absolute;\n\tleft: 0;\n\tbottom: 0;\n\tmargin: 0 4px;\n\ttext-align: left;\n\tfont-size: 18px;\n\topacity: 0.5;\n\tcolor: var(--text-color);\n\tpointer-events: all;\n\t-webkit-user-select: all;\n\t-moz-user-select: all;\n\t-ms-user-select: all;\n\tuser-select: all;\n}\n",""]);const s=o},768:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.preview-toolbar {\n\tposition: absolute;\n\tleft: 0;\n\tbottom: 0;\n\tpadding: 8px 10px 8px 8px;\n\tbackground-color: var(--surface-color);\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n}\n",""]);const s=o},140:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.profile-selection {\n\tposition: absolute;\n\tleft: calc(50% - 500px / 2);\n\ttop: 40%;\n\tz-index: 2;\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 500px;\n\tbox-sizing: border-box;\n\tbackground-color: var(--surface-secondary-color);\n}\n\n.profile-selection > .top-bar {\n\tmargin: 0;\n\tpadding: 10px;\n\tbackground-color: var(--surface-color);\n}\n\n.profile-selection > .top-bar > h2 {\n\tmargin: 0;\n\tpadding: 0;\n\tfont-weight: normal;\n\tfont-size: 38px;\n\ttext-align: center;\n\tcolor: var(--text-color);\n}\n\n.profile-selection > .slot {\n\tposition: relative;\n\tmargin: 10px 10px 0 10px;\n\tpadding: 0;\n}\n\n.profile-selection > .slot > button.main {\n\tmargin: 0;\n\tpadding: 0;\n\tvertical-align: top;\n\twidth: 100%;\n\theight: 100px;\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n\ttext-align: left;\n\twhite-space: nowrap;\n}\n\n.profile-selection > .slot > button.main.selected {\n\tbackground-color: var(--button-hover-color);\n}\n\n.profile-selection > .slot > button.main > img {\n\tbackground-color: rgba(0, 0, 0, 0.1);\n\twidth: 100px;\n\theight: 100px;\n\tpointer-events: none;\n}\n\n.profile-selection > .slot > button.main > .name {\n\tdisplay: inline-block;\n\tvertical-align: top;\n\tmargin: 0;\n\tpadding: 12px;\n\tfont-size: 28px;\n\tcolor: var(--text-color);\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\twidth: 320px;\n}\n\n.profile-selection > .bottom-bar {\n\tmargin: 10px 0 0 0;\n\tpadding: 10px;\n\tbackground-color: var(--surface-color);\n}\n\n.profile-selection > .bottom-bar > .button.right {\n\tfloat: right;\n}\n",""]);const s=o},643:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,'\n.settings-menu {\n\tposition: absolute;\n\tleft: calc(50% - 800px / 2);\n\ttop: 0;\n\tz-index: 2;\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 800px;\n\theight: 100%;\n\ttext-align: left;\n\tdisplay: flex;\n\tflex-direction: column;\n\tbackground-color: var(--surface-color);\n}\n\n.settings-menu > h2 {\n\tmargin: 10px;\n\tpadding: 0;\n\tfont-weight: normal;\n\tfont-size: 38px;\n\ttext-align: center;\n\tcolor: var(--text-color);\n}\n\n.settings-menu > .container {\n\tmargin: 0;\n\tpadding: 0;\n\tflex-grow: 1;\n\tbackground-color: var(--surface-secondary-color);\n\toverflow-y: scroll;\n\tpointer-events: auto;\n}\n\n.settings-menu > .container > h2 {\n\tmargin: 10px;\n\tpadding: 4px;\n\tfont-weight: normal;\n\tfont-size: 24px;\n\tcolor: var(--text-color);\n\tborder-bottom: 2px solid var(--text-color);\n}\n\n.settings-menu > .container > .setting {\n\tmargin: 10px;\n\tdisplay: flex;\n}\n\n.settings-menu > .container > .setting > p {\n\tdisplay: inline-block;\n\tmargin: 10px;\n\tpadding: 0;\n\tmin-width: 0;\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\tflex-grow: 1;\n\tfont-size: 28px;\n\ttext-align: left;\n\tcolor: var(--text-color);\n}\n\n.settings-menu > .container > .setting > .button-wrapper {\n\twhite-space: nowrap;\n}\n.settings-menu > .container > .setting.wrappable > .button-wrapper {\n\twhite-space: normal;\n}\n.settings-menu > .container > .setting.wrappable > .button-wrapper > button {\n\tmargin-bottom: 8px;\n\twidth: calc(100% / 4);\n\tfont-size: 23px;\n}\n\n.settings-menu > .container > .setting > .button-wrapper > button {\n\theight: 48px;\n\twhite-space: nowrap;\n}\n.settings-menu > .container > .setting > .button-wrapper > button.selected {\n\tbackground-color: var(--button-hover-color);\n}\n.settings-menu > .container > .setting > .button-wrapper > button.key-binding {\n\twidth: 210px;\n\tfont-size: 22px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\tvertical-align: top;\n}\n\n.settings-menu > .container > .setting > input[type="range"] {\n\tmargin: 0 20px;\n\tpadding: 0;\n\twidth: 390px;\n\t-webkit-appearance: none;\n\tappearance: none;\n\tbackground: transparent;\n\tcursor: pointer;\n\taccent-color: var(--text-color);\n}\n.settings-menu > .container > .setting > input[type="range"]::-webkit-slider-runnable-track {\n\tbackground-color: var(--surface-tertiary-color);\n\theight: 10px;\n}\n.settings-menu > .container > .setting > input[type="range"]::-moz-range-track {\n\tbackground-color: var(--surface-tertiary-color);\n\theight: 10px;\n}\n.settings-menu > .container > .setting > input[type="range"]::-webkit-slider-thumb {\n\t-webkit-appearance: none;\n\tappearance: none;\n\tborder-radius: 0;\n\tbackground: var(--text-color);\n\twidth: 32px;\n\theight: 32px;\n\tmargin: -13px 0 0 0;\n\tborder: 4px solid var(--button-color);\n\toutline: 2px solid var(--text-color);\n}\n.settings-menu > .container > .setting > input[type="range"]::-webkit-slider-thumb:hover {\n\tborder: 4px solid var(--button-hover-color);\n}\n@media (hover: none) {\n\t.settings-menu > .container > .setting > input[type="range"]::-webkit-slider-thumb:hover {\n\t\tborder: 4px solid var(--button-color);\n\t}\n}\n.settings-menu > .container > .setting > input[type="range"]::-webkit-slider-thumb:active {\n\tborder: 4px solid var(--button-active-color);\n}\n.settings-menu > .container > .setting > input[type="range"]::-moz-range-thumb {\n\t-webkit-appearance: none;\n\tappearance: none;\n\tborder-radius: 0;\n\tbackground: var(--text-color);\n\twidth: 24px;\n\theight: 24px;\n\tborder: 4px solid var(--button-color);\n\toutline: 2px solid var(--text-color);\n}\n.settings-menu > .container > .setting > input[type="range"]::-moz-range-thumb:hover {\n\tborder: 4px solid var(--button-hover-color);\n}\n@media (hover: none) {\n\t.settings-menu > .container > .setting > input[type="range"]::-moz-range-thumb:hover {\n\t\tborder: 4px solid var(--button-color);\n\t}\n}\n.settings-menu > .container > .setting > input[type="range"]::-moz-range-thumb:active {\n\tborder: 4px solid var(--button-active-color);\n}\n\n.settings-menu > .button-wrapper > .button {\n\tmargin: 10px 0;\n}\n\n.settings-menu > .button-wrapper > .button:first-of-type {\n\tmargin-left: 10px;\n}\n\n.settings-menu > .button-wrapper > .button:last-of-type {\n\tmargin-right: 10px;\n}\n\n.settings-menu > .button-wrapper > .button > img {\n\tmargin-top: -3px;\n}\n\n.settings-menu > .button-wrapper > .apply {\n\tfloat: right;\n}\n',""]);const s=o},151:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.speedometer {\n\tposition: absolute;\n\tbottom: 0;\n\tright: 0;\n\tmargin: 0;\n\tpadding: 8px 8px 8px 10px;\n\tmin-width: 140px;\n\tline-height: 0;\n\tfont-size: 40px;\n\tcolor: var(--text-color);\n\ttext-align: right;\n\topacity: 0.9;\n\tclip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%);\n\tbackground-color: var(--surface-color);\n}\n.speedometer.up {\n\tbottom: auto;\n\ttop: 0;\n\tclip-path: polygon(0 0, 100% 0, 100% 100%, 8px 100%);\n}\n\n.speedometer > div {\n\tmargin: 0;\n\tpadding: 0 0 0 16px;\n\tclip-path: polygon(6px 0, 100% 0, 100% 100%, 0 100%);\n\tbackground-color: var(--surface-tertiary-color);\n}\n.speedometer.up > div {\n\tclip-path: polygon(0 0, 100% 0, 100% 100%, 6px 100%);\n}\n\n.speedometer > div > span:last-of-type {\n\topacity: 0.5;\n\tmargin: 0 0.3em 0 0.25em;\n\tpadding: 0;\n\tfont-size: 0.5em;\n}\n.speedometer > div > span > span {\n\tdisplay: inline-block;\n\twidth: 0.5em;\n\ttext-align: center;\n}\n",""]);const s=o},419:(e,t,n)=>{"use strict";n.d(t,{A:()=>g});var i=n(601),r=n.n(i),a=n(314),o=n.n(a),s=n(417),l=n.n(s),c=new URL(n(682),n.b),h=new URL(n(208),n.b),d=new URL(n(832),n.b),u=o()(r()),p=l()(c),f=l()(h),m=l()(d);u.push([e.id,`\n:root {\n\t--text-color: #fff;\n\t--text-disabled-color: #5d6a7c;\n\t--surface-color: #28346a;\n\t--surface-secondary-color: #212b58;\n\t--surface-tertiary-color: #192042;\n\t--surface-transparent-color: rgba(40, 52, 106, 0.5);\n\t--button-color: #112052;\n\t--button-hover-color: #334b77;\n\t--button-active-color: #151f41;\n\t--button-disabled-color: #313d53;\n}\n\n@font-face {\n\tfont-family: ForcedSquare;\n\tsrc:\n\t\turl(${p}) format("woff2"),\n\t\turl(${f}) format("woff"),\n\t\turl(${m}) format("truetype");\n}\n\nhtml, body {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\theight: 100%;\n\toverflow: hidden;\n\n\tbackground: #000;\n}\n\n* {\n\tfont-family: ForcedSquare, Arial, sans-serif;\n\tline-height: 1;\n}\n\n#screen {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\theight: 100%;\n\t-webkit-tap-highlight-color: transparent;\n\t-webkit-user-select: none;\n\t-moz-user-select: none;\n\t-ms-user-select: none;\n\tuser-select: none;\n\ttouch-action: none;\n}\n\n#ui {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\twidth: 100%;\n\theight: 100%;\n\ttransform-origin: 0 0;\n\tpointer-events: none;\n\t-webkit-tap-highlight-color: transparent;\n\t-webkit-user-select: none;\n\t-moz-user-select: none;\n\t-ms-user-select: none;\n\tuser-select: none;\n}\n\n::-webkit-scrollbar {\n\twidth: 8px;\n\tbackground-color: #223;\n}\n::-webkit-scrollbar-thumb {\n\tborder-radius: 4px;\n\tbackground-color: #7272c2;\n}\n\n::selection {\n\tbackground-color: #5936d6;\n\tcolor: #fff;\n}\n\nbody {\n\tscrollbar-color: #7272c2 #223;\n}\n\n.hide-cursor {\n\tcursor: none;\n}\n\n.hidden {\n\tdisplay: none;\n}\n\ninput[type="text"] {\n\tmargin: 0;\n\tpadding: 4px 8px;\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n\tfont-size: 24px;\n\tfont-weight: bold;\n\tcolor: var(--text-color);\n\tbackground-color: var(--surface-tertiary-color);\n\tborder: none;\n\tpointer-events:auto;\n}\ninput[type="text"]:focus-visible {\n\toutline: none;\n}\n\n.button {\n\tposition: relative;\n\tmargin: 0;\n\tpadding: 8px 18px;\n\tbackground-color: var(--button-color);\n\tborder: none;\n\tclip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n\tcolor: var(--text-color);\n\tfont-size: 32px;\n\n\tpointer-events: auto;\n\t-webkit-user-select: none;\n\t-moz-user-select: none;\n\t-ms-user-select: none;\n\tuser-select: none;\n\tcursor: pointer;\n}\n.button::after {\n\tcontent: "";\n\tposition: absolute;\n\tleft: 0;\n\tbottom: 0;\n\tz-index: -1;\n\twidth: 0;\n\theight: 100%;\n\tbackground-color: var(--button-hover-color);\n\tborder-bottom: 2px solid var(--text-color);\n\ttransition: width 0.1s ease-in-out;\n}\n.button:hover::after {\n\twidth: 100%;\n}\n@media (hover: none) {\n\t.button::after {\n\t\tbackground-color: var(--button-active-color);\n\t}\n\n\t.button:hover::after {\n\t\twidth: 0;\n\t}\n}\n.button:active::after {\n\tbackground-color: var(--button-active-color);\n\twidth: 100%;\n}\n.button:focus-visible {\n\tbackground-color: var(--button-hover-color);\n\ttext-decoration: underline;\n\toutline: none;\n}\n.button > img.button-icon {\n\tmargin: -6px -4px 0 -4px;\n\tpadding: 0;\n\theight: 32px;\n\tvertical-align: middle;\n\tpointer-events: none;\n}\n.button:disabled {\n\tbackground-color: var(--button-disabled-color);\n\tcolor: var(--text-disabled-color);\n\tcursor: default;\n}\n.button:disabled:after {\n\tcontent: none;\n}\n`,""]);const g=u},817:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.time-announcer {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 35%;\n\twidth: 100%;\n\toverflow: hidden;\n}\n\n.time-announcer > .record {\n\tmargin: 0;\n\tpadding: 0;\n\tfont-size: 48px;\n\ttext-shadow: 0 0 5px #000;\n\tcolor: #5f5;\n\ttext-align: center;\n\topacity: 0;\n\tanimation: 0.3s ease-out 0.8s 1 normal forwards running time-announcer-record-animation;\n}\n\n.time-announcer > .track-name {\n\tmargin: 0 0 10px 0;\n\tpadding: 4px 20px;\n\tbox-sizing: border-box;\n\twidth: 100%;\n\tbackground-color: var(--surface-secondary-color);\n\tfont-size: 60px;\n\tcolor: var(--text-color);\n\ttext-align: center;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\tanimation: 0.3s ease-out 0s 1 normal forwards running time-announcer-animation;\n}\n\n.time-announcer > .current {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 0;\n\tbackground-color: var(--surface-color);\n\tfont-size: 48px;\n\tcolor: var(--text-color);\n\ttext-align: center;\n\tanimation: 0.5s ease-out 0s 1 normal forwards running time-announcer-animation;\n}\n.time-announcer > .difference > p {\n\tmargin: 0 0 0 auto;\n\tpadding: 0;\n\twidth: 0;\n\tbackground-color: var(--surface-secondary-color);\n\tcolor: #5f5;\n\tfont-size: 30px;\n\ttext-align: center;\n\tanimation: 0.4s ease-out 0.5s 1 normal forwards running time-announcer-animation;\n}\n.time-announcer > .difference.red > p {\n\tcolor: #f55;\n}\n.time-announcer > .difference > p.title {\n\tmargin-top: 30px;\n\tbackground-color: transparent;\n\ttext-shadow: 0 0 3px #000;\n}\n\n@keyframes time-announcer-record-animation {\n\tfrom {\n\t\topacity: 0;\n\t\ttransform: translateY(10px);\n\t}\n\n\tto {\n\t\topacity: 1;\n\t}\n}\n\n@keyframes time-announcer-animation {\n\tfrom {\n\t\twidth: 0;\n\t\topacity: 0;\n\t}\n\n\tto {\n\t\twidth: 100%;\n\t\topacity: 1;\n\t}\n}\n",""]);const s=o},543:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.time-bar {\n\tdisplay: flex;\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\tbackground-color: var(--surface-color);\n}\n\n.time-bar > button {\n\tmargin: 6px;\n\tpadding: 4px 12px;\n}\n.time-bar > button > img {\n\tmargin: 0 0 2px 0;\n\tpadding: 0;\n\tvertical-align: middle;\n\twidth: 28px;\n\theight: 28px;\n\tpointer-events: none;\n}\n\n.time-bar > .bar {\n\tposition: relative;\n\tmargin: 6px 6px 6px -8px;\n\tpadding: 0;\n\tflex-grow: 1;\n\theight: 40px;\n\tbackground-color: var(--surface-secondary-color);\n\tclip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n\ttouch-action: none;\n\tpointer-events: auto;\n}\n.time-bar > .bar > div {\n\tposition: relative;\n\twidth: calc(100% - 8px);\n\theight: 100%;\n}\n.time-bar > .bar > div > .unloaded-fill {\n\tposition: absolute;\n\tright: -8px;\n\ttop: 0;\n\tmargin: 0;\n\tpadding: 0;\n\theight: 100%;\n\tbackground-color: rgba(255, 255, 255, 0.1);\n\tclip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n\twill-change: width;\n}\n.time-bar > .bar > div > .fill {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\tmargin: 0;\n\tpadding: 0;\n\theight: 100%;\n\tbackground-color: #7272c2;\n\tclip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n\twill-change: width;\n}\n.time-bar > .bar > div > .dash {\n\tposition: absolute;\n\tz-index: 1;\n\tbottom: 0;\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 2px;\n\theight: 25%;\n\tbackground-color: rgba(0,0,0,0.25);\n}\n.time-bar > .bar > div > .dash.long {\n\theight: 50%;\n\tbackground-color: rgba(0,0,0,0.35);\n}\n",""]);const s=o},479:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.timer {\n\tposition: absolute;\n\tbottom: 0;\n\tleft: 0;\n\twidth: 100%;\n\ttext-align: center;\n\topacity: 0.9;\n}\n.timer.up {\n\tbottom: auto;\n\ttop: 0;\n}\n\n.timer > div {\n\tmargin: 0;\n\tpadding: 0;\n\tdisplay: inline-flex;\n\tflex-direction: column;\n\twidth: 240px;\n\tvertical-align: bottom;\n}\n.timer.up > div {\n\tflex-direction: column-reverse;\n\tvertical-align: top;\n}\n.timer > div > h2 {\n\tmargin: 0 auto;\n\tpadding: 0;\n\twidth: 220px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\tcolor: var(--text-color);\n\tfont-size: 26px;\n\tfont-weight: normal;\n\ttext-shadow: 1px 1px 1px var(--surface-color), -1px 1px 1px var(--surface-color), -1px -1px 1px var(--surface-color), 1px -1px 1px var(--surface-color);\n}\n\n.timer > div > div {\n\tmargin: 0;\n\tpadding: 0;\n\tbackground-color: var(--surface-color);\n}\n.timer > .left > div {\n\tpadding: 8px 4px 8px 10px;\n\tclip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%);\n}\n.timer.up > .left > div {\n\tclip-path: polygon(0 0, 100% 0, 100% 100%, 8px 100%);\n}\n.timer > .center > div {\n\tposition: relative;\n\tz-index: 1;\n\tmargin: 0 -12px;\n\tpadding: 8px 10px;\n\tclip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 100%, 0 100%);\n}\n.timer.up > .center > div {\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 8px 100%);\n}\n.timer > .right > div {\n\tpadding: 8px 10px 8px 4px;\n\tclip-path: polygon(0 0, calc(100% - 8px) 0, 100% 100%, 0 100%);\n}\n.timer.up > .right > div {\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n}\n\n.timer > div > div > p {\n\tmargin: 0;\n\tpadding: 0;\n\tbackground-color: var(--surface-tertiary-color);\n\tcolor: var(--text-color);\n\tfont-size: 34px;\n}\n.timer > .left > div > p {\n\tclip-path: polygon(6px 0, 100% 0, 100% 100%, 0 100%);\n}\n.timer.up > .left > div > p {\n\tclip-path: polygon(0 0, 100% 0, 100% 100%, 6px 100%);\n}\n.timer > .center > div > p {\n\tfont-size: 46px;\n\tclip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 100%, 0 100%);\n}\n.timer.up > .center > div > p {\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 6px 100%);\n}\n.timer > .right > div > p {\n\tclip-path: polygon(0 0, calc(100% - 6px) 0, 100% 100%, 0 100%);\n}\n.timer.up > .right > div > p {\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%);\n}\n\n.timer > div > div > p.green {\n\tcolor: #5f5;\n}\n.timer > div > div > p.red {\n\tcolor:#f55;\n}\n\n.timer > div > div > p > span {\n\tdisplay: inline-block;\n\twidth: 0.5em;\n\ttext-align: center;\n}\n.timer > div > div > p > span.sign {\n\tmargin-left: -4px;\n\twidth: 0.7em;\n}\n",""]);const s=o},571:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.touch-controls > button {\n\tposition: absolute;\n\ttop: calc(1.5cm + 50px);\n\tmargin: 10px;\n\tpadding: 0;\n\twidth: 160px;\n\theight: 160px;\n\tbackground-color: var(--button-color);\n\tborder: none;\n\topacity: 0.6;\n\tpointer-events: auto;\n}\n.touch-controls > button > img {\n\tmargin: 0;\n\tpadding: 30px;\n\tvertical-align: top;\n\twidth: 100%;\n height: 100%;\n\tbox-sizing: border-box;\n\tpointer-events: none;\n\ttransition: padding 0.25s ease-out;\n}\n.touch-controls > button.active > img {\n padding: 40px;\n}\n\n.touch-controls > .quit {\n\tleft: 1.5cm;\n}\n\n.touch-controls > .reset {\n\tright: 1.5cm;\n}\n\n.touch-controls > .left-container {\n\tposition: absolute;\n\tleft: 1.5cm;\n\tbottom: 1.5cm;\n}\n\n.touch-controls > .right-container {\n\tposition: absolute;\n\tright: 1.5cm;\n\tbottom: 1.5cm;\n}\n.touch-controls > .right-container > div {\n\tdisplay: inline-block;\n}\n\n.touch-controls > div > div {\n\tmargin: 10px;\n\tpadding: 0;\n\twidth: 160px;\n\theight: 160px;\n\tbackground-color: var(--button-color);\n\topacity: 0.5;\n\tpointer-events: auto;\n}\n.touch-controls > div > div.active {\n\tbackground-color: var(--button-active-color);\n\topacity: 0.6;\n}\n\n.touch-controls > div > div > img {\n\tmargin: 0;\n\tpadding: 40px;\n\tvertical-align: top;\n\twidth: 100%;\n height: 100%;\n\tbox-sizing: border-box;\n\tpointer-events: none;\n}\n.touch-controls > div > div.active > img {\n padding: 50px;\n}\n",""]);const s=o},687:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.track-export > .background {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\tz-index: 1;\n\twidth: 100%;\n\theight: 100%;\n\tbackground-color: rgba(20, 20, 30, 0.5);\n\tpointer-events: auto;\n}\n\n.track-export > .box {\n\tposition: absolute;\n\tleft: calc(50% - 80% / 2);\n\ttop: 20px;\n\tz-index: 2;\n\tmargin: 0;\n\tpadding: 10px;\n\tbox-sizing: border-box;\n\twidth: 80%;\n\theight: calc(100% - 20px * 2);\n\tbackground-color: var(--surface-color);\n}\n\n.track-export > .box > .bar {\n\ttext-align: left;\n\tpointer-events: auto;\n}\n.track-export > .box > .bar > .button.right {\n\tfloat: right;\n}\n\n.track-export > .box > textarea {\n\tmargin: 10px 0 0 0;\n\tpadding: 10px;\n\tbox-sizing: border-box;\n\tmin-width: 100%;\n\tmax-width: 100%;\n\tmin-height: calc(100% - 52px - 10px);\n\tmax-height: calc(100% - 52px - 10px);\n\tpointer-events: auto;\n\tbackground-color: var(--surface-tertiary-color);\n\tborder: none;\n\tresize: none;\n\tcolor: var(--text-color);\n\tword-break: break-all;\n\tfont-size: 20px;\n}\n.track-export > .box > textarea:focus-visible {\n\toutline: none;\n}\n",""]);const s=o},586:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.track-info {\n\tposition: absolute;\n\tleft: calc(50% - 1050px / 2);\n\ttop: 0;\n\tz-index: 2;\n\tdisplay: flex;\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 1000px;\n\theight: 100%;\n}\n\n.track-info > .side-panel {\n\tposition: relative;\n\tdisplay: inline-block;\n\tmargin-left: 50px;\n\twidth: 400px;\n\t\n\tbackground-color: var(--surface-color);\n}\n\n.track-info > .side-panel > h2 {\n\tmargin: 10px 10px 0 10px;\n\tpadding: 0;\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\tfont-weight: normal;\n\tfont-size: 38px;\n\ttext-align: center;\n\tcolor: var(--text-color);\n}\n\n\n.track-info > .side-panel > .thumbnail {\n\tmargin: 10px 0 0 0;\n\tpadding: 40px;\n\tbackground-color: var(--surface-secondary-color);\n}\n\n.track-info > .side-panel > .thumbnail > canvas {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 300px;\n\theight: 300px;\n\tobject-fit: contain;\n\t-webkit-filter: drop-shadow(0 0 3px #000);\n\tfilter: drop-shadow(0 0 3px #000);\n\timage-rendering: pixelated;\n}\n\n.track-info > .side-panel > p {\n\tmargin: 16px 0;\n\tpadding: 0;\n\tfont-size: 32px;\n\tcolor: var(--text-color);\n}\n\n.track-info > .side-panel > .button.play {\n\tposition: absolute;\n\tbottom: 10px;\n\tleft: 0;\n\tmargin: 10px 10px 0 10px;\n\tpadding: 0 0 0 30px;\n\tbox-sizing: border-box;\n\twidth: calc(100% - 2 * 10px);\n\theight: 100px;\n\tclip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);\n\ttext-align: center;\n\tfont-size: 50px;\n}\n\n.track-info > .side-panel > .button.play > img {\n\tmargin: 0 0 0 10px;\n\tpadding: 0;\n\tvertical-align: middle;\n\twidth: 48px;\n\ttransition: transform 0.2s ease-in-out;\n\tpointer-events: none;\n}\n\n.track-info > .side-panel > .button.play:hover > img {\n\ttransform: translateX(10px);\n}\n\n@media (hover: none) {\n\t.track-info > .side-panel > .button.play:hover > img {\n\t\ttransform: none;\n\t}\n}\n\n.track-info > .side-panel > .back {\n\tmargin: 10px;\n}\n\n.track-info > .side-panel > .leaderboard-button {\n\tmargin: 10px;\n\tfloat: right;\n}\n",""]);const s=o},353:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.track-selection {\n\tposition: absolute;\n\tbottom: 0;\n\twidth: 100%;\n\theight: 100%;\n\ttext-align: center;\n}\n\n.track-selection > .bar {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\tbackground-color: var(--surface-color);\n\ttext-align: left;\n\n\tpointer-events:auto;\n}\n.track-selection > .bar > .button {\n\tmargin: 8px 12px;\n}\n.track-selection > .bar > .button.right {\n\tfloat: right;\n}\n\n.track-selection .tracks-container {\n\tmargin: 0;\n\tpadding: 20px 0;\n\tbox-sizing: border-box;\n\twidth: 100%;\n\theight: calc(100% - 64px);\n\toverflow-y: auto;\n\tpointer-events: auto;\n}\n.track-selection.editor-track-selection .tracks-container {\n\tbackground-color: rgba(20, 20, 45, 0.8);\n}\n\n.track-selection h2 {\n\tmargin: 0.5em 0.75em;\n\tpadding: 0;\n\tcolor: var(--text-color);\n\tfont-size: 50px;\n\tfont-weight: normal;\n\tborder-bottom: 2px solid var(--text-color);\n}\n\n.track-selection .tracks-container .track {\n\tposition: relative;\n\tdisplay: inline-block;\n}\n\n.track-selection .tracks-container .track button {\n\tmargin: 10px;\n\tpadding: 0;\n\tcolor: var(--text-color);\n\tfont-size: 32px;\n}\n.track-selection .tracks-container .track button:after {\n\tborder-bottom: none;\n}\n.track-selection .tracks-container .track button:focus-visible {\n\ttext-decoration: none;\n}\n\n.track-selection .track-title {\n\tmargin: 0;\n\tpadding: 4px;\n\tfont-size: 25px;\n\tbackground-color: var(--surface-secondary-color);\n}\n.track-selection .tracks-container .track button:focus-visible .track-title {\n\ttext-decoration: underline;\n}\n.track-selection .track-title > p {\n\tmargin: 0;\n\tpadding: 0 22px;\n\twidth: 208px;\n\tbox-sizing: border-box;\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n}\n\n.track-selection .track canvas {\n\tmargin: 0;\n\tpadding: 20px 40px;\n\twidth: 128px;\n\theight: 128px;\n\tobject-fit: contain;\n\t-webkit-filter: drop-shadow(0 0 3px #000);\n\tfilter: drop-shadow(0 0 3px #000);\n\timage-rendering: pixelated;\n}\n\n.track-selection .record {\n\tmargin: 0;\n\tpadding: 4px;\n\tfont-size: 24px;\n\tbackground-color: var(--surface-secondary-color);\n\tcolor: var(--text-color);\n}\n\n.track-selection .delete-button {\n\tposition: absolute;\n\ttop: 7px;\n\tright: 6px;\n\tmargin: 0;\n\tpadding: 0;\n\tline-height: 0;\n\tborder-radius: 2px;\n\tborder: none;\n\tbackground-color: var(--button-color);\n\n\tpointer-events: auto;\n\tcursor: pointer;\n}\n.track-selection .delete-button:hover {\n\tbackground-color: var(--button-hover-color);\n}\n@media (hover: none) {\n\t.track-selection .delete-button:hover {\n\t\tbackground-color: var(--button-color);\n\t}\n}\n.track-selection .delete-button:active {\n\tbackground-color: var(--button-active-color);\n}\n.track-selection .delete-button > img {\n\tmargin: 0;\n\tpadding: 0;\n\theight: 20px;\n\tvertical-align: top;\n\tpointer-events: none;\n}\n\n",""]);const s=o},207:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n#transition-layer {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbackground-color: #000;\n\tpointer-events: none;\n\n\topacity: 0;\n\ttransition: 0.25s ease-in-out opacity;\n}\n",""]);const s=o},818:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.user-export {\n\tposition: absolute;\n\tleft: calc(50% - 500px / 2);\n\ttop: 35%;\n\tz-index: 2;\n\tmargin: 0;\n\tpadding: 10px;\n\tbox-sizing: border-box;\n\twidth: 500px;\n\theight: 150px;\n\tbackground-color: var(--surface-color);\n}\n\n.user-export > textarea {\n\tmargin: 0;\n\tpadding: 10px;\n\tbox-sizing: border-box;\n\tmin-width: 100%;\n\tmax-width: 100%;\n\tmin-height: calc(100% - 52px - 10px);\n\tmax-height: calc(100% - 52px - 10px);\n\tpointer-events: auto;\n\tbackground-color: var(--surface-tertiary-color);\n\tborder: none;\n\tresize: none;\n\tcolor: var(--text-color);\n\tword-break: break-all;\n\tfont-size: 20px;\n}\n.user-export > textarea:focus-visible {\n\toutline: none;\n}\n\n.user-export > .bar {\n\tmargin: 8px 0 0 0;\n}\n\n.user-export > .bar > .button.right {\n\tfloat: right;\n}\n",""]);const s=o},796:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(601),r=n.n(i),a=n(314),o=n.n(a)()(r());o.push([e.id,"\n.verifier-ui {\n\tposition: absolute;\n\tleft: calc(50% - 500px / 2);\n\ttop: 0;\n\tz-index: 2;\n\tmargin: 0;\n\tpadding: 16px;\n\twidth: 500px;\n\theight: 100%;\n\toverflow-y: scroll;\n\tbox-sizing: border-box;\n\tbackground-color: var(--surface-color);\n\tpointer-events: auto;\n}\n\n.verifier-ui > p {\n\tmargin: 16px 4px 0 4px;\n\tpadding: 0;\n\tfont-size: 20px;\n\tcolor: var(--text-color);\n\twhite-space: pre-wrap;\n}\n\n.verifier-ui > button {\n\tdisplay: inline-block;\n\tmargin: 16px 0 0 0;\n}\n",""]);const s=o},314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,r,a){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(i)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(o[l]=!0)}for(var c=0;c<e.length;c++){var h=[].concat(e[c]);i&&o[h[0]]||(void 0!==a&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=a),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},417:e=>{"use strict";e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},601:e=>{"use strict";e.exports=function(e){return e[1]}},312:(e,t,n)=>{var i;
/**
* [js-sha256]{@link https://github.com/emn178/js-sha256}
*
* @version 0.11.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2024
* @license MIT
*/!function(){"use strict";var t="input is invalid type",r="object"==typeof window,a=r?window:{};a.JS_SHA256_NO_WINDOW&&(r=!1);var o=!r&&"object"==typeof self,s=!a.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;s?a=n.g:o&&(a=self);var l=!a.JS_SHA256_NO_COMMON_JS&&e.exports,c=n.amdO,h=!a.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),u=[-2147483648,8388608,32768,128],p=[24,16,8,0],f=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],m=["hex","array","digest","arrayBuffer"],g=[];!a.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!h||!a.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var v=function(e,t){return function(n){return new _(t,!0).update(n)[e]()}},w=function(e){var t=v("hex",e);s&&(t=y(t,e)),t.create=function(){return new _(e)},t.update=function(e){return t.create().update(e)};for(var n=0;n<m.length;++n){var i=m[n];t[i]=v(i,e)}return t},y=function(e,i){var r,o=n(394),s=n(903).Buffer,l=i?"sha224":"sha256";r=s.from&&!a.JS_SHA256_NO_BUFFER_FROM?s.from:function(e){return new s(e)};return function(n){if("string"==typeof n)return o.createHash(l).update(n,"utf8").digest("hex");if(null==n)throw new Error(t);return n.constructor===ArrayBuffer&&(n=new Uint8Array(n)),Array.isArray(n)||ArrayBuffer.isView(n)||n.constructor===s?o.createHash(l).update(r(n)).digest("hex"):e(n)}},b=function(e,t){return function(n,i){return new k(n,t,!0).update(i)[e]()}},x=function(e){var t=b("hex",e);t.create=function(t){return new k(t,e)},t.update=function(e,n){return t.create(e).update(n)};for(var n=0;n<m.length;++n){var i=m[n];t[i]=b(i,e)}return t};function _(e,t){t?(g[0]=g[16]=g[1]=g[2]=g[3]=g[4]=g[5]=g[6]=g[7]=g[8]=g[9]=g[10]=g[11]=g[12]=g[13]=g[14]=g[15]=0,this.blocks=g):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}function k(e,n,i){var r,a=typeof e;if("string"===a){var o,s=[],l=e.length,c=0;for(r=0;r<l;++r)(o=e.charCodeAt(r))<128?s[c++]=o:o<2048?(s[c++]=192|o>>>6,s[c++]=128|63&o):o<55296||o>=57344?(s[c++]=224|o>>>12,s[c++]=128|o>>>6&63,s[c++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++r)),s[c++]=240|o>>>18,s[c++]=128|o>>>12&63,s[c++]=128|o>>>6&63,s[c++]=128|63&o);e=s}else{if("object"!==a)throw new Error(t);if(null===e)throw new Error(t);if(h&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||h&&ArrayBuffer.isView(e)))throw new Error(t)}e.length>64&&(e=new _(n,!0).update(e).array());var d=[],u=[];for(r=0;r<64;++r){var p=e[r]||0;d[r]=92^p,u[r]=54^p}_.call(this,n,i),this.update(u),this.oKeyPad=d,this.inner=!0,this.sharedMemory=i}_.prototype.update=function(e){if(!this.finalized){var n,i=typeof e;if("string"!==i){if("object"!==i)throw new Error(t);if(null===e)throw new Error(t);if(h&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||h&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var r,a,o=0,s=e.length,l=this.blocks;o<s;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,this.block=l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),n)for(a=this.start;o<s&&a<64;++o)l[a>>>2]|=e[o]<<p[3&a++];else for(a=this.start;o<s&&a<64;++o)(r=e.charCodeAt(o))<128?l[a>>>2]|=r<<p[3&a++]:r<2048?(l[a>>>2]|=(192|r>>>6)<<p[3&a++],l[a>>>2]|=(128|63&r)<<p[3&a++]):r<55296||r>=57344?(l[a>>>2]|=(224|r>>>12)<<p[3&a++],l[a>>>2]|=(128|r>>>6&63)<<p[3&a++],l[a>>>2]|=(128|63&r)<<p[3&a++]):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++o)),l[a>>>2]|=(240|r>>>18)<<p[3&a++],l[a>>>2]|=(128|r>>>12&63)<<p[3&a++],l[a>>>2]|=(128|r>>>6&63)<<p[3&a++],l[a>>>2]|=(128|63&r)<<p[3&a++]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=l[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},_.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=u[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},_.prototype.hash=function(){var e,t,n,i,r,a,o,s,l,c=this.h0,h=this.h1,d=this.h2,u=this.h3,p=this.h4,m=this.h5,g=this.h6,v=this.h7,w=this.blocks;for(e=16;e<64;++e)t=((r=w[e-15])>>>7|r<<25)^(r>>>18|r<<14)^r>>>3,n=((r=w[e-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,w[e]=w[e-16]+t+w[e-7]+n|0;for(l=h&d,e=0;e<64;e+=4)this.first?(this.is224?(a=300032,v=(r=w[0]-1413257819)-150054599|0,u=r+24177077|0):(a=704751109,v=(r=w[0]-210244248)-1521486534|0,u=r+143694565|0),this.first=!1):(t=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),i=(a=c&h)^c&d^l,v=u+(r=v+(n=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&m^~p&g)+f[e]+w[e])|0,u=r+(t+i)|0),t=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),i=(o=u&c)^u&h^a,g=d+(r=g+(n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&p^~v&m)+f[e+1]+w[e+1])|0,t=((d=r+(t+i)|0)>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),i=(s=d&u)^d&c^o,m=h+(r=m+(n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&v^~g&p)+f[e+2]+w[e+2])|0,t=((h=r+(t+i)|0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),i=(l=h&d)^h&u^s,p=c+(r=p+(n=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&g^~m&v)+f[e+3]+w[e+3])|0,c=r+(t+i)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+c|0,this.h1=this.h1+h|0,this.h2=this.h2+d|0,this.h3=this.h3+u|0,this.h4=this.h4+p|0,this.h5=this.h5+m|0,this.h6=this.h6+g|0,this.h7=this.h7+v|0},_.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3,r=this.h4,a=this.h5,o=this.h6,s=this.h7,l=d[e>>>28&15]+d[e>>>24&15]+d[e>>>20&15]+d[e>>>16&15]+d[e>>>12&15]+d[e>>>8&15]+d[e>>>4&15]+d[15&e]+d[t>>>28&15]+d[t>>>24&15]+d[t>>>20&15]+d[t>>>16&15]+d[t>>>12&15]+d[t>>>8&15]+d[t>>>4&15]+d[15&t]+d[n>>>28&15]+d[n>>>24&15]+d[n>>>20&15]+d[n>>>16&15]+d[n>>>12&15]+d[n>>>8&15]+d[n>>>4&15]+d[15&n]+d[i>>>28&15]+d[i>>>24&15]+d[i>>>20&15]+d[i>>>16&15]+d[i>>>12&15]+d[i>>>8&15]+d[i>>>4&15]+d[15&i]+d[r>>>28&15]+d[r>>>24&15]+d[r>>>20&15]+d[r>>>16&15]+d[r>>>12&15]+d[r>>>8&15]+d[r>>>4&15]+d[15&r]+d[a>>>28&15]+d[a>>>24&15]+d[a>>>20&15]+d[a>>>16&15]+d[a>>>12&15]+d[a>>>8&15]+d[a>>>4&15]+d[15&a]+d[o>>>28&15]+d[o>>>24&15]+d[o>>>20&15]+d[o>>>16&15]+d[o>>>12&15]+d[o>>>8&15]+d[o>>>4&15]+d[15&o];return this.is224||(l+=d[s>>>28&15]+d[s>>>24&15]+d[s>>>20&15]+d[s>>>16&15]+d[s>>>12&15]+d[s>>>8&15]+d[s>>>4&15]+d[15&s]),l},_.prototype.toString=_.prototype.hex,_.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3,r=this.h4,a=this.h5,o=this.h6,s=this.h7,l=[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i,r>>>24&255,r>>>16&255,r>>>8&255,255&r,a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o];return this.is224||l.push(s>>>24&255,s>>>16&255,s>>>8&255,255&s),l},_.prototype.array=_.prototype.digest,_.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e},k.prototype=new _,k.prototype.finalize=function(){if(_.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();_.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),_.prototype.finalize.call(this)}};var E=w();E.sha256=E,E.sha224=w(!0),E.sha256.hmac=x(),E.sha224.hmac=x(!0),l?e.exports=E:(a.sha256=E.sha256,a.sha224=E.sha224,c&&(void 0===(i=function(){return E}.call(E,n,E,e))||(e.exports=i)))}()},72:e=>{"use strict";var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var a={},o=[],s=0;s<e.length;s++){var l=e[s],c=i.base?l[0]+i.base:l[0],h=a[c]||0,d="".concat(c," ").concat(h);a[c]=h+1;var u=n(d),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==u)t[u].references++,t[u].updater(p);else{var f=r(p,i);i.byIndex=s,t.splice(s,0,{identifier:d,updater:f,references:1})}o.push(d)}return o}function r(e,t){var n=t.domAPI(t);n.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var a=i(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<a.length;o++){var s=n(a[o]);t[s].references--}for(var l=i(e,r),c=0;c<a.length;c++){var h=n(a[c]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}a=l}}},659:e=>{"use strict";var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},56:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},825:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},113:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},832:(e,t,n)=>{"use strict";e.exports=n.p+"4e75ed8189c5a7b6fbf8.ttf"},208:(e,t,n)=>{"use strict";e.exports=n.p+"2e5b7bff10d7782e539c.woff"},682:(e,t,n)=>{"use strict";e.exports=n.p+"a82f15d48dbc61b6edeb.woff2"},903:()=>{},394:()=>{}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var a=t[i]={id:i,exports:{}};return e[i](a,a.exports,n),a.exports}n.m=e,n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.p="./",n.b=document.baseURI||self.location.href,n.nc=void 0,(()=>{"use strict";var e=n(72),t=n.n(e),i=n(825),r=n.n(i),a=n(659),o=n.n(a),s=n(56),l=n.n(s),c=n(540),h=n.n(c),d=n(113),u=n.n(d),p=n(419),f={};f.styleTagTransform=u(),f.setAttributes=l(),f.insert=o().bind(null,"head"),f.domAPI=r(),f.insertStyleElement=h();t()(p.A,f);p.A&&p.A.locals&&p.A.locals;const m="166",g=0,v=1,w=2,y=0,b=1,x=2,_=3,k=1,E=2,S=3,M=0,T=1,A=2,C=100,P=101,R=102,L=200,I=201,N=202,D=203,U=204,B=205,O=206,z=207,F=208,W=209,H=210,V=211,G=212,j=213,q=214,X=0,Y=1,K=2,Z=0,J=1,Q=2,$=3,ee=4,te=5,ne=6,ie=7,re="attached",ae=301,oe=302,se=303,le=304,ce=306,he=1e3,de=1001,ue=1002,pe=1003,fe=1004,me=1005,ge=1006,ve=1007,we=1008,ye=1009,be=1010,xe=1011,_e=1012,ke=1013,Ee=1014,Se=1015,Me=1016,Te=1017,Ae=1018,Ce=1020,Pe=35902,Re=1021,Le=1022,Ie=1023,Ne=1024,De=1025,Ue=1026,Be=1027,Oe=1028,ze=1029,Fe=1030,We=1031,He=1033,Ve=33776,Ge=33777,je=33778,qe=33779,Xe=35840,Ye=35841,Ke=35842,Ze=35843,Je=36196,Qe=37492,$e=37496,et=37808,tt=37809,nt=37810,it=37811,rt=37812,at=37813,ot=37814,st=37815,lt=37816,ct=37817,ht=37818,dt=37819,ut=37820,pt=37821,ft=36492,mt=36494,gt=36495,vt=36283,wt=36284,yt=36285,bt=36286,xt=2300,_t=2301,kt=2302,Et=2400,St=2401,Mt=2402,Tt="",At="srgb",Ct="srgb-linear",Pt="display-p3",Rt="display-p3-linear",Lt="linear",It="srgb",Nt="rec709",Dt="p3",Ut=7680,Bt=512,Ot=513,zt=514,Ft=515,Wt=516,Ht=517,Vt=518,Gt=519,jt=35044,qt="300 es",Xt=2e3,Yt=2001;class Kt{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t<i;t++)n[t].call(this,e);e.target=null}}}const Zt=["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"];let Jt=1234567;const Qt=Math.PI/180,$t=180/Math.PI;function en(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Zt[255&e]+Zt[e>>8&255]+Zt[e>>16&255]+Zt[e>>24&255]+"-"+Zt[255&t]+Zt[t>>8&255]+"-"+Zt[t>>16&15|64]+Zt[t>>24&255]+"-"+Zt[63&n|128]+Zt[n>>8&255]+"-"+Zt[n>>16&255]+Zt[n>>24&255]+Zt[255&i]+Zt[i>>8&255]+Zt[i>>16&255]+Zt[i>>24&255]).toLowerCase()}function tn(e,t,n){return Math.max(t,Math.min(n,e))}function nn(e,t){return(e%t+t)%t}function rn(e,t,n){return(1-n)*e+n*t}function an(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 new Error("Invalid component type.")}}function on(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const sn={DEG2RAD:Qt,RAD2DEG:$t,generateUUID:en,clamp:tn,euclideanModulo:nn,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:rn,damp:function(e,t,n,i){return rn(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(nn(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(Jt=e);let t=Jt+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*Qt},radToDeg:function(e){return e*$t},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){const a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),c=a((t+i)/2),h=o((t+i)/2),d=a((t-i)/2),u=o((t-i)/2),p=a((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(s*h,l*d,l*u,s*c);break;case"YZY":e.set(l*u,s*h,l*d,s*c);break;case"ZXZ":e.set(l*d,l*u,s*h,s*c);break;case"XZX":e.set(s*h,l*f,l*p,s*c);break;case"YXY":e.set(l*p,s*h,l*f,s*c);break;case"ZYZ":e.set(l*f,l*p,s*h,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:on,denormalize:an};class ln{constructor(e=0,t=0){ln.prototype.isVector2=!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 new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("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){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(tn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const 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){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class cn{constructor(e,t,n,i,r,a,o,s,l){cn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,o,s,l)}set(e,t,n,i,r,a,o,s,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const 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){const 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){const n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],h=n[7],d=n[2],u=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],w=i[4],y=i[7],b=i[2],x=i[5],_=i[8];return r[0]=a*f+o*v+s*b,r[3]=a*m+o*w+s*x,r[6]=a*g+o*y+s*_,r[1]=l*f+c*v+h*b,r[4]=l*m+c*w+h*x,r[7]=l*g+c*y+h*_,r[2]=d*f+u*v+p*b,r[5]=d*m+u*w+p*x,r[8]=d*g+u*y+p*_,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-n*r*c+n*o*s+i*r*l-i*a*s}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],h=c*a-o*l,d=o*s-c*r,u=l*r-a*s,p=t*h+n*d+i*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=h*f,e[1]=(i*l-c*n)*f,e[2]=(o*n-i*a)*f,e[3]=d*f,e[4]=(c*t-i*s)*f,e[5]=(i*r-o*t)*f,e[6]=u*f,e[7]=(n*s-l*t)*f,e[8]=(a*t-n*r)*f,this}transpose(){let e;const 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){const 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,i,r,a,o){const s=Math.cos(r),l=Math.sin(r);return this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-i*l,i*s,-i*(-l*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(hn.makeScale(e,t)),this}rotate(e){return this.premultiply(hn.makeRotation(-e)),this}translate(e,t){return this.premultiply(hn.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){const 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){const 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){const 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)}}const hn=new cn;function dn(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function un(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function pn(){const e=un("canvas");return e.style.display="block",e}const fn={};function mn(e){e in fn||(fn[e]=!0,console.warn(e))}const gn=(new cn).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),vn=(new cn).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),wn={[Ct]:{transfer:Lt,primaries:Nt,toReference:e=>e,fromReference:e=>e},[At]:{transfer:It,primaries:Nt,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[Rt]:{transfer:Lt,primaries:Dt,toReference:e=>e.applyMatrix3(vn),fromReference:e=>e.applyMatrix3(gn)},[Pt]:{transfer:It,primaries:Dt,toReference:e=>e.convertSRGBToLinear().applyMatrix3(vn),fromReference:e=>e.applyMatrix3(gn).convertLinearToSRGB()}},yn=new Set([Ct,Rt]),bn={enabled:!0,_workingColorSpace:Ct,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(e){if(!yn.has(e))throw new Error(`Unsupported working color space, "${e}".`);this._workingColorSpace=e},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;const i=wn[t].toReference;return(0,wn[n].fromReference)(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return wn[e].primaries},getTransfer:function(e){return e===Tt?Lt:wn[e].transfer}};function xn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function _n(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let kn;class En{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===kn&&(kn=un("canvas")),kn.width=e.width,kn.height=e.height;const n=kn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=kn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=un("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*xn(r[e]/255);return n.putImageData(i,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*xn(t[e]/255)):t[e]=xn(t[e]);return{data:t,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Sn=0;class Mn{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Sn++}),this.uuid=en(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(Tn(i[t].image)):e.push(Tn(i[t]))}else e=Tn(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function Tn(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?En.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let An=0;class Cn extends Kt{constructor(e=Cn.DEFAULT_IMAGE,t=Cn.DEFAULT_MAPPING,n=1001,i=1001,r=1006,a=1008,o=Ie,s=ye,l=Cn.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:An++}),this.uuid=en(),this.name="",this.source=new Mn(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=s,this.offset=new ln(0,0),this.repeat=new ln(1,1),this.center=new ln(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new cn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){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)}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.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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.6,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,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(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case he:e.x=e.x-Math.floor(e.x);break;case de:e.x=e.x<0?0:1;break;case ue:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case he:e.y=e.y-Math.floor(e.y);break;case de:e.y=e.y<0?0:1;break;case ue:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}Cn.DEFAULT_IMAGE=null,Cn.DEFAULT_MAPPING=300,Cn.DEFAULT_ANISOTROPY=1;class Pn{constructor(e=0,t=0,n=0,i=1){Pn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}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,i){return this.x=e,this.y=t,this.z=n,this.w=i,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 new Error("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 new Error("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=void 0!==e.w?e.w:1,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){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const 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,i,r;const a=.01,o=.1,s=e.elements,l=s[0],c=s[4],h=s[8],d=s[1],u=s[5],p=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(c-d)<a&&Math.abs(h-f)<a&&Math.abs(p-m)<a){if(Math.abs(c+d)<o&&Math.abs(h+f)<o&&Math.abs(p+m)<o&&Math.abs(l+u+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,s=(u+1)/2,v=(g+1)/2,w=(c+d)/4,y=(h+f)/4,b=(p+m)/4;return e>s&&e>v?e<a?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(e),i=w/n,r=y/n):s>v?s<a?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(s),n=w/i,r=b/i):v<a?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(v),n=y/r,i=b/r),this.set(n,i,r,t),this}let v=Math.sqrt((m-p)*(m-p)+(h-f)*(h-f)+(d-c)*(d-c));return Math.abs(v)<.001&&(v=1),this.x=(m-p)/v,this.y=(h-f)/v,this.z=(d-c)/v,this.w=Math.acos((l+u+g-1)/2),this}setFromMatrixPosition(e){const 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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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}}class Rn extends Kt{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Pn(0,0,e,t),this.scissorTest=!1,this.viewport=new Pn(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ge,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Cn(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let e=0;e<a;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}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 i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;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;const t=Object.assign({},e.texture.image);return this.texture.source=new Mn(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ln extends Rn{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class In extends Cn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=pe,this.minFilter=pe,this.wrapR=de,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Nn extends Cn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=pe,this.minFilter=pe,this.wrapR=de,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Dn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,o){let s=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const d=r[a+0],u=r[a+1],p=r[a+2],f=r[a+3];if(0===o)return e[t+0]=s,e[t+1]=l,e[t+2]=c,void(e[t+3]=h);if(1===o)return e[t+0]=d,e[t+1]=u,e[t+2]=p,void(e[t+3]=f);if(h!==f||s!==d||l!==u||c!==p){let e=1-o;const t=s*d+l*u+c*p+h*f,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,t*n);e=Math.sin(e*a)/r,o=Math.sin(o*a)/r}const r=o*n;if(s=s*e+d*r,l=l*e+u*r,c=c*e+p*r,h=h*e+f*r,e===1-o){const e=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=e,l*=e,c*=e,h*=e}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,a){const o=n[i],s=n[i+1],l=n[i+2],c=n[i+3],h=r[a],d=r[a+1],u=r[a+2],p=r[a+3];return e[t]=o*p+c*h+s*u-l*d,e[t+1]=s*p+c*d+l*h-o*u,e[t+2]=l*p+c*u+o*d-s*h,e[t+3]=c*p-o*h-s*d-l*u,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,i){return this._x=e,this._y=t,this._z=n,this._w=i,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){const n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),d=s(n/2),u=s(i/2),p=s(r/2);switch(a){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],s=t[9],l=t[2],c=t[6],h=t[10],d=n+o+h;if(d>0){const e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(c-s)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-s)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(s+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(s+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(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(tn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,a=this._w;let o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const s=1-o*o;if(s<=Number.EPSILON){const e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(s),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*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}}class Un{constructor(e=0,t=0,n=0){Un.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(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 new Error("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 new Error("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(On.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(On.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=2*(a*i-o*n),c=2*(o*t-r*i),h=2*(r*n-a*t);return this.x=t+s*l+a*h-o*c,this.y=n+s*c+o*l-r*h,this.z=i+s*h+r*c-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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){const n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Bn.copy(this).projectOnVector(e),this.sub(Bn)}reflect(e){return this.sub(Bn.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(tn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}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){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*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){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}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(){const e=Math.random()*Math.PI*2,t=2*Math.random()-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}}const Bn=new Un,On=new Dn;class zn{constructor(e=new Un(1/0,1/0,1/0),t=new Un(-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(Wn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Wn.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){const n=Wn.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);const n=e.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,Wn):Wn.fromBufferAttribute(i,t),Wn.applyMatrix4(e.matrixWorld),this.expandByPoint(Wn);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),Hn.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),Hn.copy(n.boundingBox)),Hn.applyMatrix4(e.matrixWorld),this.union(Hn)}const i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[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,Wn),Wn.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(Kn),Zn.subVectors(this.max,Kn),Vn.subVectors(e.a,Kn),Gn.subVectors(e.b,Kn),jn.subVectors(e.c,Kn),qn.subVectors(Gn,Vn),Xn.subVectors(jn,Gn),Yn.subVectors(Vn,jn);let t=[0,-qn.z,qn.y,0,-Xn.z,Xn.y,0,-Yn.z,Yn.y,qn.z,0,-qn.x,Xn.z,0,-Xn.x,Yn.z,0,-Yn.x,-qn.y,qn.x,0,-Xn.y,Xn.x,0,-Yn.y,Yn.x,0];return!!$n(t,Vn,Gn,jn,Zn)&&(t=[1,0,0,0,1,0,0,0,1],!!$n(t,Vn,Gn,jn,Zn)&&(Jn.crossVectors(qn,Xn),t=[Jn.x,Jn.y,Jn.z],$n(t,Vn,Gn,jn,Zn)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Wn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Wn).length()),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()||(Fn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Fn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Fn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Fn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Fn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Fn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Fn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Fn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Fn)),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)}}const Fn=[new Un,new Un,new Un,new Un,new Un,new Un,new Un,new Un],Wn=new Un,Hn=new zn,Vn=new Un,Gn=new Un,jn=new Un,qn=new Un,Xn=new Un,Yn=new Un,Kn=new Un,Zn=new Un,Jn=new Un,Qn=new Un;function $n(e,t,n,i,r){for(let a=0,o=e.length-3;a<=o;a+=3){Qn.fromArray(e,a);const o=r.x*Math.abs(Qn.x)+r.y*Math.abs(Qn.y)+r.z*Math.abs(Qn.z),s=t.dot(Qn),l=n.dot(Qn),c=i.dot(Qn);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>o)return!1}return!0}const ei=new zn,ti=new Un,ni=new Un;class ii{constructor(e=new Un,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){const n=this.center;void 0!==t?n.copy(t):ei.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),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){const 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){const 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=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;ti.subVectors(e,this.center);const t=ti.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(ti,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(ni.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ti.copy(e.center).add(ni)),this.expandByPoint(ti.copy(e.center).sub(ni))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const ri=new Un,ai=new Un,oi=new Un,si=new Un,li=new Un,ci=new Un,hi=new Un;class di{constructor(e=new Un,t=new Un(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,ri)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const 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){const t=ri.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ri.copy(this.origin).addScaledVector(this.direction,t),ri.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){ai.copy(e).add(t).multiplyScalar(.5),oi.copy(t).sub(e).normalize(),si.copy(this.origin).sub(ai);const r=.5*e.distanceTo(t),a=-this.direction.dot(oi),o=si.dot(this.direction),s=-si.dot(oi),l=si.lengthSq(),c=Math.abs(1-a*a);let h,d,u,p;if(c>0)if(h=a*s-o,d=a*o-s,p=r*c,h>=0)if(d>=-p)if(d<=p){const e=1/c;h*=e,d*=e,u=h*(h+a*d+2*o)+d*(a*h+d+2*s)+l}else d=r,h=Math.max(0,-(a*d+o)),u=-h*h+d*(d+2*s)+l;else d=-r,h=Math.max(0,-(a*d+o)),u=-h*h+d*(d+2*s)+l;else d<=-p?(h=Math.max(0,-(-a*r+o)),d=h>0?-r:Math.min(Math.max(-r,-s),r),u=-h*h+d*(d+2*s)+l):d<=p?(h=0,d=Math.min(Math.max(-r,-s),r),u=d*(d+2*s)+l):(h=Math.max(0,-(a*r+o)),d=h>0?r:Math.min(Math.max(-r,-s),r),u=-h*h+d*(d+2*s)+l);else d=a>0?-r:r,h=Math.max(0,-(a*d+o)),u=-h*h+d*(d+2*s)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(ai).addScaledVector(oi,d),u}intersectSphere(e,t){ri.subVectors(e.center,this.origin);const n=ri.dot(this.direction),i=ri.dot(ri)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,o,s;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),c>=0?(r=(e.min.y-d.y)*c,a=(e.max.y-d.y)*c):(r=(e.max.y-d.y)*c,a=(e.min.y-d.y)*c),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),h>=0?(o=(e.min.z-d.z)*h,s=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,s=(e.min.z-d.z)*h),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,ri)}intersectTriangle(e,t,n,i,r){li.subVectors(t,e),ci.subVectors(n,e),hi.crossVectors(li,ci);let a,o=this.direction.dot(hi);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}si.subVectors(this.origin,e);const s=a*this.direction.dot(ci.crossVectors(si,ci));if(s<0)return null;const l=a*this.direction.dot(li.cross(si));if(l<0)return null;if(s+l>o)return null;const c=-a*si.dot(hi);return c<0?null:this.at(c/o,r)}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)}}class ui{constructor(e,t,n,i,r,a,o,s,l,c,h,d,u,p,f,m){ui.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,o,s,l,c,h,d,u,p,f,m)}set(e,t,n,i,r,a,o,s,l,c,h,d,u,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=l,g[6]=c,g[10]=h,g[14]=d,g[3]=u,g[7]=p,g[11]=f,g[15]=m,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 ui).fromArray(this.elements)}copy(e){const 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){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const 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 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){const t=this.elements,n=e.elements,i=1/pi.setFromMatrixColumn(e,0).length(),r=1/pi.setFromMatrixColumn(e,1).length(),a=1/pi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,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){const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=a*c,n=a*h,i=o*c,r=o*h;t[0]=s*c,t[4]=-s*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-o*s,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*s}else if("YXZ"===e.order){const e=s*c,n=s*h,i=l*c,r=l*h;t[0]=e+r*o,t[4]=i*o-n,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-o,t[2]=n*o-i,t[6]=r+e*o,t[10]=a*s}else if("ZXY"===e.order){const e=s*c,n=s*h,i=l*c,r=l*h;t[0]=e-r*o,t[4]=-a*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=a*c,t[9]=r-e*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){const e=a*c,n=a*h,i=o*c,r=o*h;t[0]=s*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=s*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){const e=a*s,n=a*l,i=o*s,r=o*l;t[0]=s*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=a*s,n=a*l,i=o*s,r=o*l;t[0]=s*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=a*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=r*h+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(mi,e,gi)}lookAt(e,t,n){const i=this.elements;return yi.subVectors(e,t),0===yi.lengthSq()&&(yi.z=1),yi.normalize(),vi.crossVectors(n,yi),0===vi.lengthSq()&&(1===Math.abs(n.z)?yi.x+=1e-4:yi.z+=1e-4,yi.normalize(),vi.crossVectors(n,yi)),vi.normalize(),wi.crossVectors(yi,vi),i[0]=vi.x,i[4]=wi.x,i[8]=yi.x,i[1]=vi.y,i[5]=wi.y,i[9]=yi.y,i[2]=vi.z,i[6]=wi.z,i[10]=yi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],h=n[5],d=n[9],u=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],w=n[7],y=n[11],b=n[15],x=i[0],_=i[4],k=i[8],E=i[12],S=i[1],M=i[5],T=i[9],A=i[13],C=i[2],P=i[6],R=i[10],L=i[14],I=i[3],N=i[7],D=i[11],U=i[15];return r[0]=a*x+o*S+s*C+l*I,r[4]=a*_+o*M+s*P+l*N,r[8]=a*k+o*T+s*R+l*D,r[12]=a*E+o*A+s*L+l*U,r[1]=c*x+h*S+d*C+u*I,r[5]=c*_+h*M+d*P+u*N,r[9]=c*k+h*T+d*R+u*D,r[13]=c*E+h*A+d*L+u*U,r[2]=p*x+f*S+m*C+g*I,r[6]=p*_+f*M+m*P+g*N,r[10]=p*k+f*T+m*R+g*D,r[14]=p*E+f*A+m*L+g*U,r[3]=v*x+w*S+y*C+b*I,r[7]=v*_+w*M+y*P+b*N,r[11]=v*k+w*T+y*R+b*D,r[15]=v*E+w*A+y*L+b*U,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],h=e[6],d=e[10],u=e[14];return e[3]*(+r*s*h-i*l*h-r*o*d+n*l*d+i*o*u-n*s*u)+e[7]*(+t*s*u-t*l*d+r*a*d-i*a*u+i*l*c-r*s*c)+e[11]*(+t*l*h-t*o*u-r*a*h+n*a*u+r*o*c-n*l*c)+e[15]*(-i*o*c-t*s*h+t*o*d+i*a*h-n*a*d+n*s*c)}transpose(){const e=this.elements;let 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){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],h=e[9],d=e[10],u=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=h*m*l-f*d*l+f*s*u-o*m*u-h*s*g+o*d*g,w=p*d*l-c*m*l-p*s*u+a*m*u+c*s*g-a*d*g,y=c*f*l-p*h*l+p*o*u-a*f*u-c*o*g+a*h*g,b=p*h*s-c*f*s-p*o*d+a*f*d+c*o*m-a*h*m,x=t*v+n*w+i*y+r*b;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/x;return e[0]=v*_,e[1]=(f*d*r-h*m*r-f*i*u+n*m*u+h*i*g-n*d*g)*_,e[2]=(o*m*r-f*s*r+f*i*l-n*m*l-o*i*g+n*s*g)*_,e[3]=(h*s*r-o*d*r-h*i*l+n*d*l+o*i*u-n*s*u)*_,e[4]=w*_,e[5]=(c*m*r-p*d*r+p*i*u-t*m*u-c*i*g+t*d*g)*_,e[6]=(p*s*r-a*m*r-p*i*l+t*m*l+a*i*g-t*s*g)*_,e[7]=(a*d*r-c*s*r+c*i*l-t*d*l-a*i*u+t*s*u)*_,e[8]=y*_,e[9]=(p*h*r-c*f*r-p*n*u+t*f*u+c*n*g-t*h*g)*_,e[10]=(a*f*r-p*o*r+p*n*l-t*f*l-a*n*g+t*o*g)*_,e[11]=(c*o*r-a*h*r-c*n*l+t*h*l+a*n*u-t*o*u)*_,e[12]=b*_,e[13]=(c*f*i-p*h*i+p*n*d-t*f*d-c*n*m+t*h*m)*_,e[14]=(p*o*i-a*f*i-p*n*s+t*f*s+a*n*m-t*o*m)*_,e[15]=(a*h*i-c*o*i+c*n*s-t*h*s-a*n*d+t*o*d)*_,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const 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],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}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){const 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){const 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){const 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){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,l=r*a,c=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,c*o+n,c*s-i*a,0,l*s-i*o,c*s+i*a,r*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,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,l=r+r,c=a+a,h=o+o,d=r*l,u=r*c,p=r*h,f=a*c,m=a*h,g=o*h,v=s*l,w=s*c,y=s*h,b=n.x,x=n.y,_=n.z;return i[0]=(1-(f+g))*b,i[1]=(u+y)*b,i[2]=(p-w)*b,i[3]=0,i[4]=(u-y)*x,i[5]=(1-(d+g))*x,i[6]=(m+v)*x,i[7]=0,i[8]=(p+w)*_,i[9]=(m-v)*_,i[10]=(1-(d+f))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=pi.set(i[0],i[1],i[2]).length();const a=pi.set(i[4],i[5],i[6]).length(),o=pi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],fi.copy(this);const s=1/r,l=1/a,c=1/o;return fi.elements[0]*=s,fi.elements[1]*=s,fi.elements[2]*=s,fi.elements[4]*=l,fi.elements[5]*=l,fi.elements[6]*=l,fi.elements[8]*=c,fi.elements[9]*=c,fi.elements[10]*=c,t.setFromRotationMatrix(fi),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,i,r,a,o=2e3){const s=this.elements,l=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let u,p;if(o===Xt)u=-(a+r)/(a-r),p=-2*a*r/(a-r);else{if(o!==Yt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);u=-a/(a-r),p=-a*r/(a-r)}return s[0]=l,s[4]=0,s[8]=h,s[12]=0,s[1]=0,s[5]=c,s[9]=d,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,i,r,a,o=2e3){const s=this.elements,l=1/(t-e),c=1/(n-i),h=1/(a-r),d=(t+e)*l,u=(n+i)*c;let p,f;if(o===Xt)p=(a+r)*h,f=-2*h;else{if(o!==Yt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);p=r*h,f=-1*h}return s[0]=2*l,s[4]=0,s[8]=0,s[12]=-d,s[1]=0,s[5]=2*c,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=f,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){const 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){const 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}}const pi=new Un,fi=new ui,mi=new Un(0,0,0),gi=new Un(1,1,1),vi=new Un,wi=new Un,yi=new Un,bi=new ui,xi=new Dn;class _i{constructor(e=0,t=0,n=0,i=_i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,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,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,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){const i=e.elements,r=i[0],a=i[4],o=i[8],s=i[1],l=i[5],c=i[9],h=i[2],d=i[6],u=i[10];switch(t){case"XYZ":this._y=Math.asin(tn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-tn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(tn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,r));break;case"ZYX":this._y=Math.asin(-tn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(tn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-tn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return bi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(bi,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return xi.setFromEuler(this),this.setFromQuaternion(xi,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],void 0!==e[3]&&(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}}_i.DEFAULT_ORDER="XYZ";class ki{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return!!(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}}let Ei=0;const Si=new Un,Mi=new Dn,Ti=new ui,Ai=new Un,Ci=new Un,Pi=new Un,Ri=new Dn,Li=new Un(1,0,0),Ii=new Un(0,1,0),Ni=new Un(0,0,1),Di={type:"added"},Ui={type:"removed"},Bi={type:"childadded",child:null},Oi={type:"childremoved",child:null};class zi extends Kt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ei++}),this.uuid=en(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=zi.DEFAULT_UP.clone();const e=new Un,t=new _i,n=new Dn,i=new Un(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new ui},normalMatrix:{value:new cn}}),this.matrix=new ui,this.matrixWorld=new ui,this.matrixAutoUpdate=zi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=zi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ki,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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 Mi.setFromAxisAngle(e,t),this.quaternion.multiply(Mi),this}rotateOnWorldAxis(e,t){return Mi.setFromAxisAngle(e,t),this.quaternion.premultiply(Mi),this}rotateX(e){return this.rotateOnAxis(Li,e)}rotateY(e){return this.rotateOnAxis(Ii,e)}rotateZ(e){return this.rotateOnAxis(Ni,e)}translateOnAxis(e,t){return Si.copy(e).applyQuaternion(this.quaternion),this.position.add(Si.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Li,e)}translateY(e){return this.translateOnAxis(Ii,e)}translateZ(e){return this.translateOnAxis(Ni,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ti.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Ai.copy(e):Ai.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ci.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ti.lookAt(Ci,Ai,this.up):Ti.lookAt(Ai,Ci,this.up),this.quaternion.setFromRotationMatrix(Ti),i&&(Ti.extractRotation(i.matrixWorld),Mi.setFromRotationMatrix(Ti),this.quaternion.premultiply(Mi.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.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(Di),Bi.child=e,this.dispatchEvent(Bi),Bi.child=null):console.error("THREE.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}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ui),Oi.child=e,this.dispatchEvent(Oi),Oi.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ti.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Ti.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ti),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Di),Bi.child=e,this.dispatchEvent(Bi),Bi.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,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].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(Ci,e,Pi),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ci,Ri,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++){t[n].updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++){e[t].updateWorldMatrix(!1,!0)}}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()}))),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){const t=a(e.geometries),i=a(e.materials),r=a(e.textures),o=a(e.images),s=a(e.shapes),l=a(e.skeletons),c=a(e.animations),h=a(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function a(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}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.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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];this.add(n.clone())}return this}}zi.DEFAULT_UP=new Un(0,1,0),zi.DEFAULT_MATRIX_AUTO_UPDATE=!0,zi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Fi=new Un,Wi=new Un,Hi=new Un,Vi=new Un,Gi=new Un,ji=new Un,qi=new Un,Xi=new Un,Yi=new Un,Ki=new Un;class Zi{constructor(e=new Un,t=new Un,n=new Un){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Fi.subVectors(e,t),i.cross(Fi);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Fi.subVectors(i,t),Wi.subVectors(n,t),Hi.subVectors(e,t);const a=Fi.dot(Fi),o=Fi.dot(Wi),s=Fi.dot(Hi),l=Wi.dot(Wi),c=Wi.dot(Hi),h=a*l-o*o;if(0===h)return r.set(0,0,0),null;const d=1/h,u=(l*s-o*c)*d,p=(a*c-o*s)*d;return r.set(1-u-p,p,u)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,Vi)&&(Vi.x>=0&&Vi.y>=0&&Vi.x+Vi.y<=1)}static getInterpolation(e,t,n,i,r,a,o,s){return null===this.getBarycoord(e,t,n,i,Vi)?(s.x=0,s.y=0,"z"in s&&(s.z=0),"w"in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(r,Vi.x),s.addScaledVector(a,Vi.y),s.addScaledVector(o,Vi.z),s)}static isFrontFacing(e,t,n,i){return Fi.subVectors(n,t),Wi.subVectors(e,t),Fi.cross(Wi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 Fi.subVectors(this.c,this.b),Wi.subVectors(this.a,this.b),.5*Fi.cross(Wi).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Zi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Zi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Zi.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Zi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Zi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,o;Gi.subVectors(i,n),ji.subVectors(r,n),Xi.subVectors(e,n);const s=Gi.dot(Xi),l=ji.dot(Xi);if(s<=0&&l<=0)return t.copy(n);Yi.subVectors(e,i);const c=Gi.dot(Yi),h=ji.dot(Yi);if(c>=0&&h<=c)return t.copy(i);const d=s*h-c*l;if(d<=0&&s>=0&&c<=0)return a=s/(s-c),t.copy(n).addScaledVector(Gi,a);Ki.subVectors(e,r);const u=Gi.dot(Ki),p=ji.dot(Ki);if(p>=0&&u<=p)return t.copy(r);const f=u*l-s*p;if(f<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(ji,o);const m=c*p-u*h;if(m<=0&&h-c>=0&&u-p>=0)return qi.subVectors(r,i),o=(h-c)/(h-c+(u-p)),t.copy(i).addScaledVector(qi,o);const g=1/(m+f+d);return a=f*g,o=d*g,t.copy(n).addScaledVector(Gi,a).addScaledVector(ji,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Ji={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},Qi={h:0,s:0,l:0},$i={h:0,s:0,l:0};function er(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class tr{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(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&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=At){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,bn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=bn.workingColorSpace){return this.r=e,this.g=t,this.b=n,bn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=bn.workingColorSpace){if(e=nn(e,1),t=tn(t,0,1),n=tn(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=er(r,i,e+1/3),this.g=er(r,i,e),this.b=er(r,i,e-1/3)}return bn.toWorkingColorSpace(this,i),this}setStyle(e,t=At){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=At){const n=Ji[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),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=xn(e.r),this.g=xn(e.g),this.b=xn(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=At){return bn.fromWorkingColorSpace(nr.copy(this),e),65536*Math.round(tn(255*nr.r,0,255))+256*Math.round(tn(255*nr.g,0,255))+Math.round(tn(255*nr.b,0,255))}getHexString(e=At){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=bn.workingColorSpace){bn.fromWorkingColorSpace(nr.copy(this),t);const n=nr.r,i=nr.g,r=nr.b,a=Math.max(n,i,r),o=Math.min(n,i,r);let s,l;const c=(o+a)/2;if(o===a)s=0,l=0;else{const e=a-o;switch(l=c<=.5?e/(a+o):e/(2-a-o),a){case n:s=(i-r)/e+(i<r?6:0);break;case i:s=(r-n)/e+2;break;case r:s=(n-i)/e+4}s/=6}return e.h=s,e.s=l,e.l=c,e}getRGB(e,t=bn.workingColorSpace){return bn.fromWorkingColorSpace(nr.copy(this),t),e.r=nr.r,e.g=nr.g,e.b=nr.b,e}getStyle(e=At){bn.fromWorkingColorSpace(nr.copy(this),e);const t=nr.r,n=nr.g,i=nr.b;return e!==At?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(Qi),this.setHSL(Qi.h+e,Qi.s+t,Qi.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(Qi),e.getHSL($i);const n=rn(Qi.h,$i.h,t),i=rn(Qi.s,$i.s,t),r=rn(Qi.l,$i.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,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}}const nr=new tr;tr.NAMES=Ji;let ir=0;class rr extends Kt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ir++}),this.uuid=en(),this.name="",this.type="Material",this.blending=1,this.side=M,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=C,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new tr(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=Ut,this.stencilZFail=Ut,this.stencilZPass=Ut,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.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}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(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()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(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),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(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,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),this.side!==M&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),this.blendEquation!==C&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ut&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ut&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ut&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}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;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].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.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class ar extends rr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new tr(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 _i,this.combine=X,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}}const or=new Un,sr=new ln;class lr{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=jt,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Se,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return mn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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 i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)sr.fromBufferAttribute(this,t),sr.applyMatrix3(e),this.setXY(t,sr.x,sr.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)or.fromBufferAttribute(this,t),or.applyMatrix3(e),this.setXYZ(t,or.x,or.y,or.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)or.fromBufferAttribute(this,t),or.applyMatrix4(e),this.setXYZ(t,or.x,or.y,or.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)or.fromBufferAttribute(this,t),or.applyNormalMatrix(e),this.setXYZ(t,or.x,or.y,or.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)or.fromBufferAttribute(this,t),or.transformDirection(e),this.setXYZ(t,or.x,or.y,or.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=an(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=on(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=an(t,this.array)),t}setX(e,t){return this.normalized&&(t=on(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=an(t,this.array)),t}setY(e,t){return this.normalized&&(t=on(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=an(t,this.array)),t}setZ(e,t){return this.normalized&&(t=on(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=an(t,this.array)),t}setW(e,t){return this.normalized&&(t=on(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=on(t,this.array),n=on(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=on(t,this.array),n=on(n,this.array),i=on(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=on(t,this.array),n=on(n,this.array),i=on(i,this.array),r=on(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const 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!==jt&&(e.usage=this.usage),e}}class cr extends lr{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class hr extends lr{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class dr extends lr{constructor(e,t,n){super(new Float32Array(e),t,n)}}let ur=0;const pr=new ui,fr=new zi,mr=new Un,gr=new zn,vr=new zn,wr=new Un;class yr extends Kt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ur++}),this.uuid=en(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(dn(e)?hr:cr)(e,1):this.index=e,this}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 void 0!==this.attributes[e]}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){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new cn).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return pr.makeRotationFromQuaternion(e),this.applyMatrix4(pr),this}rotateX(e){return pr.makeRotationX(e),this.applyMatrix4(pr),this}rotateY(e){return pr.makeRotationY(e),this.applyMatrix4(pr),this}rotateZ(e){return pr.makeRotationZ(e),this.applyMatrix4(pr),this}translate(e,t,n){return pr.makeTranslation(e,t,n),this.applyMatrix4(pr),this}scale(e,t,n){return pr.makeScale(e,t,n),this.applyMatrix4(pr),this}lookAt(e){return fr.lookAt(e),fr.updateMatrix(),this.applyMatrix4(fr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(mr).negate(),this.translate(mr.x,mr.y,mr.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new dr(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Un(-1/0,-1/0,-1/0),new Un(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];gr.setFromBufferAttribute(n),this.morphTargetsRelative?(wr.addVectors(this.boundingBox.min,gr.min),this.boundingBox.expandByPoint(wr),wr.addVectors(this.boundingBox.max,gr.max),this.boundingBox.expandByPoint(wr)):(this.boundingBox.expandByPoint(gr.min),this.boundingBox.expandByPoint(gr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new ii);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Un,1/0);if(e){const n=this.boundingSphere.center;if(gr.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];vr.setFromBufferAttribute(n),this.morphTargetsRelative?(wr.addVectors(gr.min,vr.min),gr.expandByPoint(wr),wr.addVectors(gr.max,vr.max),gr.expandByPoint(wr)):(gr.expandByPoint(vr.min),gr.expandByPoint(vr.max))}gr.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)wr.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(wr));if(t)for(let r=0,a=t.length;r<a;r++){const a=t[r],o=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)wr.fromBufferAttribute(a,t),o&&(mr.fromBufferAttribute(e,t),wr.add(mr)),i=Math.max(i,n.distanceToSquared(wr))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new lr(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new Un,s[e]=new Un;const l=new Un,c=new Un,h=new Un,d=new ln,u=new ln,p=new ln,f=new Un,m=new Un;function g(e,t,i){l.fromBufferAttribute(n,e),c.fromBufferAttribute(n,t),h.fromBufferAttribute(n,i),d.fromBufferAttribute(r,e),u.fromBufferAttribute(r,t),p.fromBufferAttribute(r,i),c.sub(l),h.sub(l),u.sub(d),p.sub(d);const a=1/(u.x*p.y-p.x*u.y);isFinite(a)&&(f.copy(c).multiplyScalar(p.y).addScaledVector(h,-u.y).multiplyScalar(a),m.copy(h).multiplyScalar(u.x).addScaledVector(c,-p.x).multiplyScalar(a),o[e].add(f),o[t].add(f),o[i].add(f),s[e].add(m),s[t].add(m),s[i].add(m))}let v=this.groups;0===v.length&&(v=[{start:0,count:e.count}]);for(let t=0,n=v.length;t<n;++t){const n=v[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const w=new Un,y=new Un,b=new Un,x=new Un;function _(e){b.fromBufferAttribute(i,e),x.copy(b);const t=o[e];w.copy(t),w.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);const n=y.dot(s[e])<0?-1:1;a.setXYZW(e,w.x,w.y,w.z,n)}for(let t=0,n=v.length;t<n;++t){const n=v[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)_(e.getX(t+0)),_(e.getX(t+1)),_(e.getX(t+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new lr(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const i=new Un,r=new Un,a=new Un,o=new Un,s=new Un,l=new Un,c=new Un,h=new Un;if(e)for(let d=0,u=e.count;d<u;d+=3){const u=e.getX(d+0),p=e.getX(d+1),f=e.getX(d+2);i.fromBufferAttribute(t,u),r.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),c.subVectors(a,r),h.subVectors(i,r),c.cross(h),o.fromBufferAttribute(n,u),s.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),o.add(c),s.add(c),l.add(c),n.setXYZ(u,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,o=t.count;e<o;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),c.subVectors(a,r),h.subVectors(i,r),c.cross(h),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)wr.fromBufferAttribute(e,t),wr.normalize(),e.setXYZ(t,wr.x,wr.y,wr.z)}toNonIndexed(){function e(e,t){const n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i);let o=0,s=0;for(let r=0,l=t.length;r<l;r++){o=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)a[s++]=n[o++]}return new lr(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new yr,n=this.index.array,i=this.attributes;for(const r in i){const a=e(i[r],n);t.setAttribute(r,a)}const r=this.morphAttributes;for(const i in r){const a=[],o=r[i];for(let t=0,i=o.length;t<i;t++){const i=e(o[t],n);a.push(i)}t.morphAttributes[i]=a}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let e=0,n=a.length;e<n;e++){const n=a[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t<i;t++){const i=n[t];a.push(i.toJSON(e.data))}a.length>0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),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;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let e=0,t=a.length;e<t;e++){const t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}const o=e.boundingBox;null!==o&&(this.boundingBox=o.clone());const s=e.boundingSphere;return null!==s&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const br=new ui,xr=new di,_r=new ii,kr=new Un,Er=new Un,Sr=new Un,Mr=new Un,Tr=new Un,Ar=new Un,Cr=new ln,Pr=new ln,Rr=new ln,Lr=new Un,Ir=new Un,Nr=new Un,Dr=new Un,Ur=new Un;class Br extends zi{constructor(e=new yr,t=new ar){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){Ar.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=o[n],s=r[n];0!==i&&(Tr.fromBufferAttribute(s,e),a?Ar.addScaledVector(Tr,i):Ar.addScaledVector(Tr.sub(t),i))}t.add(Ar)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),_r.copy(n.boundingSphere),_r.applyMatrix4(r),xr.copy(e.ray).recast(e.near),!1===_r.containsPoint(xr.origin)){if(null===xr.intersectSphere(_r,kr))return;if(xr.origin.distanceToSquared(kr)>(e.far-e.near)**2)return}br.copy(r).invert(),xr.copy(e.ray).applyMatrix4(br),null!==n.boundingBox&&!1===xr.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,xr)}}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,o=r.index,s=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,d=r.groups,u=r.drawRange;if(null!==o)if(Array.isArray(a))for(let r=0,s=d.length;r<s;r++){const s=d[r],p=a[s.materialIndex];for(let r=Math.max(s.start,u.start),a=Math.min(o.count,Math.min(s.start+s.count,u.start+u.count));r<a;r+=3){i=Or(this,p,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=s.materialIndex,t.push(i))}}else{for(let r=Math.max(0,u.start),s=Math.min(o.count,u.start+u.count);r<s;r+=3){i=Or(this,a,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}else if(void 0!==s)if(Array.isArray(a))for(let r=0,o=d.length;r<o;r++){const o=d[r],p=a[o.materialIndex];for(let r=Math.max(o.start,u.start),a=Math.min(s.count,Math.min(o.start+o.count,u.start+u.count));r<a;r+=3){i=Or(this,p,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}}else{for(let r=Math.max(0,u.start),o=Math.min(s.count,u.start+u.count);r<o;r+=3){i=Or(this,a,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}}}function Or(e,t,n,i,r,a,o,s,l,c){e.getVertexPosition(s,Er),e.getVertexPosition(l,Sr),e.getVertexPosition(c,Mr);const h=function(e,t,n,i,r,a,o,s){let l;if(l=t.side===T?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,t.side===M,s),null===l)return null;Ur.copy(s),Ur.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Ur);return c<n.near||c>n.far?null:{distance:c,point:Ur.clone(),object:e}}(e,t,n,i,Er,Sr,Mr,Dr);if(h){r&&(Cr.fromBufferAttribute(r,s),Pr.fromBufferAttribute(r,l),Rr.fromBufferAttribute(r,c),h.uv=Zi.getInterpolation(Dr,Er,Sr,Mr,Cr,Pr,Rr,new ln)),a&&(Cr.fromBufferAttribute(a,s),Pr.fromBufferAttribute(a,l),Rr.fromBufferAttribute(a,c),h.uv1=Zi.getInterpolation(Dr,Er,Sr,Mr,Cr,Pr,Rr,new ln)),o&&(Lr.fromBufferAttribute(o,s),Ir.fromBufferAttribute(o,l),Nr.fromBufferAttribute(o,c),h.normal=Zi.getInterpolation(Dr,Er,Sr,Mr,Lr,Ir,Nr,new Un),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a:s,b:l,c,normal:new Un,materialIndex:0};Zi.getNormal(Er,Sr,Mr,e.normal),h.face=e}return h}class zr extends yr{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const s=[],l=[],c=[],h=[];let d=0,u=0;function p(e,t,n,i,r,a,p,f,m,g,v){const w=a/m,y=p/g,b=a/2,x=p/2,_=f/2,k=m+1,E=g+1;let S=0,M=0;const T=new Un;for(let a=0;a<E;a++){const o=a*y-x;for(let s=0;s<k;s++){const d=s*w-b;T[e]=d*i,T[t]=o*r,T[n]=_,l.push(T.x,T.y,T.z),T[e]=0,T[t]=0,T[n]=f>0?1:-1,c.push(T.x,T.y,T.z),h.push(s/m),h.push(1-a/g),S+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){const n=d+t+k*e,i=d+t+k*(e+1),r=d+(t+1)+k*(e+1),a=d+(t+1)+k*e;s.push(n,i,a),s.push(i,r,a),M+=6}o.addGroup(u,M,v),u+=M,d+=S}p("z","y","x",-1,-1,n,t,e,a,r,0),p("z","y","x",1,-1,n,t,-e,a,r,1),p("x","z","y",1,1,e,n,t,i,a,2),p("x","z","y",1,-1,e,n,-t,i,a,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(s),this.setAttribute("position",new dr(l,3)),this.setAttribute("normal",new dr(c,3)),this.setAttribute("uv",new dr(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Fr(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function Wr(e){const t={};for(let n=0;n<e.length;n++){const i=Fr(e[n]);for(const e in i)t[e]=i[e]}return t}function Hr(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:bn.workingColorSpace}const Vr={clone:Fr,merge:Wr};class Gr extends rr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",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,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Fr(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(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}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}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;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class jr extends zi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ui,this.projectionMatrix=new ui,this.projectionMatrixInverse=new ui,this.coordinateSystem=Xt}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.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const qr=new Un,Xr=new ln,Yr=new ln;class Kr extends jr{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*$t*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Qt*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*$t*Math.atan(Math.tan(.5*Qt*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){qr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(qr.x,qr.y).multiplyScalar(-e/qr.z),qr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(qr.x,qr.y).multiplyScalar(-e/qr.z)}getViewSize(e,t){return this.getViewBounds(e,Xr,Yr),t.subVectors(Yr,Xr)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(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=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Qt*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const e=a.fullWidth,o=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/o,i*=a.width/e,n*=a.height/o}const o=this.filmOffset;0!==o&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Zr=-90;class Jr extends zi{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Kr(Zr,1,e,t);i.layers=this.layers,this.add(i);const r=new Kr(Zr,1,e,t);r.layers=this.layers,this.add(r);const a=new Kr(Zr,1,e,t);a.layers=this.layers,this.add(a);const o=new Kr(Zr,1,e,t);o.layers=this.layers,this.add(o);const s=new Kr(Zr,1,e,t);s.layers=this.layers,this.add(s);const l=new Kr(Zr,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,o,s]=t;for(const e of t)this.remove(e);if(e===Xt)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.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!==Yt)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.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)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,s,l,c]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,s),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(h,d,u),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class Qr extends Cn{constructor(e,t,n,i,r,a,o,s,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:ae,n,i,r,a,o,s,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class $r extends Ln{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Qr(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:ge}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new zr(5,5,5),r=new Gr({name:"CubemapFromEquirect",uniforms:Fr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:T,blending:0});r.uniforms.tEquirect.value=t;const a=new Br(i,r),o=t.minFilter;t.minFilter===we&&(t.minFilter=ge);return new Jr(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}const ea=new Un,ta=new Un,na=new cn;class ia{constructor(e=new Un(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,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=ea.subVectors(n,t).cross(ta.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const 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){const n=e.delta(ea),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const 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){const n=t||na.getNormalMatrix(e),i=this.coplanarPoint(ea).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),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)}}const ra=new ii,aa=new Un;class oa{constructor(e=new ia,t=new ia,n=new ia,i=new ia,r=new ia,a=new ia){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3){const n=this.planes,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],c=i[5],h=i[6],d=i[7],u=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],w=i[14],y=i[15];if(n[0].setComponents(s-r,d-l,m-u,y-g).normalize(),n[1].setComponents(s+r,d+l,m+u,y+g).normalize(),n[2].setComponents(s+a,d+c,m+p,y+v).normalize(),n[3].setComponents(s-a,d-c,m-p,y-v).normalize(),n[4].setComponents(s-o,d-h,m-f,y-w).normalize(),t===Xt)n[5].setComponents(s+o,d+h,m+f,y+w).normalize();else{if(t!==Yt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,h,f,w).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),ra.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),ra.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ra)}intersectsSprite(e){return ra.center.set(0,0,0),ra.radius=.7071067811865476,ra.applyMatrix4(e.matrixWorld),this.intersectsSphere(ra)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(n)<i)return!1}return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(aa.x=i.normal.x>0?e.max.x:e.min.x,aa.y=i.normal.y>0?e.max.y:e.min.y,aa.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(aa)<0)return!1}return!0}containsPoint(e){const 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)}}function sa(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function la(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}n.isInterleavedBufferAttribute&&(n=n.data);const r=t.get(n);if(void 0===r)t.set(n,function(t,n){const i=t.array,r=t.usage,a=i.byteLength,o=e.createBuffer();let s;if(e.bindBuffer(n,o),e.bufferData(n,i,r),t.onUploadCallback(),i instanceof Float32Array)s=e.FLOAT;else if(i instanceof Uint16Array)s=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)s=e.SHORT;else if(i instanceof Uint32Array)s=e.UNSIGNED_INT;else if(i instanceof Int32Array)s=e.INT;else if(i instanceof Int8Array)s=e.BYTE;else if(i instanceof Uint8Array)s=e.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);s=e.UNSIGNED_BYTE}return{buffer:o,type:s,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:a}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,n,i){const r=n.array,a=n._updateRange,o=n.updateRanges;if(e.bindBuffer(i,t),-1===a.count&&0===o.length&&e.bufferSubData(i,0,r),0!==o.length){for(let t=0,n=o.length;t<n;t++){const n=o[t];e.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}-1!==a.count&&(e.bufferSubData(i,a.offset*r.BYTES_PER_ELEMENT,r,a.offset,a.count),a.count=-1),n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}class ca extends yr{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,o=Math.floor(n),s=Math.floor(i),l=o+1,c=s+1,h=e/o,d=t/s,u=[],p=[],f=[],m=[];for(let e=0;e<c;e++){const t=e*d-a;for(let n=0;n<l;n++){const i=n*h-r;p.push(i,-t,0),f.push(0,0,1),m.push(n/o),m.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){const n=t+l*e,i=t+l*(e+1),r=t+1+l*(e+1),a=t+1+l*e;u.push(n,i,a),u.push(i,r,a)}this.setIndex(u),this.setAttribute("position",new dr(p,3)),this.setAttribute("normal",new dr(f,3)),this.setAttribute("uv",new dr(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ca(e.width,e.height,e.widthSegments,e.heightSegments)}}const ha={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},da={common:{diffuse:{value:new tr(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new cn},alphaMap:{value:null},alphaMapTransform:{value:new cn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new cn}},envmap:{envMap:{value:null},envMapRotation:{value:new cn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new cn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new cn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new cn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new cn},normalScale:{value:new ln(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new cn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new cn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new cn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new cn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new tr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new tr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new cn},alphaTest:{value:0},uvTransform:{value:new cn}},sprite:{diffuse:{value:new tr(16777215)},opacity:{value:1},center:{value:new ln(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new cn},alphaMap:{value:null},alphaMapTransform:{value:new cn},alphaTest:{value:0}}},ua={basic:{uniforms:Wr([da.common,da.specularmap,da.envmap,da.aomap,da.lightmap,da.fog]),vertexShader:ha.meshbasic_vert,fragmentShader:ha.meshbasic_frag},lambert:{uniforms:Wr([da.common,da.specularmap,da.envmap,da.aomap,da.lightmap,da.emissivemap,da.bumpmap,da.normalmap,da.displacementmap,da.fog,da.lights,{emissive:{value:new tr(0)}}]),vertexShader:ha.meshlambert_vert,fragmentShader:ha.meshlambert_frag},phong:{uniforms:Wr([da.common,da.specularmap,da.envmap,da.aomap,da.lightmap,da.emissivemap,da.bumpmap,da.normalmap,da.displacementmap,da.fog,da.lights,{emissive:{value:new tr(0)},specular:{value:new tr(1118481)},shininess:{value:30}}]),vertexShader:ha.meshphong_vert,fragmentShader:ha.meshphong_frag},standard:{uniforms:Wr([da.common,da.envmap,da.aomap,da.lightmap,da.emissivemap,da.bumpmap,da.normalmap,da.displacementmap,da.roughnessmap,da.metalnessmap,da.fog,da.lights,{emissive:{value:new tr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ha.meshphysical_vert,fragmentShader:ha.meshphysical_frag},toon:{uniforms:Wr([da.common,da.aomap,da.lightmap,da.emissivemap,da.bumpmap,da.normalmap,da.displacementmap,da.gradientmap,da.fog,da.lights,{emissive:{value:new tr(0)}}]),vertexShader:ha.meshtoon_vert,fragmentShader:ha.meshtoon_frag},matcap:{uniforms:Wr([da.common,da.bumpmap,da.normalmap,da.displacementmap,da.fog,{matcap:{value:null}}]),vertexShader:ha.meshmatcap_vert,fragmentShader:ha.meshmatcap_frag},points:{uniforms:Wr([da.points,da.fog]),vertexShader:ha.points_vert,fragmentShader:ha.points_frag},dashed:{uniforms:Wr([da.common,da.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ha.linedashed_vert,fragmentShader:ha.linedashed_frag},depth:{uniforms:Wr([da.common,da.displacementmap]),vertexShader:ha.depth_vert,fragmentShader:ha.depth_frag},normal:{uniforms:Wr([da.common,da.bumpmap,da.normalmap,da.displacementmap,{opacity:{value:1}}]),vertexShader:ha.meshnormal_vert,fragmentShader:ha.meshnormal_frag},sprite:{uniforms:Wr([da.sprite,da.fog]),vertexShader:ha.sprite_vert,fragmentShader:ha.sprite_frag},background:{uniforms:{uvTransform:{value:new cn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ha.background_vert,fragmentShader:ha.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new cn}},vertexShader:ha.backgroundCube_vert,fragmentShader:ha.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ha.cube_vert,fragmentShader:ha.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ha.equirect_vert,fragmentShader:ha.equirect_frag},distanceRGBA:{uniforms:Wr([da.common,da.displacementmap,{referencePosition:{value:new Un},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ha.distanceRGBA_vert,fragmentShader:ha.distanceRGBA_frag},shadow:{uniforms:Wr([da.lights,da.fog,{color:{value:new tr(0)},opacity:{value:1}}]),vertexShader:ha.shadow_vert,fragmentShader:ha.shadow_frag}};ua.physical={uniforms:Wr([ua.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new cn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new cn},clearcoatNormalScale:{value:new ln(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new cn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new cn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new cn},sheen:{value:0},sheenColor:{value:new tr(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new cn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new cn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new cn},transmissionSamplerSize:{value:new ln},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new cn},attenuationDistance:{value:0},attenuationColor:{value:new tr(0)},specularColor:{value:new tr(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new cn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new cn},anisotropyVector:{value:new ln},anisotropyMap:{value:null},anisotropyMapTransform:{value:new cn}}]),vertexShader:ha.meshphysical_vert,fragmentShader:ha.meshphysical_frag};const pa={r:0,b:0,g:0},fa=new _i,ma=new ui;function ga(e,t,n,i,r,a,o){const s=new tr(0);let l,c,h=!0===a?0:1,d=null,u=0,p=null;function f(e){let i=!0===e.isScene?e.background:null;if(i&&i.isTexture){i=(e.backgroundBlurriness>0?n:t).get(i)}return i}function m(t,n){t.getRGB(pa,Hr(e)),i.buffers.color.setClear(pa.r,pa.g,pa.b,n,o)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),h=t,m(s,h)},getClearAlpha:function(){return h},setClearAlpha:function(e){h=e,m(s,h)},render:function(t){let n=!1;const r=f(t);null===r?m(s,h):r&&r.isColor&&(m(r,1),n=!0);const a=e.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=f(n);i&&(i.isCubeTexture||i.mapping===ce)?(void 0===c&&(c=new Br(new zr(1,1,1),new Gr({name:"BackgroundCubeMaterial",uniforms:Fr(ua.backgroundCube.uniforms),vertexShader:ua.backgroundCube.vertexShader,fragmentShader:ua.backgroundCube.fragmentShader,side:T,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),fa.copy(n.backgroundRotation),fa.x*=-1,fa.y*=-1,fa.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(fa.y*=-1,fa.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(ma.makeRotationFromEuler(fa)),c.material.toneMapped=bn.getTransfer(i.colorSpace)!==It,d===i&&u===i.version&&p===e.toneMapping||(c.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new Br(new ca(2,2),new Gr({name:"BackgroundMaterial",uniforms:Fr(ua.background.uniforms),vertexShader:ua.background.vertexShader,fragmentShader:ua.background.fragmentShader,side:M,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=bn.getTransfer(i.colorSpace)!==It,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),d===i&&u===i.version&&p===e.toneMapping||(l.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}}}function va(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let a=r,o=!1;function s(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e<n;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function h(){const e=a.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function d(e){u(e,0)}function u(t,n){const i=a.newAttributes,r=a.enabledAttributes,o=a.attributeDivisors;i[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),o[t]!==n&&(e.vertexAttribDivisor(t,n),o[t]=n)}function p(){const t=a.newAttributes,n=a.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function f(t,n,i,r,a,o,s){!0===s?e.vertexAttribIPointer(t,n,i,a,o):e.vertexAttribPointer(t,n,i,r,a,o)}function m(){g(),o=!0,a!==r&&(a=r,s(a.object))}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,m,g){let v=!1;const w=function(t,n,r){const a=!0===r.wireframe;let o=i[t.id];void 0===o&&(o={},i[t.id]=o);let s=o[n.id];void 0===s&&(s={},o[n.id]=s);let l=s[a];void 0===l&&(l=c(e.createVertexArray()),s[a]=l);return l}(m,l,r);a!==w&&(a=w,s(a.object)),v=function(e,t,n,i){const r=a.attributes,o=t.attributes;let s=0;const l=n.getAttributes();for(const t in l){if(l[t].location>=0){const n=r[t];let i=o[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;s++}}return a.attributesNum!==s||a.index!==i}(n,m,l,g),v&&function(e,t,n,i){const r={},o=t.attributes;let s=0;const l=n.getAttributes();for(const t in l){if(l[t].location>=0){let n=o[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,s++}}a.attributes=r,a.attributesNum=s,a.index=i}(n,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(v||o)&&(o=!1,function(n,i,r,a){h();const o=a.attributes,s=r.getAttributes(),l=i.defaultAttributeValues;for(const i in s){const r=s[i];if(r.location>=0){let s=o[i];if(void 0===s&&("instanceMatrix"===i&&n.instanceMatrix&&(s=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(s=n.instanceColor)),void 0!==s){const i=s.normalized,o=s.itemSize,l=t.get(s);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,m=h===e.INT||h===e.UNSIGNED_INT||s.gpuType===ke;if(s.isInterleavedBufferAttribute){const t=s.data,l=t.stride,g=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)u(r.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)d(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)f(r.location+e,o/r.locationSize,h,i,l*p,(g+o/r.locationSize*e)*p,m)}else{if(s.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)u(r.location+e,s.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let e=0;e<r.locationSize;e++)d(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)f(r.location+e,o/r.locationSize,h,i,o*p,o/r.locationSize*e*p,m)}}else if(void 0!==l){const t=l[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}p()}(n,r,l,m),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:m,resetDefaultState:g,dispose:function(){m();for(const e in i){const t=i[e];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;const t=i[e.id];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e.id]},releaseStatesOfProgram:function(e){for(const t in i){const n=i[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)l(r[e].object),delete r[e];delete n[e.id]}},initAttributes:h,enableAttribute:d,disableUnusedAttributes:p}}function wa(e,t,n){let i;function r(t,r,a){0!==a&&(e.drawArraysInstanced(i,t,r,a),n.update(r,i,a))}this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,r,0,a);let o=0;for(let e=0;e<a;e++)o+=r[e];n.update(o,i,1)},this.renderMultiDrawInstances=function(e,a,o,s){if(0===o)return;const l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],a[t],s[t]);else{l.multiDrawArraysInstancedWEBGL(i,e,0,a,0,s,0,o);let t=0;for(let e=0;e<o;e++)t+=a[e];for(let e=0;e<s.length;e++)n.update(t,i,s[e])}}}function ya(e,t,n,i){let r;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp";const s=a(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const l=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return t===Ie||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===Me&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==ye&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==Se&&!r)},precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function ba(e){const t=this;let n=null,i=0,r=!1,a=!1;const o=new ia,s=new cn,l={value:null,needsUpdate:!1};function c(e,n,i,r){const a=null!==e?e.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const t=i+4*a,r=n.matrixWorldInverse;s.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,n=i;t!==a;++t,n+=4)o.copy(e[t]).applyMatrix4(r,s),o.normal.toArray(c,n),c[n+3]=o.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=c(e,t,0)},this.setState=function(o,s,h){const d=o.clippingPlanes,u=o.clipIntersection,p=o.clipShadows,f=e.get(o);if(!r||null===d||0===d.length||a&&!p)a?c(null):function(){l.value!==n&&(l.value=n,l.needsUpdate=i>0);t.numPlanes=i,t.numIntersection=0}();else{const e=a?0:i,t=4*e;let r=f.clippingState||null;l.value=r,r=c(d,s,t,h);for(let e=0;e!==t;++e)r[e]=n[e];f.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}function xa(e){let t=new WeakMap;function n(e,t){return t===se?e.mapping=ae:t===le&&(e.mapping=oe),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(a===se||a===le){if(t.has(r)){return n(t.get(r).texture,r.mapping)}{const a=r.image;if(a&&a.height>0){const o=new $r(a.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}class _a extends jr{constructor(e=-1,t=1,n=1,i=-1,r=.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=i,this.near=r,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=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){null===this.view&&(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=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}const ka=[.125,.215,.35,.446,.526,.582],Ea=20,Sa=new _a,Ma=new tr;let Ta=null,Aa=0,Ca=0,Pa=!1;const Ra=(1+Math.sqrt(5))/2,La=1/Ra,Ia=[new Un(-Ra,La,0),new Un(Ra,La,0),new Un(-La,0,Ra),new Un(La,0,Ra),new Un(0,Ra,-La),new Un(0,Ra,La),new Un(-1,1,-1),new Un(1,1,-1),new Un(-1,1,1),new Un(1,1,1)];class Na{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Ta=this._renderer.getRenderTarget(),Aa=this._renderer.getActiveCubeFace(),Ca=this._renderer.getActiveMipmapLevel(),Pa=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Oa(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Ba(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Ta,Aa,Ca),this._renderer.xr.enabled=Pa,e.scissorTest=!1,Ua(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ae||e.mapping===oe?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ta=this._renderer.getRenderTarget(),Aa=this._renderer.getActiveCubeFace(),Ca=this._renderer.getActiveMipmapLevel(),Pa=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:ge,minFilter:ge,generateMipmaps:!1,type:Me,format:Ie,colorSpace:Ct,depthBuffer:!1},i=Da(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Da(e,t,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){const t=[],n=[],i=[];let r=e;const a=e-4+1+ka.length;for(let o=0;o<a;o++){const a=Math.pow(2,r);n.push(a);let s=1/a;o>e-4?s=ka[o-e+4-1]:0===o&&(s=0),i.push(s);const l=1/(a-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,p=6,f=3,m=2,g=1,v=new Float32Array(f*p*u),w=new Float32Array(m*p*u),y=new Float32Array(g*p*u);for(let e=0;e<u;e++){const t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];v.set(i,f*p*e),w.set(d,m*p*e);const r=[e,e,e,e,e,e];y.set(r,g*p*e)}const b=new yr;b.setAttribute("position",new lr(v,f)),b.setAttribute("uv",new lr(w,m)),b.setAttribute("faceIndex",new lr(y,g)),t.push(b),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(Ea),r=new Un(0,1,0),a=new Gr({name:"SphericalGaussianBlur",defines:{n:Ea,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:za(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return a}(i,e,t)}return i}_compileMaterial(e){const t=new Br(this._lodPlanes[0],e);this._renderer.compile(t,Sa)}_sceneToCubeUV(e,t,n,i){const r=new Kr(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,c=s.toneMapping;s.getClearColor(Ma),s.toneMapping=Z,s.autoClear=!1;const h=new ar({name:"PMREM.Background",side:T,depthWrite:!1,depthTest:!1}),d=new Br(new zr,h);let u=!1;const p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,u=!0):(h.color.copy(Ma),u=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,a[t],0),r.lookAt(o[t],0,0)):1===n?(r.up.set(0,0,a[t]),r.lookAt(0,o[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,o[t]));const l=this._cubeSize;Ua(i,n*l,t>2?l:0,l,l),s.setRenderTarget(i),u&&s.render(d,r),s.render(e,r)}d.geometry.dispose(),d.material.dispose(),s.toneMapping=c,s.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===ae||e.mapping===oe;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Oa()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Ba());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new Br(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const o=this._cubeSize;Ua(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,Sa)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t<i;t++){const n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=Ia[(i-t-1)%Ia.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Br(this._lodPlanes[i],l),h=l.uniforms,d=this._sizeLods[n]-1,u=isFinite(r)?Math.PI/(2*d):2*Math.PI/39,p=r/u,f=isFinite(r)?1+Math.floor(3*p):Ea;f>Ea&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let e=0;e<Ea;++e){const t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:e<f&&(g+=2*n)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;h.envMap.value=e.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===a,o&&(h.poleAxis.value=o);const{_lodMax:v}=this;h.dTheta.value=u,h.mipInt.value=v-n;const w=this._sizeLods[i];Ua(t,3*w*(i>v-4?i-v+4:0),4*(this._cubeSize-w),3*w,2*w),s.setRenderTarget(t),s.render(c,Sa)}}function Da(e,t,n){const i=new Ln(e,t,n);return i.texture.mapping=ce,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ua(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Ba(){return new Gr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:za(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Oa(){return new Gr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:za(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function za(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Fa(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,o=a===se||a===le,s=a===ae||a===oe;if(o||s){let a=t.get(r);const l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Na(e)),a=o?n.fromEquirectangular(r,a):n.fromCubemap(r,a),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;if(void 0!==a)return a.texture;{const l=r.image;return o&&l&&l.height>0||s&&l&&function(e){let t=0;const n=6;for(let i=0;i<n;i++)void 0!==e[i]&&t++;return t===n}(l)?(null===n&&(n=new Na(e)),a=o?n.fromEquirectangular(r):n.fromCubemap(r),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",i),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Wa(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&mn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Ha(e,t,n,i){const r={},a=new WeakMap;function o(e){const s=e.target;null!==s.index&&t.remove(s.index);for(const e in s.attributes)t.remove(s.attributes[e]);for(const e in s.morphAttributes){const n=s.morphAttributes[e];for(let e=0,i=n.length;e<i;e++)t.remove(n[e])}s.removeEventListener("dispose",o),delete r[s.id];const l=a.get(s);l&&(t.remove(l),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;t<i;t+=3){const i=e[t+0],r=e[t+1],a=e[t+2];n.push(i,r,r,a,a,i)}}else{if(void 0===r)return;{const e=r.array;o=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){const e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}}const s=new(dn(n)?hr:cr)(n,1);s.version=o;const l=a.get(e);l&&t.remove(l),a.set(e,s)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",o),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const n in i)t.update(i[n],e.ARRAY_BUFFER);const r=n.morphAttributes;for(const n in r){const i=r[n];for(let n=0,r=i.length;n<r;n++)t.update(i[n],e.ARRAY_BUFFER)}},getWireframeAttribute:function(e){const t=a.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return a.get(e)}}}function Va(e,t,n){let i,r,a;function o(t,o,s){0!==s&&(e.drawElementsInstanced(i,o,r,t*a,s),n.update(o,i,s))}this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,o){e.drawElements(i,o,r,t*a),n.update(o,i,1)},this.renderInstances=o,this.renderMultiDraw=function(e,a,o){if(0===o)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,a,0,r,e,0,o);let s=0;for(let e=0;e<o;e++)s+=a[e];n.update(s,i,1)},this.renderMultiDrawInstances=function(e,s,l,c){if(0===l)return;const h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)o(e[t]/a,s[t],c[t]);else{h.multiDrawElementsInstancedWEBGL(i,s,0,r,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=s[e];for(let e=0;e<c.length;e++)n.update(t,i,c[e])}}}function Ga(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function ja(e,t,n){const i=new WeakMap,r=new Pn;return{update:function(a,o,s){const l=a.morphTargetInfluences,c=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=void 0!==c?c.length:0;let d=i.get(o);if(void 0===d||d.count!==h){void 0!==d&&d.texture.dispose();const u=void 0!==o.morphAttributes.position,p=void 0!==o.morphAttributes.normal,f=void 0!==o.morphAttributes.color,m=o.morphAttributes.position||[],g=o.morphAttributes.normal||[],v=o.morphAttributes.color||[];let w=0;!0===u&&(w=1),!0===p&&(w=2),!0===f&&(w=3);let y=o.attributes.position.count*w,b=1;y>t.maxTextureSize&&(b=Math.ceil(y/t.maxTextureSize),y=t.maxTextureSize);const x=new Float32Array(y*b*4*h),_=new In(x,y,b,h);_.type=Se,_.needsUpdate=!0;const k=4*w;for(let S=0;S<h;S++){const M=m[S],T=g[S],A=v[S],C=y*b*4*S;for(let P=0;P<M.count;P++){const R=P*k;!0===u&&(r.fromBufferAttribute(M,P),x[C+R+0]=r.x,x[C+R+1]=r.y,x[C+R+2]=r.z,x[C+R+3]=0),!0===p&&(r.fromBufferAttribute(T,P),x[C+R+4]=r.x,x[C+R+5]=r.y,x[C+R+6]=r.z,x[C+R+7]=0),!0===f&&(r.fromBufferAttribute(A,P),x[C+R+8]=r.x,x[C+R+9]=r.y,x[C+R+10]=r.z,x[C+R+11]=4===A.itemSize?r.w:1)}}function E(){_.dispose(),i.delete(o),o.removeEventListener("dispose",E)}d={count:h,texture:_,size:new ln(y,b)},i.set(o,d),o.addEventListener("dispose",E)}if(!0===a.isInstancedMesh&&null!==a.morphTexture)s.getUniforms().setValue(e,"morphTexture",a.morphTexture,n);else{let L=0;for(let N=0;N<l.length;N++)L+=l[N];const I=o.morphTargetsRelative?1:1-L;s.getUniforms().setValue(e,"morphTargetBaseInfluence",I),s.getUniforms().setValue(e,"morphTargetInfluences",l)}s.getUniforms().setValue(e,"morphTargetsTexture",d.texture,n),s.getUniforms().setValue(e,"morphTargetsTextureSize",d.size)}}}function qa(e,t,n,i){let r=new WeakMap;function a(e){const t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(o){const s=i.render.frame,l=o.geometry,c=t.get(o,l);if(r.get(c)!==s&&(t.update(c),r.set(c,s)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",a)&&o.addEventListener("dispose",a),r.get(o)!==s&&(n.update(o.instanceMatrix,e.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,e.ARRAY_BUFFER),r.set(o,s))),o.isSkinnedMesh){const e=o.skeleton;r.get(e)!==s&&(e.update(),r.set(e,s))}return c},dispose:function(){r=new WeakMap}}}class Xa extends Cn{constructor(e,t,n,i,r,a,o,s,l,c=1026){if(c!==Ue&&c!==Be)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Ue&&(n=Ee),void 0===n&&c===Be&&(n=Ce),super(null,i,r,a,o,s,c,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==o?o:pe,this.minFilter=void 0!==s?s:pe,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}const Ya=new Cn,Ka=new Xa(1,1),Za=new In,Ja=new Nn,Qa=new Qr,$a=[],eo=[],to=new Float32Array(16),no=new Float32Array(9),io=new Float32Array(4);function ro(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let a=$a[r];if(void 0===a&&(a=new Float32Array(r),$a[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function ao(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function oo(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function so(e,t){let n=eo[t];void 0===n&&(n=new Int32Array(t),eo[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function lo(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function co(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(ao(n,t))return;e.uniform2fv(this.addr,t),oo(n,t)}}function ho(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(ao(n,t))return;e.uniform3fv(this.addr,t),oo(n,t)}}function uo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(ao(n,t))return;e.uniform4fv(this.addr,t),oo(n,t)}}function po(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(ao(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),oo(n,t)}else{if(ao(n,i))return;io.set(i),e.uniformMatrix2fv(this.addr,!1,io),oo(n,i)}}function fo(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(ao(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),oo(n,t)}else{if(ao(n,i))return;no.set(i),e.uniformMatrix3fv(this.addr,!1,no),oo(n,i)}}function mo(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(ao(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),oo(n,t)}else{if(ao(n,i))return;to.set(i),e.uniformMatrix4fv(this.addr,!1,to),oo(n,i)}}function go(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function vo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(ao(n,t))return;e.uniform2iv(this.addr,t),oo(n,t)}}function wo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(ao(n,t))return;e.uniform3iv(this.addr,t),oo(n,t)}}function yo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(ao(n,t))return;e.uniform4iv(this.addr,t),oo(n,t)}}function bo(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function xo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(ao(n,t))return;e.uniform2uiv(this.addr,t),oo(n,t)}}function _o(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(ao(n,t))return;e.uniform3uiv(this.addr,t),oo(n,t)}}function ko(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(ao(n,t))return;e.uniform4uiv(this.addr,t),oo(n,t)}}function Eo(e,t,n){const i=this.cache,r=n.allocateTextureUnit();let a;i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),this.type===e.SAMPLER_2D_SHADOW?(Ka.compareFunction=Ft,a=Ka):a=Ya,n.setTexture2D(t||a,r)}function So(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||Ja,r)}function Mo(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||Qa,r)}function To(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||Za,r)}function Ao(e,t){e.uniform1fv(this.addr,t)}function Co(e,t){const n=ro(t,this.size,2);e.uniform2fv(this.addr,n)}function Po(e,t){const n=ro(t,this.size,3);e.uniform3fv(this.addr,n)}function Ro(e,t){const n=ro(t,this.size,4);e.uniform4fv(this.addr,n)}function Lo(e,t){const n=ro(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Io(e,t){const n=ro(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function No(e,t){const n=ro(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Do(e,t){e.uniform1iv(this.addr,t)}function Uo(e,t){e.uniform2iv(this.addr,t)}function Bo(e,t){e.uniform3iv(this.addr,t)}function Oo(e,t){e.uniform4iv(this.addr,t)}function zo(e,t){e.uniform1uiv(this.addr,t)}function Fo(e,t){e.uniform2uiv(this.addr,t)}function Wo(e,t){e.uniform3uiv(this.addr,t)}function Ho(e,t){e.uniform4uiv(this.addr,t)}function Vo(e,t,n){const i=this.cache,r=t.length,a=so(n,r);ao(i,a)||(e.uniform1iv(this.addr,a),oo(i,a));for(let e=0;e!==r;++e)n.setTexture2D(t[e]||Ya,a[e])}function Go(e,t,n){const i=this.cache,r=t.length,a=so(n,r);ao(i,a)||(e.uniform1iv(this.addr,a),oo(i,a));for(let e=0;e!==r;++e)n.setTexture3D(t[e]||Ja,a[e])}function jo(e,t,n){const i=this.cache,r=t.length,a=so(n,r);ao(i,a)||(e.uniform1iv(this.addr,a),oo(i,a));for(let e=0;e!==r;++e)n.setTextureCube(t[e]||Qa,a[e])}function qo(e,t,n){const i=this.cache,r=t.length,a=so(n,r);ao(i,a)||(e.uniform1iv(this.addr,a),oo(i,a));for(let e=0;e!==r;++e)n.setTexture2DArray(t[e]||Za,a[e])}class Xo{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return lo;case 35664:return co;case 35665:return ho;case 35666:return uo;case 35674:return po;case 35675:return fo;case 35676:return mo;case 5124:case 35670:return go;case 35667:case 35671:return vo;case 35668:case 35672:return wo;case 35669:case 35673:return yo;case 5125:return bo;case 36294:return xo;case 36295:return _o;case 36296:return ko;case 35678:case 36198:case 36298:case 36306:case 35682:return Eo;case 35679:case 36299:case 36307:return So;case 35680:case 36300:case 36308:case 36293:return Mo;case 36289:case 36303:case 36311:case 36292:return To}}(t.type)}}class Yo{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Ao;case 35664:return Co;case 35665:return Po;case 35666:return Ro;case 35674:return Lo;case 35675:return Io;case 35676:return No;case 5124:case 35670:return Do;case 35667:case 35671:return Uo;case 35668:case 35672:return Bo;case 35669:case 35673:return Oo;case 5125:return zo;case 36294:return Fo;case 36295:return Wo;case 36296:return Ho;case 35678:case 36198:case 36298:case 36306:case 35682:return Vo;case 35679:case 36299:case 36307:return Go;case 35680:case 36300:case 36308:case 36293:return jo;case 36289:case 36303:case 36311:case 36292:return qo}}(t.type)}}class Ko{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const a=i[r];a.setValue(e,t[a.id],n)}}}const Zo=/(\w+)(\])?(\[|\.)?/g;function Jo(e,t){e.seq.push(t),e.map[t.id]=t}function Qo(e,t,n){const i=e.name,r=i.length;for(Zo.lastIndex=0;;){const a=Zo.exec(i),o=Zo.lastIndex;let s=a[1];const l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===r){Jo(n,void 0===c?new Xo(s,e,t):new Yo(s,e,t));break}{let e=n.map[s];void 0===e&&(e=new Ko(s),Jo(n,e)),n=e}}}class $o{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i);Qo(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const a=t[r],o=n[a.id];!1!==o.needsUpdate&&a.setValue(e,o.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function es(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}const ts=37297;let ns=0;function is(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=r;e<a;e++){const r=e+1;i.push(`${r===t?">":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function rs(e,t){const n=function(e){const t=bn.getPrimaries(bn.workingColorSpace),n=bn.getPrimaries(e);let i;switch(t===n?i="":t===Dt&&n===Nt?i="LinearDisplayP3ToLinearSRGB":t===Nt&&n===Dt&&(i="LinearSRGBToLinearDisplayP3"),e){case Ct:case Rt:return[i,"LinearTransferOETF"];case At:case Pt:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[i,"LinearTransferOETF"]}}(t);return`vec4 ${e}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function as(e,t){let n;switch(t){case J:n="Linear";break;case Q:n="Reinhard";break;case $:n="OptimizedCineon";break;case ee:n="ACESFilmic";break;case ne:n="AgX";break;case ie:n="Neutral";break;case te:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function os(e){return""!==e}function ss(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function ls(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const cs=/^[ \t]*#include +<([\w\d./]+)>/gm;function hs(e){return e.replace(cs,us)}const ds=new Map;function us(e,t){let n=ha[t];if(void 0===n){const e=ds.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=ha[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return hs(n)}const ps=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function fs(e){return e.replace(ps,ms)}function ms(e,t,n,i){let r="";for(let e=parseInt(t);e<parseInt(n);e++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function gs(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function vs(e,t,n,i){const r=e.getContext(),a=n.defines;let o=n.vertexShader,s=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===k?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===E?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===S&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case ae:case oe:t="ENVMAP_TYPE_CUBE";break;case ce:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),h=function(e){let t="ENVMAP_MODE_REFLECTION";e.envMap&&e.envMapMode===oe&&(t="ENVMAP_MODE_REFRACTION");return t}(n),d=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case X:t="ENVMAP_BLENDING_MULTIPLY";break;case Y:t="ENVMAP_BLENDING_MIX";break;case K:t="ENVMAP_BLENDING_ADD"}return t}(n),u=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),p=function(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(os).join("\n")}(n),f=function(e){const t=[];for(const n in e){const i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(a),m=r.createProgram();let g,v,w=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(os).join("\n"),g.length>0&&(g+="\n"),v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(os).join("\n"),v.length>0&&(v+="\n")):(g=[gs(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(os).join("\n"),v=[gs(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Z?"#define TONE_MAPPING":"",n.toneMapping!==Z?ha.tonemapping_pars_fragment:"",n.toneMapping!==Z?as("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",ha.colorspace_pars_fragment,rs("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(os).join("\n")),o=hs(o),o=ss(o,n),o=ls(o,n),s=hs(s),s=ss(s,n),s=ls(s,n),o=fs(o),s=fs(s),!0!==n.isRawShaderMaterial&&(w="#version 300 es\n",g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",n.glslVersion===qt?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===qt?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v);const y=w+g+o,b=w+v+s,x=es(r,r.VERTEX_SHADER,y),_=es(r,r.FRAGMENT_SHADER,b);function M(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(m).trim(),i=r.getShaderInfoLog(x).trim(),a=r.getShaderInfoLog(_).trim();let o=!0,s=!0;if(!1===r.getProgramParameter(m,r.LINK_STATUS))if(o=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(r,m,x,_);else{const e=is(r,x,"vertex"),i=is(r,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(m,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==a||(s=!1);s&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:i,prefix:g},fragmentShader:{log:a,prefix:v}})}r.deleteShader(x),r.deleteShader(_),T=new $o(r,m),A=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r),a=i.name;let o=1;i.type===e.FLOAT_MAT2&&(o=2),i.type===e.FLOAT_MAT3&&(o=3),i.type===e.FLOAT_MAT4&&(o=4),n[a]={type:i.type,location:e.getAttribLocation(t,a),locationSize:o}}return n}(r,m)}let T,A;r.attachShader(m,x),r.attachShader(m,_),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),this.getUniforms=function(){return void 0===T&&M(this),T},this.getAttributes=function(){return void 0===A&&M(this),A};let C=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===C&&(C=r.getProgramParameter(m,ts)),C},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=ns++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=_,this}let ws=0;class ys{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new bs(e),t.set(e,n)),n}}class bs{constructor(e){this.id=ws++,this.code=e,this.usedTimes=0}}function xs(e,t,n,i,r,a,o){const s=new ki,l=new ys,c=new Set,h=[],d=r.logarithmicDepthBuffer,u=r.vertexTextures;let p=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(e){return c.add(e),0===e?"uv":`uv${e}`}return{getParameters:function(a,s,h,g,v){const w=g.fog,y=v.geometry,b=a.isMeshStandardMaterial?g.environment:null,x=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),_=x&&x.mapping===ce?x.image.height:null,k=f[a.type];null!==a.precision&&(p=r.getMaxPrecision(a.precision),p!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead."));const E=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,S=void 0!==E?E.length:0;let M,A,C,P,R=0;if(void 0!==y.morphAttributes.position&&(R=1),void 0!==y.morphAttributes.normal&&(R=2),void 0!==y.morphAttributes.color&&(R=3),k){const e=ua[k];M=e.vertexShader,A=e.fragmentShader}else M=a.vertexShader,A=a.fragmentShader,l.update(a),C=l.getVertexShaderID(a),P=l.getFragmentShaderID(a);const L=e.getRenderTarget(),I=!0===v.isInstancedMesh,N=!0===v.isBatchedMesh,D=!!a.map,U=!!a.matcap,B=!!x,O=!!a.aoMap,z=!!a.lightMap,F=!!a.bumpMap,W=!!a.normalMap,H=!!a.displacementMap,V=!!a.emissiveMap,G=!!a.metalnessMap,j=!!a.roughnessMap,q=a.anisotropy>0,X=a.clearcoat>0,Y=a.dispersion>0,K=a.iridescence>0,J=a.sheen>0,Q=a.transmission>0,$=q&&!!a.anisotropyMap,ee=X&&!!a.clearcoatMap,te=X&&!!a.clearcoatNormalMap,ne=X&&!!a.clearcoatRoughnessMap,ie=K&&!!a.iridescenceMap,re=K&&!!a.iridescenceThicknessMap,ae=J&&!!a.sheenColorMap,oe=J&&!!a.sheenRoughnessMap,se=!!a.specularMap,le=!!a.specularColorMap,he=!!a.specularIntensityMap,de=Q&&!!a.transmissionMap,ue=Q&&!!a.thicknessMap,pe=!!a.gradientMap,fe=!!a.alphaMap,me=a.alphaTest>0,ge=!!a.alphaHash,ve=!!a.extensions;let we=Z;a.toneMapped&&(null!==L&&!0!==L.isXRRenderTarget||(we=e.toneMapping));const ye={shaderID:k,shaderType:a.type,shaderName:a.name,vertexShader:M,fragmentShader:A,defines:a.defines,customVertexShaderID:C,customFragmentShaderID:P,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:N,batchingColor:N&&null!==v._colorsTexture,instancing:I,instancingColor:I&&null!==v.instanceColor,instancingMorph:I&&null!==v.morphTexture,supportsVertexTextures:u,outputColorSpace:null===L?e.outputColorSpace:!0===L.isXRRenderTarget?L.texture.colorSpace:Ct,alphaToCoverage:!!a.alphaToCoverage,map:D,matcap:U,envMap:B,envMapMode:B&&x.mapping,envMapCubeUVHeight:_,aoMap:O,lightMap:z,bumpMap:F,normalMap:W,displacementMap:u&&H,emissiveMap:V,normalMapObjectSpace:W&&1===a.normalMapType,normalMapTangentSpace:W&&0===a.normalMapType,metalnessMap:G,roughnessMap:j,anisotropy:q,anisotropyMap:$,clearcoat:X,clearcoatMap:ee,clearcoatNormalMap:te,clearcoatRoughnessMap:ne,dispersion:Y,iridescence:K,iridescenceMap:ie,iridescenceThicknessMap:re,sheen:J,sheenColorMap:ae,sheenRoughnessMap:oe,specularMap:se,specularColorMap:le,specularIntensityMap:he,transmission:Q,transmissionMap:de,thicknessMap:ue,gradientMap:pe,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:fe,alphaTest:me,alphaHash:ge,combine:a.combine,mapUv:D&&m(a.map.channel),aoMapUv:O&&m(a.aoMap.channel),lightMapUv:z&&m(a.lightMap.channel),bumpMapUv:F&&m(a.bumpMap.channel),normalMapUv:W&&m(a.normalMap.channel),displacementMapUv:H&&m(a.displacementMap.channel),emissiveMapUv:V&&m(a.emissiveMap.channel),metalnessMapUv:G&&m(a.metalnessMap.channel),roughnessMapUv:j&&m(a.roughnessMap.channel),anisotropyMapUv:$&&m(a.anisotropyMap.channel),clearcoatMapUv:ee&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:te&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ie&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:re&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:ae&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:oe&&m(a.sheenRoughnessMap.channel),specularMapUv:se&&m(a.specularMap.channel),specularColorMapUv:le&&m(a.specularColorMap.channel),specularIntensityMapUv:he&&m(a.specularIntensityMap.channel),transmissionMapUv:de&&m(a.transmissionMap.channel),thicknessMapUv:ue&&m(a.thicknessMap.channel),alphaMapUv:fe&&m(a.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(W||q),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!y.attributes.uv&&(D||fe),fog:!!w,useFog:!0===a.fog,fogExp2:!!w&&w.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:S,morphTextureStride:R,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:we,decodeVideoTexture:D&&!0===a.map.isVideoTexture&&bn.getTransfer(a.map.colorSpace)===It,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:a.side===T,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:ve&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ve&&!0===a.extensions.multiDraw||N)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return ye.vertexUv1s=c.has(1),ye.vertexUv2s=c.has(2),ye.vertexUv3s=c.has(3),c.clear(),ye},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0);t.instancing&&s.enable(1);t.instancingColor&&s.enable(2);t.instancingMorph&&s.enable(3);t.matcap&&s.enable(4);t.envMap&&s.enable(5);t.normalMapObjectSpace&&s.enable(6);t.normalMapTangentSpace&&s.enable(7);t.clearcoat&&s.enable(8);t.iridescence&&s.enable(9);t.alphaTest&&s.enable(10);t.vertexColors&&s.enable(11);t.vertexAlphas&&s.enable(12);t.vertexUv1s&&s.enable(13);t.vertexUv2s&&s.enable(14);t.vertexUv3s&&s.enable(15);t.vertexTangents&&s.enable(16);t.anisotropy&&s.enable(17);t.alphaHash&&s.enable(18);t.batching&&s.enable(19);t.dispersion&&s.enable(20);t.batchingColor&&s.enable(21);e.push(s.mask),s.disableAll(),t.fog&&s.enable(0);t.useFog&&s.enable(1);t.flatShading&&s.enable(2);t.logarithmicDepthBuffer&&s.enable(3);t.skinning&&s.enable(4);t.morphTargets&&s.enable(5);t.morphNormals&&s.enable(6);t.morphColors&&s.enable(7);t.premultipliedAlpha&&s.enable(8);t.shadowMapEnabled&&s.enable(9);t.doubleSided&&s.enable(10);t.flipSided&&s.enable(11);t.useDepthPacking&&s.enable(12);t.dithering&&s.enable(13);t.transmission&&s.enable(14);t.sheen&&s.enable(15);t.opaque&&s.enable(16);t.pointsUvs&&s.enable(17);t.decodeVideoTexture&&s.enable(18);t.alphaToCoverage&&s.enable(19);e.push(s.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=f[e.type];let n;if(t){const e=ua[t];n=Vr.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=h.length;e<t;e++){const t=h[e];if(t.cacheKey===n){i=t,++i.usedTimes;break}}return void 0===i&&(i=new vs(e,n,t,a),h.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){const t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:h,dispose:function(){l.dispose()}}}function _s(){let e=new WeakMap;return{get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function ks(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Es(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Ss(){const e=[];let t=0;const n=[],i=[],r=[];function a(n,i,r,a,o,s){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=o,l.group=s),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,o,s,l,c){const h=a(e,t,o,s,l,c);o.transmission>0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(e,t,o,s,l,c){const h=a(e,t,o,s,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n<i;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||ks),i.length>1&&i.sort(t||Es),r.length>1&&r.sort(t||Es)}}}function Ms(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new Ss,e.set(t,[r])):n>=i.length?(r=new Ss,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function Ts(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Un,color:new tr};break;case"SpotLight":n={position:new Un,direction:new Un,color:new tr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Un,color:new tr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Un,skyColor:new tr,groundColor:new tr};break;case"RectAreaLight":n={color:new tr,position:new Un,halfWidth:new Un,halfHeight:new Un}}return e[t.id]=n,n}}}let As=0;function Cs(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Ps(e){const t=new Ts,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ln};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ln,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)i.probe.push(new Un);const r=new Un,a=new ui,o=new ui;return{setup:function(r){let a=0,o=0,s=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,h=0,d=0,u=0,p=0,f=0,m=0,g=0,v=0,w=0;r.sort(Cs);for(let e=0,y=r.length;e<y;e++){const y=r[e],b=y.color,x=y.intensity,_=y.distance,k=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)a+=b.r*x,o+=b.g*x,s+=b.b*x;else if(y.isLightProbe){for(let e=0;e<9;e++)i.probe[e].addScaledVector(y.sh.coefficients[e],x);w++}else if(y.isDirectionalLight){const e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){const e=y.shadow,t=n.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,i.directionalShadow[l]=t,i.directionalShadowMap[l]=k,i.directionalShadowMatrix[l]=y.shadow.matrix,p++}i.directional[l]=e,l++}else if(y.isSpotLight){const e=t.get(y);e.position.setFromMatrixPosition(y.matrixWorld),e.color.copy(b).multiplyScalar(x),e.distance=_,e.coneCos=Math.cos(y.angle),e.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),e.decay=y.decay,i.spot[h]=e;const r=y.shadow;if(y.map&&(i.spotLightMap[g]=y.map,g++,r.updateMatrices(y),y.castShadow&&v++),i.spotLightMatrix[h]=r.matrix,y.castShadow){const e=n.get(y);e.shadowIntensity=r.intensity,e.shadowBias=r.bias,e.shadowNormalBias=r.normalBias,e.shadowRadius=r.radius,e.shadowMapSize=r.mapSize,i.spotShadow[h]=e,i.spotShadowMap[h]=k,m++}h++}else if(y.isRectAreaLight){const e=t.get(y);e.color.copy(b).multiplyScalar(x),e.halfWidth.set(.5*y.width,0,0),e.halfHeight.set(0,.5*y.height,0),i.rectArea[d]=e,d++}else if(y.isPointLight){const e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),e.distance=y.distance,e.decay=y.decay,y.castShadow){const e=y.shadow,t=n.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,i.pointShadow[c]=t,i.pointShadowMap[c]=k,i.pointShadowMatrix[c]=y.shadow.matrix,f++}i.point[c]=e,c++}else if(y.isHemisphereLight){const e=t.get(y);e.skyColor.copy(y.color).multiplyScalar(x),e.groundColor.copy(y.groundColor).multiplyScalar(x),i.hemi[u]=e,u++}}d>0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=da.LTC_FLOAT_1,i.rectAreaLTC2=da.LTC_FLOAT_2):(i.rectAreaLTC1=da.LTC_HALF_1,i.rectAreaLTC2=da.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=o,i.ambient[2]=s;const y=i.hash;y.directionalLength===l&&y.pointLength===c&&y.spotLength===h&&y.rectAreaLength===d&&y.hemiLength===u&&y.numDirectionalShadows===p&&y.numPointShadows===f&&y.numSpotShadows===m&&y.numSpotMaps===g&&y.numLightProbes===w||(i.directional.length=l,i.spot.length=h,i.rectArea.length=d,i.point.length=c,i.hemi.length=u,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=m,i.spotShadowMap.length=m,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=f,i.spotLightMatrix.length=m+g-v,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=v,i.numLightProbes=w,y.directionalLength=l,y.pointLength=c,y.spotLength=h,y.rectAreaLength=d,y.hemiLength=u,y.numDirectionalShadows=p,y.numPointShadows=f,y.numSpotShadows=m,y.numSpotMaps=g,y.numLightProbes=w,i.version=As++)},setupView:function(e,t){let n=0,s=0,l=0,c=0,h=0;const d=t.matrixWorldInverse;for(let t=0,u=e.length;t<u;t++){const u=e[t];if(u.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(d),n++}else if(u.isSpotLight){const e=i.spot[l];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(d),l++}else if(u.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),o.identity(),a.copy(u.matrixWorld),a.premultiply(d),o.extractRotation(a),e.halfWidth.set(.5*u.width,0,0),e.halfHeight.set(0,.5*u.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),c++}else if(u.isPointLight){const e=i.point[s];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),s++}else if(u.isHemisphereLight){const e=i.hemi[h];e.direction.setFromMatrixPosition(u.matrixWorld),e.direction.transformDirection(d),h++}}},state:i}}function Rs(e){const t=new Ps(e),n=[],i=[];const r={lightsArray:n,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,n.length=0,i.length=0},state:r,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function Ls(e){let t=new WeakMap;return{get:function(n,i=0){const r=t.get(n);let a;return void 0===r?(a=new Rs(e),t.set(n,[a])):i>=r.length?(a=new Rs(e),r.push(a)):a=r[i],a},dispose:function(){t=new WeakMap}}}class Is extends rr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,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}}class Ns extends rr{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}}function Ds(e,t,n){let i=new oa;const r=new ln,a=new ln,o=new Pn,s=new Is({depthPacking:3201}),l=new Ns,c={},h=n.maxTextureSize,d={[M]:T,[T]:M,[A]:2},u=new Gr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ln},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=u.clone();p.defines.HORIZONTAL_PASS=1;const f=new yr;f.setAttribute("position",new lr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Br(f,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=k;let v=this.type;function w(n,i){const a=t.update(m);u.defines.VSM_SAMPLES!==n.blurSamples&&(u.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Ln(r.x,r.y)),u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,a,u,m,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,a,p,m,null)}function y(t,n,i,r){let a=null;const o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?l:s,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=a.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=a.clone(),i[t]=r,n.addEventListener("dispose",x)),a=r}if(a.visible=n.visible,a.wireframe=n.wireframe,a.side=r===S?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial){e.properties.get(a).light=i}return a}function b(n,r,a,o,s){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===S)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=t.update(n),l=n.material;if(Array.isArray(l)){const t=i.groups;for(let c=0,h=t.length;c<h;c++){const h=t[c],d=l[h.materialIndex];if(d&&d.visible){const t=y(n,d,o,s);n.onBeforeShadow(e,n,r,a,i,t,h),e.renderBufferDirect(a,null,i,t,n,h),n.onAfterShadow(e,n,r,a,i,t,h)}}}else if(l.visible){const t=y(n,l,o,s);n.onBeforeShadow(e,n,r,a,i,t,null),e.renderBufferDirect(a,null,i,t,n,null),n.onAfterShadow(e,n,r,a,i,t,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)b(l[e],r,a,o,s)}function x(e){e.target.removeEventListener("dispose",x);for(const t in c){const n=c[t],i=e.target.uuid;if(i in n){n[i].dispose(),delete n[i]}}}this.render=function(t,n,s){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===t.length)return;const l=e.getRenderTarget(),c=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),u=e.state;u.setBlending(0),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);const p=v!==S&&this.type===S,f=v===S&&this.type!==S;for(let l=0,c=t.length;l<c;l++){const c=t[l],d=c.shadow;if(void 0===d){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===d.autoUpdate&&!1===d.needsUpdate)continue;r.copy(d.mapSize);const m=d.getFrameExtents();if(r.multiply(m),a.copy(d.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(a.x=Math.floor(h/m.x),r.x=a.x*m.x,d.mapSize.x=a.x),r.y>h&&(a.y=Math.floor(h/m.y),r.y=a.y*m.y,d.mapSize.y=a.y)),null===d.map||!0===p||!0===f){const e=this.type!==S?{minFilter:pe,magFilter:pe}:{};null!==d.map&&d.map.dispose(),d.map=new Ln(r.x,r.y,e),d.map.texture.name=c.name+".shadowMap",d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();const g=d.getViewportCount();for(let e=0;e<g;e++){const t=d.getViewport(e);o.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),u.viewport(o),d.updateMatrices(c,e),i=d.getFrustum(),b(n,s,d.camera,c,this.type)}!0!==d.isPointLightShadow&&this.type===S&&w(d,s),d.needsUpdate=!1}v=this.type,g.needsUpdate=!1,e.setRenderTarget(l,c,d)}}function Us(e){const t=new function(){let t=!1;const n=new Pn;let i=null;const r=new Pn(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},n=new function(){let t=!1,n=null,i=null,r=null;return{setTest:function(t){t?re(e.DEPTH_TEST):ae(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},i=new function(){let t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(n){t||(n?re(e.STENCIL_TEST):ae(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null}}},r=new WeakMap,a=new WeakMap;let o={},s={},l=new WeakMap,c=[],h=null,d=!1,u=null,p=null,f=null,m=null,g=null,v=null,w=null,y=new tr(0,0,0),b=0,x=!1,_=null,k=null,E=null,S=null,M=null;const A=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,Y=0;const K=e.getParameter(e.VERSION);-1!==K.indexOf("WebGL")?(Y=parseFloat(/^WebGL (\d)/.exec(K)[1]),X=Y>=1):-1!==K.indexOf("OpenGL ES")&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),X=Y>=2);let Z=null,J={};const Q=e.getParameter(e.SCISSOR_BOX),$=e.getParameter(e.VIEWPORT),ee=(new Pn).fromArray(Q),te=(new Pn).fromArray($);function ne(t,n,i,r){const a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<i;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return o}const ie={};function re(t){!0!==o[t]&&(e.enable(t),o[t]=!0)}function ae(t){!1!==o[t]&&(e.disable(t),o[t]=!1)}ie[e.TEXTURE_2D]=ne(e.TEXTURE_2D,e.TEXTURE_2D,1),ie[e.TEXTURE_CUBE_MAP]=ne(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[e.TEXTURE_2D_ARRAY]=ne(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),ie[e.TEXTURE_3D]=ne(e.TEXTURE_3D,e.TEXTURE_3D,1,1),t.setClear(0,0,0,1),n.setClear(1),i.setClear(0),re(e.DEPTH_TEST),n.setFunc(3),ce(!1),he(1),re(e.CULL_FACE),le(0);const oe={[C]:e.FUNC_ADD,[P]:e.FUNC_SUBTRACT,[R]:e.FUNC_REVERSE_SUBTRACT};oe[103]=e.MIN,oe[104]=e.MAX;const se={[L]:e.ZERO,[I]:e.ONE,[N]:e.SRC_COLOR,[U]:e.SRC_ALPHA,[H]:e.SRC_ALPHA_SATURATE,[F]:e.DST_COLOR,[O]:e.DST_ALPHA,[D]:e.ONE_MINUS_SRC_COLOR,[B]:e.ONE_MINUS_SRC_ALPHA,[W]:e.ONE_MINUS_DST_COLOR,[z]:e.ONE_MINUS_DST_ALPHA,[V]:e.CONSTANT_COLOR,[G]:e.ONE_MINUS_CONSTANT_COLOR,[j]:e.CONSTANT_ALPHA,[q]:e.ONE_MINUS_CONSTANT_ALPHA};function le(t,n,i,r,a,o,s,l,c,h){if(0!==t){if(!1===d&&(re(e.BLEND),d=!0),5===t)a=a||n,o=o||i,s=s||r,n===p&&a===g||(e.blendEquationSeparate(oe[n],oe[a]),p=n,g=a),i===f&&r===m&&o===v&&s===w||(e.blendFuncSeparate(se[i],se[r],se[o],se[s]),f=i,m=r,v=o,w=s),!1!==l.equals(y)&&c===b||(e.blendColor(l.r,l.g,l.b,c),y.copy(l),b=c),u=t,x=!1;else if(t!==u||h!==x){if(p===C&&g===C||(e.blendEquation(e.FUNC_ADD),p=C,g=C),h)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}f=null,m=null,v=null,w=null,y.set(0,0,0),b=0,u=t,x=h}}else!0===d&&(ae(e.BLEND),d=!1)}function ce(t){_!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),_=t)}function he(t){0!==t?(re(e.CULL_FACE),t!==k&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):ae(e.CULL_FACE),k=t}function de(t,n,i){t?(re(e.POLYGON_OFFSET_FILL),S===n&&M===i||(e.polygonOffset(n,i),S=n,M=i)):ae(e.POLYGON_OFFSET_FILL)}return{buffers:{color:t,depth:n,stencil:i},enable:re,disable:ae,bindFramebuffer:function(t,n){return s[t]!==n&&(e.bindFramebuffer(t,n),s[t]=n,t===e.DRAW_FRAMEBUFFER&&(s[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(s[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let i=c,r=!1;if(t){i=l.get(n),void 0===i&&(i=[],l.set(n,i));const a=t.textures;if(i.length!==a.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=a.length,r=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,r=!0);r&&e.drawBuffers(i)},useProgram:function(t){return h!==t&&(e.useProgram(t),h=t,!0)},setBlending:le,setMaterial:function(r,a){2===r.side?ae(e.CULL_FACE):re(e.CULL_FACE);let o=r.side===T;a&&(o=!o),ce(o),1===r.blending&&!1===r.transparent?le(0):le(r.blending,r.blendEquation,r.blendSrc,r.blendDst,r.blendEquationAlpha,r.blendSrcAlpha,r.blendDstAlpha,r.blendColor,r.blendAlpha,r.premultipliedAlpha),n.setFunc(r.depthFunc),n.setTest(r.depthTest),n.setMask(r.depthWrite),t.setMask(r.colorWrite);const s=r.stencilWrite;i.setTest(s),s&&(i.setMask(r.stencilWriteMask),i.setFunc(r.stencilFunc,r.stencilRef,r.stencilFuncMask),i.setOp(r.stencilFail,r.stencilZFail,r.stencilZPass)),de(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),!0===r.alphaToCoverage?re(e.SAMPLE_ALPHA_TO_COVERAGE):ae(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:ce,setCullFace:he,setLineWidth:function(t){t!==E&&(X&&e.lineWidth(t),E=t)},setPolygonOffset:de,setScissorTest:function(t){t?re(e.SCISSOR_TEST):ae(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+A-1),Z!==t&&(e.activeTexture(t),Z=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===Z?e.TEXTURE0+A-1:Z);let r=J[i];void 0===r&&(r={type:void 0,texture:void 0},J[i]=r),r.type===t&&r.texture===n||(Z!==i&&(e.activeTexture(i),Z=i),e.bindTexture(t,n||ie[t]),r.type=t,r.texture=n)},unbindTexture:function(){const t=J[Z];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){let i=a.get(n);void 0===i&&(i=new WeakMap,a.set(n,i));let r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){const i=a.get(n).get(t);r.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),r.set(n,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===ee.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),ee.copy(t))},viewport:function(t){!1===te.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),te.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),o={},Z=null,J={},s={},l=new WeakMap,c=[],h=null,d=!1,u=null,p=null,f=null,m=null,g=null,v=null,w=null,y=new tr(0,0,0),b=0,x=!1,_=null,k=null,E=null,S=null,M=null,ee.set(0,0,e.canvas.width,e.canvas.height),te.set(0,0,e.canvas.width,e.canvas.height),t.reset(),n.reset(),i.reset()}}}function Bs(e,t,n,i){const r=function(e){switch(e){case ye:case be:return{byteLength:1,components:1};case _e:case xe:case Me:return{byteLength:2,components:1};case Te:case Ae:return{byteLength:2,components:4};case Ee:case ke:case Se:return{byteLength:4,components:1};case Pe:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${e}.`)}(i);switch(n){case Re:case Ne:return e*t;case De:return e*t*2;case Oe:case ze:return e*t/r.components*r.byteLength;case Fe:case We:return e*t*2/r.components*r.byteLength;case Le:return e*t*3/r.components*r.byteLength;case Ie:case He:return e*t*4/r.components*r.byteLength;case Ve:case Ge:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case je:case qe:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Ye:case Ze:return Math.max(e,16)*Math.max(t,8)/4;case Xe:case Ke:return Math.max(e,8)*Math.max(t,8)/2;case Je:case Qe:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case $e:case et:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case tt:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case nt:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case it:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case rt:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case at:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case ot:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case st:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case lt:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case ct:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case ht:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case dt:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case ut:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case pt:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case ft:case mt:case gt:return Math.ceil(e/4)*Math.ceil(t/4)*16;case vt:case wt:return Math.ceil(e/4)*Math.ceil(t/4)*8;case yt:case bt:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function Os(e,t,n,i,r,a,o){const s=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new ln,h=new WeakMap;let d;const u=new WeakMap;let p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function f(e,t){return p?new OffscreenCanvas(e,t):un("canvas")}function m(e,t,n){let i=1;const r=F(e);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===d&&(d=f(n,a));const o=t?f(n,a):d;o.width=n,o.height=a;return o.getContext("2d").drawImage(e,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function g(e){return e.generateMipmaps&&e.minFilter!==pe&&e.minFilter!==ge}function v(t){e.generateMipmap(t)}function w(n,i,r,a,o=!1){if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let s=i;if(i===e.RED&&(r===e.FLOAT&&(s=e.R32F),r===e.HALF_FLOAT&&(s=e.R16F),r===e.UNSIGNED_BYTE&&(s=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(s=e.R8UI),r===e.UNSIGNED_SHORT&&(s=e.R16UI),r===e.UNSIGNED_INT&&(s=e.R32UI),r===e.BYTE&&(s=e.R8I),r===e.SHORT&&(s=e.R16I),r===e.INT&&(s=e.R32I)),i===e.RG&&(r===e.FLOAT&&(s=e.RG32F),r===e.HALF_FLOAT&&(s=e.RG16F),r===e.UNSIGNED_BYTE&&(s=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(s=e.RG8UI),r===e.UNSIGNED_SHORT&&(s=e.RG16UI),r===e.UNSIGNED_INT&&(s=e.RG32UI),r===e.BYTE&&(s=e.RG8I),r===e.SHORT&&(s=e.RG16I),r===e.INT&&(s=e.RG32I)),i===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),i===e.RGBA){const t=o?Lt:bn.getTransfer(a);r===e.FLOAT&&(s=e.RGBA32F),r===e.HALF_FLOAT&&(s=e.RGBA16F),r===e.UNSIGNED_BYTE&&(s=t===It?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return s!==e.R16F&&s!==e.R32F&&s!==e.RG16F&&s!==e.RG32F&&s!==e.RGBA16F&&s!==e.RGBA32F||t.get("EXT_color_buffer_float"),s}function y(t,n){let i;return t?null===n||n===Ee||n===Ce?i=e.DEPTH24_STENCIL8:n===Se?i=e.DEPTH32F_STENCIL8:n===_e&&(i=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===Ee||n===Ce?i=e.DEPTH_COMPONENT24:n===Se?i=e.DEPTH_COMPONENT32F:n===_e&&(i=e.DEPTH_COMPONENT16),i}function b(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==pe&&e.minFilter!==ge?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function x(e){const t=e.target;t.removeEventListener("dispose",x),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=u.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&k(e),0===Object.keys(r).length&&u.delete(n)}i.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function _(t){const n=t.target;n.removeEventListener("dispose",_),function(t){const n=i.get(t);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i<n.__webglFramebuffer[t].length;i++)e.deleteFramebuffer(n.__webglFramebuffer[t][i]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=t.textures;for(let t=0,n=r.length;t<n;t++){const n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),o.memory.textures--),i.remove(r[t])}i.remove(t)}(n)}function k(t){const n=i.get(t);e.deleteTexture(n.__webglTexture);const r=t.source;delete u.get(r)[n.__cacheKey],o.memory.textures--}let E=0;function S(t,r){const a=i.get(t);if(t.isVideoTexture&&function(e){const t=o.render.frame;h.get(e)!==t&&(h.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void R(a,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}const M={[he]:e.REPEAT,[de]:e.CLAMP_TO_EDGE,[ue]:e.MIRRORED_REPEAT},T={[pe]:e.NEAREST,[fe]:e.NEAREST_MIPMAP_NEAREST,[me]:e.NEAREST_MIPMAP_LINEAR,[ge]:e.LINEAR,[ve]:e.LINEAR_MIPMAP_NEAREST,[we]:e.LINEAR_MIPMAP_LINEAR},A={[Bt]:e.NEVER,[Gt]:e.ALWAYS,[Ot]:e.LESS,[Ft]:e.LEQUAL,[zt]:e.EQUAL,[Vt]:e.GEQUAL,[Wt]:e.GREATER,[Ht]:e.NOTEQUAL};function C(n,a){if(a.type!==Se||!1!==t.has("OES_texture_float_linear")||a.magFilter!==ge&&a.magFilter!==ve&&a.magFilter!==me&&a.magFilter!==we&&a.minFilter!==ge&&a.minFilter!==ve&&a.minFilter!==me&&a.minFilter!==we||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,M[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,M[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,M[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,T[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,T[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,A[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(a.magFilter===pe)return;if(a.minFilter!==me&&a.minFilter!==we)return;if(a.type===Se&&!1===t.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){const o=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function P(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",x));const r=n.source;let a=u.get(r);void 0===a&&(a={},u.set(r,a));const s=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),a[s].usedTimes++;const r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&k(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return i}function R(t,o,s){let l=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(l=e.TEXTURE_3D);const c=P(t,o),h=o.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+s);const d=i.get(h);if(h.version!==d.__version||!0===c){n.activeTexture(e.TEXTURE0+s);const t=bn.getPrimaries(bn.workingColorSpace),i=o.colorSpace===Tt?null:bn.getPrimaries(o.colorSpace),u=o.colorSpace===Tt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let p=m(o.image,!1,r.maxTextureSize);p=z(o,p);const f=a.convert(o.format,o.colorSpace),x=a.convert(o.type);let _,k=w(o.internalFormat,f,x,o.colorSpace,o.isVideoTexture);C(l,o);const E=o.mipmaps,S=!0!==o.isVideoTexture,M=void 0===d.__version||!0===c,T=h.dataReady,A=b(o,p);if(o.isDepthTexture)k=y(o.format===Be,o.type),M&&(S?n.texStorage2D(e.TEXTURE_2D,1,k,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,k,p.width,p.height,0,f,x,null));else if(o.isDataTexture)if(E.length>0){S&&M&&n.texStorage2D(e.TEXTURE_2D,A,k,E[0].width,E[0].height);for(let t=0,i=E.length;t<i;t++)_=E[t],S?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,f,x,_.data):n.texImage2D(e.TEXTURE_2D,t,k,_.width,_.height,0,f,x,_.data);o.generateMipmaps=!1}else S?(M&&n.texStorage2D(e.TEXTURE_2D,A,k,p.width,p.height),T&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,p.width,p.height,f,x,p.data)):n.texImage2D(e.TEXTURE_2D,0,k,p.width,p.height,0,f,x,p.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){S&&M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,A,k,E[0].width,E[0].height,p.depth);for(let t=0,i=E.length;t<i;t++)if(_=E[t],o.format!==Ie)if(null!==f)if(S){if(T)if(o.layerUpdates.size>0){const i=Bs(_.width,_.height,o.format,o.type);for(const r of o.layerUpdates){const a=_.data.subarray(r*i/_.data.BYTES_PER_ELEMENT,(r+1)*i/_.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,r,_.width,_.height,1,f,a,0,0)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,p.depth,f,_.data,0,0)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,k,_.width,_.height,p.depth,0,_.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else S?T&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,p.depth,f,x,_.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,k,_.width,_.height,p.depth,0,f,x,_.data)}else{S&&M&&n.texStorage2D(e.TEXTURE_2D,A,k,E[0].width,E[0].height);for(let t=0,i=E.length;t<i;t++)_=E[t],o.format!==Ie?null!==f?S?T&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,f,_.data):n.compressedTexImage2D(e.TEXTURE_2D,t,k,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):S?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,f,x,_.data):n.texImage2D(e.TEXTURE_2D,t,k,_.width,_.height,0,f,x,_.data)}else if(o.isDataArrayTexture)if(S){if(M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,A,k,p.width,p.height,p.depth),T)if(o.layerUpdates.size>0){const t=Bs(p.width,p.height,o.format,o.type);for(const i of o.layerUpdates){const r=p.data.subarray(i*t/p.data.BYTES_PER_ELEMENT,(i+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,f,x,r)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,f,x,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,k,p.width,p.height,p.depth,0,f,x,p.data);else if(o.isData3DTexture)S?(M&&n.texStorage3D(e.TEXTURE_3D,A,k,p.width,p.height,p.depth),T&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,f,x,p.data)):n.texImage3D(e.TEXTURE_3D,0,k,p.width,p.height,p.depth,0,f,x,p.data);else if(o.isFramebufferTexture){if(M)if(S)n.texStorage2D(e.TEXTURE_2D,A,k,p.width,p.height);else{let t=p.width,i=p.height;for(let r=0;r<A;r++)n.texImage2D(e.TEXTURE_2D,r,k,t,i,0,f,x,null),t>>=1,i>>=1}}else if(E.length>0){if(S&&M){const t=F(E[0]);n.texStorage2D(e.TEXTURE_2D,A,k,t.width,t.height)}for(let t=0,i=E.length;t<i;t++)_=E[t],S?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,f,x,_):n.texImage2D(e.TEXTURE_2D,t,k,f,x,_);o.generateMipmaps=!1}else if(S){if(M){const t=F(p);n.texStorage2D(e.TEXTURE_2D,A,k,t.width,t.height)}T&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,f,x,p)}else n.texImage2D(e.TEXTURE_2D,0,k,f,x,p);g(o)&&v(l),d.__version=h.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function L(t,r,o,l,c,h){const d=a.convert(o.format,o.colorSpace),u=a.convert(o.type),p=w(o.internalFormat,d,u,o.colorSpace);if(!i.get(r).__hasExternalTextures){const t=Math.max(1,r.width>>h),i=Math.max(1,r.height>>h);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?n.texImage3D(c,h,p,t,i,r.depth,0,d,u,null):n.texImage2D(c,h,p,t,i,0,d,u,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),O(r)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,c,i.get(o).__webglTexture,0,B(r)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,c,i.get(o).__webglTexture,h),n.bindFramebuffer(e.FRAMEBUFFER,null)}function I(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,o=y(n.stencilBuffer,a),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=B(n);O(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,o,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r<t.length;r++){const o=t[r],l=a.convert(o.format,o.colorSpace),c=a.convert(o.type),h=w(o.internalFormat,l,c,o.colorSpace),d=B(n);i&&!1===O(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,d,h,n.width,n.height):O(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,d,h,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,h,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function N(t){const r=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),S(r.depthTexture,0);const a=i.get(r.depthTexture).__webglTexture,o=B(r);if(r.depthTexture.format===Ue)O(r)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==Be)throw new Error("Unknown depthTexture format");O(r)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,t)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=e.createRenderbuffer(),I(r.__webglDepthbuffer[i],t,!1)}else n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),I(r.__webglDepthbuffer,t,!1);n.bindFramebuffer(e.FRAMEBUFFER,null)}const D=[],U=[];function B(e){return Math.min(r.maxSamples,e.samples)}function O(e){const n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function z(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==Ct&&n!==Tt&&(bn.getTransfer(n)===It?i===Ie&&r===ye||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function F(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){const e=E;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),E+=1,e},this.resetTextureUnits=function(){E=0},this.setTexture2D=S,this.setTexture2DArray=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?R(a,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?R(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,o){const s=i.get(t);t.version>0&&s.__version!==t.version?function(t,o,s){if(6!==o.image.length)return;const l=P(t,o),c=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(e.TEXTURE0+s);const t=bn.getPrimaries(bn.workingColorSpace),i=o.colorSpace===Tt?null:bn.getPrimaries(o.colorSpace),d=o.colorSpace===Tt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);const u=o.isCompressedTexture||o.image[0].isCompressedTexture,p=o.image[0]&&o.image[0].isDataTexture,f=[];for(let e=0;e<6;e++)f[e]=u||p?p?o.image[e].image:o.image[e]:m(o.image[e],!0,r.maxCubemapSize),f[e]=z(o,f[e]);const y=f[0],x=a.convert(o.format,o.colorSpace),_=a.convert(o.type),k=w(o.internalFormat,x,_,o.colorSpace),E=!0!==o.isVideoTexture,S=void 0===h.__version||!0===l,M=c.dataReady;let T,A=b(o,y);if(C(e.TEXTURE_CUBE_MAP,o),u){E&&S&&n.texStorage2D(e.TEXTURE_CUBE_MAP,A,k,y.width,y.height);for(let t=0;t<6;t++){T=f[t].mipmaps;for(let i=0;i<T.length;i++){const r=T[i];o.format!==Ie?null!==x?E?M&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,x,r.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,k,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):E?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,x,_,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,k,r.width,r.height,0,x,_,r.data)}}}else{if(T=o.mipmaps,E&&S){T.length>0&&A++;const t=F(f[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,A,k,t.width,t.height)}for(let t=0;t<6;t++)if(p){E?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,f[t].width,f[t].height,x,_,f[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,k,f[t].width,f[t].height,0,x,_,f[t].data);for(let i=0;i<T.length;i++){const r=T[i].image[t].image;E?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,r.width,r.height,x,_,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,k,r.width,r.height,0,x,_,r.data)}}else{E?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,x,_,f[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,k,x,_,f[t]);for(let i=0;i<T.length;i++){const r=T[i];E?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,x,_,r.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,k,x,_,r.image[t])}}}g(o)&&v(e.TEXTURE_CUBE_MAP),h.__version=c.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}(s,t,o):n.bindTexture(e.TEXTURE_CUBE_MAP,s.__webglTexture,e.TEXTURE0+o)},this.rebindTextures=function(t,n,r){const a=i.get(t);void 0!==n&&L(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&N(t)},this.setupRenderTarget=function(t){const r=t.texture,s=i.get(t),l=i.get(r);t.addEventListener("dispose",_);const c=t.textures,h=!0===t.isWebGLCubeRenderTarget,d=c.length>1;if(d||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,o.memory.textures++),h){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n<r.mipmaps.length;n++)s.__webglFramebuffer[t][n]=e.createFramebuffer()}else s.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){s.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)s.__webglFramebuffer[t]=e.createFramebuffer()}else s.__webglFramebuffer=e.createFramebuffer();if(d)for(let t=0,n=c.length;t<n;t++){const n=i.get(c[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&!1===O(t)){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];s.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,s.__webglColorRenderbuffer[n]);const r=a.convert(i.format,i.colorSpace),o=a.convert(i.type),l=w(i.internalFormat,r,o,i.colorSpace,!0===t.isXRRenderTarget),h=B(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,h,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,s.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),I(s.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(h){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),C(e.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)L(s.__webglFramebuffer[n][i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else L(s.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(r)&&v(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){for(let r=0,a=c.length;r<a;r++){const a=c[r],o=i.get(a);n.bindTexture(e.TEXTURE_2D,o.__webglTexture),C(e.TEXTURE_2D,a),L(s.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),g(a)&&v(e.TEXTURE_2D)}n.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),C(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)L(s.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,i,n);else L(s.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,i,0);g(r)&&v(i),n.unbindTexture()}t.depthBuffer&&N(t)},this.updateRenderTargetMipmap=function(t){const r=t.textures;for(let a=0,o=r.length;a<o;a++){const o=r[a];if(g(o)){const r=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=i.get(o).__webglTexture;n.bindTexture(r,a),v(r),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0)if(!1===O(t)){const r=t.textures,a=t.width,o=t.height;let s=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=i.get(t),d=r.length>1;if(d)for(let t=0;t<r.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),d){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const t=i.get(r[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),!0===l&&(D.length=0,U.length=0,D.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(D.push(c),U.push(c),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,U)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,D))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<r.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);const a=i.get(r[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&l){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=N,this.setupFrameBufferTexture=L,this.useMultisampledRTT=O}function zs(e,t){return{convert:function(n,i=""){let r;const a=bn.getTransfer(i);if(n===ye)return e.UNSIGNED_BYTE;if(n===Te)return e.UNSIGNED_SHORT_4_4_4_4;if(n===Ae)return e.UNSIGNED_SHORT_5_5_5_1;if(n===Pe)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===be)return e.BYTE;if(n===xe)return e.SHORT;if(n===_e)return e.UNSIGNED_SHORT;if(n===ke)return e.INT;if(n===Ee)return e.UNSIGNED_INT;if(n===Se)return e.FLOAT;if(n===Me)return e.HALF_FLOAT;if(n===Re)return e.ALPHA;if(n===Le)return e.RGB;if(n===Ie)return e.RGBA;if(n===Ne)return e.LUMINANCE;if(n===De)return e.LUMINANCE_ALPHA;if(n===Ue)return e.DEPTH_COMPONENT;if(n===Be)return e.DEPTH_STENCIL;if(n===Oe)return e.RED;if(n===ze)return e.RED_INTEGER;if(n===Fe)return e.RG;if(n===We)return e.RG_INTEGER;if(n===He)return e.RGBA_INTEGER;if(n===Ve||n===Ge||n===je||n===qe)if(a===It){if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===Ve)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Ge)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===je)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===qe)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=t.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===Ve)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Ge)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===je)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===qe)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Xe||n===Ye||n===Ke||n===Ze){if(r=t.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===Xe)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ye)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Ke)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ze)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===Je||n===Qe||n===$e){if(r=t.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===Je||n===Qe)return a===It?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===$e)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===et||n===tt||n===nt||n===it||n===rt||n===at||n===ot||n===st||n===lt||n===ct||n===ht||n===dt||n===ut||n===pt){if(r=t.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===et)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===tt)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===nt)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===it)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===rt)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===at)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ot)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===st)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===lt)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ct)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ht)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===dt)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===ut)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===pt)return a===It?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===ft||n===mt||n===gt){if(r=t.get("EXT_texture_compression_bptc"),null===r)return null;if(n===ft)return a===It?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===mt)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===gt)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===vt||n===wt||n===yt||n===bt){if(r=t.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===ft)return r.COMPRESSED_RED_RGTC1_EXT;if(n===wt)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===yt)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===bt)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===Ce?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class Fs extends Kr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ws extends zi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Hs={type:"move"};class Vs{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Ws,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Ws,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Un,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Un),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Ws,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Un,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Un),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const 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}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,a=null;const o=this._targetRay,s=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){a=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),s=.02,c=.005;l.inputState.pinching&&o>s+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=s-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1));null!==o&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Hs)))}return null!==o&&(o.visible=null!==i),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new Ws;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Gs{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(null===this.texture){const i=new Cn;e.properties.get(i).__webglTexture=t.texture,t.depthNear==n.depthNear&&t.depthFar==n.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new Gr({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Br(new ca(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class js extends Kt{constructor(e,t){super();const n=this;let i=null,r=1,a=null,o="local-floor",s=1,l=null,c=null,h=null,d=null,u=null,p=null;const f=new Gs,m=t.getContextAttributes();let g=null,v=null;const w=[],y=[],b=new ln;let x=null;const _=new Kr;_.layers.enable(1),_.viewport=new Pn;const k=new Kr;k.layers.enable(2),k.viewport=new Pn;const E=[_,k],S=new Fs;S.layers.enable(1),S.layers.enable(2);let M=null,T=null;function A(e){const t=y.indexOf(e.inputSource);if(-1===t)return;const n=w[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function C(){i.removeEventListener("select",A),i.removeEventListener("selectstart",A),i.removeEventListener("selectend",A),i.removeEventListener("squeeze",A),i.removeEventListener("squeezestart",A),i.removeEventListener("squeezeend",A),i.removeEventListener("end",C),i.removeEventListener("inputsourceschange",P);for(let e=0;e<w.length;e++){const t=y[e];null!==t&&(y[e]=null,w[e].disconnect(t))}M=null,T=null,f.reset(),e.setRenderTarget(g),u=null,d=null,h=null,i=null,v=null,D.stop(),n.isPresenting=!1,e.setPixelRatio(x),e.setSize(b.width,b.height,!1),n.dispatchEvent({type:"sessionend"})}function P(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],i=y.indexOf(n);i>=0&&(y[i]=null,w[i].disconnect(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let i=y.indexOf(n);if(-1===i){for(let e=0;e<w.length;e++){if(e>=y.length){y.push(n),i=e;break}if(null===y[e]){y[e]=n,i=e;break}}if(-1===i)break}const r=w[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=w[e];return void 0===t&&(t=new Vs,w[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=w[e];return void 0===t&&(t=new Vs,w[e]=t),t.getGripSpace()},this.getHand=function(e){let t=w[e];return void 0===t&&(t=new Vs,w[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==d?d:u},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(g=e.getRenderTarget(),i.addEventListener("select",A),i.addEventListener("selectstart",A),i.addEventListener("selectend",A),i.addEventListener("squeeze",A),i.addEventListener("squeezestart",A),i.addEventListener("squeezeend",A),i.addEventListener("end",C),i.addEventListener("inputsourceschange",P),!0!==m.xrCompatible&&await t.makeXRCompatible(),x=e.getPixelRatio(),e.getSize(b),void 0===i.renderState.layers){const n={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};u=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:u}),e.setPixelRatio(1),e.setSize(u.framebufferWidth,u.framebufferHeight,!1),v=new Ln(u.framebufferWidth,u.framebufferHeight,{format:Ie,type:ye,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let n=null,a=null,o=null;m.depth&&(o=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=m.stencil?Be:Ue,a=m.stencil?Ce:Ee);const s={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:r};h=new XRWebGLBinding(i,t),d=h.createProjectionLayer(s),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),v=new Ln(d.textureWidth,d.textureHeight,{format:Ie,type:ye,depthTexture:new Xa(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:!1===d.ignoreDepthValues})}v.isXRRenderTarget=!0,this.setFoveation(s),l=null,a=await i.requestReferenceSpace(o),D.setContext(i),D.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return f.getDepthTexture()};const R=new Un,L=new Un;function I(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===i)return;null!==f.texture&&(e.near=f.depthNear,e.far=f.depthFar),S.near=k.near=_.near=e.near,S.far=k.far=_.far=e.far,M===S.near&&T===S.far||(i.updateRenderState({depthNear:S.near,depthFar:S.far}),M=S.near,T=S.far,_.near=M,_.far=T,k.near=M,k.far=T,_.updateProjectionMatrix(),k.updateProjectionMatrix(),e.updateProjectionMatrix());const t=e.parent,n=S.cameras;I(S,t);for(let e=0;e<n.length;e++)I(n[e],t);2===n.length?function(e,t,n){R.setFromMatrixPosition(t.matrixWorld),L.setFromMatrixPosition(n.matrixWorld);const i=R.distanceTo(L),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],d=(a[8]+1)/a[0],u=o*h,p=o*d,f=i/(-h+d),m=f*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();const g=o+f,v=s+f,w=u-m,y=p+(i-m),b=l*s/v*g,x=c*s/v*g;e.projectionMatrix.makePerspective(w,y,b,x,g,v),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(S,_,k):S.projectionMatrix.copy(_.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld));e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*$t*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,S,t)},this.getCamera=function(){return S},this.getFoveation=function(){if(null!==d||null!==u)return s},this.setFoveation=function(e){s=e,null!==d&&(d.fixedFoveation=e),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==f.texture},this.getDepthSensingMesh=function(){return f.getMesh(S)};let N=null;const D=new sa;D.setAnimationLoop((function(t,r){if(c=r.getViewerPose(l||a),p=r,null!==c){const t=c.views;null!==u&&(e.setRenderTargetFramebuffer(v,u.framebuffer),e.setRenderTarget(v));let n=!1;t.length!==S.cameras.length&&(S.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){const r=t[i];let a=null;if(null!==u)a=u.getViewport(r);else{const t=h.getViewSubImage(d,r);a=t.viewport,0===i&&(e.setRenderTargetTextures(v,t.colorTexture,d.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(v))}let o=E[i];void 0===o&&(o=new Kr,o.layers.enable(i),o.viewport=new Pn,E[i]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),0===i&&(S.matrix.copy(o.matrix),S.matrix.decompose(S.position,S.quaternion,S.scale)),!0===n&&S.cameras.push(o)}const r=i.enabledFeatures;if(r&&r.includes("depth-sensing")){const n=h.getDepthInformation(t[0]);n&&n.isValid&&n.texture&&f.init(e,n,i.renderState)}}for(let e=0;e<w.length;e++){const t=y[e],n=w[e];null!==t&&void 0!==n&&n.update(t,r,l||a)}N&&N(t,r),r.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:r}),p=null})),this.setAnimationLoop=function(e){N=e},this.dispose=function(){}}}const qs=new _i,Xs=new ui;function Ys(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,n(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,n(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,n(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,i.side===T&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,n(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),i.side===T&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,n(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,n(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),a=r.envMap,o=r.envMapRotation;a&&(e.envMap.value=a,qs.copy(o),qs.x*=-1,qs.y*=-1,qs.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(qs.y*=-1,qs.z*=-1),e.envMapRotation.value.setFromMatrix4(Xs.makeRotationFromEuler(qs)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,Hr(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,o,s){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform));e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform));t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===T&&e.clearcoatNormalScale.value.negate()));t.dispersion>0&&(e.dispersion.value=t.dispersion);t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,s)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,a,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Ks(e,t,n,i){let r={},a={},o=[];const s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,a=t+"_"+n;if(void 0===i[a])return i[a]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[a]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){const n=t.target;n.removeEventListener("dispose",h);const i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,d){let u=r[n.id];void 0===u&&(!function(e){const t=e.uniforms;let n=0;const i=16;for(let e=0,r=t.length;e<r;e++){const r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){const t=r[e],a=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=a.length;e<r;e++){const r=c(a[e]),o=n%i;0!==o&&i-o<r.boundary&&(n+=i-o),t.__data=new Float32Array(r.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=r.storage}}}const r=n%i;r>0&&(n+=i-r);e.__size=n,e.__cache={}}(n),u=function(t){const n=function(){for(let e=0;e<s;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;const i=e.createBuffer(),r=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=u,n.addEventListener("dispose",h));const p=d.program;i.updateUBOMapping(n,p);const f=t.render.frame;a[n.id]!==f&&(!function(t){const n=r[t.id],i=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=i.length;t<n;t++){const n=Array.isArray(i[t])?i[t]:[i[t]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,t,i,a)){const t=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let a=0;a<n.length;a++){const o=n[a],s=c(o);"number"==typeof o||"boolean"==typeof o?(r.__data[0]=o,e.bufferSubData(e.UNIFORM_BUFFER,t+i,r.__data)):o.isMatrix3?(r.__data[0]=o.elements[0],r.__data[1]=o.elements[1],r.__data[2]=o.elements[2],r.__data[3]=0,r.__data[4]=o.elements[3],r.__data[5]=o.elements[4],r.__data[6]=o.elements[5],r.__data[7]=0,r.__data[8]=o.elements[6],r.__data[9]=o.elements[7],r.__data[10]=o.elements[8],r.__data[11]=0):(o.toArray(r.__data,i),i+=s.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),a[n.id]=f)},dispose:function(){for(const t in r)e.deleteBuffer(r[t]);o=[],r={},a={}}}}class Zs{constructor(e={}){const{canvas:t=pn(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1}=e;let d;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=a;const u=new Uint32Array(4),p=new Int32Array(4);let f=null,g=null;const v=[],w=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=At,this.toneMapping=Z,this.toneMappingExposure=1;const y=this;let b=!1,x=0,_=0,k=null,E=-1,S=null;const A=new Pn,C=new Pn;let P=null;const R=new tr(0);let L=0,I=t.width,N=t.height,D=1,U=null,B=null;const O=new Pn(0,0,I,N),z=new Pn(0,0,I,N);let F=!1;const W=new oa;let H=!1,V=!1;const G=new ui,j=new Un,q=new Pn,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Y=!1;function K(){return null===k?D:1}let J,Q,$,ee,te,ne,ie,re,ae,oe,se,le,ce,he,de,ue,pe,fe,me,ge,ve,be,xe,ke,Se=n;function Pe(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${m}`),t.addEventListener("webglcontextlost",Ie,!1),t.addEventListener("webglcontextrestored",Ne,!1),t.addEventListener("webglcontextcreationerror",De,!1),null===Se){const t="webgl2";if(Se=Pe(t,e),null===Se)throw Pe(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function Re(){J=new Wa(Se),J.init(),be=new zs(Se,J),Q=new ya(Se,J,e,be),$=new Us(Se),ee=new Ga(Se),te=new _s,ne=new Os(Se,J,$,te,Q,be,ee),ie=new xa(y),re=new Fa(y),ae=new la(Se),xe=new va(Se,ae),oe=new Ha(Se,ae,ee,xe),se=new qa(Se,oe,ae,ee),me=new ja(Se,Q,ne),ue=new ba(te),le=new xs(y,ie,re,J,Q,xe,ue),ce=new Ys(y,te),he=new Ms,de=new Ls(J),fe=new ga(y,ie,re,$,se,d,s),pe=new Ds(y,se,Q),ke=new Ks(Se,ee,Q,$),ge=new wa(Se,J,ee),ve=new Va(Se,J,ee),ee.programs=le.programs,y.capabilities=Q,y.extensions=J,y.properties=te,y.renderLists=he,y.shadowMap=pe,y.state=$,y.info=ee}Re();const Le=new js(y,Se);function Ie(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function Ne(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const e=ee.autoReset,t=pe.enabled,n=pe.autoUpdate,i=pe.needsUpdate,r=pe.type;Re(),ee.autoReset=e,pe.enabled=t,pe.autoUpdate=n,pe.needsUpdate=i,pe.type=r}function De(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Ue(e){const t=e.target;t.removeEventListener("dispose",Ue),function(e){(function(e){const t=te.get(e).programs;void 0!==t&&(t.forEach((function(e){le.releaseProgram(e)})),e.isShaderMaterial&&le.releaseShaderCache(e))})(e),te.remove(e)}(t)}function Be(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=T,e.needsUpdate=!0,Ze(e,t,n),e.side=M,e.needsUpdate=!0,Ze(e,t,n),e.side=2):Ze(e,t,n)}this.xr=Le,this.getContext=function(){return Se},this.getContextAttributes=function(){return Se.getContextAttributes()},this.forceContextLoss=function(){const e=J.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=J.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return D},this.setPixelRatio=function(e){void 0!==e&&(D=e,this.setSize(I,N,!1))},this.getSize=function(e){return e.set(I,N)},this.setSize=function(e,n,i=!0){Le.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(I=e,N=n,t.width=Math.floor(e*D),t.height=Math.floor(n*D),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(I*D,N*D).floor()},this.setDrawingBufferSize=function(e,n,i){I=e,N=n,D=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(A)},this.getViewport=function(e){return e.copy(O)},this.setViewport=function(e,t,n,i){e.isVector4?O.set(e.x,e.y,e.z,e.w):O.set(e,t,n,i),$.viewport(A.copy(O).multiplyScalar(D).round())},this.getScissor=function(e){return e.copy(z)},this.setScissor=function(e,t,n,i){e.isVector4?z.set(e.x,e.y,e.z,e.w):z.set(e,t,n,i),$.scissor(C.copy(z).multiplyScalar(D).round())},this.getScissorTest=function(){return F},this.setScissorTest=function(e){$.setScissorTest(F=e)},this.setOpaqueSort=function(e){U=e},this.setTransparentSort=function(e){B=e},this.getClearColor=function(e){return e.copy(fe.getClearColor())},this.setClearColor=function(){fe.setClearColor.apply(fe,arguments)},this.getClearAlpha=function(){return fe.getClearAlpha()},this.setClearAlpha=function(){fe.setClearAlpha.apply(fe,arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==k){const t=k.texture.format;e=t===He||t===We||t===ze}if(e){const e=k.texture.type,t=e===ye||e===Ee||e===_e||e===Ce||e===Te||e===Ae,n=fe.getClearColor(),i=fe.getClearAlpha(),r=n.r,a=n.g,o=n.b;t?(u[0]=r,u[1]=a,u[2]=o,u[3]=i,Se.clearBufferuiv(Se.COLOR,0,u)):(p[0]=r,p[1]=a,p[2]=o,p[3]=i,Se.clearBufferiv(Se.COLOR,0,p))}else i|=Se.COLOR_BUFFER_BIT}t&&(i|=Se.DEPTH_BUFFER_BIT),n&&(i|=Se.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Se.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ie,!1),t.removeEventListener("webglcontextrestored",Ne,!1),t.removeEventListener("webglcontextcreationerror",De,!1),he.dispose(),de.dispose(),te.dispose(),ie.dispose(),re.dispose(),se.dispose(),xe.dispose(),ke.dispose(),le.dispose(),Le.dispose(),Le.removeEventListener("sessionstart",Fe),Le.removeEventListener("sessionend",Ve),Ge.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=X);const o=r.isMesh&&r.matrixWorld.determinant()<0,s=function(e,t,n,i,r){!0!==t.isScene&&(t=X);ne.resetTextureUnits();const a=t.fog,o=i.isMeshStandardMaterial?t.environment:null,s=null===k?y.outputColorSpace:!0===k.isXRRenderTarget?k.texture.colorSpace:Ct,l=(i.isMeshStandardMaterial?re:ie).get(i.envMap||o),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),d=!!n.morphAttributes.position,u=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let f=Z;i.toneMapped&&(null!==k&&!0!==k.isXRRenderTarget||(f=y.toneMapping));const m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==m?m.length:0,w=te.get(i),b=g.state.lights;if(!0===H&&(!0===V||e!==S)){const t=e===S&&i.id===E;ue.setState(i,e,t)}let x=!1;i.version===w.__version?w.needsLights&&w.lightsStateVersion!==b.state.version||w.outputColorSpace!==s||r.isBatchedMesh&&!1===w.batching?x=!0:r.isBatchedMesh||!0!==w.batching?r.isBatchedMesh&&!0===w.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===w.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===w.instancing?x=!0:r.isInstancedMesh||!0!==w.instancing?r.isSkinnedMesh&&!1===w.skinning?x=!0:r.isSkinnedMesh||!0!==w.skinning?r.isInstancedMesh&&!0===w.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===w.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===w.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===w.instancingMorph&&null!==r.morphTexture||w.envMap!==l||!0===i.fog&&w.fog!==a?x=!0:void 0===w.numClippingPlanes||w.numClippingPlanes===ue.numPlanes&&w.numIntersection===ue.numIntersection?(w.vertexAlphas!==c||w.vertexTangents!==h||w.morphTargets!==d||w.morphNormals!==u||w.morphColors!==p||w.toneMapping!==f||w.morphTargetsCount!==v)&&(x=!0):x=!0:x=!0:x=!0:x=!0:(x=!0,w.__version=i.version);let _=w.currentProgram;!0===x&&(_=Ze(i,t,r));let M=!1,T=!1,A=!1;const C=_.getUniforms(),P=w.uniforms;$.useProgram(_.program)&&(M=!0,T=!0,A=!0);i.id!==E&&(E=i.id,T=!0);if(M||S!==e){C.setValue(Se,"projectionMatrix",e.projectionMatrix),C.setValue(Se,"viewMatrix",e.matrixWorldInverse);const t=C.map.cameraPosition;void 0!==t&&t.setValue(Se,j.setFromMatrixPosition(e.matrixWorld)),Q.logarithmicDepthBuffer&&C.setValue(Se,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&C.setValue(Se,"isOrthographic",!0===e.isOrthographicCamera),S!==e&&(S=e,T=!0,A=!0)}if(r.isSkinnedMesh){C.setOptional(Se,r,"bindMatrix"),C.setOptional(Se,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),C.setValue(Se,"boneTexture",e.boneTexture,ne))}r.isBatchedMesh&&(C.setOptional(Se,r,"batchingTexture"),C.setValue(Se,"batchingTexture",r._matricesTexture,ne),C.setOptional(Se,r,"batchingIdTexture"),C.setValue(Se,"batchingIdTexture",r._indirectTexture,ne),C.setOptional(Se,r,"batchingColorTexture"),null!==r._colorsTexture&&C.setValue(Se,"batchingColorTexture",r._colorsTexture,ne));const R=n.morphAttributes;void 0===R.position&&void 0===R.normal&&void 0===R.color||me.update(r,n,_);(T||w.receiveShadow!==r.receiveShadow)&&(w.receiveShadow=r.receiveShadow,C.setValue(Se,"receiveShadow",r.receiveShadow));i.isMeshGouraudMaterial&&null!==i.envMap&&(P.envMap.value=l,P.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(P.envMapIntensity.value=t.environmentIntensity);T&&(C.setValue(Se,"toneMappingExposure",y.toneMappingExposure),w.needsLights&&(I=A,(L=P).ambientLightColor.needsUpdate=I,L.lightProbe.needsUpdate=I,L.directionalLights.needsUpdate=I,L.directionalLightShadows.needsUpdate=I,L.pointLights.needsUpdate=I,L.pointLightShadows.needsUpdate=I,L.spotLights.needsUpdate=I,L.spotLightShadows.needsUpdate=I,L.rectAreaLights.needsUpdate=I,L.hemisphereLights.needsUpdate=I),a&&!0===i.fog&&ce.refreshFogUniforms(P,a),ce.refreshMaterialUniforms(P,i,D,N,g.state.transmissionRenderTarget[e.id]),$o.upload(Se,Je(w),P,ne));var L,I;i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&($o.upload(Se,Je(w),P,ne),i.uniformsNeedUpdate=!1);i.isSpriteMaterial&&C.setValue(Se,"center",r.center);if(C.setValue(Se,"modelViewMatrix",r.modelViewMatrix),C.setValue(Se,"normalMatrix",r.normalMatrix),C.setValue(Se,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];ke.update(n,_),ke.bind(n,_)}}return _}(e,t,n,i,r);$.setMaterial(i,o);let l=n.index,c=1;if(!0===i.wireframe){if(l=oe.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,d=n.attributes.position;let u=h.start*c,p=(h.start+h.count)*c;null!==a&&(u=Math.max(u,a.start*c),p=Math.min(p,(a.start+a.count)*c)),null!==l?(u=Math.max(u,0),p=Math.min(p,l.count)):null!=d&&(u=Math.max(u,0),p=Math.min(p,d.count));const f=p-u;if(f<0||f===1/0)return;let m;xe.setup(r,i,s,n,l);let v=ge;if(null!==l&&(m=ae.get(l),v=ve,v.setIndex(m)),r.isMesh)!0===i.wireframe?($.setLineWidth(i.wireframeLinewidth*K()),v.setMode(Se.LINES)):v.setMode(Se.TRIANGLES);else if(r.isLine){let e=i.linewidth;void 0===e&&(e=1),$.setLineWidth(e*K()),r.isLineSegments?v.setMode(Se.LINES):r.isLineLoop?v.setMode(Se.LINE_LOOP):v.setMode(Se.LINE_STRIP)}else r.isPoints?v.setMode(Se.POINTS):r.isSprite&&v.setMode(Se.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)v.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(J.get("WEBGL_multi_draw"))v.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const e=r._multiDrawStarts,t=r._multiDrawCounts,n=r._multiDrawCount,a=l?ae.get(l).bytesPerElement:1,o=te.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)o.setValue(Se,"_gl_DrawID",i),v.render(e[i]/a,t[i])}else if(r.isInstancedMesh)v.renderInstances(u,f,r.count);else if(n.isInstancedBufferGeometry){const e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);v.renderInstances(u,f,t)}else v.render(u,f)},this.compile=function(e,t,n=null){null===n&&(n=e),g=de.get(n),g.init(t),w.push(g),n.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(g.pushLight(e),e.castShadow&&g.pushShadow(e))})),e!==n&&e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(g.pushLight(e),e.castShadow&&g.pushShadow(e))})),g.setupLights();const i=new Set;return e.traverse((function(e){const t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){const a=t[r];Be(a,n,e),i.add(a)}else Be(t,n,e),i.add(t)})),w.pop(),g=null,i},this.compileAsync=function(e,t,n=null){const i=this.compile(e,t,n);return new Promise((t=>{function n(){i.forEach((function(e){te.get(e).currentProgram.isReady()&&i.delete(e)})),0!==i.size?setTimeout(n,10):t(e)}null!==J.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let Oe=null;function Fe(){Ge.stop()}function Ve(){Ge.start()}const Ge=new sa;function je(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||W.intersectsSprite(e)){i&&q.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=se.update(e),r=e.material;r.visible&&f.push(e,t,r,n,q.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||W.intersectsObject(e))){const t=se.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),q.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),q.copy(t.boundingSphere.center)),q.applyMatrix4(e.matrixWorld).applyMatrix4(G)),Array.isArray(r)){const i=t.groups;for(let a=0,o=i.length;a<o;a++){const o=i[a],s=r[o.materialIndex];s&&s.visible&&f.push(e,t,s,n,q.z,o)}}else r.visible&&f.push(e,t,r,n,q.z,null)}const r=e.children;for(let e=0,a=r.length;e<a;e++)je(r[e],t,n,i)}function qe(e,t,n,i){const r=e.opaque,a=e.transmissive,o=e.transparent;g.setupLightsView(n),!0===H&&ue.setGlobalState(y.clippingPlanes,n),i&&$.viewport(A.copy(i)),r.length>0&&Ye(r,t,n),a.length>0&&Ye(a,t,n),o.length>0&&Ye(o,t,n),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function Xe(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===g.state.transmissionRenderTarget[i.id]&&(g.state.transmissionRenderTarget[i.id]=new Ln(1,1,{generateMipmaps:!0,type:J.has("EXT_color_buffer_half_float")||J.has("EXT_color_buffer_float")?Me:ye,minFilter:we,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:bn.workingColorSpace}));const a=g.state.transmissionRenderTarget[i.id],o=i.viewport||A;a.setSize(o.z,o.w);const s=y.getRenderTarget();y.setRenderTarget(a),y.getClearColor(R),L=y.getClearAlpha(),L<1&&y.setClearColor(16777215,.5),Y?fe.render(n):y.clear();const l=y.toneMapping;y.toneMapping=Z;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),g.setupLightsView(i),!0===H&&ue.setGlobalState(y.clippingPlanes,i),Ye(e,n,i),ne.updateMultisampleRenderTarget(a),ne.updateRenderTargetMipmap(a),!1===J.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,a=t.length;r<a;r++){const a=t[r],o=a.object,s=a.geometry,l=a.material,c=a.group;if(2===l.side&&o.layers.test(i.layers)){const t=l.side;l.side=T,l.needsUpdate=!0,Ke(o,n,i,s,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(ne.updateMultisampleRenderTarget(a),ne.updateRenderTargetMipmap(a))}y.setRenderTarget(s),y.setClearColor(R,L),void 0!==c&&(i.viewport=c),y.toneMapping=l}function Ye(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r<a;r++){const a=e[r],o=a.object,s=a.geometry,l=null===i?a.material:i,c=a.group;o.layers.test(n.layers)&&Ke(o,t,n,s,l,c)}}function Ke(e,t,n,i,r,a){e.onBeforeRender(y,t,n,i,r,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=T,r.needsUpdate=!0,y.renderBufferDirect(n,t,i,r,e,a),r.side=M,r.needsUpdate=!0,y.renderBufferDirect(n,t,i,r,e,a),r.side=2):y.renderBufferDirect(n,t,i,r,e,a),e.onAfterRender(y,t,n,i,r,a)}function Ze(e,t,n){!0!==t.isScene&&(t=X);const i=te.get(e),r=g.state.lights,a=g.state.shadowsArray,o=r.state.version,s=le.getParameters(e,r.state,a,t,n),l=le.getProgramCacheKey(s);let c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?re:ie).get(e.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===c&&(e.addEventListener("dispose",Ue),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===o)return Qe(e,s),h}else s.uniforms=le.getUniforms(e),e.onBeforeCompile(s,y),h=le.acquireProgram(s,l),c.set(l,h),i.uniforms=s.uniforms;const d=i.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(d.clippingPlanes=ue.uniform),Qe(e,s),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(d.ambientLightColor.value=r.state.ambient,d.lightProbe.value=r.state.probe,d.directionalLights.value=r.state.directional,d.directionalLightShadows.value=r.state.directionalShadow,d.spotLights.value=r.state.spot,d.spotLightShadows.value=r.state.spotShadow,d.rectAreaLights.value=r.state.rectArea,d.ltc_1.value=r.state.rectAreaLTC1,d.ltc_2.value=r.state.rectAreaLTC2,d.pointLights.value=r.state.point,d.pointLightShadows.value=r.state.pointShadow,d.hemisphereLights.value=r.state.hemi,d.directionalShadowMap.value=r.state.directionalShadowMap,d.directionalShadowMatrix.value=r.state.directionalShadowMatrix,d.spotShadowMap.value=r.state.spotShadowMap,d.spotLightMatrix.value=r.state.spotLightMatrix,d.spotLightMap.value=r.state.spotLightMap,d.pointShadowMap.value=r.state.pointShadowMap,d.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function Je(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=$o.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function Qe(e,t){const n=te.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}Ge.setAnimationLoop((function(e){Oe&&Oe(e)})),"undefined"!=typeof self&&Ge.setContext(self),this.setAnimationLoop=function(e){Oe=e,Le.setAnimationLoop(e),null===e?Ge.stop():Ge.start()},Le.addEventListener("sessionstart",Fe),Le.addEventListener("sessionend",Ve),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===b)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Le.enabled&&!0===Le.isPresenting&&(!0===Le.cameraAutoUpdate&&Le.updateCamera(t),t=Le.getCamera()),!0===e.isScene&&e.onBeforeRender(y,e,t,k),g=de.get(e,w.length),g.init(t),w.push(g),G.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),W.setFromProjectionMatrix(G),V=this.localClippingEnabled,H=ue.init(this.clippingPlanes,V),f=he.get(e,v.length),f.init(),v.push(f),!0===Le.enabled&&!0===Le.isPresenting){const e=y.xr.getDepthSensingMesh();null!==e&&je(e,t,-1/0,y.sortObjects)}je(e,t,0,y.sortObjects),f.finish(),!0===y.sortObjects&&f.sort(U,B),Y=!1===Le.enabled||!1===Le.isPresenting||!1===Le.hasDepthSensing(),Y&&fe.addToRenderList(f,e),this.info.render.frame++,!0===H&&ue.beginShadows();const n=g.state.shadowsArray;pe.render(n,e,t),!0===H&&ue.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=f.opaque,r=f.transmissive;if(g.setupLights(),t.isArrayCamera){const n=t.cameras;if(r.length>0)for(let t=0,a=n.length;t<a;t++){Xe(i,r,e,n[t])}Y&&fe.render(e);for(let t=0,i=n.length;t<i;t++){const i=n[t];qe(f,e,i,i.viewport)}}else r.length>0&&Xe(i,r,e,t),Y&&fe.render(e),qe(f,e,t);null!==k&&(ne.updateMultisampleRenderTarget(k),ne.updateRenderTargetMipmap(k)),!0===e.isScene&&e.onAfterRender(y,e,t),xe.resetDefaultState(),E=-1,S=null,w.pop(),w.length>0?(g=w[w.length-1],!0===H&&ue.setGlobalState(y.clippingPlanes,g.state.camera)):g=null,v.pop(),f=v.length>0?v[v.length-1]:null},this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return k},this.setRenderTargetTextures=function(e,t,n){te.get(e.texture).__webglTexture=t,te.get(e.depthTexture).__webglTexture=n;const i=te.get(e);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===J.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){const n=te.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){k=e,x=t,_=n;let i=!0,r=null,a=!1,o=!1;if(e){const s=te.get(e);void 0!==s.__useDefaultFramebuffer?($.bindFramebuffer(Se.FRAMEBUFFER,null),i=!1):void 0===s.__webglFramebuffer?ne.setupRenderTarget(e):s.__hasExternalTextures&&ne.rebindTextures(e,te.get(e.texture).__webglTexture,te.get(e.depthTexture).__webglTexture);const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=te.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],a=!0):r=e.samples>0&&!1===ne.useMultisampledRTT(e)?te.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,A.copy(e.viewport),C.copy(e.scissor),P=e.scissorTest}else A.copy(O).multiplyScalar(D).floor(),C.copy(z).multiplyScalar(D).floor(),P=F;if($.bindFramebuffer(Se.FRAMEBUFFER,r)&&i&&$.drawBuffers(e,r),$.viewport(A),$.scissor(C),$.setScissorTest(P),a){const i=te.get(e.texture);Se.framebufferTexture2D(Se.FRAMEBUFFER,Se.COLOR_ATTACHMENT0,Se.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(o){const i=te.get(e.texture),r=t||0;Se.framebufferTextureLayer(Se.FRAMEBUFFER,Se.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}E=-1},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=te.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){$.bindFramebuffer(Se.FRAMEBUFFER,s);try{const o=e.texture,s=o.format,l=o.type;if(!Q.textureFormatReadable(s))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!Q.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&Se.readPixels(t,n,i,r,be.convert(s),be.convert(l),a)}finally{const e=null!==k?te.get(k).__webglFramebuffer:null;$.bindFramebuffer(Se.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,a,o){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=te.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){$.bindFramebuffer(Se.FRAMEBUFFER,s);try{const o=e.texture,s=o.format,l=o.type;if(!Q.textureFormatReadable(s))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Q.textureTypeReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){const e=Se.createBuffer();Se.bindBuffer(Se.PIXEL_PACK_BUFFER,e),Se.bufferData(Se.PIXEL_PACK_BUFFER,a.byteLength,Se.STREAM_READ),Se.readPixels(t,n,i,r,be.convert(s),be.convert(l),0),Se.flush();const o=Se.fenceSync(Se.SYNC_GPU_COMMANDS_COMPLETE,0);await function(e,t,n){return new Promise((function(i,r){setTimeout((function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:r();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:i()}}),n)}))}(Se,o,4);try{Se.bindBuffer(Se.PIXEL_PACK_BUFFER,e),Se.getBufferSubData(Se.PIXEL_PACK_BUFFER,0,a)}finally{Se.deleteBuffer(e),Se.deleteSync(o)}return a}}finally{const e=null!==k?te.get(k).__webglFramebuffer:null;$.bindFramebuffer(Se.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t=null,n=0){!0!==e.isTexture&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i),o=null!==t?t.x:0,s=null!==t?t.y:0;ne.setTexture2D(e,0),Se.copyTexSubImage2D(Se.TEXTURE_2D,n,0,0,o,s,r,a),$.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,i=null,r=0){let a,o,s,l,c,h;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,e=arguments[1],t=arguments[2],r=arguments[3]||0,n=null),null!==n?(a=n.max.x-n.min.x,o=n.max.y-n.min.y,s=n.min.x,l=n.min.y):(a=e.image.width,o=e.image.height,s=0,l=0),null!==i?(c=i.x,h=i.y):(c=0,h=0);const d=be.convert(t.format),u=be.convert(t.type);ne.setTexture2D(t,0),Se.pixelStorei(Se.UNPACK_FLIP_Y_WEBGL,t.flipY),Se.pixelStorei(Se.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Se.pixelStorei(Se.UNPACK_ALIGNMENT,t.unpackAlignment);const p=Se.getParameter(Se.UNPACK_ROW_LENGTH),f=Se.getParameter(Se.UNPACK_IMAGE_HEIGHT),m=Se.getParameter(Se.UNPACK_SKIP_PIXELS),g=Se.getParameter(Se.UNPACK_SKIP_ROWS),v=Se.getParameter(Se.UNPACK_SKIP_IMAGES),w=e.isCompressedTexture?e.mipmaps[r]:e.image;Se.pixelStorei(Se.UNPACK_ROW_LENGTH,w.width),Se.pixelStorei(Se.UNPACK_IMAGE_HEIGHT,w.height),Se.pixelStorei(Se.UNPACK_SKIP_PIXELS,s),Se.pixelStorei(Se.UNPACK_SKIP_ROWS,l),e.isDataTexture?Se.texSubImage2D(Se.TEXTURE_2D,r,c,h,a,o,d,u,w.data):e.isCompressedTexture?Se.compressedTexSubImage2D(Se.TEXTURE_2D,r,c,h,w.width,w.height,d,w.data):Se.texSubImage2D(Se.TEXTURE_2D,r,c,h,a,o,d,u,w),Se.pixelStorei(Se.UNPACK_ROW_LENGTH,p),Se.pixelStorei(Se.UNPACK_IMAGE_HEIGHT,f),Se.pixelStorei(Se.UNPACK_SKIP_PIXELS,m),Se.pixelStorei(Se.UNPACK_SKIP_ROWS,g),Se.pixelStorei(Se.UNPACK_SKIP_IMAGES,v),0===r&&t.generateMipmaps&&Se.generateMipmap(Se.TEXTURE_2D),$.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,i=null,r=0){let a,o,s,l,c,h,d,u,p;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,e=arguments[2],t=arguments[3],r=arguments[4]||0);const f=e.isCompressedTexture?e.mipmaps[r]:e.image;null!==n?(a=n.max.x-n.min.x,o=n.max.y-n.min.y,s=n.max.z-n.min.z,l=n.min.x,c=n.min.y,h=n.min.z):(a=f.width,o=f.height,s=f.depth,l=0,c=0,h=0),null!==i?(d=i.x,u=i.y,p=i.z):(d=0,u=0,p=0);const m=be.convert(t.format),g=be.convert(t.type);let v;if(t.isData3DTexture)ne.setTexture3D(t,0),v=Se.TEXTURE_3D;else{if(!t.isDataArrayTexture&&!t.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");ne.setTexture2DArray(t,0),v=Se.TEXTURE_2D_ARRAY}Se.pixelStorei(Se.UNPACK_FLIP_Y_WEBGL,t.flipY),Se.pixelStorei(Se.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Se.pixelStorei(Se.UNPACK_ALIGNMENT,t.unpackAlignment);const w=Se.getParameter(Se.UNPACK_ROW_LENGTH),y=Se.getParameter(Se.UNPACK_IMAGE_HEIGHT),b=Se.getParameter(Se.UNPACK_SKIP_PIXELS),x=Se.getParameter(Se.UNPACK_SKIP_ROWS),_=Se.getParameter(Se.UNPACK_SKIP_IMAGES);Se.pixelStorei(Se.UNPACK_ROW_LENGTH,f.width),Se.pixelStorei(Se.UNPACK_IMAGE_HEIGHT,f.height),Se.pixelStorei(Se.UNPACK_SKIP_PIXELS,l),Se.pixelStorei(Se.UNPACK_SKIP_ROWS,c),Se.pixelStorei(Se.UNPACK_SKIP_IMAGES,h),e.isDataTexture||e.isData3DTexture?Se.texSubImage3D(v,r,d,u,p,a,o,s,m,g,f.data):t.isCompressedArrayTexture?Se.compressedTexSubImage3D(v,r,d,u,p,a,o,s,m,f.data):Se.texSubImage3D(v,r,d,u,p,a,o,s,m,g,f),Se.pixelStorei(Se.UNPACK_ROW_LENGTH,w),Se.pixelStorei(Se.UNPACK_IMAGE_HEIGHT,y),Se.pixelStorei(Se.UNPACK_SKIP_PIXELS,b),Se.pixelStorei(Se.UNPACK_SKIP_ROWS,x),Se.pixelStorei(Se.UNPACK_SKIP_IMAGES,_),0===r&&t.generateMipmaps&&Se.generateMipmap(v),$.unbindTexture()},this.initRenderTarget=function(e){void 0===te.get(e).__webglFramebuffer&&ne.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?ne.setTextureCube(e,0):e.isData3DTexture?ne.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?ne.setTexture2DArray(e,0):ne.setTexture2D(e,0),$.unbindTexture()},this.resetState=function(){x=0,_=0,k=null,$.reset(),xe.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Xt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Pt?"display-p3":"srgb",t.unpackColorSpace=bn.workingColorSpace===Rt?"display-p3":"srgb"}}class Js{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new tr(e),this.density=t}clone(){return new Js(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Qs extends zi{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 _i,this.environmentIntensity=1,this.environmentRotation=new _i,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(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),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class $s{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=jt,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=en()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return mn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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 i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=en()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const 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 void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=en()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(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}}}const el=new Un;class tl{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}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++)el.fromBufferAttribute(this,t),el.applyMatrix4(e),this.setXYZ(t,el.x,el.y,el.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)el.fromBufferAttribute(this,t),el.applyNormalMatrix(e),this.setXYZ(t,el.x,el.y,el.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)el.fromBufferAttribute(this,t),el.transformDirection(e),this.setXYZ(t,el.x,el.y,el.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=an(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=on(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=on(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=on(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=on(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=on(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=an(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=an(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=an(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=an(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=on(t,this.array),n=on(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=on(t,this.array),n=on(n,this.array),i=on(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=on(t,this.array),n=on(n,this.array),i=on(i,this.array),r=on(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new lr(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new tl(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const 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 void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const nl=new Un,il=new Pn,rl=new Pn,al=new Un,ol=new ui,sl=new Un,ll=new ii,cl=new ui,hl=new di;class dl extends Br{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=re,this.bindMatrix=new ui,this.bindMatrixInverse=new ui,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,sl),this.boundingBox.expandByPoint(sl)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new ii),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,sl),this.boundingSphere.expandByPoint(sl)}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,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),ll.copy(this.boundingSphere),ll.applyMatrix4(i),!1!==e.ray.intersectsSphere(ll)&&(cl.copy(i).invert(),hl.copy(e.ray).applyMatrix4(cl),null!==this.boundingBox&&!1===hl.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,hl)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Pn,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===re?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;il.fromBufferAttribute(i.attributes.skinIndex,e),rl.fromBufferAttribute(i.attributes.skinWeight,e),nl.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const i=rl.getComponent(e);if(0!==i){const r=il.getComponent(e);ol.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),t.addScaledVector(al.copy(nl).applyMatrix4(ol),i)}}return t.applyMatrix4(this.bindMatrixInverse)}}class ul extends zi{constructor(){super(),this.isBone=!0,this.type="Bone"}}class pl extends Cn{constructor(e=null,t=1,n=1,i,r,a,o,s,l=1003,c=1003,h,d){super(null,a,o,s,l,c,i,r,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const fl=new ui,ml=new ui;class gl{constructor(e=[],t=[]){this.uuid=en(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.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 ui)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new ui;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++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const 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(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=e.length;i<r;i++){const r=e[i]?e[i].matrixWorld:ml;fl.multiplyMatrices(r,t[i]),fl.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new gl(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new pl(t,e,e,Ie,Se);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const i=e.bones[n];let r=t[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new ul),this.bones.push(r),this.boneInverses.push((new ui).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const r=t[i];e.bones.push(r.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class vl extends lr{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const wl=new ui,yl=new ui,bl=[],xl=new zn,_l=new ui,kl=new Br,El=new ii;class Sl extends Br{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new vl(new Float32Array(16*n),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,_l)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new zn),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,wl),xl.copy(e.boundingBox).applyMatrix4(wl),this.boundingBox.union(xl)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new ii),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,wl),El.copy(e.boundingSphere).applyMatrix4(wl),this.boundingSphere.union(El)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=i[r+e]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(kl.geometry=this.geometry,kl.material=this.material,void 0!==kl.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),El.copy(this.boundingSphere),El.applyMatrix4(n),!1!==e.ray.intersectsSphere(El)))for(let r=0;r<i;r++){this.getMatrixAt(r,wl),yl.multiplyMatrices(n,wl),kl.matrixWorld=yl,kl.raycast(e,bl);for(let e=0,n=bl.length;e<n;e++){const n=bl[e];n.instanceId=r,n.object=this,t.push(n)}bl.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new vl(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new pl(new Float32Array(i*this.count),i,this.count,Oe,Se));const r=this.morphTexture.source.data.data;let a=0;for(let e=0;e<n.length;e++)a+=n[e];const o=this.geometry.morphTargetsRelative?1:1-a,s=i*e;r[s]=o,r.set(n,s+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}class Ml extends rr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new tr(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}}const Tl=new Un,Al=new Un,Cl=new ui,Pl=new di,Rl=new ii,Ll=new Un,Il=new Un;class Nl extends zi{constructor(e=new yr,t=new Ml){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,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(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;e<i;e++)Tl.fromBufferAttribute(t,e-1),Al.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=Tl.distanceTo(Al);e.setAttribute("lineDistance",new dr(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Rl.copy(n.boundingSphere),Rl.applyMatrix4(i),Rl.radius+=r,!1===e.ray.intersectsSphere(Rl))return;Cl.copy(i).invert(),Pl.copy(e.ray).applyMatrix4(Cl);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){const n=c.getX(r),i=c.getX(r+1),a=Dl(this,e,Pl,s,n,i);a&&t.push(a)}if(this.isLineLoop){const r=c.getX(i-1),a=c.getX(n),o=Dl(this,e,Pl,s,r,a);o&&t.push(o)}}else{const n=Math.max(0,a.start),i=Math.min(h.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){const n=Dl(this,e,Pl,s,r,r+1);n&&t.push(n)}if(this.isLineLoop){const r=Dl(this,e,Pl,s,i-1,n);r&&t.push(r)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function Dl(e,t,n,i,r,a){const o=e.geometry.attributes.position;Tl.fromBufferAttribute(o,r),Al.fromBufferAttribute(o,a);if(n.distanceSqToSegment(Tl,Al,Ll,Il)>i)return;Ll.applyMatrix4(e.matrixWorld);const s=t.ray.origin.distanceTo(Ll);return s<t.near||s>t.far?void 0:{distance:s,point:Il.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,object:e}}const Ul=new Un,Bl=new Un;class Ol extends Nl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e<i;e+=2)Ul.fromBufferAttribute(t,e),Bl.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Ul.distanceTo(Bl);e.setAttribute("lineDistance",new dr(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class zl extends Nl{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Fl extends rr{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new tr(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}}const Wl=new ui,Hl=new di,Vl=new ii,Gl=new Un;class jl extends zi{constructor(e=new yr,t=new Fl){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,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){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Vl.copy(n.boundingSphere),Vl.applyMatrix4(i),Vl.radius+=r,!1===e.ray.intersectsSphere(Vl))return;Wl.copy(i).invert(),Hl.copy(e.ray).applyMatrix4(Wl);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=n.index,c=n.attributes.position;if(null!==l){for(let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);n<r;n++){const r=l.getX(n);Gl.fromBufferAttribute(c,r),ql(Gl,r,s,i,e,t,this)}}else{for(let n=Math.max(0,a.start),r=Math.min(c.count,a.start+a.count);n<r;n++)Gl.fromBufferAttribute(c,n),ql(Gl,n,s,i,e,t,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function ql(e,t,n,i,r,a,o){const s=Hl.distanceSqToPoint(e);if(s<n){const n=new Un;Hl.closestPointToPoint(e,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,object:o})}}class Xl{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const 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;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let a;a=t||e*n[r-1];let o,s=0,l=r-1;for(;s<=l;)if(i=Math.floor(s+(l-s)/2),o=n[i]-a,o<0)s=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===a)return i/(r-1);const c=n[i];return(i+(a-c)/(n[i+1]-c))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const a=this.getPoint(i),o=this.getPoint(r),s=t||(a.isVector2?new ln:new Un);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new Un,i=[],r=[],a=[],o=new Un,s=new ui;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new Un)}r[0]=new Un,a[0]=new Un;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(i[t-1],i[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(tn(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(tn(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(s.makeRotationAxis(i[n],t*n)),a[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Yl extends Xl{constructor(e=0,t=0,n=1,i=1,r=0,a=2*Math.PI,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t=new ln){const n=t,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);const o=this.aStartAngle+e*r;let s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,i=l-this.aY;s=n*e-i*t+this.aX,l=n*t+i*e+this.aY}return n.set(s,l)}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(){const 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}}function Kl(){let e=0,t=0,n=0,i=0;function r(r,a,o,s){e=r,t=o,n=-3*r+3*a-2*o-s,i=2*r-2*a+o+s}return{initCatmullRom:function(e,t,n,i,a){r(t,n,a*(n-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,a,o,s){let l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,c=(n-t)/o-(i-t)/(o+s)+(i-n)/s;l*=o,c*=o,r(t,n,l,c)},calc:function(r){const a=r*r;return e+t*r+n*a+i*(a*r)}}}const Zl=new Un,Jl=new Kl,Ql=new Kl,$l=new Kl;function ec(e,t,n,i,r){const a=.5*(i-t),o=.5*(r-n),s=e*e;return(2*n-2*i+a+o)*(e*s)+(-3*n+3*i-2*a-o)*s+a*e+n}function tc(e,t,n,i){return function(e,t){const n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function nc(e,t,n,i,r){return function(e,t){const n=1-e;return n*n*n*t}(e,t)+function(e,t){const n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}class ic extends Xl{constructor(e=new ln,t=new ln,n=new ln,i=new ln){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ln){const n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(nc(e,i.x,r.x,a.x,o.x),nc(e,i.y,r.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(){const 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}}class rc extends Xl{constructor(e=new ln,t=new ln){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ln){const n=t;return 1===e?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 ln){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(){const 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}}class ac extends Xl{constructor(e=new ln,t=new ln,n=new ln){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ln){const n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(tc(e,i.x,r.x,a.x),tc(e,i.y,r.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(){const 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}}class oc extends Xl{constructor(e=new Un,t=new Un,n=new Un){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Un){const n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(tc(e,i.x,r.x,a.x),tc(e,i.y,r.y,a.y),tc(e,i.z,r.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(){const 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}}class sc extends Xl{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ln){const n=t,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],l=i[a],c=i[a>i.length-2?i.length-1:a+1],h=i[a>i.length-3?i.length-1:a+2];return n.set(ec(o,s.x,l.x,c.x,h.x),ec(o,s.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const 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++){const n=e.points[t];this.points.push((new ln).fromArray(n))}return this}}var lc=Object.freeze({__proto__:null,ArcCurve:class extends Yl{constructor(e,t,n,i,r,a){super(e,t,n,n,i,r,a),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends Xl{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new Un){const n=t,i=this.points,r=i.length,a=(r-(this.closed?0:1))*e;let o,s,l=Math.floor(a),c=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(Zl.subVectors(i[0],i[1]).add(i[0]),o=Zl);const h=i[l%r],d=i[(l+1)%r];if(this.closed||l+2<r?s=i[(l+2)%r]:(Zl.subVectors(i[r-1],i[r-2]).add(i[r-1]),s=Zl),"centripetal"===this.curveType||"chordal"===this.curveType){const e="chordal"===this.curveType?.5:.25;let t=Math.pow(o.distanceToSquared(h),e),n=Math.pow(h.distanceToSquared(d),e),i=Math.pow(d.distanceToSquared(s),e);n<1e-4&&(n=1),t<1e-4&&(t=n),i<1e-4&&(i=n),Jl.initNonuniformCatmullRom(o.x,h.x,d.x,s.x,t,n,i),Ql.initNonuniformCatmullRom(o.y,h.y,d.y,s.y,t,n,i),$l.initNonuniformCatmullRom(o.z,h.z,d.z,s.z,t,n,i)}else"catmullrom"===this.curveType&&(Jl.initCatmullRom(o.x,h.x,d.x,s.x,this.tension),Ql.initCatmullRom(o.y,h.y,d.y,s.y,this.tension),$l.initCatmullRom(o.z,h.z,d.z,s.z,this.tension));return n.set(Jl.calc(c),Ql.calc(c),$l.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const 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++){const n=e.points[t];this.points.push((new Un).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},CubicBezierCurve:ic,CubicBezierCurve3:class extends Xl{constructor(e=new Un,t=new Un,n=new Un,i=new Un){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Un){const n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(nc(e,i.x,r.x,a.x,o.x),nc(e,i.y,r.y,a.y,o.y),nc(e,i.z,r.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(){const 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}},EllipseCurve:Yl,LineCurve:rc,LineCurve3:class extends Xl{constructor(e=new Un,t=new Un){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new Un){const n=t;return 1===e?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 Un){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(){const 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}},QuadraticBezierCurve:ac,QuadraticBezierCurve3:oc,SplineCurve:sc});class cc extends Xl{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new lc[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const e=i[r]-n,a=this.curves[r],o=a.getLength(),s=0===o?0:1-e/o;return a.getPointAt(s,t)}r++}return null}getLength(){const 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;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const 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){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const a=r[i],o=a.isEllipseCurve?2*e:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o);for(let e=0;e<s.length;e++){const i=s[e];n&&n.equals(i)||(t.push(i),n=i)}}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++){const n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const 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++){const n=e.curves[t];this.curves.push((new lc[n.type]).fromJSON(n))}return this}}class hc extends cc{constructor(e){super(),this.type="Path",this.currentPoint=new ln,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){const n=new rc(this.currentPoint.clone(),new ln(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new ac(this.currentPoint.clone(),new ln(e,t),new ln(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,a){const o=new ic(this.currentPoint.clone(),new ln(e,t),new ln(n,i),new ln(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new sc(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,a){const o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,i,r,a),this}absarc(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this}ellipse(e,t,n,i,r,a,o,s){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,i,r,a,o,s),this}absellipse(e,t,n,i,r,a,o,s){const l=new Yl(e,t,n,i,r,a,o,s);if(this.curves.length>0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class dc extends yr{constructor(e=1,t=32,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],a=[],o=[],s=[],l=new Un,c=new ln;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let r=0,h=3;r<=t;r++,h+=3){const d=n+r/t*i;l.x=e*Math.cos(d),l.y=e*Math.sin(d),a.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(a[h]/e+1)/2,c.y=(a[h+1]/e+1)/2,s.push(c.x,c.y)}for(let e=1;e<=t;e++)r.push(e,e+1,0);this.setIndex(r),this.setAttribute("position",new dr(a,3)),this.setAttribute("normal",new dr(o,3)),this.setAttribute("uv",new dr(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new dc(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class uc extends hc{constructor(e){super(e),this.uuid=en(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;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++){const n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const 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++){const n=e.holes[t];this.holes.push((new hc).fromJSON(n))}return this}}const pc=function(e,t,n=2){const i=t&&t.length,r=i?t[0]*n:e.length;let a=fc(e,0,r,n,!0);const o=[];if(!a||a.next===a.prev)return o;let s,l,c,h,d,u,p;if(i&&(a=function(e,t,n,i){const r=[];let a,o,s,l,c;for(a=0,o=t.length;a<o;a++)s=t[a]*i,l=a<o-1?t[a+1]*i:e.length,c=fc(e,s,l,i,!1),c===c.next&&(c.steiner=!0),r.push(Sc(c));for(r.sort(xc),a=0;a<r.length;a++)n=_c(r[a],n);return n}(e,t,a,n)),e.length>80*n){s=c=e[0],l=h=e[1];for(let t=n;t<r;t+=n)d=e[t],u=e[t+1],d<s&&(s=d),u<l&&(l=u),d>c&&(c=d),u>h&&(h=u);p=Math.max(c-s,h-l),p=0!==p?32767/p:0}return gc(a,o,n,s,l,p,0),o};function fc(e,t,n,i,r){let a,o;if(r===function(e,t,n,i){let r=0;for(let a=t,o=n-i;a<n;a+=i)r+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return r}(e,t,n,i)>0)for(a=t;a<n;a+=i)o=Dc(a,e[a],e[a+1],o);else for(a=n-i;a>=t;a-=i)o=Dc(a,e[a],e[a+1],o);return o&&Cc(o,o.next)&&(Uc(o),o=o.next),o}function mc(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!Cc(i,i.next)&&0!==Ac(i.prev,i,i.next))i=i.next;else{if(Uc(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function gc(e,t,n,i,r,a,o){if(!e)return;!o&&a&&function(e,t,n,i){let r=e;do{0===r.z&&(r.z=Ec(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,a,o,s,l,c=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t<c&&(s++,i=i.nextZ,i);t++);for(l=c;s>0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,a);let s,l,c=e;for(;e.prev!==e.next;)if(s=e.prev,l=e.next,a?wc(e,i,r,a):vc(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),Uc(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?gc(e=yc(mc(e),t,n),t,n,i,r,a,2):2===o&&bc(e,t,n,i,r,a):gc(mc(e),t,n,i,r,a,1);break}}function vc(e){const t=e.prev,n=e,i=e.next;if(Ac(t,n,i)>=0)return!1;const r=t.x,a=n.x,o=i.x,s=t.y,l=n.y,c=i.y,h=r<a?r<o?r:o:a<o?a:o,d=s<l?s<c?s:c:l<c?l:c,u=r>a?r>o?r:o:a>o?a:o,p=s>l?s>c?s:c:l>c?l:c;let f=i.next;for(;f!==t;){if(f.x>=h&&f.x<=u&&f.y>=d&&f.y<=p&&Mc(r,s,a,l,o,c,f.x,f.y)&&Ac(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function wc(e,t,n,i){const r=e.prev,a=e,o=e.next;if(Ac(r,a,o)>=0)return!1;const s=r.x,l=a.x,c=o.x,h=r.y,d=a.y,u=o.y,p=s<l?s<c?s:c:l<c?l:c,f=h<d?h<u?h:u:d<u?d:u,m=s>l?s>c?s:c:l>c?l:c,g=h>d?h>u?h:u:d>u?d:u,v=Ec(p,f,t,n,i),w=Ec(m,g,t,n,i);let y=e.prevZ,b=e.nextZ;for(;y&&y.z>=v&&b&&b.z<=w;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==o&&Mc(s,h,l,d,c,u,y.x,y.y)&&Ac(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==r&&b!==o&&Mc(s,h,l,d,c,u,b.x,b.y)&&Ac(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;y&&y.z>=v;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==o&&Mc(s,h,l,d,c,u,y.x,y.y)&&Ac(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=w;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==r&&b!==o&&Mc(s,h,l,d,c,u,b.x,b.y)&&Ac(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function yc(e,t,n){let i=e;do{const r=i.prev,a=i.next.next;!Cc(r,a)&&Pc(r,i,i.next,a)&&Ic(r,a)&&Ic(a,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(a.i/n|0),Uc(i),Uc(i.next),i=e=a),i=i.next}while(i!==e);return mc(i)}function bc(e,t,n,i,r,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Tc(o,e)){let s=Nc(o,e);return o=mc(o,o.next),s=mc(s,s.next),gc(o,t,n,i,r,a,0),void gc(s,t,n,i,r,a,0)}e=e.next}o=o.next}while(o!==e)}function xc(e,t){return e.x-t.x}function _c(e,t){const n=function(e,t){let n,i=t,r=-1/0;const a=e.x,o=e.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){const e=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=a&&e>r&&(r=e,n=i.x<i.next.x?i:i.next,e===a))return n}i=i.next}while(i!==t);if(!n)return null;const s=n,l=n.x,c=n.y;let h,d=1/0;i=n;do{a>=i.x&&i.x>=l&&a!==i.x&&Mc(o<c?a:r,o,l,c,o<c?r:a,o,i.x,i.y)&&(h=Math.abs(o-i.y)/(a-i.x),Ic(i,e)&&(h<d||h===d&&(i.x>n.x||i.x===n.x&&kc(n,i)))&&(n=i,d=h)),i=i.next}while(i!==s);return n}(e,t);if(!n)return t;const i=Nc(n,e);return mc(i,i.next),mc(n,n.next)}function kc(e,t){return Ac(e.prev,e,t.prev)<0&&Ac(t.next,e,e.next)<0}function Ec(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Sc(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 Mc(e,t,n,i,r,a,o,s){return(r-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(i-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(r-o)*(i-s)}function Tc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(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&&Pc(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Ic(e,t)&&Ic(t,e)&&function(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(Ac(e.prev,e,t.prev)||Ac(e,t.prev,t))||Cc(e,t)&&Ac(e.prev,e,e.next)>0&&Ac(t.prev,t,t.next)>0)}function Ac(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Cc(e,t){return e.x===t.x&&e.y===t.y}function Pc(e,t,n,i){const r=Lc(Ac(e,t,n)),a=Lc(Ac(e,t,i)),o=Lc(Ac(n,i,e)),s=Lc(Ac(n,i,t));return r!==a&&o!==s||(!(0!==r||!Rc(e,n,t))||(!(0!==a||!Rc(e,i,t))||(!(0!==o||!Rc(n,e,i))||!(0!==s||!Rc(n,t,i)))))}function Rc(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 Lc(e){return e>0?1:e<0?-1:0}function Ic(e,t){return Ac(e.prev,e,e.next)<0?Ac(e,t,e.next)>=0&&Ac(e,e.prev,t)>=0:Ac(e,t,e.prev)<0||Ac(e,e.next,t)<0}function Nc(e,t){const n=new Bc(e.i,e.x,e.y),i=new Bc(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function Dc(e,t,n,i){const r=new Bc(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Uc(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 Bc(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Oc{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n}static isClockWise(e){return Oc.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];zc(e),Fc(n,e);let a=e.length;t.forEach(zc);for(let e=0;e<t.length;e++)i.push(a),a+=t[e].length,Fc(n,t[e]);const o=pc(n,i);for(let e=0;e<o.length;e+=3)r.push(o.slice(e,e+3));return r}}function zc(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Fc(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class Wc extends yr{constructor(e=new uc([new ln(0,.5),new ln(-.5,-.5),new ln(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],a=[];let o=0,s=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(o,s,t),o+=s,s=0;function l(e){const o=i.length/3,l=e.extractPoints(t);let c=l.shape;const h=l.holes;!1===Oc.isClockWise(c)&&(c=c.reverse());for(let e=0,t=h.length;e<t;e++){const t=h[e];!0===Oc.isClockWise(t)&&(h[e]=t.reverse())}const d=Oc.triangulateShape(c,h);for(let e=0,t=h.length;e<t;e++){const t=h[e];c=c.concat(t)}for(let e=0,t=c.length;e<t;e++){const t=c[e];i.push(t.x,t.y,0),r.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){const t=d[e],i=t[0]+o,r=t[1]+o,a=t[2]+o;n.push(i,r,a),s+=3}}this.setIndex(n),this.setAttribute("position",new dr(i,3)),this.setAttribute("normal",new dr(r,3)),this.setAttribute("uv",new dr(a,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,i=e.length;n<i;n++){const i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const r=t[e.shapes[i]];n.push(r)}return new Wc(n,e.curveSegments)}}class Hc extends yr{constructor(e=1,t=32,n=16,i=0,r=2*Math.PI,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const s=Math.min(a+o,Math.PI);let l=0;const c=[],h=new Un,d=new Un,u=[],p=[],f=[],m=[];for(let u=0;u<=n;u++){const g=[],v=u/n;let w=0;0===u&&0===a?w=.5/t:u===n&&s===Math.PI&&(w=-.5/t);for(let n=0;n<=t;n++){const s=n/t;h.x=-e*Math.cos(i+s*r)*Math.sin(a+v*o),h.y=e*Math.cos(a+v*o),h.z=e*Math.sin(i+s*r)*Math.sin(a+v*o),p.push(h.x,h.y,h.z),d.copy(h).normalize(),f.push(d.x,d.y,d.z),m.push(s+w,1-v),g.push(l++)}c.push(g)}for(let e=0;e<n;e++)for(let i=0;i<t;i++){const t=c[e][i+1],r=c[e][i],o=c[e+1][i],l=c[e+1][i+1];(0!==e||a>0)&&u.push(t,r,l),(e!==n-1||s<Math.PI)&&u.push(r,o,l)}this.setIndex(u),this.setAttribute("position",new dr(p,3)),this.setAttribute("normal",new dr(f,3)),this.setAttribute("uv",new dr(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Hc(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Vc extends rr{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new tr(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 tr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new ln(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 _i,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}}class Gc extends Vc{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 ln(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return tn(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 tr(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 tr(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new tr(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}}class jc extends rr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new tr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new _i,this.combine=X,this.reflectivity=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.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}}function qc(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function Xc(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Yc(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n}function Kc(e,t,n){const i=e.length,r=new e.constructor(i);for(let a=0,o=0;o!==i;++a){const i=n[a]*t;for(let n=0;n!==t;++n)r[o++]=e[i+n]}return r}function Zc(e,t,n,i){let r=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[r++];if(void 0===a)return;let o=a[i];if(void 0!==o)if(Array.isArray(o))do{o=a[i],void 0!==o&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{o=a[i],void 0!==o&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{o=a[i],void 0!==o&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}class Jc{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let a=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(e>=r)break e;{const o=t[1];e<o&&(n=2,r=o);for(let a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0}}for(;n<a;){const i=n+a>>>1;e<t[i]?a=i:n=i+1}if(i=t[n],r=t[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let e=0;e!==i;++e)t[e]=n[r+e];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Qc extends Jc{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Et,endingEnd:Et}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case St:r=e,o=2*t-n;break;case Mt:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case St:a=e,s=2*n-t;break;case Mt:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=r*c,this._offsetNext=a*c}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,u=this._weightNext,p=(n-t)/(i-t),f=p*p,m=f*p,g=-d*m+2*d*f-d*p,v=(1+d)*m+(-1.5-2*d)*f+(-.5+d)*p+1,w=(-1-u)*m+(1.5+u)*f+.5*p,y=u*m-u*f;for(let e=0;e!==o;++e)r[e]=g*a[c+e]+v*a[l+e]+w*a[s+e]+y*a[h+e];return r}}class $c extends Jc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(n-t)/(i-t),h=1-c;for(let e=0;e!==o;++e)r[e]=a[l+e]*h+a[s+e]*c;return r}}class eh extends Jc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class th{constructor(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=qc(t,this.TimeBufferType),this.values=qc(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:qc(e.times,Array),values:qc(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new eh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new $c(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Qc(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case xt:t=this.InterpolantFactoryMethodDiscrete;break;case _t:t=this.InterpolantFactoryMethodLinear;break;case kt:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return xt;case this.InterpolantFactoryMethodLinear:return _t;case this.InterpolantFactoryMethodSmooth:return kt}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const e=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&Xc(i))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===kt,r=e.length-1;let a=1;for(let o=1;o<r;++o){let r=!1;const s=e[o];if(s!==e[o+1]&&(1!==o||s!==e[0]))if(i)r=!0;else{const e=o*n,i=e-n,a=e+n;for(let o=0;o!==n;++o){const n=t[e+o];if(n!==t[i+o]||n!==t[a+o]){r=!0;break}}}if(r){if(o!==a){e[a]=e[o];const i=o*n,r=a*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++a}}if(r>0){e[a]=e[r];for(let e=r*n,i=a*n,o=0;o!==n;++o)t[i+o]=t[e+o];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}th.prototype.TimeBufferType=Float32Array,th.prototype.ValueBufferType=Float32Array,th.prototype.DefaultInterpolation=_t;class nh extends th{constructor(e,t,n){super(e,t,n)}}nh.prototype.ValueTypeName="bool",nh.prototype.ValueBufferType=Array,nh.prototype.DefaultInterpolation=xt,nh.prototype.InterpolantFactoryMethodLinear=void 0,nh.prototype.InterpolantFactoryMethodSmooth=void 0;class ih extends th{}ih.prototype.ValueTypeName="color";class rh extends th{}rh.prototype.ValueTypeName="number";class ah extends Jc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)Dn.slerpFlat(r,0,a,l-o,a,l,s);return r}}class oh extends th{InterpolantFactoryMethodLinear(e){return new ah(this.times,this.values,this.getValueSize(),e)}}oh.prototype.ValueTypeName="quaternion",oh.prototype.InterpolantFactoryMethodSmooth=void 0;class sh extends th{constructor(e,t,n){super(e,t,n)}}sh.prototype.ValueTypeName="string",sh.prototype.ValueBufferType=Array,sh.prototype.DefaultInterpolation=xt,sh.prototype.InterpolantFactoryMethodLinear=void 0,sh.prototype.InterpolantFactoryMethodSmooth=void 0;class lh extends th{}lh.prototype.ValueTypeName="vector";class ch{constructor(e="",t=-1,n=[],i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=en(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(hh(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(th.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let e=0;e<r;e++){let o=[],s=[];o.push((e+r-1)%r,e,(e+1)%r),s.push(0,1,0);const l=Yc(o);o=Kc(o,1,l),s=Kc(s,1,l),i||0!==o[0]||(o.push(r),s.push(s[0])),a.push(new rh(".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)){const 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){const i={},r=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],a=n.name.match(r);if(a&&a.length>1){const e=a[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const a=[];for(const e in i)a.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const a=[],o=[];Zc(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode;let s=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const r=l[e].keys;if(r&&0!==r.length)if(r[0].morphTargets){const e={};let t;for(t=0;t<r.length;t++)if(r[t].morphTargets)for(let n=0;n<r[t].morphTargets.length;n++)e[r[t].morphTargets[n]]=-1;for(const n in e){const e=[],a=[];for(let i=0;i!==r[t].morphTargets.length;++i){const i=r[t];e.push(i.time),a.push(i.morphTarget===n?1:0)}i.push(new rh(".morphTargetInfluence["+n+"]",e,a))}s=e.length*a}else{const a=".bones["+t[e].name+"]";n(lh,a+".position",r,"pos",i),n(oh,a+".quaternion",r,"rot",i),n(lh,a+".scale",r,"scl",i)}}if(0===i.length)return null;return new this(r,s,i,o)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,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=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function hh(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return rh;case"vector":case"vector2":case"vector3":case"vector4":return lh;case"color":return ih;case"quaternion":return oh;case"bool":case"boolean":return nh;case"string":return sh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];Zc(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const dh={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class uh{constructor(e,t,n){const i=this;let r,a=!1,o=0,s=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){s++,!1===a&&void 0!==i.onStart&&i.onStart(e,o,s),a=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,s),o===s&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}}const ph=new uh;class fh{constructor(e){this.manager=void 0!==e?e:ph,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise((function(i,r){n.load(e,i,t,r)}))}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}}fh.DEFAULT_MATERIAL_NAME="__DEFAULT";const mh={};class gh extends Error{constructor(e,t){super(e),this.response=t}}class vh extends fh{constructor(e){super(e)}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=dh.get(e);if(void 0!==r)return this.manager.itemStart(e),setTimeout((()=>{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==mh[e])return void mh[e].push({onLoad:t,onProgress:n,onError:i});mh[e]=[],mh[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,s=this.responseType;fetch(a).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=mh[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=r?parseInt(r):0,o=0!==a;let s=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{s+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(i)}e.enqueue(r),t()}}),(t=>{e.error(t)}))}()}});return new Response(l)}throw new gh(`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(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{dh.add(e,t);const n=mh[e];delete mh[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onLoad&&i.onLoad(t)}})).catch((t=>{const n=mh[e];if(void 0===n)throw this.manager.itemError(e),t;delete mh[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.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}}class wh extends fh{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=dh.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;const o=un("img");function s(){c(),dh.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}class yh extends fh{constructor(e){super(e)}load(e,t,n,i){const r=new Cn,a=new wh(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}class bh extends zi{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new tr(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(t.object.target=this.target.uuid),t}}class xh extends bh{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(zi.DEFAULT_UP),this.updateMatrix(),this.groundColor=new tr(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const _h=new ui,kh=new Un,Eh=new Un;class Sh{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ln(512,512),this.map=null,this.mapPass=null,this.matrix=new ui,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new oa,this._frameExtents=new ln(1,1),this._viewportCount=1,this._viewports=[new Pn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;kh.setFromMatrixPosition(e.matrixWorld),t.position.copy(kh),Eh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Eh),t.updateMatrixWorld(),_h.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_h),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(_h)}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.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Mh extends Sh{constructor(){super(new Kr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*$t*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Th extends bh{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(zi.DEFAULT_UP),this.updateMatrix(),this.target=new zi,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new Mh}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}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.shadow=e.shadow.clone(),this}}const Ah=new ui,Ch=new Un,Ph=new Un;class Rh extends Sh{constructor(){super(new Kr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ln(4,2),this._viewportCount=6,this._viewports=[new Pn(2,1,1,1),new Pn(0,1,1,1),new Pn(3,1,1,1),new Pn(1,1,1,1),new Pn(3,0,1,1),new Pn(1,0,1,1)],this._cubeDirections=[new Un(1,0,0),new Un(-1,0,0),new Un(0,0,1),new Un(0,0,-1),new Un(0,1,0),new Un(0,-1,0)],this._cubeUps=[new Un(0,1,0),new Un(0,1,0),new Un(0,1,0),new Un(0,1,0),new Un(0,0,1),new Un(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Ch.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ch),Ph.copy(n.position),Ph.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Ph),n.updateMatrixWorld(),i.makeTranslation(-Ch.x,-Ch.y,-Ch.z),Ah.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ah)}}class Lh extends bh{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Rh}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}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}}class Ih extends Sh{constructor(){super(new _a(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Nh extends bh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(zi.DEFAULT_UP),this.updateMatrix(),this.target=new zi,this.shadow=new Ih}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Dh{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===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)}}class Uh extends fh{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=dh.get(e);if(void 0!==a)return r.manager.itemStart(e),a.then?void a.then((n=>{t&&t(n),r.manager.itemEnd(e)})).catch((e=>{i&&i(e)})):(setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a);const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader;const s=fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){return dh.add(e,n),t&&t(n),r.manager.itemEnd(e),n})).catch((function(t){i&&i(t),dh.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)}));dh.add(e,s),r.manager.itemStart(e)}}const Bh="\\[\\]\\.:\\/",Oh=new RegExp("["+Bh+"]","g"),zh="[^"+Bh+"]",Fh="[^"+Bh.replace("\\.","")+"]",Wh=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",zh)+/(WCOD+)?/.source.replace("WCOD",Fh)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",zh)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",zh)+"$"),Hh=["material","materials","bones","map"];class Vh{constructor(e,t,n){this.path=t,this.parsedPath=n||Vh.parseTrackName(t),this.node=Vh.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Vh.Composite(e,t,n):new Vh(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Oh,"")}static parseTrackName(e){const t=Wh.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==Hh.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i<e.length;i++){const r=e[i];if(r.name===t||r.uuid===t)return r;const a=n(r.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_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){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=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 e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=Vh.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==i){if(void 0===e[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}const a=e[i];if(void 0===a){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",e)}let o=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let s=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}s=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(s=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(s=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[s],this.setValue=this.SetterByBindingTypeAndVersioning[s][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Vh.Composite=class{constructor(e,t,n){const i=n||Vh.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Vh.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Vh.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Vh.prototype.GetterByBindingType=[Vh.prototype._getValue_direct,Vh.prototype._getValue_array,Vh.prototype._getValue_arrayElement,Vh.prototype._getValue_toArray],Vh.prototype.SetterByBindingTypeAndVersioning=[[Vh.prototype._setValue_direct,Vh.prototype._setValue_direct_setNeedsUpdate,Vh.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Vh.prototype._setValue_array,Vh.prototype._setValue_array_setNeedsUpdate,Vh.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Vh.prototype._setValue_arrayElement,Vh.prototype._setValue_arrayElement_setNeedsUpdate,Vh.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Vh.prototype._setValue_fromArray,Vh.prototype._setValue_fromArray_setNeedsUpdate,Vh.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];new Float32Array(1);const Gh=new ui;class jh{constructor(e,t,n=0,i=1/0){this.ray=new di(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new ki,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.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Gh.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Gh),this}intersectObject(e,t=!0,n=[]){return Xh(e,this,n,t),n.sort(qh),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)Xh(e[i],this,n,t);return n.sort(qh),n}}function qh(e,t){return e.distance-t.distance}function Xh(e,t,n,i){let r=!0;if(e.layers.test(t.layers)){!1===e.raycast(t,n)&&(r=!1)}if(!0===r&&!0===i){const i=e.children;for(let e=0,r=i.length;e<r;e++)Xh(i[e],t,n,!0)}}class Yh{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}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(){const e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),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),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(tn(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Kh{constructor(){this.type="ShapePath",this.color=new tr,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new hc,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,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(e,t){const n=t.length;let i=!1;for(let r=n-1,a=0;a<n;r=a++){let n=t[r],o=t[a],s=o.x-n.x,l=o.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[a],s=-s,o=t[r],l=-l),e.y<n.y||e.y>o.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-s*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(o.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=o.x)return!0}}return i}const n=Oc.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,a,o;const s=[];if(1===i.length)return a=i[0],o=new uc,o.curves=a.curves,s.push(o),s;let l=!n(i[0].getPoints());l=e?!l:l;const c=[],h=[];let d,u,p=[],f=0;h[f]=void 0,p[f]=[];for(let t=0,o=i.length;t<o;t++)a=i[t],d=a.getPoints(),r=n(d),r=e?!r:r,r?(!l&&h[f]&&f++,h[f]={s:new uc,p:d},h[f].s.curves=a.curves,l&&f++,p[f]=[]):p[f].push({h:a,p:d[0]});if(!h[0])return function(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n],r=new uc;r.curves=i.curves,t.push(r)}return t}(i);if(h.length>1){let e=!1,n=0;for(let e=0,t=h.length;e<t;e++)c[e]=[];for(let i=0,r=h.length;i<r;i++){const r=p[i];for(let a=0;a<r.length;a++){const o=r[a];let s=!0;for(let r=0;r<h.length;r++)t(o.p,h[r].p)&&(i!==r&&n++,s?(s=!1,c[r].push(o)):e=!0);s&&c[i].push(o)}}n>0&&!1===e&&(p=c)}for(let e=0,t=h.length;e<t;e++){o=h[e].s,s.push(o),u=p[e];for(let e=0,t=u.length;e<t;e++)o.holes.push(u[e].h)}return s}}var Zh;"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:m}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=m),function(e){e[e.ImperialUnitsEnabled=0]="ImperialUnitsEnabled",e[e.ResetHintEnabled=1]="ResetHintEnabled",e[e.GhostCarEnabled=2]="GhostCarEnabled",e[e.CockpitCameraToggle=3]="CockpitCameraToggle",e[e.CheckpointsPosition=4]="CheckpointsPosition",e[e.TimerPosition=5]="TimerPosition",e[e.SpeedometerPosition=6]="SpeedometerPosition",e[e.Language=7]="Language",e[e.CarShadowQuality=8]="CarShadowQuality",e[e.TrackShadowEnabled=9]="TrackShadowEnabled",e[e.CloudsEnabled=10]="CloudsEnabled",e[e.ParticlesEnabled=11]="ParticlesEnabled",e[e.SkidmarksEnabled=12]="SkidmarksEnabled",e[e.RenderScale=13]="RenderScale",e[e.Antialiasing=14]="Antialiasing",e[e.SoundEffectVolume=15]="SoundEffectVolume",e[e.MusicVolume=16]="MusicVolume",e[e.CheckpointVolume=17]="CheckpointVolume"}(Zh||(Zh={}));const Jh=Zh;var Qh,$h,ed,td,nd,id,rd,ad,od,sd,ld=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},cd=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};$h=new WeakMap,ed=new WeakMap,td=new WeakMap,nd=new WeakMap,id=new WeakMap,rd=new WeakMap,Qh=new WeakSet,ad=function e(t,n){if(null==this.context)n(null);else if(0==t.length)n(null);else{const i=t[0],r=new XMLHttpRequest;r.open("GET",i,!0),r.responseType="arraybuffer",r.onload=()=>{this.context.decodeAudioData(r.response,(e=>{n(e)}),(()=>{cd(this,Qh,"m",e).call(this,t.slice(1),n)}))},r.send()}},od=function(e){var t;let n=Math.min(Math.max(e.getSettingFloat(Jh.SoundEffectVolume),0),1);Number.isNaN(n)&&(n=0),null==cd(this,id,"f")&&null!=this.context&&null!=this.destinationMaster?(ld(this,id,this.context.createGain(),"f"),cd(this,id,"f").gain.value=n,cd(this,id,"f").connect(this.destinationMaster)):null===(t=cd(this,id,"f"))||void 0===t||t.gain.setTargetAtTime(n,0,.1)},sd=function(e,t,n){if(t){if(null==cd(this,td,"f")){const e=this.getBuffer("music");if(null!=e&&null!=this.context&&null!=this.destinationMaster){const t=this.context.createBufferSource();t.buffer=e,t.loop=!0;const n=this.context.createGain();n.gain.value=0,t.connect(n),n.connect(this.destinationMaster),t.start(0),ld(this,td,{source:t,gain:n},"f")}}else{let e=Math.min(Math.max(n.getSettingFloat(Jh.MusicVolume),0),1);Number.isNaN(e)&&(e=0),cd(this,td,"f").gain.gain.setTargetAtTime(.25*e,0,.5)}ld(this,nd,0,"f")}else null!=cd(this,td,"f")&&(cd(this,td,"f").gain.gain.setTargetAtTime(0,0,.5),cd(this,nd,"f")>=5?(cd(this,td,"f").source.stop(),ld(this,td,null,"f")):ld(this,nd,cd(this,nd,"f")+e,"f"))};const hd=class{constructor(e){Qh.add(this),$h.set(this,void 0),this.context=null,ed.set(this,new Map),td.set(this,null),nd.set(this,0),id.set(this,null),rd.set(this,null),ld(this,$h,e,"f");try{const e=new(window.AudioContext||window.webkitAudioContext);if("running"!=e.state){const t=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","pointerup","touchend","keydown","keyup"],n=()=>{e.resume();for(let e=0;e<t.length;++e)window.removeEventListener(t[e],n)};for(let e=0;e<t.length;++e)window.addEventListener(t[e],n)}this.context=e}catch(e){this.context=null,console.error("Failed to create audio context: "+e)}null!=this.context?(ld(this,rd,this.context.createGain(),"f"),cd(this,rd,"f").gain.value=1,cd(this,rd,"f").connect(this.context.destination)):ld(this,rd,null,"f")}get destinationSfx(){return cd(this,id,"f")}get destinationMaster(){return cd(this,rd,"f")}mute(){null!=cd(this,rd,"f")&&cd(this,rd,"f").gain.setTargetAtTime(0,0,.25)}unmute(){null!=cd(this,rd,"f")&&cd(this,rd,"f").gain.setTargetAtTime(1,0,.25)}load(e,t){cd(this,$h,"f").addResource(),cd(this,Qh,"m",ad).call(this,t,(t=>{cd(this,$h,"f").loadedResource(),null==t?(console.warn('Audio "'+e+'" failed to load'),cd(this,ed,"f").set(e,null)):cd(this,ed,"f").set(e,t)}))}getBuffer(e){return null==this.context?null:cd(this,ed,"f").has(e)?cd(this,ed,"f").get(e):null}playUIClick(){const e=this.getBuffer("click");if(null!=e&&null!=this.context&&null!=this.destinationSfx){const t=this.context.createBufferSource();t.buffer=e;const n=this.context.createGain();n.gain.value=.0075,t.connect(n),n.connect(this.destinationSfx),t.start(0)}}refreshListener(e){if(null!=this.context){const t=new Un,n=new Dn,i=new Un;e.camera.matrix.decompose(t,n,i);const r=this.context.listener;r.positionX&&r.positionY&&r.positionZ?(r.positionX.value=t.x,r.positionY.value=t.y,r.positionZ.value=t.z):r.setPosition(t.x,t.y,t.z);const a=new Un(0,0,-1);a.applyQuaternion(n);const o=new Un(0,1,0);o.applyQuaternion(n),r.forwardX&&r.forwardY&&r.forwardZ&&r.upX&&r.upY&&r.upZ?(r.forwardX.value=a.x,r.forwardY.value=a.y,r.forwardZ.value=a.z,r.upX.value=o.x,r.upY.value=o.y,r.upZ.value=o.z):r.setOrientation(a.x,a.y,a.z,o.x,o.y,o.z)}}update(e,t,n,i){this.refreshListener(n),cd(this,Qh,"m",od).call(this,i),cd(this,Qh,"m",sd).call(this,e,t,i)}};function dd(e,t=!1){const n=null!==e[0].index,i=new Set(Object.keys(e[0].attributes)),r=new Set(Object.keys(e[0].morphAttributes)),a={},o={},s=e[0].morphTargetsRelative,l=new yr;let c=0;for(let h=0;h<e.length;++h){const d=e[h];let u=0;if(n!==(null!==d.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const e in d.attributes){if(!i.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+e+'" attribute exists among all geometries, or in none of them.'),null;void 0===a[e]&&(a[e]=[]),a[e].push(d.attributes[e]),u++}if(u!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(s!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const e in d.morphAttributes){if(!r.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;void 0===o[e]&&(o[e]=[]),o[e].push(d.morphAttributes[e])}if(t){let e;if(n)e=d.index.count;else{if(void 0===d.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;e=d.attributes.position.count}l.addGroup(c,e,h),c+=e}}if(n){let t=0;const n=[];for(let i=0;i<e.length;++i){const r=e[i].index;for(let e=0;e<r.count;++e)n.push(r.getX(e)+t);t+=e[i].attributes.position.count}l.setIndex(n)}for(const e in a){const t=ud(a[e]);if(!t)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" attribute."),null;l.setAttribute(e,t)}for(const e in o){const t=o[e][0].length;if(0===t)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let n=0;n<t;++n){const t=[];for(let i=0;i<o[e].length;++i)t.push(o[e][i][n]);const i=ud(t);if(!i)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" morphAttribute."),null;l.morphAttributes[e].push(i)}}return l}function ud(e){let t,n,i,r=-1,a=0;for(let o=0;o<e.length;++o){const s=e[o];if(void 0===t&&(t=s.array.constructor),t!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===n&&(n=s.itemSize),n!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===i&&(i=s.normalized),i!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===r&&(r=s.gpuType),r!==s.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;a+=s.count*n}const o=new t(a),s=new lr(o,n,i);let l=0;for(let t=0;t<e.length;++t){const i=e[t];if(i.isInterleavedBufferAttribute){const e=l/n;for(let t=0,r=i.count;t<r;t++)for(let r=0;r<n;r++){const n=i.getComponent(t,r);s.setComponent(t+e,r,n)}}else o.set(i.array,l);l+=i.count*n}return void 0!==r&&(s.gpuType=r),s}function pd(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}const i=n.count-2,r=[];if(2===t)for(let e=1;e<=i;e++)r.push(n.getX(0)),r.push(n.getX(e)),r.push(n.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(r.push(n.getX(e)),r.push(n.getX(e+1)),r.push(n.getX(e+2))):(r.push(n.getX(e+2)),r.push(n.getX(e+1)),r.push(n.getX(e)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const a=e.clone();return a.setIndex(r),a.clearGroups(),a}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}class fd extends fh{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new bd(e)})),this.register((function(e){return new xd(e)})),this.register((function(e){return new Pd(e)})),this.register((function(e){return new Rd(e)})),this.register((function(e){return new Ld(e)})),this.register((function(e){return new kd(e)})),this.register((function(e){return new Ed(e)})),this.register((function(e){return new Sd(e)})),this.register((function(e){return new Md(e)})),this.register((function(e){return new yd(e)})),this.register((function(e){return new Td(e)})),this.register((function(e){return new _d(e)})),this.register((function(e){return new Cd(e)})),this.register((function(e){return new Ad(e)})),this.register((function(e){return new vd(e)})),this.register((function(e){return new Id(e)})),this.register((function(e){return new Nd(e)}))}load(e,t,n,i){const r=this;let a;if(""!==this.resourcePath)a=this.resourcePath;else if(""!==this.path){const t=Dh.extractUrlBase(e);a=Dh.resolveURL(t,this.path)}else a=Dh.extractUrlBase(e);this.manager.itemStart(e);const o=function(t){i?i(t):console.error(t),r.manager.itemError(e),r.manager.itemEnd(e)},s=new vh(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{r.parse(n,a,(function(n){t(n),r.manager.itemEnd(e)}),o)}catch(e){o(e)}}),n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r;const a={},o={},s=new TextDecoder;if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer){if(s.decode(new Uint8Array(e,0,4))===Dd){try{a[gd.KHR_BINARY_GLTF]=new Od(e)}catch(e){return void(i&&i(e))}r=JSON.parse(a[gd.KHR_BINARY_GLTF].content)}else r=JSON.parse(s.decode(e))}else r=e;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new cu(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,a[t.name]=!0}if(r.extensionsUsed)for(let e=0;e<r.extensionsUsed.length;++e){const t=r.extensionsUsed[e],n=r.extensionsRequired||[];switch(t){case gd.KHR_MATERIALS_UNLIT:a[t]=new wd;break;case gd.KHR_DRACO_MESH_COMPRESSION:a[t]=new zd(r,this.dracoLoader);break;case gd.KHR_TEXTURE_TRANSFORM:a[t]=new Fd;break;case gd.KHR_MESH_QUANTIZATION:a[t]=new Wd;break;default:n.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise((function(i,r){n.parse(e,t,i,r)}))}}function md(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const gd={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class vd{constructor(e){this.parser=e,this.name=gd.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,a=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let o;const s=new tr(16777215);void 0!==a.color&&s.setRGB(a.color[0],a.color[1],a.color[2],Ct);const l=void 0!==a.range?a.range:0;switch(a.type){case"directional":o=new Nh(s),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new Lh(s),o.distance=l;break;case"spot":o=new Th(s),o.distance=l,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return o.position.set(0,0,0),o.decay=2,iu(o,a),void 0!==a.intensity&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||"light_"+e),i=Promise.resolve(o),t.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(e){return n._getNodeRef(t.cache,r,e)}))}}class wd{constructor(){this.name=gd.KHR_MATERIALS_UNLIT}getMaterialType(){return ar}extendParams(e,t,n){const i=[];e.color=new tr(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const t=r.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],Ct),e.opacity=t[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture,At))}return Promise.all(i)}}class yd{constructor(e){this.parser=e,this.name=gd.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class bd{constructor(e){this.parser=e,this.name=gd.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Gc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){const e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new ln(e,e)}return Promise.all(r)}}class xd{constructor(e){this.parser=e,this.name=gd.KHR_MATERIALS_DISPERSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Gc:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class _d{constructor(e){this.parser=e,this.name=gd.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Gc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&r.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&r.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}}class kd{constructor(e){this.parser=e,this.name=gd.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Gc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new tr(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=i.extensions[this.name];if(void 0!==a.sheenColorFactor){const e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],Ct)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,At)),void 0!==a.sheenRoughnessTexture&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class Ed{constructor(e){this.parser=e,this.name=gd.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Gc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}}class Sd{constructor(e){this.parser=e,this.name=gd.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Gc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=(new tr).setRGB(o[0],o[1],o[2],Ct),Promise.all(r)}}class Md{constructor(e){this.parser=e,this.name=gd.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Gc:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class Td{constructor(e){this.parser=e,this.name=gd.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Gc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&r.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=(new tr).setRGB(o[0],o[1],o[2],Ct),void 0!==a.specularColorTexture&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,At)),Promise.all(r)}}class Ad{constructor(e){this.parser=e,this.name=gd.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Gc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&r.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}}class Cd{constructor(e){this.parser=e,this.name=gd.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Gc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&r.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}}class Pd{constructor(e){this.parser=e,this.name=gd.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}}class Rd{constructor(e){this.parser=e,this.name=gd.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let s=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,a.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Ld{constructor(e){this.parser=e,this.name=gd.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let s=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,a.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Id{constructor(e){this.name=gd.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){const n=e.byteOffset||0,i=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then((function(e){return e.buffer})):r.ready.then((function(){const t=new ArrayBuffer(a*o);return r.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t}))}))}return null}}class Nd{constructor(e){this.name=gd.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const e of i.primitives)if(e.mode!==jd.TRIANGLES&&e.mode!==jd.TRIANGLE_STRIP&&e.mode!==jd.TRIANGLE_FAN&&void 0!==e.mode)return null;const r=n.extensions[this.name].attributes,a=[],o={};for(const e in r)a.push(this.parser.getDependency("accessor",r[e]).then((t=>(o[e]=t,o[e]))));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then((e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const e of n){const t=new ui,n=new Un,a=new Dn,s=new Un(1,1,1),l=new Sl(e.geometry,e.material,i);for(let e=0;e<i;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&s.fromBufferAttribute(o.SCALE,e),l.setMatrixAt(e,t.compose(n,a,s));for(const t in o)if("_COLOR_0"===t){const e=o[t];l.instanceColor=new vl(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,o[t]);zi.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),r.push(l)}return t.isGroup?(t.clear(),t.add(...r),t):r[0]})))}}const Dd="glTF",Ud=1313821514,Bd=5130562;class Od{constructor(e){this.name=gd.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Dd)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(e,12);let a=0;for(;a<i;){const t=r.getUint32(a,!0);a+=4;const i=r.getUint32(a,!0);if(a+=4,i===Ud){const i=new Uint8Array(e,12+a,t);this.content=n.decode(i)}else if(i===Bd){const n=12+a;this.body=e.slice(n,n+t)}a+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class zd{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=gd.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},l={};for(const e in a){const t=Zd[e]||e.toLowerCase();o[t]=a[e]}for(const t in e.attributes){const i=Zd[t]||t.toLowerCase();if(void 0!==a[t]){const r=n.accessors[e.attributes[t]],a=qd[r.componentType];l[i]=a.name,s[i]=!0===r.normalized}}return t.getDependency("bufferView",r).then((function(e){return new Promise((function(t,n){i.decodeDracoFile(e,(function(e){for(const t in e.attributes){const n=e.attributes[t],i=s[t];void 0!==i&&(n.normalized=i)}t(e)}),o,l,Ct,n)}))}))}}class Fd{constructor(){this.name=gd.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class Wd{constructor(){this.name=gd.KHR_MESH_QUANTIZATION}}class Hd extends Jc{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let e=0;e!==i;e++)t[e]=n[r+e];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,c=i-t,h=(n-t)/c,d=h*h,u=d*h,p=e*l,f=p-l,m=-2*u+3*d,g=u-d,v=1-m,w=g-d+h;for(let e=0;e!==o;e++){const t=a[f+e+o],n=a[f+e+s]*c,i=a[p+e+o],l=a[p+e]*c;r[e]=v*t+w*n+m*i+g*l}return r}}const Vd=new Dn;class Gd extends Hd{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return Vd.fromArray(r).normalize().toArray(r),r}}const jd={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},qd={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Xd={9728:pe,9729:ge,9984:fe,9985:ve,9986:me,9987:we},Yd={33071:de,33648:ue,10497:he},Kd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Zd={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Jd={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Qd={CUBICSPLINE:void 0,LINEAR:_t,STEP:xt},$d="OPAQUE",eu="MASK",tu="BLEND";function nu(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function iu(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ru(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){const n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,i=n.length;t<i;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function au(e){let t;const n=e.extensions&&e.extensions[gd.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+ou(n.attributes):e.indices+":"+ou(e.attributes)+":"+e.mode,void 0!==e.targets)for(let n=0,i=e.targets.length;n<i;n++)t+=":"+ou(e.targets[n]);return t}function ou(e){let t="";const n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function su(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const lu=new ui;class cu{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new md,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,a=-1;if("undefined"!=typeof navigator){const e=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);i=n&&t?parseInt(t[1],10):-1,r=e.indexOf("Firefox")>-1,a=r?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&i<17||r&&a<98?this.textureLoader=new yh(this.options.manager):this.textureLoader=new Uh(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new vh(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){const a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return nu(r,a,i),iu(a,i),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){for(const e of a.scenes)e.updateMatrixWorld();e(a)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n].joints;for(let t=0,n=i.length;t<n;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){const i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(e,t)=>{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())r(i,t.children[n])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":i=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":i=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)})),!i)throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map((function(t,i){return n.getDependency(e,i)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[gd.KHR_BINARY_GLTF].body);const i=this.options;return new Promise((function(e,r){n.load(Dh.resolveURL(t.uri,i.path),e,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){const n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)}))}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){const e=Kd[i.type],t=qd[i.componentType],n=!0===i.normalized,r=new t(i.count*e);return Promise.resolve(new lr(r,e,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then((function(e){const r=e[0],a=Kd[i.type],o=qd[i.componentType],s=o.BYTES_PER_ELEMENT,l=s*a,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized;let u,p;if(h&&h!==l){const e=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count;let l=t.cache.get(n);l||(u=new o(r,e*h,i.count*h/s),l=new $s(u,h/s),t.cache.add(n,l)),p=new tl(l,a,c%h/s,d)}else u=null===r?new o(i.count*a):new o(r,c,i.count*a),p=new lr(u,a,d);if(void 0!==i.sparse){const t=Kd.SCALAR,n=qd[i.sparse.indices.componentType],s=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(e[1],s,i.sparse.count*t),h=new o(e[2],l,i.sparse.count*a);null!==r&&(p=new lr(p.array.slice(),p.itemSize,p.normalized));for(let e=0,t=c.length;e<t;e++){const t=c[e];if(p.setX(t,h[e*a]),a>=2&&p.setY(t,h[e*a+1]),a>=3&&p.setZ(t,h[e*a+2]),a>=4&&p.setW(t,h[e*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let a=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){const i=this,r=this.json,a=r.textures[e],o=r.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];const l=this.loadImageSource(t,n).then((function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);const n=(r.samplers||{})[a.sampler]||{};return t.magFilter=Xd[n.magFilter]||ge,t.minFilter=Xd[n.minFilter]||we,t.wrapS=Yd[n.wrapS]||he,t.wrapT=Yd[n.wrapT]||he,i.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[s]=l,l}loadImageSource(e,t){const n=this,i=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const a=i.images[e],o=self.URL||self.webkitURL;let s=a.uri||"",l=!1;if(void 0!==a.bufferView)s=n.getDependency("bufferView",a.bufferView).then((function(e){l=!0;const t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s}));else if(void 0===a.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(s).then((function(e){return new Promise((function(n,i){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){const t=new Cn(e);t.needsUpdate=!0,n(t)}),t.load(Dh.resolveURL(e,r.path),a,void 0,i)}))})).then((function(e){var t;return!0===l&&o.revokeObjectURL(s),iu(e,a),e.userData.mimeType=a.mimeType||((t=a.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e}));return this.sourceCache[e]=c,c}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then((function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),r.extensions[gd.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[gd.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=r.associations.get(a);a=r.extensions[gd.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),r.associations.set(a,t)}}return void 0!==i&&(a.colorSpace=i),e[t]=a,a}))}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new Fl,rr.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new Ml,rr.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||a){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),a&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Vc}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let a;const o={},s=[];if((r.extensions||{})[gd.KHR_MATERIALS_UNLIT]){const e=i[gd.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),s.push(e.extendParams(o,r,t))}else{const n=r.pbrMetallicRoughness||{};if(o.color=new tr(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],Ct),o.opacity=e[3]}void 0!==n.baseColorTexture&&s.push(t.assignTexture(o,"map",n.baseColorTexture,At)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(s.push(t.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),s.push(t.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),a=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),s.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)}))))}!0===r.doubleSided&&(o.side=2);const l=r.alphaMode||$d;if(l===tu?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===eu&&(o.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&a!==ar&&(s.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new ln(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&a!==ar&&(s.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(o.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&a!==ar){const e=r.emissiveFactor;o.emissive=(new tr).setRGB(e[0],e[1],e[2],Ct)}return void 0!==r.emissiveTexture&&a!==ar&&s.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,At)),Promise.all(s).then((function(){const n=new a(o);return r.name&&(n.name=r.name),iu(n,r),t.associations.set(n,{materials:e}),r.extensions&&nu(i,n,r),n}))}createUniqueName(e){const t=Vh.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[gd.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return hu(n,e,t)}))}const a=[];for(let n=0,o=e.length;n<o;n++){const o=e[n],s=au(o),l=i[s];if(l)a.push(l.promise);else{let e;e=o.extensions&&o.extensions[gd.KHR_DRACO_MESH_COMPRESSION]?r(o):hu(new yr,o,t),i[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,o=[];for(let e=0,t=a.length;e<t;e++){const t=void 0===a[e].material?(void 0===(s=this.cache).DefaultMaterial&&(s.DefaultMaterial=new Vc({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:M})),s.DefaultMaterial):this.getDependency("material",a[e].material);o.push(t)}var s;return o.push(t.loadGeometries(a)),Promise.all(o).then((function(n){const o=n.slice(0,n.length-1),s=n[n.length-1],l=[];for(let n=0,c=s.length;n<c;n++){const c=s[n],h=a[n];let d;const u=o[n];if(h.mode===jd.TRIANGLES||h.mode===jd.TRIANGLE_STRIP||h.mode===jd.TRIANGLE_FAN||void 0===h.mode)d=!0===r.isSkinnedMesh?new dl(c,u):new Br(c,u),!0===d.isSkinnedMesh&&d.normalizeSkinWeights(),h.mode===jd.TRIANGLE_STRIP?d.geometry=pd(d.geometry,1):h.mode===jd.TRIANGLE_FAN&&(d.geometry=pd(d.geometry,2));else if(h.mode===jd.LINES)d=new Ol(c,u);else if(h.mode===jd.LINE_STRIP)d=new Nl(c,u);else if(h.mode===jd.LINE_LOOP)d=new zl(c,u);else{if(h.mode!==jd.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);d=new jl(c,u)}Object.keys(d.geometry.morphAttributes).length>0&&ru(d,r),d.name=t.createUniqueName(r.name||"mesh_"+e),iu(d,r),h.extensions&&nu(i,d,h),t.assignFinalMaterial(d),l.push(d)}for(let n=0,i=l.length;n<i;n++)t.associations.set(l[n],{meshes:e,primitives:n});if(1===l.length)return r.extensions&&nu(i,l[0],r),l[0];const c=new Ws;r.extensions&&nu(i,c,r),t.associations.set(c,{meshes:e});for(let e=0,t=l.length;e<t;e++)c.add(l[e]);return c}))}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new Kr(sn.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new _a(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),iu(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],n=[];for(let e=0,i=t.joints.length;e<i;e++)n.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(e){const n=e.pop(),i=e,r=[],a=[];for(let e=0,o=i.length;e<o;e++){const o=i[e];if(o){r.push(o);const t=new ui;null!==n&&t.fromArray(n.array,16*e),a.push(t)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new gl(r,a)}))}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],o=[],s=[],l=[],c=[];for(let e=0,t=i.channels.length;e<t;e++){const t=i.channels[e],n=i.samplers[t.sampler],r=t.target,h=r.node,d=void 0!==i.parameters?i.parameters[n.input]:n.input,u=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(a.push(this.getDependency("node",h)),o.push(this.getDependency("accessor",d)),s.push(this.getDependency("accessor",u)),l.push(n),c.push(r))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(l),Promise.all(c)]).then((function(e){const t=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=[];for(let e=0,r=t.length;e<r;e++){const r=t[e],c=i[e],h=a[e],d=o[e],u=s[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const p=n._createAnimationTracks(r,c,h,d,u);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}return new ch(r,void 0,l)}))}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then((function(e){const t=n._getNodeRef(n.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,n=i.weights.length;t<n;t++)e.morphTargetInfluences[t]=i.weights[t]})),t}))}loadNode(e){const t=this,n=this.json.nodes[e],i=t._loadNodeShallow(e),r=[],a=n.children||[];for(let e=0,n=a.length;e<n;e++)r.push(t.getDependency("node",a[e]));const o=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),o]).then((function(e){const t=e[0],n=e[1],i=e[2];null!==i&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(i,lu)}));for(let e=0,i=n.length;e<i;e++)t.add(n[e]);return t}))}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",o=[],s=i._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return s&&o.push(s),void 0!==r.camera&&o.push(i.getDependency("camera",r.camera).then((function(e){return i._getNodeRef(i.cameraCache,r.camera,e)}))),i._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){o.push(e)})),this.nodeCache[e]=Promise.all(o).then((function(t){let o;if(o=!0===r.isBone?new ul:t.length>1?new Ws:1===t.length?t[0]:new zi,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(r.name&&(o.userData.name=r.name,o.name=a),iu(o,r),r.extensions&&nu(n,o,r),void 0!==r.matrix){const e=new ui;e.fromArray(r.matrix),o.applyMatrix4(e)}else void 0!==r.translation&&o.position.fromArray(r.translation),void 0!==r.rotation&&o.quaternion.fromArray(r.rotation),void 0!==r.scale&&o.scale.fromArray(r.scale);return i.associations.has(o)||i.associations.set(o,{}),i.associations.get(o).nodes=e,o})),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new Ws;n.name&&(r.name=i.createUniqueName(n.name)),iu(r,n),n.extensions&&nu(t,r,n);const a=n.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(i.getDependency("node",a[e]));return Promise.all(o).then((function(e){for(let t=0,n=e.length;t<n;t++)r.add(e[t]);return i.associations=(e=>{const t=new Map;for(const[e,n]of i.associations)(e instanceof rr||e instanceof Cn)&&t.set(e,n);return e.traverse((e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)})),t})(r),r}))}_createAnimationTracks(e,t,n,i,r){const a=[],o=e.name?e.name:e.uuid,s=[];let l;switch(Jd[r.path]===Jd.weights?e.traverse((function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)})):s.push(o),Jd[r.path]){case Jd.weights:l=rh;break;case Jd.rotation:l=oh;break;case Jd.position:case Jd.scale:l=lh;break;default:if(1===n.itemSize)l=rh;else l=lh}const c=void 0!==i.interpolation?Qd[i.interpolation]:_t,h=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e<n;e++){const n=new l(s[e]+"."+Jd[r.path],t.array,h,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=su(t.constructor),n=new Float32Array(t.length);for(let i=0,r=t.length;i<r;i++)n[i]=t[i]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof oh?Gd:Hd)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function hu(e,t,n){const i=t.attributes,r=[];function a(t,i){return n.getDependency("accessor",t).then((function(t){e.setAttribute(i,t)}))}for(const t in i){const n=Zd[t]||t.toLowerCase();n in e.attributes||r.push(a(i[t],n))}if(void 0!==t.indices&&!e.index){const i=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));r.push(i)}return bn.workingColorSpace!==Ct&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${bn.workingColorSpace}" not supported.`),iu(e,t),function(e,t,n){const i=t.attributes,r=new zn;if(void 0===i.POSITION)return;{const e=n.json.accessors[i.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new Un(t[0],t[1],t[2]),new Un(a[0],a[1],a[2])),e.normalized){const t=su(qd[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}const a=t.targets;if(void 0!==a){const e=new Un,t=new Un;for(let i=0,r=a.length;i<r;i++){const r=a[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],a=i.min,o=i.max;if(void 0!==a&&void 0!==o){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),i.normalized){const e=su(qd[i.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(e)}e.boundingBox=r;const o=new ii;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=o}(e,t,n),Promise.all(r).then((function(){return void 0!==t.targets?function(e,t,n){let i=!1,r=!1,a=!1;for(let e=0,n=t.length;e<n;e++){const n=t[e];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(a=!0),i&&r&&a)break}if(!i&&!r&&!a)return Promise.resolve(e);const o=[],s=[],l=[];for(let c=0,h=t.length;c<h;c++){const h=t[c];if(i){const t=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):e.attributes.position;o.push(t)}if(r){const t=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):e.attributes.normal;s.push(t)}if(a){const t=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(l)]).then((function(t){const n=t[0],o=t[1],s=t[2];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}var du,uu,pu,fu=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class mu{constructor(){pu.set(this,new Kr(fu(du,du,"f",uu),1,.1,1e4))}reset(e,t){this.update(e,t,0),fu(this,pu,"f").fov=fu(du,du,"f",uu),fu(this,pu,"f").updateProjectionMatrix()}update(e,t,n){const i=Math.abs(n)/400;fu(this,pu,"f").fov=fu(du,du,"f",uu)+(90-fu(du,du,"f",uu))*Math.pow(i,1)/(Math.pow(i,1)+Math.pow(1-i,1)),fu(this,pu,"f").updateProjectionMatrix();const r=new Un(0,1,.5);fu(this,pu,"f").position.addVectors(e,r.applyQuaternion(t)),fu(this,pu,"f").quaternion.copy(t),fu(this,pu,"f").quaternion.multiply((new Dn).setFromEuler(new _i(0,Math.PI,0))),fu(this,pu,"f").updateMatrix()}get camera(){return fu(this,pu,"f")}}du=mu,pu=new WeakMap,uu={value:70};const gu=mu;class vu{constructor(e,t,n,i){this.primary=e,this.secondary=t,this.frame=n,this.rims=i}static random(){const e=360*Math.random(),t=.5*(1-Math.pow(Math.random(),2))*100,n=100*(.1+.2*(1-Math.pow(Math.random(),2)));return new vu(new tr("hsl("+e+","+t+"%,"+n+"%)"),new tr("#ffffff"),new tr("#131313"),new tr("#666666"))}serialize(){return this.primary.getHexString()+this.secondary.getHexString()+this.frame.getHexString()+this.rims.getHexString()}static deserialize(e){const t=[];for(let n=0;n<4;n++){const i=e.substring(6*n,6*(n+1));/^[0-9a-f]{6}$/i.test(i)?t.push(new tr("#"+i)):t.push(new tr("#555"))}return new vu(t[0],t[1],t[2],t[3])}}const wu=vu;var yu,bu,xu,_u,ku,Eu=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Su=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class Mu{constructor(){xu.set(this,new Kr(Su(yu,yu,"f",bu),1,.1,1e4)),_u.set(this,new Un),ku.set(this,new Un(0,1,0))}reset(e,t){Eu(this,_u,new Un(1e-5,0,-1),"f"),Su(this,_u,"f").applyQuaternion(t),Su(this,_u,"f").add(e),Eu(this,ku,new Un(0,1,0),"f"),Su(this,ku,"f").applyQuaternion(t),this.update(e,t,0),Su(this,xu,"f").fov=Su(yu,yu,"f",bu),Su(this,xu,"f").updateProjectionMatrix()}update(e,t,n){const i=Math.abs(n)/400;Su(this,xu,"f").fov=Su(yu,yu,"f",bu)+(100-Su(yu,yu,"f",bu))*Math.pow(i,1)/(Math.pow(i,1)+Math.pow(1-i,1)),Su(this,xu,"f").updateProjectionMatrix();const r=new Un(0,1,0);r.applyQuaternion(t);const a=.005;Su(this,ku,"f").set(a*r.x+(1-a)*Su(this,ku,"f").x,a*r.y+(1-a)*Su(this,ku,"f").y,a*r.z+(1-a)*Su(this,ku,"f").z);const o=(new Un).subVectors(e,Su(this,_u,"f"));o.normalize();const s=5.5;Su(this,xu,"f").position.x=e.x-o.x*s+2*Su(this,ku,"f").x,Su(this,xu,"f").position.y=Math.max(.25,e.y-o.y*s+2*Su(this,ku,"f").y),Su(this,xu,"f").position.z=e.z-o.z*s+2*Su(this,ku,"f").z,Su(this,xu,"f").lookAt(new Un(e.x+2*Su(this,ku,"f").x,e.y+2*Su(this,ku,"f").y,e.z+2*Su(this,ku,"f").z)),Su(this,xu,"f").updateMatrix(),Su(this,_u,"f").set(e.x-o.x*s,e.y-o.y*s,e.z-o.z*s)}get camera(){return Su(this,xu,"f")}}yu=Mu,xu=new WeakMap,_u=new WeakMap,ku=new WeakMap,bu={value:70};const Tu=Mu;var Au,Cu,Pu,Ru,Lu,Iu,Nu,Du=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Uu=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class Bu{constructor(e){Cu.set(this,void 0),Pu.set(this,void 0),Ru.set(this,[]),Lu.set(this,(new ui).makeScale(0,0,0)),Iu.set(this,new Un(0,1,0)),Du(this,Cu,e,"f");const t=new ca;t.rotateX(Math.PI);const n=new ar({opacity:.3,depthWrite:!1,transparent:!0,map:Uu(Au,Au,"f",Nu)});Du(this,Pu,new Sl(t,n,256),"f"),Uu(this,Pu,"f").frustumCulled=!1,e.scene.add(Uu(this,Pu,"f")),this.clear()}dispose(){Uu(this,Pu,"f").geometry.dispose(),Uu(this,Pu,"f").material.dispose(),Uu(this,Pu,"f").dispose(),Uu(this,Cu,"f").scene.remove(Uu(this,Pu,"f"))}clear(){Uu(this,Ru,"f").length=0;for(let e=0;e<Uu(this,Pu,"f").count;++e)Uu(this,Pu,"f").setMatrixAt(e,Uu(this,Lu,"f"))}spawn(e,t,n){Uu(this,Ru,"f").push({x:e+.25*(Math.random()-.5),y:t+.25*(Math.random()-.5),z:n+.25*(Math.random()-.5),vx:.5*(Math.random()-.5),vy:.5*(Math.random()-.5),vz:.5*(Math.random()-.5),rotation:Math.random()*Math.PI*2,lifetime:.5})}update(e){for(let t=Uu(this,Ru,"f").length-1;t>=0;--t){const n=Uu(this,Ru,"f")[t];n.vy+=15*e,n.x+=n.vx*e,n.y+=n.vy*e,n.z+=n.vz*e,n.lifetime-=e,n.lifetime<=0&&Uu(this,Ru,"f").splice(t,1)}for(let e=0;e<Uu(this,Pu,"f").count;++e)if(e<Uu(this,Ru,"f").length){const t=Uu(this,Ru,"f")[Uu(this,Ru,"f").length-1-e],n=new ui;n.lookAt(new Un(t.x,t.y,t.z),Uu(this,Cu,"f").camera.position,Uu(this,Iu,"f")),n.setPosition(t.x,t.y,t.z),n.multiply((new ui).makeRotationZ(t.rotation));const i=.5+2*(.5-t.lifetime);n.scale(new Un(i,i,i)),Uu(this,Pu,"f").setMatrixAt(e,n)}else Uu(this,Pu,"f").setMatrixAt(e,Uu(this,Lu,"f"));Uu(this,Pu,"f").instanceMatrix.needsUpdate=!0}static initResources(e){e.addResource(),Du(this,Au,(new yh).load("images/smoke.png",(()=>{e.loadedResource()})),"f",Nu)}}Au=Bu,Cu=new WeakMap,Pu=new WeakMap,Ru=new WeakMap,Lu=new WeakMap,Iu=new WeakMap,Nu={value:null};const Ou=Bu;var zu,Fu,Wu,Hu,Vu,Gu,ju,qu,Xu,Yu,Ku,Zu,Ju=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Qu=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Fu=new WeakMap,Wu=new WeakMap,Hu=new WeakMap,Vu=new WeakMap,Gu=new WeakMap,ju=new WeakMap,qu=new WeakMap,Xu=new WeakMap,Yu=new WeakMap,Ku=new WeakMap,zu=new WeakSet,Zu=function(e,t,n,i){const r=new jh(e,t,n,i),a=Qu(this,Hu,"f").shortRaycast(r);if(null!=a)return a;const o=Qu(this,Wu,"f").raycast(r);return null!=o?o:null};const $u=class{constructor(e,t,n){zu.add(this),Fu.set(this,void 0),Wu.set(this,void 0),Hu.set(this,void 0),Vu.set(this,void 0),Gu.set(this,void 0),ju.set(this,void 0),qu.set(this,1e3),Xu.set(this,0),Yu.set(this,null),Ku.set(this,null),Ju(this,Fu,e,"f"),Ju(this,Wu,t,"f"),Ju(this,Hu,n,"f");const i=new yr;Ju(this,Gu,new Float32Array(6*Qu(this,qu,"f")*3),"f"),Ju(this,ju,new lr(Qu(this,Gu,"f"),3),"f"),i.setAttribute("position",Qu(this,ju,"f"));const r=new ar({color:1118481,side:2,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:0});Ju(this,Vu,new Br(i,r),"f"),Qu(this,Vu,"f").frustumCulled=!1,Qu(this,Fu,"f").scene.add(Qu(this,Vu,"f"))}dispose(){Qu(this,Vu,"f").geometry.dispose(),Qu(this,Vu,"f").material.dispose(),Qu(this,Fu,"f").scene.remove(Qu(this,Vu,"f"))}clear(){for(let e=0;e<Qu(this,Gu,"f").length;++e)Qu(this,Gu,"f")[e]=0;Qu(this,ju,"f").needsUpdate=!0,Ju(this,Xu,0,"f"),this.break()}break(){Ju(this,Yu,null,"f"),Ju(this,Ku,null,"f")}spawn(e,t,n,i){var r,a;const o=Qu(this,Yu,"f"),s=Qu(this,Ku,"f");let l=new Un(e,t,n).add(new Un(.172,-.3,0).applyQuaternion(i)),c=new Un(e,t,n).add(new Un(-.172,-.3,0).applyQuaternion(i));const h=new Un(0,-1,0).applyQuaternion(i),d=Qu(this,zu,"m",Zu).call(this,l,h,0,.05),u=Qu(this,zu,"m",Zu).call(this,c,h,0,.05);if(null!=d&&null!=u){if(l=d.point,c=u.point,null!=o&&null!=s){const e=(Ju(this,Xu,(a=Qu(this,Xu,"f"),r=a++,a),"f"),r);Qu(this,Gu,"f")[6*e*3+0]=l.x,Qu(this,Gu,"f")[6*e*3+1]=l.y,Qu(this,Gu,"f")[6*e*3+2]=l.z,Qu(this,Gu,"f")[6*e*3+3]=o.x,Qu(this,Gu,"f")[6*e*3+4]=o.y,Qu(this,Gu,"f")[6*e*3+5]=o.z,Qu(this,Gu,"f")[6*e*3+6]=c.x,Qu(this,Gu,"f")[6*e*3+7]=c.y,Qu(this,Gu,"f")[6*e*3+8]=c.z,Qu(this,Gu,"f")[6*e*3+9]=c.x,Qu(this,Gu,"f")[6*e*3+10]=c.y,Qu(this,Gu,"f")[6*e*3+11]=c.z,Qu(this,Gu,"f")[6*e*3+12]=o.x,Qu(this,Gu,"f")[6*e*3+13]=o.y,Qu(this,Gu,"f")[6*e*3+14]=o.z,Qu(this,Gu,"f")[6*e*3+15]=s.x,Qu(this,Gu,"f")[6*e*3+16]=s.y,Qu(this,Gu,"f")[6*e*3+17]=s.z,Qu(this,ju,"f").needsUpdate=!0,Qu(this,Xu,"f")>=Qu(this,qu,"f")-1&&Ju(this,Xu,0,"f")}Ju(this,Yu,l,"f"),Ju(this,Ku,c,"f")}else this.break()}};var ep,tp=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},np=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class ip{constructor(e){if(ep.set(this,0),null!=e){if(!Number.isSafeInteger(e))throw"Frames is not a safe integer";tp(this,ep,e,"f")}}get numberOfFrames(){return np(this,ep,"f")}get time(){return np(this,ep,"f")/1e3}increment(){var e;tp(this,ep,(e=np(this,ep,"f"),++e),"f")}difference(e){return new ip(np(this,ep,"f")-np(e,ep,"f"))}lessThan(e){return np(this,ep,"f")<np(e,ep,"f")}greaterThan(e){return np(this,ep,"f")>np(e,ep,"f")}lessOrEqual(e){return np(this,ep,"f")<=np(e,ep,"f")}greaterOrEqual(e){return np(this,ep,"f")>=np(e,ep,"f")}equals(e){return np(this,ep,"f")==np(e,ep,"f")}isNegative(){return np(this,ep,"f")<0}clone(){const e=new ip;return tp(e,ep,np(this,ep,"f"),"f"),e}}ep=new WeakMap;const rp=ip;function ap(e){let t=e.length;for(;--t>=0;)e[t]=0}const op=256,sp=286,lp=30,cp=15,hp=new Uint8Array([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]),dp=new Uint8Array([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]),up=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),pp=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fp=new Array(576);ap(fp);const mp=new Array(60);ap(mp);const gp=new Array(512);ap(gp);const vp=new Array(256);ap(vp);const wp=new Array(29);ap(wp);const yp=new Array(lp);function bp(e,t,n,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}let xp,_p,kp;function Ep(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}ap(yp);const Sp=e=>e<256?gp[e]:gp[256+(e>>>7)],Mp=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Tp=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,Mp(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},Ap=(e,t,n)=>{Tp(e,n[2*t],n[2*t+1])},Cp=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},Pp=(e,t,n)=>{const i=new Array(16);let r,a,o=0;for(r=1;r<=cp;r++)o=o+n[r-1]<<1,i[r]=o;for(a=0;a<=t;a++){let t=e[2*a+1];0!==t&&(e[2*a]=Cp(i[t]++,t))}},Rp=e=>{let t;for(t=0;t<sp;t++)e.dyn_ltree[2*t]=0;for(t=0;t<lp;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Lp=e=>{e.bi_valid>8?Mp(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Ip=(e,t,n,i)=>{const r=2*t,a=2*n;return e[r]<e[a]||e[r]===e[a]&&i[t]<=i[n]},Np=(e,t,n)=>{const i=e.heap[n];let r=n<<1;for(;r<=e.heap_len&&(r<e.heap_len&&Ip(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Ip(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i},Dp=(e,t,n)=>{let i,r,a,o,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,r=e.pending_buf[e.sym_buf+s++],0===i?Ap(e,r,t):(a=vp[r],Ap(e,a+op+1,t),o=hp[a],0!==o&&(r-=wp[a],Tp(e,r,o)),i--,a=Sp(i),Ap(e,a,n),o=dp[a],0!==o&&(i-=yp[a],Tp(e,i,o)))}while(s<e.sym_next);Ap(e,256,t)},Up=(e,t)=>{const n=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.elems;let o,s,l,c=-1;for(e.heap_len=0,e.heap_max=573,o=0;o<a;o++)0!==n[2*o]?(e.heap[++e.heap_len]=c=o,e.depth[o]=0):n[2*o+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[2*l]=1,e.depth[l]=0,e.opt_len--,r&&(e.static_len-=i[2*l+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)Np(e,n,o);l=a;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Np(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[2*l]=n[2*o]+n[2*s],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[2*o+1]=n[2*s+1]=l,e.heap[1]=l++,Np(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length;let c,h,d,u,p,f,m=0;for(u=0;u<=cp;u++)e.bl_count[u]=0;for(n[2*e.heap[e.heap_max]+1]=0,c=e.heap_max+1;c<573;c++)h=e.heap[c],u=n[2*n[2*h+1]+1]+1,u>l&&(u=l,m++),n[2*h+1]=u,h>i||(e.bl_count[u]++,p=0,h>=s&&(p=o[h-s]),f=n[2*h],e.opt_len+=f*(u+p),a&&(e.static_len+=f*(r[2*h+1]+p)));if(0!==m){do{for(u=l-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,m-=2}while(m>0);for(u=l;0!==u;u--)for(h=e.bl_count[u];0!==h;)d=e.heap[--c],d>i||(n[2*d+1]!==u&&(e.opt_len+=(u-n[2*d+1])*n[2*d],n[2*d+1]=u),h--)}})(e,t),Pp(n,c,e.bl_count)},Bp=(e,t,n)=>{let i,r,a=-1,o=t[1],s=0,l=7,c=4;for(0===o&&(l=138,c=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)r=o,o=t[2*(i+1)+1],++s<l&&r===o||(s<c?e.bl_tree[2*r]+=s:0!==r?(r!==a&&e.bl_tree[2*r]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,a=r,0===o?(l=138,c=3):r===o?(l=6,c=3):(l=7,c=4))},Op=(e,t,n)=>{let i,r,a=-1,o=t[1],s=0,l=7,c=4;for(0===o&&(l=138,c=3),i=0;i<=n;i++)if(r=o,o=t[2*(i+1)+1],!(++s<l&&r===o)){if(s<c)do{Ap(e,r,e.bl_tree)}while(0!=--s);else 0!==r?(r!==a&&(Ap(e,r,e.bl_tree),s--),Ap(e,16,e.bl_tree),Tp(e,s-3,2)):s<=10?(Ap(e,17,e.bl_tree),Tp(e,s-3,3)):(Ap(e,18,e.bl_tree),Tp(e,s-11,7));s=0,a=r,0===o?(l=138,c=3):r===o?(l=6,c=3):(l=7,c=4)}};let zp=!1;const Fp=(e,t,n,i)=>{Tp(e,0+(i?1:0),3),Lp(e),Mp(e,n),Mp(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var Wp=(e,t,n,i)=>{let r,a,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<op;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),Up(e,e.l_desc),Up(e,e.d_desc),o=(e=>{let t;for(Bp(e,e.dyn_ltree,e.l_desc.max_code),Bp(e,e.dyn_dtree,e.d_desc.max_code),Up(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*pp[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=n+5,n+4<=r&&-1!==t?Fp(e,t,n,i):4===e.strategy||a===r?(Tp(e,2+(i?1:0),3),Dp(e,fp,mp)):(Tp(e,4+(i?1:0),3),((e,t,n,i)=>{let r;for(Tp(e,t-257,5),Tp(e,n-1,5),Tp(e,i-4,4),r=0;r<i;r++)Tp(e,e.bl_tree[2*pp[r]+1],3);Op(e,e.dyn_ltree,t-1),Op(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Dp(e,e.dyn_ltree,e.dyn_dtree)),Rp(e),i&&Lp(e)},Hp={_tr_init:e=>{zp||((()=>{let e,t,n,i,r;const a=new Array(16);for(n=0,i=0;i<28;i++)for(wp[i]=n,e=0;e<1<<hp[i];e++)vp[n++]=i;for(vp[n-1]=i,r=0,i=0;i<16;i++)for(yp[i]=r,e=0;e<1<<dp[i];e++)gp[r++]=i;for(r>>=7;i<lp;i++)for(yp[i]=r<<7,e=0;e<1<<dp[i]-7;e++)gp[256+r++]=i;for(t=0;t<=cp;t++)a[t]=0;for(e=0;e<=143;)fp[2*e+1]=8,e++,a[8]++;for(;e<=255;)fp[2*e+1]=9,e++,a[9]++;for(;e<=279;)fp[2*e+1]=7,e++,a[7]++;for(;e<=287;)fp[2*e+1]=8,e++,a[8]++;for(Pp(fp,287,a),e=0;e<lp;e++)mp[2*e+1]=5,mp[2*e]=Cp(e,5);xp=new bp(fp,hp,257,sp,cp),_p=new bp(mp,dp,0,lp,cp),kp=new bp(new Array(0),up,0,19,7)})(),zp=!0),e.l_desc=new Ep(e.dyn_ltree,xp),e.d_desc=new Ep(e.dyn_dtree,_p),e.bl_desc=new Ep(e.bl_tree,kp),e.bi_buf=0,e.bi_valid=0,Rp(e)},_tr_stored_block:Fp,_tr_flush_block:Wp,_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(vp[n]+op+1)]++,e.dyn_dtree[2*Sp(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Tp(e,2,3),Ap(e,256,fp),(e=>{16===e.bi_valid?(Mp(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var Vp=(e,t,n,i)=>{let r=65535&e,a=e>>>16&65535,o=0;for(;0!==n;){o=n>2e3?2e3:n,n-=o;do{r=r+t[i++]|0,a=a+r|0}while(--o);r%=65521,a%=65521}return r|a<<16};const Gp=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var jp=(e,t,n,i)=>{const r=Gp,a=i+n;e^=-1;for(let n=i;n<a;n++)e=e>>>8^r[255&(e^t[n])];return~e},qp={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Xp={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Yp,_tr_stored_block:Kp,_tr_flush_block:Zp,_tr_tally:Jp,_tr_align:Qp}=Hp,{Z_NO_FLUSH:$p,Z_PARTIAL_FLUSH:ef,Z_FULL_FLUSH:tf,Z_FINISH:nf,Z_BLOCK:rf,Z_OK:af,Z_STREAM_END:of,Z_STREAM_ERROR:sf,Z_DATA_ERROR:lf,Z_BUF_ERROR:cf,Z_DEFAULT_COMPRESSION:hf,Z_FILTERED:df,Z_HUFFMAN_ONLY:uf,Z_RLE:pf,Z_FIXED:ff,Z_DEFAULT_STRATEGY:mf,Z_UNKNOWN:gf,Z_DEFLATED:vf}=Xp,wf=258,yf=262,bf=42,xf=113,_f=666,kf=(e,t)=>(e.msg=qp[t],t),Ef=e=>2*e-(e>4?9:0),Sf=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Mf=e=>{let t,n,i,r=e.w_size;t=e.hash_size,i=t;do{n=e.head[--i],e.head[i]=n>=r?n-r:0}while(--t);t=r,i=t;do{n=e.prev[--i],e.prev[i]=n>=r?n-r:0}while(--t)};let Tf=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const Af=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},Cf=(e,t)=>{Zp(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Af(e.strm)},Pf=(e,t)=>{e.pending_buf[e.pending++]=t},Rf=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Lf=(e,t,n,i)=>{let r=e.avail_in;return r>i&&(r=i),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),n),1===e.state.wrap?e.adler=Vp(e.adler,t,r,n):2===e.state.wrap&&(e.adler=jp(e.adler,t,r,n)),e.next_in+=r,e.total_in+=r,r)},If=(e,t)=>{let n,i,r=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match;const l=e.strstart>e.w_size-yf?e.strstart-(e.w_size-yf):0,c=e.window,h=e.w_mask,d=e.prev,u=e.strstart+wf;let p=c[a+o-1],f=c[a+o];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do{if(n=t,c[n+o]===f&&c[n+o-1]===p&&c[n]===c[a]&&c[++n]===c[a+1]){a+=2,n++;do{}while(c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&a<u);if(i=wf-(u-a),a=u-wf,i>o){if(e.match_start=t,o=i,i>=s)break;p=c[a+o-1],f=c[a+o]}}}while((t=d[t&h])>l&&0!=--r);return o<=e.lookahead?o:e.lookahead},Nf=e=>{const t=e.w_size;let n,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-yf)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Mf(e),i+=t),0===e.strm.avail_in)break;if(n=Lf(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=Tf(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=Tf(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<yf&&0!==e.strm.avail_in)},Df=(e,t)=>{let n,i,r,a=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,s=e.strm.avail_in;do{if(n=65535,r=e.bi_valid+42>>3,e.strm.avail_out<r)break;if(r=e.strm.avail_out-r,i=e.strstart-e.block_start,n>i+e.strm.avail_in&&(n=i+e.strm.avail_in),n>r&&(n=r),n<a&&(0===n&&t!==nf||t===$p||n!==i+e.strm.avail_in))break;o=t===nf&&n===i+e.strm.avail_in?1:0,Kp(e,0,0,o),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Af(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&(Lf(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===o);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?4:t!==$p&&t!==nf&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(r=e.window_size-e.strstart,e.strm.avail_in>r&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(Lf(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water<e.strstart&&(e.high_water=e.strstart),r=e.bi_valid+42>>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,a=r>e.w_size?e.w_size:r,i=e.strstart-e.block_start,(i>=a||(i||t===nf)&&t!==$p&&0===e.strm.avail_in&&i<=r)&&(n=i>r?r:i,o=t===nf&&0===e.strm.avail_in&&n===i?1:0,Kp(e,e.block_start,n,o),e.block_start+=n,Af(e.strm)),o?3:1)},Uf=(e,t)=>{let n,i;for(;;){if(e.lookahead<yf){if(Nf(e),e.lookahead<yf&&t===$p)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=Tf(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-yf&&(e.match_length=If(e,n)),e.match_length>=3)if(i=Jp(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Tf(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Tf(e,e.ins_h,e.window[e.strstart+1]);else i=Jp(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Cf(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===nf?(Cf(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Cf(e,!1),0===e.strm.avail_out)?1:2},Bf=(e,t)=>{let n,i,r;for(;;){if(e.lookahead<yf){if(Nf(e),e.lookahead<yf&&t===$p)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=Tf(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-yf&&(e.match_length=If(e,n),e.match_length<=5&&(e.strategy===df||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,i=Jp(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=Tf(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(Cf(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=Jp(e,0,e.window[e.strstart-1]),i&&Cf(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=Jp(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===nf?(Cf(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Cf(e,!1),0===e.strm.avail_out)?1:2};function Of(e,t,n,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=r}const zf=[new Of(0,0,0,0,Df),new Of(4,4,8,4,Uf),new Of(4,5,16,8,Uf),new Of(4,6,32,32,Uf),new Of(4,4,16,16,Bf),new Of(8,16,32,32,Bf),new Of(8,16,128,128,Bf),new Of(8,32,128,256,Bf),new Of(32,128,258,1024,Bf),new Of(32,258,258,4096,Bf)];function Ff(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=vf,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Sf(this.dyn_ltree),Sf(this.dyn_dtree),Sf(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Sf(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Sf(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Wf=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==bf&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==xf&&t.status!==_f?1:0},Hf=e=>{if(Wf(e))return kf(e,sf);e.total_in=e.total_out=0,e.data_type=gf;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?bf:xf,e.adler=2===t.wrap?0:1,t.last_flush=-2,Yp(t),af},Vf=e=>{const t=Hf(e);var n;return t===af&&((n=e.state).window_size=2*n.w_size,Sf(n.head),n.max_lazy_match=zf[n.level].max_lazy,n.good_match=zf[n.level].good_length,n.nice_match=zf[n.level].nice_length,n.max_chain_length=zf[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),t},Gf=(e,t,n,i,r,a)=>{if(!e)return sf;let o=1;if(t===hf&&(t=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),r<1||r>9||n!==vf||i<8||i>15||t<0||t>9||a<0||a>ff||8===i&&1!==o)return kf(e,sf);8===i&&(i=9);const s=new Ff;return e.state=s,s.strm=e,s.status=bf,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=r+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<r+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=a,s.method=n,Vf(e)};var jf={deflateInit:(e,t)=>Gf(e,t,vf,15,8,mf),deflateInit2:Gf,deflateReset:Vf,deflateResetKeep:Hf,deflateSetHeader:(e,t)=>Wf(e)||2!==e.state.wrap?sf:(e.state.gzhead=t,af),deflate:(e,t)=>{if(Wf(e)||t>rf||t<0)return e?kf(e,sf):sf;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===_f&&t!==nf)return kf(e,0===e.avail_out?cf:sf);const i=n.last_flush;if(n.last_flush=t,0!==n.pending){if(Af(e),0===e.avail_out)return n.last_flush=-1,af}else if(0===e.avail_in&&Ef(t)<=Ef(i)&&t!==nf)return kf(e,cf);if(n.status===_f&&0!==e.avail_in)return kf(e,cf);if(n.status===bf&&0===n.wrap&&(n.status=xf),n.status===bf){let t=vf+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=uf||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=i<<6,0!==n.strstart&&(t|=32),t+=31-t%31,Rf(n,t),0!==n.strstart&&(Rf(n,e.adler>>>16),Rf(n,65535&e.adler)),e.adler=1,n.status=xf,Af(e),0!==n.pending)return n.last_flush=-1,af}if(57===n.status)if(e.adler=0,Pf(n,31),Pf(n,139),Pf(n,8),n.gzhead)Pf(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Pf(n,255&n.gzhead.time),Pf(n,n.gzhead.time>>8&255),Pf(n,n.gzhead.time>>16&255),Pf(n,n.gzhead.time>>24&255),Pf(n,9===n.level?2:n.strategy>=uf||n.level<2?4:0),Pf(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Pf(n,255&n.gzhead.extra.length),Pf(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=jp(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Pf(n,0),Pf(n,0),Pf(n,0),Pf(n,0),Pf(n,0),Pf(n,9===n.level?2:n.strategy>=uf||n.level<2?4:0),Pf(n,3),n.status=xf,Af(e),0!==n.pending)return n.last_flush=-1,af;if(69===n.status){if(n.gzhead.extra){let t=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let r=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=jp(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=r,Af(e),0!==n.pending)return n.last_flush=-1,af;t=0,i-=r}let r=new Uint8Array(n.gzhead.extra);n.pending_buf.set(r.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>t&&(e.adler=jp(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=jp(e.adler,n.pending_buf,n.pending-i,i)),Af(e),0!==n.pending)return n.last_flush=-1,af;i=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,Pf(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=jp(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=jp(e.adler,n.pending_buf,n.pending-i,i)),Af(e),0!==n.pending)return n.last_flush=-1,af;i=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,Pf(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=jp(e.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Af(e),0!==n.pending))return n.last_flush=-1,af;Pf(n,255&e.adler),Pf(n,e.adler>>8&255),e.adler=0}if(n.status=xf,Af(e),0!==n.pending)return n.last_flush=-1,af}if(0!==e.avail_in||0!==n.lookahead||t!==$p&&n.status!==_f){let i=0===n.level?Df(n,t):n.strategy===uf?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(Nf(e),0===e.lookahead)){if(t===$p)return 1;break}if(e.match_length=0,n=Jp(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Cf(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===nf?(Cf(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Cf(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===pf?((e,t)=>{let n,i,r,a;const o=e.window;for(;;){if(e.lookahead<=wf){if(Nf(e),e.lookahead<=wf&&t===$p)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,i=o[r],i===o[++r]&&i===o[++r]&&i===o[++r])){a=e.strstart+wf;do{}while(i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&r<a);e.match_length=wf-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=Jp(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Jp(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Cf(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===nf?(Cf(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Cf(e,!1),0===e.strm.avail_out)?1:2})(n,t):zf[n.level].func(n,t);if(3!==i&&4!==i||(n.status=_f),1===i||3===i)return 0===e.avail_out&&(n.last_flush=-1),af;if(2===i&&(t===ef?Qp(n):t!==rf&&(Kp(n,0,0,!1),t===tf&&(Sf(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Af(e),0===e.avail_out))return n.last_flush=-1,af}return t!==nf?af:n.wrap<=0?of:(2===n.wrap?(Pf(n,255&e.adler),Pf(n,e.adler>>8&255),Pf(n,e.adler>>16&255),Pf(n,e.adler>>24&255),Pf(n,255&e.total_in),Pf(n,e.total_in>>8&255),Pf(n,e.total_in>>16&255),Pf(n,e.total_in>>24&255)):(Rf(n,e.adler>>>16),Rf(n,65535&e.adler)),Af(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?af:of)},deflateEnd:e=>{if(Wf(e))return sf;const t=e.state.status;return e.state=null,t===xf?kf(e,lf):af},deflateSetDictionary:(e,t)=>{let n=t.length;if(Wf(e))return sf;const i=e.state,r=i.wrap;if(2===r||1===r&&i.status!==bf||i.lookahead)return sf;if(1===r&&(e.adler=Vp(e.adler,t,n,0)),i.wrap=0,n>=i.w_size){0===r&&(Sf(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(n-i.w_size,n),0),t=e,n=i.w_size}const a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Nf(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=Tf(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,Nf(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=o,e.input=s,e.avail_in=a,i.wrap=r,af},deflateInfo:"pako deflate (from Nodeca project)"};const qf=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Xf={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const t in n)qf(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,i=e.length;n<i;n++)t+=e[n].length;const n=new Uint8Array(t);for(let t=0,i=0,r=e.length;t<r;t++){let r=e[t];n.set(r,i),i+=r.length}return n}};let Yf=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Yf=!1}const Kf=new Uint8Array(256);for(let e=0;e<256;e++)Kf[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Kf[254]=Kf[254]=1;var Zf={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,i,r,a,o=e.length,s=0;for(r=0;r<o;r++)n=e.charCodeAt(r),55296==(64512&n)&&r+1<o&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),a=0,r=0;a<s;r++)n=e.charCodeAt(r),55296==(64512&n)&&r+1<o&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|63&n):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|63&n):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|63&n);return t},buf2string:(e,t)=>{const n=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,r;const a=new Array(2*n);for(r=0,i=0;i<n;){let t=e[i++];if(t<128){a[r++]=t;continue}let o=Kf[t];if(o>4)a[r++]=65533,i+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&i<n;)t=t<<6|63&e[i++],o--;o>1?a[r++]=65533:t<65536?a[r++]=t:(t-=65536,a[r++]=55296|t>>10&1023,a[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Yf)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n})(a,r)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+Kf[e[n]]>t?n:t}};var Jf=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Qf=Object.prototype.toString,{Z_NO_FLUSH:$f,Z_SYNC_FLUSH:em,Z_FULL_FLUSH:tm,Z_FINISH:nm,Z_OK:im,Z_STREAM_END:rm,Z_DEFAULT_COMPRESSION:am,Z_DEFAULT_STRATEGY:om,Z_DEFLATED:sm}=Xp;function lm(e){this.options=Xf.assign({level:am,method:sm,chunkSize:16384,windowBits:15,memLevel:8,strategy:om},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Jf,this.strm.avail_out=0;let n=jf.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==im)throw new Error(qp[n]);if(t.header&&jf.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Zf.string2buf(t.dictionary):"[object ArrayBuffer]"===Qf.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=jf.deflateSetDictionary(this.strm,e),n!==im)throw new Error(qp[n]);this._dict_set=!0}}function cm(e,t){const n=new lm(t);if(n.push(e,!0),n.err)throw n.msg||qp[n.err];return n.result}lm.prototype.push=function(e,t){const n=this.strm,i=this.options.chunkSize;let r,a;if(this.ended)return!1;for(a=t===~~t?t:!0===t?nm:$f,"string"==typeof e?n.input=Zf.string2buf(e):"[object ArrayBuffer]"===Qf.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),(a===em||a===tm)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(r=jf.deflate(n,a),r===rm)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),r=jf.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===im;if(0!==n.avail_out){if(a>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},lm.prototype.onData=function(e){this.chunks.push(e)},lm.prototype.onEnd=function(e){e===im&&(this.result=Xf.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var hm=function(e,t){return(t=t||{}).raw=!0,cm(e,t)},dm=function(e,t){return(t=t||{}).gzip=!0,cm(e,t)},um={Deflate:lm,deflate:cm,deflateRaw:hm,gzip:dm,constants:Xp};const pm=16209;var fm=function(e,t){let n,i,r,a,o,s,l,c,h,d,u,p,f,m,g,v,w,y,b,x,_,k,E,S;const M=e.state;n=e.next_in,E=e.input,i=n+(e.avail_in-5),r=e.next_out,S=e.output,a=r-(t-e.avail_out),o=r+(e.avail_out-257),s=M.dmax,l=M.wsize,c=M.whave,h=M.wnext,d=M.window,u=M.hold,p=M.bits,f=M.lencode,m=M.distcode,g=(1<<M.lenbits)-1,v=(1<<M.distbits)-1;e:do{p<15&&(u+=E[n++]<<p,p+=8,u+=E[n++]<<p,p+=8),w=f[u&g];t:for(;;){if(y=w>>>24,u>>>=y,p-=y,y=w>>>16&255,0===y)S[r++]=65535&w;else{if(!(16&y)){if(64&y){if(32&y){M.mode=16191;break e}e.msg="invalid literal/length code",M.mode=pm;break e}w=f[(65535&w)+(u&(1<<y)-1)];continue t}for(b=65535&w,y&=15,y&&(p<y&&(u+=E[n++]<<p,p+=8),b+=u&(1<<y)-1,u>>>=y,p-=y),p<15&&(u+=E[n++]<<p,p+=8,u+=E[n++]<<p,p+=8),w=m[u&v];;){if(y=w>>>24,u>>>=y,p-=y,y=w>>>16&255,16&y){if(x=65535&w,y&=15,p<y&&(u+=E[n++]<<p,p+=8,p<y&&(u+=E[n++]<<p,p+=8)),x+=u&(1<<y)-1,x>s){e.msg="invalid distance too far back",M.mode=pm;break e}if(u>>>=y,p-=y,y=r-a,x>y){if(y=x-y,y>c&&M.sane){e.msg="invalid distance too far back",M.mode=pm;break e}if(_=0,k=d,0===h){if(_+=l-y,y<b){b-=y;do{S[r++]=d[_++]}while(--y);_=r-x,k=S}}else if(h<y){if(_+=l+h-y,y-=h,y<b){b-=y;do{S[r++]=d[_++]}while(--y);if(_=0,h<b){y=h,b-=y;do{S[r++]=d[_++]}while(--y);_=r-x,k=S}}}else if(_+=h-y,y<b){b-=y;do{S[r++]=d[_++]}while(--y);_=r-x,k=S}for(;b>2;)S[r++]=k[_++],S[r++]=k[_++],S[r++]=k[_++],b-=3;b&&(S[r++]=k[_++],b>1&&(S[r++]=k[_++]))}else{_=r-x;do{S[r++]=S[_++],S[r++]=S[_++],S[r++]=S[_++],b-=3}while(b>2);b&&(S[r++]=S[_++],b>1&&(S[r++]=S[_++]))}break}if(64&y){e.msg="invalid distance code",M.mode=pm;break e}w=m[(65535&w)+(u&(1<<y)-1)]}}break}}while(n<i&&r<o);b=p>>3,n-=b,p-=b<<3,u&=(1<<p)-1,e.next_in=n,e.next_out=r,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=r<o?o-r+257:257-(r-o),M.hold=u,M.bits=p};const mm=15,gm=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),vm=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),wm=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),ym=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var bm=(e,t,n,i,r,a,o,s)=>{const l=s.bits;let c,h,d,u,p,f,m=0,g=0,v=0,w=0,y=0,b=0,x=0,_=0,k=0,E=0,S=null;const M=new Uint16Array(16),T=new Uint16Array(16);let A,C,P,R=null;for(m=0;m<=mm;m++)M[m]=0;for(g=0;g<i;g++)M[t[n+g]]++;for(y=l,w=mm;w>=1&&0===M[w];w--);if(y>w&&(y=w),0===w)return r[a++]=20971520,r[a++]=20971520,s.bits=1,0;for(v=1;v<w&&0===M[v];v++);for(y<v&&(y=v),_=1,m=1;m<=mm;m++)if(_<<=1,_-=M[m],_<0)return-1;if(_>0&&(0===e||1!==w))return-1;for(T[1]=0,m=1;m<mm;m++)T[m+1]=T[m]+M[m];for(g=0;g<i;g++)0!==t[n+g]&&(o[T[t[n+g]]++]=g);if(0===e?(S=R=o,f=20):1===e?(S=gm,R=vm,f=257):(S=wm,R=ym,f=0),E=0,g=0,m=v,p=a,b=y,x=0,d=-1,k=1<<y,u=k-1,1===e&&k>852||2===e&&k>592)return 1;for(;;){A=m-x,o[g]+1<f?(C=0,P=o[g]):o[g]>=f?(C=R[o[g]-f],P=S[o[g]-f]):(C=96,P=0),c=1<<m-x,h=1<<b,v=h;do{h-=c,r[p+(E>>x)+h]=A<<24|C<<16|P}while(0!==h);for(c=1<<m-1;E&c;)c>>=1;if(0!==c?(E&=c-1,E+=c):E=0,g++,0==--M[m]){if(m===w)break;m=t[n+o[g]]}if(m>y&&(E&u)!==d){for(0===x&&(x=y),p+=v,b=m-x,_=1<<b;b+x<w&&(_-=M[b+x],!(_<=0));)b++,_<<=1;if(k+=1<<b,1===e&&k>852||2===e&&k>592)return 1;d=E&u,r[d]=y<<24|b<<16|p-a}}return 0!==E&&(r[p+E]=m-x<<24|64<<16),s.bits=y,0};const{Z_FINISH:xm,Z_BLOCK:_m,Z_TREES:km,Z_OK:Em,Z_STREAM_END:Sm,Z_NEED_DICT:Mm,Z_STREAM_ERROR:Tm,Z_DATA_ERROR:Am,Z_MEM_ERROR:Cm,Z_BUF_ERROR:Pm,Z_DEFLATED:Rm}=Xp,Lm=16180,Im=16190,Nm=16191,Dm=16192,Um=16194,Bm=16199,Om=16200,zm=16206,Fm=16209,Wm=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Hm(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Vm=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Lm||t.mode>16211?1:0},Gm=e=>{if(Vm(e))return Tm;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Lm,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Em},jm=e=>{if(Vm(e))return Tm;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Gm(e)},qm=(e,t)=>{let n;if(Vm(e))return Tm;const i=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Tm:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,jm(e))},Xm=(e,t)=>{if(!e)return Tm;const n=new Hm;e.state=n,n.strm=e,n.window=null,n.mode=Lm;const i=qm(e,t);return i!==Em&&(e.state=null),i};let Ym,Km,Zm=!0;const Jm=e=>{if(Zm){Ym=new Int32Array(512),Km=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(bm(1,e.lens,0,288,Ym,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;bm(2,e.lens,0,32,Km,0,e.work,{bits:5}),Zm=!1}e.lencode=Ym,e.lenbits=9,e.distcode=Km,e.distbits=5},Qm=(e,t,n,i)=>{let r;const a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(t.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>i&&(r=i),a.window.set(t.subarray(n-i,n-i+r),a.wnext),(i-=r)?(a.window.set(t.subarray(n-i,n),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0};var $m={inflateReset:jm,inflateReset2:qm,inflateResetKeep:Gm,inflateInit:e=>Xm(e,15),inflateInit2:Xm,inflate:(e,t)=>{let n,i,r,a,o,s,l,c,h,d,u,p,f,m,g,v,w,y,b,x,_,k,E=0;const S=new Uint8Array(4);let M,T;const A=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Vm(e)||!e.output||!e.input&&0!==e.avail_in)return Tm;n=e.state,n.mode===Nm&&(n.mode=Dm),o=e.next_out,r=e.output,l=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,c=n.hold,h=n.bits,d=s,u=l,k=Em;e:for(;;)switch(n.mode){case Lm:if(0===n.wrap){n.mode=Dm;break}for(;h<16;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}if(2&n.wrap&&35615===c){0===n.wbits&&(n.wbits=15),n.check=0,S[0]=255&c,S[1]=c>>>8&255,n.check=jp(n.check,S,2,0),c=0,h=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=Fm;break}if((15&c)!==Rm){e.msg="unknown compression method",n.mode=Fm;break}if(c>>>=4,h-=4,_=8+(15&c),0===n.wbits&&(n.wbits=_),_>15||_>n.wbits){e.msg="invalid window size",n.mode=Fm;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&c?16189:Nm,c=0,h=0;break;case 16181:for(;h<16;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}if(n.flags=c,(255&n.flags)!==Rm){e.msg="unknown compression method",n.mode=Fm;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=Fm;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=jp(n.check,S,2,0)),c=0,h=0,n.mode=16182;case 16182:for(;h<32;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}n.head&&(n.head.time=c),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,S[2]=c>>>16&255,S[3]=c>>>24&255,n.check=jp(n.check,S,4,0)),c=0,h=0,n.mode=16183;case 16183:for(;h<16;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=jp(n.check,S,2,0)),c=0,h=0,n.mode=16184;case 16184:if(1024&n.flags){for(;h<16;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=jp(n.check,S,2,0)),c=0,h=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(p=n.length,p>s&&(p=s),p&&(n.head&&(_=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(a,a+p),_)),512&n.flags&&4&n.wrap&&(n.check=jp(n.check,i,p,a)),s-=p,a+=p,n.length-=p),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===s)break e;p=0;do{_=i[a+p++],n.head&&_&&n.length<65536&&(n.head.name+=String.fromCharCode(_))}while(_&&p<s);if(512&n.flags&&4&n.wrap&&(n.check=jp(n.check,i,p,a)),s-=p,a+=p,_)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===s)break e;p=0;do{_=i[a+p++],n.head&&_&&n.length<65536&&(n.head.comment+=String.fromCharCode(_))}while(_&&p<s);if(512&n.flags&&4&n.wrap&&(n.check=jp(n.check,i,p,a)),s-=p,a+=p,_)break e}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;h<16;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}if(4&n.wrap&&c!==(65535&n.check)){e.msg="header crc mismatch",n.mode=Fm;break}c=0,h=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Nm;break;case 16189:for(;h<32;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}e.adler=n.check=Wm(c),c=0,h=0,n.mode=Im;case Im:if(0===n.havedict)return e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=h,Mm;e.adler=n.check=1,n.mode=Nm;case Nm:if(t===_m||t===km)break e;case Dm:if(n.last){c>>>=7&h,h-=7&h,n.mode=zm;break}for(;h<3;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}switch(n.last=1&c,c>>>=1,h-=1,3&c){case 0:n.mode=16193;break;case 1:if(Jm(n),n.mode=Bm,t===km){c>>>=2,h-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=Fm}c>>>=2,h-=2;break;case 16193:for(c>>>=7&h,h-=7&h;h<32;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=Fm;break}if(n.length=65535&c,c=0,h=0,n.mode=Um,t===km)break e;case Um:n.mode=16195;case 16195:if(p=n.length,p){if(p>s&&(p=s),p>l&&(p=l),0===p)break e;r.set(i.subarray(a,a+p),o),s-=p,a+=p,l-=p,o+=p,n.length-=p;break}n.mode=Nm;break;case 16196:for(;h<14;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}if(n.nlen=257+(31&c),c>>>=5,h-=5,n.ndist=1+(31&c),c>>>=5,h-=5,n.ncode=4+(15&c),c>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Fm;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;h<3;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}n.lens[A[n.have++]]=7&c,c>>>=3,h-=3}for(;n.have<19;)n.lens[A[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,M={bits:n.lenbits},k=bm(0,n.lens,0,19,n.lencode,0,n.work,M),n.lenbits=M.bits,k){e.msg="invalid code lengths set",n.mode=Fm;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;E=n.lencode[c&(1<<n.lenbits)-1],g=E>>>24,v=E>>>16&255,w=65535&E,!(g<=h);){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}if(w<16)c>>>=g,h-=g,n.lens[n.have++]=w;else{if(16===w){for(T=g+2;h<T;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}if(c>>>=g,h-=g,0===n.have){e.msg="invalid bit length repeat",n.mode=Fm;break}_=n.lens[n.have-1],p=3+(3&c),c>>>=2,h-=2}else if(17===w){for(T=g+3;h<T;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}c>>>=g,h-=g,_=0,p=3+(7&c),c>>>=3,h-=3}else{for(T=g+7;h<T;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}c>>>=g,h-=g,_=0,p=11+(127&c),c>>>=7,h-=7}if(n.have+p>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Fm;break}for(;p--;)n.lens[n.have++]=_}}if(n.mode===Fm)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=Fm;break}if(n.lenbits=9,M={bits:n.lenbits},k=bm(1,n.lens,0,n.nlen,n.lencode,0,n.work,M),n.lenbits=M.bits,k){e.msg="invalid literal/lengths set",n.mode=Fm;break}if(n.distbits=6,n.distcode=n.distdyn,M={bits:n.distbits},k=bm(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,M),n.distbits=M.bits,k){e.msg="invalid distances set",n.mode=Fm;break}if(n.mode=Bm,t===km)break e;case Bm:n.mode=Om;case Om:if(s>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=h,fm(e,u),o=e.next_out,r=e.output,l=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,c=n.hold,h=n.bits,n.mode===Nm&&(n.back=-1);break}for(n.back=0;E=n.lencode[c&(1<<n.lenbits)-1],g=E>>>24,v=E>>>16&255,w=65535&E,!(g<=h);){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}if(v&&!(240&v)){for(y=g,b=v,x=w;E=n.lencode[x+((c&(1<<y+b)-1)>>y)],g=E>>>24,v=E>>>16&255,w=65535&E,!(y+g<=h);){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}c>>>=y,h-=y,n.back+=y}if(c>>>=g,h-=g,n.back+=g,n.length=w,0===v){n.mode=16205;break}if(32&v){n.back=-1,n.mode=Nm;break}if(64&v){e.msg="invalid literal/length code",n.mode=Fm;break}n.extra=15&v,n.mode=16201;case 16201:if(n.extra){for(T=n.extra;h<T;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;E=n.distcode[c&(1<<n.distbits)-1],g=E>>>24,v=E>>>16&255,w=65535&E,!(g<=h);){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}if(!(240&v)){for(y=g,b=v,x=w;E=n.distcode[x+((c&(1<<y+b)-1)>>y)],g=E>>>24,v=E>>>16&255,w=65535&E,!(y+g<=h);){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}c>>>=y,h-=y,n.back+=y}if(c>>>=g,h-=g,n.back+=g,64&v){e.msg="invalid distance code",n.mode=Fm;break}n.offset=w,n.extra=15&v,n.mode=16203;case 16203:if(n.extra){for(T=n.extra;h<T;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Fm;break}n.mode=16204;case 16204:if(0===l)break e;if(p=u-l,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Fm;break}p>n.wnext?(p-=n.wnext,f=n.wsize-p):f=n.wnext-p,p>n.length&&(p=n.length),m=n.window}else m=r,f=o-n.offset,p=n.length;p>l&&(p=l),l-=p,n.length-=p;do{r[o++]=m[f++]}while(--p);0===n.length&&(n.mode=Om);break;case 16205:if(0===l)break e;r[o++]=n.length,l--,n.mode=Om;break;case zm:if(n.wrap){for(;h<32;){if(0===s)break e;s--,c|=i[a++]<<h,h+=8}if(u-=l,e.total_out+=u,n.total+=u,4&n.wrap&&u&&(e.adler=n.check=n.flags?jp(n.check,r,u,o-u):Vp(n.check,r,u,o-u)),u=l,4&n.wrap&&(n.flags?c:Wm(c))!==n.check){e.msg="incorrect data check",n.mode=Fm;break}c=0,h=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;h<32;){if(0===s)break e;s--,c+=i[a++]<<h,h+=8}if(4&n.wrap&&c!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=Fm;break}c=0,h=0}n.mode=16208;case 16208:k=Sm;break e;case Fm:k=Am;break e;case 16210:return Cm;default:return Tm}return e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=h,(n.wsize||u!==e.avail_out&&n.mode<Fm&&(n.mode<zm||t!==xm))&&Qm(e,e.output,e.next_out,u-e.avail_out),d-=e.avail_in,u-=e.avail_out,e.total_in+=d,e.total_out+=u,n.total+=u,4&n.wrap&&u&&(e.adler=n.check=n.flags?jp(n.check,r,u,e.next_out-u):Vp(n.check,r,u,e.next_out-u)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Nm?128:0)+(n.mode===Bm||n.mode===Um?256:0),(0===d&&0===u||t===xm)&&k===Em&&(k=Pm),k},inflateEnd:e=>{if(Vm(e))return Tm;let t=e.state;return t.window&&(t.window=null),e.state=null,Em},inflateGetHeader:(e,t)=>{if(Vm(e))return Tm;const n=e.state;return 2&n.wrap?(n.head=t,t.done=!1,Em):Tm},inflateSetDictionary:(e,t)=>{const n=t.length;let i,r,a;return Vm(e)?Tm:(i=e.state,0!==i.wrap&&i.mode!==Im?Tm:i.mode===Im&&(r=1,r=Vp(r,t,n,0),r!==i.check)?Am:(a=Qm(e,t,n,n),a?(i.mode=16210,Cm):(i.havedict=1,Em)))},inflateInfo:"pako inflate (from Nodeca project)"};var eg=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const tg=Object.prototype.toString,{Z_NO_FLUSH:ng,Z_FINISH:ig,Z_OK:rg,Z_STREAM_END:ag,Z_NEED_DICT:og,Z_STREAM_ERROR:sg,Z_DATA_ERROR:lg,Z_MEM_ERROR:cg}=Xp;function hg(e){this.options=Xf.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Jf,this.strm.avail_out=0;let n=$m.inflateInit2(this.strm,t.windowBits);if(n!==rg)throw new Error(qp[n]);if(this.header=new eg,$m.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Zf.string2buf(t.dictionary):"[object ArrayBuffer]"===tg.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=$m.inflateSetDictionary(this.strm,t.dictionary),n!==rg)))throw new Error(qp[n])}function dg(e,t){const n=new hg(t);if(n.push(e),n.err)throw n.msg||qp[n.err];return n.result}hg.prototype.push=function(e,t){const n=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let a,o,s;if(this.ended)return!1;for(o=t===~~t?t:!0===t?ig:ng,"[object ArrayBuffer]"===tg.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),a=$m.inflate(n,o),a===og&&r&&(a=$m.inflateSetDictionary(n,r),a===rg?a=$m.inflate(n,o):a===lg&&(a=og));n.avail_in>0&&a===ag&&n.state.wrap>0&&0!==e[n.next_in];)$m.inflateReset(n),a=$m.inflate(n,o);switch(a){case sg:case lg:case og:case cg:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(0===n.avail_out||a===ag))if("string"===this.options.to){let e=Zf.utf8border(n.output,n.next_out),t=n.next_out-e,r=Zf.buf2string(n.output,e);n.next_out=t,n.avail_out=i-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(r)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(a!==rg||0!==s){if(a===ag)return a=$m.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},hg.prototype.onData=function(e){this.chunks.push(e)},hg.prototype.onEnd=function(e){e===rg&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Xf.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ug=function(e,t){return(t=t||{}).raw=!0,dg(e,t)},pg={Inflate:hg,inflate:dg,inflateRaw:ug,ungzip:dg,constants:Xp};const{Deflate:fg,deflate:mg,deflateRaw:gg,gzip:vg}=um,{Inflate:wg,inflate:yg,inflateRaw:bg,ungzip:xg}=pg;var _g={Deflate:fg,deflate:mg,deflateRaw:gg,gzip:vg,Inflate:wg,inflate:yg,inflateRaw:bg,ungzip:xg,constants:Xp};function kg(e){let t;e=(e=e.replace(/-/g,"+")).replace(/_/g,"/");try{t=atob(e)}catch(e){return null}const n=new Uint8Array(t.length);for(let e=0;e<t.length;++e){const i=t.charCodeAt(e);if(i>255)return null;n[e]=i}return n}var Eg,Sg=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Mg=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class Tg{constructor(e){Eg.set(this,[]),null!=e&&Sg(this,Eg,e,"f")}recordFrame(e,t){if(Mg(this,Eg,"f").length>0){const e=Mg(this,Eg,"f")[Mg(this,Eg,"f").length-1];if(e.controls.up==t.up&&e.controls.right==t.right&&e.controls.down==t.down&&e.controls.left==t.left)return}Mg(this,Eg,"f").push({frame:e,controls:t})}getFrame(e){for(let t=0;t<Mg(this,Eg,"f").length;++t){const n=Mg(this,Eg,"f")[t];if(n.frame==e)return[n.controls.up,n.controls.right,n.controls.down,n.controls.left];if(n.frame>e&&t>0){const e=Mg(this,Eg,"f")[t-1];return[e.controls.up,e.controls.right,e.controls.down,e.controls.left]}}if(Mg(this,Eg,"f").length>0){const e=Mg(this,Eg,"f")[Mg(this,Eg,"f").length-1];return[e.controls.up,e.controls.right,e.controls.down,e.controls.left]}return[!1,!1,!1,!1]}getRecording(){return Mg(this,Eg,"f")}serialize(){const e=new Uint8Array(Math.ceil(3.5*Mg(this,Eg,"f").length));for(let t=0;t<Mg(this,Eg,"f").length;++t){const n=Mg(this,Eg,"f")[t];e[3*t]=255&n.frame,e[3*t+1]=n.frame>>>8&255,e[3*t+2]=n.frame>>>16&255}for(let t=0;t<Mg(this,Eg,"f").length;t+=2){const n=Mg(this,Eg,"f")[t];let i=0;if(i|=n.controls.up?1:0,i|=(n.controls.right?1:0)<<1,i|=(n.controls.down?1:0)<<2,i|=(n.controls.left?1:0)<<3,t+1<Mg(this,Eg,"f").length){const e=Mg(this,Eg,"f")[t+1];i|=(e.controls.up?1:0)<<4,i|=(e.controls.right?1:0)<<5,i|=(e.controls.down?1:0)<<6,i|=(e.controls.left?1:0)<<7}e[3*Mg(this,Eg,"f").length+Math.floor(t/2)]=i}const t=new _g.Deflate({level:9});return t.push(new Uint8Array(e),!0),function(e){let t="";e.forEach((e=>{t+=String.fromCharCode(e)}));let n=btoa(t);return n=n.replace(/\+/g,"-"),n=n.replace(/\//g,"_"),n=n.replace(/=/g,""),n}(t.result)}static deserialize(e){const t=kg(e);if(null==t)return null;const n=new _g.Inflate;if(n.push(t,!0),n.err)return null;const i=n.result,r=[],a=Math.round(i.length/3.5);for(let e=0;e<a;++e){const t=i[3*e+0]|i[3*e+1]<<8|i[3*e+2]<<16;let n;const o=i[3*a+Math.floor(e/2)];n=e%2==0?{up:!(1&~o),right:1==(o>>>1&1),down:1==(o>>>2&1),left:1==(o>>>3&1)}:{up:1==(o>>>4&1),right:1==(o>>>5&1),down:1==(o>>>6&1),left:1==(o>>>7&1)},r.push({frame:t,controls:n})}return new Tg(r)}}Eg=new WeakMap;const Ag=Tg;var Cg,Pg,Rg,Lg,Ig,Ng,Dg,Ug,Bg,Og,zg,Fg,Wg,Hg,Vg,Gg,jg,qg,Xg,Yg,Kg,Zg,Jg,Qg,$g,ev,tv,nv,iv,rv,av,ov,sv,lv,cv,hv,dv,uv,pv,fv,mv,gv,vv,wv,yv,bv,xv,_v,kv,Ev,Sv,Mv,Tv,Av,Cv,Pv,Rv,Lv,Iv=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Nv=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class Dv{constructor(e,t,n,i,r,a,o,s,l,c){var h;if(Cg.add(this),Rg.set(this,void 0),Lg.set(this,null),Ig.set(this,1),Ng.set(this,null),Dg.set(this,0),Ug.set(this,[]),Bg.set(this,null),Og.set(this,null),zg.set(this,null),Fg.set(this,[]),Wg.set(this,void 0),Hg.set(this,void 0),Vg.set(this,void 0),Gg.set(this,void 0),jg.set(this,!1),qg.set(this,void 0),Xg.set(this,void 0),Yg.set(this,void 0),Kg.set(this,void 0),Zg.set(this,[]),Jg.set(this,[0,0,0,0]),Qg.set(this,[0,0,0,0]),$g.set(this,void 0),ev.set(this,null),tv.set(this,null),nv.set(this,null),iv.set(this,[]),rv.set(this,null),av.set(this,void 0),ov.set(this,void 0),sv.set(this,void 0),lv.set(this,void 0),cv.set(this,void 0),hv.set(this,void 0),dv.set(this,void 0),uv.set(this,[]),pv.set(this,null),fv.set(this,[.075,.075,.075,.075]),mv.set(this,void 0),gv.set(this,null),vv.set(this,!1),Iv(this,Rg,o,"f"),Iv(this,$g,a,"f"),Iv(this,cv,s,"f"),Iv(this,hv,l,"f"),Iv(this,dv,c,"f"),Iv(this,Gg,e,"f"),Iv(this,Wg,r,"f"),(null==c?void 0:c.getSettingBoolean(Jh.ParticlesEnabled))?Iv(this,mv,new Ou(a),"f"):Iv(this,mv,null,"f"),null!=Nv(this,cv,"f")&&null!=Nv(this,hv,"f")&&Iv(this,uv,[new $u(Nv(this,$g,"f"),Nv(this,cv,"f"),Nv(this,hv,"f")),new $u(Nv(this,$g,"f"),Nv(this,cv,"f"),Nv(this,hv,"f")),new $u(Nv(this,$g,"f"),Nv(this,cv,"f"),Nv(this,hv,"f")),new $u(Nv(this,$g,"f"),Nv(this,cv,"f"),Nv(this,hv,"f"))],"f"),Iv(this,Hg,new Tu,"f"),Nv(this,Hg,"f").reset(t.position,t.quaternion),a.scene.add(Nv(this,Hg,"f").camera),Iv(this,Vg,new gu,"f"),Nv(this,Vg,"f").reset(t.position,t.quaternion),a.scene.add(Nv(this,Vg,"f").camera),null==Pg.models)throw"Car model isn't loaded yet";if(null!=Nv(this,Gg,"f")&&null!=Nv(this,cv,"f")&&null!=Nv(this,hv,"f"))Iv(this,qg,Nv(this,Gg,"f").createCar(t,Nv(this,cv,"f").getMountainVertices(),Nv(this,cv,"f").getMountainOffset(),Nv(this,hv,"f").getTrackData(),n,(e=>this.setCarState(e))),"f");else{const e=.11898833513259888,n=[new Un(.627909,.27-e,1.3478).applyQuaternion(t.quaternion).add(t.position),new Un(-.627909,.27-e,1.3478).applyQuaternion(t.quaternion).add(t.position),new Un(.720832,.27-e,-1.52686).applyQuaternion(t.quaternion).add(t.position),new Un(-.720832,.27-e,-1.52686).applyQuaternion(t.quaternion).add(t.position)],i=[(new Dn).setFromEuler((new _i).set(0,Math.PI,0)).multiply(t.quaternion),(new Dn).setFromEuler((new _i).set(0,Math.PI,0)).multiply(t.quaternion),(new Dn).setFromEuler((new _i).set(0,Math.PI,0)).multiply(t.quaternion),(new Dn).setFromEuler((new _i).set(0,Math.PI,0)).multiply(t.quaternion)];Iv(this,qg,{id:0,frames:0,totalFrames:0,speedKmh:0,hasStarted:!1,hasFinished:!1,nextCheckpointIndex:0,position:{x:t.position.x,y:t.position.y,z:t.position.z},quaternion:{x:t.quaternion.x,y:t.quaternion.y,z:t.quaternion.z,w:t.quaternion.w},collisionImpulses:[],wheelInContact:[!1,!1,!1,!1],wheelSuspensionLength:[e,e,e,e],wheelSuspensionVelocity:[0,0,0,0],wheelRotation:[0,0,0,0],wheelDeltaRotation:[0,0,0,0],wheelSkidInfo:[0,0,0,0],wheelPosition:n,wheelQuaternion:i,brakeLightEnabled:!1,controls:{up:!1,right:!1,down:!1,left:!1}},"f")}if(Iv(this,Xg,i,"f"),null==n)Iv(this,Yg,null!=Nv(this,Xg,"f"),"f"),Iv(this,Kg,new Ag,"f");else{if(null!=Nv(this,Xg,"f"))throw"Can't control car when recording is set";Iv(this,Yg,!1,"f"),Iv(this,Kg,n,"f")}Iv(this,ev,new Ws,"f"),Nv(this,ev,"f").add(Pg.models.chassis.clone()),Nv(this,ev,"f").add(Pg.models.suspension.clone()),Nv(this,ev,"f").add(Pg.models.wheelFL.clone()),Nv(this,ev,"f").add(Pg.models.wheelFR.clone()),Nv(this,ev,"f").add(Pg.models.wheelBL.clone()),Nv(this,ev,"f").add(Pg.models.wheelBR.clone()),Nv(this,ev,"f").children.forEach((e=>{const t=e;Array.isArray(t.material)?t.material=t.material.map((e=>e.clone())):t.material=t.material.clone(),t.castShadow=!0,t.receiveShadow=!0,t.frustumCulled=!1})),Nv(this,$g,"f").scene.add(Nv(this,ev,"f")),Iv(this,tv,Nv(this,ev,"f").getObjectByName("Body"),"f"),Iv(this,nv,Nv(this,ev,"f").getObjectByName("Suspension"),"f");{const e=document.createElement("canvas");e.width=2048,e.height=2048;const t=e.getContext("2d");if(null==t)throw"Failed to get context for car texture";const n=new Cn(e);let i;n.flipY=!1,n.anisotropy=Nv(this,$g,"f").getMaxAnisotropy(),n.needsUpdate=!0,Iv(this,av,t,"f"),Iv(this,ov,n,"f"),Iv(this,lv,wu.random(),"f"),Nv(this,Cg,"m",yv).call(this),Iv(this,sv,{value:new Un(0,0,0)},"f"),i=Array.isArray(Nv(this,tv,"f").material)?Nv(this,tv,"f").material:[Nv(this,tv,"f").material];for(let e=0;e<i.length;++e){const t=i[e];"Main"==t.name?t.onBeforeCompile=e=>{e.fragmentShader="uniform sampler2D carColorPattern;\nuniform vec3 carColorSecondary;\n"+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );","float colorSource = texture(carColorPattern, vUv).a;\nvec4 diffuseColor = vec4( carColorSecondary * colorSource + diffuse * (1.0 - colorSource), opacity );"),e.uniforms.carColorPattern={value:n},e.uniforms.carColorSecondary=Nv(this,sv,"f"),null==e.defines&&(e.defines={}),e.defines.USE_UV=!0}:"Metal"==t.name?t.needsUpdate=!0:"BrakeLight"==t.name&&Iv(this,rv,t,"f")}}Nv(this,nv,"f").geometry.morphAttributes.position=[];const d=Nv(this,nv,"f"),u=Pg.models.suspensionFL,p=Pg.models.suspensionFR,f=Pg.models.suspensionBL,m=Pg.models.suspensionBR;Nv(this,ev,"f").children.forEach((e=>{if(e!=Nv(this,tv,"f")&&e!=Nv(this,nv,"f")){const t=e;if(!(u.geometry.attributes.position instanceof lr&&p.geometry.attributes.position instanceof lr&&f.geometry.attributes.position instanceof lr&&m.geometry.attributes.position instanceof lr))throw"Vertices must use BufferAttribute";const n=u.geometry.attributes.position.array,i=p.geometry.attributes.position.array,r=f.geometry.attributes.position.array,a=m.geometry.attributes.position.array,o=d.geometry.morphAttributes.position;if("WheelFL"==t.name)o.push(new lr(n,3));else if("WheelFR"==t.name)o.push(new lr(i,3));else if("WheelBL"==t.name)o.push(new lr(r,3));else{if("WheelBR"!=t.name)throw"Unidentified wheel";o.push(new lr(a,3))}Nv(this,iv,"f").push(t)}})),Nv(this,nv,"f").updateMorphTargets(),null!=Nv(this,Xg,"f")&&(null===(h=Nv(this,Gg,"f"))||void 0===h||h.controlCar(Nv(this,qg,"f").id,Nv(this,Xg,"f").up,Nv(this,Xg,"f").right,Nv(this,Xg,"f").down,Nv(this,Xg,"f").left),Nv(this,Xg,"f").addChangeCallback(Iv(this,gv,(e=>{var t;null===(t=Nv(this,Gg,"f"))||void 0===t||t.controlCar(Nv(this,qg,"f").id,e.up,e.right,e.down,e.left)}),"f")))}dispose(){var e,t,n;Iv(this,vv,!0,"f"),Nv(this,Cg,"m",wv).call(this),Nv(this,$g,"f").scene.remove(Nv(this,Hg,"f").camera),Nv(this,$g,"f").scene.remove(Nv(this,Vg,"f").camera),null===(e=Nv(this,mv,"f"))||void 0===e||e.dispose(),Nv(this,uv,"f").forEach((e=>{e.dispose()})),Nv(this,uv,"f").length=0,null!=Nv(this,ev,"f")&&(Nv(this,ev,"f").children.forEach((e=>{const t=e;Array.isArray(t.material)?t.material.forEach((e=>e.dispose())):t.material.dispose(),t.geometry.dispose()})),Nv(this,$g,"f").scene.remove(Nv(this,ev,"f"))),Nv(this,ov,"f").dispose(),null===(t=Nv(this,Gg,"f"))||void 0===t||t.deleteCar(Nv(this,qg,"f").id),null!=Nv(this,gv,"f")&&(null===(n=Nv(this,Xg,"f"))||void 0===n||n.removeChangeCallback(Nv(this,gv,"f")))}addFinishCallback(e){Nv(this,Zg,"f").push(e)}getChassisMatrix(){return null!=Nv(this,tv,"f")?Nv(this,tv,"f").matrix:null}getSpeedKmh(){return Nv(this,qg,"f").speedKmh}start(){var e;null===(e=Nv(this,Gg,"f"))||void 0===e||e.startCar(Nv(this,qg,"f").id,null)}hasStarted(){return Nv(this,qg,"f").hasStarted}hasFinished(){return Nv(this,qg,"f").hasFinished}getRecording(){return Nv(this,Kg,"f")}getTime(){return new rp(Nv(this,qg,"f").frames)}getTotalTime(){return new rp(Nv(this,qg,"f").totalFrames)}getNextCheckpointIndex(){return Nv(this,qg,"f").nextCheckpointIndex}getPosition(){return new Un(Nv(this,qg,"f").position.x,Nv(this,qg,"f").position.y,Nv(this,qg,"f").position.z)}getQuaternion(){return new Dn(Nv(this,qg,"f").quaternion.x,Nv(this,qg,"f").quaternion.y,Nv(this,qg,"f").quaternion.z,Nv(this,qg,"f").quaternion.w)}getMatrix4(){const e=this.getPosition(),t=this.getQuaternion(),n=(new ui).makeRotationFromQuaternion(t);return n.setPosition(e),n}get isPaused(){return Nv(this,jg,"f")}set isPaused(e){var t;Nv(this,jg,"f")!=e&&(null===(t=Nv(this,Gg,"f"))||void 0===t||t.pauseCar(Nv(this,qg,"f").id,e),Iv(this,jg,e,"f"))}getControls(){return null!=Nv(this,Xg,"f")?Nv(this,Xg,"f").getControls():Nv(this,qg,"f").controls}getColors(){return Nv(this,lv,"f")}setColors(e){if(Nv(this,sv,"f").value=(new Un).setFromColor(e.secondary),null!=Nv(this,tv,"f")&&Array.isArray(Nv(this,tv,"f").material))for(let t=0;t<Nv(this,tv,"f").material.length;++t){const n=Nv(this,tv,"f").material[t];"Main"==n.name?n.color.set(e.primary):"Metal"==n.name&&n.color.set(e.frame)}if(null!=Nv(this,nv,"f")&&!Array.isArray(Nv(this,nv,"f").material)){const t=Nv(this,nv,"f").material;"Metal"==t.name&&t.color.set(e.frame)}for(let t=0;t<Nv(this,iv,"f").length;++t){const n=Nv(this,iv,"f")[t];if(Array.isArray(n.material))for(let t=0;t<n.material.length;++t){const i=n.material[t];"Metal"==i.name?i.color.set(e.frame):"Rim"==i.name&&i.color.set(e.rims)}}Iv(this,lv,e,"f")}setOpacity(e){var t;null===(t=Nv(this,ev,"f"))||void 0===t||t.children.forEach((t=>{const n=t;let i;i=Array.isArray(n.material)?n.material:[n.material],i.forEach((t=>{t.opacity=e;const n=e<1;t.needsUpdate=n!=t.transparent,t.transparent=n}))}))}setCarState(e){var t;if(Nv(this,vv,"f"))return;const n=Nv(this,qg,"f");Iv(this,qg,e,"f");const i=Nv(this,qg,"f").frames!=n.frames&&Nv(this,qg,"f").frames!=n.frames+1;Nv(this,qg,"f").nextCheckpointIndex>n.nextCheckpointIndex&&Nv(this,Wg,"f")&&Nv(this,Cg,"m",xv).call(this),Nv(this,qg,"f").hasFinished&&!n.hasFinished&&(Nv(this,Wg,"f")&&Nv(this,Cg,"m",_v).call(this),Nv(this,Zg,"f").forEach((e=>e(this))));const r=.001;i&&(null===(t=Nv(this,mv,"f"))||void 0===t||t.clear(),Nv(this,uv,"f").forEach((e=>{e.clear()}))),this.getTotalTime().numberOfFrames%10==0&&Nv(this,Cg,"m",kv).call(this,.01),i&&(Nv(this,Hg,"f").reset(this.getPosition(),this.getQuaternion()),Nv(this,Vg,"f").reset(this.getPosition(),this.getQuaternion())),Nv(this,qg,"f").hasFinished||(Nv(this,Hg,"f").update(this.getPosition(),this.getQuaternion(),this.getSpeedKmh()),Nv(this,Vg,"f").update(this.getPosition(),this.getQuaternion(),this.getSpeedKmh())),Nv(this,Cg,"m",Mv).call(this,r),Nv(this,Cg,"m",Av).call(this,r),Nv(this,Yg,"f")&&Nv(this,qg,"f").hasStarted&&!Nv(this,qg,"f").hasFinished&&Nv(this,Kg,"f").recordFrame(n.frames,Nv(this,qg,"f").controls)}update(e){var t,n,i;if(null!=Nv(this,tv,"f")&&null!=Nv(this,nv,"f")){Nv(this,Cg,"m",Ev).call(this),null===(t=Nv(this,mv,"f"))||void 0===t||t.update(e);const r=this.getMatrix4(),a=this.getQuaternion();Nv(this,tv,"f").matrixAutoUpdate=!1,Nv(this,tv,"f").matrix.copy(r),Nv(this,tv,"f").matrix.multiply((new ui).makeTranslation(0,Pg.massOffset,0)),Nv(this,nv,"f").matrixAutoUpdate=!1,Nv(this,nv,"f").matrix.copy(Nv(this,tv,"f").matrix);const o=4;for(let t=0;t<o;t++){const r=Nv(this,qg,"f").wheelInContact[t],o=Nv(this,qg,"f").wheelDeltaRotation[t];if(this.hasStarted()){if(r)Nv(this,Jg,"f")[t]=1e3*o;else{const{up:i,down:r}=null!==(n=this.getControls())&&void 0!==n?n:{up:!1,down:!1};(2==t||3==t)&&(i?Nv(this,Jg,"f")[t]+=50*e:r&&(Nv(this,Jg,"f")[t]-=25*e)),Nv(this,Jg,"f")[t]*=Math.max(0,1-e)}Nv(this,Qg,"f")[t]+=Nv(this,Jg,"f")[t]*e}const s=Nv(this,qg,"f").wheelPosition[t],l=new Dn(Nv(this,qg,"f").wheelQuaternion[t].x,Nv(this,qg,"f").wheelQuaternion[t].y,Nv(this,qg,"f").wheelQuaternion[t].z,Nv(this,qg,"f").wheelQuaternion[t].w),c=Nv(this,qg,"f").wheelRotation[t];l.multiply((new Dn).setFromAxisAngle(new Un(-1,0,0),Nv(this,Qg,"f")[t]-c)),Nv(this,iv,"f")[t].position.set(s.x,s.y,s.z),Nv(this,iv,"f")[t].quaternion.set(l.x,l.y,l.z,l.w);const h=Nv(this,qg,"f").wheelSuspensionLength[t],d=Nv(this,qg,"f").wheelSkidInfo[t];Nv(this,nv,"f").morphTargetInfluences||(Nv(this,nv,"f").morphTargetInfluences=[]),Nv(this,nv,"f").morphTargetInfluences[t]=2*h+.06,e>0&&(null===(i=Nv(this,dv,"f"))||void 0===i?void 0:i.getSettingBoolean(Jh.SkidmarksEnabled))&&t<Nv(this,uv,"f").length&&r&&o>.06&&d<.5&&0==Nv(this,fv,"f")[t]&&Nv(this,uv,"f")[t].spawn(s.x,s.y,s.z,a)}Nv(this,Cg,"m",Rv).call(this,Nv(this,qg,"f").brakeLightEnabled)}}get cameraOrbit(){return Nv(this,Hg,"f").camera}get cameraCockpit(){return Nv(this,Vg,"f").camera}set audioVolume(e){Iv(this,Ig,e,"f"),null!=Nv(this,Lg,"f")&&Nv(this,Lg,"f").gain.setTargetAtTime(Nv(this,Ig,"f"),0,.01)}static initResources(e){e.addResource();(new fd).load("models/car.glb",(t=>{function n(e){const n=t.scene.getObjectByName(e);if(null==n)throw'Mesh "'+e+'" does not exist';if(0==n.children.length){const e=n;return e.updateMatrixWorld(!0),e.geometry.applyMatrix4(e.matrix.clone()),e.matrix.identity(),e}const i=dd(n.children.map((e=>e.geometry)),!0);n.updateMatrixWorld(!0),i.applyMatrix4(n.matrix.clone());const r=n.children.map((e=>e.material)),a=new Br(i,r);return a.name=e,a}function i(e){let t;return t=Array.isArray(e.material)?e.material:[e.material],t.forEach((e=>e.side=M)),e}Pg.models={chassis:i(n("Body")),suspension:i(n("Suspension")),suspensionFL:i(n("SuspensionFL")),suspensionFR:i(n("SuspensionFR")),suspensionBL:i(n("SuspensionBL")),suspensionBR:i(n("SuspensionBR")),wheelFL:i(n("WheelFL")),wheelFR:i(n("WheelFR")),wheelBL:i(n("WheelBL")),wheelBR:i(n("WheelBR")),collisionShapeVertices:Nv(Pg,Pg,"m",Lv).call(Pg,n("Collision"))},Pg.models.wheelFL.geometry.translate(-.627909,.218824,-1.3478),Pg.models.wheelFR.geometry.translate(.627909,.218824,-1.3478),Pg.models.wheelBL.geometry.translate(-.720832,.218824,1.52686),Pg.models.wheelBR.geometry.translate(.720832,.218824,1.52686),Pg.models.wheelFL.geometry.rotateZ(Math.PI),Pg.models.wheelFR.geometry.rotateZ(Math.PI),Pg.models.wheelBL.geometry.rotateZ(Math.PI),Pg.models.wheelBR.geometry.rotateZ(Math.PI),e.loadedResource()})),e.addResource();const t=new Image;t.addEventListener("load",(()=>{e.loadedResource()})),t.src="images/car_stripe.svg",Pg.images={stripe:t}}}Pg=Dv,Rg=new WeakMap,Lg=new WeakMap,Ig=new WeakMap,Ng=new WeakMap,Dg=new WeakMap,Ug=new WeakMap,Bg=new WeakMap,Og=new WeakMap,zg=new WeakMap,Fg=new WeakMap,Wg=new WeakMap,Hg=new WeakMap,Vg=new WeakMap,Gg=new WeakMap,jg=new WeakMap,qg=new WeakMap,Xg=new WeakMap,Yg=new WeakMap,Kg=new WeakMap,Zg=new WeakMap,Jg=new WeakMap,Qg=new WeakMap,$g=new WeakMap,ev=new WeakMap,tv=new WeakMap,nv=new WeakMap,iv=new WeakMap,rv=new WeakMap,av=new WeakMap,ov=new WeakMap,sv=new WeakMap,lv=new WeakMap,cv=new WeakMap,hv=new WeakMap,dv=new WeakMap,uv=new WeakMap,pv=new WeakMap,fv=new WeakMap,mv=new WeakMap,gv=new WeakMap,vv=new WeakMap,Cg=new WeakSet,wv=function(){Nv(this,Cg,"m",bv).call(this),setTimeout((()=>{null!=Nv(this,Ng,"f")&&(Nv(this,Ng,"f").source.stop(),Iv(this,Ng,null,"f")),null!=Nv(this,Bg,"f")&&(Nv(this,Bg,"f").forEach((({source:e})=>{e.stop()})),Iv(this,Bg,null,"f"))}),200)},yv=function(){if(null==Pg.images)throw"Car images are not loaded yet";Nv(this,av,"f").clearRect(0,0,Nv(this,av,"f").canvas.width,Nv(this,av,"f").canvas.height),Nv(this,av,"f").drawImage(Pg.images.stripe,0,0,Nv(this,av,"f").canvas.width,Nv(this,av,"f").canvas.height),Nv(this,ov,"f").needsUpdate=!0},bv=function(){if(null!=Nv(this,Ng,"f")&&(Nv(this,Ng,"f").source.playbackRate.setTargetAtTime(.7,0,.15),Nv(this,Ng,"f").gain.gain.setTargetAtTime(0,0,.15)),null!=Nv(this,Bg,"f"))for(let e=0;e<Nv(this,Bg,"f").length;++e){const t=Nv(this,Bg,"f")[e];t.source.playbackRate.setTargetAtTime(.3,0,.15),t.gain.gain.setTargetAtTime(0,0,.15)}null!=Nv(this,pv,"f")&&(Nv(this,pv,"f").forEach((({source:e})=>{e.stop()})),Iv(this,pv,null,"f"))},xv=function(){var e,t;const n=null!==(t=null===(e=Nv(this,dv,"f"))||void 0===e?void 0:e.getSettingFloat(Jh.CheckpointVolume))&&void 0!==t?t:0;let i=Math.min(Math.max(Nv(this,Ig,"f")*n,0),1);if(Number.isNaN(i)&&(i=0),i>0&&null!=Nv(this,Rg,"f")){const e=Nv(this,Rg,"f").getBuffer("checkpoint");if(null!=e&&null!=Nv(this,Rg,"f").context&&null!=Nv(this,Rg,"f").destinationMaster){const t=Nv(this,Rg,"f").context.createBufferSource();t.buffer=e,t.playbackRate.value=1.25;const n=Nv(this,Rg,"f").context.createGain();n.gain.value=.03*i,t.connect(n),n.connect(Nv(this,Rg,"f").destinationMaster),t.start(0)}}},_v=function(){var e,t;const n=null!==(t=null===(e=Nv(this,dv,"f"))||void 0===e?void 0:e.getSettingFloat(Jh.CheckpointVolume))&&void 0!==t?t:0;let i=Math.min(Math.max(Nv(this,Ig,"f")*n,0),1);if(Number.isNaN(i)&&(i=0),i>0&&null!=Nv(this,Rg,"f")){const e=Nv(this,Rg,"f").getBuffer("finish");if(null!=e&&null!=Nv(this,Rg,"f").context&&null!=Nv(this,Rg,"f").destinationMaster){const t=Nv(this,Rg,"f").context.createBufferSource();t.buffer=e,t.playbackRate.value=1.25;const n=Nv(this,Rg,"f").context.createGain();n.gain.value=.03,t.connect(n),n.connect(Nv(this,Rg,"f").destinationMaster),t.start(0)}}},kv=function(e){var t;for(let n=0;n<4;n++){const i=Nv(this,qg,"f").wheelPosition[n],r=Nv(this,qg,"f").wheelInContact[n],a=Nv(this,qg,"f").wheelDeltaRotation[n],o=Nv(this,qg,"f").wheelSkidInfo[n];r&&a>.06&&o<.5?(n<Nv(this,uv,"f").length&&(Nv(this,fv,"f")[n]=Math.max(0,Nv(this,fv,"f")[n]-e)),0==Nv(this,fv,"f")[n]&&null!=Nv(this,mv,"f")&&Nv(this,mv,"f").spawn(i.x,i.y,i.z)):(n<Nv(this,uv,"f").length&&(null===(t=Nv(this,dv,"f"))||void 0===t?void 0:t.getSettingBoolean(Jh.SkidmarksEnabled))&&Nv(this,uv,"f")[n].break(),Nv(this,fv,"f")[n]=.075)}},Ev=function(){if(null!=Nv(this,Rg,"f")&&null!=Nv(this,Rg,"f").context&&null!=Nv(this,Rg,"f").destinationSfx){null==Nv(this,Lg,"f")&&(Iv(this,Lg,Nv(this,Rg,"f").context.createGain(),"f"),Nv(this,Lg,"f").gain.value=Nv(this,Ig,"f"),Nv(this,Lg,"f").connect(Nv(this,Rg,"f").destinationSfx)),null==Nv(this,zg,"f")&&(Iv(this,zg,Nv(this,Rg,"f").context.createPanner(),"f"),Nv(this,zg,"f").refDistance=5,Nv(this,zg,"f").connect(Nv(this,Lg,"f")));const e=this.getPosition();Nv(this,zg,"f").positionX.value=e.x,Nv(this,zg,"f").positionY.value=e.y,Nv(this,zg,"f").positionZ.value=e.z;const t=4;if(Nv(this,Fg,"f").length<t){Nv(this,Fg,"f").length=0;for(let e=0;e<t;++e){const e=Nv(this,Rg,"f").context.createPanner();e.refDistance=5,e.connect(Nv(this,Lg,"f")),Nv(this,Fg,"f").push(e)}}for(let e=0;e<t;++e){const t=Nv(this,Fg,"f")[e],n=Nv(this,qg,"f").wheelPosition[e];t.positionX.value=n.x,t.positionY.value=n.y,t.positionZ.value=n.z}Nv(this,$g,"f").camera!=Nv(this,Hg,"f").camera&&Nv(this,$g,"f").camera!=Nv(this,Vg,"f").camera||Nv(this,Rg,"f").refreshListener(Nv(this,$g,"f")),Nv(this,Cg,"m",Sv).call(this),Nv(this,Cg,"m",Tv).call(this),Nv(this,Cg,"m",Pv).call(this)}},Sv=function(){var e;if(null==Nv(this,Ng,"f")&&null!=Nv(this,zg,"f")&&null!=Nv(this,Rg,"f")){const e=Nv(this,Rg,"f").getBuffer("engine");if(null!=e&&null!=Nv(this,Rg,"f").context){const t=Nv(this,Rg,"f").context.createBufferSource();t.buffer=e,t.loop=!0,t.playbackRate.value=.7;const n=Nv(this,Rg,"f").context.createGain();n.gain.value=0,t.connect(n),n.connect(Nv(this,zg,"f")),t.start(0,2*Math.random()),Iv(this,Ng,{source:t,gain:n},"f")}}if(null!=Nv(this,Ng,"f")){const t=(Nv(this,Jg,"f")[0]+Nv(this,Jg,"f")[1]+Nv(this,Jg,"f")[2]+Nv(this,Jg,"f")[3])/4,n=.7+Math.pow(Math.abs(t),1/3)/3,i=Nv(this,qg,"f").wheelInContact[0]||Nv(this,qg,"f").wheelInContact[1]||Nv(this,qg,"f").wheelInContact[2]||Nv(this,qg,"f").wheelInContact[3],{up:r,down:a}=null!==(e=this.getControls())&&void 0!==e?e:{up:!1,down:!1};i?(r||a&&t<0)&&this.hasStarted()&&!this.hasFinished()?Iv(this,Dg,n,"f"):Iv(this,Dg,Math.max(.7,n/2),"f"):(r||a&&t<0)&&this.hasStarted()&&!this.hasFinished()?Iv(this,Dg,Math.max(.7,1.15*n),"f"):Iv(this,Dg,Math.max(.7,n/2),"f"),Nv(this,Ng,"f").source.playbackRate.setTargetAtTime(Nv(this,Dg,"f"),0,.05),Nv(this,Ng,"f").gain.gain.setTargetAtTime(Math.min(.285,Nv(this,Dg,"f")/14),0,.05)}},Mv=function(e){if(Nv(this,Ug,"f").length<4){Nv(this,Ug,"f").length=0;for(let e=0;e<4;++e)Nv(this,Ug,"f").push(0)}for(let t=0;t<4&&t<Nv(this,Fg,"f").length;t++)if(Nv(this,Ug,"f")[t]-=e,Nv(this,Ug,"f")[t]<=0){const e=Math.abs(Nv(this,qg,"f").wheelSuspensionVelocity[t]);if(e>4&&null!=Nv(this,Rg,"f")){const n=Nv(this,Rg,"f").getBuffer("suspension");if(null!=n&&null!=Nv(this,Rg,"f").context){const i=Nv(this,Rg,"f").context.createBufferSource();i.buffer=n,i.playbackRate.value=.7+.1*Math.random();const r=Nv(this,Rg,"f").context.createGain();r.gain.value=Math.min(.285,e/140),i.connect(r),r.connect(Nv(this,Fg,"f")[t]),i.start(Nv(this,Rg,"f").context.currentTime+.02*Math.random()),Nv(this,Ug,"f")[t]=.1}}}},Tv=function(){if(null==Nv(this,Bg,"f")&&null!=Nv(this,Rg,"f")){const e=Nv(this,Rg,"f").getBuffer("tires");if(null!=e&&null!=Nv(this,Rg,"f").context){Iv(this,Bg,[],"f");const t=4;for(let n=0;n<t;n++){const i=Nv(this,Rg,"f").context.createBufferSource();i.buffer=e,i.loop=!0,i.playbackRate.value=.3;const r=Nv(this,Rg,"f").context.createGain();r.gain.value=0,i.connect(r),r.connect(Nv(this,Fg,"f")[n]),i.start(0,n/t*3.5+.25*Math.random()),Nv(this,Bg,"f").push({source:i,gain:r})}}}if(null!=Nv(this,Bg,"f"))for(let e=0;e<Nv(this,Bg,"f").length;++e){const t=Nv(this,Bg,"f")[e];if(Nv(this,qg,"f").wheelInContact[e]){const e=Math.min(3,Math.abs(this.getSpeedKmh())/110);t.gain.gain.setTargetAtTime(e/10.5,0,.15)}else t.gain.gain.setTargetAtTime(0,0,.15);const n=.3+Math.min(.4,Math.abs(this.getSpeedKmh())/800);t.source.playbackRate.setTargetAtTime(n,0,.15)}},Av=function(e){null!=Nv(this,Og,"f")&&(Nv(this,Og,"f").timeout-=e,Nv(this,Og,"f").timeout<=0&&Iv(this,Og,null,"f"));Nv(this,qg,"f").collisionImpulses.forEach((e=>{Nv(this,Cg,"m",Cv).call(this,e)}))},Cv=function(e){if(e>25&&null!=Nv(this,zg,"f")&&null!=Nv(this,Rg,"f")&&(null==Nv(this,Og,"f")||Nv(this,Og,"f").impulse+100<e)){Iv(this,Og,{timeout:.2,impulse:e},"f");const t=Nv(this,Rg,"f").getBuffer("collision");if(null!=t&&null!=Nv(this,Rg,"f").context){const n=Nv(this,Rg,"f").context.createBufferSource();n.buffer=t,n.playbackRate.value=.5-.3*Math.max(0,Math.min(1,e/1e3))+.2*Math.random();const i=Nv(this,Rg,"f").context.createGain();i.gain.value=Math.max(.3,Math.min(e/2e3,1))/3.5,n.connect(i),i.connect(Nv(this,zg,"f")),n.start(0)}}},Pv=function(){if(null==Nv(this,pv,"f")&&null!=Nv(this,Rg,"f")){const e=Nv(this,Rg,"f").getBuffer("skidding");if(null!=e&&null!=Nv(this,Rg,"f").context){Iv(this,pv,[],"f");const t=4;for(let n=0;n<t;++n){const i=Nv(this,Rg,"f").context.createBufferSource();i.buffer=e,i.loop=!0,i.playbackRate.value=.5;const r=Nv(this,Rg,"f").context.createGain();r.gain.value=0,i.connect(r),r.connect(Nv(this,Fg,"f")[n]),i.start(0,n/t*3.5+.25*Math.random()),Nv(this,pv,"f").push({source:i,gain:r})}}}if(null!=Nv(this,pv,"f"))for(let e=0;e<Nv(this,pv,"f").length;++e){const t=Nv(this,pv,"f")[e];0==Nv(this,fv,"f")[e]?t.gain.gain.setTargetAtTime(.75/3.5,0,.1):t.gain.gain.setTargetAtTime(0,0,.1)}},Rv=function(e){null!=Nv(this,rv,"f")&&(e?Nv(this,rv,"f").emissive.setRGB(1,.4,.3):Nv(this,rv,"f").emissive.setRGB(0,0,0))},Lv=function(e){const t=e.geometry.toNonIndexed();if(!(t.attributes.position instanceof lr))throw"Vertices must use BufferAttribute";return Array.from(t.attributes.position.array)},Dv.massOffset=.6,Dv.models=null,Dv.images=null;const Uv=Dv;var Bv=n(959),Ov={};Ov.styleTagTransform=u(),Ov.setAttributes=l(),Ov.insert=o().bind(null,"head"),Ov.domAPI=r(),Ov.insertStyleElement=h();t()(Bv.A,Ov);Bv.A&&Bv.A.locals&&Bv.A.locals;const zv={type:"change"},Fv={type:"start"},Wv={type:"end"},Hv=new di,Vv=new ia,Gv=Math.cos(70*sn.DEG2RAD);class jv extends Kt{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Un,this.cursor=new Un,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:g,MIDDLE:v,RIGHT:w},this.touches={ONE:y,TWO:x},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(e){e.addEventListener("keydown",ne),this._domElementKeyEvents=e},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",ne),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(zv),n.update(),r=i.NONE},this.update=function(){const t=new Un,h=(new Dn).setFromUnitVectors(e.up,new Un(0,1,0)),d=h.clone().invert(),u=new Un,p=new Dn,f=new Un,m=2*Math.PI;return function(g=null){const v=n.object.position;t.copy(v).sub(n.target),t.applyQuaternion(h),o.setFromVector3(t),n.autoRotate&&r===i.NONE&&I(function(e){return null!==e?2*Math.PI/60*n.autoRotateSpeed*e:2*Math.PI/60/60*n.autoRotateSpeed}(g)),n.enableDamping?(o.theta+=s.theta*n.dampingFactor,o.phi+=s.phi*n.dampingFactor):(o.theta+=s.theta,o.phi+=s.phi);let w=n.minAzimuthAngle,y=n.maxAzimuthAngle;isFinite(w)&&isFinite(y)&&(w<-Math.PI?w+=m:w>Math.PI&&(w-=m),y<-Math.PI?y+=m:y>Math.PI&&(y-=m),o.theta=w<=y?Math.max(w,Math.min(y,o.theta)):o.theta>(w+y)/2?Math.max(w,o.theta):Math.min(y,o.theta)),o.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,o.phi)),o.makeSafe(),!0===n.enableDamping?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let b=!1;if(n.zoomToCursor&&A||n.object.isOrthographicCamera)o.radius=W(o.radius);else{const e=o.radius;o.radius=W(o.radius*l),b=e!=o.radius}if(t.setFromSpherical(o),t.applyQuaternion(d),v.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(s.theta*=1-n.dampingFactor,s.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(s.set(0,0,0),c.set(0,0,0)),n.zoomToCursor&&A){let i=null;if(n.object.isPerspectiveCamera){const e=t.length();i=W(e*l);const r=e-i;n.object.position.addScaledVector(M,r),n.object.updateMatrixWorld(),b=!!r}else if(n.object.isOrthographicCamera){const e=new Un(T.x,T.y,0);e.unproject(n.object);const r=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),b=r!==n.object.zoom;const a=new Un(T.x,T.y,0);a.unproject(n.object),n.object.position.sub(a).add(e),n.object.updateMatrixWorld(),i=t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;null!==i&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(i).add(n.object.position):(Hv.origin.copy(n.object.position),Hv.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Hv.direction))<Gv?e.lookAt(n.target):(Vv.setFromNormalAndCoplanarPoint(n.object.up,n.target),Hv.intersectPlane(Vv,n.target))))}else if(n.object.isOrthographicCamera){const e=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),e!==n.object.zoom&&(n.object.updateProjectionMatrix(),b=!0)}return l=1,A=!1,!!(b||u.distanceToSquared(n.object.position)>a||8*(1-p.dot(n.object.quaternion))>a||f.distanceToSquared(n.target)>a)&&(n.dispatchEvent(zv),u.copy(n.object.position),p.copy(n.object.quaternion),f.copy(n.target),!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",re),n.domElement.removeEventListener("pointerdown",Z),n.domElement.removeEventListener("pointercancel",Q),n.domElement.removeEventListener("wheel",$),n.domElement.removeEventListener("pointermove",J),n.domElement.removeEventListener("pointerup",Q);n.domElement.getRootNode().removeEventListener("keydown",ee,{capture:!0}),null!==n._domElementKeyEvents&&(n._domElementKeyEvents.removeEventListener("keydown",ne),n._domElementKeyEvents=null)};const n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=i.NONE;const a=1e-6,o=new Yh,s=new Yh;let l=1;const c=new Un,h=new ln,d=new ln,u=new ln,p=new ln,f=new ln,m=new ln,k=new ln,E=new ln,S=new ln,M=new Un,T=new ln;let A=!1;const C=[],P={};let R=!1;function L(e){const t=Math.abs(.01*e);return Math.pow(.95,n.zoomSpeed*t)}function I(e){s.theta-=e}function N(e){s.phi-=e}const D=function(){const e=new Un;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),c.add(e)}}(),U=function(){const e=new Un;return function(t,i){!0===n.screenSpacePanning?e.setFromMatrixColumn(i,1):(e.setFromMatrixColumn(i,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),c.add(e)}}(),B=function(){const e=new Un;return function(t,i){const r=n.domElement;if(n.object.isPerspectiveCamera){const a=n.object.position;e.copy(a).sub(n.target);let o=e.length();o*=Math.tan(n.object.fov/2*Math.PI/180),D(2*t*o/r.clientHeight,n.object.matrix),U(2*i*o/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(D(t*(n.object.right-n.object.left)/n.object.zoom/r.clientWidth,n.object.matrix),U(i*(n.object.top-n.object.bottom)/n.object.zoom/r.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function O(e){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function z(e){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function F(e,t){if(!n.zoomToCursor)return;A=!0;const i=n.domElement.getBoundingClientRect(),r=e-i.left,a=t-i.top,o=i.width,s=i.height;T.x=r/o*2-1,T.y=-a/s*2+1,M.set(T.x,T.y,1).unproject(n.object).sub(n.object.position).normalize()}function W(e){return Math.max(n.minDistance,Math.min(n.maxDistance,e))}function H(e){h.set(e.clientX,e.clientY)}function V(e){p.set(e.clientX,e.clientY)}function G(e){if(1===C.length)h.set(e.pageX,e.pageY);else{const t=oe(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);h.set(n,i)}}function j(e){if(1===C.length)p.set(e.pageX,e.pageY);else{const t=oe(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);p.set(n,i)}}function q(e){const t=oe(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);k.set(0,r)}function X(e){if(1==C.length)d.set(e.pageX,e.pageY);else{const t=oe(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);d.set(n,i)}u.subVectors(d,h).multiplyScalar(n.rotateSpeed);const t=n.domElement;I(2*Math.PI*u.x/t.clientHeight),N(2*Math.PI*u.y/t.clientHeight),h.copy(d)}function Y(e){if(1===C.length)f.set(e.pageX,e.pageY);else{const t=oe(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);f.set(n,i)}m.subVectors(f,p).multiplyScalar(n.panSpeed),B(m.x,m.y),p.copy(f)}function K(e){const t=oe(e),i=e.pageX-t.x,r=e.pageY-t.y,a=Math.sqrt(i*i+r*r);E.set(0,a),S.set(0,Math.pow(E.y/k.y,n.zoomSpeed)),O(S.y),k.copy(E);F(.5*(e.pageX+t.x),.5*(e.pageY+t.y))}function Z(e){!1!==n.enabled&&(0===C.length&&(n.domElement.setPointerCapture(e.pointerId),n.domElement.addEventListener("pointermove",J),n.domElement.addEventListener("pointerup",Q)),function(e){for(let t=0;t<C.length;t++)if(C[t]==e.pointerId)return!0;return!1}(e)||(function(e){C.push(e.pointerId)}(e),"touch"===e.pointerType?ie(e):function(e){let t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case v:if(!1===n.enableZoom)return;!function(e){F(e.clientX,e.clientX),k.set(e.clientX,e.clientY)}(e),r=i.DOLLY;break;case g:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;V(e),r=i.PAN}else{if(!1===n.enableRotate)return;H(e),r=i.ROTATE}break;case w:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;H(e),r=i.ROTATE}else{if(!1===n.enablePan)return;V(e),r=i.PAN}break;default:r=i.NONE}r!==i.NONE&&n.dispatchEvent(Fv)}(e)))}function J(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(ae(e),r){case i.TOUCH_ROTATE:if(!1===n.enableRotate)return;X(e),n.update();break;case i.TOUCH_PAN:if(!1===n.enablePan)return;Y(e),n.update();break;case i.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&K(e),n.enablePan&&Y(e)}(e),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&K(e),n.enableRotate&&X(e)}(e),n.update();break;default:r=i.NONE}}(e):function(e){switch(r){case i.ROTATE:if(!1===n.enableRotate)return;!function(e){d.set(e.clientX,e.clientY),u.subVectors(d,h).multiplyScalar(n.rotateSpeed);const t=n.domElement;I(2*Math.PI*u.x/t.clientHeight),N(2*Math.PI*u.y/t.clientHeight),h.copy(d),n.update()}(e);break;case i.DOLLY:if(!1===n.enableZoom)return;!function(e){E.set(e.clientX,e.clientY),S.subVectors(E,k),S.y>0?O(L(S.y)):S.y<0&&z(L(S.y)),k.copy(E),n.update()}(e);break;case i.PAN:if(!1===n.enablePan)return;!function(e){f.set(e.clientX,e.clientY),m.subVectors(f,p).multiplyScalar(n.panSpeed),B(m.x,m.y),p.copy(f),n.update()}(e)}}(e))}function Q(e){switch(function(e){delete P[e.pointerId];for(let t=0;t<C.length;t++)if(C[t]==e.pointerId)return void C.splice(t,1)}(e),C.length){case 0:n.domElement.releasePointerCapture(e.pointerId),n.domElement.removeEventListener("pointermove",J),n.domElement.removeEventListener("pointerup",Q),n.dispatchEvent(Wv),r=i.NONE;break;case 1:const t=C[0],a=P[t];ie({pointerId:t,pageX:a.x,pageY:a.y})}}function $(e){!1!==n.enabled&&!1!==n.enableZoom&&r===i.NONE&&(e.preventDefault(),n.dispatchEvent(Fv),function(e){F(e.clientX,e.clientY),e.deltaY<0?z(L(e.deltaY)):e.deltaY>0&&O(L(e.deltaY)),n.update()}(function(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100}e.ctrlKey&&!R&&(n.deltaY*=10);return n}(e)),n.dispatchEvent(Wv))}function ee(e){if("Control"===e.key){R=!0;n.domElement.getRootNode().addEventListener("keyup",te,{passive:!0,capture:!0})}}function te(e){if("Control"===e.key){R=!1;n.domElement.getRootNode().removeEventListener("keyup",te,{passive:!0,capture:!0})}}function ne(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?N(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):B(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?N(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):B(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?I(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):B(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?I(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):B(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function ie(e){switch(ae(e),C.length){case 1:switch(n.touches.ONE){case y:if(!1===n.enableRotate)return;G(e),r=i.TOUCH_ROTATE;break;case b:if(!1===n.enablePan)return;j(e),r=i.TOUCH_PAN;break;default:r=i.NONE}break;case 2:switch(n.touches.TWO){case x:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&q(e),n.enablePan&&j(e)}(e),r=i.TOUCH_DOLLY_PAN;break;case _:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&q(e),n.enableRotate&&G(e)}(e),r=i.TOUCH_DOLLY_ROTATE;break;default:r=i.NONE}break;default:r=i.NONE}r!==i.NONE&&n.dispatchEvent(Fv)}function re(e){!1!==n.enabled&&e.preventDefault()}function ae(e){let t=P[e.pointerId];void 0===t&&(t=new ln,P[e.pointerId]=t),t.set(e.pageX,e.pageY)}function oe(e){const t=e.pointerId===C[0]?C[1]:C[0];return P[t]}n.domElement.addEventListener("contextmenu",re),n.domElement.addEventListener("pointerdown",Z),n.domElement.addEventListener("pointercancel",Q),n.domElement.addEventListener("wheel",$,{passive:!1});n.domElement.getRootNode().addEventListener("keydown",ee,{passive:!0,capture:!0}),this.update()}}var qv=n(848),Xv={};Xv.styleTagTransform=u(),Xv.setAttributes=l(),Xv.insert=o().bind(null,"head"),Xv.domAPI=r(),Xv.insertStyleElement=h();t()(qv.A,Xv);qv.A&&qv.A.locals&&qv.A.locals;var Yv,Kv,Zv,Jv,Qv,$v,ew,tw,nw,iw,rw,aw,ow,sw,lw,cw,hw,dw,uw,pw=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},fw=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Kv=new WeakMap,Zv=new WeakMap,Jv=new WeakMap,Qv=new WeakMap,$v=new WeakMap,ew=new WeakMap,tw=new WeakMap,nw=new WeakMap,iw=new WeakMap,rw=new WeakMap,aw=new WeakMap,ow=new WeakMap,sw=new WeakMap,lw=new WeakMap,cw=new WeakMap,hw=new WeakMap,Yv=new WeakSet,dw=function(){fw(this,nw,"f").style.left="calc("+100*fw(this,ow,"f")/360+"% - 1px)",fw(this,Qv,"f").style.backgroundImage="linear-gradient(transparent, #000), linear-gradient(to right, transparent, hsla("+fw(this,ow,"f")+", 100%, 50%, 1))"},uw=function(){fw(this,$v,"f").style.left="calc("+fw(this,aw,"f")+"% - 6px)",fw(this,$v,"f").style.top="calc("+(100-fw(this,rw,"f"))+"% - 6px)"};const mw=class{constructor(e,t){Yv.add(this),Kv.set(this,void 0),Zv.set(this,void 0),Jv.set(this,void 0),Qv.set(this,void 0),$v.set(this,void 0),ew.set(this,!1),tw.set(this,void 0),nw.set(this,void 0),iw.set(this,!1),rw.set(this,0),aw.set(this,0),ow.set(this,0),sw.set(this,void 0),lw.set(this,void 0),cw.set(this,void 0),hw.set(this,void 0),pw(this,Kv,e,"f"),pw(this,Zv,t,"f"),pw(this,Jv,document.createElement("div"),"f"),fw(this,Jv,"f").className="color-picker",pw(this,Qv,document.createElement("div"),"f"),fw(this,Qv,"f").className="value-saturation-picker",fw(this,Jv,"f").appendChild(fw(this,Qv,"f")),pw(this,$v,document.createElement("div"),"f"),fw(this,$v,"f").className="marker",fw(this,Qv,"f").appendChild(fw(this,$v,"f")),pw(this,tw,document.createElement("div"),"f"),fw(this,tw,"f").className="hue-picker",fw(this,Jv,"f").appendChild(fw(this,tw,"f")),pw(this,nw,document.createElement("div"),"f"),fw(this,nw,"f").className="marker",fw(this,tw,"f").appendChild(fw(this,nw,"f")),fw(this,Kv,"f").appendChild(fw(this,Jv,"f"));pw(this,sw,(e=>{let n=null;if(e instanceof MouseEvent?fw(this,ew,"f")&&(n=e):e instanceof TouchEvent&&e.targetTouches.length>0&&(n=e.targetTouches[e.targetTouches.length-1]),null!=n){const e=fw(this,Qv,"f").getBoundingClientRect(),i=Math.max(0,Math.min(1,(n.clientX-e.left)/e.width)),r=Math.max(0,Math.min(1,(n.clientY-e.top)/e.height));pw(this,aw,100*i,"f"),pw(this,rw,100*(1-r),"f"),fw(this,Yv,"m",uw).call(this),t(this.color)}}),"f"),pw(this,lw,(e=>{0==e.button&&pw(this,ew,!1,"f")}),"f"),fw(this,Qv,"f").addEventListener("mousedown",(e=>{0==e.button&&pw(this,ew,!0,"f"),fw(this,sw,"f").call(this,e)})),window.addEventListener("mouseup",fw(this,lw,"f")),window.addEventListener("mousemove",fw(this,sw,"f")),fw(this,Qv,"f").addEventListener("touchstart",fw(this,sw,"f")),fw(this,Qv,"f").addEventListener("touchmove",fw(this,sw,"f")),pw(this,cw,(e=>{let n=null;if(e instanceof MouseEvent?fw(this,iw,"f")&&(n=e):e instanceof TouchEvent&&e.targetTouches.length>0&&(n=e.targetTouches[e.targetTouches.length-1]),null!=n){const e=fw(this,tw,"f").getBoundingClientRect(),i=Math.max(0,Math.min(1,(n.clientX-e.left)/e.width));pw(this,ow,360*i,"f"),fw(this,Yv,"m",dw).call(this),t(this.color)}}),"f"),pw(this,hw,(e=>{0==e.button&&pw(this,iw,!1,"f")}),"f"),fw(this,tw,"f").addEventListener("mousedown",(e=>{0==e.button&&pw(this,iw,!0,"f"),fw(this,cw,"f").call(this,e)})),window.addEventListener("mouseup",fw(this,hw,"f")),window.addEventListener("mousemove",fw(this,cw,"f")),fw(this,tw,"f").addEventListener("touchstart",fw(this,cw,"f")),fw(this,tw,"f").addEventListener("touchmove",fw(this,cw,"f")),fw(this,Yv,"m",dw).call(this),fw(this,Yv,"m",uw).call(this)}dispose(){window.removeEventListener("mouseup",fw(this,lw,"f")),window.removeEventListener("mousemove",fw(this,sw,"f")),window.removeEventListener("mouseup",fw(this,hw,"f")),window.removeEventListener("mousemove",fw(this,cw,"f"))}get color(){const e=fw(this,aw,"f")/100,t=fw(this,rw,"f")/100,n=t-t*e/2,i=Math.min(n,1-n),r=0!=i?(t-n)/i:0;return new tr("hsl("+fw(this,ow,"f")+","+100*r+"%,"+100*n+"%)")}set color(e){const{h:t,s:n,l:i}=e.getHSL({h:0,s:0,l:0},At),r=i+n*Math.min(i,1-i),a=0==r?0:2*(1-i/r);pw(this,ow,360*t,"f"),pw(this,aw,100*a,"f"),pw(this,rw,100*r,"f"),fw(this,Yv,"m",dw).call(this),fw(this,Yv,"m",uw).call(this),fw(this,Zv,"f").call(this,this.color)}};var gw,vw,ww,yw,bw,xw,_w,kw,Ew,Sw,Mw,Tw,Aw,Cw,Pw,Rw,Lw,Iw=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Nw=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};vw=new WeakMap,ww=new WeakMap,yw=new WeakMap,bw=new WeakMap,xw=new WeakMap,_w=new WeakMap,kw=new WeakMap,Ew=new WeakMap,Sw=new WeakMap,Mw=new WeakMap,Tw=new WeakMap,Aw=new WeakMap,gw=new WeakSet,Cw=function(e){const t=document.createElement("div");t.className="color",Nw(this,Mw,"f").appendChild(t);const n=document.createElement("h2");n.textContent=e,t.appendChild(n);const i=document.createElement("input");i.type="text",i.addEventListener("input",(()=>{let e=i.value;/^[0-9A-F]{6}$/i.test(e)&&(e="#"+e),r.color=new tr(e),Nw(this,vw,"f").setColors(Nw(this,gw,"m",Rw).call(this)),Iw(this,Aw,!0,"f")})),i.addEventListener("blur",(()=>{i.value="#"+r.color.getHexString()})),t.appendChild(i);const r=new mw(t,(e=>{document.activeElement!=i&&(i.value="#"+e.getHexString()),Nw(this,vw,"f").setColors(Nw(this,gw,"m",Rw).call(this)),Iw(this,Aw,!0,"f")}));i.value="#"+r.color.getHexString(),Nw(this,Tw,"f").push(r)},Pw=function(){const e=wu.random();Nw(this,Tw,"f")[0].color=e.primary.clone(),Nw(this,Tw,"f")[1].color=e.secondary.clone(),Nw(this,Tw,"f")[2].color=e.frame.clone(),Nw(this,Tw,"f")[3].color=e.rims.clone()},Rw=function(){return new wu(Nw(this,Tw,"f")[0].color.clone(),Nw(this,Tw,"f")[1].color.clone(),Nw(this,Tw,"f")[2].color.clone(),Nw(this,Tw,"f")[3].color.clone())},Lw=function(e){Nw(this,Tw,"f")[0].color=e.primary.clone(),Nw(this,Tw,"f")[1].color=e.secondary.clone(),Nw(this,Tw,"f")[2].color=e.frame.clone(),Nw(this,Tw,"f")[3].color=e.rims.clone()};const Dw=class{constructor(e,t,n,i,r,a,o){gw.add(this),vw.set(this,void 0),ww.set(this,void 0),yw.set(this,void 0),bw.set(this,void 0),xw.set(this,void 0),_w.set(this,void 0),kw.set(this,void 0),Ew.set(this,void 0),Sw.set(this,void 0),Mw.set(this,void 0),Tw.set(this,[]),Aw.set(this,!1),Iw(this,vw,e,"f"),Iw(this,ww,n,"f"),Iw(this,yw,r,"f"),Iw(this,bw,a,"f"),Iw(this,kw,new Kr(70,1,.1,1e4),"f"),Nw(this,kw,"f").position.set(4,3,4),n.scene.add(Nw(this,kw,"f")),Iw(this,Ew,new jv(Nw(this,kw,"f"),n.canvas),"f"),Nw(this,Ew,"f").target.set(0,.7,1.2),Nw(this,Ew,"f").update(),Nw(this,Ew,"f").mouseButtons={LEFT:g,MIDDLE:g,RIGHT:g},Nw(this,Ew,"f").enablePan=!1,Nw(this,Ew,"f").minDistance=2.5,Nw(this,Ew,"f").maxDistance=5.8,Nw(this,Ew,"f").maxPolarAngle=Math.PI/2+.06,Iw(this,xw,document.getElementById("ui"),"f"),Iw(this,Sw,document.createElement("div"),"f"),Nw(this,Sw,"f").className="customization";const s=document.createElement("div");s.className="top",Nw(this,Sw,"f").appendChild(s);const l=document.createElement("button");l.className="button",l.innerHTML='<img class="button-icon" src="images/quit.svg"> ',l.append(document.createTextNode(t.get("Exit"))),l.addEventListener("click",(()=>{i.playUIClick(),o()})),s.appendChild(l),window.addEventListener("keydown",Iw(this,_w,(e=>{"Escape"==e.code&&(o(),e.preventDefault())}),"f"));const c=document.createElement("button");c.className="button",c.innerHTML='<img class="button-icon" src="images/random.svg"> ',c.append(document.createTextNode(t.get("Random"))),c.addEventListener("click",(()=>{i.playUIClick(),Nw(this,gw,"m",Pw).call(this)})),s.appendChild(c),Iw(this,Mw,document.createElement("div"),"f"),Nw(this,Mw,"f").className="colors",Nw(this,Sw,"f").appendChild(Nw(this,Mw,"f")),Nw(this,gw,"m",Cw).call(this,t.get("Primary")),Nw(this,gw,"m",Cw).call(this,t.get("Secondary")),Nw(this,gw,"m",Cw).call(this,t.get("Frame")),Nw(this,gw,"m",Cw).call(this,t.get("Rims")),Nw(this,xw,"f").appendChild(Nw(this,Sw,"f"));const h=Nw(this,bw,"f").getCarColors();Nw(this,gw,"m",Lw).call(this,h),Nw(this,vw,"f").setColors(h),Iw(this,Aw,!1,"f")}save(){if(Nw(this,Aw,"f")){const e=Nw(this,gw,"m",Rw).call(this);Nw(this,bw,"f").setCarColors(e),Nw(this,yw,"f").submitUserProfile(Nw(this,bw,"f").getToken(),Nw(this,bw,"f").getNickname(),e),Iw(this,Aw,!1,"f")}}dispose(){Nw(this,Tw,"f").forEach((e=>{e.dispose()})),Nw(this,ww,"f").scene.remove(Nw(this,kw,"f")),window.removeEventListener("keydown",Nw(this,_w,"f")),Nw(this,xw,"f").removeChild(Nw(this,Sw,"f")),Nw(this,Ew,"f").dispose()}get camera(){return Nw(this,kw,"f")}};var Uw;!function(e){e[e.Straight=0]="Straight",e[e.TurnSharp=1]="TurnSharp",e[e.SlopeUp=2]="SlopeUp",e[e.SlopeDown=3]="SlopeDown",e[e.Slope=4]="Slope",e[e.Start=5]="Start",e[e.Finish=6]="Finish",e[e.ToWideMiddle=7]="ToWideMiddle",e[e.ToWideLeft=8]="ToWideLeft",e[e.ToWideRight=9]="ToWideRight",e[e.StraightWide=10]="StraightWide",e[e.InnerCornerWide=11]="InnerCornerWide",e[e.OuterCornerWide=12]="OuterCornerWide",e[e.SlopeUpLeftWide=13]="SlopeUpLeftWide",e[e.SlopeUpRightWide=14]="SlopeUpRightWide",e[e.SlopeDownLeftWide=15]="SlopeDownLeftWide",e[e.SlopeDownRightWide=16]="SlopeDownRightWide",e[e.SlopeLeftWide=17]="SlopeLeftWide",e[e.SlopeRightWide=18]="SlopeRightWide",e[e.PillarTop=19]="PillarTop",e[e.PillarMiddle=20]="PillarMiddle",e[e.PillarBottom=21]="PillarBottom",e[e.PillarShort=22]="PillarShort",e[e.PlanePillarBottom=23]="PlanePillarBottom",e[e.PlanePillarShort=24]="PlanePillarShort",e[e.Plane=25]="Plane",e[e.PlaneWall=26]="PlaneWall",e[e.PlaneWallCorner=27]="PlaneWallCorner",e[e.PlaneWallInnerCorner=28]="PlaneWallInnerCorner",e[e.Block=29]="Block",e[e.WallTrackTop=30]="WallTrackTop",e[e.WallTrackMiddle=31]="WallTrackMiddle",e[e.WallTrackBottom=32]="WallTrackBottom",e[e.PlaneSlopeUp=33]="PlaneSlopeUp",e[e.PlaneSlopeDown=34]="PlaneSlopeDown",e[e.PlaneSlope=35]="PlaneSlope",e[e.TurnShort=36]="TurnShort",e[e.TurnLong=37]="TurnLong",e[e.SlopeUpLong=38]="SlopeUpLong",e[e.SlopeDownLong=39]="SlopeDownLong",e[e.SlopePillar=40]="SlopePillar",e[e.TurnSLeft=41]="TurnSLeft",e[e.TurnSRight=42]="TurnSRight",e[e.IntersectionT=43]="IntersectionT",e[e.IntersectionCross=44]="IntersectionCross",e[e.PillarBranch1=45]="PillarBranch1",e[e.PillarBranch2=46]="PillarBranch2",e[e.PillarBranch3=47]="PillarBranch3",e[e.PillarBranch4=48]="PillarBranch4",e[e.WallTrackBottomCorner=49]="WallTrackBottomCorner",e[e.WallTrackMiddleCorner=50]="WallTrackMiddleCorner",e[e.WallTrackTopCorner=51]="WallTrackTopCorner",e[e.Checkpoint=52]="Checkpoint",e[e.HalfBlock=53]="HalfBlock",e[e.QuarterBlock=54]="QuarterBlock",e[e.HalfPlane=55]="HalfPlane",e[e.QuarterPlane=56]="QuarterPlane",e[e.PlaneBridge=57]="PlaneBridge",e[e.SignArrowLeft=58]="SignArrowLeft",e[e.SignArrowRight=59]="SignArrowRight",e[e.SignArrowUp=61]="SignArrowUp",e[e.SignArrowDown=62]="SignArrowDown",e[e.SignWarning=63]="SignWarning",e[e.SignWrongWay=64]="SignWrongWay",e[e.CheckpointWide=65]="CheckpointWide",e[e.WallTrackCeiling=66]="WallTrackCeiling",e[e.WallTrackFloor=67]="WallTrackFloor",e[e.BlockSlopedDown=68]="BlockSlopedDown",e[e.BlockSlopedDownInnerCorner=69]="BlockSlopedDownInnerCorner",e[e.BlockSlopedDownOuterCorner=70]="BlockSlopedDownOuterCorner",e[e.BlockSlopedUp=71]="BlockSlopedUp",e[e.BlockSlopedUpInnerCorner=72]="BlockSlopedUpInnerCorner",e[e.BlockSlopedUpOuterCorner=73]="BlockSlopedUpOuterCorner",e[e.FinishWide=74]="FinishWide",e[e.PlaneCheckpoint=75]="PlaneCheckpoint",e[e.PlaneFinish=76]="PlaneFinish",e[e.PlaneCheckpointWide=77]="PlaneCheckpointWide",e[e.PlaneFinishWide=78]="PlaneFinishWide",e[e.WallTrackBottomInnerCorner=79]="WallTrackBottomInnerCorner",e[e.WallTrackInnerCorner=80]="WallTrackInnerCorner",e[e.WallTrackTopInnerCorner=81]="WallTrackTopInnerCorner",e[e.TurnLong2=82]="TurnLong2",e[e.TurnLong3=83]="TurnLong3",e[e.SlopePillarShort=84]="SlopePillarShort",e[e.BlockSlopeUp=85]="BlockSlopeUp",e[e.BlockSlopeDown=86]="BlockSlopeDown",e[e.SlopeBlock=87]="SlopeBlock",e[e.SlopeUpBlock=88]="SlopeUpBlock",e[e.SlopeDownBlock=89]="SlopeDownBlock",e[e.SlopeUpLeftWideBlock=90]="SlopeUpLeftWideBlock",e[e.SlopeUpRightWideBlock=91]="SlopeUpRightWideBlock",e[e.SlopeDownLeftWideBlock=92]="SlopeDownLeftWideBlock",e[e.SlopeDownRightWideBlock=93]="SlopeDownRightWideBlock",e[e.SlopeLeftWideBlock=94]="SlopeLeftWideBlock",e[e.SlopeRightWideBlock=95]="SlopeRightWideBlock",e[e.PlaneSlopeUpBlock=96]="PlaneSlopeUpBlock",e[e.PlaneSlopeDownBlock=97]="PlaneSlopeDownBlock",e[e.PlaneSlopeBlock=98]="PlaneSlopeBlock",e[e.PlaneSlopePillar=99]="PlaneSlopePillar",e[e.PlaneSlopePillarShort=100]="PlaneSlopePillarShort",e[e.PillarBranch1Top=101]="PillarBranch1Top",e[e.PillarBranch1Bottom=102]="PillarBranch1Bottom",e[e.PillarBranch1Middle=103]="PillarBranch1Middle",e[e.PillarBranch2Top=104]="PillarBranch2Top",e[e.PillarBranch2Middle=105]="PillarBranch2Middle",e[e.PillarBranch2Bottom=106]="PillarBranch2Bottom",e[e.PillarBranch3Top=107]="PillarBranch3Top",e[e.PillarBranch3Middle=108]="PillarBranch3Middle",e[e.PillarBranch3Bottom=109]="PillarBranch3Bottom",e[e.PillarBranch4Top=110]="PillarBranch4Top",e[e.PillarBranch4Middle=111]="PillarBranch4Middle",e[e.PillarBranch4Bottom=112]="PillarBranch4Bottom",e[e.PillarBranch5=113]="PillarBranch5",e[e.PillarBranch5Top=114]="PillarBranch5Top",e[e.PillarBranch5Middle=115]="PillarBranch5Middle",e[e.PillarBranch5Bottom=116]="PillarBranch5Bottom",e[e.ToWideDouble=117]="ToWideDouble",e[e.ToWideDiagonal=118]="ToWideDiagonal",e[e.StraightPillarBottom=119]="StraightPillarBottom",e[e.StraightPillarShort=120]="StraightPillarShort",e[e.TurnSharpPillarBottom=121]="TurnSharpPillarBottom",e[e.TurnSharpPillarShort=122]="TurnSharpPillarShort",e[e.IntersectionTPillarBottom=123]="IntersectionTPillarBottom",e[e.IntersectionTPillarShort=124]="IntersectionTPillarShort",e[e.IntersectionCrossPillarBottom=125]="IntersectionCrossPillarBottom",e[e.IntersectionCrossPillarShort=126]="IntersectionCrossPillarShort",e[e.PlaneBridgeCorner=127]="PlaneBridgeCorner",e[e.PlaneBridgeIntersectionT=128]="PlaneBridgeIntersectionT",e[e.PlaneBridgeIntersectionCross=129]="PlaneBridgeIntersectionCross",e[e.BlockBridge=130]="BlockBridge",e[e.BlockBridgeCorner=131]="BlockBridgeCorner",e[e.BlockBridgeIntersectionT=132]="BlockBridgeIntersectionT",e[e.BlockBridgeIntersectionCross=133]="BlockBridgeIntersectionCross",e[e.RedBlock=134]="RedBlock",e[e.RedHalfBlock=135]="RedHalfBlock",e[e.RedQuarterBlock=136]="RedQuarterBlock",e[e.RedBlockSlopedDown=137]="RedBlockSlopedDown",e[e.RedBlockSlopedDownInnerCorner=138]="RedBlockSlopedDownInnerCorner",e[e.RedBlockSlopedDownOuterCorner=139]="RedBlockSlopedDownOuterCorner",e[e.RedBlockSlopedUp=140]="RedBlockSlopedUp",e[e.RedBlockSlopedUpInnerCorner=141]="RedBlockSlopedUpInnerCorner",e[e.RedBlockSlopedUpOuterCorner=142]="RedBlockSlopedUpOuterCorner",e[e.RedBlockSlopeDown=143]="RedBlockSlopeDown",e[e.RedBlockSlopeUp=144]="RedBlockSlopeUp",e[e.RedBlockBridge=145]="RedBlockBridge",e[e.RedBlockBridgeCorner=146]="RedBlockBridgeCorner",e[e.RedBlockBridgeIntersectionT=147]="RedBlockBridgeIntersectionT",e[e.RedBlockBridgeIntersectionCross=148]="RedBlockBridgeIntersectionCross",e[e.BlueBlock=149]="BlueBlock",e[e.BlueHalfBlock=150]="BlueHalfBlock",e[e.BlueQuarterBlock=151]="BlueQuarterBlock",e[e.BlueBlockSlopedDown=152]="BlueBlockSlopedDown",e[e.BlueBlockSlopedDownInnerCorner=153]="BlueBlockSlopedDownInnerCorner",e[e.BlueBlockSlopedDownOuterCorner=154]="BlueBlockSlopedDownOuterCorner",e[e.BlueBlockSlopedUp=155]="BlueBlockSlopedUp",e[e.BlueBlockSlopedUpInnerCorner=156]="BlueBlockSlopedUpInnerCorner",e[e.BlueBlockSlopedUpOuterCorner=157]="BlueBlockSlopedUpOuterCorner",e[e.BlueBlockSlopeDown=158]="BlueBlockSlopeDown",e[e.BlueBlockSlopeUp=159]="BlueBlockSlopeUp",e[e.BlueBlockBridge=160]="BlueBlockBridge",e[e.BlueBlockBridgeCorner=161]="BlueBlockBridgeCorner",e[e.BlueBlockBridgeIntersectionT=162]="BlueBlockBridgeIntersectionT",e[e.BlueBlockBridgeIntersectionCross=163]="BlueBlockBridgeIntersectionCross",e[e.BlackBlock=164]="BlackBlock",e[e.BlackHalfBlock=165]="BlackHalfBlock",e[e.BlackQuarterBlock=166]="BlackQuarterBlock",e[e.BlackBlockSlopedDown=167]="BlackBlockSlopedDown",e[e.BlackBlockSlopedDownInnerCorner=168]="BlackBlockSlopedDownInnerCorner",e[e.BlackBlockSlopedDownOuterCorner=169]="BlackBlockSlopedDownOuterCorner",e[e.BlackBlockSlopedUp=170]="BlackBlockSlopedUp",e[e.BlackBlockSlopedUpInnerCorner=171]="BlackBlockSlopedUpInnerCorner",e[e.BlackBlockSlopedUpOuterCorner=172]="BlackBlockSlopedUpOuterCorner",e[e.BlackBlockSlopeDown=173]="BlackBlockSlopeDown",e[e.BlackBlockSlopeUp=174]="BlackBlockSlopeUp",e[e.BlackBlockBridge=175]="BlackBlockBridge",e[e.BlackBlockBridgeCorner=176]="BlackBlockBridgeCorner",e[e.BlackBlockBridgeIntersectionT=177]="BlackBlockBridgeIntersectionT",e[e.BlackBlockBridgeIntersectionCross=178]="BlackBlockBridgeIntersectionCross"}(Uw||(Uw={}));const Bw=Uw;var Ow,zw,Fw,Ww,Hw,Vw,Gw,jw=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},qw=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Ow=new WeakMap,zw=new WeakMap,Fw=new WeakMap,Ww=new WeakMap,Hw=new WeakMap,Vw=new WeakMap,Gw=new WeakMap;const Xw=class{constructor(e,t,n,i,r,a,o,s,l,c){Ow.set(this,void 0),zw.set(this,void 0),Fw.set(this,void 0),Ww.set(this,void 0),Hw.set(this,void 0),Vw.set(this,void 0),Gw.set(this,void 0),jw(this,Ow,a,"f"),jw(this,zw,n,"f"),jw(this,Fw,i,"f"),jw(this,Ww,r,"f"),jw(this,Hw,s,"f");for(let e=-100;e<100;++e)0==e?n.setPart(0,0,e,Bw.Start,2,null):n.setPart(0,0,e,Bw.Straight,0,null);n.generateMeshes(),i.generateMountains(n.getBounds()),jw(this,Gw,new Uv(e,qw(this,zw,"f").getStartTransform(),null,null,!1,r,a,i,n,s),"f"),qw(this,Gw,"f").audioVolume=0,qw(this,Gw,"f").update(0),jw(this,Vw,new Dw(qw(this,Gw,"f"),t,r,a,l,o,c),"f"),r.setCamera(qw(this,Vw,"f").camera)}dispose(){qw(this,zw,"f").clear(),qw(this,Fw,"f").clearMountains(),qw(this,Vw,"f").save(),qw(this,Vw,"f").dispose(),qw(this,Gw,"f").dispose()}update(e){qw(this,Ww,"f").update(qw(this,Gw,"f").getPosition()),qw(this,Ow,"f").update(e,!0,qw(this,Ww,"f"),qw(this,Hw,"f"))}};var Yw=n(344),Kw={};Kw.styleTagTransform=u(),Kw.setAttributes=l(),Kw.insert=o().bind(null,"head"),Kw.domAPI=r(),Kw.insertStyleElement=h();t()(Yw.A,Kw);Yw.A&&Yw.A.locals&&Yw.A.locals;var Zw,Jw,Qw,$w,ey=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},ty=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Zw=new WeakMap,Jw=new WeakMap,Qw=new WeakMap,$w=new WeakMap;const ny=class{constructor(){Zw.set(this,!1),Jw.set(this,void 0),Qw.set(this,0),$w.set(this,0);const e=document.getElementById("ui");ey(this,Jw,document.createElement("div"),"f"),ty(this,Jw,"f").className="hidden",e.appendChild(ty(this,Jw,"f"))}show(){ty(this,Jw,"f").className="debug",ey(this,Zw,!0,"f")}hide(){ty(this,Jw,"f").className="hidden",ey(this,Zw,!1,"f")}toggle(){ty(this,Zw,"f")?this.hide():this.show()}update(e){ey(this,Qw,ty(this,Qw,"f")+e,"f"),ey(this,$w,ty(this,$w,"f")+1,"f"),ty(this,Qw,"f")>=1&&(ty(this,Jw,"f").textContent="FPS: "+ty(this,$w,"f"),ey(this,Qw,ty(this,Qw,"f")-Math.trunc(ty(this,Qw,"f")),"f"),ey(this,$w,0,"f"))}};var iy=n(57),ry={};ry.styleTagTransform=u(),ry.setAttributes=l(),ry.insert=o().bind(null,"head"),ry.domAPI=r(),ry.insertStyleElement=h();t()(iy.A,ry);iy.A&&iy.A.locals&&iy.A.locals;class ay extends jv{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons={LEFT:w,MIDDLE:v,RIGHT:g},this.touches={ONE:b,TWO:_}}}class oy extends fh{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new vh(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(e){const n=r.parse(JSON.parse(e));t&&t(n)}),n,i)}parse(e){return new sy(e)}}class sy{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){const n=[],i=function(e,t,n){const i=Array.from(e),r=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,o=[];let s=0,l=0;for(let e=0;e<i.length;e++){const t=i[e];if("\n"===t)s=0,l-=a;else{const e=ly(t,r,s,l,n);s+=e.offsetX,o.push(e.path)}}return o}(e,t,this.data);for(let e=0,t=i.length;e<t;e++)n.push(...i[e].toShapes());return n}}function ly(e,t,n,i,r){const a=r.glyphs[e]||r.glyphs["?"];if(!a)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+r.familyName+".");const o=new Kh;let s,l,c,h,d,u,p,f;if(a.o){const e=a._cachedOutline||(a._cachedOutline=a.o.split(" "));for(let r=0,a=e.length;r<a;){switch(e[r++]){case"m":s=e[r++]*t+n,l=e[r++]*t+i,o.moveTo(s,l);break;case"l":s=e[r++]*t+n,l=e[r++]*t+i,o.lineTo(s,l);break;case"q":c=e[r++]*t+n,h=e[r++]*t+i,d=e[r++]*t+n,u=e[r++]*t+i,o.quadraticCurveTo(d,u,c,h);break;case"b":c=e[r++]*t+n,h=e[r++]*t+i,d=e[r++]*t+n,u=e[r++]*t+i,p=e[r++]*t+n,f=e[r++]*t+i,o.bezierCurveTo(d,u,p,f,c,h)}}}return{offsetX:a.ha*t,path:o}}class cy extends Sl{constructor(e,t){const n=new ar({color:t,depthWrite:!1});super(e.geometry,n,e.count);for(let t=0;t<e.count;++t){const n=new ui;e.getMatrixAt(t,n),this.setMatrixAt(t,n)}this.meshMatrix=e.matrixWorld,this.frustumCulled=!1,this.matrixAutoUpdate=!1,this.renderOrder=-1}update(e,t){var n=new ui,i=e.normal.x*t.x+e.normal.y*t.y+e.normal.z*t.z+-e.constant*t.w,r=n.elements;r[0]=i-t.x*e.normal.x,r[4]=-t.x*e.normal.y,r[8]=-t.x*e.normal.z,r[12]=-t.x*-e.constant,r[1]=-t.y*e.normal.x,r[5]=i-t.y*e.normal.y,r[9]=-t.y*e.normal.z,r[13]=-t.y*-e.constant,r[2]=-t.z*e.normal.x,r[6]=-t.z*e.normal.y,r[10]=i-t.z*e.normal.z,r[14]=-t.z*-e.constant,r[3]=-t.w*e.normal.x,r[7]=-t.w*e.normal.y,r[11]=-t.w*e.normal.z,r[15]=i-t.w*-e.constant,this.matrix.multiplyMatrices(n,this.meshMatrix)}}var hy=n(312);const dy=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"],uy=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],py=30;function fy(e){let t=0,n="";for(;t<8*e.length;){const i=gy(e,t);let r;(i&py)==py?(r=31&i,t+=5):(r=i,t+=6),n+=dy[r]}return n}function my(e){let t=0;const n=[],i=e.length;for(let r=0;r<i;r++){const a=e.charCodeAt(r);if(a>=uy.length)return null;const o=uy[a];if(-1==o)return null;(o&py)==py?(vy(n,t,5,o,r==i-1),t+=5):(vy(n,t,6,o,r==i-1),t+=6)}return new Uint8Array(n)}function gy(e,t){if(t>=8*e.length)throw"Out of range";const n=Math.floor(t/8),i=e[n],r=t-8*n;if(r<=2||n>=e.length-1)return(i&63<<r)>>>r;return(i&63<<r)>>>r|(e[n+1]&63>>>8-r)<<8-r}function vy(e,t,n,i,r){const a=Math.floor(t/8);for(;a>=e.length;)e.push(0);const o=t-8*a;if(e[a]|=i<<o&255,o>8-n&&!r){const t=a+1;t>=e.length&&e.push(0),e[t]|=i>>8-o}}var wy;!function(e){e[e.Checkpoint=0]="Checkpoint",e[e.Finish=1]="Finish"}(wy||(wy={}));const yy=wy;function by(e,t){const n=e.parts;if("object"!=typeof n&&null!==n&&!Array.isArray(n))return null;const i=t.getPartTypesWithDetector(yy.Checkpoint),r=new Py,a=Object.keys(n);for(let e=0;e<a.length;++e){const t=parseInt(a[e],10);if(!(t in Bw))return null;{const e=n[t];if(!Array.isArray(e))return null;if(e.length%4!=0)return null;for(let n=0;n<e.length;n+=4){const a=parseInt(e[n+0],10),o=parseInt(e[n+1],10),s=parseInt(e[n+2],10),l=parseInt(e[n+3],10);if(isNaN(a)||isNaN(o)||isNaN(s)||isNaN(l))return null;if(!(l>=0&&l<=3&&Math.abs(a)<=1e9&&o>=0&&o<=1e9&&Math.abs(s)<=1e9))return null;if(i.includes(t))return null;r.addPart(a,o,s,t,l,null)}}}return r}function xy(e,t){if("string"!=typeof e.name)return null;if("string"!=typeof e.track)return null;let n;try{n=JSON.parse(e.track)}catch(e){return console.error(e),null}const i=by(n,t);return null==i?null:{trackName:e.name,trackData:i}}function _y(e,t){const n=kg(e);if(null==n)return null;const i=t.getPartTypesWithDetector(yy.Checkpoint),r=new Py;let a=0;for(;a<n.length;){if(n.length-a<2)return null;const e=n[a+0]|n[a+1]<<8;if(a+=2,!(e in Bw))return null;if(n.length-a<4)return null;const t=n[a+0]|n[a+1]<<8|n[a+2]<<16|n[a+3]<<24;a+=4;for(let o=0;o<t;++o){if(n.length-a<3)return null;const t=(n[a+0]|n[a+1]<<8|n[a+2]<<16)-Math.pow(2,23);if(a+=3,n.length-a<3)return null;const o=n[a+0]|n[a+1]<<8|n[a+2]<<16;if(a+=3,n.length-a<3)return null;const s=(n[a+0]|n[a+1]<<8|n[a+2]<<16)-Math.pow(2,23);if(a+=3,n.length-a<1)return null;const l=3&n[a+0];if(a+=1,i.includes(e))return null;r.addPart(t,o,s,e,l,null)}}return r}function ky(e,t){const n=my(e);if(null==n)return null;const i=new _g.Inflate;if(i.push(n,!0),i.err)return null;const r=i.result,a=t.getPartTypesWithDetector(yy.Checkpoint),o=new Py;let s=0;for(;s<r.length;){if(r.length-s<2)return null;const e=r[s+0]|r[s+1]<<8;if(s+=2,!(e in Bw))return null;if(r.length-s<4)return null;const t=r[s+0]|r[s+1]<<8|r[s+2]<<16|r[s+3]<<24;s+=4;for(let n=0;n<t;++n){if(r.length-s<3)return null;const t=(r[s+0]|r[s+1]<<8|r[s+2]<<16)-Math.pow(2,23);if(s+=3,r.length-s<3)return null;const n=r[s+0]|r[s+1]<<8|r[s+2]<<16;if(s+=3,r.length-s<3)return null;const i=(r[s+0]|r[s+1]<<8|r[s+2]<<16)-Math.pow(2,23);if(s+=3,r.length-s<1)return null;const l=3&r[s+0];s+=1;let c=null;a.includes(e)&&(c=r[s+0]|r[s+1]<<8,s+=2),o.addPart(t,n,i,e,l,c)}}return o}function Ey(e,t){const n=my(e);if(null==n)return null;const i=new _g.Inflate;if(i.push(n,!0),i.err)return null;const r=i.result,a=t.getPartTypesWithDetector(yy.Checkpoint),o=new Py;let s=0;for(;s<r.length;){if(r.length-s<2)return null;const e=r[s+0]|r[s+1]<<8;if(s+=2,!(e in Bw))return null;if(r.length-s<4)return null;const t=r[s+0]|r[s+1]<<8|r[s+2]<<16|r[s+3]<<24;s+=4;for(let n=0;n<t;++n){if(r.length-s<3)return null;const t=(r[s+0]|r[s+1]<<8|r[s+2]<<16)-Math.pow(2,23);if(s+=3,r.length-s<3)return null;const n=r[s+0]|r[s+1]<<8|r[s+2]<<16;if(s+=3,r.length-s<3)return null;const i=(r[s+0]|r[s+1]<<8|r[s+2]<<16)-Math.pow(2,23);if(s+=3,r.length-s<1)return null;const l=3&r[s+0];s+=1;let c=null;a.includes(e)&&(c=r[s+0]|r[s+1]<<8,s+=2),o.addPart(t,n,i,e,l,c)}}return o}var Sy,My,Ty,Ay,Cy=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};My=new WeakMap,Sy=new WeakSet,Ty=function(){const e=Cy(this,My,"f").get(Bw.Start);return null!=e&&e.length>0?e[e.length-1]:null},Ay=function(e){const t=e.getPartTypesWithDetector(yy.Checkpoint),n=[];return Cy(this,My,"f").forEach(((e,i)=>{if(i<0||i>65535)throw"Type id is out of range";const r=e.length;n.push(255&i,i>>>8&255,255&r,r>>>8&255,r>>>16&255,r>>>24&255),e.forEach((e=>{const r=e.x+Math.pow(2,23),a=e.y,o=e.z+Math.pow(2,23);if(n.push(255&r,r>>>8&255,r>>>16&255,255&a,a>>>8&255,a>>>16&255,255&o,o>>>8&255,o>>>16&255,3&e.rotation),t.includes(i)){if(null==e.checkpointOrder)throw"Checkpoint has no checkpoint order";n.push(255&e.checkpointOrder,e.checkpointOrder>>>8&255)}}))})),new Uint8Array(n)};const Py=class{constructor(){Sy.add(this),My.set(this,new Map)}addPart(e,t,n,i,r,a){const o=Cy(this,My,"f").get(i);null!=o?o.push({x:e,y:t,z:n,rotation:r,checkpointOrder:a}):Cy(this,My,"f").set(i,[{x:e,y:t,z:n,rotation:r,checkpointOrder:a}])}forEachPart(e){Cy(this,My,"f").forEach(((t,n)=>{t.forEach((t=>{e(t.x,t.y,t.z,n,t.rotation,t.checkpointOrder)}))}))}getId(e){return(0,hy.sha256)(Cy(this,Sy,"m",Ay).call(this,e))}getBounds(){let e=1/0,t=1/0,n=-1/0,i=-1/0;return this.forEachPart(((r,a,o)=>{e=Math.min(r,e),t=Math.min(o,t),n=Math.max(r,n),i=Math.max(o,i)})),Number.isFinite(e)&&Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(i)?{min:new ln(e,t),max:new ln(n,i)}:{min:new ln,max:new ln}}hasStartingPoint(){return Cy(this,My,"f").has(Bw.Start)}getStartTransform(){const e=Cy(this,Sy,"m",Ty).call(this);if(null!=e){const t=(new Dn).setFromEuler(new _i(0,Math.PI+e.rotation*Math.PI/2,0)),n=new Un(0,.385,1.35);return n.applyQuaternion(t),{position:new Un(e.x*Ky.partWidth+n.x,e.y*Ky.partHeight+n.y,e.z*Ky.partLength+n.z),quaternion:t}}return null}toSaveString(e){const t=Cy(this,Sy,"m",Ay).call(this,e),n=new _g.Deflate({level:9});return n.push(t,!0),fy(n.result)}toExportString(e,t){const n=fy((new TextEncoder).encode(e)),i=new Uint8Array(1);i[0]=n.length;let r=fy(i);return 1==r.length&&(r+="A"),"v3"+r+n+this.toSaveString(t)}static fromSaveString(e,t){const n=Ey(e,t);if(null!=n)return n;const i=ky(e,t);if(null!=i)return i;const r=_y(e,t);if(null!=r)return r;const a=by(e,t);return null!=a?a:null}static fromExportString(e,t){const n=e.replace(/\s+/g,""),i=function(e,t){if(!e.startsWith("v3"))return null;const n=my(e.substring(2,4));if(null==n)return null;if(1!=n.length)return null;const i=n[0],r=my(e.substring(4,4+i));if(null==r)return null;let a;try{a=new TextDecoder("utf-8").decode(r)}catch(e){return null}const o=Ey(e.substring(4+i),t);return null==o?null:{trackName:a,trackData:o}}(n,t);if(null!=i)return i;const r=function(e,t){if(!e.startsWith("v2"))return null;const n=my(e.substring(2,4));if(null==n)return null;if(1!=n.length)return null;const i=n[0],r=Math.ceil(i/3*4),a=my(e.substring(4,4+r));if(null==a)return null;let o;try{o=new TextDecoder("utf-8").decode(a)}catch(e){return null}const s=ky(e.substring(4+r),t);return null==s?null:{trackName:o,trackData:s}}(n,t);if(null!=r)return r;const a=function(e,t){if(!e.startsWith("v1n"))return null;const n=kg(e.substring(3,5));if(null==n)return null;if(1!=n.length)return null;const i=n[0],r=e.substring(5,5+i);let a;try{a=decodeURIComponent(r)}catch(e){return console.error(e),null}const o=_y(e.substring(5+i),t);return null==o?null:{trackName:a,trackData:o}}(n,t);if(null!=a)return a;const o=xy(e,t);return null!=o?o:null}createThumbnail(e){const t=document.createElement("canvas");let n=0,i=0,r=0,a=0;this.forEachPart(((e,t,o)=>{n=Math.min(n,e),i=Math.min(i,o),r=Math.max(r,e),a=Math.max(a,o)}));const o=10,s=r-n+1;s<=o&&(r+=Math.ceil((o-s)/2),n-=Math.ceil((o-s)/2));const l=a-i+1;l<=o&&(a+=Math.ceil((o-l)/2),i-=Math.ceil((o-l)/2)),t.width=Math.min(1024,r-n+1),t.height=Math.min(1024,a-i+1);const c=t.getContext("2d");c.fillStyle="#fff";const h=[],d=[],u=[];return this.forEachPart(((t,r,a,o,s)=>{const l=e.getPart(o);l.tiles.rotated(s).forEach(((e,r,s)=>{c.fillRect(t+e-n,a+s-i,1,1),o==Bw.Start?d.push([t+e-n,a+s-i]):null!=l.detector&&l.detector.type==yy.Checkpoint?h.push([t+e-n,a+s-i]):null!=l.detector&&l.detector.type==yy.Finish&&u.push([t+e-n,a+s-i])}))})),c.fillStyle="#e2c026",h.forEach((([e,t])=>{c.fillRect(e,t,1,1)})),c.fillStyle="#338ce0",d.forEach((([e,t])=>{c.fillRect(e,t,1,1)})),c.fillStyle="#d12929",u.forEach((([e,t])=>{c.fillRect(e,t,1,1)})),t}};var Ry,Ly,Iy,Ny,Dy,Uy,By,Oy,zy,Fy,Wy,Hy,Vy,Gy,jy=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},qy=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class Xy{constructor(e,t,n,i,r,a,o){if(this.checkpointOrder=null,this.x=e,this.y=t,this.z=n,this.rotation=i,this.type=r,this.matrix=a,this.checkpointOrder=o,null!=r.detector&&r.detector.type==yy.Checkpoint){if(null==o)throw"Checkpoint has no checkpoint order"}else if(null!=o)throw"Non-checkpoint has checkpoint order"}}class Yy{constructor(e,t,n){Ry.add(this),Ly.set(this,void 0),Iy.set(this,void 0),Ny.set(this,void 0),Dy.set(this,[]),Uy.set(this,new Map),By.set(this,new Map),Oy.set(this,{min:new ln(0,0),max:new ln(0,0)}),zy.set(this,null),Fy.set(this,[]),jy(this,Ly,e,"f"),jy(this,Iy,t,"f"),jy(this,Ny,n,"f")}getID(){return qy(this,zy,"f")}clear(){jy(this,zy,null,"f"),qy(this,Dy,"f").length=0,qy(this,Uy,"f").clear(),qy(this,By,"f").clear(),qy(this,Ry,"m",Wy).call(this)}hasPartAt(e,t,n){return qy(this,Uy,"f").has(e+"|"+t+"|"+n)}getPartAt(e,t,n){const i=qy(this,Uy,"f").get(e+"|"+t+"|"+n);return null==i?null:{id:i.type.id,rotation:i.rotation}}setPart(e,t,n,i,r,a){const o=qy(this,Ny,"f").getPart(i),s=new Xy(e,t,n,r,o,(new ui).makeRotationY(r*Math.PI/2).setPosition(e*Yy.partWidth,t*Yy.partHeight,n*Yy.partLength),a);qy(this,Dy,"f").push(s);o.tiles.rotated(r).forEach(((i,r,a)=>{const o=e+i+"|"+(t+r)+"|"+(n+a);if(this.hasPartAt(e+i,t+r,n+a))throw"Track part collision";qy(this,Uy,"f").set(o,s)}));const l=qy(this,By,"f").get(i);null==l?qy(this,By,"f").set(i,[s]):l.push(s)}deletePart(e,t,n){const i=qy(this,Uy,"f").get(e+"|"+t+"|"+n);if(null==i)throw"Track part missing from parts by position map";for(let e=0;e<qy(this,Dy,"f").length;++e){if(qy(this,Dy,"f")[e]==i){qy(this,Dy,"f").splice(e,1);break}if(e==qy(this,Dy,"f").length-1)throw"Track part missing from parts list"}i.type.tiles.rotated(i.rotation).forEach(((e,t,n)=>{const r=i.x+e+"|"+(i.y+t)+"|"+(i.z+n);if(!qy(this,Uy,"f").has(r))throw"Track part section missing";qy(this,Uy,"f").delete(r)}));const r=qy(this,By,"f").get(i.type.id);if(null==r)throw"Track part type is missing from parts by type map";for(let e=0;e<r.length;++e){if(r[e]==i){r.splice(e,1);break}if(e==r.length-1)throw"Track part is missing from parts by type map"}}getBounds(){return qy(this,Oy,"f")}shortRaycast(e){const t=new Un(Math.floor(e.ray.origin.x/Yy.partWidth),Math.floor(e.ray.origin.y/Yy.partHeight),Math.floor(e.ray.origin.z/Yy.partLength)),n=new Set;for(let e=-1;e<=1;e++)for(let i=-1;i<=1;i++)for(let r=-1;r<=1;r++){const a=qy(this,Ry,"m",Hy).call(this,t.x+e,t.y+i,t.z+r);null!=a&&n.add(a)}let i=null;return n.forEach((t=>{if(null==t.type.mesh)throw"Track part is not loaded yet";if(null==i){t.type.mesh.matrixWorld.copy(t.matrix);const n=e.intersectObject(t.type.mesh,!0);n.length>0&&(i=n[0])}})),i}generateMeshes(){qy(this,Ry,"m",Wy).call(this);const e=qy(this,Ly,"f").getShadowDirection(),t=new Pn(e.x,e.y,e.z,0);qy(this,Ny,"f").getAllParts().forEach((e=>{const n=[];for(let t=0;t<qy(this,Dy,"f").length;++t)qy(this,Dy,"f")[t].type==e&&n.push(qy(this,Dy,"f")[t]);if(n.length>0){if(null==e.mesh)throw"Mesh is not loaded";const i=new Sl(e.mesh.geometry,e.mesh.material,n.length);i.frustumCulled=!1,i.receiveShadow=!0;for(let e=0;e<n.length;++e)i.setMatrixAt(e,n[e].matrix);if(qy(this,Ly,"f").scene.add(i),qy(this,Fy,"f").push(i),qy(this,Iy,"f").getSettingBoolean(Jh.TrackShadowEnabled)){const e=new cy(i,1192238);e.update(new ia(new Un(0,1,0),0),t),qy(this,Ly,"f").scene.add(e),qy(this,Fy,"f").push(e)}}})),qy(this,Ry,"m",Vy).call(this)}getCheckpoints(){let e=[];return qy(this,Ny,"f").getPartTypesWithDetector(yy.Checkpoint).forEach((t=>{const n=qy(this,By,"f").get(t);null!=n&&(e=e.concat(n))})),e.map((e=>{if(null==e.checkpointOrder)throw"Checkpoint has no checkpoint order";if(null==e.type.detector)throw"Checkpoint has no detector";return{x:e.x,y:e.y,z:e.z,rotation:e.rotation,checkpointOrder:e.checkpointOrder,detector:e.type.detector}}))}getCheckpointOrders(){let e=[];return qy(this,Ny,"f").getPartTypesWithDetector(yy.Checkpoint).forEach((t=>{const n=qy(this,By,"f").get(t);null!=n&&(e=e.concat(n))})),e.map((e=>{if(null==e.checkpointOrder)throw"Checkpoint has no checkpoint order";if(null==e.type.detector)throw"Checkpoint has no detector";return e.checkpointOrder}))}getTotalNumberOfCheckpointIndices(){let e=[];if(qy(this,Ny,"f").getPartTypesWithDetector(yy.Checkpoint).forEach((t=>{const n=qy(this,By,"f").get(t);null!=n&&(e=e.concat(n))})),null==e)return 0;return e.map((e=>e.checkpointOrder)).filter(((e,t,n)=>n.indexOf(e)==t)).length}getStartTransform(){const e=qy(this,Ry,"m",Gy).call(this);if(null!=e){const t=(new Dn).setFromEuler(new _i(0,Math.PI+e.rotation*Math.PI/2,0)),n=new Un(0,.385,1.35);return n.applyQuaternion(t),{position:new Un(e.x*Yy.partWidth+n.x,e.y*Yy.partHeight+n.y,e.z*Yy.partLength+n.z),quaternion:t}}return null}getTrackData(){const e=new Py;return qy(this,Dy,"f").forEach((t=>{e.addPart(t.x,t.y,t.z,t.type.id,t.rotation,t.checkpointOrder)})),e}loadTrackData(e,t=!0){return this.clear(),jy(this,zy,t?e.getId(qy(this,Ny,"f")):null,"f"),e.forEachPart(((e,t,n,i,r,a)=>{this.setPart(e,t,n,i,r,a)})),!0}}Ly=new WeakMap,Iy=new WeakMap,Ny=new WeakMap,Dy=new WeakMap,Uy=new WeakMap,By=new WeakMap,Oy=new WeakMap,zy=new WeakMap,Fy=new WeakMap,Ry=new WeakSet,Wy=function(){for(let e=0;e<qy(this,Fy,"f").length;++e){const t=qy(this,Fy,"f")[e];qy(this,Ly,"f").scene.remove(t)}qy(this,Fy,"f").length=0},Hy=function(e,t,n){return qy(this,Uy,"f").get(e+"|"+t+"|"+n)},Vy=function(){let e=1/0,t=1/0,n=-1/0,i=-1/0;qy(this,Dy,"f").forEach((r=>{e=Math.min(r.x,e),t=Math.min(r.z,t),n=Math.max(r.x,n),i=Math.max(r.z,i)})),Number.isFinite(e)&&Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(i)?jy(this,Oy,{min:new ln(e,t),max:new ln(n,i)},"f"):jy(this,Oy,{min:new ln,max:new ln},"f")},Gy=function(){const e=qy(this,By,"f").get(Bw.Start);return null!=e&&e.length>0?e[e.length-1]:null},Yy.partWidth=20,Yy.partHeight=5,Yy.partLength=20;const Ky=Yy;var Zy,Jy,Qy,$y,eb,tb=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},nb=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class ib{constructor(e){Jy.set(this,void 0),Qy.set(this,[]),$y.set(this,[]),tb(this,Jy,e,"f")}dispose(){nb(this,Qy,"f").forEach((e=>{Array.isArray(e.material)?e.material.forEach((e=>e.dispose())):e.material.dispose(),e.geometry.dispose(),nb(this,Jy,"f").scene.remove(e)})),nb(this,Qy,"f").length=0}refresh(e){const t=e.getCheckpoints();let n=!1;if(t.length==nb(this,$y,"f").length)for(let e=0;e<t.length;e++){const i=t[e],r=nb(this,$y,"f")[e];if(i.x!=r.x||i.y!=r.y||i.z!=r.z||i.rotation!=r.rotation||i.checkpointOrder!=r.checkpointOrder){n=!0;break}}else n=!0;if(n){this.dispose(),tb(this,$y,t,"f");const e=new ar({color:16777215});t.forEach((t=>{if(null==nb(Zy,Zy,"f",eb))throw"Font is not loaded yet";const n=new Un(...t.detector.center);let i;if(0==t.rotation)i=new Un(n.x,n.y,n.z);else if(1==t.rotation)i=new Un(n.z,n.y,-n.x);else if(2==t.rotation)i=new Un(-n.x,n.y,-n.z);else{if(3!=t.rotation)throw"Invalid rotation";i=new Un(n.z,n.y,n.x)}i.add(new Un(t.x*Ky.partWidth,t.y*Ky.partHeight,t.z*Ky.partLength)),i.add(new Un(0,-1.3,0));const r=nb(Zy,Zy,"f",eb).generateShapes((t.checkpointOrder+1).toString(),4),a=new Wc(r);a.computeBoundingBox();const o=-.5*(a.boundingBox.max.x-a.boundingBox.min.x);a.translate(o,0,0);const s=new Br(a,e);s.position.copy(i),s.rotation.y=Math.PI/2*t.rotation,nb(this,Jy,"f").scene.add(s),nb(this,Qy,"f").push(s);const l=new Br(a,e);l.position.copy(i),l.rotation.y=Math.PI/2*t.rotation+Math.PI,nb(this,Jy,"f").scene.add(l),nb(this,Qy,"f").push(l)}))}}static initResources(e){e.addResource();(new oy).load("forced_square.json",(t=>{tb(this,Zy,t,"f",eb),e.loadedResource()}))}}Zy=ib,Jy=new WeakMap,Qy=new WeakMap,$y=new WeakMap,eb={value:null};const rb=ib;var ab=n(909),ob={};ob.styleTagTransform=u(),ob.setAttributes=l(),ob.insert=o().bind(null,"head"),ob.domAPI=r(),ob.insertStyleElement=h();t()(ab.A,ob);ab.A&&ab.A.locals&&ab.A.locals;var sb,lb,cb,hb,db,ub,pb,fb,mb,gb,vb=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},wb=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};lb=new WeakMap,cb=new WeakMap,hb=new WeakMap,db=new WeakMap,ub=new WeakMap,pb=new WeakMap,fb=new WeakMap,sb=new WeakSet,mb=function(){wb(this,ub,"f").textContent=wb(this,cb,"f").get("Checkpoint order")+": "+(this.checkpointOrder+1)},gb=function(e){const t=e.getCheckpointOrders(),n=new Set;t.forEach((e=>{n.add(e)}));for(let e=0;e<65535;e++)if(!n.has(e))return e;return 65535};const yb=class{constructor(e,t,n,i){sb.add(this),lb.set(this,void 0),cb.set(this,void 0),hb.set(this,void 0),db.set(this,void 0),ub.set(this,void 0),pb.set(this,0),fb.set(this,void 0),vb(this,lb,e,"f"),vb(this,cb,t,"f"),vb(this,hb,i,"f"),vb(this,db,document.createElement("div"),"f"),wb(this,db,"f").className="hidden",e.appendChild(wb(this,db,"f")),wb(this,hb,"f").addChangeListener(vb(this,fb,(e=>{e?wb(this,db,"f").classList.add("touch"):wb(this,db,"f").classList.remove("touch")}),"f"));const r=document.createElement("div");r.className="buttons",wb(this,db,"f").appendChild(r);const a=document.createElement("button");a.addEventListener("click",(()=>{n.playUIClick(),this.checkpointOrder++})),r.appendChild(a);const o=document.createElement("img");o.src="images/arrow_up.svg",a.appendChild(o);const s=document.createElement("button");s.addEventListener("click",(()=>{n.playUIClick(),this.checkpointOrder--})),r.appendChild(s);const l=document.createElement("img");l.src="images/arrow_down.svg",s.appendChild(l),vb(this,ub,document.createElement("p"),"f"),wb(this,db,"f").appendChild(wb(this,ub,"f")),wb(this,sb,"m",mb).call(this)}dispose(){wb(this,lb,"f").removeChild(wb(this,db,"f")),wb(this,hb,"f").removeChangeListener(wb(this,fb,"f"))}hide(){wb(this,db,"f").classList.add("hidden"),wb(this,db,"f").classList.remove("editor-checkpoint-order")}show(){wb(this,db,"f").classList.remove("hidden"),wb(this,db,"f").classList.add("editor-checkpoint-order")}reset(){this.checkpointOrder=0}get checkpointOrder(){return wb(this,pb,"f")}set checkpointOrder(e){vb(this,pb,Math.max(0,Math.min(65535,e)),"f"),wb(this,sb,"m",mb).call(this)}setFromExistingCheckpoints(e){this.checkpointOrder=wb(this,sb,"m",gb).call(this,e)}};var bb=n(7),xb={};xb.styleTagTransform=u(),xb.setAttributes=l(),xb.insert=o().bind(null,"head"),xb.domAPI=r(),xb.insertStyleElement=h();t()(bb.A,xb);bb.A&&bb.A.locals&&bb.A.locals;var _b,kb,Eb,Sb,Mb,Tb,Ab=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Cb=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};_b=new WeakMap,kb=new WeakMap,Eb=new WeakMap,Sb=new WeakMap,Mb=new WeakMap,Tb=new WeakMap;const Pb=class{constructor(e,t,n,i,r){_b.set(this,void 0),kb.set(this,void 0),Eb.set(this,void 0),Sb.set(this,void 0),Mb.set(this,void 0),Tb.set(this,void 0),Ab(this,_b,e,"f"),Ab(this,kb,t,"f"),Ab(this,Eb,n,"f"),Ab(this,Sb,document.createElement("div"),"f"),Cb(this,Sb,"f").className="editor-height-selector",e.appendChild(Cb(this,Sb,"f")),Cb(this,Eb,"f").addChangeListener(Ab(this,Tb,(e=>{e?Cb(this,Sb,"f").classList.add("touch"):Cb(this,Sb,"f").classList.remove("touch")}),"f")),Ab(this,Mb,document.createElement("p"),"f"),Cb(this,Sb,"f").appendChild(Cb(this,Mb,"f"));const a=document.createElement("div");a.className="buttons",Cb(this,Sb,"f").appendChild(a);const o=document.createElement("button");o.addEventListener("click",i),a.appendChild(o);const s=document.createElement("img");s.src="images/arrow_up.svg",o.appendChild(s);const l=document.createElement("button");l.addEventListener("click",r),a.appendChild(l);const c=document.createElement("img");c.src="images/arrow_down.svg",l.appendChild(c)}refresh(e){Cb(this,Mb,"f").textContent=Cb(this,kb,"f").get("Height")+": "+e}dispose(){Cb(this,_b,"f").removeChild(Cb(this,Sb,"f")),Cb(this,Eb,"f").removeChangeListener(Cb(this,Tb,"f"))}};var Rb;!function(e){e[e.VehicleAccelerate=0]="VehicleAccelerate",e[e.VehicleTurnRight=1]="VehicleTurnRight",e[e.VehicleBrake=2]="VehicleBrake",e[e.VehicleTurnLeft=3]="VehicleTurnLeft",e[e.VehicleReset=4]="VehicleReset",e[e.VehicleCockpitCamera=5]="VehicleCockpitCamera",e[e.ToggleUI=6]="ToggleUI",e[e.EditorRotate=7]="EditorRotate",e[e.EditorHeightModifier=8]="EditorHeightModifier",e[e.EditorDelete=9]="EditorDelete",e[e.EditorMoveForwards=10]="EditorMoveForwards",e[e.EditorMoveRight=11]="EditorMoveRight",e[e.EditorMoveBackwards=12]="EditorMoveBackwards",e[e.EditorMoveLeft=13]="EditorMoveLeft",e[e.EditorRotateLeft=14]="EditorRotateLeft",e[e.EditorRotateRight=15]="EditorRotateRight",e[e.EditorMoveDown=16]="EditorMoveDown",e[e.EditorMoveUp=17]="EditorMoveUp",e[e.EditorTest=18]="EditorTest",e[e.EditorPick=19]="EditorPick",e[e.ToggleFpsCounter=20]="ToggleFpsCounter",e[e.ToggleSpectatorCamera=21]="ToggleSpectatorCamera",e[e.SpectatorMoveForwards=22]="SpectatorMoveForwards",e[e.SpectatorMoveRight=23]="SpectatorMoveRight",e[e.SpectatorMoveBackwards=24]="SpectatorMoveBackwards",e[e.SpectatorMoveLeft=25]="SpectatorMoveLeft",e[e.SpectatorSpeedModifier=26]="SpectatorSpeedModifier"}(Rb||(Rb={}));const Lb=Rb;var Ib=n(687),Nb={};Nb.styleTagTransform=u(),Nb.setAttributes=l(),Nb.insert=o().bind(null,"head"),Nb.domAPI=r(),Nb.insertStyleElement=h();t()(Ib.A,Nb);Ib.A&&Ib.A.locals&&Ib.A.locals;var Db,Ub,Bb,Ob,zb,Fb,Wb,Hb=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Vb=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Db=new WeakMap,Ub=new WeakMap,Bb=new WeakMap,Ob=new WeakMap,zb=new WeakMap,Fb=new WeakMap,Wb=new WeakMap;const Gb=class{constructor(e,t,n,i,r,a,o,s,l){Db.set(this,void 0),Ub.set(this,void 0),Bb.set(this,void 0),Ob.set(this,void 0),zb.set(this,void 0),Fb.set(this,void 0),Wb.set(this,void 0),Hb(this,Db,r,"f"),Hb(this,Ub,document.getElementById("ui"),"f"),Hb(this,Bb,document.createElement("div"),"f"),Vb(this,Bb,"f").className="track-export",Vb(this,Ub,"f").appendChild(Vb(this,Bb,"f"));const c=document.createElement("div");c.className="background",Vb(this,Bb,"f").appendChild(c);const h=document.createElement("div");h.className="box",Vb(this,Bb,"f").appendChild(h);const d=document.createElement("div");d.className="bar",h.appendChild(d);const u=document.createElement("button");u.className="button",u.innerHTML='<img class="button-icon" src="images/back.svg"> ',u.append(document.createTextNode(r.get("Back"))),u.addEventListener("click",(()=>{a.playUIClick(),t()})),d.appendChild(u),Hb(this,zb,document.createElement("button"),"f"),Vb(this,zb,"f").className="hidden",Vb(this,zb,"f").innerHTML='<img class="button-icon" src="images/copy.svg"> ',Vb(this,zb,"f").append(document.createTextNode(r.get("Copy"))),Vb(this,zb,"f").addEventListener("click",(()=>{a.playUIClick();try{navigator.clipboard.writeText(Vb(this,Ob,"f").value)}catch(e){console.error(e)}})),d.appendChild(Vb(this,zb,"f")),Hb(this,Fb,document.createElement("button"),"f"),Vb(this,Fb,"f").className="hidden",Vb(this,Fb,"f").innerHTML='<img class="button-icon" src="images/import.svg"> ',Vb(this,Fb,"f").append(document.createTextNode(r.get("Import"))),Vb(this,Fb,"f").addEventListener("click",(()=>{a.playUIClick();const e=()=>{const e=Vb(this,Bb,"f").className;Vb(this,Bb,"f").className="hidden",l.show(r.get("Failed to import track"),r.get("Ok"),(()=>{Vb(this,Bb,"f").className=e}))},i=Vb(this,Ob,"f").value,c=Py.fromExportString(i,o);if(null==c)e();else{const{trackName:i,trackData:a}=c,h=a.getId(o),d=a.createThumbnail(o);if(s.checkTrackExists(i)){const c=Vb(this,Bb,"f").className;Vb(this,Bb,"f").className="hidden",l.showConfirm(r.get('The track "{0}" already exists. Do you wish to overwrite it?',[i]),r.get("Cancel"),r.get("Overwrite"),(()=>{Vb(this,Bb,"f").className=c}),(()=>{Vb(this,Bb,"f").className=c,s.saveTrack(i,a,o)?null!=n?n(a,i,h,d):t():e()}))}else s.saveTrack(i,a,o)?null!=n?n(a,i,h,d):t():e()}})),d.appendChild(Vb(this,Fb,"f")),Hb(this,Ob,document.createElement("textarea"),"f"),Vb(this,Ob,"f").spellcheck=!1,h.appendChild(Vb(this,Ob,"f")),i&&(Vb(this,Ob,"f").placeholder=Vb(this,Db,"f").get("Paste track data here...")),Vb(this,Ob,"f").value=e,Vb(this,Ob,"f").readOnly=!i,i?(Vb(this,zb,"f").className="hidden",Vb(this,Fb,"f").className="button right"):(Vb(this,zb,"f").className="button right",Vb(this,Fb,"f").className="hidden"),window.addEventListener("keydown",Hb(this,Wb,(e=>{"Escape"==e.code&&(t(),e.preventDefault())}),"f"))}dispose(){Vb(this,Ub,"f").removeChild(Vb(this,Bb,"f")),window.removeEventListener("keydown",Vb(this,Wb,"f"))}};var jb=n(353),qb={};qb.styleTagTransform=u(),qb.setAttributes=l(),qb.insert=o().bind(null,"head"),qb.domAPI=r(),qb.insertStyleElement=h();t()(jb.A,qb);jb.A&&jb.A.locals&&jb.A.locals;var Xb=n(479),Yb={};Yb.styleTagTransform=u(),Yb.setAttributes=l(),Yb.insert=o().bind(null,"head"),Yb.domAPI=r(),Yb.insertStyleElement=h();t()(Xb.A,Yb);Xb.A&&Xb.A.locals&&Xb.A.locals;var Kb,Zb,Jb,Qb,$b,ex,tx,nx,ix,rx=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},ax=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class ox{constructor(e,t,n,i=!1){if(Kb.set(this,void 0),Zb.set(this,void 0),Jb.set(this,void 0),Qb.set(this,void 0),$b.set(this,void 0),ex.set(this,void 0),tx.set(this,null),nx.set(this,null),ix.set(this,null),this.record=null,rx(this,Kb,t,"f"),rx(this,Zb,document.getElementById("ui"),"f"),rx(this,Jb,document.createElement("div"),"f"),t.getSettingBoolean(Jh.TimerPosition)?ax(this,Jb,"f").className="timer up":ax(this,Jb,"f").className="timer",i)rx(this,Qb,null,"f");else{const t=document.createElement("div");t.className="left",ax(this,Jb,"f").appendChild(t);const i=document.createElement("h2");i.textContent=null!=n?'"'+n+'"':e.get("Record"),t.appendChild(i);const r=document.createElement("div");t.appendChild(r),rx(this,Qb,document.createElement("p"),"f"),ax(this,Qb,"f").className="small",ax(this,Qb,"f").textContent="- - -",r.appendChild(ax(this,Qb,"f"))}const r=document.createElement("div");r.className="center",ax(this,Jb,"f").appendChild(r);const a=document.createElement("h2");a.textContent=e.get("Current"),r.appendChild(a);const o=document.createElement("div");if(r.appendChild(o),rx(this,$b,document.createElement("p"),"f"),ax(this,$b,"f").textContent="- - -",o.appendChild(ax(this,$b,"f")),i)rx(this,ex,null,"f");else{const t=document.createElement("div");t.className="right",ax(this,Jb,"f").appendChild(t);const n=document.createElement("h2");n.textContent=e.get("Difference"),t.appendChild(n);const i=document.createElement("div");t.appendChild(i),rx(this,ex,document.createElement("p"),"f"),ax(this,ex,"f").className="small",ax(this,ex,"f").textContent="- - -",i.appendChild(ax(this,ex,"f"))}ax(this,Zb,"f").appendChild(ax(this,Jb,"f"))}dispose(){ax(this,Zb,"f").removeChild(ax(this,Jb,"f"))}setOverridePosition(e){(null!=e?e:ax(this,Kb,"f").getSettingBoolean(Jh.TimerPosition))?ax(this,Jb,"f").className="timer up":ax(this,Jb,"f").className="timer"}static formatTimeString(e,t=!1){if(null==e)return"---";{const n=Math.abs(e.numberOfFrames),i=Math.floor(n/6e4),r=Math.floor((n-6e4*i)/1e3),a=n-6e4*i-1e3*r;let o;return o=t?e.isNegative()?"-":"+":"",o+i.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")+"."+a.toString().padStart(3,"0")}}update(e){const t=e.getTime();let n;if(n=null!=this.record?t.difference(this.record):null,null!=ax(this,Qb,"f")){const e=ox.formatTimeString(this.record,!1);if(e!=ax(this,tx,"f")){ax(this,Qb,"f").innerHTML="";for(let t=0;t<e.length;++t){const n=document.createElement("span");n.textContent=e[t],ax(this,Qb,"f").appendChild(n)}rx(this,tx,e,"f")}null==this.record?"small center"!=ax(this,Qb,"f").className&&(ax(this,Qb,"f").className="small center"):"small"!=ax(this,Qb,"f").className&&(ax(this,Qb,"f").className="small")}const i=ox.formatTimeString(t,!1);if(i!=ax(this,nx,"f")){ax(this,$b,"f").innerHTML="";for(let e=0;e<i.length;++e){const t=document.createElement("span");t.textContent=i[e],ax(this,$b,"f").appendChild(t)}rx(this,nx,i,"f")}if(null!=ax(this,ex,"f")){const e=ox.formatTimeString(n,!0);if(e!=ax(this,ix,"f")){ax(this,ex,"f").innerHTML="";for(let t=0;t<e.length;++t){const i=document.createElement("span");0==t&&Number.isFinite(n)&&(i.className="sign"),i.textContent=e[t],ax(this,ex,"f").appendChild(i)}rx(this,ix,e,"f")}null==n?"small center"!=ax(this,ex,"f").className&&(ax(this,ex,"f").className="small center"):n.isNegative()?"small green"!=ax(this,ex,"f").className&&(ax(this,ex,"f").className="small green"):"small red"!=ax(this,ex,"f").className&&(ax(this,ex,"f").className="small red")}}}Kb=new WeakMap,Zb=new WeakMap,Jb=new WeakMap,Qb=new WeakMap,$b=new WeakMap,ex=new WeakMap,tx=new WeakMap,nx=new WeakMap,ix=new WeakMap;const sx=ox;var lx,cx,hx,dx,ux,px,fx,mx,gx,vx,wx,yx,bx,xx,_x,kx,Ex,Sx,Mx=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Tx=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};cx=new WeakMap,hx=new WeakMap,dx=new WeakMap,ux=new WeakMap,px=new WeakMap,fx=new WeakMap,mx=new WeakMap,gx=new WeakMap,vx=new WeakMap,wx=new WeakMap,yx=new WeakMap,bx=new WeakMap,xx=new WeakMap,_x=new WeakMap,kx=new WeakMap,lx=new WeakSet,Ex=function(e,t,n,i,r=null){const a=document.createElement("div");a.className="track",Tx(this,bx,"f").appendChild(a);const o=document.createElement("button");o.className="button",o.addEventListener("click",(()=>{Tx(this,dx,"f").playUIClick(),Tx(this,wx,"f").call(this,e,t,n,i)})),a.appendChild(o);const s=document.createElement("div");s.className="track-title",o.appendChild(s);const l=document.createElement("p");l.textContent=t,s.appendChild(l),o.appendChild(i);const c=Tx(this,ux,"f").getRecordTime(Tx(this,mx,"f").profileSlot,n),h=document.createElement("div");if(h.className="record",h.textContent=null!=c?sx.formatTimeString(c):Tx(this,hx,"f").get("No record"),o.appendChild(h),null!=r){const e=document.createElement("button");e.className="delete-button",e.innerHTML='<img src="images/erase.svg">',e.addEventListener("click",(()=>{Tx(this,dx,"f").playUIClick(),r()})),a.appendChild(e)}},Sx=function(){Tx(this,bx,"f").innerHTML="",Tx(this,fx,"f").refreshCustomTracks();const e=document.createElement("h2");if(e.textContent=Tx(this,hx,"f").get("Standard tracks"),Tx(this,bx,"f").appendChild(e),Tx(this,fx,"f").forEachStandard(((e,t,n,i)=>{Tx(this,lx,"m",Ex).call(this,n,t,e,i)})),!Tx(this,fx,"f").isCustomTracksEmpty()){const e=document.createElement("h2");e.textContent=Tx(this,hx,"f").get("Custom tracks"),Tx(this,bx,"f").appendChild(e),Tx(this,fx,"f").forEachCustom(((e,t,n,i)=>{Tx(this,lx,"m",Ex).call(this,n,t,e,i,(()=>{this.hide(),Tx(this,gx,"f").showConfirm(Tx(this,hx,"f").get('Are you sure you want to delete "{0}"?',[t]),Tx(this,hx,"f").get("Cancel"),Tx(this,hx,"f").get("Delete"),(()=>{this.show()}),(()=>{Tx(this,px,"f").deleteTrack(t),this.show()}))}))}))}};const Ax=class{constructor(e,t,n,i,r,a,o,s,l,c,h,d){lx.add(this),cx.set(this,void 0),hx.set(this,void 0),dx.set(this,void 0),ux.set(this,void 0),px.set(this,void 0),fx.set(this,void 0),mx.set(this,void 0),gx.set(this,void 0),vx.set(this,void 0),wx.set(this,void 0),yx.set(this,void 0),bx.set(this,void 0),xx.set(this,null),_x.set(this,!1),kx.set(this,void 0),Mx(this,cx,e,"f"),Mx(this,hx,t,"f"),Mx(this,dx,n,"f"),Mx(this,ux,i,"f"),Mx(this,px,r,"f"),Mx(this,fx,a,"f"),Mx(this,mx,s,"f"),Mx(this,gx,l,"f"),Mx(this,vx,c,"f"),Mx(this,wx,d,"f"),Mx(this,yx,document.createElement("div"),"f"),Tx(this,yx,"f").className="hidden",e.appendChild(Tx(this,yx,"f"));const u=document.createElement("div");u.className="bar",Tx(this,yx,"f").appendChild(u),Mx(this,bx,document.createElement("div"),"f"),Tx(this,bx,"f").className="tracks-container",Tx(this,yx,"f").appendChild(Tx(this,bx,"f"));const p=document.createElement("button");p.className="button",c?(p.innerHTML='<img class="button-icon" src="images/erase.svg"> ',p.append(document.createTextNode(Tx(this,hx,"f").get("Cancel")))):(p.innerHTML='<img class="button-icon" src="images/back.svg"> ',p.append(document.createTextNode(Tx(this,hx,"f").get("Back")))),p.addEventListener("click",(()=>{Tx(this,dx,"f").playUIClick(),h()})),u.appendChild(p);const f=document.createElement("button");f.className="button right",f.innerHTML='<img class="button-icon" src="images/import.svg"> ',f.append(document.createTextNode(Tx(this,hx,"f").get("Import"))),f.addEventListener("click",(()=>{Tx(this,dx,"f").playUIClick(),this.hide(),Mx(this,xx,new Gb("",(()=>{var e;this.show(),null===(e=Tx(this,xx,"f"))||void 0===e||e.dispose(),Mx(this,xx,null,"f")}),((e,t,n,i)=>{var r;null===(r=Tx(this,xx,"f"))||void 0===r||r.dispose(),Mx(this,xx,null,"f"),Tx(this,wx,"f").call(this,e,t,n,i)}),!0,t,n,o,r,l),"f")})),u.appendChild(f),window.addEventListener("keydown",Mx(this,kx,(e=>{Tx(this,_x,"f")&&"Escape"==e.code&&(h(),e.preventDefault())}),"f"))}dispose(){Tx(this,cx,"f").removeChild(Tx(this,yx,"f")),window.removeEventListener("keydown",Tx(this,kx,"f"))}hide(){Tx(this,yx,"f").className="hidden",Mx(this,_x,!1,"f")}show(){Tx(this,vx,"f")?Tx(this,yx,"f").className="track-selection editor-track-selection":Tx(this,yx,"f").className="track-selection",Mx(this,_x,!0,"f"),Tx(this,lx,"m",Sx).call(this)}get isOpen(){return Tx(this,_x,"f")}};var Cx,Px=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Rx=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class Lx{constructor(e){Cx.set(this,void 0);const t=[];e.forEach((([e,n,i])=>{t.push([e,n,i])})),Px(this,Cx,t,"f")}rotated(e){const t=[];return Rx(this,Cx,"f").forEach((([n,i,r])=>{switch(e){case 0:t.push([n,i,r]);break;case 1:t.push([r,i,-n]);break;case 2:t.push([-n,i,-r]);break;case 3:t.push([-r,i,n]);break;default:throw"Invalid rotation"}})),new Lx(t)}forEach(e){Rx(this,Cx,"f").forEach((([t,n,i])=>{e(t,n,i)}))}}Cx=new WeakMap;const Ix=Lx;var Nx=n(51),Dx={};Dx.styleTagTransform=u(),Dx.setAttributes=l(),Dx.insert=o().bind(null,"head"),Dx.domAPI=r(),Dx.insertStyleElement=h();t()(Nx.A,Dx);Nx.A&&Nx.A.locals&&Nx.A.locals;var Ux,Bx,Ox,zx,Fx,Wx,Hx=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Vx=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Bx=new WeakMap,Ox=new WeakMap,zx=new WeakMap,Fx=new WeakMap,Ux=new WeakSet,Wx=function(){!Vx(this,Fx,"f")&&Vx(this,zx,"f")?Vx(this,Ox,"f").className="editor-touch-controls":Vx(this,Ox,"f").className="hidden"};const Gx=class{constructor(e,t,n){Ux.add(this),Bx.set(this,void 0),Ox.set(this,void 0),zx.set(this,!1),Fx.set(this,!1),Hx(this,Bx,e,"f"),Hx(this,Ox,document.createElement("div"),"f"),Vx(this,Ox,"f").className="hidden",Vx(this,Bx,"f").appendChild(Vx(this,Ox,"f"));const i=document.createElement("button");i.className="rotate",i.innerHTML='<img src="images/rotate.svg">',i.addEventListener("touchstart",(()=>{i.classList.add("active")})),i.addEventListener("touchend",(()=>{i.classList.remove("active")})),i.addEventListener("click",(()=>{t.playUIClick(),n()})),Vx(this,Ox,"f").appendChild(i)}setEnabled(e){Hx(this,zx,e,"f"),Vx(this,Ux,"m",Wx).call(this)}hide(){Hx(this,Fx,!0,"f"),Vx(this,Ux,"m",Wx).call(this)}show(){Hx(this,Fx,!1,"f"),Vx(this,Ux,"m",Wx).call(this)}dispose(){Vx(this,Bx,"f").removeChild(Vx(this,Ox,"f"))}};var jx=n(242),qx={};qx.styleTagTransform=u(),qx.setAttributes=l(),qx.insert=o().bind(null,"head"),qx.domAPI=r(),qx.insertStyleElement=h();t()(jx.A,qx);jx.A&&jx.A.locals&&jx.A.locals;var Xx,Yx,Kx,Zx=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Jx=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Xx=new WeakMap,Yx=new WeakMap,Kx=new WeakMap;const Qx=class{constructor(e,t,n,i,r,a,o,s){Xx.set(this,void 0),Yx.set(this,void 0),Kx.set(this,void 0),Zx(this,Xx,document.getElementById("ui"),"f"),Zx(this,Yx,document.createElement("div"),"f"),Jx(this,Yx,"f").className="editor-help",Jx(this,Xx,"f").appendChild(Jx(this,Yx,"f"));const l=document.createElement("div");l.className="background",Jx(this,Yx,"f").appendChild(l);const c=document.createElement("section");c.className="container",Jx(this,Yx,"f").appendChild(c);const h=document.createElement("h1");h.textContent=t.get("How to use the editor"),c.appendChild(h);const d=document.createElement("section");d.className="content",c.appendChild(d);const u=document.createElement("h2");function p(e){const i=n.getKeyBindings(e).filter((e=>null!=e));return 0==i.length?t.get("Not set"):i.map((e=>"["+e+"]")).join(" "+t.get("or")+" ")}u.textContent=t.get("Camera controls"),d.appendChild(u);let f="";i.touchEnabled?(f+=t.get("The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.")+"\n\n",f+=t.get("The edited height can be changed by using the height selection in the bottom left corner.")):(f+=t.get("The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.")+"\n\n",f+=t.get("Alternatively, the camera can also be controlled using the following keyboard keys:")+"\n\n",f+="\t"+t.get("Move forwards:")+" "+p(Lb.EditorMoveForwards)+"\n",f+="\t"+t.get("Move backwards:")+" "+p(Lb.EditorMoveBackwards)+"\n",f+="\t"+t.get("Move left:")+" "+p(Lb.EditorMoveLeft)+"\n",f+="\t"+t.get("Move right:")+" "+p(Lb.EditorMoveRight)+"\n",f+="\t"+t.get("Rotate left:")+" "+p(Lb.EditorRotateLeft)+"\n",f+="\t"+t.get("Rotate right:")+" "+p(Lb.EditorRotateRight)+"\n\n",f+=t.get("The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:")+"\n\n",f+="\t"+t.get("Move up:")+" "+p(Lb.EditorMoveUp)+"\n",f+="\t"+t.get("Move down:")+" "+p(Lb.EditorMoveDown));const m=document.createElement("p");m.textContent=f,d.appendChild(m);const g=document.createElement("h2");g.textContent=t.get("Editing"),d.appendChild(g);let v="";i.touchEnabled?(v+=t.get("Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.")+"\n\n",v+=t.get("The selected part can then be rotated by tapping the rotate button in the bottom left corner.")+"\n\n",v+=t.get("Track parts can be deleted by using the delete tool in the right side menu.")):(v+=t.get("Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.")+"\n\n",v+=t.get("Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:")+" "+p(Lb.EditorPick)+"\n\n",v+=t.get("The selected part can then be rotated using the following keyboard shortcut:")+" "+p(Lb.EditorRotate)+"\n\n",v+=t.get("Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:")+" "+p(Lb.EditorDelete));const w=document.createElement("p");w.textContent=v,d.appendChild(w);const y=document.createElement("h2");y.textContent=t.get("Starting points, checkpoints and the finish line"),d.appendChild(y);let b=t.get("Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.")+"\n\n";b+=t.get("Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.")+"\n\n",b+=t.get("Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.")+"\n\n",b+=t.get("The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.");const x=document.createElement("p");x.textContent=b,d.appendChild(x);const _=document.createElement("div");_.className="part-images",d.appendChild(_);const k=document.createElement("div");_.appendChild(k);const E=document.createElement("img");E.src=r,k.appendChild(E);const S=document.createElement("span");S.textContent=t.get("Starting point"),k.appendChild(S);const M=document.createElement("div");_.appendChild(M);const T=document.createElement("img");T.src=a,M.appendChild(T);const A=document.createElement("span");A.textContent=t.get("Checkpoint"),M.appendChild(A);const C=document.createElement("div");_.appendChild(C);const P=document.createElement("img");P.src=o,C.appendChild(P);const R=document.createElement("span");R.textContent=t.get("Finish line"),C.appendChild(R);const L=document.createElement("h2");L.textContent=t.get("Exporting the track"),d.appendChild(L);let I=t.get("When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.")+"\n\n";const N=document.createElement("p");N.textContent=I,d.appendChild(N);const D=document.createElement("div");D.className="button-wrapper",c.appendChild(D);const U=document.createElement("button");U.className="button",U.innerHTML='<img class="button-icon" src="images/cancel.svg"> ',U.append(document.createTextNode(t.get("Close"))),U.addEventListener("click",(()=>{e.playUIClick(),s()})),D.appendChild(U),window.addEventListener("keydown",Zx(this,Kx,(e=>{"Escape"==e.code&&(s(),e.preventDefault())}),"f"))}dispose(){Jx(this,Xx,"f").removeChild(Jx(this,Yx,"f")),window.removeEventListener("keydown",Jx(this,Kx,"f"))}};var $x,e_,t_,n_,i_,r_,a_,o_,s_,l_,c_,h_,d_,u_,p_,f_,m_,g_,v_,w_,y_,b_,x_,__,k_,E_,S_,M_,T_,A_,C_,P_,R_,L_,I_,N_,D_,U_,B_,O_,z_,F_,W_,H_,V_,G_,j_,q_,X_,Y_,K_,Z_,J_,Q_,$_,ek,tk,nk,ik,rk,ak,ok,sk,lk,ck,hk,dk,uk,pk,fk,mk,gk,vk,wk,yk,bk,xk,_k,kk,Ek,Sk,Mk,Tk,Ak,Ck,Pk,Rk,Lk,Ik,Nk=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Dk=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};e_=new WeakMap,t_=new WeakMap,n_=new WeakMap,i_=new WeakMap,r_=new WeakMap,a_=new WeakMap,o_=new WeakMap,s_=new WeakMap,l_=new WeakMap,c_=new WeakMap,h_=new WeakMap,d_=new WeakMap,u_=new WeakMap,p_=new WeakMap,f_=new WeakMap,m_=new WeakMap,g_=new WeakMap,v_=new WeakMap,w_=new WeakMap,y_=new WeakMap,b_=new WeakMap,x_=new WeakMap,__=new WeakMap,k_=new WeakMap,E_=new WeakMap,S_=new WeakMap,M_=new WeakMap,T_=new WeakMap,A_=new WeakMap,C_=new WeakMap,P_=new WeakMap,R_=new WeakMap,L_=new WeakMap,I_=new WeakMap,N_=new WeakMap,D_=new WeakMap,U_=new WeakMap,B_=new WeakMap,O_=new WeakMap,z_=new WeakMap,F_=new WeakMap,W_=new WeakMap,H_=new WeakMap,V_=new WeakMap,G_=new WeakMap,j_=new WeakMap,q_=new WeakMap,X_=new WeakMap,Y_=new WeakMap,K_=new WeakMap,Z_=new WeakMap,J_=new WeakMap,Q_=new WeakMap,$_=new WeakMap,ek=new WeakMap,tk=new WeakMap,nk=new WeakMap,ik=new WeakMap,rk=new WeakMap,ak=new WeakMap,ok=new WeakMap,sk=new WeakMap,lk=new WeakMap,ck=new WeakMap,hk=new WeakMap,dk=new WeakMap,uk=new WeakMap,pk=new WeakMap,_k=new WeakMap,kk=new WeakMap,Ek=new WeakMap,$x=new WeakSet,fk=function(e){const t=document.getElementById("ui");Nk(this,g_,document.createElement("div"),"f"),Dk(this,g_,"f").className="hidden",t.appendChild(Dk(this,g_,"f")),Nk(this,v_,document.createElement("div"),"f"),Dk(this,v_,"f").className="top",Dk(this,g_,"f").appendChild(Dk(this,v_,"f"));const n=document.createElement("div");n.className="button-bar",Dk(this,v_,"f").appendChild(n);const i=document.createElement("button");i.className="button",i.innerHTML='<img class="button-icon" src="images/quit.svg"> ',i.append(document.createTextNode(Dk(this,n_,"f").get("Exit"))),i.addEventListener("click",(()=>{Dk(this,e_,"f").playUIClick(),Dk(this,$x,"m",mk).call(this,e)})),n.appendChild(i);const r=document.createElement("button");r.className="button",r.innerHTML='<img class="button-icon" src="images/test.svg"> ',r.append(Dk(this,n_,"f").get("Test")),r.addEventListener("click",(()=>{Dk(this,e_,"f").playUIClick(),Dk(this,$x,"m",gk).call(this)})),n.appendChild(r);const a=document.createElement("button");a.className="button",a.innerHTML='<img class="button-icon" src="images/random.svg"> ',a.append(Dk(this,n_,"f").get("Generate")),a.addEventListener("click",(()=>{Dk(this,e_,"f").playUIClick();const e=()=>{var e;!function(e){let t;e.clear();do{let n=0,i=0,r=0,a=Math.floor(4*Math.random());Math.random()<.5&&(i=Math.floor(20*Math.random()));const o=new Map;function s(){switch(a){case 0:--r;break;case 1:--n;break;case 2:++r;break;case 3:++n}}function l(){switch(a){case 0:++r;break;case 1:++n;break;case 2:--r;break;case 3:--n}}function c(){switch((a+1)%4){case 0:--r;break;case 1:--n;break;case 2:++r;break;case 3:++n}}function h(){switch(((a-1)%4+4)%4){case 0:--r;break;case 1:--n;break;case 2:++r;break;case 3:++n}}function d(e,n,i,r=null){const a=e+"|"+n+"|"+i;o.has(a)&&(t=!0),null!=r&&(r.x=e,r.y=n,r.z=i,"direction"in r&&(r.direction=(r.direction%4+4)%4)),o.set(a,r)}function u(e,t,n){return!!o.has(e+"|"+t+"|"+n)}function p(){let e=!1;for(let t=0;t<i;++t)if(u(n,t,r)){e=!0;break}if(!e)for(let e=0;e<i;++e){let t;t=0==e&&e==i-1?22:0==e?21:e==i-1?19:20,d(n,e,r,{type:t,direction:0})}}function f(e){e>0?(--e,Math.random()<.2?E(e):Math.random()<.6?g(e):Math.random()<.5?y(e,i<2||Math.random()<.5):Math.random()<.5?v(e):w(e)):_()}function m(e){e>0?(--e,Math.random()<.1?S(e):Math.random()<.6?M(e):Math.random()<.5?C(e,i<2||Math.random()<.5):Math.random()<.5?T(e):A(e)):S(e)}function g(e){d(n,i,r,{type:0,direction:a}),p(),s(),f(e)}function v(e){d(n,i,r,{type:1,direction:a-1}),p(),a=(a+1)%4,s(),e>0?(--e,Math.random()<.4?g(e):Math.random()<.5?v(e):w(e)):_()}function w(e){d(n,i,r,{type:1,direction:a}),p(),a=((a-1)%4+4)%4,s(),e>0?(--e,Math.random()<.4?g(e):Math.random()<.5?v(e):w(e)):_()}function y(e,t){let o;o=t?2:3,t||--i,d(n,i+1,r),d(n,i,r,{type:o,direction:a}),s(),t&&++i,e>0?(--e,Math.random()<.4||i<=3?b(e,t):x(e,t)):b(e,t)}function b(e,t){let o;t||--i,d(n,i+1,r),o=t?3:2,d(n,i,r,{type:o,direction:a+2}),s(),t&&++i,e>0?f(--e):_()}function x(e,t){let o;t||(i-=2),d(n,i+1,r),d(n,i+2,r),o=t?a:a+2,d(n,i,r,{type:4,direction:o}),s(),t&&(i+=2),e>0?(--e,Math.random()<.4||i<=3?b(e,t):x(e,t)):b(e,t)}function _(){d(n,i,r,{type:6,direction:a})}function k(e){d(n,i,r,{type:5,direction:a}),p(),s(),f(e)}function E(e){Math.random()<.5?(d(n,i,r,{type:8,direction:a}),p(),h(),d(n,i,r,{type:12,direction:a+2}),p(),s()):(d(n,i,r,{type:9,direction:a}),p(),c(),d(n,i,r,{type:12,direction:a+1}),p(),s(),h()),m(e)}function S(e){Math.random()<.5?(d(n,i,r,{type:12,direction:a+3}),p(),c(),d(n,i,r,{type:9,direction:a+2}),p(),s()):(d(n,i,r,{type:8,direction:a+2}),p(),c(),d(n,i,r,{type:12,direction:a}),p(),s(),h()),f(e)}function M(e){d(n,i,r,{type:10,direction:a}),p(),c(),d(n,i,r,{type:10,direction:a+2}),p(),h(),s(),m(e)}function T(e){d(n,i,r,{type:10,direction:a}),p(),s(),d(n,i,r,{type:12,direction:a+3}),p(),c(),d(n,i,r,{type:10,direction:a+1}),p(),l(),d(n,i,r,{type:11,direction:a+3}),p(),s(),a=(a+1)%4,s(),m(e)}function A(e){d(n,i,r,{type:11,direction:a}),p(),c(),d(n,i,r,{type:10,direction:a+2}),p(),s(),d(n,i,r,{type:12,direction:a}),p(),h(),d(n,i,r,{type:10,direction:a+1}),p(),l(),a=((a-1)%4+4)%4,s(),m(e)}function C(e,t){let o,l;t?(o=13,l=14):(o=15,l=16),t||--i,c(),d(n,i+1,r),d(n,i,r,{type:o,direction:a}),h(),d(n,i+1,r),d(n,i,r,{type:l,direction:a}),s(),t&&++i,e>0?(--e,Math.random()<.4||i<=3?P(e,t):R(e,t)):P(e,t)}function P(e,t){let o,l;t||--i,t?(o=16,l=15):(o=14,l=13),c(),d(n,i+1,r),d(n,i,r,{type:o,direction:a+2}),h(),d(n,i+1,r),d(n,i,r,{type:l,direction:a+2}),s(),t&&++i,m(e)}function R(e,t){t||(i-=2),t?(c(),d(n,i+1,r),d(n,i+2,r),d(n,i,r,{type:17,direction:a}),h(),d(n,i+1,r),d(n,i+2,r),d(n,i,r,{type:18,direction:a})):(c(),d(n,i+1,r),d(n,i+2,r),d(n,i,r,{type:18,direction:a+2}),h(),d(n,i+1,r),d(n,i+2,r),d(n,i,r,{type:17,direction:a+2})),s(),t&&(i+=2),e>0?(--e,Math.random()<.4||i<=3?P(e,t):R(e,t)):P(e,t)}t=!1,k(50),t||o.forEach((t=>{null!=t&&e.setPart(t.x,t.y,t.z,t.type,t.direction,null)}))}while(t)}(Dk(this,a_,"f")),Dk(this,a_,"f").generateMeshes(),null===(e=Dk(this,ck,"f"))||void 0===e||e.refresh(Dk(this,a_,"f")),Dk(this,E_,"f").setFromExistingCheckpoints(Dk(this,a_,"f")),Nk(this,K_,!0,"f")};Dk(this,K_,"f")?e():(Dk(this,g_,"f").inert=!0,Dk(this,d_,"f").showConfirm(Dk(this,n_,"f").get("Are you sure you want to generate a new track?\n\nYour current track will be lost!"),Dk(this,n_,"f").get("Cancel"),Dk(this,n_,"f").get("Confirm"),(()=>{Dk(this,g_,"f").inert=!1}),(()=>{e(),Dk(this,g_,"f").inert=!1})))})),n.appendChild(a),Nk(this,S_,new Ax(t,Dk(this,n_,"f"),Dk(this,e_,"f"),Dk(this,s_,"f"),Dk(this,l_,"f"),Dk(this,c_,"f"),Dk(this,o_,"f"),Dk(this,h_,"f"),Dk(this,d_,"f"),!0,(()=>{Dk(this,g_,"f").className="editor",Dk(this,S_,"f").hide()}),((e,t)=>{var n;Dk(this,a_,"f").loadTrackData(e,!1),Dk(this,a_,"f").generateMeshes(),null===(n=Dk(this,ck,"f"))||void 0===n||n.refresh(Dk(this,a_,"f")),Dk(this,E_,"f").setFromExistingCheckpoints(Dk(this,a_,"f")),Nk(this,K_,!0,"f"),Dk(this,w_,"f").value=t,this.resetView(),Dk(this,g_,"f").className="editor",Dk(this,S_,"f").hide()})),"f"),Nk(this,T_,new Gx(Dk(this,g_,"f"),Dk(this,e_,"f"),(()=>{Nk(this,ok,(Dk(this,ok,"f")+1)%4,"f")})),"f"),Dk(this,T_,"f").setEnabled(Dk(this,u_,"f").touchEnabled);const o=document.createElement("button");o.className="button",o.innerHTML='<img class="button-icon" src="images/load.svg"> ',o.append(document.createTextNode(Dk(this,n_,"f").get("Load"))),o.addEventListener("click",(()=>{Dk(this,e_,"f").playUIClick(),Dk(this,K_,"f")?(Dk(this,S_,"f").show(),Dk(this,g_,"f").className="hidden"):(Dk(this,g_,"f").inert=!0,Dk(this,d_,"f").showConfirm(Dk(this,n_,"f").get("Are you sure you want to load a new track?\n\nYour current track will be lost!"),Dk(this,n_,"f").get("Cancel"),Dk(this,n_,"f").get("Confirm"),(()=>{Dk(this,g_,"f").inert=!1}),(()=>{Dk(this,S_,"f").show(),Dk(this,g_,"f").className="hidden",Dk(this,g_,"f").inert=!1})))})),n.appendChild(o);const s=document.createElement("button");s.className="button",s.innerHTML='<img class="button-icon" src="images/save.svg"> ',s.append(document.createTextNode(Dk(this,n_,"f").get("Save"))),s.addEventListener("click",(()=>{Dk(this,e_,"f").playUIClick();const e=this.getTrackName();if(null==e)Dk(this,$x,"m",wk).call(this,Dk(this,n_,"f").get("Failed to save - Track name is needed!"),!1);else{const t=()=>{Dk(this,l_,"f").saveTrack(e,Dk(this,a_,"f").getTrackData(),Dk(this,o_,"f"))?(Dk(this,$x,"m",wk).call(this,Dk(this,n_,"f").get("Track saved!"),!0),Nk(this,K_,!0,"f")):Dk(this,$x,"m",wk).call(this,Dk(this,n_,"f").get("Failed to save!"),!1)},n=Dk(this,l_,"f").checkTrackExists(e);null==n?Dk(this,$x,"m",wk).call(this,Dk(this,n_,"f").get("Failed to save!"),!1):0==n?t():(Dk(this,g_,"f").inert=!0,Dk(this,d_,"f").showConfirm(Dk(this,n_,"f").get('Are you sure you want to overwrite "{0}"?',[e]),Dk(this,n_,"f").get("Cancel"),Dk(this,n_,"f").get("Confirm"),(()=>{Dk(this,g_,"f").inert=!1}),(()=>{t(),Dk(this,g_,"f").inert=!1})))}})),n.appendChild(s);const l=document.createElement("button");l.className="button",l.innerHTML='<img class="button-icon" src="images/export.svg"> ',l.append(document.createTextNode(Dk(this,n_,"f").get("Export"))),l.addEventListener("click",(()=>{Dk(this,e_,"f").playUIClick();const e=this.getTrackName();if(null==e)Dk(this,$x,"m",wk).call(this,Dk(this,n_,"f").get("Failed to export - Track name is needed!"),!1);else{const t=Dk(this,a_,"f").getTrackData().toExportString(e,Dk(this,o_,"f"));Dk(this,g_,"f").className="hidden",Nk(this,M_,new Gb(t,(()=>{var e;null===(e=Dk(this,M_,"f"))||void 0===e||e.dispose(),Nk(this,M_,null,"f"),Dk(this,g_,"f").className="editor"}),null,!1,Dk(this,n_,"f"),Dk(this,e_,"f"),Dk(this,o_,"f"),Dk(this,l_,"f"),Dk(this,d_,"f")),"f")}})),n.appendChild(l);const c=document.createElement("button");c.className="button",c.innerHTML='<img class="button-icon" src="images/help.svg"> ',c.append(document.createTextNode(Dk(this,n_,"f").get("Help"))),c.addEventListener("click",(()=>{Dk(this,e_,"f").playUIClick();const e=Dk(this,o_,"f").getPart(Bw.Start).mesh;if(null==e)throw new Error("Starting point mesh is null");const t=Dk(this,$x,"m",Sk).call(this,e),n=Dk(this,o_,"f").getPart(Bw.Checkpoint).mesh;if(null==n)throw new Error("Checkpoint mesh is null");const i=Dk(this,$x,"m",Sk).call(this,n),r=Dk(this,o_,"f").getPart(Bw.Finish).mesh;if(null==r)throw new Error("Finish line mesh is null");const a=Dk(this,$x,"m",Sk).call(this,r);Dk(this,g_,"f").className="hidden",Nk(this,A_,new Qx(Dk(this,e_,"f"),Dk(this,n_,"f"),Dk(this,p_,"f"),Dk(this,u_,"f"),t,i,a,(()=>{var e;null===(e=Dk(this,A_,"f"))||void 0===e||e.dispose(),Nk(this,A_,null,"f"),Dk(this,g_,"f").className="editor"})),"f")})),n.appendChild(c);const h=document.createElement("div");h.className="trackname-input",h.textContent=Dk(this,n_,"f").get("Track name")+": ",Dk(this,v_,"f").appendChild(h),Nk(this,w_,document.createElement("input"),"f"),Dk(this,w_,"f").type="text",Dk(this,w_,"f").maxLength=64,Dk(this,w_,"f").spellcheck=!1,h.appendChild(Dk(this,w_,"f")),Nk(this,y_,document.createElement("div"),"f"),Dk(this,y_,"f").className="message-box",Dk(this,g_,"f").appendChild(Dk(this,y_,"f"));const d=document.createElement("side");d.className="side",Dk(this,g_,"f").appendChild(d),Nk(this,E_,new yb(d,Dk(this,n_,"f"),Dk(this,e_,"f"),Dk(this,u_,"f")),"f"),Nk(this,x_,document.createElement("div"),"f"),Dk(this,x_,"f").className="side-panel",d.appendChild(Dk(this,x_,"f")),Nk(this,__,document.createElement("div"),"f"),Dk(this,__,"f").className="category-panel",Dk(this,x_,"f").appendChild(Dk(this,__,"f"));const u=new zr(Ky.partWidth,Ky.partHeight,Ky.partLength);u.translate(0,2.5,0);const p=new Br(u,Dk(this,$_,"f")),f=document.createElement("button");f.addEventListener("click",(()=>{Dk(this,e_,"f").playUIClick(),Dk(this,$x,"m",bk).call(this,null)})),Dk(this,__,"f").appendChild(f);const m=document.createElement("img");m.src="images/erase.svg",f.appendChild(m),Dk(this,Q_,"f").add(p),Dk(this,hk,"f").push({id:null,mesh:p,button:f,tiles:new Ix([[0,0,0]]),isCheckpoint:!1,category:null}),Nk(this,k_,new Pb(Dk(this,g_,"f"),Dk(this,n_,"f"),Dk(this,u_,"f"),(()=>{Dk(this,e_,"f").playUIClick(),Nk(this,$x,Dk(this,$x,"a",Mk)+1,"a",Tk)}),(()=>{Dk(this,e_,"f").playUIClick(),Nk(this,$x,Math.max(0,Dk(this,$x,"a",Mk)-1),"a",Tk)})),"f"),Dk(this,k_,"f").refresh(Dk(this,$x,"a",Mk))},mk=function(e){const t=()=>{Dk(this,r_,"f").trigger((()=>{Nk(this,K_,!0,"f"),Dk(this,w_,"f").value="",e(),Dk(this,g_,"f").inert=!1}))};Dk(this,K_,"f")?t():(Dk(this,g_,"f").inert=!0,Dk(this,d_,"f").showConfirm(Dk(this,n_,"f").get("Are you sure you want to exit the editor?")+"\n\n"+Dk(this,n_,"f").get("All unsaved data will be lost!"),Dk(this,n_,"f").get("Cancel"),Dk(this,n_,"f").get("Confirm"),(()=>{Dk(this,g_,"f").inert=!1}),(()=>{t()})))},gk=function(){if(null!=Dk(this,a_,"f").getStartTransform()){if(null==Dk(this,f_,"f"))throw"Test callback is null";Dk(this,f_,"f").call(this)}else Dk(this,$x,"m",wk).call(this,Dk(this,n_,"f").get("Starting point is missing!"),!1)},vk=function(){if(null!=Dk(this,ak,"f")){const e=Dk(this,a_,"f").getPartAt(Dk(this,ak,"f").x,Dk(this,ak,"f").y,Dk(this,ak,"f").z);if(null!=e){const t=Dk(this,hk,"f").findIndex((t=>t.id==e.id));t>=0&&(Dk(this,$x,"m",xk).call(this,t),Nk(this,ok,e.rotation,"f"))}}},wk=function(e,t){null!=Dk(this,b_,"f")&&(clearTimeout(Dk(this,b_,"f")),Nk(this,b_,null,"f")),t?Dk(this,y_,"f").classList.add("green"):Dk(this,y_,"f").classList.remove("green"),Dk(this,y_,"f").classList.remove("show"),Dk(this,y_,"f").classList.remove("hide"),Nk(this,b_,window.setTimeout((()=>{Dk(this,y_,"f").textContent=e,Dk(this,y_,"f").classList.add("show"),Nk(this,b_,window.setTimeout((()=>{Dk(this,y_,"f").classList.remove("show"),Dk(this,y_,"f").classList.add("hide")}),3e3),"f")}),0),"f")},yk=function(){var e;const t=Dk(this,o_,"f").getAllParts();for(let n=0;n<t.length;++n){const i=t[n];if(null==i.mesh)throw"Mesh is not loaded";const r=i.mesh.clone(),a=Dk(this,$x,"m",Sk).call(this,r);let o=null===(e=Dk(this,uk,"f").find((e=>e.category==i.category)))||void 0===e?void 0:e.partPanel;if(null==o){o=document.createElement("div"),o.className="part-panel hidden",Dk(this,x_,"f").prepend(o);const e=document.createElement("button");e.addEventListener("click",(()=>{Dk(this,$x,"m",bk).call(this,i.category),Dk(this,e_,"f").playUIClick()})),Dk(this,__,"f").appendChild(e);const t=document.createElement("img");t.src=a,e.appendChild(t),Dk(this,uk,"f").push({category:i.category,button:e,partPanel:o,selectedIndex:null})}const s=document.createElement("button");s.addEventListener("click",(()=>{Dk(this,e_,"f").playUIClick(),Dk(this,$x,"m",xk).call(this,1+n)})),o.appendChild(s);const l=document.createElement("img");l.src=a,s.appendChild(l),r.material=Dk(this,$_,"f"),Dk(this,Q_,"f").add(r),Dk(this,hk,"f").push({id:i.id,mesh:r,button:s,tiles:i.tiles,isCheckpoint:null!=i.detector&&i.detector.type==yy.Checkpoint,category:i.category})}Dk(this,$x,"m",xk).call(this,1)},bk=function(e){var t;if(Dk(this,pk,"f")!=e)if(Nk(this,pk,e,"f"),Dk(this,uk,"f").forEach((t=>{t.category==e?(t.button.classList.add("selected"),t.partPanel.classList.remove("hidden")):(t.button.classList.remove("selected"),t.partPanel.classList.add("hidden"))})),null==e)Dk(this,$x,"m",xk).call(this,0);else{let n=null===(t=Dk(this,uk,"f").find((t=>t.category==e)))||void 0===t?void 0:t.selectedIndex;if(null==n&&(n=Dk(this,hk,"f").findIndex((t=>t.category==e)),n<0))throw"Empty category";Dk(this,$x,"m",xk).call(this,n)}},xk=function(e){Dk(this,hk,"f").forEach((({button:t},n)=>{t.className=n==e?"selected":""})),Nk(this,dk,e,"f");const t=Dk(this,uk,"f").find((e=>e.category==Dk(this,pk,"f")));null!=t&&(t.selectedIndex=e);const n=Dk(this,hk,"f")[e];null!=n&&n.isCheckpoint?Dk(this,E_,"f").show():Dk(this,E_,"f").hide()},Sk=function(e){if(null==Dk(this,_k,"f")||null==Dk(this,kk,"f")||null==Dk(this,Ek,"f")){const e=document.createElement("canvas");e.width=128,e.height=128,Nk(this,_k,new Zs({canvas:e,alpha:!0,preserveDrawingBuffer:!0,antialias:!0}),"f"),Dk(this,_k,"f").outputColorSpace=Ct,Nk(this,Ek,new Qs,"f"),Nk(this,kk,new _a(-1,1,1,-1,.1,1e4),"f"),Dk(this,kk,"f").position.set(1e3,1e3,1e3),Dk(this,kk,"f").lookAt(0,0,0),Dk(this,Ek,"f").add(Dk(this,kk,"f"));const t=new Nh(16777215,4.7);t.position.set(8,10,10),Dk(this,Ek,"f").add(t)}e.geometry.computeBoundingSphere();const t=(new ii).copy(e.geometry.boundingSphere);return Dk(this,kk,"f").zoom=1/t.radius*.9,Dk(this,kk,"f").position.copy(t.center),Dk(this,kk,"f").position.addScalar(1e3),Dk(this,kk,"f").updateProjectionMatrix(),Dk(this,_k,"f").clear(),Dk(this,Ek,"f").add(e),Dk(this,_k,"f").render(Dk(this,Ek,"f"),Dk(this,kk,"f")),Dk(this,Ek,"f").remove(e),Dk(this,_k,"f").domElement.toDataURL()},Mk=function(){return Math.floor(Dk(this,J_,"f").position.y/5)},Tk=function(e){const t=Dk(this,$x,"a",Mk);Dk(this,J_,"f").position.y=5*e,Dk(this,F_,"f").position.y+=5*(e-t),Dk(this,W_,"f").target.y=5*e,Dk(this,k_,"f").refresh(e),Dk(this,J_,"f").updateWorldMatrix(!0,!0),Dk(this,W_,"f").update()},Ak=function(){const e=performance.now();if(e-Dk(this,t_,"f")>35){const t=Dk(this,e_,"f").getBuffer("editor_edit");if(null!=t&&null!=Dk(this,e_,"f").context&&null!=Dk(this,e_,"f").destinationSfx){const e=Dk(this,e_,"f").context.createBufferSource();e.buffer=t,e.playbackRate.value=.7;const n=Dk(this,e_,"f").context.createGain();n.gain.value=.05,e.connect(n),n.connect(Dk(this,e_,"f").destinationSfx),e.start(0)}Nk(this,t_,e,"f")}},Ck=function(){if(Dk(this,u_,"f").touchEnabled)return new Un(Math.round(Dk(this,W_,"f").target.x/Ky.partWidth),Math.round(Dk(this,W_,"f").target.y/Ky.partHeight),Math.round(Dk(this,W_,"f").target.z/Ky.partLength));let e;if(null!=Dk(this,nk,"f")?(Dk(this,Z_,"f").setFromCamera(Dk(this,nk,"f"),Dk(this,i_,"f").camera),e=Dk(this,Z_,"f").intersectObjects([Dk(this,J_,"f")])):e=[],e.length>0){const t=e[0],n=new Un(Math.round(t.point.x/Ky.partWidth),Math.floor(Dk(this,J_,"f").position.y/Ky.partHeight),Math.round(t.point.z/Ky.partLength));return t.point.distanceToSquared(Dk(this,W_,"f").target)<=Dk(this,lk,"f")*Dk(this,lk,"f")?n:null}return null},Pk=function(e,t){const n=[];return t.rotated(Dk(this,ok,"f")).forEach(((t,i,r)=>{const a=e.x+t,o=e.y+i,s=e.z+r;Dk(this,a_,"f").hasPartAt(a,o,s)&&n.push({x:a,y:o,z:s})})),n},Rk=function(e){var t;let n=!1;e.forEach((({x:e,y:t,z:i})=>{Dk(this,a_,"f").hasPartAt(e,t,i)&&(Dk(this,a_,"f").deletePart(e,t,i),n=!0)})),n&&(Dk(this,$x,"m",Ak).call(this),Dk(this,a_,"f").generateMeshes(),null===(t=Dk(this,ck,"f"))||void 0===t||t.refresh(Dk(this,a_,"f")),Dk(this,E_,"f").setFromExistingCheckpoints(Dk(this,a_,"f")),Nk(this,K_,!1,"f"))},Lk=function(e){const t=4*Dk(this,W_,"f").getDistance();if(Dk(this,m_,"f")&&Dk(this,$x,"m",Ik).call(this)){const n=new Un;if(Dk(this,V_,"f")&&(n.z=-1),Dk(this,G_,"f")&&(n.x=1),Dk(this,j_,"f")&&(n.z=1),Dk(this,q_,"f")&&(n.x=-1),0!=n.x||0!=n.z){const i=n.applyQuaternion(Dk(this,F_,"f").quaternion),r=new ln(i.x,i.z).normalize(),a=new Un(r.x,0,r.y).multiplyScalar(t*e);Dk(this,F_,"f").position.add(a),Dk(this,W_,"f").target.add(a)}let i=0;if(Dk(this,X_,"f")&&(i+=1.5*Math.PI*e),Dk(this,Y_,"f")&&(i-=1.5*Math.PI*e),0!=i){const e=new ln(Dk(this,F_,"f").position.x,Dk(this,F_,"f").position.z).distanceTo(new ln(Dk(this,W_,"f").target.x,Dk(this,W_,"f").target.z)),t=Math.atan2(Dk(this,F_,"f").position.z-Dk(this,W_,"f").target.z,Dk(this,F_,"f").position.x-Dk(this,W_,"f").target.x)+i;Dk(this,F_,"f").position.x=Dk(this,W_,"f").target.x+Math.cos(t)*e,Dk(this,F_,"f").position.z=Dk(this,W_,"f").target.z+Math.sin(t)*e,Dk(this,W_,"f").update()}}},Ik=function(){return!!Dk(this,m_,"f")&&(document.activeElement!=Dk(this,w_,"f")&&(!Dk(this,d_,"f").isOpen&&null==Dk(this,M_,"f")&&!Dk(this,S_,"f").isOpen&&null==Dk(this,A_,"f")))};const Uk=class{constructor(e,t,n,i,r,a,o,s,l,c,h,d,u,p){$x.add(this),e_.set(this,void 0),t_.set(this,performance.now()),n_.set(this,void 0),i_.set(this,void 0),r_.set(this,void 0),a_.set(this,void 0),o_.set(this,void 0),s_.set(this,void 0),l_.set(this,void 0),c_.set(this,void 0),h_.set(this,void 0),d_.set(this,void 0),u_.set(this,void 0),p_.set(this,void 0),f_.set(this,null),m_.set(this,!1),g_.set(this,void 0),v_.set(this,void 0),w_.set(this,void 0),y_.set(this,void 0),b_.set(this,null),x_.set(this,void 0),__.set(this,void 0),k_.set(this,void 0),E_.set(this,void 0),S_.set(this,void 0),M_.set(this,null),T_.set(this,void 0),A_.set(this,null),C_.set(this,void 0),P_.set(this,void 0),R_.set(this,void 0),L_.set(this,void 0),I_.set(this,void 0),N_.set(this,void 0),D_.set(this,void 0),U_.set(this,void 0),B_.set(this,void 0),O_.set(this,void 0),z_.set(this,void 0),F_.set(this,void 0),W_.set(this,void 0),H_.set(this,!1),V_.set(this,!1),G_.set(this,!1),j_.set(this,!1),q_.set(this,!1),X_.set(this,!1),Y_.set(this,!1),K_.set(this,!0),Z_.set(this,void 0),J_.set(this,void 0),Q_.set(this,void 0),$_.set(this,void 0),ek.set(this,!1),tk.set(this,!1),nk.set(this,null),ik.set(this,null),rk.set(this,!1),ak.set(this,null),ok.set(this,0),sk.set(this,null),lk.set(this,1e3),ck.set(this,null),hk.set(this,[]),dk.set(this,1),uk.set(this,[]),pk.set(this,null),_k.set(this,null),kk.set(this,null),Ek.set(this,null),Nk(this,n_,e,"f"),Nk(this,e_,t,"f"),Nk(this,i_,n,"f"),Nk(this,r_,i,"f"),Nk(this,a_,r,"f"),Nk(this,o_,a,"f"),Nk(this,h_,o,"f"),Nk(this,s_,s,"f"),Nk(this,l_,l,"f"),Nk(this,c_,c,"f"),Nk(this,d_,h,"f"),Nk(this,u_,d,"f"),Nk(this,p_,u,"f"),Nk(this,F_,new Kr(70,1,.1,1e4),"f"),Dk(this,F_,"f").position.set(40,40,-40),n.scene.add(Dk(this,F_,"f")),Nk(this,W_,new ay(Dk(this,F_,"f"),n.canvas),"f"),Dk(this,W_,"f").mouseButtons={MIDDLE:g,RIGHT:w},Dk(this,W_,"f").minDistance=4,Dk(this,W_,"f").maxDistance=600,Nk(this,Z_,new jh,"f"),Nk(this,$_,new jc({transparent:!0,opacity:.3,polygonOffset:!0,polygonOffsetFactor:-.3,depthWrite:!1}),"f"),Nk(this,Q_,new Ws,"f"),Dk(this,Q_,"f").visible=!1,n.scene.add(Dk(this,Q_,"f")),Nk(this,J_,new Br(new ca(1e6,1e6),new ar({side:2})),"f"),Dk(this,J_,"f").rotation.x=-Math.PI/2,Dk(this,J_,"f").updateWorldMatrix(!0,!0),n.canvas.addEventListener("mousemove",Nk(this,C_,(e=>{const t=e.clientX/window.innerWidth*2-1,n=-e.clientY/window.innerHeight*2+1;null==Dk(this,nk,"f")?Nk(this,nk,new ln(t,n),"f"):Dk(this,nk,"f").set(t,n)}),"f")),n.canvas.addEventListener("mousedown",Nk(this,P_,(e=>{0==e.button&&Nk(this,tk,!0,"f"),1==e.button&&e.preventDefault()}),"f")),window.addEventListener("mouseup",Nk(this,R_,(e=>{0==e.button&&(Nk(this,tk,!1,"f"),Nk(this,sk,null,"f"))}),"f")),n.canvas.addEventListener("mouseout",Nk(this,L_,(()=>{Nk(this,nk,null,"f")}),"f")),n.canvas.addEventListener("touchstart",Nk(this,I_,(()=>{Dk(this,u_,"f").touchEnabled&&Nk(this,ik,Date.now(),"f")}),"f")),n.canvas.addEventListener("click",Nk(this,N_,(()=>{Dk(this,u_,"f").touchEnabled&&null!=Dk(this,ik,"f")&&Date.now()-Dk(this,ik,"f")<200&&(Nk(this,ik,null,"f"),Nk(this,rk,!0,"f"))}),"f")),window.addEventListener("keydown",Nk(this,D_,(e=>{Dk(this,$x,"m",Ik).call(this)&&(Dk(this,d_,"f").isOpen||Dk(this,S_,"f").isOpen||null!=Dk(this,M_,"f")||null!=Dk(this,A_,"f")||"Escape"==e.code&&(Dk(this,$x,"m",mk).call(this,p),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorRotate)&&(Nk(this,ok,(Dk(this,ok,"f")+1)%4,"f"),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorHeightModifier)&&(Nk(this,H_,!0,"f"),Dk(this,W_,"f").enableZoom=!1,e.preventDefault()),u.checkKeyBinding(e,Lb.EditorDelete)&&(Nk(this,ek,!0,"f"),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorMoveForwards)&&(Nk(this,V_,!0,"f"),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorMoveRight)&&(Nk(this,G_,!0,"f"),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorMoveBackwards)&&(Nk(this,j_,!0,"f"),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorMoveLeft)&&(Nk(this,q_,!0,"f"),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorRotateLeft)&&(Nk(this,X_,!0,"f"),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorRotateRight)&&(Nk(this,Y_,!0,"f"),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorMoveDown)&&(Nk(this,$x,Math.max(0,Dk(this,$x,"a",Mk)-1),"a",Tk),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorMoveUp)&&(Nk(this,$x,Dk(this,$x,"a",Mk)+1,"a",Tk),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorTest)&&(Dk(this,$x,"m",gk).call(this),e.preventDefault()),u.checkKeyBinding(e,Lb.EditorPick)&&(Dk(this,$x,"m",vk).call(this),e.preventDefault()))}),"f")),window.addEventListener("keyup",Nk(this,U_,(e=>{u.checkKeyBinding(e,Lb.EditorHeightModifier)&&(Nk(this,H_,!1,"f"),Dk(this,W_,"f").enableZoom=!0),u.checkKeyBinding(e,Lb.EditorDelete)&&Nk(this,ek,!1,"f"),u.checkKeyBinding(e,Lb.EditorMoveForwards)&&Nk(this,V_,!1,"f"),u.checkKeyBinding(e,Lb.EditorMoveRight)&&Nk(this,G_,!1,"f"),u.checkKeyBinding(e,Lb.EditorMoveBackwards)&&Nk(this,j_,!1,"f"),u.checkKeyBinding(e,Lb.EditorMoveLeft)&&Nk(this,q_,!1,"f"),u.checkKeyBinding(e,Lb.EditorRotateLeft)&&Nk(this,X_,!1,"f"),u.checkKeyBinding(e,Lb.EditorRotateRight)&&Nk(this,Y_,!1,"f")}),"f")),window.addEventListener("wheel",Nk(this,B_,(e=>{Dk(this,H_,"f")&&Dk(this,m_,"f")&&(e.deltaY>0?Nk(this,$x,Dk(this,$x,"a",Mk)+1,"a",Tk):e.deltaY<0&&Nk(this,$x,Math.max(0,Dk(this,$x,"a",Mk)-1),"a",Tk))}),"f")),window.addEventListener("beforeunload",Nk(this,O_,(e=>!Dk(this,K_,"f")&&(e.preventDefault(),e.returnValue=!0,!0)),"f")),Dk(this,$x,"m",fk).call(this,p),d.addChangeListener(Nk(this,z_,(e=>{Dk(this,T_,"f").setEnabled(e)}),"f"))}dispose(){var e,t,n;Nk(this,m_,!1,"f"),null===(e=Dk(this,ck,"f"))||void 0===e||e.dispose(),Dk(this,k_,"f").dispose(),Dk(this,E_,"f").dispose(),null===(t=Dk(this,M_,"f"))||void 0===t||t.dispose(),Nk(this,M_,null,"f"),Dk(this,S_,"f").dispose(),Dk(this,T_,"f").dispose(),null===(n=Dk(this,A_,"f"))||void 0===n||n.dispose(),Nk(this,A_,null,"f");document.getElementById("ui").removeChild(Dk(this,g_,"f")),Dk(this,i_,"f").scene.remove(Dk(this,F_,"f")),Dk(this,W_,"f").dispose(),Dk(this,$_,"f").dispose(),Dk(this,Q_,"f").children.forEach((e=>{const t=e;t.geometry.dispose(),Array.isArray(t.material)?t.material.forEach((e=>e.dispose())):t.material.dispose()})),Dk(this,i_,"f").scene.remove(Dk(this,Q_,"f")),Dk(this,J_,"f").geometry.dispose(),Array.isArray(Dk(this,J_,"f").material)?Dk(this,J_,"f").material.forEach((e=>e.dispose())):Dk(this,J_,"f").material.dispose(),Dk(this,i_,"f").canvas.removeEventListener("mousemove",Dk(this,C_,"f")),Dk(this,i_,"f").canvas.removeEventListener("mousedown",Dk(this,P_,"f")),window.removeEventListener("mouseup",Dk(this,R_,"f")),Dk(this,i_,"f").canvas.removeEventListener("mouseout",Dk(this,L_,"f")),Dk(this,i_,"f").canvas.removeEventListener("touchstart",Dk(this,I_,"f")),Dk(this,i_,"f").canvas.removeEventListener("click",Dk(this,N_,"f")),window.removeEventListener("keydown",Dk(this,D_,"f")),window.removeEventListener("keyup",Dk(this,U_,"f")),window.removeEventListener("wheel",Dk(this,B_,"f")),window.removeEventListener("beforeunload",Dk(this,O_,"f")),Dk(this,u_,"f").removeChangeListener(Dk(this,z_,"f"))}getTrackName(){return""==Dk(this,w_,"f").value.trim()?null:Dk(this,w_,"f").value}setTestCallback(e){Nk(this,f_,e,"f")}reset(){Nk(this,ok,0,"f"),Dk(this,$x,"m",xk).call(this,1),Dk(this,E_,"f").reset(),this.resetView()}enable(){var e;Nk(this,m_,!0,"f"),Dk(this,W_,"f").enabled=!0,1==Dk(this,hk,"f").length&&Dk(this,$x,"m",yk).call(this),null===(e=Dk(this,ck,"f"))||void 0===e||e.dispose(),Nk(this,ck,new rb(Dk(this,i_,"f")),"f"),Dk(this,ck,"f").refresh(Dk(this,a_,"f")),Dk(this,T_,"f").show(),Dk(this,g_,"f").className="editor"}disable(){var e,t,n;Nk(this,m_,!1,"f"),Dk(this,W_,"f").enabled=!1,Dk(this,Q_,"f").visible=!1,null===(e=Dk(this,ck,"f"))||void 0===e||e.dispose(),Dk(this,g_,"f").className="hidden",null===(t=Dk(this,M_,"f"))||void 0===t||t.dispose(),Nk(this,M_,null,"f"),Dk(this,S_,"f").hide(),Dk(this,T_,"f").hide(),null===(n=Dk(this,A_,"f"))||void 0===n||n.dispose(),Nk(this,A_,null,"f")}isEnabled(){return Dk(this,m_,"f")}resetView(){Nk(this,$x,0,"a",Tk),Dk(this,F_,"f").position.set(40,40,-40),Dk(this,W_,"f").target.set(0,0,0),Dk(this,W_,"f").update()}get camera(){return Dk(this,F_,"f")}update(e){var t;if(Dk(this,m_,"f")){Dk(this,F_,"f").position.y<.5&&(Dk(this,F_,"f").position.y=.5,Dk(this,W_,"f").update()),Nk(this,ak,Dk(this,$x,"m",Ck).call(this),"f"),null!=Dk(this,ak,"f")?Dk(this,Q_,"f").position.set(Dk(this,ak,"f").x*Ky.partWidth,Dk(this,ak,"f").y*Ky.partHeight,Dk(this,ak,"f").z*Ky.partLength):Dk(this,Q_,"f").position.set(-1e6,-1e6,-1e6),Dk(this,Q_,"f").rotation.y=Dk(this,ok,"f")*Math.PI/2;for(let e=0;e<Dk(this,hk,"f").length;++e){const t=Dk(this,hk,"f")[e];e==Dk(this,dk,"f")?t.mesh.visible=!0:t.mesh.visible=!1}const e=Dk(this,ak,"f");if(null!=e){const n=Dk(this,hk,"f")[Dk(this,dk,"f")],i=Dk(this,$x,"m",Pk).call(this,e,n.tiles);if(null==n.id||Dk(this,ek,"f")?i.length>0?Dk(this,$_,"f").color.set(12255232):Dk(this,$_,"f").color.set(12263970):i.length>0?Dk(this,$_,"f").color.set(12303104):Dk(this,$_,"f").color.set(187),Dk(this,ek,"f"))Dk(this,$x,"m",Rk).call(this,i);else if(Dk(this,tk,"f")||Dk(this,rk,"f")){if(null==n.id)Dk(this,$x,"m",Rk).call(this,i);else if(null==Dk(this,sk,"f")||Dk(this,sk,"f").x!=e.x||Dk(this,sk,"f").y!=e.y||Dk(this,sk,"f").z!=e.z||Dk(this,sk,"f").id!=n.id||Dk(this,sk,"f").rotation!=Dk(this,ok,"f")){i.forEach((({x:e,y:t,z:n})=>{Dk(this,a_,"f").hasPartAt(e,t,n)&&Dk(this,a_,"f").deletePart(e,t,n)}));let r=null;n.isCheckpoint&&(r=Dk(this,E_,"f").checkpointOrder),Dk(this,a_,"f").setPart(e.x,e.y,e.z,n.id,Dk(this,ok,"f"),r),Dk(this,$x,"m",Ak).call(this),Nk(this,sk,{x:e.x,y:e.y,z:e.z,id:n.id,rotation:Dk(this,ok,"f")},"f"),Dk(this,a_,"f").generateMeshes(),null===(t=Dk(this,ck,"f"))||void 0===t||t.refresh(Dk(this,a_,"f")),Dk(this,E_,"f").setFromExistingCheckpoints(Dk(this,a_,"f")),Nk(this,K_,!1,"f")}Nk(this,rk,!1,"f")}Dk(this,Q_,"f").visible=!0}else Dk(this,Q_,"f").visible=!1}Dk(this,$x,"m",Lk).call(this,e)}};var Bk,Ok,zk,Fk,Wk,Hk=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},Vk=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Bk=new WeakMap,Ok=new WeakMap,zk=new WeakMap,Fk=new WeakMap,Wk=new WeakMap;const Gk=class{constructor(e,t,n,i,r,a,o,s,l,c,h,d,u,p,f){Bk.set(this,void 0),Ok.set(this,void 0),zk.set(this,void 0),Fk.set(this,void 0),Wk.set(this,void 0),this.isPaused=!1,Hk(this,Bk,e,"f"),Hk(this,Ok,i,"f"),Hk(this,zk,r,"f"),Hk(this,Fk,a,"f"),Hk(this,Wk,new Uk(n,i,r,o,e,t,s,l,c,h,d,u,a,p),"f"),Vk(this,Wk,"f").reset(),Vk(this,Wk,"f").enable(),Vk(this,Bk,"f").clear(),Vk(this,Bk,"f").setPart(0,0,0,Bw.Start,0,null),Vk(this,Bk,"f").generateMeshes(),r.setCamera(Vk(this,Wk,"f").camera),Vk(this,Wk,"f").setTestCallback((()=>{var e;Vk(this,Wk,"f").disable();const t=null!==(e=Vk(this,Wk,"f").getTrackName())&&void 0!==e?e:"Unnamed track";f(t,Vk(this,Bk,"f").getTrackData(),(()=>{Vk(this,Wk,"f").enable(),r.setCamera(Vk(this,Wk,"f").camera)}))}))}dispose(){Vk(this,Wk,"f").dispose(),Vk(this,Wk,"f").resetView(),Vk(this,Bk,"f").clear()}update(e){this.isPaused||Vk(this,Wk,"f").update(e),Vk(this,zk,"f").update(),Vk(this,Ok,"f").update(e,!1,Vk(this,zk,"f"),Vk(this,Fk,"f"))}};var jk=n(811),qk={};qk.styleTagTransform=u(),qk.setAttributes=l(),qk.insert=o().bind(null,"head"),qk.domAPI=r(),qk.insertStyleElement=h();t()(jk.A,qk);jk.A&&jk.A.locals&&jk.A.locals;var Xk,Yk,Kk,Zk,Jk,Qk,$k=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},eE=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Xk=new WeakMap,Yk=new WeakMap,Kk=new WeakMap,Zk=new WeakMap,Jk=new WeakMap,Qk=new WeakMap;const tE=class{constructor(e,t){Xk.set(this,void 0),Yk.set(this,void 0),Kk.set(this,void 0),Zk.set(this,void 0),Jk.set(this,void 0),Qk.set(this,null),$k(this,Xk,t,"f"),$k(this,Yk,e,"f"),$k(this,Kk,document.getElementById("ui"),"f"),$k(this,Zk,document.createElement("div"),"f"),eE(this,Yk,"f")>0?t.getSettingBoolean(Jh.CheckpointsPosition)?eE(this,Zk,"f").className="checkpoint up":eE(this,Zk,"f").className="checkpoint":eE(this,Zk,"f").className="hidden",eE(this,Kk,"f").appendChild(eE(this,Zk,"f"));const n=document.createElement("div");eE(this,Zk,"f").appendChild(n);const i=document.createElement("img");i.src="images/checkpoint.svg",n.appendChild(i),$k(this,Jk,document.createElement("span"),"f"),n.appendChild(eE(this,Jk,"f"))}dispose(){eE(this,Kk,"f").removeChild(eE(this,Zk,"f"))}setOverridePosition(e){eE(this,Yk,"f")>0?(null!=e?e:eE(this,Xk,"f").getSettingBoolean(Jh.CheckpointsPosition))?eE(this,Zk,"f").className="checkpoint up":eE(this,Zk,"f").className="checkpoint":eE(this,Zk,"f").className="hidden"}update(e){const t=e.getNextCheckpointIndex()+"/"+eE(this,Yk,"f");t!=eE(this,Qk,"f")&&(eE(this,Jk,"f").textContent=t,$k(this,Qk,t,"f"))}};var nE=n(229),iE={};iE.styleTagTransform=u(),iE.setAttributes=l(),iE.insert=o().bind(null,"head"),iE.domAPI=r(),iE.insertStyleElement=h();t()(nE.A,iE);nE.A&&nE.A.locals&&nE.A.locals;var rE,aE,oE,sE,lE,cE,hE,dE,uE,pE,fE=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},mE=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};aE=new WeakMap,oE=new WeakMap,sE=new WeakMap,lE=new WeakMap,cE=new WeakMap,hE=new WeakMap,rE=new WeakSet,dE=function(e){mE(this,cE,"f").textContent=e,mE(this,cE,"f").className="hint show"},uE=function(){fE(this,hE,2.5,"f"),mE(this,cE,"f").className="hint hide"},pE=function(){fE(this,hE,2.5,"f"),mE(this,cE,"f").className="hint"};const gE=class{constructor(e,t,n){rE.add(this),aE.set(this,void 0),oE.set(this,void 0),sE.set(this,void 0),lE.set(this,void 0),cE.set(this,void 0),hE.set(this,2.5),fE(this,aE,e,"f"),fE(this,oE,t,"f"),fE(this,sE,n,"f"),fE(this,lE,document.getElementById("ui"),"f"),fE(this,cE,document.createElement("div"),"f"),mE(this,cE,"f").className="hint",mE(this,lE,"f").appendChild(mE(this,cE,"f"))}dispose(){mE(this,lE,"f").removeChild(mE(this,cE,"f"))}update(e,t){if(e.hasStarted()&&!mE(this,oE,"f").touchEnabled&&mE(this,sE,"f").getSettingBoolean(Jh.ResetHintEnabled))if(e.getSpeedKmh()<50||e.hasFinished()){if(0!=mE(this,hE,"f")&&(fE(this,hE,mE(this,hE,"f")-t,"f"),mE(this,hE,"f")<=0)){const e=mE(this,sE,"f").getKeyBindings(Lb.VehicleReset);null!=e[0]&&null!=e[1]?mE(this,rE,"m",dE).call(this,mE(this,aE,"f").get("Press [{0}] or [{1}] to restart",[e[0],e[1]])):null!=e[0]?mE(this,rE,"m",dE).call(this,mE(this,aE,"f").get("Press [{0}] to restart",[e[0]])):null!=e[1]&&mE(this,rE,"m",dE).call(this,mE(this,aE,"f").get("Press [{0}] to restart",[e[1]])),fE(this,hE,0,"f")}}else mE(this,rE,"m",uE).call(this);else mE(this,rE,"m",pE).call(this)}};var vE=n(151),wE={};wE.styleTagTransform=u(),wE.setAttributes=l(),wE.insert=o().bind(null,"head"),wE.domAPI=r(),wE.insertStyleElement=h();t()(vE.A,wE);vE.A&&vE.A.locals&&vE.A.locals;var yE,bE,xE,_E,kE,EE,SE,ME=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},TE=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};yE=new WeakMap,bE=new WeakMap,xE=new WeakMap,_E=new WeakMap,kE=new WeakMap,EE=new WeakMap,SE=new WeakMap;const AE=class{constructor(e){yE.set(this,void 0),bE.set(this,void 0),xE.set(this,void 0),_E.set(this,void 0),kE.set(this,void 0),EE.set(this,null),SE.set(this,void 0),ME(this,yE,e,"f"),ME(this,SE,e.getSettingBoolean(Jh.ImperialUnitsEnabled),"f"),ME(this,bE,document.getElementById("ui"),"f"),ME(this,xE,document.createElement("div"),"f"),e.getSettingBoolean(Jh.SpeedometerPosition)?TE(this,xE,"f").className="speedometer up":TE(this,xE,"f").className="speedometer",TE(this,bE,"f").appendChild(TE(this,xE,"f"));const t=document.createElement("div");TE(this,xE,"f").appendChild(t),ME(this,_E,document.createElement("span"),"f"),TE(this,_E,"f").textContent="0",t.appendChild(TE(this,_E,"f")),ME(this,kE,document.createElement("span"),"f"),TE(this,SE,"f")?TE(this,kE,"f").textContent="mph":TE(this,kE,"f").textContent="km/h",t.appendChild(TE(this,kE,"f"))}dispose(){TE(this,bE,"f").removeChild(TE(this,xE,"f"))}setOverridePosition(e){(null!=e?e:TE(this,yE,"f").getSettingBoolean(Jh.SpeedometerPosition))?TE(this,xE,"f").className="speedometer up":TE(this,xE,"f").className="speedometer"}update(e){const t=Math.abs(e.getSpeedKmh());let n;n=TE(this,SE,"f")?t/1.609344:t;const i=Math.trunc(n).toString();if(i!=TE(this,EE,"f")){TE(this,_E,"f").innerHTML="";for(let e=0;e<i.length;++e){const t=document.createElement("span");t.textContent=i[e],TE(this,_E,"f").appendChild(t)}ME(this,EE,i,"f")}}};var CE=n(817),PE={};PE.styleTagTransform=u(),PE.setAttributes=l(),PE.insert=o().bind(null,"head"),PE.domAPI=r(),PE.insertStyleElement=h();t()(CE.A,PE);CE.A&&CE.A.locals&&CE.A.locals;var RE,LE,IE,NE,DE,UE,BE,OE,zE,FE,WE=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},HE=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};RE=new WeakMap,LE=new WeakMap,IE=new WeakMap,NE=new WeakMap,DE=new WeakMap,UE=new WeakMap,BE=new WeakMap,OE=new WeakMap,zE=new WeakMap,FE=new WeakMap;const VE=class{constructor(e,t,n,i,r){if(RE.set(this,void 0),LE.set(this,void 0),IE.set(this,void 0),NE.set(this,void 0),DE.set(this,void 0),UE.set(this,void 0),BE.set(this,void 0),OE.set(this,void 0),zE.set(this,void 0),FE.set(this,void 0),WE(this,RE,document.getElementById("ui"),"f"),WE(this,LE,document.createElement("div"),"f"),HE(this,LE,"f").className="time-announcer",WE(this,IE,document.createElement("div"),"f"),HE(this,IE,"f").className="hidden",HE(this,IE,"f").textContent=e.get("New record"),HE(this,LE,"f").appendChild(HE(this,IE,"f")),WE(this,NE,document.createElement("div"),"f"),HE(this,NE,"f").className="track-name",HE(this,NE,"f").textContent=t,HE(this,LE,"f").appendChild(HE(this,NE,"f")),WE(this,DE,document.createElement("div"),"f"),HE(this,DE,"f").className="current",HE(this,LE,"f").appendChild(HE(this,DE,"f")),WE(this,UE,document.createElement("div"),"f"),HE(this,LE,"f").appendChild(HE(this,UE,"f")),WE(this,BE,document.createElement("p"),"f"),HE(this,UE,"f").appendChild(HE(this,BE,"f")),WE(this,OE,document.createElement("div"),"f"),HE(this,LE,"f").appendChild(HE(this,OE,"f")),WE(this,zE,document.createElement("p"),"f"),HE(this,zE,"f").className="title",HE(this,OE,"f").appendChild(HE(this,zE,"f")),WE(this,FE,document.createElement("p"),"f"),HE(this,OE,"f").appendChild(HE(this,FE,"f")),HE(this,RE,"f").appendChild(HE(this,LE,"f")),HE(this,DE,"f").textContent=sx.formatTimeString(n),null==i)HE(this,IE,"f").className="record",HE(this,UE,"f").className="hidden";else{const e=n.difference(i);HE(this,BE,"f").textContent=sx.formatTimeString(e,!0),e.isNegative()?(HE(this,IE,"f").className="record",HE(this,UE,"f").className="difference"):(HE(this,IE,"f").className="hidden",HE(this,UE,"f").className="difference red")}if(null==r)HE(this,OE,"f").className="hidden";else{const e=n.difference(r.record);HE(this,zE,"f").textContent=r.name,HE(this,FE,"f").textContent=sx.formatTimeString(e,!0),e.isNegative()?HE(this,OE,"f").className="difference":HE(this,OE,"f").className="difference red"}}dispose(){HE(this,RE,"f").removeChild(HE(this,LE,"f"))}},GE=new _i(0,0,0,"YXZ"),jE=new Un,qE={type:"change"},XE={type:"lock"},YE={type:"unlock"},KE=Math.PI/2;class ZE extends Kt{constructor(e,t){super(),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,this._onMouseMove=JE.bind(this),this._onPointerlockChange=QE.bind(this),this._onPointerlockError=$E.bind(this),this.connect()}connect(){this.domElement.ownerDocument.addEventListener("mousemove",this._onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this._onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this._onPointerlockError)}disconnect(){this.domElement.ownerDocument.removeEventListener("mousemove",this._onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this._onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this._onPointerlockError)}dispose(){this.disconnect()}getObject(){return this.camera}getDirection(e){return e.set(0,0,-1).applyQuaternion(this.camera.quaternion)}moveForward(e){const t=this.camera;jE.setFromMatrixColumn(t.matrix,0),jE.crossVectors(t.up,jE),t.position.addScaledVector(jE,e)}moveRight(e){const t=this.camera;jE.setFromMatrixColumn(t.matrix,0),t.position.addScaledVector(jE,e)}lock(){this.domElement.requestPointerLock()}unlock(){this.domElement.ownerDocument.exitPointerLock()}}function JE(e){if(!1===this.isLocked)return;const t=e.movementX||e.mozMovementX||e.webkitMovementX||0,n=e.movementY||e.mozMovementY||e.webkitMovementY||0,i=this.camera;GE.setFromQuaternion(i.quaternion),GE.y-=.002*t*this.pointerSpeed,GE.x-=.002*n*this.pointerSpeed,GE.x=Math.max(KE-this.maxPolarAngle,Math.min(KE-this.minPolarAngle,GE.x)),i.quaternion.setFromEuler(GE),this.dispatchEvent(qE)}function QE(){this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(XE),this.isLocked=!0):(this.dispatchEvent(YE),this.isLocked=!1)}function $E(){console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}var eS,tS,nS,iS,rS,aS,oS,sS,lS,cS,hS,dS=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},uS=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};eS=new WeakMap,tS=new WeakMap,nS=new WeakMap,iS=new WeakMap,rS=new WeakMap,aS=new WeakMap,oS=new WeakMap,sS=new WeakMap,lS=new WeakMap,cS=new WeakMap,hS=new WeakMap;const pS=class{constructor(e){eS.set(this,void 0),tS.set(this,void 0),nS.set(this,!1),iS.set(this,[]),rS.set(this,void 0),aS.set(this,void 0),oS.set(this,!1),sS.set(this,!1),lS.set(this,!1),cS.set(this,!1),hS.set(this,!1),dS(this,eS,new Kr(70,1,.1,1e4),"f"),uS(this,eS,"f").position.set(0,20,0),dS(this,tS,new ZE(uS(this,eS,"f"),document.documentElement),"f"),uS(this,tS,"f").addEventListener("lock",(()=>{dS(this,nS,!0,"f"),uS(this,iS,"f").forEach((e=>{e(!0)}))})),uS(this,tS,"f").addEventListener("unlock",(()=>{dS(this,nS,!1,"f"),uS(this,iS,"f").forEach((e=>{e(!1)}))})),window.addEventListener("keydown",dS(this,rS,(t=>{e.checkKeyBinding(t,Lb.SpectatorMoveForwards)?(dS(this,oS,!0,"f"),t.preventDefault()):e.checkKeyBinding(t,Lb.SpectatorMoveRight)?(dS(this,sS,!0,"f"),t.preventDefault()):e.checkKeyBinding(t,Lb.SpectatorMoveBackwards)?(dS(this,lS,!0,"f"),t.preventDefault()):e.checkKeyBinding(t,Lb.SpectatorMoveLeft)?(dS(this,cS,!0,"f"),t.preventDefault()):e.checkKeyBinding(t,Lb.SpectatorSpeedModifier)&&(dS(this,hS,!0,"f"),t.preventDefault())}),"f")),window.addEventListener("keyup",dS(this,aS,(t=>{e.checkKeyBinding(t,Lb.SpectatorMoveForwards)?dS(this,oS,!1,"f"):e.checkKeyBinding(t,Lb.SpectatorMoveRight)?dS(this,sS,!1,"f"):e.checkKeyBinding(t,Lb.SpectatorMoveBackwards)?dS(this,lS,!1,"f"):e.checkKeyBinding(t,Lb.SpectatorMoveLeft)?dS(this,cS,!1,"f"):e.checkKeyBinding(t,Lb.SpectatorSpeedModifier)&&dS(this,hS,!1,"f")}),"f"))}dispose(){uS(this,tS,"f").dispose(),window.removeEventListener("keydown",uS(this,rS,"f")),window.removeEventListener("keyup",uS(this,aS,"f"))}addToggleListener(e){uS(this,iS,"f").push(e)}enable(){try{uS(this,tS,"f").lock()}catch(e){}}disable(){try{uS(this,tS,"f").unlock()}catch(e){}}toggle(){uS(this,nS,"f")?this.disable():this.enable()}update(e){if(uS(this,nS,"f")){let t;if(t=uS(this,hS,"f")?400*e:50*e,uS(this,oS,"f")){const e=new Un(0,0,-1).applyQuaternion(uS(this,eS,"f").quaternion);uS(this,eS,"f").position.add(e.multiplyScalar(t))}if(uS(this,sS,"f")){const e=new Un(1,0,0).applyQuaternion(uS(this,eS,"f").quaternion);uS(this,eS,"f").position.add(e.multiplyScalar(t))}if(uS(this,lS,"f")){const e=new Un(0,0,1).applyQuaternion(uS(this,eS,"f").quaternion);uS(this,eS,"f").position.add(e.multiplyScalar(t))}if(uS(this,cS,"f")){const e=new Un(-1,0,0).applyQuaternion(uS(this,eS,"f").quaternion);uS(this,eS,"f").position.add(e.multiplyScalar(t))}}}get camera(){return uS(this,eS,"f")}get enabled(){return uS(this,nS,"f")}};var fS=n(571),mS={};mS.styleTagTransform=u(),mS.setAttributes=l(),mS.insert=o().bind(null,"head"),mS.domAPI=r(),mS.insertStyleElement=h();t()(fS.A,mS);fS.A&&fS.A.locals&&fS.A.locals;var gS,vS,wS,yS=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},bS=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};gS=new WeakMap,vS=new WeakMap,wS=new WeakMap;const xS=class{constructor(e,t,n,i){gS.set(this,void 0),vS.set(this,void 0),wS.set(this,void 0),yS(this,gS,document.getElementById("ui"),"f"),yS(this,vS,document.createElement("div"),"f"),bS(this,vS,"f").className="hidden",bS(this,gS,"f").appendChild(bS(this,vS,"f"));const r=document.createElement("button");r.className="quit",r.innerHTML='<img src="images/quit.svg">',r.addEventListener("touchstart",(()=>{r.classList.add("active"),r.click()})),r.addEventListener("touchend",(()=>{r.classList.remove("active")})),r.addEventListener("click",(()=>{t.playUIClick(),i()})),bS(this,vS,"f").appendChild(r);const a=document.createElement("button");a.className="reset",a.innerHTML='<img src="images/reset.svg">',a.addEventListener("touchstart",(()=>{a.classList.add("active"),a.click()})),a.addEventListener("touchend",(()=>{a.classList.remove("active")})),a.addEventListener("click",(()=>{t.playUIClick(),n()})),bS(this,vS,"f").appendChild(a);const o=document.createElement("div");o.className="left-container",bS(this,vS,"f").appendChild(o);const s=document.createElement("div");s.innerHTML='<img src="images/arrow_up.svg">',o.appendChild(s);const l=document.createElement("div");l.innerHTML='<img src="images/arrow_down.svg">',o.appendChild(l);const c=document.createElement("div");c.className="right-container",bS(this,vS,"f").appendChild(c);const h=document.createElement("div");h.innerHTML='<img src="images/arrow_left.svg">',c.appendChild(h);const d=document.createElement("div");d.innerHTML='<img src="images/arrow_right.svg">',c.appendChild(d),yS(this,wS,(t=>{let n=!1,i=!1,r=!1,a=!1;for(let e=0;e<t.touches.length;e++){const o=t.touches.item(e);if(null!=o){switch(document.elementFromPoint(o.clientX,o.clientY)){case s:n=!0;break;case d:i=!0;break;case l:r=!0;break;case h:a=!0}}}e.up=n,e.right=i,e.down=r,e.left=a,s.className=n?"active":"",d.className=i?"active":"",l.className=r?"active":"",h.className=a?"active":"",t.preventDefault()}),"f"),window.addEventListener("touchstart",bS(this,wS,"f"),{passive:!1}),window.addEventListener("touchmove",bS(this,wS,"f"),{passive:!1}),window.addEventListener("touchend",bS(this,wS,"f"),{passive:!1})}setEnabled(e){bS(this,vS,"f").className=e?"touch-controls":"hidden"}dispose(){bS(this,gS,"f").removeChild(bS(this,vS,"f")),window.removeEventListener("touchstart",bS(this,wS,"f")),window.removeEventListener("touchmove",bS(this,wS,"f")),window.removeEventListener("touchend",bS(this,wS,"f"))}};var _S,kS,ES,SS,MS,TS,AS,CS=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},PS=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};_S=new WeakMap,kS=new WeakMap,ES=new WeakMap,SS=new WeakMap,MS=new WeakMap,TS=new WeakMap,AS=new WeakMap;const RS=class{constructor(e){_S.set(this,!1),kS.set(this,!1),ES.set(this,!1),SS.set(this,!1),MS.set(this,void 0),TS.set(this,void 0),AS.set(this,[]),window.addEventListener("keydown",CS(this,MS,(t=>{e.checkKeyBinding(t,Lb.VehicleAccelerate)?(this.up=!0,t.preventDefault()):e.checkKeyBinding(t,Lb.VehicleTurnRight)?(this.right=!0,t.preventDefault()):e.checkKeyBinding(t,Lb.VehicleBrake)?(this.down=!0,t.preventDefault()):e.checkKeyBinding(t,Lb.VehicleTurnLeft)&&(this.left=!0,t.preventDefault())}),"f")),window.addEventListener("keyup",CS(this,TS,(t=>{e.checkKeyBinding(t,Lb.VehicleAccelerate)?this.up=!1:e.checkKeyBinding(t,Lb.VehicleTurnRight)?this.right=!1:e.checkKeyBinding(t,Lb.VehicleBrake)?this.down=!1:e.checkKeyBinding(t,Lb.VehicleTurnLeft)&&(this.left=!1)}),"f"))}get up(){return PS(this,_S,"f")}get right(){return PS(this,kS,"f")}get down(){return PS(this,ES,"f")}get left(){return PS(this,SS,"f")}set up(e){PS(this,_S,"f")!=e&&(CS(this,_S,e,"f"),PS(this,AS,"f").forEach((e=>{e(this)})))}set right(e){PS(this,kS,"f")!=e&&(CS(this,kS,e,"f"),PS(this,AS,"f").forEach((e=>{e(this)})))}set down(e){PS(this,ES,"f")!=e&&(CS(this,ES,e,"f"),PS(this,AS,"f").forEach((e=>{e(this)})))}set left(e){PS(this,SS,"f")!=e&&(CS(this,SS,e,"f"),PS(this,AS,"f").forEach((e=>{e(this)})))}addChangeCallback(e){PS(this,AS,"f").push(e)}removeChangeCallback(e){const t=PS(this,AS,"f").indexOf(e);t>=0&&PS(this,AS,"f").splice(t,1)}dispose(){window.removeEventListener("keydown",PS(this,MS,"f")),window.removeEventListener("keyup",PS(this,TS,"f"))}getControls(){return{up:this.up,right:this.right,down:this.down,left:this.left}}};var LS,IS=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};LS=new WeakMap;const NS=class{constructor(){LS.set(this,[])}push(e){if(IS(this,LS,"f").length>0){if(e.totalFrames!=IS(this,LS,"f")[IS(this,LS,"f").length-1].totalFrames+1)throw"Car states are not continuous"}else if(e.totalFrames>0)throw"First frame must be zero";IS(this,LS,"f").push(e)}getFrame(e){return e>=0&&e<IS(this,LS,"f").length?IS(this,LS,"f")[e]:null}getLastFrame(){return 0==IS(this,LS,"f").length?new rp(0):new rp(IS(this,LS,"f")[IS(this,LS,"f").length-1].totalFrames)}};var DS=n(804),US={};US.styleTagTransform=u(),US.setAttributes=l(),US.insert=o().bind(null,"head"),US.domAPI=r(),US.insertStyleElement=h();t()(DS.A,US);DS.A&&DS.A.locals&&DS.A.locals;var BS,OS,zS,FS=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},WS=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};BS=new WeakMap,OS=new WeakMap,zS=new WeakMap;const HS=class{constructor(e,t,n,i){BS.set(this,void 0),OS.set(this,void 0),zS.set(this,!0),FS(this,BS,document.getElementById("ui"),"f"),FS(this,OS,document.createElement("div"),"f"),n.getSettingBoolean(Jh.CheckpointsPosition)?WS(this,OS,"f").className="game-toolbar visible":WS(this,OS,"f").className="game-toolbar visible up";const r=document.createElement("button");r.className="button",r.innerHTML='<img class="button-icon" src="images/quit.svg"> ',r.append(document.createTextNode(t.get("Exit"))),r.addEventListener("click",(()=>{e.playUIClick(),i()})),WS(this,OS,"f").appendChild(r),WS(this,BS,"f").appendChild(WS(this,OS,"f"))}dispose(){WS(this,BS,"f").removeChild(WS(this,OS,"f"))}setVisible(e){WS(this,zS,"f")!=e&&(e?WS(this,OS,"f").classList.add("visible"):WS(this,OS,"f").classList.remove("visible"),FS(this,zS,e,"f"))}};var VS,GS,jS,qS,XS,YS,KS,ZS,JS,QS,$S,eM,tM,nM,iM,rM,aM,oM,sM,lM,cM,hM,dM,uM,pM,fM,mM,gM,vM,wM,yM,bM,xM,_M,kM,EM,SM,MM,TM,AM=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},CM=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};GS=new WeakMap,jS=new WeakMap,qS=new WeakMap,XS=new WeakMap,YS=new WeakMap,KS=new WeakMap,ZS=new WeakMap,JS=new WeakMap,QS=new WeakMap,$S=new WeakMap,eM=new WeakMap,tM=new WeakMap,nM=new WeakMap,iM=new WeakMap,rM=new WeakMap,aM=new WeakMap,oM=new WeakMap,sM=new WeakMap,lM=new WeakMap,cM=new WeakMap,hM=new WeakMap,dM=new WeakMap,uM=new WeakMap,pM=new WeakMap,fM=new WeakMap,mM=new WeakMap,gM=new WeakMap,vM=new WeakMap,wM=new WeakMap,yM=new WeakMap,bM=new WeakMap,xM=new WeakMap,VS=new WeakSet,_M=function(e){var t,n,i,r,a,o,s,l,c;e?(AM(this,aM,new gE(CM(this,YS,"f"),CM(this,eM,"f"),CM(this,QS,"f")),"f"),AM(this,oM,new tE(CM(this,qS,"f").getTotalNumberOfCheckpointIndices(),CM(this,QS,"f")),"f"),AM(this,sM,new AE(CM(this,QS,"f")),"f"),AM(this,lM,new sx(CM(this,YS,"f"),CM(this,QS,"f"),null===(t=CM(this,vM,"f"))||void 0===t?void 0:t.name),"f"),CM(this,eM,"f").touchEnabled?(CM(this,oM,"f").setOverridePosition(!0),CM(this,lM,"f").setOverridePosition(!0),CM(this,sM,"f").setOverridePosition(!0)):(CM(this,oM,"f").setOverridePosition(null),CM(this,lM,"f").setOverridePosition(null),CM(this,sM,"f").setOverridePosition(null),AM(this,hM,new HS(CM(this,ZS,"f"),CM(this,YS,"f"),CM(this,QS,"f"),CM(this,nM,"f")),"f"),CM(this,hM,"f").setVisible(!(null!==(i=null===(n=CM(this,fM,"f"))||void 0===n?void 0:n.hasStarted())&&void 0!==i&&i))),CM(this,dM,"f").setEnabled(CM(this,eM,"f").touchEnabled),CM(this,VS,"m",TM).call(this)):(null===(r=CM(this,aM,"f"))||void 0===r||r.dispose(),AM(this,aM,null,"f"),null===(a=CM(this,oM,"f"))||void 0===a||a.dispose(),AM(this,oM,null,"f"),null===(o=CM(this,sM,"f"))||void 0===o||o.dispose(),AM(this,sM,null,"f"),null===(s=CM(this,lM,"f"))||void 0===s||s.dispose(),AM(this,lM,null,"f"),null===(l=CM(this,cM,"f"))||void 0===l||l.dispose(),AM(this,cM,null,"f"),null===(c=CM(this,hM,"f"))||void 0===c||c.dispose(),AM(this,hM,null,"f"))},kM=function(){CM(this,VS,"m",EM).call(this,CM(this,JS,"f").getCarColors()),CM(this,VS,"m",SM).call(this)},EM=function(e){var t,n;null!=CM(this,fM,"f")&&(null!=CM(this,lM,"f")&&CM(this,vM,"f").isSelf&&CM(this,fM,"f").hasFinished()&&(null==CM(this,lM,"f").record||CM(this,fM,"f").getTime().lessThan(null===(t=CM(this,lM,"f"))||void 0===t?void 0:t.record))&&(CM(this,lM,"f").record=CM(this,fM,"f").getTime()),CM(this,fM,"f").dispose(),AM(this,fM,null,"f")),AM(this,fM,new Uv(CM(this,GS,"f"),CM(this,qS,"f").getStartTransform(),null,CM(this,pM,"f"),!0,CM(this,KS,"f"),CM(this,ZS,"f"),CM(this,XS,"f"),CM(this,qS,"f"),CM(this,QS,"f")),"f"),CM(this,fM,"f").addFinishCallback((e=>{const t=e.getTime(),n=e.getRecording(),i=e.getColors(),r=CM(this,wM,"f");(null==CM(this,wM,"f")||t.lessThan(CM(this,wM,"f")))&&(CM(this,tM,"f").call(this,CM(this,qS,"f").getID(),n,t,i),CM(this,vM,"f").isSelf&&(CM(this,vM,"f").recording=n,CM(this,vM,"f").time=t),AM(this,wM,t,"f"));let a=null;CM(this,vM,"f").isSelf||null==CM(this,vM,"f").time||null==CM(this,vM,"f").name||(a={record:CM(this,vM,"f").time,name:CM(this,vM,"f").name}),AM(this,cM,new VE(CM(this,YS,"f"),CM(this,iM,"f"),t,r,a),"f")})),CM(this,fM,"f").setColors(e),CM(this,KS,"f").setCamera(CM(this,fM,"f").cameraOrbit),CM(this,xM,"f").disable(),null===(n=CM(this,cM,"f"))||void 0===n||n.dispose(),AM(this,cM,null,"f")},SM=function(){var e,t,n;if(CM(this,QS,"f").getSettingBoolean(Jh.GhostCarEnabled)&&(null!=CM(this,mM,"f")&&(null===(e=CM(this,mM,"f"))||void 0===e||e.dispose(),AM(this,mM,null,"f")),null!=CM(this,vM,"f").time&&null!=CM(this,vM,"f").recording)){const e=CM(this,qS,"f").getStartTransform();if(null!=CM(this,gM,"f")&&CM(this,vM,"f").recording!=(null===(t=CM(this,gM,"f"))||void 0===t?void 0:t.recording)&&(null!=CM(this,gM,"f").carId&&(CM(this,jS,"f").deleteCar(CM(this,gM,"f").carId),CM(this,gM,"f").carId=null),AM(this,gM,null,"f")),null==CM(this,gM,"f")){const t=CM(this,vM,"f").time.numberOfFrames+1e4,n=new NS,i=CM(this,jS,"f").createCar(e,CM(this,XS,"f").getMountainVertices(),CM(this,XS,"f").getMountainOffset(),CM(this,qS,"f").getTrackData(),CM(this,vM,"f").recording,(e=>{n.push(e),e.frames>=t&&null!=r.carId&&(CM(this,jS,"f").deleteCar(r.carId),r.carId=null)}));n.push(i),CM(this,jS,"f").startCar(i.id,new rp(t));const r={carId:i.id,recording:CM(this,vM,"f").recording,replay:n};AM(this,gM,r,"f")}const i=new Uv(null,e,CM(this,vM,"f").recording,null,!1,CM(this,KS,"f"),CM(this,ZS,"f"),CM(this,XS,"f"),CM(this,qS,"f"),CM(this,QS,"f"));i.setColors(null!==(n=CM(this,vM,"f").carColors)&&void 0!==n?n:CM(this,JS,"f").getCarColors()),i.audioVolume=.35,CM(this,VS,"m",MM).call(this),AM(this,mM,i,"f")}},MM=function(){if(null!=CM(this,mM,"f")&&null!=CM(this,fM,"f")){const e=CM(this,mM,"f").getPosition().distanceTo(CM(this,fM,"f").getPosition()),t=Math.max(0,Math.min(1,e/5));CM(this,mM,"f").setOpacity(t)}},TM=function(){var e,t;null!=CM(this,lM,"f")&&(CM(this,lM,"f").record=null!==(t=null===(e=CM(this,vM,"f"))||void 0===e?void 0:e.time)&&void 0!==t?t:null)};const PM=class{constructor(e,t,n,i,r,a,o,s,l,c,h,d,u,p,f,m,g){VS.add(this),GS.set(this,void 0),jS.set(this,void 0),qS.set(this,void 0),XS.set(this,void 0),YS.set(this,void 0),KS.set(this,void 0),ZS.set(this,void 0),JS.set(this,void 0),QS.set(this,void 0),$S.set(this,void 0),eM.set(this,void 0),tM.set(this,void 0),nM.set(this,void 0),iM.set(this,void 0),rM.set(this,!0),aM.set(this,void 0),oM.set(this,void 0),sM.set(this,void 0),lM.set(this,void 0),cM.set(this,void 0),hM.set(this,void 0),dM.set(this,void 0),uM.set(this,void 0),pM.set(this,void 0),fM.set(this,null),mM.set(this,null),gM.set(this,null),vM.set(this,void 0),wM.set(this,void 0),yM.set(this,void 0),bM.set(this,void 0),xM.set(this,void 0),this.isPaused=!1,AM(this,GS,e,"f"),AM(this,jS,t,"f"),AM(this,qS,n,"f"),AM(this,XS,i,"f"),AM(this,YS,r,"f"),AM(this,KS,a,"f"),AM(this,ZS,o,"f"),AM(this,JS,s,"f"),AM(this,QS,l,"f"),AM(this,$S,c,"f"),AM(this,eM,h,"f"),AM(this,tM,m,"f"),AM(this,nM,g,"f"),AM(this,vM,p,"f"),AM(this,wM,f,"f"),AM(this,iM,d,"f"),n.loadTrackData(u),n.generateMeshes(),i.generateMountains(n.getBounds()),AM(this,pM,new RS(l),"f"),c.setCursorHiddenWhenInactive(!0),AM(this,dM,new xS(CM(this,pM,"f"),CM(this,ZS,"f"),(()=>{CM(this,VS,"m",kM).call(this)}),g),"f"),CM(this,dM,"f").setEnabled(CM(this,eM,"f").touchEnabled),CM(this,VS,"m",_M).call(this,!0),CM(this,VS,"m",TM).call(this),AM(this,xM,new pS(l),"f"),CM(this,xM,"f").addToggleListener((e=>{e?(null!=CM(this,fM,"f")&&(CM(this,fM,"f").audioVolume=0),null!=CM(this,mM,"f")&&(CM(this,mM,"f").audioVolume=0),CM(this,VS,"m",_M).call(this,!1),a.setCamera(CM(this,xM,"f").camera)):null!=CM(this,fM,"f")&&(null!=CM(this,fM,"f")&&(CM(this,fM,"f").audioVolume=1),null!=CM(this,mM,"f")&&(CM(this,mM,"f").audioVolume=.35),CM(this,VS,"m",_M).call(this,CM(this,rM,"f")),a.setCamera(CM(this,fM,"f").cameraOrbit))})),CM(this,eM,"f").addChangeListener(AM(this,uM,(e=>{var t,n,i,r,a,o,s,l,c;e?(null===(t=CM(this,oM,"f"))||void 0===t||t.setOverridePosition(!0),null===(n=CM(this,lM,"f"))||void 0===n||n.setOverridePosition(!0),null===(i=CM(this,sM,"f"))||void 0===i||i.setOverridePosition(!0),null===(r=CM(this,hM,"f"))||void 0===r||r.dispose(),AM(this,hM,null,"f")):(null===(a=CM(this,oM,"f"))||void 0===a||a.setOverridePosition(null),null===(o=CM(this,lM,"f"))||void 0===o||o.setOverridePosition(null),null===(s=CM(this,sM,"f"))||void 0===s||s.setOverridePosition(null),CM(this,rM,"f")&&!CM(this,xM,"f").enabled&&null==CM(this,hM,"f")&&(AM(this,hM,new HS(CM(this,ZS,"f"),CM(this,YS,"f"),CM(this,QS,"f"),CM(this,nM,"f")),"f"),CM(this,hM,"f").setVisible(!(null!==(c=null===(l=CM(this,fM,"f"))||void 0===l?void 0:l.hasStarted())&&void 0!==c&&c)))),CM(this,dM,"f").setEnabled(e)}),"f")),CM(this,VS,"m",EM).call(this,s.getCarColors()),CM(this,VS,"m",SM).call(this),window.addEventListener("keydown",AM(this,yM,(e=>{var t;if(CM(this,xM,"f").enabled||(CM(this,QS,"f").checkKeyBinding(e,Lb.VehicleReset)?((null===(t=CM(this,fM,"f"))||void 0===t?void 0:t.hasStarted())&&CM(this,VS,"m",kM).call(this),e.preventDefault()):CM(this,QS,"f").checkKeyBinding(e,Lb.VehicleCockpitCamera)?(e.repeat||null==CM(this,fM,"f")||CM(this,fM,"f").hasFinished()||(CM(this,QS,"f").getSettingBoolean(Jh.CockpitCameraToggle)?CM(this,KS,"f").camera==CM(this,fM,"f").cameraOrbit?CM(this,KS,"f").setCamera(CM(this,fM,"f").cameraCockpit):CM(this,KS,"f").setCamera(CM(this,fM,"f").cameraOrbit):CM(this,KS,"f").setCamera(CM(this,fM,"f").cameraCockpit)),e.preventDefault()):l.checkKeyBinding(e,Lb.ToggleUI)?(AM(this,rM,!CM(this,rM,"f"),"f"),CM(this,VS,"m",_M).call(this,CM(this,rM,"f")),e.preventDefault()):"Escape"==e.code&&(g(),e.preventDefault())),l.checkKeyBinding(e,Lb.ToggleSpectatorCamera)&&null!=CM(this,fM,"f")){CM(this,xM,"f").camera.position.copy(CM(this,KS,"f").camera.position);const t=new _i(0,0,0,"YXZ").setFromQuaternion(CM(this,KS,"f").camera.quaternion);t.z=0,CM(this,xM,"f").camera.quaternion.setFromEuler(t),CM(this,xM,"f").toggle(),e.preventDefault()}}),"f")),window.addEventListener("keyup",AM(this,bM,(e=>{CM(this,xM,"f").enabled||CM(this,QS,"f").checkKeyBinding(e,Lb.VehicleCockpitCamera)&&(null==CM(this,fM,"f")||CM(this,fM,"f").hasFinished()||CM(this,QS,"f").getSettingBoolean(Jh.CockpitCameraToggle)||CM(this,KS,"f").setCamera(CM(this,fM,"f").cameraOrbit))}),"f"))}dispose(e=!0){var t,n;CM(this,$S,"f").setCursorHiddenWhenInactive(!1),CM(this,VS,"m",_M).call(this,!1),CM(this,dM,"f").dispose(),CM(this,eM,"f").removeChangeListener(CM(this,uM,"f")),e&&CM(this,qS,"f").clear(),CM(this,XS,"f").clearMountains(),CM(this,pM,"f").dispose(),null===(t=CM(this,fM,"f"))||void 0===t||t.dispose(),null!=(null===(n=CM(this,gM,"f"))||void 0===n?void 0:n.carId)&&(CM(this,jS,"f").deleteCar(CM(this,gM,"f").carId),CM(this,gM,"f").carId=null,AM(this,gM,null,"f")),null!=CM(this,mM,"f")&&(CM(this,mM,"f").dispose(),AM(this,mM,null,"f")),window.removeEventListener("keydown",CM(this,yM,"f")),window.removeEventListener("keyup",CM(this,bM,"f")),CM(this,xM,"f").dispose()}update(e){var t,n,i,r,a,o,s,l,c,h;if(!this.isPaused){let h;if(h=null==CM(this,fM,"f")||CM(this,xM,"f").enabled?0:e,null===(t=CM(this,fM,"f"))||void 0===t||t.update(h),null==CM(this,fM,"f")||CM(this,xM,"f").enabled)null!=CM(this,fM,"f")&&(CM(this,fM,"f").isPaused=!0);else{CM(this,fM,"f").isPaused=!1;const t=CM(this,pM,"f").getControls();(t.up||t.down)&&(CM(this,fM,"f").hasStarted()||CM(this,fM,"f").start()),null===(n=CM(this,aM,"f"))||void 0===n||n.update(CM(this,fM,"f"),e),null===(i=CM(this,sM,"f"))||void 0===i||i.update(CM(this,fM,"f")),null===(r=CM(this,lM,"f"))||void 0===r||r.update(CM(this,fM,"f")),null===(a=CM(this,oM,"f"))||void 0===a||a.update(CM(this,fM,"f")),null===(o=CM(this,hM,"f"))||void 0===o||o.setVisible(!CM(this,fM,"f").hasStarted())}if(null!=CM(this,mM,"f")){const e=null===(s=CM(this,fM,"f"))||void 0===s?void 0:s.getTotalTime().numberOfFrames;if(null!=e){for(let t=CM(this,mM,"f").getTotalTime().numberOfFrames+1;t<=e;t++){const e=null===(l=CM(this,gM,"f"))||void 0===l?void 0:l.replay.getFrame(t);if(null==e){CM(this,mM,"f").dispose(),AM(this,mM,null,"f");break}CM(this,mM,"f").setCarState(e)}}null===(c=CM(this,mM,"f"))||void 0===c||c.update(h)}CM(this,VS,"m",MM).call(this),CM(this,xM,"f").update(e)}CM(this,KS,"f").update(null===(h=CM(this,fM,"f"))||void 0===h?void 0:h.getPosition()),CM(this,ZS,"f").update(e,!1,CM(this,KS,"f"),CM(this,QS,"f"))}};var RM,LM,IM,NM,DM,UM,BM,OM,zM,FM=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},WM=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};LM=new WeakMap,IM=new WeakMap,NM=new WeakMap,DM=new WeakMap,UM=new WeakMap,BM=new WeakMap,OM=new WeakMap,RM=new WeakSet,zM=function(){var e,t;if(WM(this,UM,"f")instanceof Kr){const e=window.innerWidth/window.innerHeight;WM(this,LM,"f").width==window.innerWidth&&WM(this,LM,"f").height==window.innerHeight&&WM(this,UM,"f").aspect==e||(WM(this,NM,"f").setSize(window.innerWidth,window.innerHeight),WM(this,UM,"f").aspect=e,WM(this,UM,"f").updateProjectionMatrix())}let n=null!==(t=null===(e=WM(this,IM,"f"))||void 0===e?void 0:e.getSettingFloat(Jh.RenderScale))&&void 0!==t?t:1;n=Number.isFinite(n)?Math.min(Math.max(n,.25),2):1;const i=window.devicePixelRatio*n;WM(this,NM,"f").pixelRatio!=i&&WM(this,NM,"f").setPixelRatio(i)};const HM=class{constructor(e,t,n=!0,i=!1){var r;RM.add(this),LM.set(this,void 0),IM.set(this,void 0),NM.set(this,void 0),DM.set(this,void 0),UM.set(this,new Kr),BM.set(this,void 0),OM.set(this,{x:8,y:10,z:10}),FM(this,LM,e,"f"),FM(this,IM,t,"f"),FM(this,NM,new Zs({antialias:null===(r=null==t?void 0:t.getSettingBoolean(Jh.Antialiasing))||void 0===r||r,powerPreference:"high-performance",canvas:e,alpha:i}),"f"),WM(this,NM,"f").outputColorSpace=Ct,WM(this,NM,"f").shadowMap.enabled=!0,FM(this,DM,new Qs,"f"),n&&(WM(this,DM,"f").fog=new Js(6793641,.001)),WM(this,DM,"f").add(new xh(3891597,11714755,4.7)),FM(this,BM,new Nh(16777215,4.7),"f"),WM(this,BM,"f").position.set(WM(this,OM,"f").x,WM(this,OM,"f").y,WM(this,OM,"f").z),WM(this,BM,"f").castShadow=!0,WM(this,BM,"f").shadow.camera.top=10,WM(this,BM,"f").shadow.camera.right=10,WM(this,BM,"f").shadow.camera.bottom=-10,WM(this,BM,"f").shadow.camera.left=-10,WM(this,BM,"f").shadow.camera.near=1,WM(this,BM,"f").shadow.camera.far=50,WM(this,BM,"f").shadow.mapSize.width=2048,WM(this,BM,"f").shadow.mapSize.height=2048,WM(this,DM,"f").add(WM(this,BM,"f")),WM(this,DM,"f").add(WM(this,BM,"f").target)}clear(){WM(this,NM,"f").clear()}update(e){var t,n,i;const r=null!==(n=null===(t=WM(this,IM,"f"))||void 0===t?void 0:t.getSettingInteger(Jh.CarShadowQuality))&&void 0!==n?n:0;if(!Number.isFinite(r)||r<=0)WM(this,BM,"f").castShadow=!1;else{WM(this,BM,"f").castShadow=!0;const e=Math.min(r,WM(this,NM,"f").capabilities.maxTextureSize);WM(this,BM,"f").shadow.mapSize.width==e&&WM(this,BM,"f").shadow.mapSize.height==e||(WM(this,BM,"f").shadow.mapSize.setScalar(e),null===(i=WM(this,BM,"f").shadow.map)||void 0===i||i.dispose(),WM(this,BM,"f").shadow.map=null)}null!=e&&(WM(this,BM,"f").position.set(e.x+WM(this,OM,"f").x,e.y+WM(this,OM,"f").y,e.z+WM(this,OM,"f").z),WM(this,BM,"f").target.position.copy(e)),WM(this,RM,"m",zM).call(this),WM(this,NM,"f").render(WM(this,DM,"f"),WM(this,UM,"f"))}getShadowDirection(){return(new Un).subVectors(WM(this,BM,"f").position,WM(this,BM,"f").target.position).normalize()}getLightTarget(){return WM(this,BM,"f").target.position}getMaxAnisotropy(){return WM(this,NM,"f").capabilities.getMaxAnisotropy()}setCamera(e){FM(this,UM,e,"f")}get camera(){return WM(this,UM,"f")}get canvas(){return WM(this,LM,"f")}setAnimationLoop(e){WM(this,NM,"f").setAnimationLoop(e)}get scene(){return WM(this,DM,"f")}};var VM,GM,jM,qM=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},XM=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};class YM{constructor(e){if(GM.set(this,void 0),null!=e){if(!Number.isInteger(e))throw"Seed must be an integer";XM(this,GM,e%qM(VM,VM,"f",jM).length,"f")}else XM(this,GM,0,"f")}next(){var e;return XM(this,GM,(e=qM(this,GM,"f"),++e),"f"),qM(this,GM,"f")>=qM(VM,VM,"f",jM).length&&XM(this,GM,0,"f"),qM(VM,VM,"f",jM)[qM(this,GM,"f")]}}VM=YM,GM=new WeakMap,jM={value:[.12047764760664692,.19645762332790628,.5525629082262744,.41272626379209965,.7795036003541387,.13367266027110114,.7999601557377349,.9519714253374205,.1735048382917752,.7513367084489158,.6531386724839523,.9026427867068505,.8543272738216994,.11176849958868162,.6705698284858437,.26628732081296946,.31140322993719605,.45170300835470933,.12615515120247944,.0610638094525735,.291990923385425,.4613983868623317,.6615759832726253,.4373182881232056,.7432890501246443,.39316710322388837,.49444122821563297,.5994296685114344,.060050119050233386,.4165885432422003,.43974364800990084,.1628314496954224,.05787972729968116,.225388541259955,.6075775236386991,.8908354370882479,.47072983115144584,.7662003453186828,.20651036895645647,.03724062137286044,.17110277274376795,.7626426077793496,.8372112804261309,.8761690804447455,.13887024930406633,.8287513367412203,.9794446290917873,.807658524448803,.8465629116398186,.5187285629536083,.33962953580139277,.9798419666114342,.6777071959103609,.5388899884934379,.7863389168762325,.4274591420924474,.25631366937500566,.5695289062505289,.026841382754547727,.18267938207996903,.9853642975717878,.24428485895234409,.5322028747608949,.9655065842019517,.043810183244384016,.541216190236913,.05897981610006209,.2849168541804703,.5349823008832073,.9655676144971486,.22831812764497283,.7698701658704175,.4103995069939841,.25782763124411856,.8490222628872495,.39280879489916987,.31999467883347554,.2860820872456349,.9684928577493004,.9973831481899462,.2930912094664657,.4847128131859766,.7218400909709828,.40407009594106236,.7059298060123587,.45362146566562744,.4640974655488792,.16076769483252273,.5989453525750241,.585759299589679,.9417035568973537,.20117930667657413,.5777873180244959,.1991854396549344,.8743781441651348,.624666386634513,.38720573630932886,.9967931526923675,.49817894572849486,.24585267823751833,.8639168275132305,.2865624029759799,.6163605496913385,.5864748073339972,.8781049154377354,.7497547608938613,.7864098057445887,.0334170452332867,.4875588105294657,.6737395339380896,.21851121231639659,.2923739650597854,.6073797612662293,.41823228947229896,.8531029420136382,.3260916332061783,.6306262204574675,.5268576689601923,.3516570914484707,.8659366375222706,.8447448461834428,.3794548980890986,.9832775904115916,.8442256760399809,.3006550591973338,.9718660619781394,.5103245035851833,.794319831388071]};const KM=YM;var ZM,JM,QM,$M,eT=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},tT=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class nT{constructor(e){ZM.set(this,void 0),JM.set(this,void 0),QM.set(this,void 0),$M.set(this,null),eT(this,ZM,e,"f"),eT(this,JM,new Br(new dc(9e3,32),new jc({color:3495480,depthWrite:!1})),"f"),tT(this,JM,"f").rotation.x=-Math.PI/2,tT(this,JM,"f").renderOrder=-3,e.scene.add(tT(this,JM,"f")),eT(this,QM,new Br(new ca(120,120),new jc({color:3495480,depthWrite:!1})),"f"),tT(this,QM,"f").rotation.x=-Math.PI/2,tT(this,QM,"f").receiveShadow=!0,tT(this,QM,"f").renderOrder=-2,e.scene.add(tT(this,QM,"f"))}clearMountains(){null!=tT(this,$M,"f")&&(tT(this,$M,"f").material.dispose(),tT(this,$M,"f").geometry.dispose(),tT(this,ZM,"f").scene.remove(tT(this,$M,"f")),eT(this,$M,null,"f"))}generateMountains(e){this.clearMountains();const{vertices:t,offset:n}=nT.createMountainVertices(e),i=new yr;i.setAttribute("position",new lr(new Float32Array(t),3)),i.computeVertexNormals();const r=new Br(i,new jc({color:3495480}));r.position.copy(n),r.receiveShadow=!0,tT(this,ZM,"f").scene.add(r),eT(this,$M,r,"f")}static createMountainVertices(e){const t=new KM,n=Math.max(200,160+Math.max(Math.abs(e.max.x-e.min.x)*Ky.partWidth/2*Math.SQRT2,Math.abs(e.max.y-e.min.y)*Ky.partLength/2*Math.SQRT2)),i=new ln((e.min.x+(e.max.x-e.min.x)/2)*Ky.partWidth,(e.min.y+(e.max.y-e.min.y)/2)*Ky.partLength);if(n>4500)return{vertices:[],offset:new Un};const r=Math.floor(n/10),a=[];for(let e=0;e<r;++e){const e=[];for(let n=0;n<8;++n)0==n||7==n||1==n&&t.next()<.5?e.push(0):e.push(t.next());a.push(e)}const o=100,s=[];for(let e=0;e<a.length;++e){const t=e/a.length*Math.PI*2,i=(e+1)/a.length*Math.PI*2,r=a[e];let l;l=e+1<a.length?a[e+1]:a[0];for(let e=0;e<r.length-1;++e){const a=n+100*e,c=n+100*(e+1);s.push(Math.cos(t)*a,r[e]*o,Math.sin(t)*a),s.push(Math.cos(i)*a,l[e]*o,Math.sin(i)*a),s.push(Math.cos(i)*c,l[e+1]*o,Math.sin(i)*c),s.push(Math.cos(t)*a,r[e]*o,Math.sin(t)*a),s.push(Math.cos(i)*c,l[e+1]*o,Math.sin(i)*c),s.push(Math.cos(t)*c,r[e+1]*o,Math.sin(t)*c)}}return{vertices:s,offset:new Un(i.x,0,i.y)}}getMountainVertices(){if(null==tT(this,$M,"f"))return[];const e=tT(this,$M,"f").geometry;if(!(e.attributes.position instanceof lr))throw"Vertices must use BufferAttribute";return Array.from(e.attributes.position.array)}getMountainOffset(){return null==tT(this,$M,"f")?new Un:tT(this,$M,"f").position.clone()}raycast(e){const t=e.intersectObject(tT(this,QM,"f"));if(t.length>0)return t[0];if(null!=tT(this,$M,"f")){const t=e.intersectObject(tT(this,$M,"f"));if(t.length>0)return t[0]}return null}update(){const e=new Un,t=new Dn,n=new Un;tT(this,ZM,"f").camera.matrix.decompose(e,t,n),tT(this,JM,"f").position.set(e.x,0,e.z);const i=tT(this,ZM,"f").getLightTarget();tT(this,QM,"f").position.set(i.x,0,i.z),tT(this,QM,"f").visible=tT(this,QM,"f").position.manhattanDistanceTo(tT(this,JM,"f").position)<8e3}}ZM=new WeakMap,JM=new WeakMap,QM=new WeakMap,$M=new WeakMap;const iT=nT;var rT=n(915),aT={};aT.styleTagTransform=u(),aT.setAttributes=l(),aT.insert=o().bind(null,"head"),aT.domAPI=r(),aT.insertStyleElement=h();t()(rT.A,aT);rT.A&&rT.A.locals&&rT.A.locals;var oT=n(927),sT={};sT.styleTagTransform=u(),sT.setAttributes=l(),sT.insert=o().bind(null,"head"),sT.domAPI=r(),sT.insertStyleElement=h();t()(oT.A,sT);oT.A&&oT.A.locals&&oT.A.locals;var lT,cT,hT=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},dT=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};lT=new WeakMap,cT=new WeakMap;const uT=class{constructor(e,t,n){lT.set(this,void 0),cT.set(this,void 0),hT(this,lT,e,"f"),hT(this,cT,document.createElement("div"),"f"),dT(this,cT,"f").className="loading",e.appendChild(dT(this,cT,"f"));const i=document.createElement("p");i.textContent=t.get("Loading")+"...",dT(this,cT,"f").appendChild(i);const r=document.createElement("div");dT(this,cT,"f").appendChild(r);const a=document.createElement("div");r.appendChild(a);const o=document.createElement("div");a.appendChild(o),n.addProgressListener((e=>{o.style.width=100*e+"%"}))}dispose(){dT(this,lT,"f").removeChild(dT(this,cT,"f"))}};var pT=n(643),fT={};fT.styleTagTransform=u(),fT.setAttributes=l(),fT.insert=o().bind(null,"head"),fT.domAPI=r(),fT.insertStyleElement=h();t()(pT.A,fT);pT.A&&pT.A.locals&&pT.A.locals;var mT,gT,vT,wT,yT,bT,xT,_T,kT,ET,ST,MT,TT,AT,CT,PT,RT,LT,IT,NT,DT=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},UT=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};gT=new WeakMap,vT=new WeakMap,wT=new WeakMap,yT=new WeakMap,bT=new WeakMap,xT=new WeakMap,_T=new WeakMap,kT=new WeakMap,ET=new WeakMap,ST=new WeakMap,MT=new WeakMap,TT=new WeakMap,mT=new WeakSet,AT=function(){UT(this,_T,"f").className="hidden"},CT=function(){UT(this,_T,"f").className="settings-menu"},PT=function(){UT(this,kT,"f").innerHTML="",UT(this,mT,"m",RT).call(this,UT(this,vT,"f").get("Gameplay")),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Units"),[{title:UT(this,vT,"f").get("Metric"),value:"false"},{title:UT(this,vT,"f").get("Imperial"),value:"true"}],Jh.ImperialUnitsEnabled),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Reset hint"),[{title:UT(this,vT,"f").get("Disabled"),value:"false"},{title:UT(this,vT,"f").get("Enabled"),value:"true"}],Jh.ResetHintEnabled),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Ghost car"),[{title:UT(this,vT,"f").get("Disabled"),value:"false"},{title:UT(this,vT,"f").get("Enabled"),value:"true"}],Jh.GhostCarEnabled),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Cockpit camera mode"),[{title:UT(this,vT,"f").get("Hold"),value:"false"},{title:UT(this,vT,"f").get("Toggle"),value:"true"}],Jh.CockpitCameraToggle),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Checkpoints position"),[{title:UT(this,vT,"f").get("Bottom"),value:"false"},{title:UT(this,vT,"f").get("Top"),value:"true"}],Jh.CheckpointsPosition),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Timer position"),[{title:UT(this,vT,"f").get("Bottom"),value:"false"},{title:UT(this,vT,"f").get("Top"),value:"true"}],Jh.TimerPosition),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Speedometer position"),[{title:UT(this,vT,"f").get("Bottom"),value:"false"},{title:UT(this,vT,"f").get("Top"),value:"true"}],Jh.SpeedometerPosition),UT(this,mT,"m",RT).call(this,UT(this,vT,"f").get("Language")),UT(this,mT,"m",LT).call(this,null,[{title:"العربية",value:"ar"},{title:"Deutsch",value:"de-DE"},{title:"English",value:"en-US"},{title:"Español",value:"es-ES"},{title:"Français",value:"fr-FR"},{title:"Italiano",value:"it-IT"},{title:"日本語",value:"ja-JP"},{title:"한국어",value:"ko-KR"},{title:"Polski",value:"pl-PL"},{title:"Português (BR)",value:"pt-BR"},{title:"Português (PT)",value:"pt-PT"},{title:"Русский",value:"ru-RU"},{title:"Türkçe",value:"tr-TR"},{title:"Українська",value:"uk-UA"},{title:"简体中文",value:"zh-CN"},{title:"繁體中文",value:"zh-TW"}],Jh.Language),UT(this,mT,"m",RT).call(this,UT(this,vT,"f").get("Graphics")),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Car shadow"),[{title:UT(this,vT,"f").get("Off"),value:"0"},{title:UT(this,vT,"f").get("Low"),value:"1024"},{title:UT(this,vT,"f").get("Medium"),value:"2048"},{title:UT(this,vT,"f").get("High"),value:"4096"}],Jh.CarShadowQuality),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Track shadow"),[{title:UT(this,vT,"f").get("Off"),value:"false"},{title:UT(this,vT,"f").get("On"),value:"true"}],Jh.TrackShadowEnabled,(()=>{UT(this,bT,"f").generateMeshes()})),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Clouds"),[{title:UT(this,vT,"f").get("Off"),value:"false"},{title:UT(this,vT,"f").get("On"),value:"true"}],Jh.CloudsEnabled),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Particles"),[{title:UT(this,vT,"f").get("Off"),value:"false"},{title:UT(this,vT,"f").get("On"),value:"true"}],Jh.ParticlesEnabled),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Skidmarks"),[{title:UT(this,vT,"f").get("Off"),value:"false"},{title:UT(this,vT,"f").get("On"),value:"true"}],Jh.SkidmarksEnabled),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Render scale"),[{title:"25%",value:"0.25"},{title:"50%",value:"0.5"},{title:"100%",value:"1"},{title:"150%",value:"1.5"},{title:"200%",value:"2"}],Jh.RenderScale),UT(this,mT,"m",LT).call(this,UT(this,vT,"f").get("Anti-aliasing (requires restart)"),[{title:UT(this,vT,"f").get("Off"),value:"false"},{title:UT(this,vT,"f").get("On"),value:"true"}],Jh.Antialiasing),UT(this,mT,"m",RT).call(this,UT(this,vT,"f").get("Audio")),UT(this,mT,"m",IT).call(this,UT(this,vT,"f").get("Sound effect volume"),Jh.SoundEffectVolume),UT(this,mT,"m",IT).call(this,UT(this,vT,"f").get("Music volume"),Jh.MusicVolume),UT(this,mT,"m",IT).call(this,UT(this,vT,"f").get("Checkpoint volume"),Jh.CheckpointVolume),UT(this,mT,"m",RT).call(this,UT(this,vT,"f").get("Controls")),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Vehicle accelerate"),Lb.VehicleAccelerate),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Vehicle brake"),Lb.VehicleBrake),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Vehicle turn left"),Lb.VehicleTurnLeft),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Vehicle turn right"),Lb.VehicleTurnRight),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Vehicle reset"),Lb.VehicleReset),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Vehicle cockpit camera"),Lb.VehicleCockpitCamera),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Hide UI"),Lb.ToggleUI),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor rotate part"),Lb.EditorRotate),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor height modifier"),Lb.EditorHeightModifier),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor delete part"),Lb.EditorDelete),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor forwards"),Lb.EditorMoveForwards),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor backwards"),Lb.EditorMoveBackwards),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor left"),Lb.EditorMoveLeft),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor right"),Lb.EditorMoveRight),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor rotate left"),Lb.EditorRotateLeft),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor rotate right"),Lb.EditorRotateRight),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor move down"),Lb.EditorMoveDown),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor move up"),Lb.EditorMoveUp),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor test"),Lb.EditorTest),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Editor pick"),Lb.EditorPick),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Toggle FPS counter"),Lb.ToggleFpsCounter),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Toggle spectator camera"),Lb.ToggleSpectatorCamera),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Spectator forwards"),Lb.SpectatorMoveForwards),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Spectator backwards"),Lb.SpectatorMoveBackwards),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Spectator left"),Lb.SpectatorMoveLeft),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Spectator right"),Lb.SpectatorMoveRight),UT(this,mT,"m",NT).call(this,UT(this,vT,"f").get("Spectator speed modifier"),Lb.SpectatorSpeedModifier)},RT=function(e){const t=document.createElement("h2");t.textContent=e,UT(this,kT,"f").appendChild(t)},LT=function(e,t,n,i){var r;const a=null!==(r=UT(this,MT,"f").get(n))&&void 0!==r?r:UT(this,yT,"f").getSetting(n),o=document.createElement("div");if(o.className="setting",null!=e){const t=document.createElement("p");t.textContent=e,o.appendChild(t)}else o.classList.add("wrappable");const s=document.createElement("div");s.className="button-wrapper",o.appendChild(s);const l=[];t.forEach((({title:e,value:t})=>{const r=document.createElement("button");r.className=t==a?"button selected":"button",r.textContent=e,r.addEventListener("click",(()=>{UT(this,wT,"f").playUIClick(),l.forEach((e=>{e.className="button"})),r.className="button selected",UT(this,MT,"f").set(n,t),UT(this,yT,"f").updateSettings(Array.from(UT(this,MT,"f"))),null!=i&&i()})),s.appendChild(r),l.push(r)})),UT(this,kT,"f").appendChild(o)},IT=function(e,t,n=0,i=1){var r;let a=parseFloat(null!==(r=UT(this,MT,"f").get(t))&&void 0!==r?r:UT(this,yT,"f").getSetting(t));Number.isNaN(a)&&(a=0);const o=document.createElement("div");o.className="setting";const s=document.createElement("p");s.textContent=e,o.appendChild(s);const l=document.createElement("input");l.type="range",l.min=(20*n).toString(),l.max=(20*i).toString(),l.value=(20*a).toString(),l.addEventListener("input",(()=>{const e=parseFloat(l.value)/20;UT(this,MT,"f").set(t,e.toString()),UT(this,yT,"f").updateSettings(Array.from(UT(this,MT,"f")))})),o.appendChild(l),UT(this,kT,"f").appendChild(o)},NT=function(e,t){var n,i,r;const a=document.createElement("div");a.className="setting";const o=document.createElement("p");o.textContent=e,a.appendChild(o);const s=document.createElement("div");s.className="button-wrapper",a.appendChild(s);const l=null!==(n=UT(this,TT,"f").get(t))&&void 0!==n?n:UT(this,yT,"f").getKeyBindings(t),c=document.createElement("button");c.className="button key-binding",c.textContent=null!==(i=l[0])&&void 0!==i?i:"",c.addEventListener("click",(()=>{UT(this,wT,"f").playUIClick(),UT(this,mT,"m",AT).call(this);const e=t=>{"Escape"==t.code||"Tab"==t.code||"Enter"==t.code&&null!=document.activeElement&&document.activeElement!=document.body||(UT(this,xT,"f").hide(),l[0]=t.code,c.textContent=t.code,UT(this,mT,"m",CT).call(this),window.removeEventListener("keydown",e),t.preventDefault())};window.addEventListener("keydown",e),UT(this,xT,"f").showConfirm(UT(this,vT,"f").get("Press any key...\n\nPress [Escape] to cancel."),UT(this,vT,"f").get("Cancel"),UT(this,vT,"f").get("Clear"),(()=>{UT(this,mT,"m",CT).call(this),window.removeEventListener("keydown",e)}),(()=>{c.textContent="",l[0]=null,window.removeEventListener("keydown",e),UT(this,mT,"m",CT).call(this)}))})),s.appendChild(c);const h=document.createElement("button");h.className="button key-binding",h.textContent=null!==(r=l[1])&&void 0!==r?r:"",h.addEventListener("click",(()=>{UT(this,wT,"f").playUIClick(),UT(this,mT,"m",AT).call(this);const e=t=>{"Escape"==t.code||"Tab"==t.code||"Enter"==t.code&&null!=document.activeElement&&document.activeElement!=document.body||(UT(this,xT,"f").hide(),l[1]=t.code,h.textContent=t.code,UT(this,mT,"m",CT).call(this),window.removeEventListener("keydown",e),t.preventDefault())};window.addEventListener("keydown",e),UT(this,xT,"f").showConfirm(UT(this,vT,"f").get("Press any key...\n\nPress [Escape] to cancel."),UT(this,vT,"f").get("Cancel"),UT(this,vT,"f").get("Clear"),(()=>{UT(this,mT,"m",CT).call(this),window.removeEventListener("keydown",e)}),(()=>{h.textContent="",l[1]=null,window.removeEventListener("keydown",e),UT(this,mT,"m",CT).call(this)}))})),s.appendChild(h),UT(this,kT,"f").appendChild(a)};const BT=class{constructor(e,t,n,i,r,a,o){mT.add(this),gT.set(this,void 0),vT.set(this,void 0),wT.set(this,void 0),yT.set(this,void 0),bT.set(this,void 0),xT.set(this,void 0),_T.set(this,void 0),kT.set(this,void 0),ET.set(this,void 0),ST.set(this,new Map),MT.set(this,new Map),TT.set(this,new Map),DT(this,gT,e,"f"),DT(this,vT,t,"f"),DT(this,wT,n,"f"),DT(this,yT,i,"f"),DT(this,bT,r,"f"),DT(this,xT,a,"f"),DT(this,_T,document.createElement("div"),"f"),UT(this,_T,"f").className="settings-menu",e.appendChild(UT(this,_T,"f"));const s=document.createElement("h2");s.textContent=t.get("Settings"),UT(this,_T,"f").appendChild(s),DT(this,kT,document.createElement("div"),"f"),UT(this,kT,"f").className="container",UT(this,_T,"f").appendChild(UT(this,kT,"f")),DT(this,ST,new Map(i.getSettings()),"f"),UT(this,mT,"m",PT).call(this);const l=document.createElement("div");l.className="button-wrapper",UT(this,_T,"f").appendChild(l);const c=document.createElement("button");c.className="button cancel",c.innerHTML='<img class="button-icon" src="images/cancel.svg"> ',c.append(document.createTextNode(t.get("Cancel"))),c.addEventListener("click",(()=>{n.playUIClick(),i.updateSettings(Array.from(UT(this,ST,"f"))),r.generateMeshes(),o()})),l.appendChild(c);const h=document.createElement("button");h.className="button reset",h.innerHTML='<img class="button-icon" src="images/reset_settings.svg"> ',h.append(document.createTextNode(t.get("Reset"))),h.addEventListener("click",(()=>{n.playUIClick(),DT(this,MT,UT(this,yT,"f").defaultSettings(),"f"),i.updateSettings(Array.from(UT(this,MT,"f"))),DT(this,TT,UT(this,yT,"f").defaultKeyBindings(),"f"),r.generateMeshes(),UT(this,mT,"m",PT).call(this)})),l.appendChild(h);const d=document.createElement("button");d.className="button apply",d.append(document.createTextNode(t.get("Apply"))),d.innerHTML+=' <img class="button-icon" src="images/apply.svg">',d.addEventListener("click",(()=>{n.playUIClick(),i.updateSettings(Array.from(UT(this,MT,"f"))),i.saveSettings(),i.setKeyBindings(Array.from(UT(this,TT,"f"))),r.generateMeshes(),t.language=i.getSetting(Jh.Language),o()})),l.appendChild(d),window.addEventListener("keydown",DT(this,ET,(e=>{"Escape"==e.code&&(o(),e.preventDefault())}),"f"))}dispose(){UT(this,gT,"f").removeChild(UT(this,_T,"f")),window.removeEventListener("keydown",UT(this,ET,"f"))}};var OT=n(586),zT={};zT.styleTagTransform=u(),zT.setAttributes=l(),zT.insert=o().bind(null,"head"),zT.domAPI=r(),zT.insertStyleElement=h();t()(OT.A,zT);OT.A&&OT.A.locals&&OT.A.locals;var FT=n(657),WT={};WT.styleTagTransform=u(),WT.setAttributes=l(),WT.insert=o().bind(null,"head"),WT.domAPI=r(),WT.insertStyleElement=h();t()(FT.A,WT);FT.A&&FT.A.locals&&FT.A.locals;var HT=n(86),VT={};VT.styleTagTransform=u(),VT.setAttributes=l(),VT.insert=o().bind(null,"head"),VT.domAPI=r(),VT.insertStyleElement=h();t()(HT.A,VT);HT.A&&HT.A.locals&&HT.A.locals;let GT=null,jT=null,qT=null,XT=null;function YT(e){return null!=GT&&null!=jT&&null!=qT&&null!=XT||(jT=document.createElement("canvas"),jT.width=100,jT.height=100,qT=new HM(jT,null,!1,!0),XT=new _a(-1,1,1,-1,.1,1e4),XT.position.set(1e3,1e3,1e3),XT.lookAt(0,0,0),XT.zoom=.5,XT.position.add(new Un(.1,.3,0)),XT.updateProjectionMatrix(),qT.scene.add(XT),qT.setCamera(XT),GT=new Uv(null,{position:new Un,quaternion:new Dn},null,null,!1,qT,null,null,null,null),GT.update(0)),GT.setColors(e),qT.update(new Un),jT.toDataURL()}var KT,ZT,JT,QT,$T,eA,tA,nA,iA,rA,aA,oA,sA,lA,cA,hA,dA,uA,pA,fA,mA,gA,vA,wA,yA,bA,xA,_A,kA=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},EA=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class SA{constructor(e,t,n,i,r,a,o,s,l,c,h){KT.add(this),JT.set(this,void 0),QT.set(this,void 0),$T.set(this,void 0),eA.set(this,void 0),tA.set(this,void 0),nA.set(this,void 0),iA.set(this,void 0),rA.set(this,void 0),aA.set(this,void 0),oA.set(this,void 0),sA.set(this,void 0),lA.set(this,void 0),cA.set(this,void 0),hA.set(this,void 0),dA.set(this,void 0),uA.set(this,void 0),pA.set(this,null),fA.set(this,!1),mA.set(this,!1),gA.set(this,0),vA.set(this,0),wA.set(this,null),yA.set(this,null),kA(this,JT,t,"f"),kA(this,QT,n,"f"),kA(this,$T,i,"f"),kA(this,eA,r,"f"),kA(this,tA,a,"f"),kA(this,nA,o,"f"),kA(this,iA,l,"f"),kA(this,rA,c,"f"),kA(this,aA,h,"f"),kA(this,oA,e,"f"),kA(this,sA,document.createElement("div"),"f"),EA(this,sA,"f").className="leaderboard",e.appendChild(EA(this,sA,"f"));const d=document.createElement("h2");d.textContent=n.get("Leaderboard"),EA(this,sA,"f").appendChild(d),kA(this,lA,document.createElement("div"),"f"),EA(this,lA,"f").className="container",EA(this,sA,"f").appendChild(EA(this,lA,"f")),kA(this,cA,document.createElement("div"),"f"),EA(this,cA,"f").className="loading-spinner",EA(this,lA,"f").appendChild(EA(this,cA,"f")),EA(this,KT,"m",bA).call(this,!1),kA(this,uA,document.createElement("div"),"f"),EA(this,uA,"f").className="pages",EA(this,sA,"f").appendChild(EA(this,uA,"f")),EA(this,KT,"m",_A).call(this);const u=document.createElement("div");u.className="button-wrapper",EA(this,sA,"f").appendChild(u);const p=document.createElement("button");p.className="button back",p.innerHTML='<img class="button-icon" src="images/back.svg"> ',p.append(document.createTextNode(n.get("Back"))),p.addEventListener("click",(()=>{r.playUIClick(),s()})),u.appendChild(p),kA(this,hA,document.createElement("button"),"f"),EA(this,hA,"f").className="button icon-button first",EA(this,hA,"f").innerHTML='<img class="button-icon" src="images/pin.svg">',EA(this,hA,"f").disabled=!0,EA(this,hA,"f").addEventListener("click",(()=>{r.playUIClick(),null!=EA(this,yA,"f")?EA(this,yA,"f").scrollIntoView({behavior:"smooth"}):null!=EA(this,wA,"f")&&(kA(this,gA,EA(this,wA,"f"),"f"),EA(this,KT,"m",_A).call(this),EA(this,KT,"m",bA).call(this,!0))})),u.appendChild(EA(this,hA,"f")),kA(this,dA,document.createElement("button"),"f"),EA(this,dA,"f").className="button icon-button disabled",EA(this,dA,"f").innerHTML='<img class="button-icon" src="images/verified.svg">',EA(this,dA,"f").addEventListener("click",(()=>{r.playUIClick(),kA(this,mA,!EA(this,mA,"f"),"f"),EA(this,mA,"f")?EA(this,dA,"f").classList.remove("disabled"):EA(this,dA,"f").classList.add("disabled"),EA(this,KT,"m",bA).call(this,!1)})),u.appendChild(EA(this,dA,"f"))}dispose(){EA(this,oA,"f").removeChild(EA(this,sA,"f"))}static getPositionSuffix(e){if(e<=0||!Number.isInteger(e))throw"Position must be a positive integer.";const t=e%100;if(t>=11&&t<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}}ZT=SA,JT=new WeakMap,QT=new WeakMap,$T=new WeakMap,eA=new WeakMap,tA=new WeakMap,nA=new WeakMap,iA=new WeakMap,rA=new WeakMap,aA=new WeakMap,oA=new WeakMap,sA=new WeakMap,lA=new WeakMap,cA=new WeakMap,hA=new WeakMap,dA=new WeakMap,uA=new WeakMap,pA=new WeakMap,fA=new WeakMap,mA=new WeakMap,gA=new WeakMap,vA=new WeakMap,wA=new WeakMap,yA=new WeakMap,KT=new WeakSet,bA=function e(t){null!=EA(this,pA,"f")&&(EA(this,pA,"f").isCancelled=!0);const n={isCancelled:!1};kA(this,pA,n,"f"),EA(this,lA,"f").innerHTML="",EA(this,lA,"f").appendChild(EA(this,cA,"f")),kA(this,yA,null,"f"),setTimeout((()=>{if(!n.isCancelled){const i=20,r=EA(this,gA,"f")*i;EA(this,$T,"f").getLeaderboard(EA(this,JT,"f"),r,i,EA(this,mA,"f")).then((({total:a,entries:o,userEntry:s})=>{if(!n.isCancelled&&(kA(this,vA,Math.ceil(a/i),"f"),EA(this,KT,"m",_A).call(this),o.forEach((({id:e,name:t,time:n,carColors:i,verifiedState:a,isSelf:o},s)=>{const l=r+s+1;EA(this,KT,"m",xA).call(this,l,t,n,i,a,o,e)})),null!=s?(kA(this,wA,Math.floor((s.position-1)/i),"f"),EA(this,hA,"f").disabled=!1,t&&null!=EA(this,yA,"f")&&EA(this,yA,"f").scrollIntoView(),EA(this,aA,"f").call(this,s)):(kA(this,wA,null,"f"),EA(this,hA,"f").disabled=!0,EA(this,aA,"f").call(this,null)),!EA(this,fA,"f"))){kA(this,fA,!0,"f");let n=null;null!=s&&(n={time:s.time,recordingId:s.id}),EA(this,nA,"f").syncRecord(EA(this,tA,"f").profileSlot,EA(this,JT,"f"),n,EA(this,tA,"f").getCarColors()).then((n=>{"Upload"==n&&EA(this,KT,"m",e).call(this,t)}))}})).catch((e=>{if(!n.isCancelled){const e=document.createElement("p");e.className="error-message",e.textContent=EA(this,QT,"f").get("Error: Failed to load leaderboard"),EA(this,lA,"f").appendChild(e)}console.error(e)})).finally((()=>{n.isCancelled||EA(this,lA,"f").removeChild(EA(this,cA,"f"))}))}}),500)},xA=function(e,t,n,i,r,a,o){const s=document.createElement("div");s.className="buttons",EA(this,lA,"f").appendChild(s);const l=document.createElement("button");a?(kA(this,yA,l,"f"),l.className="button main",l.disabled=!0):(l.className="button main",l.addEventListener("click",(()=>{EA(this,eA,"f").playUIClick(),EA(this,iA,"f").call(this,new Promise(((e,i)=>{EA(this,$T,"f").getRecording(o).then((({recording:i,carColors:r})=>{e({recording:i,carColors:r,name:t,time:n,isSelf:!1})})).catch(i)})))}))),s.appendChild(l);const c=document.createElement("button");c.className="button preview",c.innerHTML='<img src="images/preview.svg">',c.addEventListener("click",(()=>{EA(this,eA,"f").playUIClick(),EA(this,rA,"f").call(this,new Promise(((e,i)=>{EA(this,$T,"f").getRecording(o).then((({recording:i,carColors:r})=>{e({recording:i,carColors:r,name:t,time:n})})).catch(i)})))})),s.appendChild(c);const h=document.createElement("img");h.src=YT(i),l.appendChild(h);const d=document.createElement("div");d.className="left",l.appendChild(d);const u=document.createElement("p");u.textContent=e+ZT.getPositionSuffix(e),d.appendChild(u);const p=document.createElement("p");p.textContent=sx.formatTimeString(n),d.appendChild(p);const f=document.createElement("div");f.className="right",l.appendChild(f);const m=document.createElement("p");m.className="name",m.textContent=t,f.appendChild(m);const g=document.createElement("p");1==r?(g.innerHTML='<img src="images/state_verified.svg">',g.prepend(document.createTextNode(EA(this,QT,"f").get("Verified"))),g.className="verified-state verified"):0==r?(g.innerHTML='<img src="images/state_invalid.svg">',g.prepend(document.createTextNode(EA(this,QT,"f").get("Invalid"))),g.className="verified-state invalid"):(g.innerHTML='<img src="images/state_pending.svg">',g.prepend(document.createTextNode(EA(this,QT,"f").get("Pending"))),g.className="verified-state pending"),f.appendChild(g)},_A=function e(){EA(this,uA,"f").innerHTML="";const t=document.createElement("button");t.className="button",t.textContent="<",EA(this,gA,"f")>0?t.addEventListener("click",(()=>{EA(this,eA,"f").playUIClick(),kA(this,gA,EA(this,gA,"f")-1,"f"),EA(this,KT,"m",e).call(this),EA(this,KT,"m",bA).call(this,!1)})):t.disabled=!0,EA(this,uA,"f").appendChild(t);const n=Math.max(0,EA(this,gA,"f")-Math.floor(3.5));for(let t=n;t<n+7;++t){const n=document.createElement("button");n.textContent=(t+1).toString(),t>=EA(this,vA,"f")?(n.className="button page",n.disabled=!0):t==EA(this,gA,"f")?n.className="button page selected":(n.className="button page",n.addEventListener("click",(()=>{EA(this,eA,"f").playUIClick(),kA(this,gA,t,"f"),EA(this,KT,"m",e).call(this),EA(this,KT,"m",bA).call(this,!1)}))),EA(this,uA,"f").appendChild(n)}const i=document.createElement("button");i.className="button",i.textContent=">",EA(this,gA,"f")+1>=EA(this,vA,"f")?i.disabled=!0:i.addEventListener("click",(()=>{EA(this,eA,"f").playUIClick(),kA(this,gA,EA(this,gA,"f")+1,"f"),EA(this,KT,"m",e).call(this),EA(this,KT,"m",bA).call(this,!1)})),EA(this,uA,"f").appendChild(i)};const MA=SA;var TA,AA,CA,PA,RA,LA,IA=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},NA=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};TA=new WeakMap,AA=new WeakMap,CA=new WeakMap,PA=new WeakMap,RA=new WeakMap,LA=new WeakMap;const DA=class{constructor(e,t,n,i,r,a,o,s,l,c,h,d,u){var p;TA.set(this,void 0),AA.set(this,void 0),CA.set(this,void 0),PA.set(this,void 0),RA.set(this,void 0),LA.set(this,void 0),IA(this,TA,e,"f"),IA(this,AA,u,"f"),IA(this,CA,document.createElement("div"),"f"),NA(this,CA,"f").className="track-info",e.appendChild(NA(this,CA,"f"));const f=r.getRecord(i.profileSlot,s);IA(this,RA,new MA(NA(this,CA,"f"),s,t,n,a,i,r,c,h,d,(e=>{null==e||null!=f&&!e.time.lessOrEqual(f.time)?w.textContent=t.get("Rank")+": ---":(v.textContent=t.get("Record")+": "+sx.formatTimeString(e.time),w.textContent=t.get("Rank")+": "+e.position+MA.getPositionSuffix(e.position))})),"f"),IA(this,PA,document.createElement("div"),"f"),NA(this,PA,"f").className="side-panel",NA(this,CA,"f").appendChild(NA(this,PA,"f"));const m=document.createElement("h2");m.textContent=o,NA(this,PA,"f").appendChild(m);const g=document.createElement("div");g.className="thumbnail",g.appendChild(l),NA(this,PA,"f").appendChild(g);const v=document.createElement("p");v.textContent=t.get("Record")+": "+sx.formatTimeString(null!==(p=null==f?void 0:f.time)&&void 0!==p?p:null),NA(this,PA,"f").appendChild(v);const w=document.createElement("p");NA(this,PA,"f").appendChild(w);const y=document.createElement("button");y.className="button play",y.innerHTML='<img src="images/play.svg">',y.prepend(document.createTextNode(t.get("Play"))),y.addEventListener("click",(()=>{var e,t;a.playUIClick();const n=r.getRecord(i.profileSlot,s);NA(this,AA,"f").call(this,{recording:null!==(e=null==n?void 0:n.recording)&&void 0!==e?e:null,carColors:null,name:null,time:null!==(t=null==n?void 0:n.time)&&void 0!==t?t:null,isSelf:!0})})),NA(this,PA,"f").appendChild(y),window.addEventListener("keydown",IA(this,LA,(e=>{"Escape"==e.code&&(c(),e.preventDefault())}),"f"))}dispose(){NA(this,RA,"f").dispose(),NA(this,TA,"f").removeChild(NA(this,CA,"f")),window.removeEventListener("keydown",NA(this,LA,"f"))}};var UA=n(140),BA={};BA.styleTagTransform=u(),BA.setAttributes=l(),BA.insert=o().bind(null,"head"),BA.domAPI=r(),BA.insertStyleElement=h();t()(UA.A,BA);UA.A&&UA.A.locals&&UA.A.locals;var OA,zA,FA,WA,HA,VA,GA,jA,qA=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},XA=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};zA=new WeakMap,FA=new WeakMap,WA=new WeakMap,HA=new WeakMap,VA=new WeakMap,GA=new WeakMap,OA=new WeakSet,jA=function(e,t){const n=XA(this,WA,"f").getUserProfile(e),i=document.createElement("div");i.className="slot";const r=document.createElement("button");if(r.className="button main",e==XA(this,WA,"f").profileSlot&&r.classList.add("selected"),r.addEventListener("click",(()=>{XA(this,FA,"f").playUIClick(),XA(this,VA,"f").forEach((e=>{e.classList.remove("selected")})),r.classList.add("selected"),t(e)})),i.appendChild(r),XA(this,VA,"f").push(r),null!=n){const e=document.createElement("img");e.src=YT(n.carColors),r.appendChild(e);const t=document.createElement("p");t.className="name",t.textContent=n.nickname,r.appendChild(t)}XA(this,HA,"f").appendChild(i)};const YA=class{constructor(e,t,n,i,r,a){OA.add(this),zA.set(this,void 0),FA.set(this,void 0),WA.set(this,void 0),HA.set(this,void 0),VA.set(this,[]),GA.set(this,void 0),qA(this,zA,document.getElementById("ui"),"f"),qA(this,FA,t,"f"),qA(this,WA,n,"f"),qA(this,HA,document.createElement("div"),"f"),XA(this,HA,"f").className="profile-selection",XA(this,zA,"f").appendChild(XA(this,HA,"f"));const o=document.createElement("div");o.className="top-bar",XA(this,HA,"f").appendChild(o);const s=document.createElement("h2");s.textContent=e.get("Profiles"),o.appendChild(s);for(let e=0;e<3;e++)XA(this,OA,"m",jA).call(this,e,a);const l=document.createElement("div");l.className="bottom-bar",XA(this,HA,"f").appendChild(l);const c=document.createElement("button");c.className="button",c.innerHTML='<img class="button-icon" src="images/back.svg"> ',c.append(document.createTextNode(e.get("Back"))),c.addEventListener("click",(()=>{t.playUIClick(),i()})),l.appendChild(c);const h=document.createElement("button");h.className="button right",h.innerHTML='<img class="button-icon" src="images/import.svg"> ',h.append(document.createTextNode(e.get("Import"))),h.addEventListener("click",(()=>{t.playUIClick(),r()})),l.appendChild(h),window.addEventListener("keydown",qA(this,GA,(e=>{"Escape"==e.code&&(i(),e.preventDefault())}),"f"))}dispose(){XA(this,zA,"f").removeChild(XA(this,HA,"f")),window.removeEventListener("keydown",XA(this,GA,"f"))}};var KA=n(474),ZA={};ZA.styleTagTransform=u(),ZA.setAttributes=l(),ZA.insert=o().bind(null,"head"),ZA.domAPI=r(),ZA.insertStyleElement=h();t()(KA.A,ZA);KA.A&&KA.A.locals&&KA.A.locals;function JA(e){return new Blob([e]).size}var QA,$A,eC,tC,nC,iC,rC,aC,oC,sC=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},lC=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};$A=new WeakMap,eC=new WeakMap,tC=new WeakMap,nC=new WeakMap,iC=new WeakMap,rC=new WeakMap,aC=new WeakMap,QA=new WeakSet,oC=function(){let e=lC(this,nC,"f").value;return/\S/.test(e)||(e="Anonymous"),e};const cC=class{constructor(e,t,n,i,r,a,o,s,l,c){QA.add(this),$A.set(this,void 0),eC.set(this,!1),tC.set(this,void 0),nC.set(this,void 0),iC.set(this,null),rC.set(this,null),aC.set(this,void 0),sC(this,$A,document.getElementById("ui"),"f"),sC(this,tC,document.createElement("div"),"f"),lC(this,tC,"f").className="nickname",lC(this,$A,"f").appendChild(lC(this,tC,"f"));const h=document.createElement("h1");h.textContent=e.get("Nickname"),lC(this,tC,"f").appendChild(h),sC(this,nC,document.createElement("input"),"f"),lC(this,nC,"f").type="text",lC(this,nC,"f").placeholder="Anonymous",lC(this,nC,"f").spellcheck=!1,"Anonymous"!=i&&(lC(this,nC,"f").value=i),lC(this,tC,"f").appendChild(lC(this,nC,"f")),lC(this,nC,"f").focus(),lC(this,nC,"f").addEventListener("input",(()=>{let e=lC(this,nC,"f").value;for(;JA(e)>=50;)e=e.substring(0,e.length-1);lC(this,nC,"f").value=e})),lC(this,nC,"f").addEventListener("keydown",(e=>{"Enter"==e.code&&(l(lC(this,QA,"m",oC).call(this)),e.preventDefault())}));const d=document.createElement("p");d.textContent=e.get("Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time."),lC(this,tC,"f").appendChild(d);const u=document.createElement("button");u.className="button delete",u.innerHTML=' <img class="button-icon" src="images/delete.svg"> ',u.append(e.get("Delete")),u.addEventListener("click",(()=>{t.playUIClick(),o(lC(this,QA,"m",oC).call(this))})),lC(this,tC,"f").appendChild(u);const p=document.createElement("button");p.className="button",p.innerHTML='<img class="button-icon" src="images/export.svg"> ',p.append(e.get("Export")),p.addEventListener("click",(()=>{t.playUIClick(),s(lC(this,QA,"m",oC).call(this))})),lC(this,tC,"f").appendChild(p);const f=document.createElement("button");f.className="button",f.textContent=e.get("Ok"),f.addEventListener("click",(()=>{t.playUIClick(),l(lC(this,QA,"m",oC).call(this))})),lC(this,tC,"f").appendChild(f),null!=r&&n.getUser(r).then((n=>{const i=1==(null==n?void 0:n.isVerifier);!lC(this,eC,"f")&&i&&(sC(this,iC,document.createElement("button"),"f"),lC(this,iC,"f").className="button nickname-verifier-button",lC(this,iC,"f").textContent=e.get("Verifier"),lC(this,iC,"f").addEventListener("click",(()=>{t.playUIClick(),c()})),lC(this,$A,"f").appendChild(lC(this,iC,"f")))})).catch((e=>{console.error(e)})),null!=a&&(sC(this,rC,document.createElement("p"),"f"),lC(this,rC,"f").className="nickname-user-token",lC(this,rC,"f").textContent=e.get("User ID")+": "+a,lC(this,$A,"f").appendChild(lC(this,rC,"f"))),window.addEventListener("keydown",sC(this,aC,(e=>{"Escape"==e.code&&(l(lC(this,QA,"m",oC).call(this)),e.preventDefault())}),"f"))}dispose(){lC(this,$A,"f").removeChild(lC(this,tC,"f")),null!=lC(this,iC,"f")&&lC(this,$A,"f").removeChild(lC(this,iC,"f")),null!=lC(this,rC,"f")&&lC(this,$A,"f").removeChild(lC(this,rC,"f")),window.removeEventListener("keydown",lC(this,aC,"f")),sC(this,eC,!0,"f")}};var hC=n(818),dC={};dC.styleTagTransform=u(),dC.setAttributes=l(),dC.insert=o().bind(null,"head"),dC.domAPI=r(),dC.insertStyleElement=h();t()(hC.A,dC);hC.A&&hC.A.locals&&hC.A.locals;var uC,pC,fC,mC=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},gC=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};uC=new WeakMap,pC=new WeakMap,fC=new WeakMap;const vC=class{constructor(e,t,n,i,r){uC.set(this,void 0),pC.set(this,void 0),fC.set(this,void 0),mC(this,uC,document.getElementById("ui"),"f"),mC(this,pC,document.createElement("div"),"f"),gC(this,pC,"f").className="user-export",gC(this,uC,"f").appendChild(gC(this,pC,"f"));const a=document.createElement("textarea");a.value=n,a.readOnly=null==r,a.placeholder="Paste user token here...",gC(this,pC,"f").appendChild(a);const o=document.createElement("div");o.className="bar",gC(this,pC,"f").appendChild(o);const s=document.createElement("button");if(s.className="button",s.innerHTML='<img class="button-icon" src="images/back.svg"> ',s.append(document.createTextNode(t.get("Back"))),s.addEventListener("click",(()=>{e.playUIClick(),i()})),o.appendChild(s),null!=r){const n=document.createElement("button");n.className="button right",n.innerHTML='<img class="button-icon" src="images/import.svg"> ',n.append(document.createTextNode(t.get("Import"))),n.addEventListener("click",(()=>{e.playUIClick(),r(a.value)})),o.appendChild(n)}else{const n=document.createElement("button");n.className="button right",n.innerHTML='<img class="button-icon" src="images/copy.svg"> ',n.append(document.createTextNode(t.get("Copy"))),n.addEventListener("click",(()=>{e.playUIClick();try{navigator.clipboard.writeText(a.value)}catch(e){console.error(e)}})),o.appendChild(n)}window.addEventListener("keydown",mC(this,fC,(e=>{"Escape"==e.code&&(i(),e.preventDefault())}),"f"))}dispose(){gC(this,uC,"f").removeChild(gC(this,pC,"f")),window.removeEventListener("keydown",gC(this,fC,"f"))}},wC={rE:"0.4.1"};var yC,bC,xC,_C,kC,EC,SC,MC,TC,AC,CC,PC,RC,LC,IC,NC,DC,UC,BC,OC,zC,FC,WC,HC,VC=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},GC=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};bC=new WeakMap,xC=new WeakMap,_C=new WeakMap,kC=new WeakMap,EC=new WeakMap,SC=new WeakMap,MC=new WeakMap,TC=new WeakMap,AC=new WeakMap,CC=new WeakMap,PC=new WeakMap,RC=new WeakMap,LC=new WeakMap,IC=new WeakMap,NC=new WeakMap,DC=new WeakMap,UC=new WeakMap,yC=new WeakSet,BC=function e(t,n,i,r,a,o,s,l,c,h,d,u,p,f,m,g,v){GC(this,_C,"f").innerHTML="",VC(this,kC,document.createElement("img"),"f"),GC(this,kC,"f").src="images/logo.svg",GC(this,kC,"f").className="logo",GC(this,_C,"f").appendChild(GC(this,kC,"f")),VC(this,TC,new Ax(GC(this,_C,"f"),t,n,s,l,h,a,o,u,!1,(()=>{GC(this,TC,"f").hide(),GC(this,yC,"m",zC).call(this),GC(this,yC,"m",WC).call(this)}),((e,i,r,a)=>{if(e.hasStartingPoint()){GC(this,TC,"f").hide();const l=()=>{var e;GC(this,TC,"f").show(),null===(e=GC(this,AC,"f"))||void 0===e||e.dispose(),VC(this,AC,null,"f")},h=t=>{var n;null===(n=GC(this,AC,"f"))||void 0===n||n.dispose(),VC(this,AC,null,"f"),m(i,e,t)},d=f=>{var g;null===(g=GC(this,AC,"f"))||void 0===g||g.dispose(),VC(this,AC,null,"f"),f.then((t=>{m(i,e,t)})).catch((()=>{u.show(t.get("Failed to load recording"),t.get("Ok"),(()=>{VC(this,AC,new DA(GC(this,_C,"f"),t,c,o,s,n,i,r,a,l,d,p,h),"f")}))}))},p=f=>{var m;null===(m=GC(this,AC,"f"))||void 0===m||m.dispose(),VC(this,AC,null,"f"),f.then((t=>{g(e,t)})).catch((()=>{u.show(t.get("Failed to load recording"),t.get("Ok"),(()=>{VC(this,AC,new DA(GC(this,_C,"f"),t,c,o,s,n,i,r,a,l,d,p,h),"f")}))}))};VC(this,AC,new DA(GC(this,_C,"f"),t,c,o,s,n,i,r,a,l,d,p,h),"f"),GC(this,yC,"m",FC).call(this)}else GC(this,TC,"f").hide(),u.show(t.get("Track is missing starting point"),t.get("Ok"),(()=>{GC(this,TC,"f").show()}))})),"f");const w=document.createElement("button");w.className="hidden",w.innerHTML='<img src="images/customize.svg">',w.addEventListener("click",(()=>{n.playUIClick(),p()}));const y=document.createElement("p");y.textContent=t.get("Customize"),w.appendChild(y),GC(this,_C,"f").appendChild(w),GC(this,IC,"f").push(w);const b=document.createElement("button");b.className="hidden",b.innerHTML='<img src="images/editor.svg">',b.addEventListener("click",(()=>{n.playUIClick(),f()}));const x=document.createElement("p");x.textContent=t.get("Editor"),b.appendChild(x),GC(this,_C,"f").appendChild(b),GC(this,IC,"f").push(b);const _=document.createElement("button");_.className="hidden",_.innerHTML='<img src="images/settings.svg">',_.addEventListener("click",(()=>{n.playUIClick(),GC(this,yC,"m",OC).call(this),GC(this,yC,"m",FC).call(this),VC(this,CC,new BT(GC(this,_C,"f"),t,n,d,r,u,(()=>{var w;null===(w=GC(this,CC,"f"))||void 0===w||w.dispose(),VC(this,CC,null,"f"),GC(this,yC,"m",e).call(this,t,n,i,r,a,o,s,l,c,h,d,u,p,f,m,g,v)})),"f")}));const k=document.createElement("p");k.textContent=t.get("Settings"),_.appendChild(k),GC(this,_C,"f").appendChild(_),GC(this,IC,"f").push(_);const E=document.createElement("button");E.className="hidden",E.innerHTML='<img src="images/helmet.svg">',E.addEventListener("click",(()=>{n.playUIClick(),GC(this,yC,"m",OC).call(this);const e=(i,a)=>{VC(this,LC,new vC(n,t,a,(()=>{var e;null===(e=GC(this,LC,"f"))||void 0===e||e.dispose(),VC(this,LC,null,"f"),r()}),(n=>{var a;null===(a=GC(this,LC,"f"))||void 0===a||a.dispose(),VC(this,LC,null,"f"),o.hasDuplicateToken(n)?u.show(t.get("You cannot have duplicate user profiles"),t.get("Ok"),(()=>{e(i,n)})):o.isValidToken(n)?c.getUser(n).then((a=>{null!=a?o.createProfile(i,n,a.name,a.carColors)?(o.setProfileSlot(i),r()):u.show(t.get("Failed to create user profile"),t.get("Ok"),(()=>{e(i,n)})):u.show(t.get("This user profile does not exist on the server"),t.get("Ok"),(()=>{e(i,n)}))})).catch((r=>{console.error(r),u.show(t.get("Failed to download user profile from the server"),t.get("Ok"),(()=>{e(i,n)}))})):u.show(t.get("User token is invalid"),t.get("Ok"),(()=>{e(i,n)}))})),"f")},i=(e,a)=>{var s;null===(s=GC(this,PC,"f"))||void 0===s||s.dispose(),VC(this,PC,null,"f"),null!=a||(a=o.getNickname(e)),VC(this,RC,new cC(t,n,c,a,o.getToken(e),o.getTokenHash(e),(n=>{var a;null===(a=GC(this,RC,"f"))||void 0===a||a.dispose(),VC(this,RC,null,"f"),u.showConfirm(t.get('Are you sure you would like to delete "{0}"?',[n]),t.get("Cancel"),t.get("Confirm"),(()=>{i(e,n)}),(()=>{var t;o.deleteProfileSlot(e),e==o.profileSlot&&o.setProfileSlot(null!==(t=o.firstOccupiedProfileSlot())&&void 0!==t?t:0),r()}))}),(r=>{var a;null===(a=GC(this,RC,"f"))||void 0===a||a.dispose(),VC(this,RC,null,"f"),u.showConfirm(t.get("Are you sure you want to display your private key?")+"\n\n"+t.get("DO NOT SHARE THIS KEY WITH ANYONE."),t.get("Cancel"),t.get("Confirm"),(()=>{i(e,r)}),(()=>{var a;VC(this,LC,new vC(n,t,null!==(a=o.getToken(e))&&void 0!==a?a:"",(()=>{var t;null===(t=GC(this,LC,"f"))||void 0===t||t.dispose(),VC(this,LC,null,"f"),i(e,r)}),null),"f")}))}),(t=>{var n;null===(n=GC(this,RC,"f"))||void 0===n||n.dispose(),VC(this,RC,null,"f"),o.setNickname(t,e),c.submitUserProfile(o.getToken(e),t,o.getCarColors(e)),o.setProfileSlot(e),r()}),(()=>{var t;null===(t=GC(this,RC,"f"))||void 0===t||t.dispose(),VC(this,RC,null,"f"),v(o.getToken(e)),GC(this,yC,"m",zC).call(this)})),"f")},r=()=>{VC(this,PC,new YA(t,n,o,(()=>{var e;null===(e=GC(this,PC,"f"))||void 0===e||e.dispose(),VC(this,PC,null,"f"),GC(this,yC,"m",zC).call(this)}),(()=>{var n;null===(n=GC(this,PC,"f"))||void 0===n||n.dispose(),VC(this,PC,null,"f");const i=o.firstFreeProfileSlot();null==i?u.show(t.get("You need a free user profile slot to import a new user profile"),t.get("Ok"),(()=>{r()})):e(i,"")}),(e=>i(e,null))),"f")};r()}));const S=document.createElement("p");S.textContent=t.get("Profile"),E.appendChild(S),GC(this,_C,"f").appendChild(E),GC(this,IC,"f").push(E);const M=document.createElement("button");M.className="hidden",M.innerHTML='<img src="images/play.svg">',M.addEventListener("click",(()=>{n.playUIClick(),GC(this,yC,"m",OC).call(this),GC(this,yC,"m",FC).call(this),GC(this,TC,"f").show()}));const T=document.createElement("p");T.textContent=t.get("Play"),M.appendChild(T),GC(this,_C,"f").appendChild(M),GC(this,IC,"f").push(M);const A=document.createElement("div");if(A.className="bottom-buttons",GC(this,_C,"f").appendChild(A),window.electron){const e=document.createElement("button");e.className="button small",e.innerHTML='<img src="images/quit.svg"> Quit',e.addEventListener("click",(()=>{var e;n.playUIClick(),null===(e=window.electron)||void 0===e||e.quit()})),A.appendChild(e),GC(this,NC,"f").push(e)}VC(this,EC,document.createElement("a"),"f"),GC(this,EC,"f").className="discord-link",GC(this,EC,"f").href="https://www.kodub.com/discord/polytrack",GC(this,EC,"f").target="_blank",GC(this,EC,"f").innerHTML='<img src="images/discord.svg">',GC(this,_C,"f").appendChild(GC(this,EC,"f")),VC(this,SC,document.createElement("div"),"f"),GC(this,SC,"f").className="info",GC(this,_C,"f").appendChild(GC(this,SC,"f"));const C=document.createElement("a");C.href="https://www.kodub.com",C.target="_blank",C.textContent="kodub.com - "+t.get("Version")+" "+wC.rE,GC(this,SC,"f").appendChild(C);const P=document.createElement("a");P.href="https://opengameart.org/content/sci-fi-theme-1",P.target="_blank",P.textContent='"Sci-fi Theme" by Maou (CC-BY 4.0)',GC(this,SC,"f").appendChild(P);const G=document.createElement("a");G.href="https://selenite.cc",P.target="_blank",G.textContent='Ripped by Selenite. No multiplayer features.',GC(this,SC,"f").appendChild(G),i.hasLoaded()?GC(this,yC,"m",zC).call(this):(VC(this,MC,new uT(GC(this,_C,"f"),t,i),"f"),i.addCompleteListener((()=>{var e;null===(e=GC(this,MC,"f"))||void 0===e||e.dispose(),VC(this,MC,null,"f");null==o.getToken()?(E.disabled=!0,GC(this,yC,"m",FC).call(this),u.show(t.get("Failed to create user token.")+" "+t.get("Leaderboard is disabled.")+"\n\n"+t.get("Please try another browser or device."),t.get("Ok"),(()=>{GC(this,yC,"m",WC).call(this),GC(this,yC,"m",zC).call(this)}))):c.submitAllowed?(E.disabled=!1,GC(this,yC,"m",zC).call(this)):(E.disabled=!0,GC(this,yC,"m",FC).call(this),u.show(t.get("Computer determinism check failed.")+" "+t.get("Leaderboard is disabled.")+"\n\n"+t.get("Please try another browser or device."),t.get("Ok"),(()=>{GC(this,yC,"m",WC).call(this),GC(this,yC,"m",zC).call(this)})))})))},OC=function(){GC(this,IC,"f").forEach((e=>{e.className="hidden"})),GC(this,NC,"f").forEach((e=>{e.classList.add("hidden")})),GC(this,EC,"f").className="hidden",GC(this,SC,"f").className="hidden"},zC=function(){GC(this,IC,"f").forEach((e=>{e.className="button-image button"})),GC(this,NC,"f").forEach((e=>{e.classList.remove("hidden")})),GC(this,EC,"f").className="discord-link",GC(this,SC,"f").className="info"},FC=function(){GC(this,kC,"f").className="hidden"},WC=function(){GC(this,kC,"f").className="logo"},HC=function(){const e=GC(this,bC,"f").getBounds(),t=new ln((e.min.x+(e.max.x-e.min.x)/2)*Ky.partWidth,(e.min.y+(e.max.y-e.min.y)/2)*Ky.partLength);GC(this,DC,"f").position.set(t.x+250*Math.cos(GC(this,UC,"f")),100,t.y-250*Math.sin(GC(this,UC,"f"))),GC(this,DC,"f").rotation.y=GC(this,UC,"f")+Math.PI/2};const jC=class{constructor(e,t,n,i,r,a,o,s,l,c,h,d,u,p,f,m,g,v){yC.add(this),bC.set(this,void 0),xC.set(this,void 0),_C.set(this,void 0),kC.set(this,void 0),EC.set(this,void 0),SC.set(this,void 0),MC.set(this,null),TC.set(this,void 0),AC.set(this,null),CC.set(this,null),PC.set(this,null),RC.set(this,null),LC.set(this,null),IC.set(this,[]),NC.set(this,[]),DC.set(this,void 0),UC.set(this,Math.random()*Math.PI*2),VC(this,bC,r,"f"),VC(this,xC,document.getElementById("ui"),"f"),VC(this,_C,document.createElement("div"),"f"),GC(this,_C,"f").className="menu",GC(this,yC,"m",BC).call(this,e,t,i,r,a,o,s,l,c,h,d,u,p,f,m,g,v),GC(this,xC,"f").appendChild(GC(this,_C,"f")),VC(this,DC,new Kr(70,1,.1,1e4),"f"),n.scene.add(GC(this,DC,"f")),GC(this,yC,"m",HC).call(this)}dispose(){var e;GC(this,xC,"f").removeChild(GC(this,_C,"f")),null===(e=GC(this,AC,"f"))||void 0===e||e.dispose(),VC(this,AC,null,"f")}get camera(){return GC(this,DC,"f")}update(e){VC(this,UC,GC(this,UC,"f")+.05*e,"f"),GC(this,yC,"m",HC).call(this)}};var qC,XC,YC,KC,ZC,JC,QC,$C,eP,tP,nP,iP,rP,aP=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},oP=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};XC=new WeakMap,YC=new WeakMap,KC=new WeakMap,ZC=new WeakMap,JC=new WeakMap,QC=new WeakMap,$C=new WeakMap,eP=new WeakMap,tP=new WeakMap,nP=new WeakMap,iP=new WeakMap,qC=new WeakSet,rP=function(){oP(this,YC,"f").loadTrackData(oP(this,ZC,"f").getRandomTrackData(!1)),oP(this,YC,"f").generateMeshes(),oP(this,KC,"f").generateMountains(oP(this,YC,"f").getBounds());let e=null;const t=oP(this,YC,"f").getID();if(null!=t){const n=oP(this,JC,"f").getRecord(oP(this,tP,"f").profileSlot,t);null!=n&&(e=n.recording)}null!=e&&(aP(this,iP,new Uv(oP(this,XC,"f"),oP(this,YC,"f").getStartTransform(),e,null,!1,oP(this,$C,"f"),oP(this,eP,"f"),oP(this,KC,"f"),oP(this,YC,"f"),oP(this,QC,"f")),"f"),oP(this,iP,"f").audioVolume=0,oP(this,iP,"f").start())};const sP=class{constructor(e,t,n,i,r,a,o,s,l,c,h,d,u,p,f,m,g,v,w,y){qC.add(this),XC.set(this,void 0),YC.set(this,void 0),KC.set(this,void 0),ZC.set(this,void 0),JC.set(this,void 0),QC.set(this,void 0),$C.set(this,void 0),eP.set(this,void 0),tP.set(this,void 0),nP.set(this,void 0),iP.set(this,null),aP(this,XC,e,"f"),aP(this,YC,t,"f"),aP(this,KC,i,"f"),aP(this,ZC,r,"f"),aP(this,JC,l,"f"),aP(this,QC,u,"f"),aP(this,$C,c,"f"),aP(this,eP,h,"f"),aP(this,tP,s,"f"),aP(this,nP,new jC(a,h,c,f,t,n,s,l,d,p,r,u,o,m,g,v,w,y),"f"),c.setCamera(oP(this,nP,"f").camera),f.hasLoaded()?oP(this,qC,"m",rP).call(this):f.addCompleteListener((()=>{oP(this,qC,"m",rP).call(this)}))}dispose(){var e;null===(e=oP(this,iP,"f"))||void 0===e||e.dispose(),oP(this,nP,"f").dispose(),oP(this,YC,"f").clear(),oP(this,KC,"f").clearMountains()}update(e){var t,n;null===(t=oP(this,iP,"f"))||void 0===t||t.update(e),oP(this,nP,"f").update(e),oP(this,$C,"f").update(null===(n=oP(this,iP,"f"))||void 0===n?void 0:n.getPosition()),oP(this,eP,"f").update(e,!0,oP(this,$C,"f"),oP(this,QC,"f"))}};var lP=n(437),cP={};cP.styleTagTransform=u(),cP.setAttributes=l(),cP.insert=o().bind(null,"head"),cP.domAPI=r(),cP.insertStyleElement=h();t()(lP.A,cP);lP.A&&lP.A.locals&&lP.A.locals;var hP,dP,uP,pP,fP,mP,gP,vP,wP,yP=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},bP=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};hP=new WeakMap,dP=new WeakMap,uP=new WeakMap,pP=new WeakMap,fP=new WeakMap,mP=new WeakMap,gP=new WeakMap,vP=new WeakMap,wP=new WeakMap;const xP=class{constructor(e){hP.set(this,!1),dP.set(this,void 0),uP.set(this,void 0),pP.set(this,void 0),fP.set(this,void 0),mP.set(this,void 0),gP.set(this,void 0),vP.set(this,null),wP.set(this,null);const t=document.getElementById("ui");yP(this,dP,document.createElement("div"),"f"),bP(this,dP,"f").className="hidden",t.appendChild(bP(this,dP,"f")),yP(this,uP,document.createElement("div"),"f"),bP(this,uP,"f").className="background",bP(this,dP,"f").appendChild(bP(this,uP,"f")),yP(this,pP,document.createElement("div"),"f"),bP(this,pP,"f").className="box",bP(this,dP,"f").appendChild(bP(this,pP,"f")),yP(this,fP,document.createElement("p"),"f"),bP(this,pP,"f").appendChild(bP(this,fP,"f")),yP(this,mP,document.createElement("button"),"f"),bP(this,mP,"f").className="button",bP(this,mP,"f").addEventListener("click",(()=>{e.playUIClick(),yP(this,hP,!1,"f"),null!=bP(this,vP,"f")&&bP(this,vP,"f").call(this),bP(this,hP,"f")||this.hide()})),bP(this,pP,"f").appendChild(bP(this,mP,"f")),yP(this,gP,document.createElement("button"),"f"),bP(this,gP,"f").className="button",bP(this,gP,"f").addEventListener("click",(()=>{e.playUIClick(),yP(this,hP,!1,"f"),null!=bP(this,wP,"f")&&bP(this,wP,"f").call(this),bP(this,hP,"f")||this.hide()})),bP(this,pP,"f").appendChild(bP(this,gP,"f")),window.addEventListener("keydown",(e=>{this.isOpen&&"Escape"==e.code&&(null!=bP(this,vP,"f")&&bP(this,vP,"f").call(this),this.hide(),e.stopImmediatePropagation(),e.preventDefault())}))}get isOpen(){return bP(this,hP,"f")}show(e,t,n){yP(this,hP,!0,"f"),bP(this,dP,"f").className="message-box message",bP(this,fP,"f").textContent=e,bP(this,mP,"f").textContent="",bP(this,gP,"f").textContent=t,yP(this,vP,n,"f"),yP(this,wP,n,"f")}showConfirm(e,t,n,i,r){yP(this,hP,!0,"f"),bP(this,dP,"f").className="message-box confirm",bP(this,fP,"f").textContent=e,bP(this,mP,"f").textContent=t,bP(this,gP,"f").textContent=n,yP(this,vP,i,"f"),yP(this,wP,r,"f")}hide(){yP(this,hP,!1,"f"),bP(this,dP,"f").className="hidden",bP(this,fP,"f").textContent="",bP(this,mP,"f").textContent="",bP(this,gP,"f").textContent="",yP(this,vP,null,"f"),yP(this,wP,null,"f")}};var _P,kP,EP,SP,MP=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},TP=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};_P=new WeakMap,kP=new WeakMap,EP=new WeakMap,SP=new WeakMap;const AP=class{constructor(){_P.set(this,0),kP.set(this,0),EP.set(this,[]),SP.set(this,[])}hasLoaded(){return MP(this,kP,"f")==MP(this,_P,"f")}getProgress(){return MP(this,kP,"f")/MP(this,_P,"f")}addResource(){var e;TP(this,_P,(e=MP(this,_P,"f"),++e),"f")}loadedResource(){var e;TP(this,kP,(e=MP(this,kP,"f"),++e),"f");for(let e=0;e<MP(this,EP,"f").length;++e)MP(this,EP,"f")[e](this.getProgress());if(this.hasLoaded())for(let e=0;e<MP(this,SP,"f").length;++e)MP(this,SP,"f")[e]()}addProgressListener(e){MP(this,EP,"f").push(e)}addCompleteListener(e){MP(this,SP,"f").push(e)}preloadImage(e){this.addResource();const t=new Image;t.addEventListener("load",(()=>{this.loadedResource()})),t.src=e}};var CP,PP,RP,LP,IP,NP,DP,UP=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},BP=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};PP=new WeakMap,RP=new WeakMap,LP=new WeakMap,IP=new WeakMap,CP=new WeakSet,NP=function(e,t,n,i,r){var a;const o=BP(this,LP,"f").getToken(e),s=e+"_"+t,l=(null!==(a=BP(this,IP,"f").get(s))&&void 0!==a?a:0)+1;return BP(this,IP,"f").set(s,l),BP(this,RP,"f").submitLeaderboard(t,n,i,r).then((({uploadId:r})=>{null!=o&&BP(this,IP,"f").get(s)==l&&BP(this,LP,"f").getToken(e)==o&&BP(this,PP,"f").saveRecord(e,t,r,n,i)}))},DP=function(e,t,n){var i;const r=BP(this,LP,"f").getToken(e),a=e+"_"+t,o=(null!==(i=BP(this,IP,"f").get(a))&&void 0!==i?i:0)+1;return BP(this,IP,"f").set(a,o),BP(this,RP,"f").getRecording(n).then((({recording:i,time:s})=>{if(null!=r&&BP(this,IP,"f").get(a)==o&&BP(this,LP,"f").getToken(e)==r){const r=this.getRecordTime(e,t);(null==r||s.lessThan(r))&&BP(this,PP,"f").saveRecord(e,t,n,s,i)}}))};const OP=class{constructor(e,t,n){CP.add(this),PP.set(this,void 0),RP.set(this,void 0),LP.set(this,void 0),IP.set(this,new Map),UP(this,PP,e,"f"),UP(this,RP,t,"f"),UP(this,LP,n,"f")}setRecord(e,t,n,i,r){BP(this,PP,"f").saveRecord(e,t,null,n,i),BP(this,CP,"m",NP).call(this,e,t,n,i,r)}syncRecord(e,t,n,i){return new Promise(((r,a)=>{const o=this.getRecord(e,t);null!=o&&(null==n||o.uploadId!=n.recordingId&&o.time.lessThan(n.time))?BP(this,CP,"m",NP).call(this,e,t,o.time,o.recording,i).then((()=>r("Upload"))).catch(a):null!=n&&(null==o||o.uploadId!=n.recordingId&&n.time.lessThan(o.time))?BP(this,CP,"m",DP).call(this,e,t,n.recordingId).then((()=>r("Download"))).catch(a):r(null)}))}getRecordTime(e,t){const n=this.getRecord(e,t);return null==n?null:n.time}getRecord(e,t){return BP(this,PP,"f").loadRecord(e,t)}};var zP,FP,WP,HP,VP,GP,jP,qP=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},XP=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};FP=new WeakMap,WP=new WeakMap,HP=new WeakMap,VP=new WeakMap,zP=new WeakSet,GP=function(e,t){return t.addResource(),new Promise((n=>{const i=new XMLHttpRequest;i.overrideMimeType("text/plain"),i.onreadystatechange=()=>{if(4==i.readyState&&200==i.status){t.loadedResource();const e=Py.fromExportString(i.responseText,XP(this,VP,"f"));if(null==e)throw"Failed to load standard track";const{trackName:r,trackData:a}=e;n({id:a.getId(XP(this,VP,"f")),name:r,trackData:a,thumbnail:a.createThumbnail(XP(this,VP,"f")),saveTime:null})}},i.open("GET",e,!0),i.send()}))},jP=function(e){var t;const n=XP(this,HP,"f").loadTrack(e,XP(this,VP,"f"));if(null!=n){const{trackData:i,saveTime:r}=n,a={id:i.getId(XP(this,VP,"f")),name:e,trackData:i,thumbnail:i.createThumbnail(XP(this,VP,"f")),saveTime:r};for(let e=0;e<=XP(this,WP,"f").length;e++)if(e==XP(this,WP,"f").length||(null!==(t=XP(this,WP,"f")[e].saveTime)&&void 0!==t?t:-1/0)<r){XP(this,WP,"f").splice(e,0,a);break}}};const YP=class{constructor(e,t,n){zP.add(this),FP.set(this,[]),WP.set(this,[]),HP.set(this,void 0),VP.set(this,void 0),qP(this,HP,n,"f"),qP(this,VP,t,"f"),Promise.all([XP(this,zP,"m",GP).call(this,"tracks/track1.track",e),XP(this,zP,"m",GP).call(this,"tracks/track2.track",e),XP(this,zP,"m",GP).call(this,"tracks/track3.track",e),XP(this,zP,"m",GP).call(this,"tracks/track4.track",e),XP(this,zP,"m",GP).call(this,"tracks/track5.track",e),XP(this,zP,"m",GP).call(this,"tracks/track6.track",e),XP(this,zP,"m",GP).call(this,"tracks/track7.track",e),XP(this,zP,"m",GP).call(this,"tracks/track8.track",e),XP(this,zP,"m",GP).call(this,"tracks/track9.track",e),XP(this,zP,"m",GP).call(this,"tracks/track10.track",e),XP(this,zP,"m",GP).call(this,"tracks/track11.track",e),XP(this,zP,"m",GP).call(this,"tracks/track12.track",e),XP(this,zP,"m",GP).call(this,"tracks/track13.track",e)]).then((e=>{qP(this,FP,e,"f")}))}refreshCustomTracks(){const e=XP(this,HP,"f").getAllTrackNames();null!=e&&(XP(this,WP,"f").length=0,e.forEach((e=>{XP(this,zP,"m",jP).call(this,e)})))}isCustomTracksEmpty(){return 0==XP(this,WP,"f").length}forEach(e){this.forEachStandard(e),this.forEachCustom(e)}forEachStandard(e){XP(this,FP,"f").forEach((t=>{e(t.id,t.name,t.trackData,t.thumbnail)}))}forEachCustom(e){XP(this,WP,"f").forEach((t=>{e(t.id,t.name,t.trackData,t.thumbnail)}))}getRandomTrackData(e){let t;return t=e?XP(this,FP,"f").concat(XP(this,WP,"f")):XP(this,FP,"f"),t[Math.floor(Math.random()*t.length)].trackData}};var KP;!function(e){e[e.Special=0]="Special",e[e.Road=1]="Road",e[e.RoadTurns=2]="RoadTurns",e[e.RoadWide=3]="RoadWide",e[e.Plane=4]="Plane",e[e.Block=5]="Block",e[e.WallTrack=6]="WallTrack",e[e.Pillar=7]="Pillar",e[e.Sign=8]="Sign"}(KP||(KP={}));const ZP=KP;var JP,QP,$P,eR,tR=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))},nR=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},iR=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class rR{constructor(e){JP.add(this),QP.set(this,void 0),$P.set(this,new Map),nR(this,QP,e,"f"),iR(this,JP,"m",eR).call(this)}getPhysicsParts(){const e=[];return iR(this,$P,"f").forEach((({id:t,physicsShapeVertices:n,detector:i})=>{e.push({type:t,vertices:n,detector:i})})),e}hasPart(e){return iR(this,$P,"f").has(e)}getPart(e){const t=iR(this,$P,"f").get(e);if(null==t)throw'Track part with the id "'+e+'" does not exist';return t}getAllParts(){return Array.from(iR(this,$P,"f").values())}getPartTypesWithDetector(e){const t=[];return iR(this,$P,"f").forEach(((n,i)=>{null!=n.detector&&n.detector.type==e&&t.push(i)})),t}}QP=new WeakMap,$P=new WeakMap,JP=new WeakSet,eR=function(){return tR(this,void 0,void 0,(function*(){const e=(t=["models/block.glb","models/pillar.glb","models/plane.glb","models/road.glb","models/road_wide.glb","models/signs.glb","models/wall_track.glb"],Promise.all(t.map((e=>{return t=e,new Promise((e=>{(new fd).load(t,(t=>{e(t)}))}));var t}))));var t;const n=new jc({vertexColors:!0}),i=(t,i,r,...a)=>tR(this,[t,i,r,...a],void 0,(function*(t,i,r,a=null,o=null,s=null){if(iR(this,QP,"f").addResource(),iR(this,$P,"f").has(i))throw"Track part types have same Id";const l={id:i,mesh:null,physicsShapeVertices:[],tiles:new Ix(null!=a?a:[[0,0,0]]),detector:null!=o?o:null,category:t};iR(this,$P,"f").set(i,l);const c=yield e;function h(e){const t=e.material;if(!(t instanceof Vc))throw"Material is not a MeshStandardMaterial";const n=e.geometry.clone(),i=new Float32Array(n.attributes.position.array.length);for(let e=0;e<i.length;e+=3)i[e+0]=t.color.r,i[e+1]=t.color.g,i[e+2]=t.color.b;return n.attributes.color=new lr(i,3),n}const d=[];let u=[];r.forEach((([e,t])=>{const i=function(e,t){const i=c.find((t=>t.scene.name==e));if(null==i)throw'Scene "'+e+'" does not exist';const r=i.scene.getObjectByName(t);if(null==r)throw'Mesh "'+t+'" does not exist in scene "'+e+'"';let a;if(0==r.children.length){const e=r;a=h(e),e.updateMatrixWorld(!0),a.applyMatrix4(e.matrix)}else{const e=r.children.map((e=>h(e)));a=dd(e,!0),r.updateMatrixWorld(!0),a.applyMatrix4(r.matrix)}const o=new Br(a,n);return o.name=t,o}(e,t);d.push(i);const r=i.geometry.toNonIndexed();if(!(r.attributes.position instanceof lr))throw"Vertices must use BufferAttribute";u=u.concat(Array.from(r.attributes.position.array))}));const p=dd(d.map((e=>e.geometry)),!0),f=new Br(p,n);l.mesh=f,l.physicsShapeVertices=u,null!=s&&s(l),iR(this,QP,"f").loadedResource()}));function r(e,t,n,i){if(null==e.mesh)throw"Mesh not loaded";const r=e.mesh.geometry.attributes.color.array;for(let e=0;e<3*r.length;e+=3){const a=new tr(r[e+0],r[e+1],r[e+2]);a.offsetHSL(t,n,i),r[e+0]=a.r,r[e+1]=a.g,r[e+2]=a.b}}function a(e){return r(e,0,.5,0)}function o(e){return r(e,.65,.4,0)}function s(e){return r(e,0,0,-.135)}i(ZP.Special,Bw.Start,[["Road","Start"]]),i(ZP.Special,Bw.Checkpoint,[["Road","Checkpoint"]],[[0,0,0]],{type:yy.Checkpoint,center:[0,2.2,0],size:[11,3.8,2]}),i(ZP.Special,Bw.CheckpointWide,[["RoadWide","CheckpointWide"]],[[0,0,0],[1,0,0]],{type:yy.Checkpoint,center:[10,2.2,0],size:[31.1,3.8,2]}),i(ZP.Special,Bw.PlaneCheckpoint,[["Planes","PlaneCheckpoint"]],[[0,0,0]],{type:yy.Checkpoint,center:[0,2.2,0],size:[18.75,3.8,2]}),i(ZP.Special,Bw.PlaneCheckpointWide,[["Planes","PlaneCheckpointWide"]],[[0,0,0],[1,0,0]],{type:yy.Checkpoint,center:[10,2.2,0],size:[38.75,3.8,2]}),i(ZP.Special,Bw.Finish,[["Road","Finish"]],[[0,0,0]],{type:yy.Finish,center:[0,2.2,0],size:[11,3.8,2]}),i(ZP.Special,Bw.FinishWide,[["RoadWide","FinishWide"]],[[0,0,0],[1,0,0]],{type:yy.Finish,center:[10,2.2,0],size:[31.1,3.8,2]}),i(ZP.Special,Bw.PlaneFinish,[["Planes","PlaneFinish"]],[[0,0,0]],{type:yy.Finish,center:[0,2.2,0],size:[18.75,3.8,2]}),i(ZP.Special,Bw.PlaneFinishWide,[["Planes","PlaneFinishWide"]],[[0,0,0],[1,0,0]],{type:yy.Finish,center:[10,2.2,0],size:[38.75,3.8,2]}),i(ZP.Road,Bw.Straight,[["Road","Straight"]]),i(ZP.Road,Bw.StraightPillarBottom,[["Road","Straight"],["Pillar","SurfacePillarBottom"]]),i(ZP.Road,Bw.StraightPillarShort,[["Road","Straight"],["Pillar","SurfacePillarShort"]]),i(ZP.Road,Bw.TurnSharp,[["Road","TurnSharp"]]),i(ZP.Road,Bw.TurnSharpPillarBottom,[["Road","TurnSharp"],["Pillar","SurfacePillarBottom"]]),i(ZP.Road,Bw.TurnSharpPillarShort,[["Road","TurnSharp"],["Pillar","SurfacePillarShort"]]),i(ZP.RoadTurns,Bw.TurnShort,[["Road","TurnShort"]],[[0,0,0],[1,0,0],[0,0,-1],[1,0,-1]]),i(ZP.RoadTurns,Bw.TurnLong,[["Road","TurnLong"]],[[0,0,0],[1,0,0],[0,0,-1],[1,0,-1],[2,0,-1],[1,0,-2],[2,0,-2]]),i(ZP.RoadTurns,Bw.TurnLong2,[["Road","TurnLong2"]],[[0,0,0],[0,0,-1],[1,0,-1],[0,0,-2],[1,0,-2],[2,0,-2],[1,0,-3],[2,0,-3],[3,0,-3]]),i(ZP.RoadTurns,Bw.TurnLong3,[["Road","TurnLong3"]],[[0,0,0],[0,0,-1],[1,0,-1],[0,0,-2],[1,0,-2],[2,0,-2],[1,0,-3],[2,0,-3],[3,0,-3],[2,0,-4],[3,0,-4],[4,0,-4]]),i(ZP.RoadTurns,Bw.TurnSLeft,[["Road","TurnSLeft"]],[[0,0,0],[0,0,-1],[0,0,-2],[-1,0,0],[-1,0,-1],[-1,0,-2]]),i(ZP.RoadTurns,Bw.TurnSRight,[["Road","TurnSRight"]],[[0,0,0],[0,0,-1],[0,0,-2],[1,0,0],[1,0,-1],[1,0,-2]]),i(ZP.Road,Bw.SlopeUp,[["Road","SlopeUp"]],[[0,0,0],[0,1,0]]),i(ZP.Road,Bw.SlopeUpBlock,[["Road","SlopeUp"],["Blocks","BlockSlopeUp"]],[[0,0,0],[0,1,0]]),i(ZP.Road,Bw.SlopeUpLong,[["Road","SlopeUpLong"]],[[0,0,0],[0,0,-1],[0,1,-1],[0,2,-1]]),i(ZP.Road,Bw.SlopeDown,[["Road","SlopeDown"]],[[0,0,0],[0,1,0]]),i(ZP.Road,Bw.SlopeDownBlock,[["Road","SlopeDown"],["Blocks","BlockSlopeDown"]],[[0,0,0],[0,1,0]]),i(ZP.Road,Bw.SlopeDownLong,[["Road","SlopeDownLong"]],[[0,0,0],[0,1,0],[0,1,1],[0,2,1]]),i(ZP.Road,Bw.Slope,[["Road","Slope"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.Road,Bw.SlopePillar,[["Road","Slope"],["Pillar","PillarTopSlope"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.Road,Bw.SlopePillarShort,[["Road","Slope"],["Pillar","PillarShortSlope"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.Road,Bw.SlopeBlock,[["Road","Slope"],["Blocks","BlockSlopedUp"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.Road,Bw.IntersectionT,[["Road","IntersectionT"]]),i(ZP.Road,Bw.IntersectionTPillarBottom,[["Road","IntersectionT"],["Pillar","SurfacePillarBottom"]]),i(ZP.Road,Bw.IntersectionTPillarShort,[["Road","IntersectionT"],["Pillar","SurfacePillarShort"]]),i(ZP.Road,Bw.IntersectionCross,[["Road","IntersectionCross"]]),i(ZP.Road,Bw.IntersectionCrossPillarBottom,[["Road","IntersectionCross"],["Pillar","SurfacePillarBottom"]]),i(ZP.Road,Bw.IntersectionCrossPillarShort,[["Road","IntersectionCross"],["Pillar","SurfacePillarShort"]]),i(ZP.RoadWide,Bw.ToWideMiddle,[["RoadWide","ToWideMiddle"]]),i(ZP.RoadWide,Bw.ToWideLeft,[["RoadWide","ToWideLeft"]]),i(ZP.RoadWide,Bw.ToWideRight,[["RoadWide","ToWideRight"]]),i(ZP.RoadWide,Bw.ToWideDouble,[["RoadWide","ToWideDouble"]]),i(ZP.RoadWide,Bw.ToWideDiagonal,[["RoadWide","ToWideDiagonal"]]),i(ZP.RoadWide,Bw.StraightWide,[["RoadWide","StraightWide"]]),i(ZP.RoadWide,Bw.InnerCornerWide,[["RoadWide","InnerCornerWide"]]),i(ZP.RoadWide,Bw.OuterCornerWide,[["RoadWide","OuterCornerWide"]]),i(ZP.RoadWide,Bw.SlopeUpLeftWide,[["RoadWide","SlopeUpLeftWide"]],[[0,0,0],[0,1,0]]),i(ZP.RoadWide,Bw.SlopeUpLeftWideBlock,[["RoadWide","SlopeUpLeftWide"],["Blocks","BlockSlopeUp"]],[[0,0,0],[0,1,0]]),i(ZP.RoadWide,Bw.SlopeUpRightWide,[["RoadWide","SlopeUpRightWide"]],[[0,0,0],[0,1,0]]),i(ZP.RoadWide,Bw.SlopeUpRightWideBlock,[["RoadWide","SlopeUpRightWide"],["Blocks","BlockSlopeUp"]],[[0,0,0],[0,1,0]]),i(ZP.RoadWide,Bw.SlopeDownLeftWide,[["RoadWide","SlopeDownLeftWide"]],[[0,0,0],[0,1,0]]),i(ZP.RoadWide,Bw.SlopeDownLeftWideBlock,[["RoadWide","SlopeDownLeftWide"],["Blocks","BlockSlopeDown"]],[[0,0,0],[0,1,0]]),i(ZP.RoadWide,Bw.SlopeDownRightWide,[["RoadWide","SlopeDownRightWide"]],[[0,0,0],[0,1,0]]),i(ZP.RoadWide,Bw.SlopeDownRightWideBlock,[["RoadWide","SlopeDownRightWide"],["Blocks","BlockSlopeDown"]],[[0,0,0],[0,1,0]]),i(ZP.RoadWide,Bw.SlopeLeftWide,[["RoadWide","SlopeLeftWide"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.RoadWide,Bw.SlopeLeftWideBlock,[["RoadWide","SlopeLeftWide"],["Blocks","BlockSlopedUp"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.RoadWide,Bw.SlopeRightWide,[["RoadWide","SlopeRightWide"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.RoadWide,Bw.SlopeRightWideBlock,[["RoadWide","SlopeRightWide"],["Blocks","BlockSlopedUp"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.Plane,Bw.Plane,[["Planes","Plane"]]),i(ZP.Plane,Bw.PlanePillarBottom,[["Planes","Plane"],["Pillar","SurfacePillarBottom"]]),i(ZP.Plane,Bw.PlanePillarShort,[["Planes","Plane"],["Pillar","SurfacePillarShort"]]),i(ZP.Plane,Bw.HalfPlane,[["Planes","HalfPlane"]]),i(ZP.Plane,Bw.QuarterPlane,[["Planes","QuarterPlane"]]),i(ZP.Plane,Bw.PlaneSlopeUp,[["Planes","PlaneSlopeUp"]],[[0,0,0],[0,1,0]]),i(ZP.Plane,Bw.PlaneSlopeDown,[["Planes","PlaneSlopeDown"]],[[0,0,0],[0,1,0]]),i(ZP.Plane,Bw.PlaneSlope,[["Planes","PlaneSlope"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.Plane,Bw.PlaneBridge,[["Planes","PlaneBridge"]]),i(ZP.Plane,Bw.PlaneBridgeCorner,[["Planes","PlaneBridgeCorner"]]),i(ZP.Plane,Bw.PlaneBridgeIntersectionT,[["Planes","PlaneBridgeIntersectionT"]]),i(ZP.Plane,Bw.PlaneBridgeIntersectionCross,[["Planes","PlaneBridgeIntersectionCross"]]),i(ZP.Plane,Bw.PlaneWall,[["Planes","PlaneWall"]]),i(ZP.Plane,Bw.PlaneWallCorner,[["Planes","PlaneWallCorner"]]),i(ZP.Plane,Bw.PlaneWallInnerCorner,[["Planes","PlaneWallInnerCorner"]]),i(ZP.Plane,Bw.PlaneSlopeUpBlock,[["Planes","PlaneSlopeUp"],["Blocks","BlockSlopeUp"]],[[0,0,0],[0,1,0]]),i(ZP.Plane,Bw.PlaneSlopeDownBlock,[["Planes","PlaneSlopeDown"],["Blocks","BlockSlopeDown"]],[[0,0,0],[0,1,0]]),i(ZP.Plane,Bw.PlaneSlopeBlock,[["Planes","PlaneSlope"],["Blocks","BlockSlopedUp"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.Plane,Bw.PlaneSlopePillar,[["Planes","PlaneSlope"],["Pillar","PillarTopSlope"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.Plane,Bw.PlaneSlopePillarShort,[["Planes","PlaneSlope"],["Pillar","PillarShortSlope"]],[[0,0,0],[0,1,0],[0,2,0]]),i(ZP.Block,Bw.Block,[["Blocks","Block"]]),i(ZP.Block,Bw.HalfBlock,[["Blocks","HalfBlock"]]),i(ZP.Block,Bw.QuarterBlock,[["Blocks","QuarterBlock"]]),i(ZP.Block,Bw.BlockSlopedDown,[["Blocks","BlockSlopedDown"]],[[0,0,0],[0,1,0]]),i(ZP.Block,Bw.BlockSlopedDownInnerCorner,[["Blocks","BlockSlopedDownInnerCorner"]],[[0,0,0],[0,1,0]]),i(ZP.Block,Bw.BlockSlopedDownOuterCorner,[["Blocks","BlockSlopedDownOuterCorner"]],[[0,0,0],[0,1,0]]),i(ZP.Block,Bw.BlockSlopedUp,[["Blocks","BlockSlopedUp"]],[[0,0,0],[0,1,0]]),i(ZP.Block,Bw.BlockSlopedUpInnerCorner,[["Blocks","BlockSlopedUpInnerCorner"]],[[0,0,0],[0,1,0]]),i(ZP.Block,Bw.BlockSlopedUpOuterCorner,[["Blocks","BlockSlopedUpOuterCorner"]],[[0,0,0],[0,1,0]]),i(ZP.Block,Bw.BlockSlopeDown,[["Blocks","BlockSlopeDown"]]),i(ZP.Block,Bw.BlockSlopeUp,[["Blocks","BlockSlopeUp"]]),i(ZP.Block,Bw.BlockBridge,[["Blocks","BlockBridge"]]),i(ZP.Block,Bw.BlockBridgeCorner,[["Blocks","BlockBridgeCorner"]]),i(ZP.Block,Bw.BlockBridgeIntersectionT,[["Blocks","BlockBridgeIntersectionT"]]),i(ZP.Block,Bw.BlockBridgeIntersectionCross,[["Blocks","BlockBridgeIntersectionCross"]]),i(ZP.Block,Bw.RedBlock,[["Blocks","Block"]],null,null,a),i(ZP.Block,Bw.RedHalfBlock,[["Blocks","HalfBlock"]],null,null,a),i(ZP.Block,Bw.RedQuarterBlock,[["Blocks","QuarterBlock"]],null,null,a),i(ZP.Block,Bw.RedBlockSlopedDown,[["Blocks","BlockSlopedDown"]],[[0,0,0],[0,1,0]],null,a),i(ZP.Block,Bw.RedBlockSlopedDownInnerCorner,[["Blocks","BlockSlopedDownInnerCorner"]],[[0,0,0],[0,1,0]],null,a),i(ZP.Block,Bw.RedBlockSlopedDownOuterCorner,[["Blocks","BlockSlopedDownOuterCorner"]],[[0,0,0],[0,1,0]],null,a),i(ZP.Block,Bw.RedBlockSlopedUp,[["Blocks","BlockSlopedUp"]],[[0,0,0],[0,1,0]],null,a),i(ZP.Block,Bw.RedBlockSlopedUpInnerCorner,[["Blocks","BlockSlopedUpInnerCorner"]],[[0,0,0],[0,1,0]],null,a),i(ZP.Block,Bw.RedBlockSlopedUpOuterCorner,[["Blocks","BlockSlopedUpOuterCorner"]],[[0,0,0],[0,1,0]],null,a),i(ZP.Block,Bw.RedBlockSlopeDown,[["Blocks","BlockSlopeDown"]],null,null,a),i(ZP.Block,Bw.RedBlockSlopeUp,[["Blocks","BlockSlopeUp"]],null,null,a),i(ZP.Block,Bw.RedBlockBridge,[["Blocks","BlockBridge"]],null,null,a),i(ZP.Block,Bw.RedBlockBridgeCorner,[["Blocks","BlockBridgeCorner"]],null,null,a),i(ZP.Block,Bw.RedBlockBridgeIntersectionT,[["Blocks","BlockBridgeIntersectionT"]],null,null,a),i(ZP.Block,Bw.RedBlockBridgeIntersectionCross,[["Blocks","BlockBridgeIntersectionCross"]],null,null,a),i(ZP.Block,Bw.BlueBlock,[["Blocks","Block"]],null,null,o),i(ZP.Block,Bw.BlueHalfBlock,[["Blocks","HalfBlock"]],null,null,o),i(ZP.Block,Bw.BlueQuarterBlock,[["Blocks","QuarterBlock"]],null,null,o),i(ZP.Block,Bw.BlueBlockSlopedDown,[["Blocks","BlockSlopedDown"]],[[0,0,0],[0,1,0]],null,o),i(ZP.Block,Bw.BlueBlockSlopedDownInnerCorner,[["Blocks","BlockSlopedDownInnerCorner"]],[[0,0,0],[0,1,0]],null,o),i(ZP.Block,Bw.BlueBlockSlopedDownOuterCorner,[["Blocks","BlockSlopedDownOuterCorner"]],[[0,0,0],[0,1,0]],null,o),i(ZP.Block,Bw.BlueBlockSlopedUp,[["Blocks","BlockSlopedUp"]],[[0,0,0],[0,1,0]],null,o),i(ZP.Block,Bw.BlueBlockSlopedUpInnerCorner,[["Blocks","BlockSlopedUpInnerCorner"]],[[0,0,0],[0,1,0]],null,o),i(ZP.Block,Bw.BlueBlockSlopedUpOuterCorner,[["Blocks","BlockSlopedUpOuterCorner"]],[[0,0,0],[0,1,0]],null,o),i(ZP.Block,Bw.BlueBlockSlopeDown,[["Blocks","BlockSlopeDown"]],null,null,o),i(ZP.Block,Bw.BlueBlockSlopeUp,[["Blocks","BlockSlopeUp"]],null,null,o),i(ZP.Block,Bw.BlueBlockBridge,[["Blocks","BlockBridge"]],null,null,o),i(ZP.Block,Bw.BlueBlockBridgeCorner,[["Blocks","BlockBridgeCorner"]],null,null,o),i(ZP.Block,Bw.BlueBlockBridgeIntersectionT,[["Blocks","BlockBridgeIntersectionT"]],null,null,o),i(ZP.Block,Bw.BlueBlockBridgeIntersectionCross,[["Blocks","BlockBridgeIntersectionCross"]],null,null,o),i(ZP.Block,Bw.BlackBlock,[["Blocks","Block"]],null,null,s),i(ZP.Block,Bw.BlackHalfBlock,[["Blocks","HalfBlock"]],null,null,s),i(ZP.Block,Bw.BlackQuarterBlock,[["Blocks","QuarterBlock"]],null,null,s),i(ZP.Block,Bw.BlackBlockSlopedDown,[["Blocks","BlockSlopedDown"]],[[0,0,0],[0,1,0]],null,s),i(ZP.Block,Bw.BlackBlockSlopedDownInnerCorner,[["Blocks","BlockSlopedDownInnerCorner"]],[[0,0,0],[0,1,0]],null,s),i(ZP.Block,Bw.BlackBlockSlopedDownOuterCorner,[["Blocks","BlockSlopedDownOuterCorner"]],[[0,0,0],[0,1,0]],null,s),i(ZP.Block,Bw.BlackBlockSlopedUp,[["Blocks","BlockSlopedUp"]],[[0,0,0],[0,1,0]],null,s),i(ZP.Block,Bw.BlackBlockSlopedUpInnerCorner,[["Blocks","BlockSlopedUpInnerCorner"]],[[0,0,0],[0,1,0]],null,s),i(ZP.Block,Bw.BlackBlockSlopedUpOuterCorner,[["Blocks","BlockSlopedUpOuterCorner"]],[[0,0,0],[0,1,0]],null,s),i(ZP.Block,Bw.BlackBlockSlopeDown,[["Blocks","BlockSlopeDown"]],null,null,s),i(ZP.Block,Bw.BlackBlockSlopeUp,[["Blocks","BlockSlopeUp"]],null,null,s),i(ZP.Block,Bw.BlackBlockBridge,[["Blocks","BlockBridge"]],null,null,s),i(ZP.Block,Bw.BlackBlockBridgeCorner,[["Blocks","BlockBridgeCorner"]],null,null,s),i(ZP.Block,Bw.BlackBlockBridgeIntersectionT,[["Blocks","BlockBridgeIntersectionT"]],null,null,s),i(ZP.Block,Bw.BlackBlockBridgeIntersectionCross,[["Blocks","BlockBridgeIntersectionCross"]],null,null,s),i(ZP.WallTrack,Bw.WallTrackTop,[["WallTrack","WallTrackTop"]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0]]),i(ZP.WallTrack,Bw.WallTrackMiddle,[["WallTrack","WallTrackMiddle"]]),i(ZP.WallTrack,Bw.WallTrackBottom,[["WallTrack","WallTrackBottom"]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0]]),i(ZP.WallTrack,Bw.WallTrackTopCorner,[["WallTrack","WallTrackTopCorner"]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0]]),i(ZP.WallTrack,Bw.WallTrackMiddleCorner,[["WallTrack","WallTrackMiddleCorner"]]),i(ZP.WallTrack,Bw.WallTrackBottomCorner,[["WallTrack","WallTrackBottomCorner"]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0]]),i(ZP.WallTrack,Bw.WallTrackBottomInnerCorner,[["WallTrack","WallTrackBottomInnerCorner"]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0]]),i(ZP.WallTrack,Bw.WallTrackInnerCorner,[["WallTrack","WallTrackInnerCorner"]]),i(ZP.WallTrack,Bw.WallTrackTopInnerCorner,[["WallTrack","WallTrackTopInnerCorner"]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0]]),i(ZP.WallTrack,Bw.WallTrackCeiling,[["WallTrack","WallTrackCeiling"]]),i(ZP.WallTrack,Bw.WallTrackFloor,[["WallTrack","WallTrackFloor"]]),i(ZP.Pillar,Bw.PillarTop,[["Pillar","PillarTop"]]),i(ZP.Pillar,Bw.PillarMiddle,[["Pillar","PillarMiddle"]]),i(ZP.Pillar,Bw.PillarBottom,[["Pillar","PillarBottom"]]),i(ZP.Pillar,Bw.PillarShort,[["Pillar","PillarShort"]]),i(ZP.Pillar,Bw.PillarBranch1,[["Pillar","PillarBranch1"]]),i(ZP.Pillar,Bw.PillarBranch1Top,[["Pillar","PillarBranch1Top"]]),i(ZP.Pillar,Bw.PillarBranch1Middle,[["Pillar","PillarBranch1Middle"]]),i(ZP.Pillar,Bw.PillarBranch1Bottom,[["Pillar","PillarBranch1Bottom"]]),i(ZP.Pillar,Bw.PillarBranch2,[["Pillar","PillarBranch2"]]),i(ZP.Pillar,Bw.PillarBranch2Top,[["Pillar","PillarBranch2Top"]]),i(ZP.Pillar,Bw.PillarBranch2Middle,[["Pillar","PillarBranch2Middle"]]),i(ZP.Pillar,Bw.PillarBranch2Bottom,[["Pillar","PillarBranch2Bottom"]]),i(ZP.Pillar,Bw.PillarBranch3,[["Pillar","PillarBranch3"]]),i(ZP.Pillar,Bw.PillarBranch3Top,[["Pillar","PillarBranch3Top"]]),i(ZP.Pillar,Bw.PillarBranch3Middle,[["Pillar","PillarBranch3Middle"]]),i(ZP.Pillar,Bw.PillarBranch3Bottom,[["Pillar","PillarBranch3Bottom"]]),i(ZP.Pillar,Bw.PillarBranch4,[["Pillar","PillarBranch4"]]),i(ZP.Pillar,Bw.PillarBranch4Top,[["Pillar","PillarBranch4Top"]]),i(ZP.Pillar,Bw.PillarBranch4Middle,[["Pillar","PillarBranch4Middle"]]),i(ZP.Pillar,Bw.PillarBranch4Bottom,[["Pillar","PillarBranch4Bottom"]]),i(ZP.Pillar,Bw.PillarBranch5,[["Pillar","PillarBranch5"]]),i(ZP.Pillar,Bw.PillarBranch5Top,[["Pillar","PillarBranch5Top"]]),i(ZP.Pillar,Bw.PillarBranch5Middle,[["Pillar","PillarBranch5Middle"]]),i(ZP.Pillar,Bw.PillarBranch5Bottom,[["Pillar","PillarBranch5Bottom"]]),i(ZP.Sign,Bw.SignArrowLeft,[["Signs","SignArrowLeft"]]),i(ZP.Sign,Bw.SignArrowRight,[["Signs","SignArrowRight"]]),i(ZP.Sign,Bw.SignArrowUp,[["Signs","SignArrowUp"]]),i(ZP.Sign,Bw.SignArrowDown,[["Signs","SignArrowDown"]]),i(ZP.Sign,Bw.SignWarning,[["Signs","SignWarning"]]),i(ZP.Sign,Bw.SignWrongWay,[["Signs","SignWrongWay"]])}))};var aR=n(207),oR={};oR.styleTagTransform=u(),oR.setAttributes=l(),oR.insert=o().bind(null,"head"),oR.domAPI=r(),oR.insertStyleElement=h();t()(aR.A,oR);aR.A&&aR.A.locals&&aR.A.locals;const sR=class{constructor(){this.transitionLayer=document.getElementById("transition-layer"),this.callback=null}trigger(e){null==this.callback&&(this.transitionLayer.style.opacity="1",setTimeout((()=>{if(null!=this.callback){const e=this.callback();null==e?(this.transitionLayer.style.opacity="0",this.callback=null):e.catch((e=>{console.error(e)})).finally((()=>{this.transitionLayer.style.opacity="0",this.callback=null}))}}),250)),this.callback=e}};var lR,cR,hR=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},dR=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};lR=new WeakMap,cR=new WeakMap;const uR=class{constructor(e,t,n){lR.set(this,void 0),cR.set(this,void 0),hR(this,lR,t,"f");const i=e.getShadowDirection().negate();n.addResource();const r=(new yh).load("images/clouds.jpg",(()=>{n.loadedResource()}));r.wrapT=he,r.wrapS=he;const a=new Hc(1e6,5,2,0,2*Math.PI,0,Math.PI),o=new Gr({defines:{CLOUDS_ENABLED:t.getSettingBoolean(Jh.CloudsEnabled)},uniforms:{scrollA:{value:new ln(100*Math.random(),100*Math.random())},scrollB:{value:new ln(100*Math.random(),100*Math.random())},sampler:{value:r},cloudDensity:{value:.6},cloudLight:{value:new Un(.75,.75,.75)},sunPosition:{value:i}},vertexShader:"\n\t\t\t\tvarying vec3 fPos;\n\t\t\t\t\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewPosition;\n\t\t\t\t\tgl_Position.z = 0.0;\n\t\t\t\t\tfPos = position;\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\t\tvarying vec3 fPos;\n\n\t\t\t\tuniform vec2 offset;\n\t\t\t\tuniform vec2 scrollA;\n\t\t\t\tuniform vec2 scrollB;\n\t\t\t\tuniform sampler2D sampler;\n\n\t\t\t\tuniform float cloudDensity;\n\t\t\t\tuniform vec3 cloudLight;\n\n\t\t\t\tuniform vec3 sunPosition;\n\n\t\t\t\tvoid main()\n\t\t\t\t{\n\t\t\t\t\t#ifdef CLOUDS_ENABLED\n\t\t\t\t\t\tfloat c00 = texture2D(sampler, vec2(fPos.x / ((fPos.y + 0.06) / 0.1) - scrollB.x * 0.981, fPos.z / ((fPos.y + 0.06) / 0.1) - scrollB.y * 1.041) + scrollA).r;\n\t\t\t\t\t\tfloat c10 = texture2D(sampler, vec2(fPos.x / ((fPos.y + 0.06) / 0.1) + scrollB.x * 0.821, fPos.z / ((fPos.y + 0.06) / 0.1) - scrollB.y * 0.951) + scrollA).r;\n\t\t\t\t\t\tfloat c01 = texture2D(sampler, vec2(fPos.x / ((fPos.y + 0.06) / 0.1) - scrollB.x * 1.043, fPos.z / ((fPos.y + 0.06) / 0.1) + scrollB.y * 0.899) + scrollA).r;\n\t\t\t\t\t\tfloat c11 = texture2D(sampler, vec2(fPos.x / ((fPos.y + 0.06) / 0.1) + scrollB.x * 0.901, fPos.z / ((fPos.y + 0.06) / 0.1) + scrollB.y * 1.045) + scrollA).r;\n\t\t\t\t\t\tfloat cloud = min(1.0, max(0.0, (c00 + c10 + c01 + c11) / 4.0 - (1.0 - cloudDensity)) * 3.0);\n\n\t\t\t\t\t\tvec3 cloudColor = vec3(min(1.0, (c00 + c10 + c01 + c11) / 4.0 - (1.0 - cloudDensity)) * 4.0 + cloudDensity) * cloudLight;\n\t\t\t\t\t\tfloat cloudIntensity = cloud * min(1.0, max(0.0, fPos.y * 2.0 / 1000000.0));\n\t\t\t\t\t#else\n\t\t\t\t\t\tvec3 cloudColor = vec3(0.0);\n\t\t\t\t\t\tfloat cloudIntensity = 0.0;\n\t\t\t\t\t#endif\n\t\t\t\t\t\n\t\t\t\t\tvec3 horizonColor = vec3(255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0);\n\t\t\t\t\tvec3 zenithColor = vec3(5.0 / 255.0, 140.0 / 255.0, 255.0 / 255.0);\n\t\t\t\t\tfloat h = pow(clamp(fPos.y / 1000000.0, 0.01, 1.0), 0.2);\n\t\t\t\t\tvec3 skyColor = zenithColor * h + horizonColor * (1.0 - h);\n\n\t\t\t\t\tvec3 normal = normalize(-fPos);\n\t\t\t\t\tfloat sun = pow(max(0.0, max(0.0, dot(normal, sunPosition)) - 0.999), 4.0) * 60000000000.0;\n\t\t\t\t\tvec3 sunColor = vec3(20.0 * sun, 20.0 * sun, 19.0 * sun);\n\n\t\t\t\t\tgl_FragColor = vec4((skyColor * (1.0 - cloudIntensity) + cloudColor * cloudIntensity) * max(vec3(0.0), vec3(1.0) - sunColor) + sunColor, 1.0);\n\t\t\t\t}\n\t\t\t"});o.side=T,o.depthWrite=!1,hR(this,cR,new Br(a,o),"f"),dR(this,cR,"f").renderOrder=-3,dR(this,cR,"f").matrixAutoUpdate=!1,dR(this,cR,"f").updateMatrix(),e.scene.add(dR(this,cR,"f"))}update(e,t){dR(this,lR,"f").getSettingBoolean(Jh.CloudsEnabled)?(dR(this,cR,"f").material.uniforms.scrollA.value.x+=.00226*e,dR(this,cR,"f").material.uniforms.scrollA.value.y+=.001646*e,dR(this,cR,"f").material.uniforms.scrollB.value.x+=.001752*e,dR(this,cR,"f").material.uniforms.scrollB.value.y+=.001057*e,1!=dR(this,cR,"f").material.defines.CLOUDS_ENABLED&&(dR(this,cR,"f").material.defines.CLOUDS_ENABLED=!0,dR(this,cR,"f").material.needsUpdate=!0)):0!=dR(this,cR,"f").material.defines.CLOUDS_ENABLED&&(dR(this,cR,"f").material.defines.CLOUDS_ENABLED=!1,dR(this,cR,"f").material.needsUpdate=!0),dR(this,cR,"f").position.copy(t.position),dR(this,cR,"f").updateMatrix()}};const pR=class{constructor(){this.token=null,this.nickname=ER.defaultNickname,this.carColors=wu.random()}};var fR,mR,gR,vR,wR,yR,bR,xR=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},_R=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class kR{constructor(e){var t;fR.add(this),gR.set(this,void 0),vR.set(this,void 0),wR.set(this,void 0),xR(this,gR,e,"f"),xR(this,vR,null!==(t=_R(this,gR,"f").loadUserProfileSlot())&&void 0!==t?t:0,"f"),xR(this,wR,_R(this,fR,"m",bR).call(this,_R(this,vR,"f")),"f")}createProfile(e,t,n,i){return!!this.isValidToken(t)&&(_R(this,gR,"f").saveUserProfile(e,t,n,i),null!=_R(this,gR,"f").loadUserProfile(e))}isValidToken(e){return!(!/^[0-9a-f]*$/.test(e)||64!=e.length)}hasDuplicateToken(e){var t;for(let n=0;n<3;n++)if((null===(t=_R(this,gR,"f").loadUserProfile(n))||void 0===t?void 0:t.token)==e)return!0;return!1}firstOccupiedProfileSlot(){for(let e=0;e<3;e++)if(null!=_R(this,gR,"f").loadUserProfile(e))return e;return null}firstFreeProfileSlot(){for(let e=0;e<3;e++)if(null==_R(this,gR,"f").loadUserProfile(e))return e;return null}deleteProfileSlot(e){_R(this,gR,"f").deleteAllRecords(e),_R(this,gR,"f").deleteUserProfile(e)}setProfileSlot(e){if(!Number.isSafeInteger(e)||e<0)throw"Profile slot is invalid";xR(this,vR,e,"f"),xR(this,wR,_R(this,fR,"m",bR).call(this,_R(this,vR,"f")),"f"),_R(this,gR,"f").saveUserProfileSlot(_R(this,vR,"f"))}setNickname(e,t=_R(this,vR,"f")){let n;n=t==_R(this,vR,"f")?_R(this,wR,"f"):_R(this,fR,"m",bR).call(this,t),n.nickname=e,_R(this,gR,"f").saveUserProfile(t,n.token,n.nickname,n.carColors)}setCarColors(e,t=_R(this,vR,"f")){let n;n=t==_R(this,vR,"f")?_R(this,wR,"f"):_R(this,fR,"m",bR).call(this,t),n.carColors=e,_R(this,gR,"f").saveUserProfile(t,n.token,n.nickname,n.carColors)}get profileSlot(){return _R(this,vR,"f")}getUserProfile(e=_R(this,vR,"f")){var t;return e==_R(this,vR,"f")?{token:_R(this,wR,"f").token,nickname:_R(this,wR,"f").nickname,carColors:_R(this,wR,"f").carColors}:null!==(t=_R(this,gR,"f").loadUserProfile(e))&&void 0!==t?t:null}getToken(e=_R(this,vR,"f")){var t,n;return e==_R(this,vR,"f")?_R(this,wR,"f").token:null!==(n=null===(t=_R(this,gR,"f").loadUserProfile(e))||void 0===t?void 0:t.token)&&void 0!==n?n:null}getTokenHash(e=_R(this,vR,"f")){var t,n;let i;return i=e==_R(this,vR,"f")?_R(this,wR,"f").token:null!==(n=null===(t=_R(this,gR,"f").loadUserProfile(e))||void 0===t?void 0:t.token)&&void 0!==n?n:null,null==i?null:(0,hy.sha256)(i)}getNickname(e=_R(this,vR,"f")){var t,n;return e==_R(this,vR,"f")?_R(this,wR,"f").nickname:null!==(n=null===(t=_R(this,gR,"f").loadUserProfile(e))||void 0===t?void 0:t.nickname)&&void 0!==n?n:mR.defaultNickname}getCarColors(e=_R(this,vR,"f")){var t,n;return e==_R(this,vR,"f")?_R(this,wR,"f").carColors:null!==(n=null===(t=_R(this,gR,"f").loadUserProfile(e))||void 0===t?void 0:t.carColors)&&void 0!==n?n:wu.random()}syncUserProfile(e){const t=this.getUserProfile();null!=t&&e.getUser(t.token).then((e=>{if(null==e)return;const n=this.getUserProfile();null!=n&&n.token==t.token&&n.nickname==t.nickname&&n.carColors.serialize()==t.carColors.serialize()&&(this.setNickname(e.name),this.setCarColors(e.carColors))})).catch((e=>{console.error(e)}))}}mR=kR,gR=new WeakMap,vR=new WeakMap,wR=new WeakMap,fR=new WeakSet,yR=function(e){let t,n="";try{const e=new Uint8Array(32);crypto.getRandomValues(e),n+=e}catch(e){}try{n+=crypto.randomUUID()}catch(e){}0==n.length?(t=null,console.error("Failed to generate user token")):t=(0,hy.sha256)(n);const i=mR.defaultNickname,r=wu.random();_R(this,gR,"f").saveUserProfile(e,t,i,r)},bR=function(e){var t;return null==_R(this,gR,"f").loadUserProfile(e)&&_R(this,fR,"m",yR).call(this,e),null!==(t=_R(this,gR,"f").loadUserProfile(e))&&void 0!==t?t:new pR},kR.defaultNickname="Anonymous";const ER=kR;var SR,MR,TR,AR,CR,PR,RR,LR,IR,NR,DR,UR,BR,OR,zR,FR,WR,HR,VR,GR=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class jR{constructor(){SR.add(this)}migrate(e){GR(MR,MR,"f",TR)||GR(MR,MR,"f",AR)||GR(this,SR,"m",BR).call(this)||(GR(this,SR,"m",PR).call(this,e),GR(this,SR,"m",RR).call(this,e),GR(this,SR,"m",LR).call(this,e),GR(this,SR,"m",UR).call(this))}saveRecord(e,t,n,i,r){if(!Number.isSafeInteger(e)||e<0)throw"Profile slot is invalid";try{localStorage.setItem(GR(MR,MR,"f",OR)+e+"_"+t,JSON.stringify({uploadId:n,frames:i.numberOfFrames.toString(),recording:r.serialize()}))}catch(e){console.error(e)}}loadRecord(e,t){if(!Number.isSafeInteger(e)||e<0)throw"Profile slot is invalid";try{const n=localStorage.getItem(GR(MR,MR,"f",OR)+e+"_"+t);if(null==n)return null;const i=JSON.parse(n);if("object"!=typeof i)return null;if(!("uploadId"in i))return null;let r;if(null==i.uploadId)r=null;else if(r=Number.parseInt(i.uploadId,10),!Number.isSafeInteger(r))return null;if(!("frames"in i))return null;const a=Number.parseInt(i.frames,10);if(!Number.isSafeInteger(a))return null;const o=new rp(a);if(!("recording"in i))return null;const s=Ag.deserialize(i.recording);return null==s?null:{uploadId:r,time:o,recording:s}}catch(e){console.error(e)}return null}deleteAllRecords(e){if(!Number.isSafeInteger(e)||e<0)throw"Profile slot is invalid";try{Object.keys(localStorage).forEach((t=>{t.startsWith(GR(MR,MR,"f",OR)+e+"_")&&localStorage.removeItem(t)}))}catch(e){console.error(e)}}saveTrack(e,t,n){const i=t.toSaveString(n);try{return localStorage.setItem(GR(MR,MR,"f",zR)+e,JSON.stringify({data:i,saveTime:(new Date).getTime()})),!0}catch(e){return console.error(e),!1}}loadTrack(e,t){let n,i;try{const t=localStorage.getItem(GR(MR,MR,"f",zR)+e);if(null==t)return null;const r=JSON.parse(t);if("string"!=typeof r.data)return null;if("number"!=typeof r.saveTime)return null;n=r.data,i=r.saveTime}catch(e){return console.error(e),null}const r=Py.fromSaveString(n,t);return null==r?null:{trackData:r,saveTime:i}}deleteTrack(e){try{return localStorage.removeItem(GR(MR,MR,"f",zR)+e),!0}catch(e){return console.error(e),!1}}checkTrackExists(e){try{return null!=localStorage.getItem(GR(MR,MR,"f",zR)+e)}catch(e){return null}}getAllTrackNames(){let e;try{e=Object.keys(localStorage)}catch(e){return console.error(e),null}return e.filter((e=>e.startsWith(GR(MR,MR,"f",zR)))).map((e=>e.substring(GR(MR,MR,"f",zR).length)))}saveUserProfileSlot(e){if(!Number.isSafeInteger(e)||e<0)throw"Profile slot is invalid";try{localStorage.setItem(GR(MR,MR,"f",FR),JSON.stringify(e))}catch(e){console.error(e)}}loadUserProfileSlot(){try{const e=localStorage.getItem(GR(MR,MR,"f",FR));if(null!=e)try{const t=JSON.parse(e);if(!Number.isSafeInteger(t)||t<0)throw"Profile slot is invalid";return t}catch(e){console.error(e)}}catch(e){console.error(e)}return null}saveUserProfile(e,t,n,i){if(!Number.isSafeInteger(e)||e<0)throw"Profile slot is invalid";try{localStorage.setItem(GR(MR,MR,"f",WR)+e,JSON.stringify({token:t,nickname:n,carColors:i.serialize()}))}catch(e){console.error(e)}}loadUserProfile(e){if(!Number.isSafeInteger(e)||e<0)throw"Profile slot is invalid";try{const t=localStorage.getItem(GR(MR,MR,"f",WR)+e);if(null!=t)try{const e=JSON.parse(t);if("object"!=typeof e)throw"User profile is not an object";if("string"!=typeof e.token)throw"User profile token field has invalid type";if("string"!=typeof e.nickname)throw"User profile nickname field has invalid type";if("string"!=typeof e.carColors)throw"User profile carColors field has invalid type";return{token:e.token,nickname:e.nickname,carColors:wu.deserialize(e.carColors)}}catch(e){console.error(e)}}catch(e){console.error(e)}return null}deleteUserProfile(e){try{localStorage.removeItem(GR(MR,MR,"f",WR)+e)}catch(e){console.error(e)}}saveSettings(e){try{const t=[];for(const[n,i]of e.entries())t.push([Jh[n],i]);localStorage.setItem(GR(MR,MR,"f",HR),JSON.stringify(t))}catch(e){console.error(e)}}loadSettings(){try{const e=localStorage.getItem(GR(MR,MR,"f",HR));if(null==e)return null;const t=JSON.parse(e);if(!Array.isArray(t))return null;const n=[];return t.forEach((e=>{if(!Array.isArray(e))return;if(2!=e.length)return;if("string"!=typeof e[0])return;const t=e[0],i=Jh[t];if(null==i)return;const r=e[1];"string"==typeof e[1]&&n.push([i,r])})),n}catch(e){console.error(e)}return null}saveKeyBindings(e){try{const t=[];for(const[n,i]of e.entries())t.push([Lb[n],i]);localStorage.setItem(GR(MR,MR,"f",VR),JSON.stringify(t))}catch(e){console.error(e)}}loadKeyBindings(){try{const e=localStorage.getItem(GR(MR,MR,"f",VR));if(null==e)return null;const t=JSON.parse(e);if(!Array.isArray(t))return null;const n=[];return t.forEach((e=>{if(!Array.isArray(e))return;if(2!=e.length)return;if("string"!=typeof e[0])return;const t=e[0],i=Lb[t];if(null==i)return;const r=e[1];Array.isArray(r)&&2==r.length&&(null!=r[0]&&"string"!=typeof r[0]||null!=r[1]&&"string"!=typeof r[1]||n.push([i,r]))})),n}catch(e){console.error(e)}return null}}MR=jR,SR=new WeakSet,PR=function(e){try{Object.keys(localStorage).forEach((t=>{if("car_colors"==t)try{const e=localStorage.getItem(t);if(null!=e){const n=JSON.parse(e),i=new wu(new tr(n[0]),new tr(n[1]),new tr(n[2]),new tr(n[3]));GR(this,SR,"m",NR).call(this,i),localStorage.removeItem(t)}}catch(e){console.error(e)}if(t.startsWith("record_"))try{localStorage.removeItem(t)}catch(e){console.error(e)}if(t.startsWith("custom_track_"))try{const n=localStorage.getItem(t);if(null!=n){const i=xy(JSON.parse(n),e);if(null!=i){const{trackName:n,trackData:r}=i;this.saveTrack(n,r,e)&&localStorage.removeItem(t)}}}catch(e){console.error(e)}}))}catch(e){console.error(e)}},RR=function(e){try{Object.keys(localStorage).forEach((t=>{if("v1_car"==t)try{const e=localStorage.getItem(t);if(null!=e){const n=JSON.parse(e),i=new wu(new tr(n[0]),new tr(n[1]),new tr(n[2]),new tr(n[3]));GR(this,SR,"m",NR).call(this,i),localStorage.removeItem(t)}}catch(e){console.error(e)}if(t.startsWith("v1_record_"))try{localStorage.removeItem(t)}catch(e){console.error(e)}if(t.startsWith("v1_track_"))try{const n=localStorage.getItem(t);if(null!=n){const i=t.substring(9),r=_y(n,e);if(null==r)throw"Failed to load v1 track for migration";if(!this.saveTrack(i,r,e))throw"Failed to save v1 track for migration";localStorage.removeItem(t)}}catch(e){console.error(e)}}))}catch(e){console.error(e)}},LR=function(e){try{Object.keys(localStorage).forEach((t=>{if("v2_car"==t)try{const e=localStorage.getItem(t);if(null!=e){const n=wu.deserialize(e);GR(this,SR,"m",NR).call(this,n),localStorage.removeItem(t)}}catch(e){console.error(e)}if("v2_user"==t)try{const e=localStorage.getItem(t);if(null!=e){const n=JSON.parse(e);if(Array.isArray(n)||"object"!=typeof n)throw"User profile is not an object";const i=n.token;if(null!=i&&"string"!=typeof i)throw"User profile token is not a string";const r=n.nickname;if("string"!=typeof r)throw"User profile nickname is not a string";const a=wu.random();GR(this,SR,"m",IR).call(this,i,r,a),localStorage.removeItem(t)}}catch(e){console.error(e)}if(t.startsWith("v2_record_"))try{localStorage.removeItem(t)}catch(e){console.error(e)}if(t.startsWith("v2_track_"))try{const n=localStorage.getItem(t);if(null!=n){const i=t.substring(9),r=ky(n,e);if(null==r)throw"Failed to load v2 track for migration";if(!this.saveTrack(i,r,e))throw"Failed to save v2 track for migration";localStorage.removeItem(t)}}catch(e){console.error(e)}}))}catch(e){console.error(e)}},IR=function(e,t,n){var i;const r=this.loadUserProfile(0);null==r?this.saveUserProfile(0,e,t,n):this.saveUserProfile(0,null!==(i=r.token)&&void 0!==i?i:e,r.nickname,r.carColors)},NR=function(e){const t=this.loadUserProfile(0);null==t?this.saveUserProfile(0,null,ER.defaultNickname,e):this.saveUserProfile(0,t.token,t.nickname,e)},UR=function(){try{localStorage.setItem(GR(MR,MR,"f",DR),"")}catch(e){console.error(e)}},BR=function(){try{return null!=localStorage.getItem(GR(MR,MR,"f",DR))}catch(e){console.error(e)}return!1},TR={value:"0.0.0"==wC.rE},AR={value:wC.rE.toLowerCase().includes("beta")},CR={value:"polytrack_v3_"+(GR(MR,MR,"f",TR)?"dev_":"")+(GR(MR,MR,"f",AR)?"beta_":"")},DR={value:GR(MR,MR,"f",CR)+"migrated"},OR={value:GR(MR,MR,"f",CR)+"record_"},zR={value:GR(MR,MR,"f",CR)+"track_"},FR={value:GR(MR,MR,"f",CR)+"user_slot"},WR={value:GR(MR,MR,"f",CR)+"user_"},HR={value:GR(MR,MR,"f",CR)+"settings"},VR={value:GR(MR,MR,"f",CR)+"key_bindings"};const qR=jR;var XR,YR,KR,ZR,JR,QR,$R,eL=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},tL=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class nL{constructor(){XR.add(this),KR.set(this,void 0),ZR.set(this,!1),JR.set(this,null);const e=document.getElementById("ui");if(null==e)throw"Failed to find UI element";eL(this,KR,e,"f"),window.addEventListener("mousemove",(()=>{document.body.classList.remove("hide-cursor"),tL(this,ZR,"f")&&(null!=tL(this,JR,"f")&&clearTimeout(tL(this,JR,"f")),eL(this,JR,setTimeout((()=>{document.body.classList.add("hide-cursor"),eL(this,JR,null,"f")}),tL(YR,YR,"f",QR)),"f"))})),window.addEventListener("resize",(()=>{tL(this,XR,"m",$R).call(this)})),tL(this,XR,"m",$R).call(this)}setCursorHiddenWhenInactive(e){eL(this,ZR,e,"f"),e?eL(this,JR,setTimeout((()=>{document.body.classList.add("hide-cursor"),eL(this,JR,null,"f")}),tL(YR,YR,"f",QR)),"f"):(document.body.classList.remove("hide-cursor"),null!=tL(this,JR,"f")&&(clearTimeout(tL(this,JR,"f")),eL(this,JR,null,"f")))}}YR=nL,KR=new WeakMap,ZR=new WeakMap,JR=new WeakMap,XR=new WeakSet,$R=function(){const e=Math.max(.01,Math.min(window.innerWidth,1.4375*window.innerHeight)/1150);e<1?(tL(this,KR,"f").style.width="calc(100% / "+e+")",tL(this,KR,"f").style.height="calc(100% / "+e+")",tL(this,KR,"f").style.transform="scale("+e+")"):(tL(this,KR,"f").style.width="",tL(this,KR,"f").style.height="",tL(this,KR,"f").style.transform="")},QR={value:1e3};const iL=nL;var rL,aL,oL,sL=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},lL=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};const cL="https://vps.kodub.com:43273/";rL=new WeakMap,aL=new WeakMap,oL=new WeakMap;const hL=class{constructor(e){rL.set(this,void 0),this.submitAllowed=!1,aL.set(this,2e4),oL.set(this,1e4),sL(this,rL,e,"f")}getLeaderboard(e,t,n,i){const r=lL(this,rL,"f").getTokenHash();let a=cL+"leaderboard?version="+wC.rE+"&trackId="+e+"&skip="+t+"&amount="+n+"&onlyVerified="+i;return null!=r&&(a+="&userTokenHash="+encodeURIComponent(r)),new Promise(((e,t)=>{const n=new XMLHttpRequest;n.timeout=lL(this,aL,"f"),n.overrideMimeType("text/plain"),n.onreadystatechange=()=>{if(n.readyState==XMLHttpRequest.DONE)if(200==n.status)try{const i=JSON.parse(n.responseText),r=i.total;if("number"!=typeof r)return void t("Total is not a number");if(!Number.isSafeInteger(r))return void t("Total is not a safe integer");const a=i.entries;if(!Array.isArray(a))return void t("Entries is not an array");const o=[];for(let e=0;e<a.length;e++){const n=a[e];if(null==n)return void t("Entry is missing");if(!Object.prototype.hasOwnProperty.call(n,"id"))return void t('Entry is missing "id" field');if(!Object.prototype.hasOwnProperty.call(n,"name"))return void t('Entry is missing "name" field');if(!Object.prototype.hasOwnProperty.call(n,"frames"))return void t('Entry is missing "frames" field');if(!Object.prototype.hasOwnProperty.call(n,"carColors"))return void t('Entry is missing "carColors" field');if(!Object.prototype.hasOwnProperty.call(n,"verifiedState"))return void t('Entry is missing "verifiedState" field');if(!Object.prototype.hasOwnProperty.call(n,"isSelf"))return void t('Entry is missing "isSelf" field');if("number"!=typeof n.id)return void t('"id" field has incorrect type');if("string"!=typeof n.name)return void t('"name" field has incorrect type');if("number"!=typeof n.frames)return void t('"frames" field has incorrect type');if(!Number.isSafeInteger(n.frames))return void t('"frames" field has an invalid value');if("string"!=typeof n.carColors)return void t('"carColors" field has incorrect type');let i=null;if(null!=n.verifiedState){if("boolean"!=typeof n.verifiedState)return void t('"verifiedState" field has incorrect type');i=1==n.verifiedState}o.push({id:n.id,name:n.name,time:new rp(n.frames),carColors:wu.deserialize(n.carColors),verifiedState:i,isSelf:1==n.isSelf})}let s=null;if(null!=i.userEntry){const e=i.userEntry.position;if("number"!=typeof e)return void t("User position is not a number");if(!Number.isSafeInteger(e))return void t("User position is not a safe integer");const n=i.userEntry.frames;if("number"!=typeof n)return void t("User frames is not a number");if(!Number.isSafeInteger(n))return void t("User frames is not a safe integer");const r=new rp(n),a=i.userEntry.id;if("number"!=typeof a)return void t("User record id is not a number");if(!Number.isSafeInteger(a))return void t("User record id is not a safe integer");s={position:e,time:r,id:a}}e({total:r,entries:o,userEntry:s})}catch(e){t("Unknown error: "+e)}else t("Failed to connect to server, status: "+n.status)},n.open("GET",a,!0),n.send()}))}getRecording(e){const t=cL+"recording?version="+wC.rE+"&recordingId="+e;return new Promise(((e,n)=>{const i=new XMLHttpRequest;i.timeout=lL(this,aL,"f"),i.overrideMimeType("text/plain"),i.onreadystatechange=()=>{if(i.readyState==XMLHttpRequest.DONE)if(200==i.status)try{const t=JSON.parse(i.responseText);if("string"!=typeof t.recording)return void n("JSON recording field has incorrect type");const r=Ag.deserialize(t.recording);if(null==r)return void n("Failed to deserialize recording");let a=null;if(null!=t.verifiedState){if("boolean"!=typeof t.verifiedState)return void n("JSON verifiedState field has incorrect type");a=1==t.verifiedState}if("number"!=typeof t.frames)return void n("JSON frames field has incorrect type");const o=t.frames;if(!Number.isSafeInteger(o))return void n("JSON frames is not a safe integer");const s=new rp(o);if("string"!=typeof t.carColors)return void n("JSON carColors field has incorrect type");const l=wu.deserialize(t.carColors);e({recording:r,time:s,verifiedState:a,carColors:l})}catch(e){n("Unknown error: "+e)}else n("Failed to connect to server, status: "+i.status)},i.open("GET",t,!0),i.send()}))}submitLeaderboard(e,t,n,i){return new Promise(((r,a)=>{const o=lL(this,rL,"f").getToken();if(this.submitAllowed&&null!=o){const s=lL(this,rL,"f").getNickname(),l=n.serialize();if(l.length>=lL(this,oL,"f"))a("Recording is too large");else{const n=cL+"leaderboard",c="version="+wC.rE+"&userToken="+encodeURIComponent(o)+"&name="+encodeURIComponent(s)+"&carColors="+i.serialize()+"&trackId="+e+"&frames="+t.numberOfFrames+"&recording="+l,h=new XMLHttpRequest;h.timeout=lL(this,aL,"f"),h.overrideMimeType("text/plain"),h.onreadystatechange=()=>{if(4==h.readyState)if(200==h.status)try{const e=JSON.parse(h.responseText);if(null==e)r({uploadId:null});else{const t=Number.parseInt(e,10);Number.isSafeInteger(t)?r({uploadId:t}):a("UploadId is not a safe integer")}}catch(e){a("Unknown error: "+e)}else a("Failed to connect to server, status: "+h.status)},h.open("POST",n,!0),h.send(c)}}else r({uploadId:null})}))}submitUserProfile(e,t,n){return new Promise(((i,r)=>{if(this.submitAllowed&&null!=e){const a=cL+"user",o="version="+wC.rE+"&userToken="+encodeURIComponent(e)+"&name="+encodeURIComponent(t)+"&carColors="+n.serialize(),s=new XMLHttpRequest;s.timeout=lL(this,aL,"f"),s.overrideMimeType("text/plain"),s.onreadystatechange=()=>{4==s.readyState&&(200==s.status?i():r("Failed to connect to server, status: "+s.status))},s.open("POST",a,!0),s.send(o)}else i()}))}verifyRecordings(e,t,n,i){return new Promise(((r,a)=>{if(this.submitAllowed)if(null==e)a("No user token");else{const o=cL+"verifyRecordings",s="version="+wC.rE+"&userToken="+encodeURIComponent(e)+(null!=t?"&trackId="+t:"")+"&maxFrames="+n.numberOfFrames+"&recordings="+encodeURIComponent(JSON.stringify(i)),l=new XMLHttpRequest;l.timeout=lL(this,aL,"f"),l.overrideMimeType("text/plain"),l.onreadystatechange=()=>{if(4==l.readyState)if(200==l.status)try{if(""==l.responseText)return void r({unverifiedRecordings:[],exhaustive:!0});const e=JSON.parse(l.responseText);if(!("exhaustive"in e))return void a('Field "exhaustive" does not exist');const t=1==e.exhaustive;if(!("unverifiedRecordings"in e))return void a('Field "unverifiedRecordings" does not exist');const n=e.unverifiedRecordings;if(!Array.isArray(n))return void a('Field "unverifiedRecordings" is not an array');for(let e=0;e<n.length;e++){const t=n[e];if("object"!=typeof t)return void a("Recording is not an object");if("number"!=typeof t.id||!Number.isSafeInteger(t.id))return void a("Recording id is not a valid integer");if("string"!=typeof t.recording)return void a("Recording recording is not a string");if("number"!=typeof t.frames||t.frames<=0||!Number.isSafeInteger(t.frames))return void a("Recording frames is not a valid integer")}r({unverifiedRecordings:n,exhaustive:t})}catch(e){a("Unknown error: "+e)}else 403==l.status?a("User is not a verifier"):a("Failed to connect to server, status: "+l.status)},l.open("POST",o,!0),l.send(s)}else a("Submit not allowed")}))}getUser(e){return new Promise(((t,n)=>{if(null==e)n("No user token");else{const i="",r=new XMLHttpRequest;r.timeout=lL(this,aL,"f"),r.overrideMimeType("text/plain"),r.onreadystatechange=()=>{if(r.readyState==XMLHttpRequest.DONE)if(200==r.status)try{const e=JSON.parse(r.responseText);if(null==e)return void t(null);const i=e.name;if("string"!=typeof i)return void n("Name is not a string");const a=JA(i);if(0==a||a>50)return void n("Name as invalid length");const o=e.carColors;if("string"!=typeof o)return void n("CarColors data is not a string");const s=wu.deserialize(o),l=e.isVerifier;if("boolean"!=typeof l)return void n("IsVerifier is not a boolean");t({name:i,carColors:s,isVerifier:l})}catch(e){n("Unknown error: "+e)}else n("Failed to connect to server, status: "+r.status)},r.open("GET",i,!0),r.send()}}))}};var dL,uL,pL,fL,mL,gL=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},vL=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};uL=new WeakMap,pL=new WeakMap,fL=new WeakMap,dL=new WeakSet,mL=function(e){e.forEach((([e,t])=>{if(!vL(this,fL,"f").has(e))throw"Key binding is missing";vL(this,fL,"f").set(e,t)}))};const wL=class{constructor(e){dL.add(this),uL.set(this,void 0),pL.set(this,this.defaultSettings()),fL.set(this,this.defaultKeyBindings()),gL(this,uL,e,"f");const t=e.loadSettings();null!=t&&this.updateSettings(t);const n=e.loadKeyBindings();null!=n&&vL(this,dL,"m",mL).call(this,n)}defaultSettings(){return new Map([[Jh.ImperialUnitsEnabled,"false"],[Jh.ResetHintEnabled,"true"],[Jh.GhostCarEnabled,"true"],[Jh.CockpitCameraToggle,"true"],[Jh.CheckpointsPosition,"false"],[Jh.TimerPosition,"false"],[Jh.SpeedometerPosition,"false"],[Jh.Language,"en-US"],[Jh.CarShadowQuality,"2048"],[Jh.TrackShadowEnabled,"true"],[Jh.CloudsEnabled,"true"],[Jh.ParticlesEnabled,"true"],[Jh.SkidmarksEnabled,"true"],[Jh.RenderScale,"1"],[Jh.Antialiasing,"true"],[Jh.SoundEffectVolume,"1"],[Jh.MusicVolume,"1"],[Jh.CheckpointVolume,"1"]])}defaultKeyBindings(){return new Map([[Lb.VehicleAccelerate,["KeyW","ArrowUp"]],[Lb.VehicleTurnRight,["KeyD","ArrowRight"]],[Lb.VehicleBrake,["KeyS","ArrowDown"]],[Lb.VehicleTurnLeft,["KeyA","ArrowLeft"]],[Lb.VehicleReset,["KeyR","Enter"]],[Lb.VehicleCockpitCamera,["KeyC","KeyM"]],[Lb.ToggleUI,["KeyH",null]],[Lb.EditorRotate,["KeyR","Space"]],[Lb.EditorHeightModifier,["ShiftLeft","ShiftRight"]],[Lb.EditorDelete,["Delete","KeyX"]],[Lb.EditorMoveForwards,["KeyW","ArrowUp"]],[Lb.EditorMoveRight,["KeyD","ArrowRight"]],[Lb.EditorMoveBackwards,["KeyS","ArrowDown"]],[Lb.EditorMoveLeft,["KeyA","ArrowLeft"]],[Lb.EditorRotateLeft,["KeyQ",null]],[Lb.EditorRotateRight,["KeyE",null]],[Lb.EditorMoveDown,["KeyZ",null]],[Lb.EditorMoveUp,["KeyC",null]],[Lb.EditorTest,["KeyT",null]],[Lb.EditorPick,["KeyG",null]],[Lb.ToggleFpsCounter,["Comma",null]],[Lb.ToggleSpectatorCamera,["Period",null]],[Lb.SpectatorMoveForwards,["KeyW","ArrowUp"]],[Lb.SpectatorMoveRight,["KeyD","ArrowRight"]],[Lb.SpectatorMoveBackwards,["KeyS","ArrowDown"]],[Lb.SpectatorMoveLeft,["KeyA","ArrowLeft"]],[Lb.SpectatorSpeedModifier,["ShiftLeft","ShiftRight"]]])}getSettings(){return Array.from(vL(this,pL,"f"))}getSetting(e){const t=vL(this,pL,"f").get(e);if(null==t)throw"Setting name is missing";return t}getSettingBoolean(e){return"true"==this.getSetting(e)}getSettingFloat(e){return parseFloat(this.getSetting(e))}getSettingInteger(e){return parseInt(this.getSetting(e),10)}updateSettings(e){e.forEach((([e,t])=>{if(!vL(this,pL,"f").has(e))throw"Setting name is missing";vL(this,pL,"f").set(e,t)}))}saveSettings(){vL(this,uL,"f").saveSettings(vL(this,pL,"f"))}getKeyBindings(e){var t;return null!==(t=vL(this,fL,"f").get(e))&&void 0!==t?t:[null,null]}setKeyBindings(e){vL(this,dL,"m",mL).call(this,e),vL(this,uL,"f").saveKeyBindings(vL(this,fL,"f"))}checkKeyBinding(e,t){var n;const i=null!==(n=vL(this,fL,"f").get(t))&&void 0!==n?n:[];for(let t=0;t<i.length;t++){const n=i[t];if(null!=n&&e.code==n)return!0}return!1}};var yL;!function(e){e[e.Init=0]="Init",e[e.Verify=1]="Verify",e[e.TestDeterminism=2]="TestDeterminism",e[e.CreateCar=3]="CreateCar",e[e.DeleteCar=4]="DeleteCar",e[e.StartCar=5]="StartCar",e[e.ControlCar=6]="ControlCar",e[e.PauseCar=7]="PauseCar",e[e.VerifyResult=8]="VerifyResult",e[e.DeterminismResult=9]="DeterminismResult",e[e.UpdateResult=10]="UpdateResult"}(yL||(yL={}));const bL=yL;var xL,_L,kL,EL,SL,ML,TL,AL=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},CL=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};_L=new WeakMap,kL=new WeakMap,EL=new WeakMap,SL=new WeakMap,ML=new WeakMap,xL=new WeakSet,TL=function(e){CL(this,kL,"f").postMessage({messageType:bL.Init,trackParts:e.getPhysicsParts()})};const PL=class{constructor(e,t){xL.add(this),_L.set(this,void 0),kL.set(this,void 0),EL.set(this,!1),SL.set(this,0),ML.set(this,new Map),AL(this,kL,new Worker("simulation_worker.bundle.js"),"f"),null!=e&&null!=t?(AL(this,_L,e,"f"),t.hasLoaded()?CL(this,xL,"m",TL).call(this,e):t.addCompleteListener((()=>{CL(this,xL,"m",TL).call(this,e)}))):AL(this,_L,null,"f")}dispose(){CL(this,kL,"f").terminate(),AL(this,EL,!0,"f")}validate(e,t,n){return new Promise(((i,r)=>{var a,o;const s=e.getStartTransform();if(null==s)i(!1);else{const l=iT.createMountainVertices(e.getBounds());if(null==CL(this,_L,"f"))throw"TrackPartManager is not initialized";if(null==Uv.models)throw"Car collision model not loaded";const c=(AL(this,SL,(o=CL(this,SL,"f"),a=o++,o),"f"),a),h=setInterval((()=>{CL(this,EL,"f")&&(clearInterval(h),r("Simulation has been disposed"))}),10),d=e=>{e.data.messageType==bL.VerifyResult&&e.data.carId==c&&(clearInterval(h),CL(this,kL,"f").removeEventListener("message",d),i(e.data.result))};CL(this,kL,"f").addEventListener("message",d),CL(this,kL,"f").postMessage({messageType:bL.Verify,mountainVertices:l.vertices,mountainOffset:{x:l.offset.x,y:l.offset.y,z:l.offset.z},trackData:e.toSaveString(CL(this,_L,"f")),carId:c,carCollisionShapeVertices:Uv.models.collisionShapeVertices,carMassOffset:Uv.massOffset,carRecording:t.serialize(),carPosition:{x:s.position.x,y:s.position.y,z:s.position.z},carQuaternion:{x:s.quaternion.x,y:s.quaternion.y,z:s.quaternion.z,w:s.quaternion.w},targetFrames:n.numberOfFrames})}}))}testDeterminism(){return new Promise((e=>{const t=n=>{if(n.data.messageType===bL.DeterminismResult)CL(this,kL,"f").removeEventListener("message",t),e(n.data.isDeterminstic)};CL(this,kL,"f").addEventListener("message",t),CL(this,kL,"f").postMessage({messageType:bL.TestDeterminism})}))}createCar(e,t,n,i,r,a){var o,s;if(null==CL(this,_L,"f"))throw"TrackPartManager is not initialized";if(null==Uv.models)throw"Car collision model not loaded";const l=(AL(this,SL,(s=CL(this,SL,"f"),o=s++,s),"f"),o),c=e=>{if(e.data.messageType==bL.UpdateResult){e.data.carStates.forEach((e=>{e.id==l&&a(e)}))}};CL(this,kL,"f").addEventListener("message",c),CL(this,ML,"f").set(l,c),CL(this,kL,"f").postMessage({messageType:bL.CreateCar,mountainVertices:t,mountainOffset:{x:n.x,y:n.y,z:n.z},trackData:i.toSaveString(CL(this,_L,"f")),carId:l,carCollisionShapeVertices:Uv.models.collisionShapeVertices,carMassOffset:Uv.massOffset,carPosition:{x:e.position.x,y:e.position.y,z:e.position.z},carQuaternion:{x:e.quaternion.x,y:e.quaternion.y,z:e.quaternion.z,w:e.quaternion.w},carRecording:null==r?void 0:r.serialize()});const h=.11898833513259888,d=[new Un(.627909,.15101166486740114,1.3478).applyQuaternion(e.quaternion).add(e.position),new Un(-.627909,.15101166486740114,1.3478).applyQuaternion(e.quaternion).add(e.position),new Un(.720832,.15101166486740114,-1.52686).applyQuaternion(e.quaternion).add(e.position),new Un(-.720832,.15101166486740114,-1.52686).applyQuaternion(e.quaternion).add(e.position)],u=[(new Dn).setFromEuler((new _i).set(0,Math.PI,0)).multiply(e.quaternion),(new Dn).setFromEuler((new _i).set(0,Math.PI,0)).multiply(e.quaternion),(new Dn).setFromEuler((new _i).set(0,Math.PI,0)).multiply(e.quaternion),(new Dn).setFromEuler((new _i).set(0,Math.PI,0)).multiply(e.quaternion)];return{id:l,frames:0,totalFrames:0,speedKmh:0,hasStarted:!1,hasFinished:!1,nextCheckpointIndex:0,position:{x:e.position.x,y:e.position.y,z:e.position.z},quaternion:{x:e.quaternion.x,y:e.quaternion.y,z:e.quaternion.z,w:e.quaternion.w},collisionImpulses:[],wheelInContact:[!1,!1,!1,!1],wheelSuspensionLength:[h,h,h,h],wheelSuspensionVelocity:[0,0,0,0],wheelRotation:[0,0,0,0],wheelDeltaRotation:[0,0,0,0],wheelSkidInfo:[0,0,0,0],wheelPosition:d,wheelQuaternion:u,brakeLightEnabled:!1,controls:{up:!1,right:!1,down:!1,left:!1}}}deleteCar(e){CL(this,kL,"f").postMessage({messageType:bL.DeleteCar,carId:e});const t=CL(this,ML,"f").get(e);if(null==t)throw"Deleting non-existant car";CL(this,kL,"f").removeEventListener("message",t),CL(this,ML,"f").delete(e)}startCar(e,t){CL(this,kL,"f").postMessage({messageType:bL.StartCar,carId:e,targetSimulationTimeFrames:null==t?void 0:t.numberOfFrames})}controlCar(e,t,n,i,r){CL(this,kL,"f").postMessage({messageType:bL.ControlCar,carId:e,up:t,right:n,down:i,left:r})}pauseCar(e,t){CL(this,kL,"f").postMessage({messageType:bL.PauseCar,carId:e,isPaused:t})}};var RL=n(796),LL={};LL.styleTagTransform=u(),LL.setAttributes=l(),LL.insert=o().bind(null,"head"),LL.domAPI=r(),LL.insertStyleElement=h();t()(RL.A,LL);RL.A&&RL.A.locals&&RL.A.locals;var IL,NL,DL,UL,BL=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},OL=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};IL=new WeakMap,NL=new WeakMap,DL=new WeakMap,UL=new WeakMap;const zL=class{constructor(e,t){IL.set(this,void 0),NL.set(this,void 0),DL.set(this,void 0),UL.set(this,void 0),BL(this,IL,document.getElementById("ui"),"f"),BL(this,NL,document.createElement("div"),"f"),OL(this,NL,"f").className="verifier-ui",OL(this,IL,"f").appendChild(OL(this,NL,"f")),BL(this,DL,document.createElement("p"),"f"),OL(this,NL,"f").appendChild(OL(this,DL,"f"));const n=document.createElement("button");n.className="button",n.textContent="Stop",n.addEventListener("click",(()=>{e.playUIClick(),t()})),OL(this,NL,"f").appendChild(n),window.addEventListener("keydown",BL(this,UL,(e=>{"Escape"==e.code&&(t(),e.preventDefault())}),"f"))}dispose(){OL(this,IL,"f").removeChild(OL(this,NL,"f")),window.removeEventListener("keydown",OL(this,UL,"f"))}setText(e){OL(this,DL,"f").textContent=e}};var FL,WL,HL,VL,GL,jL,qL,XL,YL,KL,ZL,JL,QL,$L,eI,tI,nI,iI,rI,aI,oI,sI,lI,cI,hI,dI,uI,pI,fI=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},mI=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};WL=new WeakMap,HL=new WeakMap,VL=new WeakMap,GL=new WeakMap,jL=new WeakMap,qL=new WeakMap,XL=new WeakMap,YL=new WeakMap,KL=new WeakMap,ZL=new WeakMap,JL=new WeakMap,QL=new WeakMap,$L=new WeakMap,eI=new WeakMap,tI=new WeakMap,nI=new WeakMap,iI=new WeakMap,rI=new WeakMap,aI=new WeakMap,oI=new WeakMap,sI=new WeakMap,lI=new WeakMap,cI=new WeakMap,hI=new WeakMap,FL=new WeakSet,dI=function(e){const t=mI(this,KL,"f").slice();do{const n=Math.floor(Math.random()*t.length),i=t.splice(n,1)[0];if(e>i.timeout)return i}while(t.length>0);return null},uI=function(){var e;const t=new Date;if(!mI(this,QL,"f")&&mI(this,JL,"f").length<mI(this,sI,"f")&&Math.abs(t.getTime()-mI(this,$L,"f").getTime())>=mI(this,lI,"f")){fI(this,QL,!0,"f"),fI(this,$L,t,"f");const n=mI(this,FL,"m",dI).call(this,t);null!=n||mI(this,ZL,"f").length>0&&0==mI(this,JL,"f").length||mI(this,ZL,"f").length>mI(this,oI,"f")?mI(this,GL,"f").verifyRecordings(mI(this,qL,"f"),null!==(e=null==n?void 0:n.id)&&void 0!==e?e:null,mI(this,cI,"f"),mI(this,ZL,"f")).then((({unverifiedRecordings:e,exhaustive:i})=>{mI(this,ZL,"f").length=0,null!=n&&(fI(this,JL,mI(this,JL,"f").concat(e.map((({id:e,recording:t,frames:i})=>({trackData:n.data,recordingId:e,recording:Ag.deserialize(t),time:new rp(i)})))),"f"),i&&(n.timeout=new Date(t.getTime()+Math.floor(6e4*(30+30*Math.random())))))})).catch((e=>{console.error(e),mI(this,GL,"f").getUser(mI(this,qL,"f")).then((e=>{null!=e&&e.isVerifier||fI(this,eI,!1,"f")}))})).finally((()=>{fI(this,QL,!1,"f")})):fI(this,QL,!1,"f")}},pI=function(){mI(this,jL,"f").hasLoaded()&&mI(this,eI,"f")&&(mI(this,FL,"m",uI).call(this),mI(this,YL,"f").forEach((e=>{var t;if(!e.isBusy&&mI(this,JL,"f").length>0){e.isBusy=!0;const{trackData:n,recordingId:i,recording:r,time:a}=mI(this,JL,"f").splice(0,1)[0];null==r?(mI(this,ZL,"f").push({id:i,verifiedState:!1}),e.isBusy=!1):(fI(this,iI,(t=mI(this,iI,"f"),++t),"f"),e.simulation.validate(n,r,a).then((e=>{var t,n;fI(this,rI,(t=mI(this,rI,"f"),++t),"f"),e||fI(this,aI,(n=mI(this,aI,"f"),++n),"f"),mI(this,ZL,"f").push({id:i,verifiedState:e})})).catch((e=>{if(!mI(this,nI,"f"))throw e})).finally((()=>{var t;e.isBusy=!1,fI(this,iI,(t=mI(this,iI,"f"),--t),"f")})))}})))};const gI=class{constructor(e,t,n,i,r,a,o,s,l){FL.add(this),WL.set(this,void 0),HL.set(this,void 0),VL.set(this,void 0),GL.set(this,void 0),jL.set(this,void 0),qL.set(this,void 0),XL.set(this,void 0),YL.set(this,[]),KL.set(this,[]),ZL.set(this,[]),JL.set(this,[]),QL.set(this,!1),$L.set(this,new Date),eI.set(this,!0),tI.set(this,void 0),nI.set(this,!1),iI.set(this,0),rI.set(this,0),aI.set(this,0),oI.set(this,100),sI.set(this,100),lI.set(this,1e3),cI.set(this,new rp(6e5)),hI.set(this,4),fI(this,WL,e,"f"),fI(this,HL,t,"f"),fI(this,VL,a,"f"),fI(this,GL,n,"f"),fI(this,jL,o,"f"),fI(this,qL,s,"f"),t.clear(),fI(this,XL,new zL(e,l),"f"),navigator&&navigator.hardwareConcurrency>0&&fI(this,hI,navigator.hardwareConcurrency,"f");for(let e=0;e<mI(this,hI,"f");e++)mI(this,YL,"f").push({simulation:new PL(r,mI(this,jL,"f")),isBusy:!1});i.forEach(((e,t,n)=>{mI(this,KL,"f").push({id:e,name:t,data:n,timeout:new Date})})),fI(this,tI,setInterval((()=>{mI(this,FL,"m",pI).call(this)}),10),"f")}dispose(){fI(this,nI,!0,"f"),mI(this,XL,"f").dispose(),mI(this,YL,"f").forEach((e=>{e.simulation.dispose()})),mI(this,YL,"f").length=0,clearInterval(mI(this,tI,"f"))}update(e){if(mI(this,jL,"f").hasLoaded()){const e=new Date;let t="";mI(this,eI,"f")?(t+="Recordings are being verified...\n",t+="\nNumber of threads: "+mI(this,hI,"f"),t+="\n",t+="\nBacklog: "+mI(this,JL,"f").length,t+="\nProcessing: "+mI(this,iI,"f"),t+="\nRecordings verified: "+mI(this,rI,"f"),t+="\nInvalid recordings found: "+mI(this,aI,"f"),t+="\n",t+="\nTracks",mI(this,KL,"f").forEach((n=>{const i=e<=n.timeout;t+=i?"\n\tEmpty\t- "+n.name:"\n\tProcessing\t- "+n.name}))):t+="Error: User is no longer a verifier",mI(this,XL,"f").setText(t)}mI(this,WL,"f").update(e,!1,mI(this,HL,"f"),mI(this,VL,"f"))}},vI={Checkpoints:"النقاط التفتيشية","Checkpoint order":"ترتيب النقاط التفتيشية",Height:"الارتفاع",Exit:"خروج",Random:"عشوائي",Primary:"أساسي",Secondary:"ثانوي",Frame:"الإطار",Rims:"الجنوط",Test:"اختبار","Starting point is missing!":"نقطة البداية مفقودة!",Generate:"إنشاء","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"هل أنت متأكد من أنك تريد إنشاء مسار جديد؟\n\nسيتم فقدان المسار الحالي!",Load:"تحميل",Save:"حفظ","Are you sure you want to load a new track?\n\nYour current track will be lost!":"هل أنت متأكد من أنك تريد تحميل مسار جديد؟\n\nسيتم فقدان المسار الحالي!","Failed to save - Track name is needed!":"فشل الحفظ - اسم المسار مطلوب!","Track saved!":"تم حفظ المسار!","Failed to save!":"فشل الحفظ!",'Are you sure you want to overwrite "{0}"?':'هل أنت متأكد من أنك تريد الكتابة فوق "{0}"؟',Export:"تصدير","Failed to export - Track name is needed!":"فشل التصدير - اسم المسار مطلوب!",Help:"مساعدة","Track name":"اسم المسار","Are you sure you want to exit the editor?":"هل أنت متأكد من أنك تريد الخروج من المحرر؟","All unsaved data will be lost!":"سيتم فقدان جميع البيانات غير المحفوظة!","How to use the editor":"كيفية استخدام المحرر","Camera controls":"ضوابط الكاميرا","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"يمكن تحريك الكاميرا بالنقر بزر الماوس الأيمن وسحب الماوس. قم بتدوير الكاميرا بالنقر على زر الماوس الأوسط (عجلة الماوس) أو بالضغط على مفتاح التحكم والنقر بزر الماوس الأيمن وسحب الماوس. قم بالتكبير والتصغير عن طريق تمرير عجلة الماوس.","Alternatively, the camera can also be controlled using the following keyboard keys:":"بدلاً من ذلك، يمكن أيضًا التحكم في الكاميرا باستخدام مفاتيح لوحة المفاتيح التالية:","Move forwards:":"تحرك للأمام:","Move backwards:":"تحرك للخلف:","Move left:":"تحرك لليسار:","Move right:":"تحرك لليمين:","Rotate left:":"تدوير لليسار:","Rotate right:":"تدوير لليمين:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"يمكن تغيير الارتفاع المحرر إما باستخدام اختيار الارتفاع في الزاوية السفلية اليسرى، أو بالضغط على مفتاح Shift وتمرير عجلة الماوس. بدلاً من ذلك، يمكنك استخدام مفاتيح لوحة المفاتيح التالية:","Move up:":"تحرك لأعلى:","Move down:":"تحرك لأسفل:",Editing:"تحرير","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"يمكن اختيار أجزاء المسار في القائمة الموجودة على اليمين وبعد ذلك يمكن وضعها بالنقر بزر الماوس الأيسر.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"بدلاً من ذلك، يمكن اختيار جزء المسار الذي يتم تحويمه حاليًا بواسطة الماوس باستخدام اختصار لوحة المفاتيح التالي:","The selected part can then be rotated using the following keyboard shortcut:":"يمكن بعد ذلك تدوير الجزء المحدد باستخدام اختصار لوحة المفاتيح التالي:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"يمكن حذف أجزاء المسار باستخدام أداة الحذف في القائمة الجانبية اليمنى أو بالضغط على المفتاح التالي:","Starting points, checkpoints and the finish line":"نقاط البداية ونقاط التفتيش وخط النهاية","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"يمكن اختيار نقاط البداية ونقاط التفتيش وخطوط النهاية جميعها في الفئة العليا في القائمة الجانبية اليمنى.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"يجب أن يحتوي كل مسار على نقطة بداية واحدة على الأقل. إذا كانت هناك نقاط بداية متعددة، فسيتم استخدام آخر نقطة تم وضعها.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"يجب وضع نقاط التفتيش بين نقطة البداية وخط النهاية. عند اختيار جزء مسار نقطة التفتيش، سيكون هناك أداة في الزاوية السفلية اليمنى لاختيار ترتيب نقطة التفتيش. يحدد هذا الترتيب الذي يجب أن تمر به نقاط التفتيش قبل القيادة إلى خط النهاية. لاحظ أنه من الممكن أن يكون هناك نقاط تفتيش متعددة بنفس ترتيب نقطة التفتيش.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"خط النهاية هو المكان الذي ينتهي فيه المسار ولكنه سيصبح نشطًا فقط بعد اجتياز جميع نقاط التفتيش. من الممكن أيضًا أن يكون هناك خطوط نهاية متعددة.","Starting point":"نقطة البداية",Checkpoint:"نقطة التفتيش","Finish line":"خط النهاية","Exporting the track":"تصدير المسار","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"عند الانتهاء من المسار، يمكن إدخال اسم للمسار في الزاوية العلوية اليسرى وبعد ذلك يمكن تصدير المسار باستخدام زر التصدير. سيظهر رمز المسار الذي يمكن إرساله إلى مستخدمين آخرين حتى يتمكنوا من استيراد وتشغيل المسار.",Close:"إغلاق","Not set":"غير محدد",or:"أو","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"يمكن تحريك الكاميرا بالنقر بزر الماوس الأيمن وسحب الماوس. قم بتدوير الكاميرا بالنقر على زر الماوس الأوسط (عجلة الماوس) أو بالضغط على مفتاح التحكم والنقر بزر الماوس الأيمن وسحب الماوس. قم بالتكبير والتصغير عن طريق تمرير عجلة الماوس.","The edited height can be changed by using the height selection in the bottom left corner.":"يمكن تغيير الارتفاع المحرر باستخدام اختيار الارتفاع في الزاوية السفلية اليسرى.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"يمكن اختيار أجزاء المسار في القائمة الموجودة على اليمين وبعد ذلك يمكن وضعها بالنقر على الشاشة.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"يمكن بعد ذلك تدوير الجزء المحدد بالنقر على زر الدوران في الزاوية السفلية اليسرى.","Track parts can be deleted by using the delete tool in the right side menu.":"يمكن حذف أجزاء المسار باستخدام أداة الحذف في القائمة الجانبية اليمنى.","Press [{0}] or [{1}] to restart":"اضغط [{0}] أو [{1}] لإعادة البدء","Press [{0}] to restart":"اضغط [{0}] لإعادة البدء",Leaderboard:"التصنيف",Back:"عودة","Error: Failed to load leaderboard":"خطأ: فشل تحميل التصنيف",Verified:"تم التحقق",Invalid:"غير صالح",Pending:"قيد الانتظار",Loading:"جاري التحميل","Failed to load recording":"فشل تحميل التسجيل",Ok:"موافق","Track is missing starting point":"المسار يفتقد نقطة البداية","Failed to create user token.":"فشل في إنشاء رمز المستخدم.","Leaderboard is disabled.":"تم تعطيل لوحة المتصدرين.","Please try another browser or device.":"يرجى محاولة متصفح أو جهاز آخر.","Computer determinism check failed.":"فشل فحص التحديد الحاسوبي.",Customize:"تخصيص",Editor:"المحرر",Settings:"الإعدادات",Profile:"الملف الشخصي",Play:"تشغيل",Version:"الإصدار","You cannot have duplicate user profiles":"لا يمكنك امتلاك ملفات تعريف مستخدم مكررة","Failed to create user profile":"فشل في إنشاء ملف تعريف المستخدم","This user profile does not exist on the server":"هذا الملف الشخصي للمستخدم غير موجود على الخادم","Failed to download user profile from the server":"فشل في تحميل ملف تعريف المستخدم من الخادم","User token is invalid":"رمز المستخدم غير صالح","Are you sure you want to display your private key?":"هل أنت متأكد أنك تريد عرض المفتاح الخاص؟","DO NOT SHARE THIS KEY WITH ANYONE.":"لا تشارك هذا المفتاح مع أي شخص.","You need a free user profile slot to import a new user profile":"تحتاج إلى فتحة ملف تعريف مستخدم فارغة لاستيراد ملف تعريف مستخدم جديد",Nickname:"اسم المستخدم","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"اختر اسم مستخدم ليظهر في التصنيف. يمكنك تغيير اسم المستخدم في أي وقت.",Cancel:"إلغاء",Confirm:"تأكيد",Verifier:"التحقق","User ID":"معرف المستخدم",Profiles:"الملفات",'Are you sure you would like to delete "{0}"?':'هل أنت متأكد أنك تريد حذف "{0}"؟',Reset:"إعادة تعيين",Apply:"تطبيق",Gameplay:"أسلوب اللعب",Units:"الوحدات",Metric:"متري",Imperial:"إمبراطوري","Reset hint":"إعادة تعيين التلميح",Disabled:"معطل",Enabled:"مفعل","Ghost car":"سيارة الشبح","Cockpit camera mode":"وضع الكاميرا في القمرة",Hold:"استمرار",Toggle:"تبديل","Checkpoints position":"موقع النقاط الفارقة","Timer position":"موقع المؤقت","Speedometer position":"موقع عداد السرعة",Bottom:"أسفل",Top:"أعلى",Language:"اللغة",Graphics:"الجرافيكس","Car shadow":"ظل السيارة","Track shadow":"ظل المسار",Off:"إيقاف",On:"تشغيل",Low:"منخفض",Medium:"متوسط",High:"عالي",Clouds:"السحب",Particles:"الجسيمات",Skidmarks:"علامات الانزلاق","Render scale":"مقياس الرسم","Anti-aliasing (requires restart)":"تمويه الحواف (يتطلب إعادة التشغيل)",Audio:"الصوت","Sound effect volume":"مستوى تأثير الصوت","Music volume":"مستوى الموسيقى","Checkpoint volume":"مستوى نقطة التفتيش",Controls:"التحكم","Vehicle accelerate":"تسريع السيارة","Vehicle brake":"فرملة السيارة","Vehicle turn left":"دوران السيارة لليسار","Vehicle turn right":"دوران السيارة لليمين","Vehicle reset":"إعادة تعيين السيارة","Vehicle cockpit camera":"كاميرا قمرة السيارة","Hide UI":"إخفاء واجهة المستخدم","Editor rotate part":"تدوير الجزء في المحرر","Editor height modifier":"معدل الارتفاع في المحرر","Editor delete part":"حذف الجزء في المحرر","Editor forwards":"الانتقال للأمام في المحرر","Editor backwards":"الانتقال للخلف في المحرر","Editor left":"الانتقال لليسار في المحرر","Editor right":"الانتقال لليمين في المحرر","Editor rotate left":"تدوير المحرر إلى اليسار","Editor rotate right":"تدوير المحرر إلى اليمين","Editor move down":"تحريك المحرر للأسفل","Editor move up":"تحريك المحرر للأعلى","Editor test":"اختبار المحرر","Editor pick":"اختيار المحرر","Toggle FPS counter":"تبديل عداد الإطارات في الثانية","Toggle spectator camera":"تبديل كاميرا المشاهد","Spectator forwards":"الانتقال للأمام كمشاهد","Spectator backwards":"الانتقال للخلف كمشاهد","Spectator left":"الانتقال لليسار كمشاهد","Spectator right":"الانتقال لليمين كمشاهد","Spectator speed modifier":"معدل سرعة المشاهد","Press any key...\n\nPress [Escape] to cancel.":"اضغط على أي مفتاح...\n\nاضغط [إلغاء] للإلغاء.",Clear:"مسح","New record":"رقم قياسي جديد",Record:"الرقم القياسي",Current:"الحالي",Difference:"الفارق",Copy:"نسخ",Import:"استيراد","Failed to import track":"فشل استيراد المسار",'The track "{0}" already exists. Do you wish to overwrite it?':'المسار "{0}" موجود بالفعل. هل ترغب في الكتابة فوقه؟',Overwrite:"الكتابة فوقه","Paste track data here...":"الصق بيانات المسار هنا...",Rank:"التصنيف","No record":"لا يوجد تسجيل","Standard tracks":"المسارات القياسية","Custom tracks":"المسارات المخصصة",'Are you sure you want to delete "{0}"?':'هل أنت متأكد من أنك تريد حذف "{0}"ØŸ',Delete:"حذف"},wI={Checkpoints:"Kontrollpunkte","Checkpoint order":"Kontrollpunktreihenfolge",Height:"Höhe",Exit:"Beenden",Random:"Zufällig",Primary:"Primär",Secondary:"Sekundär",Frame:"Rahmen",Rims:"Felgen",Test:"Test","Starting point is missing!":"Startpunkt fehlt!",Generate:"Generieren","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"Sind Sie sicher, dass Sie eine neue Strecke generieren möchten?\n\nIhre aktuelle Strecke geht verloren!",Load:"Laden",Save:"Speichern","Are you sure you want to load a new track?\n\nYour current track will be lost!":"Sind Sie sicher, dass Sie eine neue Strecke laden möchten?\n\nIhre aktuelle Strecke geht verloren!","Failed to save - Track name is needed!":"Speichern fehlgeschlagen - Streckenname erforderlich!","Track saved!":"Strecke gespeichert!","Failed to save!":"Speichern fehlgeschlagen!",'Are you sure you want to overwrite "{0}"?':'Sind Sie sicher, dass Sie "{0}" überschreiben möchten?',Export:"Exportieren","Failed to export - Track name is needed!":"Export fehlgeschlagen - Streckenname erforderlich!",Help:"Hilfe","Track name":"Streckenname","Are you sure you want to exit the editor?":"Sind Sie sicher, dass Sie den Editor verlassen möchten?","All unsaved data will be lost!":"Alle nicht gespeicherten Daten gehen verloren!","How to use the editor":"Wie man den Editor benutzt","Camera controls":"Kamerasteuerung","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"Die Kamera kann durch Rechtsklick und Ziehen der Maus bewegt werden. Drehen Sie die Kamera, indem Sie die mittlere Maustaste (Mausrad) klicken oder die Steuerungstaste gedrückt halten und mit der rechten Maustaste ziehen. Zoomen Sie mit dem Mausrad rein und raus.","Alternatively, the camera can also be controlled using the following keyboard keys:":"Alternativ kann die Kamera auch mit den folgenden Tasten gesteuert werden:","Move forwards:":"Nach vorne bewegen:","Move backwards:":"Nach hinten bewegen:","Move left:":"Nach links bewegen:","Move right:":"Nach rechts bewegen:","Rotate left:":"Nach links drehen:","Rotate right:":"Nach rechts drehen:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"Die bearbeitete Höhe kann entweder durch Verwendung der Höhenauswahl in der unteren linken Ecke geändert werden oder indem Sie die Umschalttaste gedrückt halten und das Mausrad scrollen. Alternativ können Sie die folgenden Tasten verwenden:","Move up:":"Nach oben bewegen:","Move down:":"Nach unten bewegen:",Editing:"Bearbeiten","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"Streckenteile können im Menü auf der rechten Seite ausgewählt werden, danach können sie durch Linksklick mit der Maus platziert werden.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"Alternativ kann das Streckenteil, über das die Maus gerade schwebt, mit der folgenden Tastenkombination ausgewählt werden:","The selected part can then be rotated using the following keyboard shortcut:":"Das ausgewählte Teil kann dann mit der folgenden Tastenkombination gedreht werden:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"Streckenteile können mit dem Löschwerkzeug im Menü auf der rechten Seite gelöscht werden oder indem Sie die folgende Taste gedrückt halten:","Starting points, checkpoints and the finish line":"Startpunkte, Kontrollpunkte und die Ziellinie","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"Startpunkte, Kontrollpunkte und Ziellinien können alle in der obersten Kategorie im Menü auf der rechten Seite ausgewählt werden.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"Jede Strecke muss mindestens einen Startpunkt haben. Wenn es mehrere Startpunkte gibt, wird der zuletzt platzierte verwendet.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"Kontrollpunkte sollten zwischen dem Startpunkt und der Ziellinie platziert werden. Wenn ein Kontrollpunkt-Streckenteil ausgewählt ist, gibt es unten rechts ein Werkzeug, um die Reihenfolge des Kontrollpunkts auszuwählen. Dies bestimmt die Reihenfolge, in der die Kontrollpunkte passiert werden müssen, bevor man zur Ziellinie fährt. Beachten Sie, dass es möglich ist, mehrere Kontrollpunkte mit derselben Kontrollpunkt-Reihenfolge zu haben.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"Die Ziellinie ist der Ort, an dem die Strecke endet, wird aber erst aktiv, nachdem alle Kontrollpunkte passiert wurden. Es ist auch möglich, mehrere Ziellinien zu haben.","Starting point":"Startpunkt",Checkpoint:"Kontrollpunkt","Finish line":"Ziellinie","Exporting the track":"Exportieren der Strecke","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"Wenn die Strecke fertig ist, kann oben links ein Name für die Strecke eingegeben werden, danach kann die Strecke mit dem Export-Button exportiert werden. Dadurch wird ein Streckencode angezeigt, der an andere Benutzer gesendet werden kann, damit sie die Strecke importieren und spielen können.",Close:"Schließen","Not set":"Nicht festgelegt",or:"oder","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"Die Kamera kann durch Ziehen mit einem Finger bewegt werden. Drehen Sie die Kamera, indem Sie mit zwei Fingern ziehen. Zoomen Sie rein und raus, indem Sie kneifen.","The edited height can be changed by using the height selection in the bottom left corner.":"Die bearbeitete Höhe kann durch Verwendung der Höhenauswahl in der unteren linken Ecke geändert werden.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"Streckenteile können im Menü auf der rechten Seite ausgewählt werden, danach können sie durch Antippen des Bildschirms platziert werden.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"Das ausgewählte Teil kann dann durch Antippen der Drehen-Schaltfläche in der unteren linken Ecke gedreht werden.","Track parts can be deleted by using the delete tool in the right side menu.":"Streckenteile können mit dem Löschwerkzeug im Menü auf der rechten Seite gelöscht werden.","Press [{0}] or [{1}] to restart":"Drücken Sie [{0}] oder [{1}] zum Neustarten","Press [{0}] to restart":"Drücken Sie [{0}] zum Neustarten",Leaderboard:"Bestenliste",Back:"Zurück","Error: Failed to load leaderboard":"Fehler: Laden der Bestenliste fehlgeschlagen",Verified:"Verifiziert",Invalid:"Ungültig",Pending:"Ausstehend",Loading:"Laden","Failed to load recording":"Laden der Aufnahme fehlgeschlagen",Ok:"Ok","Track is missing starting point":"Strecke hat keinen Startpunkt","Failed to create user token.":"Fehler beim Erstellen des Benutzer-Token.","Leaderboard is disabled.":"Bestenliste ist deaktiviert.","Please try another browser or device.":"Bitte versuchen Sie einen anderen Browser oder ein anderes Gerät.","Computer determinism check failed.":"Der Computer-Determinismus-Check ist fehlgeschlagen.",Customize:"Anpassen",Editor:"Editor",Settings:"Einstellungen",Profile:"Profil",Play:"Spielen",Version:"Version","You cannot have duplicate user profiles":"Sie können keine doppelten Benutzerprofile haben","Failed to create user profile":"Benutzerprofil konnte nicht erstellt werden","This user profile does not exist on the server":"Dieses Benutzerprofil existiert nicht auf dem Server","Failed to download user profile from the server":"Benutzerprofil konnte nicht vom Server heruntergeladen werden","User token is invalid":"Benutzertoken ist ungültig","Are you sure you want to display your private key?":"Möchten Sie Ihren privaten Schlüssel wirklich anzeigen?","DO NOT SHARE THIS KEY WITH ANYONE.":"TEILEN SIE DIESEN SCHLÜSSEL NICHT MIT JEMANDEM.","You need a free user profile slot to import a new user profile":"Sie benötigen einen freien Benutzerprofil-Slot, um ein neues Benutzerprofil zu importieren",Nickname:"Spitzname","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"Wählen Sie einen Spitznamen, der in der Bestenliste angezeigt wird. Ihr Spitzname kann jederzeit geändert werden.",Cancel:"Abbrechen",Confirm:"Bestätigen",Verifier:"Verifizierer","User ID":"Benutzer-ID",Profiles:"Profile",'Are you sure you would like to delete "{0}"?':'Möchten Sie "{0}" wirklich löschen?',Reset:"Zurücksetzen",Apply:"Anwenden",Gameplay:"Spielablauf",Units:"Einheiten",Metric:"Metrisch",Imperial:"Imperial","Reset hint":"Hinweis zurücksetzen",Disabled:"Deaktiviert",Enabled:"Aktiviert","Ghost car":"Geisterauto","Cockpit camera mode":"Cockpit-Kameramodus",Hold:"Halten",Toggle:"Umschalten","Checkpoints position":"Position der Kontrollpunkte","Timer position":"Position des Timers","Speedometer position":"Position des Tachometers",Bottom:"Unten",Top:"Oben",Language:"Sprache",Graphics:"Grafik","Car shadow":"Auto-Schatten","Track shadow":"Strecken-Schatten",Off:"Aus",On:"An",Low:"Niedrig",Medium:"Mittel",High:"Hoch",Clouds:"Wolken",Particles:"Partikel",Skidmarks:"Reifenspuren","Render scale":"Render-Skalierung","Anti-aliasing (requires restart)":"Antialiasing (erfordert Neustart)",Audio:"Audio","Sound effect volume":"Lautstärke Soundeffekte","Music volume":"Lautstärke Musik","Checkpoint volume":"Lautstärke Kontrollpunkt",Controls:"Steuerung","Vehicle accelerate":"Fahrzeug beschleunigen","Vehicle brake":"Fahrzeug bremsen","Vehicle turn left":"Fahrzeug links lenken","Vehicle turn right":"Fahrzeug rechts lenken","Vehicle reset":"Fahrzeug zurücksetzen","Vehicle cockpit camera":"Fahrzeug-Cockpit-Kamera","Hide UI":"UI ausblenden","Editor rotate part":"Editor Teil drehen","Editor height modifier":"Editor Höhenmodifikator","Editor delete part":"Editor Teil löschen","Editor forwards":"Editor vorwärts","Editor backwards":"Editor rückwärts","Editor left":"Editor links","Editor right":"Editor rechts","Editor rotate left":"Editor nach links drehen","Editor rotate right":"Editor nach rechts drehen","Editor move down":"Editor nach unten bewegen","Editor move up":"Editor nach oben bewegen","Editor test":"Editor-Test","Editor pick":"Editor-Auswahl","Toggle FPS counter":"FPS-Zähler umschalten","Toggle spectator camera":"Zuschauer-Kamera umschalten","Spectator forwards":"Zuschauer vorwärts","Spectator backwards":"Zuschauer rückwärts","Spectator left":"Zuschauer links","Spectator right":"Zuschauer rechts","Spectator speed modifier":"Zuschauer-Geschwindigkeitsmodifikator","Press any key...\n\nPress [Escape] to cancel.":"Drücken Sie eine beliebige Taste...\n\nDrücken Sie [Escape], um abzubrechen.",Clear:"Löschen","New record":"Neuer Rekord",Record:"Rekord",Current:"Aktuell",Difference:"Differenz",Copy:"Kopieren",Import:"Importieren","Failed to import track":"Import der Strecke fehlgeschlagen",'The track "{0}" already exists. Do you wish to overwrite it?':'Die Strecke "{0}" existiert bereits. Möchten Sie sie überschreiben?',Overwrite:"Überschreiben","Paste track data here...":"Streckendaten hier einfügen...",Rank:"Rang","No record":"Kein Rekord","Standard tracks":"Standardstrecken","Custom tracks":"Benutzerdefinierte Strecken",'Are you sure you want to delete "{0}"?':'Sind Sie sicher, dass Sie "{0}" löschen möchten?',Delete:"Löschen"},yI={Checkpoints:"Checkpoints","Checkpoint order":"Checkpoint order",Height:"Height",Exit:"Exit",Random:"Random",Primary:"Primary",Secondary:"Secondary",Frame:"Frame",Rims:"Rims",Test:"Test","Starting point is missing!":"Starting point is missing!",Generate:"Generate","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"Are you sure you want to generate a new track?\n\nYour current track will be lost!",Load:"Load",Save:"Save","Are you sure you want to load a new track?\n\nYour current track will be lost!":"Are you sure you want to load a new track?\n\nYour current track will be lost!","Failed to save - Track name is needed!":"Failed to save - Track name is needed!","Track saved!":"Track saved!","Failed to save!":"Failed to save!",'Are you sure you want to overwrite "{0}"?':'Are you sure you want to overwrite "{0}"?',Export:"Export","Failed to export - Track name is needed!":"Failed to export - Track name is needed!",Help:"Help","Track name":"Track name","Are you sure you want to exit the editor?":"Are you sure you want to exit the editor?","All unsaved data will be lost!":"All unsaved data will be lost!","How to use the editor":"How to use the editor","Camera controls":"Camera controls","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.","Alternatively, the camera can also be controlled using the following keyboard keys:":"Alternatively, the camera can also be controlled using the following keyboard keys:","Move forwards:":"Move forwards:","Move backwards:":"Move backwards:","Move left:":"Move left:","Move right:":"Move right:","Rotate left:":"Rotate left:","Rotate right:":"Rotate right:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:","Move up:":"Move up:","Move down:":"Move down:",Editing:"Editing","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:","The selected part can then be rotated using the following keyboard shortcut:":"The selected part can then be rotated using the following keyboard shortcut:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:","Starting points, checkpoints and the finish line":"Starting points, checkpoints and the finish line","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.","Starting point":"Starting point",Checkpoint:"Checkpoint","Finish line":"Finish line","Exporting the track":"Exporting the track","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.",Close:"Close","Not set":"Not set",or:"or","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.","The edited height can be changed by using the height selection in the bottom left corner.":"The edited height can be changed by using the height selection in the bottom left corner.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"The selected part can then be rotated by tapping the rotate button in the bottom left corner.","Track parts can be deleted by using the delete tool in the right side menu.":"Track parts can be deleted by using the delete tool in the right side menu.","Press [{0}] or [{1}] to restart":"Press [{0}] or [{1}] to restart","Press [{0}] to restart":"Press [{0}] to restart",Leaderboard:"Leaderboard",Back:"Back","Error: Failed to load leaderboard":"Error: Failed to load leaderboard",Verified:"Verified",Invalid:"Invalid",Pending:"Pending",Loading:"Loading","Failed to load recording":"Failed to load recording",Ok:"Ok","Track is missing starting point":"Track is missing starting point","Failed to create user token.":"Failed to create user token.","Leaderboard is disabled.":"Leaderboard is disabled.","Please try another browser or device.":"Please try another browser or device.","Computer determinism check failed.":"Computer determinism check failed.",Customize:"Customize",Editor:"Editor",Settings:"Settings",Profile:"Profile",Play:"Play",Version:"Version","You cannot have duplicate user profiles":"You cannot have duplicate user profiles","Failed to create user profile":"Failed to create user profile","This user profile does not exist on the server":"This user profile does not exist on the server","Failed to download user profile from the server":"Failed to download user profile from the server","User token is invalid":"User token is invalid","Are you sure you want to display your private key?":"Are you sure you want to display your private key?","DO NOT SHARE THIS KEY WITH ANYONE.":"DO NOT SHARE THIS KEY WITH ANYONE.","You need a free user profile slot to import a new user profile":"You need a free user profile slot to import a new user profile",Nickname:"Nickname","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.",Cancel:"Cancel",Confirm:"Confirm",Verifier:"Verifier","User ID":"User ID",Profiles:"Profiles",'Are you sure you would like to delete "{0}"?':'Are you sure you would like to delete "{0}"?',Reset:"Reset",Apply:"Apply",Gameplay:"Gameplay",Units:"Units",Metric:"Metric",Imperial:"Imperial","Reset hint":"Reset hint",Disabled:"Disabled",Enabled:"Enabled","Ghost car":"Ghost car","Cockpit camera mode":"Cockpit camera mode",Hold:"Hold",Toggle:"Toggle","Checkpoints position":"Checkpoints position","Timer position":"Timer position","Speedometer position":"Speedometer position",Bottom:"Bottom",Top:"Top",Language:"Language",Graphics:"Graphics","Car shadow":"Car shadow","Track shadow":"Track shadow",Off:"Off",On:"On",Low:"Low",Medium:"Medium",High:"High",Clouds:"Clouds",Particles:"Particles",Skidmarks:"Skidmarks","Render scale":"Render scale","Anti-aliasing (requires restart)":"Anti-aliasing (requires restart)",Audio:"Audio","Sound effect volume":"Sound effect volume","Music volume":"Music volume","Checkpoint volume":"Checkpoint volume",Controls:"Controls","Vehicle accelerate":"Vehicle accelerate","Vehicle brake":"Vehicle brake","Vehicle turn left":"Vehicle turn left","Vehicle turn right":"Vehicle turn right","Vehicle reset":"Vehicle reset","Vehicle cockpit camera":"Vehicle cockpit camera","Hide UI":"Hide UI","Editor rotate part":"Editor rotate part","Editor height modifier":"Editor height modifier","Editor delete part":"Editor delete part","Editor forwards":"Editor forwards","Editor backwards":"Editor backwards","Editor left":"Editor left","Editor right":"Editor right","Editor rotate left":"Editor rotate left","Editor rotate right":"Editor rotate right","Editor move down":"Editor move down","Editor move up":"Editor move up","Editor test":"Editor test","Editor pick":"Editor pick","Toggle FPS counter":"Toggle FPS counter","Toggle spectator camera":"Toggle spectator camera","Spectator forwards":"Spectator forwards","Spectator backwards":"Spectator backwards","Spectator left":"Spectator left","Spectator right":"Spectator right","Spectator speed modifier":"Spectator speed modifier","Press any key...\n\nPress [Escape] to cancel.":"Press any key...\n\nPress [Escape] to cancel.",Clear:"Clear","New record":"New record",Record:"Record",Current:"Current",Difference:"Difference",Copy:"Copy",Import:"Import","Failed to import track":"Failed to import track",'The track "{0}" already exists. Do you wish to overwrite it?':'The track "{0}" already exists. Do you wish to overwrite it?',Overwrite:"Overwrite","Paste track data here...":"Paste track data here...",Rank:"Rank","No record":"No record","Standard tracks":"Standard tracks","Custom tracks":"Custom tracks",'Are you sure you want to delete "{0}"?':'Are you sure you want to delete "{0}"?',Delete:"Delete"},bI={Checkpoints:"Puntos de control","Checkpoint order":"Orden de puntos de control",Height:"Altura",Exit:"Salir",Random:"Aleatorio",Primary:"Primario",Secondary:"Secundario",Frame:"Marco",Rims:"Llantas",Test:"Prueba","Starting point is missing!":"¡Falta el punto de inicio!",Generate:"Generar","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"¿Estás seguro de que deseas generar una nueva pista?\n\n¡Tu pista actual se perderá!",Load:"Cargar",Save:"Guardar","Are you sure you want to load a new track?\n\nYour current track will be lost!":"¿Estás seguro de que deseas cargar una nueva pista?\n\n¡Tu pista actual se perderá!","Failed to save - Track name is needed!":"Error al guardar: ¡Se necesita un nombre para la pista!","Track saved!":"¡Pista guardada!","Failed to save!":"Error al guardar!",'Are you sure you want to overwrite "{0}"?':'¿Estás seguro de que deseas sobrescribir "{0}"?',Export:"Exportar","Failed to export - Track name is needed!":"Error al exportar: ¡Se necesita un nombre para la pista!",Help:"Ayuda","Track name":"Nombre de la pista","Are you sure you want to exit the editor?":"¿Estás seguro de que deseas salir del editor?","All unsaved data will be lost!":"¡Se perderán todos los datos no guardados!","How to use the editor":"Cómo usar el editor","Camera controls":"Controles de la cámara","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"La cámara se puede mover haciendo clic derecho y arrastrando el ratón. Gira la cámara haciendo clic con el botón central del ratón (rueda del ratón) o manteniendo presionada la tecla de control y haciendo clic derecho y arrastrando el ratón. Acércate y aléjate desplazando la rueda del ratón.","Alternatively, the camera can also be controlled using the following keyboard keys:":"Alternativamente, la cámara también se puede controlar usando las siguientes teclas del teclado:","Move forwards:":"Mover hacia adelante:","Move backwards:":"Mover hacia atrás:","Move left:":"Mover a la izquierda:","Move right:":"Mover a la derecha:","Rotate left:":"Girar a la izquierda:","Rotate right:":"Girar a la derecha:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"La altura editada se puede cambiar ya sea usando la selección de altura en la esquina inferior izquierda, o manteniendo presionada la tecla de mayúsculas y desplazando la rueda del ratón. Alternativamente, puedes usar las siguientes teclas del teclado:","Move up:":"Mover hacia arriba:","Move down:":"Mover hacia abajo:",Editing:"Edición","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"Las partes de la pista se pueden seleccionar en el menú de la derecha, después de lo cual se pueden colocar haciendo clic izquierdo con el ratón.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"Alternativamente, la parte de la pista actualmente sobrevolada por el ratón se puede seleccionar con el siguiente atajo de teclado:","The selected part can then be rotated using the following keyboard shortcut:":"La parte seleccionada se puede girar usando el siguiente atajo de teclado:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"Las partes de la pista se pueden eliminar usando la herramienta de eliminación en el menú del lado derecho o manteniendo presionada la siguiente tecla:","Starting points, checkpoints and the finish line":"Puntos de inicio, puntos de control y la línea de meta","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"Los puntos de inicio, puntos de control y líneas de meta se pueden seleccionar en la categoría superior del menú del lado derecho.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"Cada pista debe tener al menos un punto de inicio. Si hay varios puntos de inicio, se usará el último colocado.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"Los puntos de control deben colocarse entre el punto de inicio y la línea de meta. Cuando se selecciona una parte de la pista de punto de control, habrá una herramienta en la parte inferior derecha para seleccionar el orden del punto de control. Esto determina el orden en que se deben pasar los puntos de control antes de conducir hacia la línea de meta. Ten en cuenta que es posible tener varios puntos de control con el mismo orden de punto de control.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"La línea de meta es donde termina la pista, pero solo se activará después de que se hayan pasado todos los puntos de control. También es posible tener varias líneas de meta.","Starting point":"Punto de inicio",Checkpoint:"Punto de control","Finish line":"Línea de meta","Exporting the track":"Exportando la pista","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"Cuando la pista esté terminada, se puede ingresar un nombre para la pista en la parte superior izquierda, después de lo cual se puede exportar la pista usando el botón de exportación. Esto revelará un código de pista que se puede enviar a otros usuarios para que puedan importar y jugar la pista.",Close:"Cerrar","Not set":"No establecido",or:"o","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"La cámara se puede mover arrastrando con un dedo. Gira la cámara arrastrando con dos dedos. Acércate y aléjate pellizcando.","The edited height can be changed by using the height selection in the bottom left corner.":"La altura editada se puede cambiar usando la selección de altura en la esquina inferior izquierda.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"Las partes de la pista se pueden seleccionar en el menú de la derecha, después de lo cual se pueden colocar tocando la pantalla.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"La parte seleccionada se puede girar tocando el botón de rotación en la esquina inferior izquierda.","Track parts can be deleted by using the delete tool in the right side menu.":"Las partes de la pista se pueden eliminar usando la herramienta de eliminación en el menú del lado derecho.","Press [{0}] or [{1}] to restart":"Presiona [{0}] o [{1}] para reiniciar","Press [{0}] to restart":"Presiona [{0}] para reiniciar",Leaderboard:"Tabla de clasificación",Back:"Volver","Error: Failed to load leaderboard":"Error: No se pudo cargar la tabla de clasificación",Verified:"Verificado",Invalid:"Inválido",Pending:"Pendiente",Loading:"Cargando","Failed to load recording":"Error al cargar la grabación",Ok:"Aceptar","Track is missing starting point":"Falta el punto de inicio en la pista","Failed to create user token.":"No se pudo crear el token de usuario.","Leaderboard is disabled.":"El marcador está desactivado.","Please try another browser or device.":"Por favor, prueba otro navegador o dispositivo.","Computer determinism check failed.":"Falló la comprobación de determinismo del ordenador.",Customize:"Personalizar",Editor:"Editor",Settings:"Configuración",Profile:"Perfil",Play:"Jugar",Version:"Versión","You cannot have duplicate user profiles":"No puedes tener perfiles de usuario duplicados","Failed to create user profile":"No se pudo crear el perfil de usuario","This user profile does not exist on the server":"Este perfil de usuario no existe en el servidor","Failed to download user profile from the server":"No se pudo descargar el perfil de usuario desde el servidor","User token is invalid":"El token de usuario no es válido","Are you sure you want to display your private key?":"¿Estás seguro de que quieres mostrar tu clave privada?","DO NOT SHARE THIS KEY WITH ANYONE.":"NO COMPARTAS ESTA CLAVE CON NADIE.","You need a free user profile slot to import a new user profile":"Necesitas un espacio libre de perfil de usuario para importar un nuevo perfil de usuario",Nickname:"Apodo","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"Elige un apodo para que aparezca en la tabla de clasificación. Puedes cambiar tu apodo en cualquier momento.",Cancel:"Cancelar",Confirm:"Confirmar",Verifier:"Verificador","User ID":"ID de usuario",Profiles:"Perfiles",'Are you sure you would like to delete "{0}"?':'¿Estás seguro de que quieres eliminar "{0}"?',Reset:"Restablecer",Apply:"Aplicar",Gameplay:"Jugabilidad",Units:"Unidades",Metric:"Métrico",Imperial:"Imperial","Reset hint":"Restablecer pista",Disabled:"Desactivado",Enabled:"Activado","Ghost car":"Coche fantasma","Cockpit camera mode":"Modo de cámara en la cabina",Hold:"Mantener",Toggle:"Alternar","Checkpoints position":"Posición de los puntos de control","Timer position":"Posición del temporizador","Speedometer position":"Posición del velocímetro",Bottom:"Inferior",Top:"Superior",Language:"Idioma",Graphics:"Gráficos","Car shadow":"Sombra del coche","Track shadow":"Sombra de la pista",Off:"Apagar",On:"Encender",Low:"Bajo",Medium:"Medio",High:"Alto",Clouds:"Nubes",Particles:"Partículas",Skidmarks:"Marcas de derrape","Render scale":"Escala de renderizado","Anti-aliasing (requires restart)":"Anti-aliasing (requiere reinicio)",Audio:"Audio","Sound effect volume":"Volumen de efectos de sonido","Music volume":"Volumen de música","Checkpoint volume":"Volumen de puntos de control",Controls:"Controles","Vehicle accelerate":"Acelerar vehículo","Vehicle brake":"Frenar vehículo","Vehicle turn left":"Girar vehículo a la izquierda","Vehicle turn right":"Girar vehículo a la derecha","Vehicle reset":"Reiniciar vehículo","Vehicle cockpit camera":"Cámara en el interior del vehículo","Hide UI":"Ocultar interfaz de usuario","Editor rotate part":"Rotar pieza del editor","Editor height modifier":"Modificador de altura del editor","Editor delete part":"Eliminar pieza del editor","Editor forwards":"Avanzar en el editor","Editor backwards":"Retroceder en el editor","Editor left":"Moverse a la izquierda en el editor","Editor right":"Moverse a la derecha en el editor","Editor rotate left":"Girar editor a la izquierda","Editor rotate right":"Girar editor a la derecha","Editor move down":"Mover editor hacia abajo","Editor move up":"Mover editor hacia arriba","Editor test":"Prueba de editor","Editor pick":"Selección del editor","Toggle FPS counter":"Alternar contador de FPS","Toggle spectator camera":"Alternar cámara de espectador","Spectator forwards":"Avanzar como espectador","Spectator backwards":"Retroceder como espectador","Spectator left":"Moverse a la izquierda como espectador","Spectator right":"Moverse a la derecha como espectador","Spectator speed modifier":"Modificador de velocidad de espectador","Press any key...\n\nPress [Escape] to cancel.":"Presiona cualquier tecla...\n\nPresiona [Escape] para cancelar.",Clear:"Borrar","New record":"Nuevo récord",Record:"Récord",Current:"Actual",Difference:"Diferencia",Copy:"Copiar",Import:"Importar","Failed to import track":"Error al importar la pista",'The track "{0}" already exists. Do you wish to overwrite it?':'La pista "{0}" ya existe. ¿Deseas sobrescribirla?',Overwrite:"Sobrescribir","Paste track data here...":"Pegar datos de la pista aquí...",Rank:"Rango","No record":"Sin récord","Standard tracks":"Pistas estándar","Custom tracks":"Pistas personalizadas",'Are you sure you want to delete "{0}"?':'¿Estás seguro de que deseas eliminar "{0}"?',Delete:"Eliminar"},xI={Checkpoints:"Points de contrôle","Checkpoint order":"Ordre des points de contrôle",Height:"Hauteur",Exit:"Quitter",Random:"Aléatoire",Primary:"Principal",Secondary:"Secondaire",Frame:"Cadre",Rims:"Jantes",Test:"Test","Starting point is missing!":"Point de départ manquant !",Generate:"Générer","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"Êtes-vous sûr de vouloir générer une nouvelle piste ?\n\nVotre piste actuelle sera perdue !",Load:"Charger",Save:"Enregistrer","Are you sure you want to load a new track?\n\nYour current track will be lost!":"Êtes-vous sûr de vouloir charger une nouvelle piste ?\n\nVotre piste actuelle sera perdue !","Failed to save - Track name is needed!":"Échec de l'enregistrement - Le nom de la piste est nécessaire !","Track saved!":"Piste enregistrée !","Failed to save!":"Échec de l'enregistrement !",'Are you sure you want to overwrite "{0}"?':'Êtes-vous sûr de vouloir écraser "{0}" ?',Export:"Exporter","Failed to export - Track name is needed!":"Échec de l'exportation - Le nom de la piste est nécessaire !",Help:"Aide","Track name":"Nom de la piste","Are you sure you want to exit the editor?":"Êtes-vous sûr de vouloir quitter l'éditeur ?","All unsaved data will be lost!":"Toutes les données non sauvegardées seront perdues !","How to use the editor":"Comment utiliser l'éditeur","Camera controls":"Contrôles de la caméra","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"La caméra peut être déplacée en cliquant avec le bouton droit et en faisant glisser la souris. Faites pivoter la caméra en cliquant sur le bouton central de la souris (molette) ou en maintenant la touche de contrôle enfoncée et en cliquant avec le bouton droit et en faisant glisser la souris. Zoomez en avant et en arrière en faisant défiler la molette de la souris.","Alternatively, the camera can also be controlled using the following keyboard keys:":"Alternativement, la caméra peut également être contrôlée en utilisant les touches de clavier suivantes :","Move forwards:":"Avancer :","Move backwards:":"Reculer :","Move left:":"Déplacer à gauche :","Move right:":"Déplacer à droite :","Rotate left:":"Pivoter à gauche :","Rotate right:":"Pivoter à droite :","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"La hauteur modifiée peut être changée en utilisant la sélection de hauteur dans le coin inférieur gauche, ou en maintenant la touche Maj enfoncée et en faisant défiler la molette de la souris. Alternativement, vous pouvez utiliser les touches de clavier suivantes :","Move up:":"Monter :","Move down:":"Descendre :",Editing:"Édition","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"Les parties de la piste peuvent être sélectionnées dans le menu de droite, après quoi elles peuvent être placées en cliquant avec le bouton gauche de la souris.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"Alternativement, la partie de la piste actuellement survolée par la souris peut être sélectionnée avec le raccourci clavier suivant :","The selected part can then be rotated using the following keyboard shortcut:":"La partie sélectionnée peut ensuite être pivotée en utilisant le raccourci clavier suivant :","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"Les parties de la piste peuvent être supprimées en utilisant l'outil de suppression dans le menu de droite ou en maintenant la touche suivante enfoncée :","Starting points, checkpoints and the finish line":"Points de départ, points de contrôle et ligne d'arrivée","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"Les points de départ, les points de contrôle et les lignes d'arrivée peuvent tous être sélectionnés dans la catégorie la plus haute du menu de droite.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"Chaque piste doit avoir au moins un point de départ. S'il y a plusieurs points de départ, le dernier placé sera utilisé.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"Les points de contrôle doivent être placés entre le point de départ et la ligne d'arrivée. Lorsqu'une partie de la piste de point de contrôle est sélectionnée, il y aura un outil en bas à droite pour sélectionner l'ordre du point de contrôle. Cela détermine l'ordre dans lequel les points de contrôle doivent être passés avant de conduire jusqu'à la ligne d'arrivée. Notez qu'il est possible d'avoir plusieurs points de contrôle avec le même ordre de point de contrôle.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"La ligne d'arrivée est l'endroit où la piste se termine mais ne deviendra active qu'après que tous les points de contrôle aient été passés. Il est également possible d'avoir plusieurs lignes d'arrivée.","Starting point":"Point de départ",Checkpoint:"Point de contrôle","Finish line":"Ligne d'arrivée","Exporting the track":"Exportation de la piste","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"Lorsque la piste est terminée, un nom pour la piste peut être entré en haut à gauche, après quoi la piste peut être exportée en utilisant le bouton d'exportation. Cela révélera un code de piste qui peut être envoyé à d'autres utilisateurs afin qu'ils puissent importer et jouer la piste.",Close:"Fermer","Not set":"Non défini",or:"ou","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"La caméra peut être déplacée en faisant glisser un doigt. Faites pivoter la caméra en faisant glisser deux doigts. Zoomez avant et arrière en pinçant.","The edited height can be changed by using the height selection in the bottom left corner.":"La hauteur modifiée peut être changée en utilisant la sélection de hauteur dans le coin inférieur gauche.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"Les parties de la piste peuvent être sélectionnées dans le menu de droite, après quoi elles peuvent être placées en tapant sur l'écran.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"La partie sélectionnée peut ensuite être pivotée en tapant sur le bouton de rotation dans le coin inférieur gauche.","Track parts can be deleted by using the delete tool in the right side menu.":"Les parties de la piste peuvent être supprimées en utilisant l'outil de suppression dans le menu de droite.","Press [{0}] or [{1}] to restart":"Appuyez sur [{0}] ou [{1}] pour redémarrer","Press [{0}] to restart":"Appuyez sur [{0}] pour redémarrer",Leaderboard:"Classement",Back:"Retour","Error: Failed to load leaderboard":"Erreur : Échec du chargement du classement",Verified:"Vérifié",Invalid:"Invalide",Pending:"En attente",Loading:"Chargement","Failed to load recording":"Échec du chargement de l'enregistrement",Ok:"OK","Track is missing starting point":"La piste n'a pas de point de départ","Failed to create user token.":"Échec de la création du jeton d'utilisateur.","Leaderboard is disabled.":"Le classement est désactivé.","Please try another browser or device.":"Veuillez essayer un autre navigateur ou appareil.","Computer determinism check failed.":"Échec de la vérification du déterminisme de l'ordinateur.",Customize:"Personnaliser",Editor:"Éditeur",Settings:"Paramètres",Profile:"Profil",Play:"Jouer",Version:"Version","You cannot have duplicate user profiles":"Vous ne pouvez pas avoir de profils d'utilisateur en double","Failed to create user profile":"Échec de la création du profil utilisateur","This user profile does not exist on the server":"Ce profil utilisateur n'existe pas sur le serveur","Failed to download user profile from the server":"Échec du téléchargement du profil utilisateur depuis le serveur","User token is invalid":"Le jeton utilisateur n'est pas valide","Are you sure you want to display your private key?":"Êtes-vous sûr de vouloir afficher votre clé privée ?","DO NOT SHARE THIS KEY WITH ANYONE.":"NE PARTAGEZ PAS CETTE CLÉ AVEC PERSONNE.","You need a free user profile slot to import a new user profile":"Vous avez besoin d'un emplacement de profil utilisateur libre pour importer un nouveau profil utilisateur",Nickname:"Pseudonyme","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"Choisissez un pseudonyme à afficher dans le classement. Vous pouvez changer votre pseudonyme à tout moment.",Cancel:"Annuler",Confirm:"Confirmer",Verifier:"Vérificateur","User ID":"ID utilisateur",Profiles:"Profils",'Are you sure you would like to delete "{0}"?':'Êtes-vous sûr de vouloir supprimer "{0}"?',Reset:"Réinitialiser",Apply:"Appliquer",Gameplay:"Jouabilité",Units:"Unités",Metric:"Métrique",Imperial:"Impérial","Reset hint":"Réinitialiser l'astuce",Disabled:"Désactivé",Enabled:"Activé","Ghost car":"Voiture fantôme","Cockpit camera mode":"Mode caméra cockpit",Hold:"Maintenir",Toggle:"Basculer","Checkpoints position":"Position des checkpoints","Timer position":"Position du minuteur","Speedometer position":"Position du compteur de vitesse",Bottom:"Bas",Top:"Haut",Language:"Langue",Graphics:"Graphismes","Car shadow":"Ombre de la voiture","Track shadow":"Ombre de la piste",Off:"Désactivé",On:"Activé",Low:"Faible",Medium:"Moyen",High:"Élevé",Clouds:"Nuages",Particles:"Particules",Skidmarks:"Marques de dérapage","Render scale":"Échelle de rendu","Anti-aliasing (requires restart)":"Anticrénelage (nécessite un redémarrage)",Audio:"Audio","Sound effect volume":"Volume des effets sonores","Music volume":"Volume de la musique","Checkpoint volume":"Volume des points de contrôle",Controls:"Commandes","Vehicle accelerate":"Accélérer le véhicule","Vehicle brake":"Freiner le véhicule","Vehicle turn left":"Tourner à gauche","Vehicle turn right":"Tourner à droite","Vehicle reset":"Réinitialiser le véhicule","Vehicle cockpit camera":"Caméra du cockpit du véhicule","Hide UI":"Masquer l'interface utilisateur","Editor rotate part":"Tourner la pièce de l'éditeur","Editor height modifier":"Modificateur de hauteur de l'éditeur","Editor delete part":"Supprimer la pièce de l'éditeur","Editor forwards":"Avancer dans l'éditeur","Editor backwards":"Reculer dans l'éditeur","Editor left":"Aller à gauche dans l'éditeur","Editor right":"Aller à droite dans l'éditeur","Editor rotate left":"Tourner l'éditeur à gauche","Editor rotate right":"Tourner l'éditeur à droite","Editor move down":"Déplacer l'éditeur vers le bas","Editor move up":"Déplacer l'éditeur vers le haut","Editor test":"Test de l'éditeur","Editor pick":"Sélection de l'éditeur","Toggle FPS counter":"Activer/désactiver le compteur FPS","Toggle spectator camera":"Activer/désactiver la caméra du spectateur","Spectator forwards":"Spectateur - Avancer","Spectator backwards":"Spectateur - Reculer","Spectator left":"Spectateur - Aller à gauche","Spectator right":"Spectateur - Aller à droite","Spectator speed modifier":"Modificateur de vitesse du spectateur","Press any key...\n\nPress [Escape] to cancel.":"Appuyez sur n'importe quelle touche...\n\nAppuyez sur [Échap] pour annuler.",Clear:"Effacer","New record":"Nouveau record",Record:"Record",Current:"Actuel",Difference:"Différence",Copy:"Copier",Import:"Importer","Failed to import track":"Échec de l'importation de la piste",'The track "{0}" already exists. Do you wish to overwrite it?':'La piste "{0}" existe déjà . Souhaitez-vous l\'écraser ?',Overwrite:"Écraser","Paste track data here...":"Collez les données de la piste ici...",Rank:"Classement","No record":"Pas de record","Standard tracks":"Pistes standard","Custom tracks":"Pistes personnalisées",'Are you sure you want to delete "{0}"?':'Êtes-vous sûr de vouloir supprimer "{0}" ?',Delete:"Supprimer"},_I={Checkpoints:"Checkpoint","Checkpoint order":"Ordine dei checkpoint",Height:"Altezza",Exit:"Esci",Random:"Casuale",Primary:"Primario",Secondary:"Secondario",Frame:"Telaio",Rims:"Cerchioni",Test:"Test","Starting point is missing!":"Punto di partenza mancante!",Generate:"Genera","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"Sei sicuro di voler generare un nuovo percorso?\n\nIl tuo percorso attuale verrà perso!",Load:"Carica",Save:"Salva","Are you sure you want to load a new track?\n\nYour current track will be lost!":"Sei sicuro di voler caricare un nuovo percorso?\n\nIl tuo percorso attuale verrà perso!","Failed to save - Track name is needed!":"Salvataggio non riuscito - È necessario un nome per il percorso!","Track saved!":"Percorso salvato!","Failed to save!":"Salvataggio non riuscito!",'Are you sure you want to overwrite "{0}"?':'Sei sicuro di voler sovrascrivere "{0}"?',Export:"Esporta","Failed to export - Track name is needed!":"Esportazione non riuscita - È necessario un nome per il percorso!",Help:"Aiuto","Track name":"Nome del percorso","Are you sure you want to exit the editor?":"Sei sicuro di voler uscire dall'editor?","All unsaved data will be lost!":"Tutti i dati non salvati andranno persi!","How to use the editor":"Come usare l'editor","Camera controls":"Controlli della telecamera","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"La telecamera può essere spostata facendo clic con il tasto destro del mouse e trascinando. Ruota la telecamera facendo clic con il pulsante centrale del mouse (rotella) o tenendo premuto il tasto di controllo e facendo clic con il tasto destro del mouse e trascinando. Zoom avanti e indietro scorrendo la rotella del mouse.","Alternatively, the camera can also be controlled using the following keyboard keys:":"In alternativa, la telecamera può essere controllata utilizzando i seguenti tasti della tastiera:","Move forwards:":"Muovi avanti:","Move backwards:":"Muovi indietro:","Move left:":"Muovi a sinistra:","Move right:":"Muovi a destra:","Rotate left:":"Ruota a sinistra:","Rotate right:":"Ruota a destra:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"L'altezza modificata può essere cambiata utilizzando la selezione dell'altezza nell'angolo in basso a sinistra, o tenendo premuto il tasto shift e scorrendo la rotella del mouse. In alternativa, puoi utilizzare i seguenti tasti della tastiera:","Move up:":"Muovi su:","Move down:":"Muovi giù:",Editing:"Modifica","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"Le parti del percorso possono essere selezionate nel menu a destra, dopodiché possono essere posizionate facendo clic con il tasto sinistro del mouse.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"In alternativa, la parte del percorso attualmente sotto il cursore del mouse può essere selezionata con la seguente scorciatoia da tastiera:","The selected part can then be rotated using the following keyboard shortcut:":"La parte selezionata può quindi essere ruotata utilizzando la seguente scorciatoia da tastiera:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"Le parti del percorso possono essere eliminate utilizzando lo strumento di eliminazione nel menu a destra o tenendo premuto il seguente tasto:","Starting points, checkpoints and the finish line":"Punti di partenza, checkpoint e linea di arrivo","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"I punti di partenza, i checkpoint e le linee di arrivo possono essere selezionati nella categoria più alta nel menu a destra.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"Ogni percorso deve avere almeno un punto di partenza. Se ci sono più punti di partenza, verrà utilizzato l'ultimo posizionato.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"I checkpoint devono essere posizionati tra il punto di partenza e la linea di arrivo. Quando viene selezionata una parte del percorso checkpoint, ci sarà uno strumento in basso a destra per selezionare l'ordine del checkpoint. Questo determina l'ordine in cui i checkpoint devono essere superati prima di arrivare alla linea di arrivo. Nota che è possibile avere più checkpoint con lo stesso ordine di checkpoint.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"La linea di arrivo è dove finisce il percorso, ma diventerà attiva solo dopo che tutti i checkpoint sono stati superati. È anche possibile avere più linee di arrivo.","Starting point":"Punto di partenza",Checkpoint:"Checkpoint","Finish line":"Linea di arrivo","Exporting the track":"Esportazione del percorso","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"Quando il percorso è terminato, è possibile inserire un nome per il percorso in alto a sinistra, dopodiché il percorso può essere esportato utilizzando il pulsante di esportazione. Questo rivelerà un codice del percorso che può essere inviato ad altri utenti in modo che possano importare e giocare il percorso.",Close:"Chiudi","Not set":"Non impostato",or:"o","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"La telecamera può essere spostata trascinando con un dito. Ruota la telecamera trascinando con due dita. Zoom avanti e indietro pizzicando.","The edited height can be changed by using the height selection in the bottom left corner.":"L'altezza modificata può essere cambiata utilizzando la selezione dell'altezza nell'angolo in basso a sinistra.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"Le parti del percorso possono essere selezionate nel menu a destra, dopodiché possono essere posizionate toccando lo schermo.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"La parte selezionata può quindi essere ruotata toccando il pulsante di rotazione nell'angolo in basso a sinistra.","Track parts can be deleted by using the delete tool in the right side menu.":"Le parti del percorso possono essere eliminate utilizzando lo strumento di eliminazione nel menu a destra.","Press [{0}] or [{1}] to restart":"Premi [{0}] o [{1}] per riavviare","Press [{0}] to restart":"Premi [{0}] per riavviare",Leaderboard:"Classifica",Back:"Indietro","Error: Failed to load leaderboard":"Errore: impossibile caricare la classifica",Verified:"Verificato",Invalid:"Non valido",Pending:"In sospeso",Loading:"Caricamento","Failed to load recording":"Caricamento registrazione non riuscito",Ok:"Ok","Track is missing starting point":"Il percorso non ha un punto di partenza","Failed to create user token.":"Impossibile creare il token dell'utente.","Leaderboard is disabled.":"La classifica è disabilitata.","Please try another browser or device.":"Si prega di provare un altro browser o dispositivo.","Computer determinism check failed.":"Verifica del determinismo del computer fallita.",Customize:"Personalizza",Editor:"Editor",Settings:"Impostazioni",Profile:"Profilo",Play:"Gioca",Version:"Versione","You cannot have duplicate user profiles":"Non è possibile avere profili utente duplicati","Failed to create user profile":"Impossibile creare il profilo utente","This user profile does not exist on the server":"Questo profilo utente non esiste sul server","Failed to download user profile from the server":"Impossibile scaricare il profilo utente dal server","User token is invalid":"Token utente non valido","Are you sure you want to display your private key?":"Sei sicuro di voler mostrare la tua chiave privata?","DO NOT SHARE THIS KEY WITH ANYONE.":"NON CONDIVIDERE QUESTA CHIAVE CON NESSUNO.","You need a free user profile slot to import a new user profile":"Hai bisogno di uno slot di profilo utente libero per importare un nuovo profilo utente",Nickname:"Nickname","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"Scegli un nickname da mostrare nella classifica. Puoi cambiarlo in qualsiasi momento.",Cancel:"Annulla",Confirm:"Conferma",Verifier:"Verificatore","User ID":"ID Utente",Profiles:"Profili",'Are you sure you would like to delete "{0}"?':'Sei sicuro di voler eliminare "{0}"?',Reset:"Resetta",Apply:"Applica",Gameplay:"Modalità di gioco",Units:"Unità ",Metric:"Metrico",Imperial:"Imperiale","Reset hint":"Resetta suggerimento",Disabled:"Disattivato",Enabled:"Attivato","Ghost car":"Auto fantasma","Cockpit camera mode":"Modalità telecamera cabina",Hold:"Tieni",Toggle:"Attiva/Disattiva","Checkpoints position":"Posizione dei checkpoint","Timer position":"Posizione del timer","Speedometer position":"Posizione del contagiri",Bottom:"In basso",Top:"In alto",Language:"Lingua",Graphics:"Grafica","Car shadow":"Ombra dell'auto","Track shadow":"Ombra del percorso",Off:"Disattivato",On:"Attivato",Low:"Basso",Medium:"Medio",High:"Alto",Clouds:"Nuvole",Particles:"Particelle",Skidmarks:"Segni di frenata","Render scale":"Scala di rendering","Anti-aliasing (requires restart)":"Anti-aliasing (richiede riavvio)",Audio:"Audio","Sound effect volume":"Volume degli effetti sonori","Music volume":"Volume della musica","Checkpoint volume":"Volume dei checkpoint",Controls:"Controlli","Vehicle accelerate":"Accelerare veicolo","Vehicle brake":"Frenare veicolo","Vehicle turn left":"Sterzare a sinistra","Vehicle turn right":"Sterzare a destra","Vehicle reset":"Riporta veicolo","Vehicle cockpit camera":"Visuale cabina veicolo","Hide UI":"Nascondi UI","Editor rotate part":"Ruota parte nell'editor","Editor height modifier":"Modifica altezza nell'editor","Editor delete part":"Elimina parte nell'editor","Editor forwards":"Avanti nell'editor","Editor backwards":"Indietro nell'editor","Editor left":"Sinistra nell'editor","Editor right":"Destra nell'editor","Editor rotate left":"Ruota editor a sinistra","Editor rotate right":"Ruota editor a destra","Editor move down":"Muovi editor verso il basso","Editor move up":"Muovi editor verso l'alto","Editor test":"Test dell'editor","Editor pick":"Scelta dell'editor","Toggle FPS counter":"Mostra contatore FPS","Toggle spectator camera":"Attiva/disattiva telecamera spettatore","Spectator forwards":"Avanti spettatore","Spectator backwards":"Indietro spettatore","Spectator left":"Sinistra spettatore","Spectator right":"Destra spettatore","Spectator speed modifier":"Modificatore velocità spettatore","Press any key...\n\nPress [Escape] to cancel.":"Premi un tasto qualsiasi...\n\nPremi [Esc] per annullare.",Clear:"Cancella","New record":"Nuovo record",Record:"Record",Current:"Attuale",Difference:"Differenza",Copy:"Copia",Import:"Importa","Failed to import track":"Importazione percorso non riuscita",'The track "{0}" already exists. Do you wish to overwrite it?':'Il percorso "{0}" esiste già . Vuoi sovrascriverlo?',Overwrite:"Sovrascrivi","Paste track data here...":"Incolla dati del percorso qui...",Rank:"Posizione","No record":"Nessun record","Standard tracks":"Percorsi standard","Custom tracks":"Percorsi personalizzati",'Are you sure you want to delete "{0}"?':'Sei sicuro di voler eliminare "{0}"?',Delete:"Elimina"},kI={Checkpoints:"チェックポイント","Checkpoint order":"ãƒã‚§ãƒƒã‚¯ãƒã‚¤ãƒ³ãƒˆã®é †åº",Height:"高さ",Exit:"終了",Random:"ランダム",Primary:"プライマリ",Secondary:"セカンダリ",Frame:"フレーム",Rims:"リム",Test:"テスト","Starting point is missing!":"スタート地点がありません!",Generate:"生成","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"新しいトラックを生成してもよろしいですか?\n\n現在のトラッã¯ã¯å¤±ããŒã¾ã™ï¼",Load:"読み込み",Save:"保存","Are you sure you want to load a new track?\n\nYour current track will be lost!":"新しいトラックを読み込んでもよろしいですか?\n\n現在のトラッã¯ã¯å¤±ããŒã¾ã™ï¼","Failed to save - Track name is needed!":"保存に失敗しました - トラック名が必要です!","Track saved!":"トラックが保存されました!","Failed to save!":"保存に失敗しました!",'Are you sure you want to overwrite "{0}"?':'"{0}" を上書きしてもよろしいですか?',Export:"エクスポート","Failed to export - Track name is needed!":"エクスポートに失敗しました - トラック名が必要です!",Help:"ヘルプ","Track name":"トラック名","Are you sure you want to exit the editor?":"エディタを終了してもよろしいですか?","All unsaved data will be lost!":"保存されていないデータはすべて失われます!","How to use the editor":"エディタの使い方","Camera controls":"カメラの操作方法","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"カメラは右クリックしてマウスをドラッグすることで移動できます。カメラを回転させるには、マウスの中ボタン(マウスホイール)をクリックするか、コントロールキーを押しながら右クリックしてマウスをドラッグします。マウスホイールをスクロールすることでズームインとズームアウトができます。","Alternatively, the camera can also be controlled using the following keyboard keys:":"また、以下のキーボードのキーを使用してカメラを制御することもできます:","Move forwards:":"前に移動:","Move backwards:":"後ろに移動:","Move left:":"左に移動:","Move right:":"右に移動:","Rotate left:":"左に回転:","Rotate right:":"右に回転:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"ç·¨é†ã•ãŒãŸé«˜ã•は、左ä¸éš…の高さ選択ã使用すããã€Shiftã­ãƒ¼ã押しながã‰ãƒžã¦ã¹ãƒã¤ãƒ¼ãƒ«ãã¹ã¯ãƒ­ãƒ¼ãƒ«ã™ãことで変æ´ã§ãã¾ã™ã€ã¾ãŸã€ä»¥ä¸ã®ã­ãƒ¼ãƒœãƒ¼ãƒ‰ã­ãƒ¼ã使用すãことãできます:","Move up:":"上に移動:","Move down:":"下に移動:",Editing:"編集","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"トラックパーツは、右側のメニューで選択してから、マウスで左クリックすることで配置できます。","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"また、マウスで現在ホバーしているトラックパーツは、以下のキーボードショートカットで選択できます:","The selected part can then be rotated using the following keyboard shortcut:":"選択したパーツは、以下のキーボードショートカットを使用して回転させることができます:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"トラックパーツは、右側のメニューの削除ツールを使用するか、以下のキーを押しながら削除することができます:","Starting points, checkpoints and the finish line":"スタート地点、チェックポイント、フィニッシュライン","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"スタート地点、チェックポイント、フィニッシュラインは、右側のメニューの最上位カテゴリで選択できます。","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"各トラッã¯ã«ã¯å°ãªãã¨ã¤ã®ã¹ã¿ãƒ¼ãƒˆåœ°ç¹ãŒå¿…要ですã€è¤‡æ•°ã®ã¹ã¿ãƒ¼ãƒˆåœ°ç¹ãŒããå ´åˆã¯ã€æœ€å¾Œã«é…ç½®ã•ã‚ŒãŸã‚‚ã®ãŒä½¿ç”¨ã•ã‚Œã¾ã™ã€‚","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"ãƒã‚§ãƒƒã‚¯ãƒã‚¤ãƒ³ãƒˆã¯ã€ã‚¹ã‚¿ãƒ¼ãƒˆåœ°ç‚¹ã¨ãƒ•ã‚£ãƒ‹ãƒƒã‚·ãƒ¥ãƒ©ã‚¤ãƒ³ã®é–“ã«é…ç½®ã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚ãƒã‚§ãƒƒã‚¯ãƒã‚¤ãƒ³ãƒˆã®ãƒˆãƒ©ãƒƒã‚¯ãƒ‘ãƒ¼ãƒ„ãŒé¸æŠžã•ã‚Œã‚‹ã¨ã€å³ä¸‹ã«ãƒã‚§ãƒƒã‚¯ãƒã‚¤ãƒ³ãƒˆã®é †åºã‚’é¸æŠžã™ã‚‹ãŸã‚ã®ãƒ„ãƒ¼ãƒ«ãŒè¡¨ç¤ºã•ã‚Œã¾ã™ã€‚ã“ã‚Œã«ã‚ˆã‚Šã€ãƒã‚§ãƒƒã‚¯ãƒã‚¤ãƒ³ãƒˆã‚’é€šéŽã™ã‚‹é †åºãŒæ±ºã¾ã‚Šã¾ã™ã€‚åŒã˜ãƒã‚§ãƒƒã‚¯ãƒã‚¤ãƒ³ãƒˆé †åºã§è¤‡æ•°ã®ãƒã‚§ãƒƒã‚¯ãƒã‚¤ãƒ³ãƒˆã‚’æŒã¤ã“ã¨ã‚‚å¯èƒ½ã§ã™ã€‚","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"フィニッシュラインはトラックの終わりですが、すべてのチェックポイントを通過した後にのみアクティブになります。複数のフィニッシュラインを持つことも可能です。","Starting point":"スタート地点",Checkpoint:"チェックポイント","Finish line":"フィニッシュライン","Exporting the track":"トラックのエクスポート","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"トラックが完成したら、トップ左にトラックの名前を入力し、エクスポートボタンを使用してトラックをエクスポートできます。これにより、他のユーザーがトラックをインポートして再生できるトラックコードが表示されます。",Close:"閉じる","Not set":"未設定",or:"または","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"ã«ãƒ¡ãƒ©ã¯1本の指でドラッã°ã™ãことで移å•できますã€ã«ãƒ¡ãƒ©ãåžè»¢ã•ããには、2本の指でドラッã°ã—ますã€ãƒ”ンチã¤ãƒ³ã¨ãƒ”ンチã¢ã¦ãƒˆã§ãºãƒ¼ãƒ インとズームアウトができます。","The edited height can be changed by using the height selection in the bottom left corner.":"編集された高さは、左下隅の高さ選択を使用することで変更できます。","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"トラックパーツは、右側のメニューで選択してから、画面をタップすることで配置できます。","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"選択したパーツは、左下隅の回転ボタンをタップすることで回転させることができます。","Track parts can be deleted by using the delete tool in the right side menu.":"トラックパーツは、右側のメニューの削除ツールを使用することで削除できます。","Press [{0}] or [{1}] to restart":"[{0}] または [{1}] を押して再起動","Press [{0}] to restart":"[{0}] を押して再起動",Leaderboard:"リーダーボード",Back:"戻る","Error: Failed to load leaderboard":"エラー:リーダーボードの読み込みに失敗しました",Verified:"検証済み",Invalid:"無効",Pending:"保留中",Loading:"読み込み中","Failed to load recording":"録画の読み込みに失敗しました",Ok:"OK","Track is missing starting point":"トラックにスタート地点がありません","Failed to create user token.":"ユーザートークンの作成に失敗しました。","Leaderboard is disabled.":"リーダーボードは無効です。","Please try another browser or device.":"別のブラウザまたはデバイスをお試しください。","Computer determinism check failed.":"コンピューターの決定論チェックに失敗しました。",Customize:"カスタマイズ",Editor:"エディタ",Settings:"設定",Profile:"プロフィール",Play:"再生",Version:"バージョン","You cannot have duplicate user profiles":"重複するユーザープロファイルを持つことはできません","Failed to create user profile":"ユーザープロファイルの作成に失敗しました","This user profile does not exist on the server":"このユーザープロファイルはサーバーに存在しません","Failed to download user profile from the server":"サーバーからユーザープロファイルをダウンロードできませんでした","User token is invalid":"ユーザートークンが無効です","Are you sure you want to display your private key?":"本当に秘密鍵を表示しますか?","DO NOT SHARE THIS KEY WITH ANYONE.":"この鍵を誰とも共有しないでください。","You need a free user profile slot to import a new user profile":"新しいユーザープロファイルをインポートするには空きユーザープロファイルスロットが必要です",Nickname:"ニックネーム","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"リーダーボードに表示されるニックネームを選択してください。ニックネームはいつでも変更できます。",Cancel:"キャンセル",Confirm:"確認",Verifier:"検証者","User ID":"ユーã¶ãƒ¼ID",Profiles:"プロフィール",'Are you sure you would like to delete "{0}"?':'"{0}"を削除してもよろしいですか?',Reset:"リセット",Apply:"適用",Gameplay:"ゲームプレイ",Units:"単位",Metric:"メトリック",Imperial:"インペリアル","Reset hint":"ヒントをリセット",Disabled:"無効",Enabled:"有効","Ghost car":"ゴーストカー","Cockpit camera mode":"コクピットカメラモード",Hold:"押し続ける",Toggle:"トグル","Checkpoints position":"チェックポイントの位置","Timer position":"タイマーの位置","Speedometer position":"速度計の位置",Bottom:"下",Top:"上",Language:"言語",Graphics:"グラフィック","Car shadow":"車の影","Track shadow":"トラックの影",Off:"オフ",On:"オン",Low:"低",Medium:"中",High:"高",Clouds:"雲",Particles:"パーティクル",Skidmarks:"スキッドマーク","Render scale":"レンダースケール","Anti-aliasing (requires restart)":"アンチエイリアシング(再起動が必要)",Audio:"オーディオ","Sound effect volume":"効果音の音量","Music volume":"音楽の音量","Checkpoint volume":"チェックポイントの音量",Controls:"コントロール","Vehicle accelerate":"è»Šã®åŠ é€Ÿ","Vehicle brake":"車のブレーキ","Vehicle turn left":"車を左に曲げる","Vehicle turn right":"車を右に曲げる","Vehicle reset":"車のリセット","Vehicle cockpit camera":"車のコクピットカメラ","Hide UI":"UIã非表示","Editor rotate part":"エディタのパーツ回転","Editor height modifier":"エディタの高さ調整","Editor delete part":"エディタのパーツ削除","Editor forwards":"エディタ前進","Editor backwards":"エディタ後退","Editor left":"エディタ左","Editor right":"エディタ右","Editor rotate left":"エディタを左に回転","Editor rotate right":"エディタを右に回転","Editor move down":"エディタを下に移動","Editor move up":"エディタを上に移動","Editor test":"エディターテスト","Editor pick":"エディター選択","Toggle FPS counter":"FPSã«ã¦ãƒ³ã¿ãƒ¼ã®åˆ‡ãŠæ¿ãˆ","Toggle spectator camera":"観戦カメラの切り替え","Spectator forwards":"観戦者前進","Spectator backwards":"観戦者後退","Spectator left":"観戦者左","Spectator right":"観戦者右","Spectator speed modifier":"観戦者速度調整","Press any key...\n\nPress [Escape] to cancel.":"任意のキーを押してください...\n\n[Escape] を押してキャンセル。",Clear:"クリア","New record":"新記録",Record:"記録",Current:"現在",Difference:"差分",Copy:"コピー",Import:"インポート","Failed to import track":"トラックのインポートに失敗しました",'The track "{0}" already exists. Do you wish to overwrite it?':"トラック「{0}」は既に存在します。上書きしますか?",Overwrite:"上書き","Paste track data here...":"トラックデータをここに貼り付けてください...",Rank:"ランク","No record":"記録なし","Standard tracks":"標準トラック","Custom tracks":"カスタムトラック",'Are you sure you want to delete "{0}"?':'"{0}" を削除してもよろしいですか?',Delete:"削除"},EI={Checkpoints:"체크포인트","Checkpoint order":"체크포인트 순서",Height:"높이",Exit:"나가기",Random:"랜덤",Primary:"기본",Secondary:"ë³´ì¡°",Frame:"í”„ë ˆìž„",Rims:"림",Test:"테스트","Starting point is missing!":"출발 ì§€ì ì´ 없습니다!",Generate:"생성","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"새로운 트랙을 ìƒì„±í•˜ì‹œê² ìŠµë‹ˆê¹Œ?\n\n현재 트랙은 손실됩니다!",Load:"불러오기",Save:"ì €ìž¥","Are you sure you want to load a new track?\n\nYour current track will be lost!":"새로운 트랙을 ë¶ˆëŸ¬ì˜¤ì‹œê² ìŠµë‹ˆê¹Œ?\n\n현재 트랙은 손실됩니다!","Failed to save - Track name is needed!":"ì €ìž¥ 실패 - 트랙 이름이 필요합니다!","Track saved!":"트랙이 ì €ìž¥ë˜ì—ˆìŠµë‹ˆë‹¤!","Failed to save!":"ì €ìž¥ 실패!",'Are you sure you want to overwrite "{0}"?':'"{0}"을(를) ë®ì–´ì“°ì‹œê² ìŠµë‹ˆê¹Œ?',Export:"내보내기","Failed to export - Track name is needed!":"내보내기 실패 - 트랙 이름이 필요합니다!",Help:"도움말","Track name":"트랙 이름","Are you sure you want to exit the editor?":"편집기를 ë‚˜ê°€ì‹œê² ìŠµë‹ˆê¹Œ?","All unsaved data will be lost!":"ì €ìž¥ë˜ì§€ 않은 ëª¨ë“ ë°ì´í„°ê°€ 손실됩니다!","How to use the editor":"에디터 사용 방법","Camera controls":"카메라 컨트롤","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"카메라는 마우스 오른쪽 버튼을 í´ë¦­í•˜ê³ ë“œëž˜ê·¸í•˜ì—¬ ì´ë™í• ìˆ˜ 있습니다. 카메라를 íšŒì „í•˜ë ¤ë©´ 마우스 중간 버튼(íœ )을 클릭하거나 컨트롤 키를 누른 상태에서 마우스 오른쪽 버튼을 í´ë¦­í•˜ê³ ë“œëž˜ê·¸í•˜ë©´ 됩니다. 마우스 íœ ì„ 스크롤하여 확대 및 ì¶•ì†Œí• ìˆ˜ 있습니다.","Alternatively, the camera can also be controlled using the following keyboard keys:":"또는 다음 키보드 키를 사용하여 카메라를 ì œì–´í• ìˆ˜ë„ 있습니다.","Move forwards:":"앞으로 이동:","Move backwards:":"뒤로 이동:","Move left:":"왼쪽으로 이동:","Move right:":"오른쪽으로 이동:","Rotate left:":"왼쪽으로 íšŒì „:","Rotate right:":"오른쪽으로 íšŒì „:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"편집된 높이는 왼쪽 하단 모서리의 높이 ì„ íƒì„ 사용하거나 Shift 키를 누른 상태에서 마우스 íœ ì„ 스크롤하여 ë³€ê²½í• ìˆ˜ 있습니다. 또는 다음 키보드 키를 ì‚¬ìš©í• ìˆ˜ë„ 있습니다.","Move up:":"위로 이동:","Move down:":"아래로 이동:",Editing:"편집","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"트랙 부품은 오른쪽 메뉴에서 ì„ íƒí•œ 후 마우스로 왼쪽 클릭하여 ë°°ì¹˜í• ìˆ˜ 있습니다.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"또는 현재 마우스로 ê°€ë¦¬í‚¤ê³ ìžˆëŠ” 트랙 부품을 다음 키보드 단축키로 ì„ íƒí• ìˆ˜ë„ 있습니다.","The selected part can then be rotated using the following keyboard shortcut:":"ì„ íƒí•œ 부품은 다음 키보드 단축키를 사용하여 íšŒì „í• ìˆ˜ 있습니다.","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"트랙 부품은 오른쪽 메뉴의 ì‚­ì œ 도구를 사용하거나 다음 키를 누른 상태에서 ì‚­ì œí• ìˆ˜ 있습니다.","Starting points, checkpoints and the finish line":"시작 ì§€ì , 체크포인트 및 완주 ì„ ","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"시작 ì§€ì , 체크포인트 및 완주 ì„ ì€ 모두 오른쪽 메뉴의 가장 상위 ì¹´í…Œê³ ë¦¬ì—ì„œ ì„ íƒí• ìˆ˜ 있습니다.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"각 트랙은 최소한 하나의 시작 ì§€ì ì´ 있어야 합니다. 여러 개의 시작 ì§€ì ì´ 있는 경우 마지막으로 배치된 ì§€ì ì´ 사용됩니다.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"체크포인트는 시작 ì§€ì ê³¼ 완주 ì„ ì‚¬ì´ì— 배치되어야 합니다. 체크포인트 트랙 부품이 ì„ íƒë˜ë©´ 하단 오른쪽에 체크포인트 순서를 ì„ íƒí• ìˆ˜ 있는 도구가 있습니다. 이는 완주 ì„ ìœ¼ë¡œ 이동하기 ì „ì— 체크포인트를 통과해야 하는 순서를 ê²°ì •í•©ë‹ˆë‹¤. 동일한 체크포인트 순서를 가진 여러 개의 체크포인트를 가질 수 있다는 ì ì— ìœ ì˜í•˜ì„¸ìš”.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"완주 ì„ ì€ 트랙이 끝나는 곳이지만 ëª¨ë“ ì²´í¬í¬ì¸íŠ¸ë¥¼ 통과한 후에만 활성화됩니다. 여러 개의 완주 ì„ ì„ 가질 수도 있습니다.","Starting point":"시작 ì§€ì ",Checkpoint:"체크포인트","Finish line":"완주 ì„ ","Exporting the track":"트랙 내보내기","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"트랙이 완성되면 왼쪽 상단에 트랙 이름을 ìž…ë ¥í•œ 후 내보내기 버튼을 사용하여 트랙을 내보낼 수 있습니다. ì´ë ‡ê²Œ 하면 다른 사용자가 트랙을 ê°€ì ¸ì™€ì„œ ìž¬ìƒí• ìˆ˜ 있는 트랙 코드가 표시됩니다.",Close:"닫기","Not set":"ì„¤ì •ë˜ì§€ 않음",or:"또는","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"카메라는 한 손가락으로 드래그하여 ì´ë™í• ìˆ˜ 있습니다. 카메라를 두 손가락으로 드래그하여 íšŒì „í• ìˆ˜ 있습니다. 확대 및 ì¶•ì†Œí•˜ë ¤ë©´ 핀치 동작을 사용하십시오.","The edited height can be changed by using the height selection in the bottom left corner.":"편집된 높이는 왼쪽 하단의 높이 ì„ íƒì„ 사용하여 ë³€ê²½í• ìˆ˜ 있습니다.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"트랙 부품은 오른쪽 메뉴에서 ì„ íƒí•œ 후 화면을 탭하여 ë°°ì¹˜í• ìˆ˜ 있습니다.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"ì„ íƒí•œ 부품은 왼쪽 하단의 íšŒì „ 버튼을 탭하여 íšŒì „í• ìˆ˜ 있습니다.","Track parts can be deleted by using the delete tool in the right side menu.":"트랙 부품은 오른쪽 메뉴의 ì‚­ì œ 도구를 사용하여 ì‚­ì œí• ìˆ˜ 있습니다.","Press [{0}] or [{1}] to restart":"[{0}] 또는 [{1}]을(를) 눌러 다시 시작","Press [{0}] to restart":"[{0}]을(를) 눌러 다시 시작",Leaderboard:"리더보드",Back:"뒤로","Error: Failed to load leaderboard":"오류: 리더보드 불러오기 실패",Verified:"확인됨",Invalid:"ìœ íš¨í•˜ì§€ 않음",Pending:"대기 중",Loading:"로딩 중","Failed to load recording":"녹화 불러오기 실패",Ok:"확인","Track is missing starting point":"트랙에 출발 ì§€ì ì´ 없습니다","Failed to create user token.":"사용자 í† í° 생성 실패.","Leaderboard is disabled.":"리더보드가 비활성화되었습니다.","Please try another browser or device.":"다른 ë¸Œë¼ìš°ì €ë‚˜ 기기를 시도해보십시오.","Computer determinism check failed.":"컴퓨터 ê²°ì •ë¡ ê²€ì‚¬ 실패.",Customize:"사용자 ì„¤ì •",Editor:"편집기",Settings:"ì„¤ì •",Profile:"프로필",Play:"재생",Version:"ë²„ì „","You cannot have duplicate user profiles":"중복 사용자 프로필을 가질 수 없습니다","Failed to create user profile":"사용자 프로필 생성에 실패했습니다","This user profile does not exist on the server":"이 사용자 프로필은 서버에 존재하지 않습니다","Failed to download user profile from the server":"서버에서 사용자 프로필을 다운로드하지 못했습니다","User token is invalid":"사용자 í† í°ì´ ìœ íš¨í•˜ì§€ 않습니다","Are you sure you want to display your private key?":"개인 키를 í‘œì‹œí•˜ì‹œê² ìŠµë‹ˆê¹Œ?","DO NOT SHARE THIS KEY WITH ANYONE.":"이 키를 아무와도 ê³µìœ í•˜ì§€ 마십시오.","You need a free user profile slot to import a new user profile":"새로운 사용자 프로필을 ê°€ì ¸ì˜¤ë ¤ë©´ 빈 사용자 프로필 슬롯이 필요합니다",Nickname:"닉네임","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"리더보드에 í‘œì‹œë ë‹‰ë„¤ìž„ì„ ì„ íƒí•˜ì‹­ì‹œì˜¤. 닉네임은 ì–¸ì œë“ ì§€ ë³€ê²½í• ìˆ˜ 있습니다.",Cancel:"취소",Confirm:"확인",Verifier:"확인자","User ID":"사용자 ID",Profiles:"프로필",'Are you sure you would like to delete "{0}"?':'"{0}"를 ì‚­ì œí•˜ì‹œê² ìŠµë‹ˆê¹Œ?',Reset:"ìž¬ì„¤ì •",Apply:"ì ìš©",Gameplay:"게임 í”Œë ˆì´",Units:"단위",Metric:"미터법",Imperial:"영국/미국 단위","Reset hint":"힌트 ìž¬ì„¤ì •",Disabled:"비활성화",Enabled:"활성화","Ghost car":"ìœ ë ¹ 자동차","Cockpit camera mode":"콕핏 카메라 모드",Hold:"ìœ ì§€",Toggle:"ì „í™˜","Checkpoints position":"체크포인트 위치","Timer position":"타이머 위치","Speedometer position":"속도계 위치",Bottom:"하단",Top:"상단",Language:"언어",Graphics:"그래픽","Car shadow":"자동차 그림자","Track shadow":"트랙 그림자",Off:"끄기",On:"켜기",Low:"낮음",Medium:"중간",High:"높음",Clouds:"구름",Particles:"파티클",Skidmarks:"스키드 마크","Render scale":"ë Œë”ë§ 스케일","Anti-aliasing (requires restart)":"안티 앨리어싱 (재시작 í•„ìš”)",Audio:"오디오","Sound effect volume":"사운드 효과 볼륨","Music volume":"음악 볼륨","Checkpoint volume":"체크포인트 볼륨",Controls:"컨트롤","Vehicle accelerate":"차량 가속","Vehicle brake":"차량 ë¸Œë ˆì´í¬","Vehicle turn left":"차량 왼쪽 íšŒì „","Vehicle turn right":"차량 오른쪽 íšŒì „","Vehicle reset":"차량 초기화","Vehicle cockpit camera":"차량 코크핏 카메라","Hide UI":"UI 숨기기","Editor rotate part":"편집기 부품 íšŒì „","Editor height modifier":"편집기 높이 ìˆ˜ì •ê¸°","Editor delete part":"편집기 부품 ì‚­ì œ","Editor forwards":"편집기 앞으로","Editor backwards":"편집기 뒤로","Editor left":"편집기 왼쪽","Editor right":"편집기 오른쪽","Editor rotate left":"편집기 왼쪽으로 íšŒì „","Editor rotate right":"편집기 오른쪽으로 íšŒì „","Editor move down":"편집기 아래로 이동","Editor move up":"편집기 위로 이동","Editor test":"편집기 테스트","Editor pick":"편집기 ì„ íƒ","Toggle FPS counter":"FPS ì¹´ìš´í„° ì „í™˜","Toggle spectator camera":"스펙테이터 카메라 ì „í™˜","Spectator forwards":"스펙테이터 앞으로","Spectator backwards":"스펙테이터 뒤로","Spectator left":"스펙테이터 왼쪽","Spectator right":"스펙테이터 오른쪽","Spectator speed modifier":"스펙테이터 속도 ìˆ˜ì •ê¸°","Press any key...\n\nPress [Escape] to cancel.":"아무 키나 누르십시오...\n\n[Escape]를 눌러 취소하십시오.",Clear:"지우기","New record":"새 기록",Record:"기록",Current:"현재",Difference:"차이",Copy:"복사",Import:"ê°€ì ¸ì˜¤ê¸°","Failed to import track":"트랙 ê°€ì ¸ì˜¤ê¸° 실패",'The track "{0}" already exists. Do you wish to overwrite it?':'"{0}" 트랙이 이미 존재합니다. ë®ì–´ì“°ì‹œê² ìŠµë‹ˆê¹Œ?',Overwrite:"덮어쓰기","Paste track data here...":"트랙 데이터를 여기에 붙여넣으십시오...",Rank:"순위","No record":"기록 없음","Standard tracks":"표준 트랙","Custom tracks":"사용자 ì •ì˜ 트랙",'Are you sure you want to delete "{0}"?':'"{0}"을(를) ì‚­ì œí•˜ì‹œê² ìŠµë‹ˆê¹Œ?',Delete:"ì‚­ì œ"},SI={Checkpoints:"Punkty kontrolne","Checkpoint order":"KolejnoÅć punktów kontrolnych",Height:"WysokoÅć",Exit:"WyjÅcie",Random:"Losowe",Primary:"GÅówny",Secondary:"Dodatkowy",Frame:"Rama",Rims:"ObrÄ™cze",Test:"Test","Starting point is missing!":"Brak punktu startowego!",Generate:"Generuj","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"Czy na pewno chcesz wygenerować nowÄ… trasÄ™?\n\nTwoja obecna trasa zostanie utracona!",Load:"Wczytaj",Save:"Zapisz","Are you sure you want to load a new track?\n\nYour current track will be lost!":"Czy na pewno chcesz wczytać nowÄ… trasÄ™?\n\nTwoja obecna trasa zostanie utracona!","Failed to save - Track name is needed!":"Nie udaÅo siÄ™ zapisać - Wymagana nazwa trasy!","Track saved!":"Trasa zostaÅa zapisana!","Failed to save!":"Nie udaÅo siÄ™ zapisać!",'Are you sure you want to overwrite "{0}"?':"Czy na pewno chcesz nadpisać „{0}”?",Export:"Eksportuj","Failed to export - Track name is needed!":"Nie udaÅo siÄ™ wyeksportować - Wymagana nazwa trasy!",Help:"Pomoc","Track name":"Nazwa trasy","Are you sure you want to exit the editor?":"Czy na pewno chcesz wyjÅć z edytora?","All unsaved data will be lost!":"Wszystkie niezapisane dane zostanÄ… utracone!","How to use the editor":"Jak korzystać z edytora","Camera controls":"Sterowanie kamerÄ…","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"KamerÄ™ można przesuwać, klikajÄ…c prawym przyciskiem myszy i przeciÄ…gajÄ…c. Obróć kamerÄ™, klikajÄ…c Årodkowy przycisk myszy (koÅo myszy) lub przytrzymujÄ…c klawisz Ctrl i klikajÄ…c prawym przyciskiem myszy i przeciÄ…gajÄ…c. Przybliż i oddal obraz, przewijajÄ…c kóÅko myszy.","Alternatively, the camera can also be controlled using the following keyboard keys:":"Alternatywnie, kamerÄ… można również sterować za pomocÄ… nastÄ™pujÄ…cych klawiszy na klawiaturze:","Move forwards:":"Poruszaj siÄ™ do przodu:","Move backwards:":"Poruszaj siÄ™ do tyÅu:","Move left:":"Poruszaj siÄ™ w lewo:","Move right:":"Poruszaj siÄ™ w prawo:","Rotate left:":"Obróć w lewo:","Rotate right:":"Obróć w prawo:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"EdytowanÄ… wysokoÅć można zmienić, korzystajÄ…c z wyboru wysokoÅci w lewym dolnym rogu lub przytrzymujÄ…c klawisz Shift i przewijajÄ…c kóÅko myszy. Alternatywnie można użyć nastÄ™pujÄ…cych klawiszy na klawiaturze:","Move up:":"PrzesuÅ„ w górÄ™:","Move down:":"PrzesuÅ„ w dóÅ:",Editing:"Edycja","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"CzÄ™Åci toru można wybrać w menu po prawej stronie, a nastÄ™pnie można je umieÅcić, klikajÄ…c lewym przyciskiem myszy.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"Alternatywnie, aktualnie zaznaczonÄ… czÄ™Åć toru można wybrać za pomocÄ… nastÄ™pujÄ…cego skrótu klawiaturowego:","The selected part can then be rotated using the following keyboard shortcut:":"WybranÄ… czÄ™Åć można nastÄ™pnie obrócić za pomocÄ… nastÄ™pujÄ…cego skrótu klawiaturowego:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"CzÄ™Åci toru można usunąć, korzystajÄ…c z narzÄ™dzia usuwania w menu po prawej stronie lub przytrzymujÄ…c nastÄ™pujÄ…cy klawisz:","Starting points, checkpoints and the finish line":"Punkty startowe, punkty kontrolne i linia mety","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"Punkty startowe, punkty kontrolne i linie mety można wybrać we wszystkich kategoriach w menu po prawej stronie.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"Każda trasa musi mieć co najmniej jeden punkt startowy. JeÅli istnieje wiele punktów startowych, zostanie użyty ostatnio umieszczony.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"Punkty kontrolne powinny być umieszczone miÄ™dzy punktem startowym a liniÄ… mety. Po wybraniu czÄ™Åci toru punktu kontrolnego pojawi siÄ™ narzÄ™dzie w prawym dolnym rogu, które pozwoli wybrać kolejnoÅć punktu kontrolnego. OkreÅla to kolejnoÅć, w jakiej punkty kontrolne muszÄ… być przechodzone przed dojazdem do linii mety. Zauważ, że możliwe jest posiadanie wielu punktów kontrolnych o tej samej kolejnoÅci.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"Linia mety to miejsce, gdzie koÅ„czy siÄ™ tor, ale staje siÄ™ aktywna dopiero po przejÅciu wszystkich punktów kontrolnych. Możliwe jest również posiadanie wielu linii mety.","Starting point":"Punkt startowy",Checkpoint:"Punkt kontrolny","Finish line":"Linia mety","Exporting the track":"Eksportowanie trasy","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"Po zakoÅ„czeniu trasy można wprowadzić jej nazwÄ™ w lewym górnym rogu, a nastÄ™pnie można jÄ… wyeksportować, korzystajÄ…c z przycisku eksportu. To ujawni kod trasy, który można przesÅać innym użytkownikom, aby mogli zaimportować i odtworzyć trasÄ™.",Close:"Zamknij","Not set":"Nie ustawiono",or:"lub","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"KamerÄ™ można przesuwać, przeciÄ…gajÄ…c jednym palcem. Obróć kamerÄ™, przeciÄ…gajÄ…c dwoma palcami. Przybliż i oddal obraz, ÅciskajÄ…c palcami.","The edited height can be changed by using the height selection in the bottom left corner.":"EdytowanÄ… wysokoÅć można zmienić, korzystajÄ…c z wyboru wysokoÅci w lewym dolnym rogu.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"CzÄ™Åci toru można wybrać w menu po prawej stronie, a nastÄ™pnie można je umieÅcić, dotykajÄ…c ekranu.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"WybranÄ… czÄ™Åć można nastÄ™pnie obrócić, dotykajÄ…c przycisku obracania w lewym dolnym rogu.","Track parts can be deleted by using the delete tool in the right side menu.":"CzÄ™Åci toru można usunąć, korzystajÄ…c z narzÄ™dzia usuwania w menu po prawej stronie.","Press [{0}] or [{1}] to restart":"NaciÅnij [{0}] lub [{1}] aby zrestartować","Press [{0}] to restart":"NaciÅnij [{0}] aby zrestartować",Leaderboard:"Tabela wyników",Back:"Powrót","Error: Failed to load leaderboard":"BÅÄ…d: Nie można wczytać tabeli wyników",Verified:"Zweryfikowany",Invalid:"NieprawidÅowy",Pending:"OczekujÄ…cy",Loading:"Ładowanie","Failed to load recording":"Nie udaÅo siÄ™ wczytać nagrania",Ok:"Ok","Track is missing starting point":"Brak punktu startowego na trasie","Failed to create user token.":"Nie udaÅo siÄ™ utworzyć tokenu użytkownika.","Leaderboard is disabled.":"Tablica wyników jest wyÅÄ…czona.","Please try another browser or device.":"ProszÄ™ spróbować innÄ… przeglÄ…darkÄ™ lub urzÄ…dzenie.","Computer determinism check failed.":"Nie udaÅo siÄ™ sprawdzić determinizmu komputera.",Customize:"Dostosuj",Editor:"Edytor",Settings:"Ustawienia",Profile:"Profil",Play:"Graj",Version:"Wersja","You cannot have duplicate user profiles":"Nie możesz mieć zduplikowanych profili użytkownika","Failed to create user profile":"Nie udaÅo siÄ™ utworzyć profilu użytkownika","This user profile does not exist on the server":"Ten profil użytkownika nie istnieje na serwerze","Failed to download user profile from the server":"Nie udaÅo siÄ™ pobrać profilu użytkownika z serwera","User token is invalid":"Token użytkownika jest nieprawidÅowy","Are you sure you want to display your private key?":"Czy na pewno chcesz wyÅwietlić swój klucz prywatny?","DO NOT SHARE THIS KEY WITH ANYONE.":"NIE UDOSTĘPNIAJ TEGO KLUCZA NIKOMU.","You need a free user profile slot to import a new user profile":"Potrzebujesz wolnego miejsca na profil użytkownika, aby zaimportować nowy profil użytkownika",Nickname:"Pseudonim","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"Wybierz pseudonim, który bÄ™dzie wyÅwietlany w tabeli wyników. Możesz go zmieniać w dowolnym momencie.",Cancel:"Anuluj",Confirm:"Potwierdź",Verifier:"Weryfikator","User ID":"ID użytkownika",Profiles:"Profile",'Are you sure you would like to delete "{0}"?':'Czy na pewno chcesz usunąć "{0}"?',Reset:"Resetuj",Apply:"Zastosuj",Gameplay:"Rozgrywka",Units:"Jednostki",Metric:"Metryczne",Imperial:"Imperialne","Reset hint":"Resetuj wskazówkÄ™",Disabled:"WyÅÄ…czone",Enabled:"WÅÄ…czone","Ghost car":"Duch samochodu","Cockpit camera mode":"Tryb kamery kokpitu",Hold:"Przytrzymaj",Toggle:"PrzeÅÄ…cz","Checkpoints position":"Pozycja punktów kontrolnych","Timer position":"Pozycja timera","Speedometer position":"Pozycja licznika prÄ™dkoÅci",Bottom:"DóÅ",Top:"Góra",Language:"JÄ™zyk",Graphics:"Grafika","Car shadow":"CieÅ„ samochodu","Track shadow":"CieÅ„ trasy",Off:"WyÅÄ…cz",On:"WÅÄ…cz",Low:"Niska",Medium:"Åšrednia",High:"Wysoka",Clouds:"Chmury",Particles:"CzÄ…steczki",Skidmarks:"Åšlady opon","Render scale":"Skala renderowania","Anti-aliasing (requires restart)":"Anti-aliasing (wymaga restartu)",Audio:"DźwiÄ™k","Sound effect volume":"GÅnoÅć efektów dźwiÄ™kowych","Music volume":"GÅnoÅć muzyki","Checkpoint volume":"GÅnoÅć punktów kontrolnych",Controls:"Sterowanie","Vehicle accelerate":"Przyspiesz pojazd","Vehicle brake":"Hamuj pojazd","Vehicle turn left":"Skręć pojazd w lewo","Vehicle turn right":"Skręć pojazd w prawo","Vehicle reset":"Zresetuj pojazd","Vehicle cockpit camera":"Kamera kokpitu pojazdu","Hide UI":"Ukryj interfejs użytkownika","Editor rotate part":"Obróć czÄ™Åć w edytorze","Editor height modifier":"Modyfikator wysokoÅci w edytorze","Editor delete part":"UsuÅ„ czÄ™Åć w edytorze","Editor forwards":"Edytor do przodu","Editor backwards":"Edytor do tyÅu","Editor left":"Edytor w lewo","Editor right":"Edytor w prawo","Editor rotate left":"Obróć edytor w lewo","Editor rotate right":"Obróć edytor w prawo","Editor move down":"PrzesuÅ„ edytor w dóÅ","Editor move up":"PrzesuÅ„ edytor w górÄ™","Editor test":"Test edytora","Editor pick":"Wybór edytora","Toggle FPS counter":"PrzeÅÄ…cz licznik FPS","Toggle spectator camera":"PrzeÅÄ…cz kamerÄ™ widza","Spectator forwards":"Widz do przodu","Spectator backwards":"Widz do tyÅu","Spectator left":"Widz w lewo","Spectator right":"Widz w prawo","Spectator speed modifier":"Modyfikator prÄ™dkoÅci widza","Press any key...\n\nPress [Escape] to cancel.":"NaciÅnij dowolny klawisz...\n\nNaciÅnij [Escape], aby anulować.",Clear:"WyczyÅć","New record":"Nowy rekord",Record:"Rekord",Current:"Aktualny",Difference:"Różnica",Copy:"Kopiuj",Import:"Importuj","Failed to import track":"Import trasy nie powiódÅ siÄ™",'The track "{0}" already exists. Do you wish to overwrite it?':"Trasa „{0}” już istnieje. Czy chcesz jÄ… nadpisać?",Overwrite:"Nadpisz","Paste track data here...":"Wklej dane trasy tutaj...",Rank:"Ranking","No record":"Brak rekordu","Standard tracks":"Standardowe trasy","Custom tracks":"Niestandardowe trasy",'Are you sure you want to delete "{0}"?':"Czy na pewno chcesz usunąć „{0}”?",Delete:"UsuÅ„"},MI={Checkpoints:"Pontos de Verificação","Checkpoint order":"Ordem dos Pontos de Verificação",Height:"Altura",Exit:"Sair",Random:"Aleatório",Primary:"Principal",Secondary:"Secundário",Frame:"Estrutura",Rims:"Aros",Test:"Testar","Starting point is missing!":"Ponto de partida está faltando!",Generate:"Gerar","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"Tem certeza de que deseja gerar uma nova pista?\n\nSua pista atual será perdida!",Load:"Carregar",Save:"Salvar","Are you sure you want to load a new track?\n\nYour current track will be lost!":"Tem certeza de que deseja carregar uma nova pista?\n\nSua pista atual será perdida!","Failed to save - Track name is needed!":"Falha ao salvar - Nome da pista é necessário!","Track saved!":"Pista salva!","Failed to save!":"Falha ao salvar!",'Are you sure you want to overwrite "{0}"?':'Tem certeza de que deseja sobrescrever "{0}"?',Export:"Exportar","Failed to export - Track name is needed!":"Falha ao exportar - Nome da pista é necessário!",Help:"Ajuda","Track name":"Nome da pista","Are you sure you want to exit the editor?":"Tem certeza de que deseja sair do editor?","All unsaved data will be lost!":"Todos os dados não salvos serão perdidos!","How to use the editor":"Como usar o editor","Camera controls":"Controles da câmera","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"A câmera pode ser movida clicando com o botão direito do mouse e arrastando. Gire a câmera clicando no botão do meio do mouse (roda do mouse) ou segurando a tecla de controle e clicando com o botão direito do mouse e arrastando. Amplie e reduza o zoom rolando a roda do mouse.","Alternatively, the camera can also be controlled using the following keyboard keys:":"Alternativamente, a câmera também pode ser controlada usando as seguintes teclas do teclado:","Move forwards:":"Mover para frente:","Move backwards:":"Mover para trás:","Move left:":"Mover para a esquerda:","Move right:":"Mover para a direita:","Rotate left:":"Girar para a esquerda:","Rotate right:":"Girar para a direita:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"A altura editada pode ser alterada usando a seleção de altura no canto inferior esquerdo ou segurando a tecla shift e rolando a roda do mouse. Alternativamente, você pode usar as seguintes teclas do teclado:","Move up:":"Mover para cima:","Move down:":"Mover para baixo:",Editing:"Edição","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"As partes da pista podem ser selecionadas no menu à direita e, em seguida, podem ser colocadas clicando com o botão esquerdo do mouse.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"Alternativamente, a parte da pista atualmente destacada pelo mouse pode ser selecionada com o seguinte atalho de teclado:","The selected part can then be rotated using the following keyboard shortcut:":"A parte selecionada pode então ser girada usando o seguinte atalho de teclado:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"As partes da pista podem ser excluídas usando a ferramenta de exclusão no menu lateral direito ou segurando a seguinte tecla:","Starting points, checkpoints and the finish line":"Pontos de partida, checkpoints e linha de chegada","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"Pontos de partida, checkpoints e linhas de chegada podem ser selecionados na categoria mais alta do menu lateral direito.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"Cada pista deve ter pelo menos um ponto de partida. Se houver vários pontos de partida, o último colocado será usado.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"Os checkpoints devem ser colocados entre o ponto de partida e a linha de chegada. Quando uma parte da pista de checkpoint é selecionada, haverá uma ferramenta no canto inferior direito para selecionar a ordem do checkpoint. Isso determina a ordem em que os checkpoints devem ser passados antes de dirigir até a linha de chegada. Observe que é possível ter vários checkpoints com a mesma ordem de checkpoint.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"A linha de chegada é onde a pista termina, mas só se tornará ativa depois que todos os checkpoints forem passados. Também é possível ter várias linhas de chegada.","Starting point":"Ponto de partida",Checkpoint:"Checkpoint","Finish line":"Linha de chegada","Exporting the track":"Exportando a pista","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"Quando a pista estiver pronta, um nome para a pista pode ser inserido no canto superior esquerdo e, em seguida, a pista pode ser exportada usando o botão de exportação. Isso revelará um código de pista que pode ser enviado para outros usuários para que eles possam importar e jogar a pista.",Close:"Fechar","Not set":"Não definido",or:"ou","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"A câmera pode ser movida arrastando com um dedo. Gire a câmera arrastando com dois dedos. Amplie e reduza o zoom beliscando.","The edited height can be changed by using the height selection in the bottom left corner.":"A altura editada pode ser alterada usando a seleção de altura no canto inferior esquerdo.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"As partes da pista podem ser selecionadas no menu à direita e, em seguida, podem ser colocadas tocando na tela.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"A parte selecionada pode então ser girada tocando no botão de rotação no canto inferior esquerdo.","Track parts can be deleted by using the delete tool in the right side menu.":"As partes da pista podem ser excluídas usando a ferramenta de exclusão no menu lateral direito.","Press [{0}] or [{1}] to restart":"Pressione [{0}] ou [{1}] para reiniciar","Press [{0}] to restart":"Pressione [{0}] para reiniciar",Leaderboard:"Quadro de Líderes",Back:"Voltar","Error: Failed to load leaderboard":"Erro: Falha ao carregar o quadro de líderes",Verified:"Verificado",Invalid:"Inválido",Pending:"Pendente",Loading:"Carregando","Failed to load recording":"Falha ao carregar a gravação",Ok:"Ok","Track is missing starting point":"Pista está sem ponto de partida","Failed to create user token.":"Falha ao criar o token do usuário.","Leaderboard is disabled.":"O ranking está desativado.","Please try another browser or device.":"Por favor, tente outro navegador ou dispositivo.","Computer determinism check failed.":"Falha na verificação de determinismo do computador.",Customize:"Personalizar",Editor:"Editor",Settings:"Configurações",Profile:"Perfil",Play:"Jogar",Version:"Versão","You cannot have duplicate user profiles":"Você não pode ter perfis de usuário duplicados","Failed to create user profile":"Falha ao criar perfil de usuário","This user profile does not exist on the server":"Este perfil de usuário não existe no servidor","Failed to download user profile from the server":"Falha ao baixar perfil de usuário do servidor","User token is invalid":"Token de usuário inválido","Are you sure you want to display your private key?":"Tem certeza de que deseja exibir sua chave privada?","DO NOT SHARE THIS KEY WITH ANYONE.":"NÃO COMPARTILHE ESTA CHAVE COM NINGUÉM.","You need a free user profile slot to import a new user profile":"Você precisa de um slot de perfil de usuário livre para importar um novo perfil de usuário",Nickname:"Apelido","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"Escolha um apelido para ser exibido no quadro de líderes. Seu apelido pode ser alterado a qualquer momento.",Cancel:"Cancelar",Confirm:"Confirmar",Verifier:"Verificador","User ID":"ID de Usuário",Profiles:"Perfis",'Are you sure you would like to delete "{0}"?':'Tem certeza de que deseja excluir "{0}"?',Reset:"Redefinir",Apply:"Aplicar",Gameplay:"Jogabilidade",Units:"Unidades",Metric:"Métrico",Imperial:"Imperial","Reset hint":"Redefinir dica",Disabled:"Desativado",Enabled:"Ativado","Ghost car":"Carro Fantasma","Cockpit camera mode":"Modo de câmera do cockpit",Hold:"Manter",Toggle:"Alternar","Checkpoints position":"Posição dos checkpoints","Timer position":"Posição do temporizador","Speedometer position":"Posição do velocímetro",Bottom:"Inferior",Top:"Superior",Language:"Idioma",Graphics:"Gráficos","Car shadow":"Sombra do Carro","Track shadow":"Sombra da Pista",Off:"Desligado",On:"Ligado",Low:"Baixo",Medium:"Médio",High:"Alto",Clouds:"Nuvens",Particles:"Partículas",Skidmarks:"Marcas de Derrapagem","Render scale":"Escala de Renderização","Anti-aliasing (requires restart)":"Anti-aliasing (requer reinício)",Audio:"Áudio","Sound effect volume":"Volume de Efeitos Sonoros","Music volume":"Volume de Música","Checkpoint volume":"Volume dos Pontos de Verificação",Controls:"Controles","Vehicle accelerate":"Acelerar Veículo","Vehicle brake":"Freio do Veículo","Vehicle turn left":"Virar à Esquerda","Vehicle turn right":"Virar à Direita","Vehicle reset":"Redefinir Veículo","Vehicle cockpit camera":"Câmera Interna do Veículo","Hide UI":"Esconder UI","Editor rotate part":"Girar Peça do Editor","Editor height modifier":"Modificador de Altura do Editor","Editor delete part":"Excluir Peça do Editor","Editor forwards":"Avançar no Editor","Editor backwards":"Retroceder no Editor","Editor left":"Mover à Esquerda no Editor","Editor right":"Mover à Direita no Editor","Editor rotate left":"Girar o editor para a esquerda","Editor rotate right":"Girar o editor para a direita","Editor move down":"Mover o editor para baixo","Editor move up":"Mover o editor para cima","Editor test":"Teste de editor","Editor pick":"Escolha do editor","Toggle FPS counter":"Alternar Contador de FPS","Toggle spectator camera":"Alternar Câmera de Espectador","Spectator forwards":"Avançar como Espectador","Spectator backwards":"Retroceder como Espectador","Spectator left":"Mover à Esquerda como Espectador","Spectator right":"Mover à Direita como Espectador","Spectator speed modifier":"Modificador de Velocidade do Espectador","Press any key...\n\nPress [Escape] to cancel.":"Pressione qualquer tecla...\n\nPressione [Escape] para cancelar.",Clear:"Limpar","New record":"Novo recorde",Record:"Recorde",Current:"Atual",Difference:"Diferença",Copy:"Copiar",Import:"Importar","Failed to import track":"Falha ao importar a pista",'The track "{0}" already exists. Do you wish to overwrite it?':'A pista "{0}" já existe. Deseja sobrescrevê-la?',Overwrite:"Sobrescrever","Paste track data here...":"Cole os dados da pista aqui...",Rank:"Classificação","No record":"Sem recorde","Standard tracks":"Pistas Padrão","Custom tracks":"Pistas Personalizadas",'Are you sure you want to delete "{0}"?':'Tem certeza de que deseja excluir "{0}"?',Delete:"Excluir"},TI={Checkpoints:"Pontos de Verificação","Checkpoint order":"Ordem dos Pontos de Verificação",Height:"Altura",Exit:"Sair",Random:"Aleatório",Primary:"Primário",Secondary:"Secundário",Frame:"Estrutura",Rims:"Aros",Test:"Testar","Starting point is missing!":"Ponto de partida em falta!",Generate:"Gerar","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"Tem a certeza de que deseja gerar uma nova pista?\n\nA pista atual será perdida!",Load:"Carregar",Save:"Guardar","Are you sure you want to load a new track?\n\nYour current track will be lost!":"Tem a certeza de que deseja carregar uma nova pista?\n\nA pista atual será perdida!","Failed to save - Track name is needed!":"Falha ao guardar - É necessário um nome para a pista!","Track saved!":"Pista guardada!","Failed to save!":"Falha ao guardar!",'Are you sure you want to overwrite "{0}"?':'Tem a certeza de que deseja substituir "{0}"?',Export:"Exportar","Failed to export - Track name is needed!":"Falha ao exportar - É necessário um nome para a pista!",Help:"Ajuda","Track name":"Nome da pista","Are you sure you want to exit the editor?":"Tem a certeza de que deseja sair do editor?","All unsaved data will be lost!":"Todos os dados não guardados serão perdidos!","How to use the editor":"Como usar o editor","Camera controls":"Controlos da câmera","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"A câmera pode ser movida clicando com o botão direito do mouse e arrastando. Rode a câmera clicando no botão do meio do mouse (roda do mouse) ou segurando a tecla de controle e clicando com o botão direito do mouse e arrastando. Aproxime e afaste o zoom rolando a roda do mouse.","Alternatively, the camera can also be controlled using the following keyboard keys:":"Alternativamente, a câmera também pode ser controlada usando as seguintes teclas do teclado:","Move forwards:":"Mover para a frente:","Move backwards:":"Mover para trás:","Move left:":"Mover para a esquerda:","Move right:":"Mover para a direita:","Rotate left:":"Rodar para a esquerda:","Rotate right:":"Rodar para a direita:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"A altura editada pode ser alterada usando a seleção de altura no canto inferior esquerdo ou segurando a tecla shift e rolando a roda do mouse. Alternativamente, você pode usar as seguintes teclas do teclado:","Move up:":"Mover para cima:","Move down:":"Mover para baixo:",Editing:"Edição","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"As partes da pista podem ser selecionadas no menu à direita e depois podem ser colocadas clicando com o botão esquerdo do mouse.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"Alternativamente, a parte da pista atualmente destacada pelo mouse pode ser selecionada com o seguinte atalho de teclado:","The selected part can then be rotated using the following keyboard shortcut:":"A parte selecionada pode então ser girada usando o seguinte atalho de teclado:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"As partes da pista podem ser excluídas usando a ferramenta de exclusão no menu lateral direito ou segurando a seguinte tecla:","Starting points, checkpoints and the finish line":"Pontos de partida, checkpoints e linha de chegada","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"Pontos de partida, checkpoints e linhas de chegada podem ser selecionados na categoria mais alta do menu lateral direito.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"Cada pista deve ter pelo menos um ponto de partida. Se houver vários pontos de partida, o último colocado será usado.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"Os checkpoints devem ser colocados entre o ponto de partida e a linha de chegada. Quando uma parte da pista de checkpoint é selecionada, haverá uma ferramenta no canto inferior direito para selecionar a ordem do checkpoint. Isso determina a ordem em que os checkpoints devem ser passados antes de dirigir até a linha de chegada. Observe que é possível ter vários checkpoints com a mesma ordem de checkpoint.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"A linha de chegada é onde a pista termina, mas só se tornará ativa depois que todos os checkpoints forem passados. Também é possível ter várias linhas de chegada.","Starting point":"Ponto de partida",Checkpoint:"Checkpoint","Finish line":"Linha de chegada","Exporting the track":"Exportando a pista","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"Quando a pista estiver pronta, um nome para a pista pode ser inserido no canto superior esquerdo, após o qual a pista pode ser exportada usando o botão de exportação. Isso revelará um código de pista que pode ser enviado para outros usuários para que eles possam importar e jogar a pista.",Close:"Fechar","Not set":"Não definido",or:"ou","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"A câmera pode ser movida arrastando com um dedo. Rode a câmera arrastando com dois dedos. Aproxime e afaste o zoom beliscando.","The edited height can be changed by using the height selection in the bottom left corner.":"A altura editada pode ser alterada usando a seleção de altura no canto inferior esquerdo.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"As partes da pista podem ser selecionadas no menu à direita e depois podem ser colocadas tocando na tela.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"A parte selecionada pode então ser girada tocando no botão de rotação no canto inferior esquerdo.","Track parts can be deleted by using the delete tool in the right side menu.":"As partes da pista podem ser excluídas usando a ferramenta de exclusão no menu lateral direito.","Press [{0}] or [{1}] to restart":"Pressione [{0}] ou [{1}] para reiniciar","Press [{0}] to restart":"Pressione [{0}] para reiniciar",Leaderboard:"Tabela de Classificação",Back:"Voltar","Error: Failed to load leaderboard":"Erro: Falha ao carregar a tabela de classificação",Verified:"Verificado",Invalid:"Inválido",Pending:"Pendente",Loading:"A Carregar","Failed to load recording":"Falha ao carregar a gravação",Ok:"Ok","Track is missing starting point":"A pista não tem ponto de partida","Failed to create user token.":"Falha ao criar o token de utilizador.","Leaderboard is disabled.":"O leaderboard está desativado.","Please try another browser or device.":"Por favor, tente outro navegador ou dispositivo.","Computer determinism check failed.":"Falha na verificação de determinismo do computador.",Customize:"Personalizar",Editor:"Editor",Settings:"Definições",Profile:"Perfil",Play:"Jogar",Version:"Versão","You cannot have duplicate user profiles":"Não pode ter perfis de utilizador duplicados","Failed to create user profile":"Falha ao criar o perfil de utilizador","This user profile does not exist on the server":"Este perfil de utilizador não existe no servidor","Failed to download user profile from the server":"Falha ao descarregar o perfil de utilizador do servidor","User token is invalid":"Token de utilizador inválido","Are you sure you want to display your private key?":"Tem a certeza de que pretende mostrar a sua chave privada?","DO NOT SHARE THIS KEY WITH ANYONE.":"NÃO PARTILHE ESTA CHAVE COM NINGUÉM.","You need a free user profile slot to import a new user profile":"Necessita de um slot de perfil de utilizador livre para importar um novo perfil de utilizador",Nickname:"Alcunha","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"Escolha uma alcunha para ser exibida na tabela de classificação. A sua alcunha pode ser alterada a qualquer momento.",Cancel:"Cancelar",Confirm:"Confirmar",Verifier:"Verificador","User ID":"ID de Utilizador",Profiles:"Perfis",'Are you sure you would like to delete "{0}"?':'Tem a certeza de que pretende eliminar "{0}"?',Reset:"Repor",Apply:"Aplicar",Gameplay:"Jogabilidade",Units:"Unidades",Metric:"Métrico",Imperial:"Imperial","Reset hint":"Repor dica",Disabled:"Desativado",Enabled:"Ativado","Ghost car":"Carro Fantasma","Cockpit camera mode":"Modo da câmera de cabine",Hold:"Manter",Toggle:"Alternar","Checkpoints position":"Posição dos checkpoints","Timer position":"Posição do temporizador","Speedometer position":"Posição do velocímetro",Bottom:"Inferior",Top:"Superior",Language:"Idioma",Graphics:"Gráficos","Car shadow":"Sombra do Carro","Track shadow":"Sombra da Pista",Off:"Desligado",On:"Ligado",Low:"Baixo",Medium:"Médio",High:"Alto",Clouds:"Nuvens",Particles:"Partículas",Skidmarks:"Marcas de Derrapagem","Render scale":"Escala de Renderização","Anti-aliasing (requires restart)":"Anti-aliasing (necessita de reiniciar)",Audio:"Áudio","Sound effect volume":"Volume dos Efeitos Sonoros","Music volume":"Volume da Música","Checkpoint volume":"Volume dos Pontos de Verificação",Controls:"Controlos","Vehicle accelerate":"Acelerar Veículo","Vehicle brake":"Travar Veículo","Vehicle turn left":"Virar à Esquerda","Vehicle turn right":"Virar à Direita","Vehicle reset":"Reiniciar Veículo","Vehicle cockpit camera":"Câmara do Cockpit do Veículo","Hide UI":"Esconder UI","Editor rotate part":"Rodar Peça do Editor","Editor height modifier":"Modificador de Altura do Editor","Editor delete part":"Eliminar Peça do Editor","Editor forwards":"Frente do Editor","Editor backwards":"Trás do Editor","Editor left":"Esquerda do Editor","Editor right":"Direita do Editor","Editor rotate left":"Rodar o editor para a esquerda","Editor rotate right":"Rodar o editor para a direita","Editor move down":"Mover o editor para baixo","Editor move up":"Mover o editor para cima","Editor test":"Teste de editor","Editor pick":"Escolha do editor","Toggle FPS counter":"Alternar Contador de FPS","Toggle spectator camera":"Alternar Câmara de Espectador","Spectator forwards":"Frente do Espectador","Spectator backwards":"Trás do Espectador","Spectator left":"Esquerda do Espectador","Spectator right":"Direita do Espectador","Spectator speed modifier":"Modificador de Velocidade do Espectador","Press any key...\n\nPress [Escape] to cancel.":"Pressione qualquer tecla...\n\nPressione [Escape] para cancelar.",Clear:"Limpar","New record":"Novo Recorde",Record:"Recorde",Current:"Atual",Difference:"Diferença",Copy:"Copiar",Import:"Importar","Failed to import track":"Falha ao importar a pista",'The track "{0}" already exists. Do you wish to overwrite it?':'A pista "{0}" já existe. Deseja substituí-la?',Overwrite:"Substituir","Paste track data here...":"Cole os dados da pista aqui...",Rank:"Classificação","No record":"Sem Registo","Standard tracks":"Pistas Padrão","Custom tracks":"Pistas Personalizadas",'Are you sure you want to delete "{0}"?':'Tem a certeza de que deseja eliminar "{0}"?',Delete:"Eliminar"},AI={Checkpoints:"Контрольные точки","Checkpoint order":"Порядок контрольных точек",Height:"Высота",Exit:"Выход",Random:"Случайный",Primary:"Основной",Secondary:"Вторичный",Frame:"Каркас",Rims:"Диски",Test:"Тест","Starting point is missing!":"Отсутствует стартовая точка!",Generate:"Генерировать","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"Ð’Ñ‹ уверены, что хотите создать новую трассу?\n\nÐаша текущая трасса будет потеряна!",Load:"Загрузить",Save:"Сохранить","Are you sure you want to load a new track?\n\nYour current track will be lost!":"Ð’Ñ‹ уверены, что хотите загрузить новую трассу?\n\nÐаша текущая трасса будет потеряна!","Failed to save - Track name is needed!":"Не удалось сохранить - требуется имя трассы!","Track saved!":"Трасса сохранена!","Failed to save!":"Не удалось сохранить!",'Are you sure you want to overwrite "{0}"?':'Ð’Ñ‹ уверены, что хотите перезаписать "{0}"?',Export:"Экспорт","Failed to export - Track name is needed!":"Не удалось экспортировать - требуется имя трассы!",Help:"Помощь","Track name":"Имя трассы","Are you sure you want to exit the editor?":"Ð’Ñ‹ уверены, что хотите выйти из редактора?","All unsaved data will be lost!":"Все несохраненные данные будут потеряны!","How to use the editor":"Как использовать редактор","Camera controls":"Управление камерой","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"Камеру можно перемещать, щелкая правой кнопкой мыши и перетаскивая мышь. Вращайте камеру, щелкнув средней кнопкой мыши (колесиком) или удерживая клавишу Ctrl и щелкнув правой кнопкой мыши и перетаскивая мышь. Масштабируйте внутрь и наружу, прокручивая колесико мыши.","Alternatively, the camera can also be controlled using the following keyboard keys:":"Кроме того, камеру можно управлять с помощью следующих клавиш клавиатуры:","Move forwards:":"Двигаться вперед:","Move backwards:":"Двигаться назад:","Move left:":"Двигаться влево:","Move right:":"Двигаться вправо:","Rotate left:":"Повернуть влево:","Rotate right:":"Повернуть вправо:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"Изменять высоту редактируемой части можно с помощью выбора высоты в левом нижнем углу или удерживая клавишу Shift и прокручивая колесико мыши. Кроме того, можно использовать следующие клавиши клавиатуры:","Move up:":"Двигаться вверх:","Move down:":"Двигаться вниз:",Editing:"Редактирование","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"Части трассы можно выбирать в меню справа, после чего их можно размещать, щелкнув левой кнопкой мыши.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"Кроме того, текущую часть трассы, на которую указывает мышь, можно выбрать с помощью следующей комбинации клавиш:","The selected part can then be rotated using the following keyboard shortcut:":"Выбранную часть можно повернуть с помощью следующей комбинации клавиш:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"Части трассы можно удалять с помощью инструмента удаления в правом меню или удерживая следующую клавишу:","Starting points, checkpoints and the finish line":"Стартовые точки, контрольные точки и финишная линия","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"Стартовые точки, контрольные точки и финишные линии можно выбрать в верхней категории правого меню.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"Каждая трасса должна иметь как минимум одну стартовую точку. Если есть несколько стартовых точек, будет использована последняя размещенная.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"Контрольные точки следует размещать между стартовой точкой и финишной линией. При выборе части трассы контрольной точки в правом нижнем углу появится инструмент для выбора порядка контрольной точки. Это определяет порядок, в котором контрольные точки должны быть пройдены перед движением к финишной линии. Обратите внимание, что возможно наличие нескольких контрольных точек с одним и тем же порядком контрольных точек.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"Финишная линия - это место, где заканчивается трасса, но она становится активной только после прохождения всех контрольных точек. Также возможно наличие нескольких финишных линий.","Starting point":"Стартовая точка",Checkpoint:"Контрольная точка","Finish line":"Финишная линия","Exporting the track":"Экспорт трассы","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"Когда трасса готова, в верхнем левом углу можно ввести имя трассы, после чего трассу можно экспортировать с помощью кнопки экспорта. Это позволит получить код трассы, который можно отправить другим пользователям, чтобы они могли импортировать и играть на трассе.",Close:"Закрыть","Not set":"Не установлено",or:"или","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"Камеру можно перемещать, перетаскивая одним пальцем. Вращайте камеру, перетаскивая двумя пальцами. Масштабируйте внутрь и наружу, сжимая и разжимая пальцами.","The edited height can be changed by using the height selection in the bottom left corner.":"Изменять высоту редактируемой части можно с помощью выбора высоты в левом нижнем углу.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"Части трассы можно выбирать в меню справа, после чего их можно размещать, касаясь экрана.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"Выбранную часть можно повернуть, касаясь кнопки поворота в левом нижнем углу.","Track parts can be deleted by using the delete tool in the right side menu.":"Части трассы можно удалять с помощью инструмента удаления в правом меню.","Press [{0}] or [{1}] to restart":"Нажмите [{0}] или [{1}] для перезапуска","Press [{0}] to restart":"Нажмите [{0}] для перезапуска",Leaderboard:"Таблица лидеров",Back:"Назад","Error: Failed to load leaderboard":"Ошибка: не удалось загрузить таблицу лидеров",Verified:"Подтверждено",Invalid:"Недействительно",Pending:"Ð’ ожидании",Loading:"Загрузка","Failed to load recording":"Не удалось загрузить запись",Ok:"Ок","Track is missing starting point":"Отсутствует стартовая точка на трассе","Failed to create user token.":"Не удалось создать токен пользователя.","Leaderboard is disabled.":"Таблица лидеров отключена.","Please try another browser or device.":"Пожалуйста, попробуйте другой браузер или устройство.","Computer determinism check failed.":"Проверка детерминизма компьютера не удалась.",Customize:"Настройка",Editor:"Редактор",Settings:"Настройки",Profile:"Профиль",Play:"Играть",Version:"Версия","You cannot have duplicate user profiles":"Нельзя иметь дублирующиеся профили пользователей","Failed to create user profile":"Не удалось создать профиль пользователя","This user profile does not exist on the server":"Этот профиль пользователя не существует на сервере","Failed to download user profile from the server":"Не удалось загрузить профиль пользователя с сервера","User token is invalid":"Недействительный токен пользователя","Are you sure you want to display your private key?":"Ð’Ñ‹ уверены, что хотите отобразить свой личный ключ?","DO NOT SHARE THIS KEY WITH ANYONE.":"НЕ ДЕЛИТЕСЬ ЭТИМ КЛЮЧОМ НИ С КЕМ.","You need a free user profile slot to import a new user profile":"Вам нужен свободный слот профиля пользователя для импорта нового профиля пользователя",Nickname:"Никнейм","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"Выберите никнейм, который будет отображаться в таблице лидеров. Ð’Ñ‹ можете изменить никнейм в любое время.",Cancel:"Отмена",Confirm:"Подтвердить",Verifier:"Подтверждающий","User ID":"Идентификатор пользователя",Profiles:"Профили",'Are you sure you would like to delete "{0}"?':'Ð’Ñ‹ уверены, что хотите удалить "{0}"?',Reset:"Сброс",Apply:"Применить",Gameplay:"Игровой процесс",Units:"Единицы измерения",Metric:"Метрическая",Imperial:"Имперская","Reset hint":"Сбросить подсказку",Disabled:"Выключено",Enabled:"Включено","Ghost car":"Призрачная машина","Cockpit camera mode":"Режим кабины",Hold:"Удерживать",Toggle:"Переключить","Checkpoints position":"Позиция контрольных точек","Timer position":"Позиция таймера","Speedometer position":"Позиция спидометра",Bottom:"Снизу",Top:"Сверху",Language:"Язык",Graphics:"Графика","Car shadow":"Тень автомобиля","Track shadow":"Тень трассы",Off:"Выключено",On:"Включено",Low:"Низкая",Medium:"Средняя",High:"Высокая",Clouds:"Облака",Particles:"Частицы",Skidmarks:"Отметины от скольжения","Render scale":"Масштаб рендера","Anti-aliasing (requires restart)":"Сглаживание (требуется перезапуск)",Audio:"Звук","Sound effect volume":"Громкость звуковых эффектов","Music volume":"Громкость музыки","Checkpoint volume":"Громкость контрольных точек",Controls:"Управление","Vehicle accelerate":"Ускорение автомобиля","Vehicle brake":"Торможение автомобиля","Vehicle turn left":"Поворот влево автомобиля","Vehicle turn right":"Поворот вправо автомобиля","Vehicle reset":"Сброс автомобиля","Vehicle cockpit camera":"Камера кабины автомобиля","Hide UI":"Скрыть интерфейс","Editor rotate part":"Поворот части в редакторе","Editor height modifier":"Модификатор высоты в редакторе","Editor delete part":"Удаление части в редакторе","Editor forwards":"Перемещение вперед в редакторе","Editor backwards":"Перемещение назад в редакторе","Editor left":"Перемещение влево в редакторе","Editor right":"Перемещение вправо в редакторе","Editor rotate left":"Повернуть редактор влево","Editor rotate right":"Повернуть редактор вправо","Editor move down":"Переместить редактор вниз","Editor move up":"Переместить редактор вверх","Editor test":"Тест редактора","Editor pick":"Выбор редактора","Toggle FPS counter":"Переключить счетчик FPS","Toggle spectator camera":"Переключить камеру наблюдателя","Spectator forwards":"Перемещение наблюдателя вперед","Spectator backwards":"Перемещение наблюдателя назад","Spectator left":"Перемещение наблюдателя влево","Spectator right":"Перемещение наблюдателя вправо","Spectator speed modifier":"Модификатор скорости наблюдателя","Press any key...\n\nPress [Escape] to cancel.":"Нажмите любую клавишу...\n\nНажмиÑе [Escape], чтобы отменить.",Clear:"Очистить","New record":"Новый рекорд",Record:"Рекорд",Current:"Текущее",Difference:"Разница",Copy:"Копировать",Import:"Импортировать","Failed to import track":"Не удалось импортировать трассу",'The track "{0}" already exists. Do you wish to overwrite it?':'Трасса "{0}" уже существует. Хотите перезаписать её?',Overwrite:"Перезаписать","Paste track data here...":"Вставьте данные трассы сюда...",Rank:"Ранг","No record":"Нет рекорда","Standard tracks":"Стандартные трассы","Custom tracks":"Пользовательские трассы",'Are you sure you want to delete "{0}"?':'Ð’Ñ‹ уверены, что хотите удалить "{0}"?',Delete:"Удалить"},CI={Checkpoints:"Kontroller","Checkpoint order":"Kontrol noktası sırası",Height:"Yükseklik",Exit:"Çıkış",Random:"Rastgele",Primary:"Birincil",Secondary:"İkincil",Frame:"Çerçeve",Rims:"Jantlar",Test:"Test","Starting point is missing!":"BaÅŸlangıç noktası eksik!",Generate:"OluÅŸtur","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"Yeni bir rota oluÅŸturmak istediÄŸinizden emin misiniz?\n\nMevcut rotanız kaybolacak!",Load:"Yükle",Save:"Kaydet","Are you sure you want to load a new track?\n\nYour current track will be lost!":"Yeni bir rota yüklemek istediÄŸinizden emin misiniz?\n\nMevcut rotanız kaybolacak!","Failed to save - Track name is needed!":"Kaydetme baÅŸarısız - Rota adı gerekiyor!","Track saved!":"Rota kaydedildi!","Failed to save!":"Kaydetme baÅŸarısız!",'Are you sure you want to overwrite "{0}"?':'"{0}" üzerine yazmak istediÄŸinizden emin misiniz?',Export:"Dışa Aktar","Failed to export - Track name is needed!":"Dışa aktarma baÅŸarısız - Rota adı gerekiyor!",Help:"Yardım","Track name":"Rota adı","Are you sure you want to exit the editor?":"Editörden çıkmak istediÄŸinizden emin misiniz?","All unsaved data will be lost!":"Tüm kaydedilmemiÅŸ veriler kaybolacak!","How to use the editor":"Editörü nasıl kullanılır","Camera controls":"Kamera kontrolleri","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"Kamerayı saÄŸ tıklayarak ve fareyi sürükleyerek hareket ettirebilirsiniz. Kamerayı orta fare düğmesine (fare tekerleÄŸi) tıklayarak veya kontrol tuÅŸunu basılı tutarak saÄŸ tıklayarak ve fareyi sürükleyerek döndürebilirsiniz. Fare tekerleÄŸi ile yakınlaÅŸtırma ve uzaklaÅŸtırma yapabilirsiniz.","Alternatively, the camera can also be controlled using the following keyboard keys:":"Alternatif olarak, kamera aÅŸağıdaki klavye tuÅŸları kullanılarak da kontrol edilebilir:","Move forwards:":"İleri hareket et:","Move backwards:":"Geri hareket et:","Move left:":"Sola hareket et:","Move right:":"SaÄŸa hareket et:","Rotate left:":"Sola döndür:","Rotate right:":"SaÄŸa döndür:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"Düzenlenen yükseklik, sol alt köşedeki yükseklik seçimini kullanarak veya Shift tuÅŸunu basılı tutarak ve fare tekerleÄŸini kaydırarak deÄŸiÅŸtirilebilir. Alternatif olarak, aÅŸağıdaki klavye tuÅŸlarını kullanabilirsiniz:","Move up:":"Yukarı hareket et:","Move down:":"AÅŸağı hareket et:",Editing:"Düzenleme","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"Parçalar, fareyle sol tıklayarak yerleÅŸtirilebilecekleri saÄŸ taraftaki menüden seçilebilir.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"Alternatif olarak, fare tarafından üzerine gelinen rota parçası aÅŸağıdaki klavye kısayoluyla seçilebilir:","The selected part can then be rotated using the following keyboard shortcut:":"Seçilen parça aÅŸağıdaki klavye kısayoluyla döndürülebilir:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"Rota parçaları, saÄŸ taraftaki menüdeki silme aracı kullanılarak veya aÅŸağıdaki tuÅŸa basılı tutarak silinebilir:","Starting points, checkpoints and the finish line":"BaÅŸlangıç noktaları, kontrol noktaları ve bitiÅŸ çizgisi","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"BaÅŸlangıç noktaları, kontrol noktaları ve bitiÅŸ çizgileri, saÄŸ taraftaki menünün en üst kategorisinde seçilebilir.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"Her rota en az bir baÅŸlangıç noktasına sahip olmalıdır. Birden fazla baÅŸlangıç noktası varsa, en son yerleÅŸtirilen kullanılacaktır.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"Kontrol noktaları, baÅŸlangıç noktası ile bitiÅŸ çizgisi arasına yerleÅŸtirilmelidir. Bir kontrol noktası rota parçası seçildiÄŸinde, kontrol noktasının sırasını seçmek için saÄŸ alt köşede bir araç bulunur. Bu, kontrol noktalarının bitiÅŸ çizgisine gitmeden önce geçilmesi gereken sırayı belirler. Aynı kontrol noktası sırasına sahip birden fazla kontrol noktası olabileceÄŸine dikkat edin.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"BitiÅŸ çizgisi, rotanın bittiÄŸi yerdir, ancak tüm kontrol noktaları geçildikten sonra aktif hale gelir. Birden fazla bitiÅŸ çizgisi de olabilir.","Starting point":"BaÅŸlangıç noktası",Checkpoint:"Kontrol noktası","Finish line":"BitiÅŸ çizgisi","Exporting the track":"Rotanın dışa aktarılması","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"Rota tamamlandığında, rota için bir ad girilebilir ve ardından rota düğmesini kullanarak rota dışa aktarılabilir. Bu, diÄŸer kullanıcılara gönderilebilecek bir rota kodunu ortaya çıkarır, böylece rota içe aktarılabilir ve oynanabilir.",Close:"Kapat","Not set":"Ayarlanmadı",or:"veya","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"Kamerayı bir parmakla sürükleyerek hareket ettirebilirsiniz. Kamerayı iki parmakla sürükleyerek döndürebilirsiniz. YakınlaÅŸtırmak ve uzaklaÅŸtırmak için sıkıştırabilirsiniz.","The edited height can be changed by using the height selection in the bottom left corner.":"Düzenlenen yükseklik, sol alt köşedeki yükseklik seçimi kullanılarak deÄŸiÅŸtirilebilir.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"Parçalar, ekrana dokunarak yerleÅŸtirilebilecekleri saÄŸ taraftaki menüden seçilebilir.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"Seçilen parça, sol alt köşedeki döndür düğmesine dokunarak döndürülebilir.","Track parts can be deleted by using the delete tool in the right side menu.":"Parçalar, saÄŸ taraftaki menüdeki silme aracı kullanılarak silinebilir.","Press [{0}] or [{1}] to restart":"Yeniden baÅŸlatmak için [{0}] veya [{1}] tuÅŸuna basın","Press [{0}] to restart":"Yeniden baÅŸlatmak için [{0}] tuÅŸuna basın",Leaderboard:"Liderlik Tablosu",Back:"Geri","Error: Failed to load leaderboard":"Hata: Liderlik tablosu yüklenemedi",Verified:"DoÄŸrulandı",Invalid:"Geçersiz",Pending:"Beklemede",Loading:"Yükleniyor","Failed to load recording":"Kayıt yüklenemedi",Ok:"Tamam","Track is missing starting point":"Rota baÅŸlangıç noktası eksik","Failed to create user token.":"Kullanıcı jetonu oluÅŸturulamadı.","Leaderboard is disabled.":"Liderlik tablosu devre dışı.","Please try another browser or device.":"Lütfen baÅŸka bir tarayıcı veya cihaz deneyin.","Computer determinism check failed.":"Bilgisayar belirlenim kontrolü baÅŸarısız oldu.",Customize:"ÃzelleÅŸtir",Editor:"Editör",Settings:"Ayarlar",Profile:"Profil",Play:"Oyna",Version:"Sürüm","You cannot have duplicate user profiles":"Çift kullanıcı profili oluÅŸturamazsınız","Failed to create user profile":"Kullanıcı profili oluÅŸturulamadı","This user profile does not exist on the server":"Bu kullanıcı profili sunucuda mevcut deÄŸil","Failed to download user profile from the server":"Kullanıcı profili sunucudan indirilemedi","User token is invalid":"Kullanıcı belirteci geçersiz","Are you sure you want to display your private key?":"Gizli anahtarınızı göstermek istediÄŸinizden emin misiniz?","DO NOT SHARE THIS KEY WITH ANYONE.":"BU ANAHTARI KİMSEYLE PAYLAÅžMAYIN.","You need a free user profile slot to import a new user profile":"Yeni bir kullanıcı profili eklemek için boÅŸ bir kullanıcı profili yuvasına ihtiyacınız var",Nickname:"Kullanıcı Adı","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"Liderlik tablosunda gösterilecek bir kullanıcı adı seçin. Kullanıcı adınızı istediÄŸiniz zaman deÄŸiÅŸtirebilirsiniz.",Cancel:"İptal",Confirm:"Onayla",Verifier:"DoÄŸrulayıcı","User ID":"Kullanıcı KimliÄŸi",Profiles:"Profiller",'Are you sure you would like to delete "{0}"?':'"{0}" silmek istediÄŸinizden emin misiniz?',Reset:"Sıfırla",Apply:"Uygula",Gameplay:"Oynanış",Units:"Birimler",Metric:"Metrik",Imperial:"İngiliz","Reset hint":"İpucunu sıfırla",Disabled:"Devre Dışı",Enabled:"Etkin","Ghost car":"Hayalet araba","Cockpit camera mode":"Kokpit kamera modu",Hold:"Basılı Tut",Toggle:"DeÄŸiÅŸtir","Checkpoints position":"Kontrol noktaları pozisyonu","Timer position":"Kronometre pozisyonu","Speedometer position":"Hız göstergesi pozisyonu",Bottom:"Alt",Top:"Üst",Language:"Dil",Graphics:"Grafikler","Car shadow":"Araba gölgesi","Track shadow":"Rota gölgesi",Off:"Kapalı",On:"Açık",Low:"Düşük",Medium:"Orta",High:"Yüksek",Clouds:"Bulutlar",Particles:"Partiküller",Skidmarks:"Lastik izleri","Render scale":"Görüntü ölçeÄŸi","Anti-aliasing (requires restart)":"Kenar yumuÅŸatma (yeniden baÅŸlatma gerektirir)",Audio:"Ses","Sound effect volume":"Ses efekti ses seviyesi","Music volume":"Müzik ses seviyesi","Checkpoint volume":"Kontrol noktası ses seviyesi",Controls:"Kontroller","Vehicle accelerate":"Araç hızlandır","Vehicle brake":"Araç fren","Vehicle turn left":"Araç sola dön","Vehicle turn right":"Araç saÄŸa dön","Vehicle reset":"Araç sıfırla","Vehicle cockpit camera":"Araç kokpit kamerası","Hide UI":"UI'ı Gizle","Editor rotate part":"Editör parçayı döndür","Editor height modifier":"Editör yükseklik düzenleyici","Editor delete part":"Editör parça sil","Editor forwards":"Editör ileri","Editor backwards":"Editör geri","Editor left":"Editör sola","Editor right":"Editör saÄŸa","Editor rotate left":"Editörü sola döndür","Editor rotate right":"Editörü saÄŸa döndür","Editor move down":"Editörü aÅŸağı taşı","Editor move up":"Editörü yukarı taşı","Editor test":"Editör testi","Editor pick":"Editör seçimi","Toggle FPS counter":"FPS sayacını aç/kapat","Toggle spectator camera":"İzleyici kamerasını aç/kapat","Spectator forwards":"İzleyici ileri","Spectator backwards":"İzleyici geri","Spectator left":"İzleyici sola","Spectator right":"İzleyici saÄŸa","Spectator speed modifier":"İzleyici hız düzenleyici","Press any key...\n\nPress [Escape] to cancel.":"Herhangi bir tuÅŸa basın...\n\nİptal etmek için [Escape] tuÅŸuna basın",Clear:"Temizle","New record":"Yeni kayıt",Record:"Kayıt",Current:"Mevcut",Difference:"Fark",Copy:"Kopyala",Import:"İçe Aktar","Failed to import track":"Rota içe aktarma baÅŸarısız oldu",'The track "{0}" already exists. Do you wish to overwrite it?':'"{0}" rota zaten var. Üzerine yazmak istiyor musunuz?',Overwrite:"Üzerine yaz","Paste track data here...":"Rota verilerini buraya yapıştır...",Rank:"Sıra","No record":"Kayıt yok","Standard tracks":"Standart rotalar","Custom tracks":"Ãzel rotalar",'Are you sure you want to delete "{0}"?':'"{0}" silmek istediÄŸinizden emin misiniz?',Delete:"Sil"},PI={Checkpoints:"Пункти контролю","Checkpoint order":"Порядок пунктів контролю",Height:"Висота",Exit:"Вихід",Random:"Випадково",Primary:"Основний",Secondary:"Додатковий",Frame:"Рама",Rims:"Дисків",Test:"Тест","Starting point is missing!":"Відсутня стартова точка!",Generate:"Генерувати","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"Ви впевнені, що хочете згенерувати новий трек?\n\nÐаш поточний трек буде втрачено!",Load:"Завантажити",Save:"Зберегти","Are you sure you want to load a new track?\n\nYour current track will be lost!":"Ви впевнені, що хочете завантажити новий трек?\n\nÐаш поточний трек буде втрачено!","Failed to save - Track name is needed!":"Не вдалося зберегти - потрібно вказати назву треку!","Track saved!":"Трек збережено!","Failed to save!":"Не вдалося зберегти!",'Are you sure you want to overwrite "{0}"?':'Ви впевнені, що хочете перезаписати "{0}"?',Export:"Експорт","Failed to export - Track name is needed!":"Не вдалося експортувати - потрібно вказати назву треку!",Help:"Довідка","Track name":"Назва треку","Are you sure you want to exit the editor?":"Ви впевнені, що хочете вийти з редактора?","All unsaved data will be lost!":"Всі не збережені дані будуть втрачені!","How to use the editor":"Як користуватися редактором","Camera controls":"Управління камерою","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"Камеру можна переміщувати, натискаючи праву кнопку миші Ñ– перетягуючи Ñ—Ñ—. Повертайте камеру, натискаючи середню кнопку миші (колесо миші) або утримуючи клавішу Control Ñ– натискаючи праву кнопку миші Ñ– перетягуючи Ñ—Ñ—. Збільшуйте та зменшуйте масштаб, прокручуючи колесо миші.","Alternatively, the camera can also be controlled using the following keyboard keys:":"Також камеру можна керувати за допомогою наступних клавіш на клавіатурі:","Move forwards:":"Рухатися вперед:","Move backwards:":"Рухатися назад:","Move left:":"Рухатися вліво:","Move right:":"Рухатися вправо:","Rotate left:":"Повернути вліво:","Rotate right:":"Повернути вправо:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"Редаговану висоту можна змінити, використовуючи вибір висоти в нижньому лівому куті або утримуючи клавішу Shift Ñ– прокручуючи колесо миші. Альтернативно, ви можете використовувати наступні клавіші на клавіатурі:","Move up:":"Рухатися вгору:","Move down:":"Рухатися вниз:",Editing:"Редагування","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"Частини треку можна вибрати в меню справа, після чого Ñ—Ñ… можна розмістити, натиснувши ліву кнопку миші.","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"Альтернативно, частину треку, над якою зараз знаходиться курсор миші, можна вибрати за допомогою наступної комбінації клавіш на клавіатурі:","The selected part can then be rotated using the following keyboard shortcut:":"Вибрану частину можна повернути за допомогою наступної комбінації клавіш на клавіатурі:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"Частини треку можна видалити, використовуючи інструмент видалення в бічному меню справа або утримуючи наступну клавішу:","Starting points, checkpoints and the finish line":"Стартові точки, контрольні пункти та фінішна лінія","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"Стартові точки, контрольні пункти та фінішна лінія можуть бути вибрані в найвищій категорії в бічному меню справа.","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"Кожен трек повинен мати принаймні одну стартову точку. Якщо Ñ” кілька стартових точок, буде використана остання розміщена.","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"Контрольні пункти слід розміщувати між стартовою точкою та фінішною лінією. Коли вибрана частина треку контрольного пункту, внизу справа з'явиться інструмент для вибору порядку контрольного пункту. Це визначає порядок, в якому контрольні пункти повинні бути пройдені перед рухом до фінішної лінії. Зверніть увагу, що можливо мати кілька контрольних пунктів з однаковим порядком контрольних пунктів.","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"Фінішна лінія - це місце, де закінчується трек, але вона стане активною лише після проходження всіх контрольних пунктів. Також можливо мати кілька фінішних ліній.","Starting point":"Стартова точка",Checkpoint:"Контрольний пункт","Finish line":"Фінішна лінія","Exporting the track":"Експорт треку","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"Коли трек готовий, вгорі зліва можна ввести назву треку, після чого трек можна експортувати, використовуючи кнопку експорту. Це розкриє код треку, який можна надіслати іншим користувачам, щоб вони могли імпортувати й грати трек.",Close:"Закрити","Not set":"Не встановлено",or:"або","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"Камеру можна переміщувати, перетягуючи одним пальцем. Повертайте камеру, перетягуючи двома пальцями. Збільшуйте та зменшуйте масштаб, стискаючи пальці.","The edited height can be changed by using the height selection in the bottom left corner.":"Редаговану висоту можна змінити, використовуючи вибір висоти в нижньому лівому куті.","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"Частини треку можна вибрати в меню справа, після чого Ñ—Ñ… можна розмістити, натиснувши на екран.","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"Вибрану частину можна повернути, натиснувши кнопку повороту в нижньому лівому куті.","Track parts can be deleted by using the delete tool in the right side menu.":"Частини треку можна видалити, використовуючи інструмент видалення в бічному меню справа.","Press [{0}] or [{1}] to restart":"Натисніть [{0}] або [{1}] для перезапуску","Press [{0}] to restart":"Натисніть [{0}] для перезапуску",Leaderboard:"Таблиця лідерів",Back:"Назад","Error: Failed to load leaderboard":"Помилка: не вдалося завантажити таблицю лідерів",Verified:"Підтверджено",Invalid:"Недійсний",Pending:"Очікує на підтвердження",Loading:"Завантаження","Failed to load recording":"Не вдалося завантажити запис",Ok:"Ок","Track is missing starting point":"Ð’ треку відсутня стартова точка","Failed to create user token.":"Не вдалося створити токен користувача.","Leaderboard is disabled.":"Таблиця лідерів вимкнена.","Please try another browser or device.":"Будь ласка, спробуйте інший браузер або пристрій.","Computer determinism check failed.":"Перевірка детермінізму комп'ютера не вдалася.",Customize:"Налаштувати",Editor:"Редактор",Settings:"Налаштування",Profile:"Профіль",Play:"Грати",Version:"Версія","You cannot have duplicate user profiles":"Ви не можете мати дубльовані профілі користувачів","Failed to create user profile":"Не вдалося створити профіль користувача","This user profile does not exist on the server":"Цей профіль користувача не існує на сервері","Failed to download user profile from the server":"Не вдалося завантажити профіль користувача з сервера","User token is invalid":"Недійсний токен користувача","Are you sure you want to display your private key?":"Ви впевнені, що хочете відобразити свій приватний ключ?","DO NOT SHARE THIS KEY WITH ANYONE.":"НЕ ДІЛІТЬСЯ ЦИМ КЛЮЧЕМ З КИМБУДЬ.","You need a free user profile slot to import a new user profile":"Вам потрібен вільний слот профілю користувача для імпорту нового профілю користувача",Nickname:"Псевдонім","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"Виберіть псевдонім для відображення в таблиці лідерів. Ви можете змінити псевдонім в будь-який час.",Cancel:"Скасувати",Confirm:"Підтвердити",Verifier:"Підтверджувач","User ID":"ID користувача",Profiles:"Профілі",'Are you sure you would like to delete "{0}"?':'Ви впевнені, що хочете видалити "{0}"?',Reset:"Скинути",Apply:"Застосувати",Gameplay:"Ігровий процес",Units:"Одиниці вимірювання",Metric:"Метричні",Imperial:"Імперські","Reset hint":"Скинути підказку",Disabled:"Вимкнено",Enabled:"Увімкнено","Ghost car":"Привид автомобіля","Cockpit camera mode":"Режим кабіни кокпіту",Hold:"Тримати",Toggle:"Перемикання","Checkpoints position":"Позиція контрольних точок","Timer position":"Позиція таймера","Speedometer position":"Позиція вимірювача швидкості",Bottom:"Знизу",Top:"Зверху",Language:"Мова",Graphics:"Графіка","Car shadow":"Тінь автомобіля","Track shadow":"Тінь треку",Off:"Вимкнено",On:"Увімкнено",Low:"Низькі",Medium:"Середні",High:"Високі",Clouds:"Хмари",Particles:"Частинки",Skidmarks:"Сліди","Render scale":"Масштаб рендерингу","Anti-aliasing (requires restart)":"Антиаліасинг (потребує перезапуску)",Audio:"Звук","Sound effect volume":"Гучність звукових ефектів","Music volume":"Гучність музики","Checkpoint volume":"Гучність пунктів контролю",Controls:"Управління","Vehicle accelerate":"Прискорення автомобіля","Vehicle brake":"Гальмо автомобіля","Vehicle turn left":"Поворот вліво автомобіля","Vehicle turn right":"Поворот вправо автомобіля","Vehicle reset":"Скидання автомобіля","Vehicle cockpit camera":"Камера кабіни автомобіля","Hide UI":"Сховати інтерфейс користувача","Editor rotate part":"Поворот частини редактора","Editor height modifier":"Модифікатор висоти редактора","Editor delete part":"Видалення частини редактора","Editor forwards":"Рух вперед редактора","Editor backwards":"Рух назад редактора","Editor left":"Рух вліво редактора","Editor right":"Рух вправо редактора","Editor rotate left":"Обертати редактор вліво","Editor rotate right":"Обертати редактор вправо","Editor move down":"Переміщувати редактор вниз","Editor move up":"Переміщувати редактор вгору","Editor test":"Тест редактора","Editor pick":"Вибір редактора","Toggle FPS counter":"Перемикач лічильника FPS","Toggle spectator camera":"Перемикач камери спостерігача","Spectator forwards":"Рух вперед спостерігача","Spectator backwards":"Рух назад спостерігача","Spectator left":"Рух вліво спостерігача","Spectator right":"Рух вправо спостерігача","Spectator speed modifier":"Модифікатор швидкості спостерігача","Press any key...\n\nPress [Escape] to cancel.":"Натисніть будь-яку клавішу...\n\nНаÑиснÑÑÑŒ [Escape], щоб скасувати.",Clear:"Очистити","New record":"Новий рекорд",Record:"Рекорд",Current:"Поточний",Difference:"Різниця",Copy:"Копіювати",Import:"Імпортувати","Failed to import track":"Не вдалося імпортувати трек",'The track "{0}" already exists. Do you wish to overwrite it?':'Трек "{0}" вже існує. Бажаєте перезаписати його?',Overwrite:"Перезаписати","Paste track data here...":"Вставте дані треку сюди...",Rank:"Ранг","No record":"Немає записів","Standard tracks":"Стандартні треки","Custom tracks":"Власні треки",'Are you sure you want to delete "{0}"?':'Ви впевнені, що хочете видалити "{0}"?',Delete:"Видалити"},RI={Checkpoints:"检查点","Checkpoint order":"检查点顺序",Height:"高度",Exit:"退出",Random:"随机",Primary:"主要",Secondary:"次要",Frame:"框架",Rims:"轮辋",Test:"测试","Starting point is missing!":"起点缺失!",Generate:"生成","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"确定要生成新赛道吗?\n\n当前èµé“将丢失!",Load:"åŠ è½½",Save:"保存","Are you sure you want to load a new track?\n\nYour current track will be lost!":"ç¡®å®šè¦åŠ è½½æ–°èµ›é“å—ï¼Ÿ\n\n当前èµé“将丢失!","Failed to save - Track name is needed!":"保存失败 - 需要赛道名称!","Track saved!":"赛道已保存!","Failed to save!":"保存失败!",'Are you sure you want to overwrite "{0}"?':'确定要覆盖 "{0}" 吗?',Export:"导出","Failed to export - Track name is needed!":"导出失败 - 需要赛道名称!",Help:"帮助","Track name":"赛道名称","Are you sure you want to exit the editor?":"确定要退出编辑器吗?","All unsaved data will be lost!":"所有未保存的数据将丢失!","How to use the editor":"如何使用编辑器","Camera controls":"相机控制","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"å¯ä»¥é€šè¿‡å³é”®å•å‡»å¹¶æ‹–åŠ¨é¼ æ ‡æ¥ç§»åŠ¨ç›¸æœºã€‚é€šè¿‡å•å‡»ä¸­é—´é¼ æ ‡æŒ‰é’®ï¼ˆé¼ æ ‡æ»šè½®ï¼‰æˆæŒ‰ä½Ctrl键并右键单击并æåŠ¨é¼ æ ‡æ¥æ—‹è½¬ç›¸æœºã€‚é€šè¿‡æ»šåŠ¨é¼ æ ‡æ»šè½®è¿›è¡Œç¼©æ”¾ã€‚","Alternatively, the camera can also be controlled using the following keyboard keys:":"或者,还可以使用以下键盘按键来控制相机:","Move forwards:":"向前移动:","Move backwards:":"向后移动:","Move left:":"向左移动:","Move right:":"向右移动:","Rotate left:":"向左旋转:","Rotate right:":"向右旋转:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"可以通过使用左ä¸è§çš„高度选æ©å™¨æ¥æ´æ”¹ç¼è¾çš„高度,也可以按住Shifté”®å¹¶æ»šåŠ¨é¼ æ ‡æ»šè½®ã€‚æˆ–è€…ï¼Œæ‚¨å¯ä»¥ä½¿ç”¨ä»¥ä¸‹é”®ç›˜æŒ‰é”®ï¼š","Move up:":"向上移动:","Move down:":"向下移动:",Editing:"编辑","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"å¯ä»¥åœ¨å³ä¾§èœå•ä¸­é€‰æ‹©è½¨é“éƒ¨ä»¶ï¼Œç„¶åŽå¯ä»¥ä½¿ç”¨é¼ æ ‡å·¦é”®å•å‡»æ”¾ç½®ã€‚","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"æˆ–è€…ï¼Œå¯ä»¥ä½¿ç”¨ä»¥ä¸‹é”®ç›˜å¿«æ·é”®é€‰æ‹©å½“å‰é¼ æ ‡æ‚¬åœçš„è½¨é“éƒ¨ä»¶ï¼š","The selected part can then be rotated using the following keyboard shortcut:":"然后可以使用以下键盘快捷键旋转所选部件:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"å¯ä»¥ä½¿ç”¨å³ä¾§èœå•ä¸­çš„åˆ é™¤å·¥å…·æˆ–æŒ‰ä½ä»¥ä¸‹é”®æ¥åˆ é™¤è½¨é“éƒ¨ä»¶ï¼š","Starting points, checkpoints and the finish line":"起点、检查点和终点","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"起点、检查点和终点都可以在右侧菜单的最上方类别中选择。","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"每个赛道必须至少有一个起点。如果有多个起点,则将使用最后放置的起点。","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"检查点应该放置在起点和终点之间。当选择检查点轨道部件时,底部右侧将有一个工具来选择检查点的顺序。这决定了在驶向终点之前必须通过检查点的顺序。请注意,可以有多个具有相同检查点顺序的检查点。","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"终点是赛道结束的地方,但只有在通过所有检查点后才会变为活动状态。也可以有多个终点。","Starting point":"起点",Checkpoint:"检查点","Finish line":"终点","Exporting the track":"导出赛道","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"å½“èµ›é“å®ŒæˆåŽï¼Œå¯ä»¥åœ¨å·¦ä¸Šè§’è¾“å…¥èµ›é“åç§°ï¼Œç„¶åŽå¯ä»¥ä½¿ç”¨å¯¼å‡ºæŒ‰é’®å¯¼å‡ºèµ›é“ã€‚è¿™å°†æ˜¾ç¤ºä¸€ä¸ªèµ›é“ä»£ç ï¼Œå¯ä»¥å°†å…¶å‘é€ç»™å…¶ä»–ç”¨æˆ·ï¼Œä»¥ä¾¿ä»–ä»¬å¯ä»¥å¯¼å…¥å’Œæ’­æ”¾èµ›é“ã€‚",Close:"关闭","Not set":"未设置",or:"或","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"ç›¸æœºå¯ä»¥é€šè¿‡ç”¨ä¸€æ ¹æ‰‹æŒ‡æ‹–åŠ¨æ¥ç§»åŠ¨ã€‚é€šè¿‡ç”¨ä¸¤æ ¹æ‰‹æŒ‡æ‹–åŠ¨æ¥æ—‹è½¬ç›¸æœºã€‚é€šè¿‡æåˆæ¥æ”¾å¤§å’Œç¼©å°ã€‚","The edited height can be changed by using the height selection in the bottom left corner.":"可以通过使用左下角的高度选择器来更改编辑的高度。","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"可以在右侧菜单中选择轨道部件,然后可以通过点击屏幕来放置。","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"然后可以通过点击左下角的旋转按钮来旋转所选部件。","Track parts can be deleted by using the delete tool in the right side menu.":"å¯ä»¥ä½¿ç”¨å³ä¾§èœå•ä¸­çš„åˆ é™¤å·¥å…·æ¥åˆ é™¤è½¨é“éƒ¨ä»¶ã€‚","Press [{0}] or [{1}] to restart":"按 [{0}] 或 [{1}] 重新开始","Press [{0}] to restart":"按 [{0}] 重新开始",Leaderboard:"排行榜",Back:"返回","Error: Failed to load leaderboard":"é”™è¯¯ï¼šåŠ è½½æŽ’è¡Œæ¦œå¤±è´¥",Verified:"已验证",Invalid:"æ— æ•ˆ",Pending:"待处理",Loading:"åŠ è½½ä¸­","Failed to load recording":"åŠ è½½å½•åƒå¤±è´¥",Ok:"确定","Track is missing starting point":"赛道缺失起点","Failed to create user token.":"æ— æ³•åˆ›å»ºç”¨æˆ·ä»¤ç‰Œã€‚","Leaderboard is disabled.":"排行榜已禁用。","Please try another browser or device.":"请尝试其他浏览器或设备。","Computer determinism check failed.":"计算机确定性检查失败。",Customize:"自定义",Editor:"编辑器",Settings:"设置",Profile:"个人资料",Play:"游戏",Version:"版本","You cannot have duplicate user profiles":"您不能拥有重复的用户配置文件","Failed to create user profile":"创建用户配置文件失败","This user profile does not exist on the server":"服务器上不存在此用户配置文件","Failed to download user profile from the server":"æ— æ³•ä»ŽæœåŠ¡å™¨ä¸‹è½½ç”¨æˆ·é…ç½®æ–‡ä»¶","User token is invalid":"ç”¨æˆ·ä»¤ç‰Œæ— æ•ˆ","Are you sure you want to display your private key?":"确定要显示您的私钥吗?","DO NOT SHARE THIS KEY WITH ANYONE.":"请勿与任何人分享此密钥。","You need a free user profile slot to import a new user profile":"您需要一个空闲的用户配置文件槽来导入新的用户配置文件",Nickname:"昵称","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"选择在排行榜中显示的昵称。您可以随时更改昵称。",Cancel:"取消",Confirm:"确认",Verifier:"验证器","User ID":"用户ID",Profiles:"配置文件",'Are you sure you would like to delete "{0}"?':'æ‚¨ç¡®å®šè¦åˆ é™¤ "{0}" 吗?',Reset:"重置",Apply:"应用",Gameplay:"游戏方式",Units:"单位",Metric:"公制",Imperial:"英制","Reset hint":"重置提示",Disabled:"禁用",Enabled:"启用","Ghost car":"幽灵车","Cockpit camera mode":"座舱摄像头模式",Hold:"按住",Toggle:"切换","Checkpoints position":"检查点位置","Timer position":"计时器位置","Speedometer position":"速度表位置",Bottom:"底部",Top:"顶部",Language:"语言",Graphics:"图形","Car shadow":"车辆阴影","Track shadow":"赛道阴影",Off:"关闭",On:"打开",Low:"低",Medium:"中",High:"高",Clouds:"云",Particles:"粒子",Skidmarks:"打滑痕迹","Render scale":"渲染比例","Anti-aliasing (requires restart)":"抗锯齿(需要重启)",Audio:"音频","Sound effect volume":"音效音量","Music volume":"音乐音量","Checkpoint volume":"检查点音量",Controls:"控制","Vehicle accelerate":"è½¦è¾†åŠ é€Ÿ","Vehicle brake":"车辆刹车","Vehicle turn left":"车辆左转","Vehicle turn right":"车辆右转","Vehicle reset":"车辆重置","Vehicle cockpit camera":"车辆驾驶舱摄像机","Hide UI":"隐藏用户界面","Editor rotate part":"编辑器旋转零件","Editor height modifier":"编辑器高度调整器","Editor delete part":"ç¼–è¾‘å™¨åˆ é™¤é›¶ä»¶","Editor forwards":"编辑器前进","Editor backwards":"编辑器后退","Editor left":"编辑器左转","Editor right":"编辑器右转","Editor rotate left":"编辑器向左旋转","Editor rotate right":"编辑器向右旋转","Editor move down":"编辑器向下移动","Editor move up":"编辑器向上移动","Editor test":"编辑器测试","Editor pick":"编辑器精选","Toggle FPS counter":"切换FPS计数器","Toggle spectator camera":"切换旁观摄像机","Spectator forwards":"旁观前进","Spectator backwards":"旁观后退","Spectator left":"旁观左转","Spectator right":"旁观右转","Spectator speed modifier":"旁观速度调整器","Press any key...\n\nPress [Escape] to cancel.":"按任意键...\n\n按 [Escape] 取消。",Clear:"清除","New record":"新记录",Record:"记录",Current:"当前",Difference:"差异",Copy:"复制",Import:"导入","Failed to import track":"导入赛道失败",'The track "{0}" already exists. Do you wish to overwrite it?':'赛道 "{0}" 已存在。您是否要覆盖它?',Overwrite:"覆盖","Paste track data here...":"在此粘贴赛道数据...",Rank:"排名","No record":"æ— è®°å½•","Standard tracks":"æ ‡å‡†èµ›é“","Custom tracks":"自定义赛道",'Are you sure you want to delete "{0}"?':'ç¡®å®šè¦åˆ é™¤ "{0}" 吗?',Delete:"åˆ é™¤"},LI={Checkpoints:"檢查點","Checkpoint order":"æª¢æŸ¥é»žé †åº",Height:"高度",Exit:"退出",Random:"隨機",Primary:"主要",Secondary:"次要",Frame:"框架",Rims:"輪框",Test:"測試","Starting point is missing!":"起點缺失!",Generate:"生成","Are you sure you want to generate a new track?\n\nYour current track will be lost!":"您確定要生成新賽道嗎?\n\næ¨ç•¶å‰çš„賽道將會丟失!",Load:"載入",Save:"保存","Are you sure you want to load a new track?\n\nYour current track will be lost!":"您確定要載入新賽道嗎?\n\næ¨ç•¶å‰çš„賽道將會丟失!","Failed to save - Track name is needed!":"保存失敗 - 需要賽道名稱!","Track saved!":"賽道已保存!","Failed to save!":"保存失敗!",'Are you sure you want to overwrite "{0}"?':'您確定要覆蓋 "{0}" 嗎?',Export:"匯出","Failed to export - Track name is needed!":"匯出失敗 - 需要賽道名稱!",Help:"幫助","Track name":"賽道名稱","Are you sure you want to exit the editor?":"您確定要退出編輯器嗎?","All unsaved data will be lost!":"所有未儲存的資料將遺失!","How to use the editor":"如何使用編輯器","Camera controls":"攝影機控制","The camera can be moved by right clicking and dragging the mouse. Rotate the camera by clicking the middle mouse button (mouse wheel) or holding the control key and right clicking and dragging the mouse. Zoom in and out by scrolling the mouse wheel.":"æ”å½±æ©Ÿå¯ä»¥é€šéŽå³éµé»žæ“Šä¸¦æ‹–å‹•é¼ æ¨™ä¾†ç§»å‹•ã€‚é€šéŽé»žæ“Šä¸­é–“çš„é¼ æ¨™æŒ‰éˆ•ï¼ˆæ»¾è¼ªï¼‰æˆæŒ‰ä½Ctrl鍵並右鍵點擊並æå•é¼ æ¨™ä¾†æ—‹è½‰æ”å½±æ©Ÿã€‚é€šéŽæ»¾å‹•é¼ æ¨™æ»¾è¼ªä¾†æ”¾å¤§å’Œç¸®å°ã€‚","Alternatively, the camera can also be controlled using the following keyboard keys:":"或者,攝影機也可以使用以下鍵盤按鍵進行控制:","Move forwards:":"向前移動:","Move backwards:":"向後移動:","Move left:":"向左移動:","Move right:":"向右移動:","Rotate left:":"向左旋轉:","Rotate right:":"向右旋轉:","The edited height can be changed either by using the height selection in the bottom left corner, or holding the shift key and scrolling the mouse wheel. Alternatively, you can use the following keyboard keys:":"可以通過使用左ä¸è§çš„é«˜åº¦é¸æ“‡å™¨ä¾†æ´æ”¹ç·¨è¼¯çš„高度,也可以按住Shift鍵並滾å•é¼ æ¨™æ»¾è¼ªã€‚æˆ–è€…ï¼Œæ‚¨å¯ä»¥ä½¿ç”¨ä»¥ä¸‹éµç›¤æŒ‰éµï¼š","Move up:":"向上移動:","Move down:":"向下移動:",Editing:"編輯","Track parts can be selected in the menu on the right after which they can be placed by left clicking with the mouse.":"å¯ä»¥åœ¨å³å´çš„èœå–®ä¸­é¸æ“‡è»Œé“éƒ¨ä»¶ï¼Œç„¶å¾Œå¯ä»¥ä½¿ç”¨é¼ æ¨™å·¦éµé»žæ“Šæ”¾ç½®ã€‚","Alternatively, the track part currently hovered by the mouse can be selected with the following keyboard shortcut:":"æˆ–è€…ï¼Œå¯ä»¥ä½¿ç”¨ä»¥ä¸‹éµç›¤å¿«æ·éµé¸æ“‡ç•¶å‰é¼ æ¨™æ‡¸åœçš„è»Œé“éƒ¨ä»¶ï¼š","The selected part can then be rotated using the following keyboard shortcut:":"然後可以使用以下鍵盤快捷鍵旋轉所選部分:","Track parts can be deleted by using the delete tool in the right side menu or by holding the following key:":"可以使用右側菜單中的刪除工具或按住以下鍵來刪除軌道部件:","Starting points, checkpoints and the finish line":"起點、檢查點和終點","Starting points, checkpoints and finish lines can all be selected in the uppermost category in the right side menu.":"起點、檢查點和終點都可以在右側菜單的最上方類別中選擇。","Each track must have at least one starting point. If there are multiple starting points, the last placed one will be used.":"æ¯å€‹è³½é“å¿…é ˆè‡³å°‘æœ‰ä¸€å€‹èµ·é»žã€‚å¦‚æžœæœ‰å¤šå€‹èµ·é»žï¼Œå‰‡ä½¿ç”¨æœ€å¾Œæ”¾ç½®çš„èµ·é»žã€‚","Checkpoints should be placed between the starting point and the finish line. When a checkpoint track part is selected there will be a tool in the bottom right to select the order of the checkpoint. This determines the order in which the checkpoints must be passed before driving to the finish line. Notice that it is possible to have multiple checkpoints with the same checkpoint order.":"æª¢æŸ¥é»žæ‡‰è©²æ”¾ç½®åœ¨èµ·é»žå’Œçµ‚é»žä¹‹é–“ã€‚ç•¶é¸æ“‡æª¢æŸ¥é»žè»Œé“éƒ¨ä»¶æ™‚ï¼Œåº•éƒ¨å³å´å°‡æœ‰ä¸€å€‹å·¥å…·ä¾†é¸æ“‡æª¢æŸ¥é»žçš„é †åºã€‚é€™æ±ºå®šäº†åœ¨é–‹å§‹è¡Œé§›åˆ°çµ‚é»žä¹‹å‰å¿…é ˆé€šéŽæª¢æŸ¥é»žçš„é †åºã€‚è«‹æ³¨æ„ï¼Œå¯ä»¥æœ‰å¤šå€‹å…·æœ‰ç›¸åŒæª¢æŸ¥é»žé †åºçš„æª¢æŸ¥é»žã€‚","The finish line is where the track ends but will only become active after all checkpoints have been passed. It is also possible to have multiple finish lines.":"終點是賽道結束的地方,但只有在通過所有檢查點後才會變為活動狀態。也可以有多個終點。","Starting point":"起點",Checkpoint:"檢查點","Finish line":"終點","Exporting the track":"導出賽道","When the track is finished, a name for the track can be entered in top left after which the track can be exported using the export button. This will reveal a track code which can be sent to other users so they can import and play the track.":"完成賽道後,可以在左上角輸入賽道名稱,然後使用導出按鈕導出賽道。這將顯示一個賽道代碼,可以將其發送給其他用戶,以便他們可以導入並播放賽道。",Close:"關閉","Not set":"未設置",or:"或","The camera can be moved by dragging with one finger. Rotate the camera by dragging with two fingers. Zoom in and out by pinching.":"æ”å½±æ©Ÿå¯ä»¥é€šéŽç”¨ä¸€æ ¹æ‰‹æŒ‡æ‹–å‹•ä¾†ç§»å‹•ã€‚é€šéŽç”¨å…©æ ¹æ‰‹æŒ‡æ‹–å‹•ä¾†æ—‹è½‰æ”å½±æ©Ÿã€‚é€šéŽæåˆä¾†æ”¾å¤§å’Œç¸®å°ã€‚","The edited height can be changed by using the height selection in the bottom left corner.":"可以通過使用左下角的高度選擇器來更改編輯的高度。","Track parts can be selected in the menu on the right after which they can be placed by tapping on the screen.":"可以在右側的菜單中選擇軌道部件,然後可以通過點擊屏幕來放置。","The selected part can then be rotated by tapping the rotate button in the bottom left corner.":"然後可以通過點擊左下角的旋轉按鈕來旋轉所選部分。","Track parts can be deleted by using the delete tool in the right side menu.":"可以使用右側菜單中的刪除工具來刪除軌道部件。","Press [{0}] or [{1}] to restart":"按 [{0}] 或 [{1}] 重新開始","Press [{0}] to restart":"按 [{0}] 重新開始",Leaderboard:"排行榜",Back:"返回","Error: Failed to load leaderboard":"錯誤:無法載入排行榜",Verified:"已驗證",Invalid:"無效",Pending:"待定",Loading:"載入中","Failed to load recording":"載入錄影失敗",Ok:"確定","Track is missing starting point":"賽道缺少起點","Failed to create user token.":"無法建立使用者憑證。","Leaderboard is disabled.":"排行榜已停用。","Please try another browser or device.":"請嘗試其他瀏覽器或設備。","Computer determinism check failed.":"電腦確定性檢查失敗。",Customize:"自訂",Editor:"編輯器",Settings:"設定",Profile:"個人資料",Play:"遊玩",Version:"版本","You cannot have duplicate user profiles":"您不能擁有重複的使用者檔案","Failed to create user profile":"無法建立使用者檔案","This user profile does not exist on the server":"此使用者檔案不存在於伺服器上","Failed to download user profile from the server":"無法從伺服器下載使用者檔案","User token is invalid":"使用者令牌無效","Are you sure you want to display your private key?":"確定要顯示您的私密金鑰嗎?","DO NOT SHARE THIS KEY WITH ANYONE.":"請勿與任何人分享此金鑰。","You need a free user profile slot to import a new user profile":"您需要一個空閒的使用者檔案插槽以匯入新的使用者檔案",Nickname:"暱稱","Choose a nickname to be shown in the leaderboard. Your nickname can be changed at any time.":"選擇一個在排行榜中顯示的暱稱。您隨時可以更改您的暱稱。",Cancel:"取消",Confirm:"確認",Verifier:"驗證者","User ID":"使用者 ID",Profiles:"配置檔",'Are you sure you would like to delete "{0}"?':'您確定要刪除 "{0}" 嗎?',Reset:"重設",Apply:"套用",Gameplay:"遊戲玩法",Units:"單位",Metric:"公制",Imperial:"英制","Reset hint":"重設提示",Disabled:"禁用",Enabled:"啟用","Ghost car":"鬼車","Cockpit camera mode":"座艙攝影機模式",Hold:"按住",Toggle:"切換","Checkpoints position":"檢查點位置","Timer position":"計時器位置","Speedometer position":"速度計位置",Bottom:"底部",Top:"é ‚éƒ¨",Language:"語言",Graphics:"圖形","Car shadow":"車影","Track shadow":"賽道影子",Off:"é—œ",On:"é–‹",Low:"低",Medium:"中",High:"高",Clouds:"雲彩",Particles:"粒子",Skidmarks:"滑胎痕跡","Render scale":"渲染比例","Anti-aliasing (requires restart)":"抗鋸齒 (需要重新啟動)",Audio:"音效","Sound effect volume":"音效音量","Music volume":"音樂音量","Checkpoint volume":"檢查點音量",Controls:"控制","Vehicle accelerate":"è»Šè¼›åŠ é€Ÿ","Vehicle brake":"車輛煞車","Vehicle turn left":"車輛左轉","Vehicle turn right":"車輛右轉","Vehicle reset":"車輛重置","Vehicle cockpit camera":"車輛座艙攝影機","Hide UI":"隱藏使用者介面","Editor rotate part":"編輯器旋轉零件","Editor height modifier":"編輯器高度修改器","Editor delete part":"編輯器刪除零件","Editor forwards":"編輯器前進","Editor backwards":"編輯器後退","Editor left":"編輯器向左","Editor right":"編輯器向右","Editor rotate left":"向左旋轉編輯器","Editor rotate right":"向右旋轉編輯器","Editor move down":"向下移動編輯器","Editor move up":"向上移動編輯器","Editor test":"編輯器測試","Editor pick":"編輯器選擇","Toggle FPS counter":"切換 FPS 計數器","Toggle spectator camera":"切換旁觀攝影機","Spectator forwards":"旁觀前進","Spectator backwards":"旁觀後退","Spectator left":"旁觀向左","Spectator right":"旁觀向右","Spectator speed modifier":"旁觀速度調整器","Press any key...\n\nPress [Escape] to cancel.":"按下任意鍵...\n\n按 [Escape] 取消。",Clear:"清除","New record":"新紀錄",Record:"紀錄",Current:"目前",Difference:"差異",Copy:"複製",Import:"匯入","Failed to import track":"匯入賽道失敗",'The track "{0}" already exists. Do you wish to overwrite it?':'賽道 "{0}" 已存在。您要覆蓋它嗎?',Overwrite:"覆蓋","Paste track data here...":"在此粘貼賽道數據...",Rank:"排名","No record":"無紀錄","Standard tracks":"標準賽道","Custom tracks":"自訂賽道",'Are you sure you want to delete "{0}"?':'您確定要刪除 "{0}" 嗎?',Delete:"刪除"};var II,NI,DI,UI,BI,OI=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},zI=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};NI=new WeakMap,DI=new WeakMap,UI=new WeakMap,II=new WeakSet,BI=function(e){const t=OI(this,UI,"f").get(e);return null!=t?t:yI};const FI=class{constructor(e){II.add(this),NI.set(this,!1),DI.set(this,void 0),UI.set(this,new Map([["ar",vI],["de-DE",wI],["es-ES",bI],["fr-FR",xI],["it-IT",_I],["ja-JP",kI],["ko-KR",EI],["pl-PL",SI],["pt-BR",MI],["pt-PT",TI],["ru-RU",AI],["tr-TR",CI],["uk-UA",PI],["zh-CN",RI],["zh-TW",LI]])),zI(this,DI,OI(this,II,"m",BI).call(this,e),"f")}set language(e){zI(this,DI,OI(this,II,"m",BI).call(this,e),"f")}get(e,t){let n;return n=OI(this,NI,"f")?"###":e in OI(this,DI,"f")?OI(this,DI,"f")[e]:e,null!=t&&t.forEach(((e,t)=>{n=n.replace(new RegExp("\\{"+t+"\\}","g"),e)})),n}};var WI=n(465),HI={};HI.styleTagTransform=u(),HI.setAttributes=l(),HI.insert=o().bind(null,"head"),HI.domAPI=r(),HI.insertStyleElement=h();t()(WI.A,HI);WI.A&&WI.A.locals&&WI.A.locals;var VI,GI,jI,qI,XI,YI,KI=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},ZI=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};VI=new WeakMap,GI=new WeakMap,jI=new WeakMap,qI=new WeakMap,XI=new WeakMap,YI=new WeakMap;const JI=class{constructor(){VI.set(this,void 0),GI.set(this,void 0),jI.set(this,void 0),qI.set(this,void 0),XI.set(this,void 0),YI.set(this,void 0),KI(this,VI,document.getElementById("ui"),"f"),KI(this,GI,document.createElement("div"),"f"),ZI(this,GI,"f").className="input-visualizer",ZI(this,VI,"f").appendChild(ZI(this,GI,"f")),KI(this,jI,document.createElement("div"),"f"),ZI(this,jI,"f").className="arrow-up",ZI(this,jI,"f").innerHTML='<img src="images/arrow_up.svg">',ZI(this,GI,"f").appendChild(ZI(this,jI,"f")),KI(this,qI,document.createElement("div"),"f"),ZI(this,qI,"f").className="arrow-right",ZI(this,qI,"f").innerHTML='<img src="images/arrow_right.svg">',ZI(this,GI,"f").appendChild(ZI(this,qI,"f")),KI(this,XI,document.createElement("div"),"f"),ZI(this,XI,"f").className="arrow-down",ZI(this,XI,"f").innerHTML='<img src="images/arrow_down.svg">',ZI(this,GI,"f").appendChild(ZI(this,XI,"f")),KI(this,YI,document.createElement("div"),"f"),ZI(this,YI,"f").className="arrow-left",ZI(this,YI,"f").innerHTML='<img src="images/arrow_left.svg">',ZI(this,GI,"f").appendChild(ZI(this,YI,"f"))}dispose(){ZI(this,VI,"f").removeChild(ZI(this,GI,"f"))}update(e){ZI(this,jI,"f").className=e.up?"active arrow-up":"arrow-up",ZI(this,qI,"f").className=e.right?"active arrow-right":"arrow-right",ZI(this,XI,"f").className=e.down?"active arrow-down":"arrow-down",ZI(this,YI,"f").className=e.left?"active arrow-left":"arrow-left"}};var QI=n(543),$I={};$I.styleTagTransform=u(),$I.setAttributes=l(),$I.insert=o().bind(null,"head"),$I.domAPI=r(),$I.insertStyleElement=h();t()(QI.A,$I);QI.A&&QI.A.locals&&QI.A.locals;var eN,tN,nN,iN,rN,aN,oN,sN,lN,cN,hN,dN,uN,pN,fN,mN,gN=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},vN=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};tN=new WeakMap,nN=new WeakMap,iN=new WeakMap,rN=new WeakMap,aN=new WeakMap,oN=new WeakMap,sN=new WeakMap,lN=new WeakMap,cN=new WeakMap,hN=new WeakMap,dN=new WeakMap,uN=new WeakMap,pN=new WeakMap,eN=new WeakSet,fN=function(e){const t=vN(this,aN,"f").getBoundingClientRect(),n=(e.clientX-t.left)/(t.width-8),i=new rp(Math.max(0,Math.floor(n*vN(this,hN,"f").time*1e3)));vN(this,nN,"f").call(this,i)},mN=function(){vN(this,cN,"f")?vN(this,rN,"f").innerHTML='<img src="images/reset.svg">':vN(this,lN,"f")?vN(this,rN,"f").innerHTML='<img src="images/play.svg">':vN(this,rN,"f").innerHTML='<img src="images/pause.svg">'};const wN=class{constructor(e,t,n,i){eN.add(this),tN.set(this,void 0),nN.set(this,void 0),iN.set(this,void 0),rN.set(this,void 0),aN.set(this,void 0),oN.set(this,void 0),sN.set(this,void 0),lN.set(this,void 0),cN.set(this,!1),hN.set(this,void 0),dN.set(this,!1),uN.set(this,void 0),pN.set(this,void 0),gN(this,lN,i,"f"),gN(this,tN,document.getElementById("ui"),"f"),gN(this,nN,n,"f"),gN(this,hN,t,"f"),gN(this,iN,document.createElement("div"),"f"),vN(this,iN,"f").className="time-bar",vN(this,tN,"f").appendChild(vN(this,iN,"f")),gN(this,rN,document.createElement("button"),"f"),vN(this,rN,"f").className="button",vN(this,rN,"f").addEventListener("click",(()=>{e.playUIClick(),vN(this,cN,"f")?(vN(this,nN,"f").call(this,new rp(0)),this.isPaused=!1):this.isPaused=!this.isPaused})),vN(this,iN,"f").appendChild(vN(this,rN,"f")),vN(this,eN,"m",mN).call(this),gN(this,aN,document.createElement("div"),"f"),vN(this,aN,"f").className="bar",vN(this,aN,"f").addEventListener("pointerdown",(e=>{gN(this,dN,!0,"f"),vN(this,eN,"m",fN).call(this,e)})),window.addEventListener("pointermove",gN(this,uN,(e=>{vN(this,dN,"f")&&vN(this,eN,"m",fN).call(this,e)}),"f")),window.addEventListener("pointerup",gN(this,pN,(e=>{vN(this,dN,"f")&&(gN(this,dN,!1,"f"),vN(this,eN,"m",fN).call(this,e))}),"f")),vN(this,iN,"f").appendChild(vN(this,aN,"f"));const r=document.createElement("div");if(vN(this,aN,"f").appendChild(r),gN(this,oN,document.createElement("div"),"f"),vN(this,oN,"f").className="unloaded-fill",r.appendChild(vN(this,oN,"f")),gN(this,sN,document.createElement("div"),"f"),vN(this,sN,"f").className="fill",r.appendChild(vN(this,sN,"f")),vN(this,hN,"f").time<1e4){let e,t;vN(this,hN,"f").time>2e3?(e=60,t=600):vN(this,hN,"f").time>200?(e=10,t=60):(e=1,t=10);for(let n=e;n<vN(this,hN,"f").time;n+=e){const e=document.createElement("div");e.className=n%t==0?"dash long":"dash",e.style.left="calc("+n/vN(this,hN,"f").time*100+"% - 1px)",r.appendChild(e)}}}dispose(){vN(this,tN,"f").removeChild(vN(this,iN,"f")),window.removeEventListener("pointermove",vN(this,uN,"f")),window.removeEventListener("pointerup",vN(this,pN,"f"))}get isDragging(){return vN(this,dN,"f")}get isPaused(){return vN(this,lN,"f")}set isPaused(e){gN(this,lN,e,"f"),vN(this,eN,"m",mN).call(this)}set time(e){let t;null==vN(this,hN,"f")?(t=!1,vN(this,sN,"f").style.visibility="hidden"):(t=e.numberOfFrames>=vN(this,hN,"f").numberOfFrames,vN(this,sN,"f").style.width="calc(8px + "+e.numberOfFrames/vN(this,hN,"f").numberOfFrames*100+"%)",0==e.numberOfFrames?vN(this,sN,"f").style.visibility="hidden":vN(this,sN,"f").style.visibility="visible"),vN(this,cN,"f")!=t&&(gN(this,cN,t,"f"),vN(this,eN,"m",mN).call(this))}set loadedTime(e){null==vN(this,hN,"f")?vN(this,oN,"f").style.visibility="hidden":(vN(this,oN,"f").style.width="calc(8px + "+100*(1-e.numberOfFrames/vN(this,hN,"f").numberOfFrames)+"%)",e.numberOfFrames>=vN(this,hN,"f").numberOfFrames?vN(this,oN,"f").style.visibility="hidden":vN(this,oN,"f").style.visibility="visible")}};var yN=n(768),bN={};bN.styleTagTransform=u(),bN.setAttributes=l(),bN.insert=o().bind(null,"head"),bN.domAPI=r(),bN.insertStyleElement=h();t()(yN.A,bN);yN.A&&yN.A.locals&&yN.A.locals;var xN,_N,kN=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},EN=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};xN=new WeakMap,_N=new WeakMap;const SN=class{constructor(e,t,n){xN.set(this,void 0),_N.set(this,void 0),kN(this,xN,document.getElementById("ui"),"f"),kN(this,_N,document.createElement("div"),"f"),EN(this,_N,"f").className="preview-toolbar";const i=document.createElement("button");i.className="button",i.innerHTML='<img class="button-icon" src="images/quit.svg"> ',i.append(document.createTextNode(t.get("Exit"))),i.addEventListener("click",(()=>{e.playUIClick(),n()})),EN(this,_N,"f").appendChild(i),EN(this,xN,"f").appendChild(EN(this,_N,"f"))}dispose(){EN(this,xN,"f").removeChild(EN(this,_N,"f"))}};var MN,TN,AN,CN,PN,RN,LN,IN,NN,DN,UN,BN,ON,zN,FN,WN,HN,VN,GN,jN,qN,XN,YN,KN,ZN,JN,QN,$N=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},eD=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};TN=new WeakMap,AN=new WeakMap,CN=new WeakMap,PN=new WeakMap,RN=new WeakMap,LN=new WeakMap,IN=new WeakMap,NN=new WeakMap,DN=new WeakMap,UN=new WeakMap,BN=new WeakMap,ON=new WeakMap,zN=new WeakMap,FN=new WeakMap,WN=new WeakMap,HN=new WeakMap,VN=new WeakMap,GN=new WeakMap,jN=new WeakMap,qN=new WeakMap,XN=new WeakMap,YN=new WeakMap,KN=new WeakMap,ZN=new WeakMap,MN=new WeakSet,JN=function(e){var t,n,i,r,a;e?($N(this,GN,new wN(eD(this,RN,"f"),eD(this,NN,"f").time,(e=>{var t,n,i;$N(this,FN,Math.max(0,Math.min(eD(this,WN,"f"),e.time)),"f");const r=Math.round(1e3*eD(this,FN,"f"));eD(this,MN,"m",QN).call(this,r),eD(this,ON,"f").update(0),null!=eD(this,GN,"f")&&(eD(this,GN,"f").time=new rp(r)),null===(t=eD(this,qN,"f"))||void 0===t||t.update(eD(this,ON,"f").getControls()),null===(n=eD(this,XN,"f"))||void 0===n||n.update(eD(this,ON,"f")),null===(i=eD(this,YN,"f"))||void 0===i||i.update(eD(this,ON,"f"))}),eD(this,zN,"f")),"f"),$N(this,jN,new SN(eD(this,RN,"f"),eD(this,LN,"f"),eD(this,DN,"f")),"f"),$N(this,qN,new JI,"f"),$N(this,XN,new AE(eD(this,IN,"f")),"f"),eD(this,XN,"f").setOverridePosition(!1),$N(this,YN,new sx(eD(this,LN,"f"),eD(this,IN,"f"),null,!0),"f"),eD(this,YN,"f").setOverridePosition(!1)):(null===(t=eD(this,GN,"f"))||void 0===t||t.dispose(),$N(this,GN,null,"f"),null===(n=eD(this,jN,"f"))||void 0===n||n.dispose(),$N(this,jN,null,"f"),null===(i=eD(this,qN,"f"))||void 0===i||i.dispose(),$N(this,qN,null,"f"),null===(r=eD(this,XN,"f"))||void 0===r||r.dispose(),$N(this,XN,null,"f"),null===(a=eD(this,YN,"f"))||void 0===a||a.dispose(),$N(this,YN,null,"f"))},QN=function(e){if(eD(this,ON,"f").getTotalTime().numberOfFrames!=e){const t=eD(this,UN,"f").getFrame(e);null!=t&&eD(this,ON,"f").setCarState(t)}};const tD=class{constructor(e,t,n,i,r,a,o,s,l,c){MN.add(this),TN.set(this,void 0),AN.set(this,void 0),CN.set(this,void 0),PN.set(this,void 0),RN.set(this,void 0),LN.set(this,void 0),IN.set(this,void 0),NN.set(this,void 0),DN.set(this,void 0),UN.set(this,void 0),BN.set(this,null),ON.set(this,void 0),zN.set(this,!1),FN.set(this,0),WN.set(this,0),HN.set(this,void 0),VN.set(this,!0),GN.set(this,void 0),jN.set(this,void 0),qN.set(this,void 0),XN.set(this,void 0),YN.set(this,void 0),KN.set(this,void 0),ZN.set(this,void 0),$N(this,TN,e,"f"),$N(this,AN,t,"f"),$N(this,CN,i,"f"),$N(this,PN,r,"f"),$N(this,RN,a,"f"),$N(this,LN,o,"f"),$N(this,IN,s,"f"),$N(this,NN,l,"f"),$N(this,DN,c,"f"),t.loadTrackData(n),t.generateMeshes(),i.generateMountains(t.getBounds());const h=t.getStartTransform();if(null==h)throw"Track has no starting point";$N(this,UN,new NS,"f");const d=e.createCar(h,eD(this,CN,"f").getMountainVertices(),eD(this,CN,"f").getMountainOffset(),eD(this,AN,"f").getTrackData(),l.recording,(t=>{eD(this,UN,"f").push(t),null!=eD(this,BN,"f")&&t.totalFrames>=l.time.numberOfFrames&&(e.deleteCar(eD(this,BN,"f")),$N(this,BN,null,"f"))}));eD(this,UN,"f").push(d),e.startCar(d.id,l.time),$N(this,BN,d.id,"f"),$N(this,WN,l.time.time,"f"),$N(this,ON,new Uv(null,h,l.recording,null,!0,r,a,i,t,s),"f"),eD(this,ON,"f").setColors(l.carColors),r.setCamera(eD(this,ON,"f").cameraOrbit),$N(this,HN,new pS(s),"f"),eD(this,HN,"f").addToggleListener((e=>{e?r.setCamera(eD(this,HN,"f").camera):null!=eD(this,ON,"f")&&r.setCamera(eD(this,ON,"f").cameraOrbit)})),eD(this,MN,"m",JN).call(this,!0),window.addEventListener("keydown",$N(this,KN,(e=>{if(eD(this,HN,"f").enabled||("Escape"==e.code?(c(),e.preventDefault()):s.checkKeyBinding(e,Lb.VehicleReset)?($N(this,FN,0,"f"),e.preventDefault()):eD(this,IN,"f").checkKeyBinding(e,Lb.VehicleCockpitCamera)&&(e.repeat||null==eD(this,ON,"f")||eD(this,ON,"f").hasFinished()||(eD(this,IN,"f").getSettingBoolean(Jh.CockpitCameraToggle)?eD(this,PN,"f").camera==eD(this,ON,"f").cameraOrbit?eD(this,PN,"f").setCamera(eD(this,ON,"f").cameraCockpit):eD(this,PN,"f").setCamera(eD(this,ON,"f").cameraOrbit):eD(this,PN,"f").setCamera(eD(this,ON,"f").cameraCockpit)),e.preventDefault())),s.checkKeyBinding(e,Lb.ToggleUI)&&($N(this,VN,!eD(this,VN,"f"),"f"),eD(this,MN,"m",JN).call(this,eD(this,VN,"f")),e.preventDefault()),s.checkKeyBinding(e,Lb.ToggleSpectatorCamera)){eD(this,HN,"f").camera.position.copy(eD(this,PN,"f").camera.position);const t=new _i(0,0,0,"YXZ").setFromQuaternion(eD(this,PN,"f").camera.quaternion);t.z=0,eD(this,HN,"f").camera.quaternion.setFromEuler(t),eD(this,HN,"f").toggle(),e.preventDefault()}"Space"==e.code&&($N(this,zN,!eD(this,zN,"f"),"f"),null!=eD(this,GN,"f")&&(eD(this,GN,"f").isPaused=eD(this,zN,"f")),e.preventDefault())}),"f")),window.addEventListener("keyup",$N(this,ZN,(e=>{eD(this,HN,"f").enabled||eD(this,IN,"f").checkKeyBinding(e,Lb.VehicleCockpitCamera)&&(eD(this,ON,"f").hasFinished()||eD(this,IN,"f").getSettingBoolean(Jh.CockpitCameraToggle)||eD(this,PN,"f").setCamera(eD(this,ON,"f").cameraOrbit))}),"f"))}dispose(){eD(this,AN,"f").clear(),eD(this,CN,"f").clearMountains(),null!=eD(this,BN,"f")&&(eD(this,TN,"f").deleteCar(eD(this,BN,"f")),$N(this,BN,null,"f")),eD(this,ON,"f").dispose(),eD(this,HN,"f").dispose(),eD(this,MN,"m",JN).call(this,!1),window.removeEventListener("keydown",eD(this,KN,"f")),window.removeEventListener("keyup",eD(this,ZN,"f"))}update(e){var t,n,i,r,a;null!=eD(this,GN,"f")&&$N(this,zN,eD(this,GN,"f").isPaused,"f");const o=eD(this,UN,"f").getLastFrame();let s;if(eD(this,zN,"f")||(null===(t=eD(this,GN,"f"))||void 0===t?void 0:t.isDragging))s=0,eD(this,ON,"f").audioVolume=0;else{const t=Math.min(eD(this,WN,"f"),eD(this,FN,"f")+e);o.time>=t?($N(this,FN,t,"f"),eD(this,FN,"f")==eD(this,WN,"f")&&(null!=eD(this,GN,"f")&&(eD(this,GN,"f").isPaused=!0),$N(this,zN,!0,"f")),s=e,eD(this,ON,"f").audioVolume=1):(s=0,eD(this,ON,"f").audioVolume=0)}const l=Math.round(1e3*eD(this,FN,"f")),c=Math.min(l,eD(this,UN,"f").getLastFrame().numberOfFrames);if((null===(n=eD(this,GN,"f"))||void 0===n?void 0:n.isDragging)||c<eD(this,ON,"f").getTotalTime().numberOfFrames||c>eD(this,ON,"f").getTotalTime().numberOfFrames+1e3)eD(this,MN,"m",QN).call(this,c);else{for(let e=eD(this,ON,"f").getTotalTime().numberOfFrames+1;e<=c;e++)eD(this,MN,"m",QN).call(this,e)}null!=eD(this,GN,"f")&&(eD(this,GN,"f").time=eD(this,ON,"f").getTotalTime(),eD(this,GN,"f").loadedTime=o),null===(i=eD(this,qN,"f"))||void 0===i||i.update(eD(this,ON,"f").getControls()),null===(r=eD(this,XN,"f"))||void 0===r||r.update(eD(this,ON,"f")),null===(a=eD(this,YN,"f"))||void 0===a||a.update(eD(this,ON,"f")),eD(this,ON,"f").update(s),eD(this,HN,"f").update(e),eD(this,PN,"f").update(eD(this,ON,"f").getPosition()),eD(this,RN,"f").update(e,!1,eD(this,PN,"f"),eD(this,IN,"f"))}};var nD,iD,rD=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n},aD=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};nD=new WeakMap,iD=new WeakMap;const oD=class{constructor(){nD.set(this,!1),iD.set(this,[]),window.addEventListener("touchstart",(()=>{rD(this,nD,!0,"f"),aD(this,iD,"f").forEach((e=>e(aD(this,nD,"f"))))})),window.addEventListener("keydown",(()=>{rD(this,nD,!1,"f"),aD(this,iD,"f").forEach((e=>e(aD(this,nD,"f"))))}))}get touchEnabled(){return aD(this,nD,"f")}addChangeListener(e){aD(this,iD,"f").push(e),e(aD(this,nD,"f"))}removeChangeListener(e){const t=aD(this,iD,"f").indexOf(e);t>=0&&aD(this,iD,"f").splice(t,1)}};var sD=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))};function lD(){try{window.CrazyGames?window.CrazyGames.SDK.game.gameplayStart():window.PokiSDK&&window.PokiSDK.gameplayStart()}catch(e){console.error(e)}}function cD(){try{window.CrazyGames?window.CrazyGames.SDK.game.gameplayStop():window.PokiSDK&&window.PokiSDK.gameplayStop()}catch(e){console.error(e)}}function hD(){try{window.CrazyGames?window.CrazyGames.SDK.game.loadingStart():window.PokiSDK}catch(e){console.error(e)}}function dD(){try{window.CrazyGames?window.CrazyGames.SDK.game.loadingStop():window.PokiSDK}catch(e){console.error(e)}}function uD(e){return new Promise(((t,n)=>{try{window.CrazyGames?window.CrazyGames.SDK.ad.requestAd("midgame",{adFinished:t,adError:n,adStarted:e}):window.PokiSDK?window.PokiSDK.commercialBreak().then(t).catch(n):t()}catch(e){n(e)}}))}
/**
* @license
* Copyright 2024 Kodub.com
*/
bn.enabled=!1,function(){const e=new AP;e.addResource(),function(){return sD(this,void 0,void 0,(function*(){try{window.CrazyGames?yield window.CrazyGames.SDK.init():window.PokiSDK&&(yield window.PokiSDK.init())}catch(e){console.error(e)}}))}().then((()=>{e.loadedResource()})),e.addCompleteListener((()=>{!function(){try{window.CrazyGames?window.CrazyGames.SDK.game.loadingStop():window.PokiSDK&&window.PokiSDK.gameLoadingFinished()}catch(e){console.error(e)}}()})),e.preloadImage("images/apply.svg"),e.preloadImage("images/arrow_down.svg"),e.preloadImage("images/arrow_left.svg"),e.preloadImage("images/arrow_right.svg"),e.preloadImage("images/arrow_up.svg"),e.preloadImage("images/back.svg"),e.preloadImage("images/cancel.svg"),e.preloadImage("images/car_stripe.svg"),e.preloadImage("images/checkpoint.svg"),e.preloadImage("images/clouds.jpg"),e.preloadImage("images/copy.svg"),e.preloadImage("images/customize.svg"),e.preloadImage("images/delete.svg"),e.preloadImage("images/discord.svg"),e.preloadImage("images/editor.svg"),e.preloadImage("images/erase.svg"),e.preloadImage("images/export.svg"),e.preloadImage("images/helmet.svg"),e.preloadImage("images/help.svg"),e.preloadImage("images/icon.svg"),e.preloadImage("images/import.svg"),e.preloadImage("images/load.svg"),e.preloadImage("images/logo.svg"),e.preloadImage("images/pause.svg"),e.preloadImage("images/pin.svg"),e.preloadImage("images/play.svg"),e.preloadImage("images/preview.svg"),e.preloadImage("images/quit.svg"),e.preloadImage("images/random.svg"),e.preloadImage("images/reset_settings.svg"),e.preloadImage("images/reset.svg"),e.preloadImage("images/rotate.svg"),e.preloadImage("images/save.svg"),e.preloadImage("images/settings.svg"),e.preloadImage("images/smoke.png"),e.preloadImage("images/state_invalid.svg"),e.preloadImage("images/state_pending.svg"),e.preloadImage("images/state_verified.svg"),e.preloadImage("images/test.svg"),e.preloadImage("images/verified.svg");const t=new sR,n=new iL,i=new hd(e);i.load("music",["audio/music.mp3","audio/music.flac"]),i.load("click",["audio/click.flac"]),i.load("engine",["audio/engine.flac"]),i.load("suspension",["audio/suspension.flac"]),i.load("tires",["audio/tires.flac"]),i.load("collision",["audio/collision.flac"]),i.load("skidding",["audio/skidding.flac"]),i.load("editor_edit",["audio/editor_edit.flac"]),i.load("checkpoint",["audio/checkpoint.flac"]),i.load("finish",["audio/checkpoint.flac"]),Ou.initResources(e),Uv.initResources(e),rb.initResources(e);const r=new rR(e),a=new qR;a.migrate(r),e.addResource();const o=new PL(r,e),s=new PL(r,e);o.testDeterminism().then((t=>{d.submitAllowed=t,e.loadedResource()}));const l=new wL(a),c=new FI(l.getSetting(Jh.Language)),h=new ER(a),d=new hL(h);h.syncUserProfile(d);const u=new OP(a,d,h),p=document.getElementById("screen"),f=new HM(p,l),m=new uR(f,l,e),g=new iT(f),v=new Ky(f,l,r),w=new YP(e,r,a),y=new ny,b=new xP(i),x=new oD,_=()=>{t.trigger((()=>{cD(),hD(),A.dispose(),A=new sP(o,v,r,g,w,c,b,h,u,f,i,a,l,d,e,k,E,S,M,T),dD()}))},k=()=>{t.trigger((()=>{cD(),hD(),A.dispose(),A=new Xw(o,c,v,g,f,i,h,l,d,_),dD()}))},E=()=>{t.trigger((()=>{hD(),A.dispose();const p=A=new Gk(v,r,c,i,f,l,t,h,u,a,w,b,x,(()=>{A.dispose(),A=new sP(o,v,r,g,w,c,b,h,u,f,i,a,l,d,e,k,E,S,M,T)}),((e,t,r)=>{const a=A=new PM(o,s,v,g,c,f,i,h,l,n,x,e,t,{recording:null,carColors:null,name:null,time:null,isSelf:!0},null,(()=>{}),(()=>{a.dispose(!1),A=p,r()}))}));return dD(),lD(),p.isPaused=!0,uD((()=>{i.mute()})).finally((()=>{i.unmute(),p.isPaused=!1}))}))},S=(e,a,d)=>{t.trigger((()=>{hD(),A.dispose();const t=h.profileSlot,p=u.getRecordTime(t,a.getId(r)),m=A=new PM(o,s,v,g,c,f,i,h,l,n,x,e,a,d,p,((e,n,i,r)=>{if(null!=e){const a=u.getRecordTime(t,e);(null==a||i.lessThan(a))&&u.setRecord(t,e,i,n,r)}}),_);return dD(),lD(),m.isPaused=!0,uD((()=>{i.mute()})).finally((()=>{i.unmute(),m.isPaused=!1}))}))},M=(e,n)=>{t.trigger((()=>{hD(),A.dispose(),A=new tD(o,v,e,g,f,i,c,l,n,_),dD(),lD()}))},T=n=>{t.trigger((()=>{hD(),A.dispose(),A=new gI(i,f,d,w,r,l,e,n,_),dD(),lD()}))};let A=new sP(o,v,r,g,w,c,b,h,u,f,i,a,l,d,e,k,E,S,M,T),C=0;f.setAnimationLoop((function(e){const t=Math.max(e-C,0)/1e3;C=e,A.update(t),m.update(t,f.camera),g.update(),y.update(t)})),window.addEventListener("keyup",(function(e){l.checkKeyBinding(e,Lb.ToggleFpsCounter)&&y.toggle()}))}()})()})();